/home/crealab/.cagefs/tmp/phpUeOCti
/* Header with interface version macros for library pieces copied elsewhere.
Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GNU_VERSIONS_H
#define _GNU_VERSIONS_H 1
/* This file exists to define these few macros. Each specifies a version
number associated with the library interface of a piece of the C library
which is also distributed with other GNU packages. These pieces are
both part of the GNU C library and also distributed with other GNU
packages so those packages may use their facilities on systems lacking
the GNU C library. The source files for each piece surround all their
code with `#ifndef ELIDE_CODE' after defining it with this:
#define OBSTACK_INTERFACE_VERSION 1
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
#include <gnu-versions.h>
#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
This allows those one to avoid compiling those files when part of a GNU
package not libc, on a system using a GNU C library that supports the
same interface.
Please preserve the format of the comments after each macro. And
remember, if any of these versions change, the libc.so major version
number must change too (so avoid it)! */
#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */
#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */
#define _GNU_GLOB_INTERFACE_VERSION 2 /* vs posix/glob.c */
#define _GNU_GETOPT_INTERFACE_VERSION 2 /* vs posix/getopt.c and
posix/getopt1.c */
#endif /* gnu-versions.h */
#ifndef _GDFONTS_H_
#define _GDFONTS_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
/*
This is a header file for gd font, generated using
bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
from bdf font
-misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2
at Thu Jan 8 14:13:20 1998.
No copyright info was found in the original bdf.
*/
#include "gd.h"
extern BGD_EXPORT_DATA_PROT gdFontPtr gdFontSmall;
BGD_DECLARE(gdFontPtr) gdFontGetSmall(void);
#ifdef __cplusplus
}
#endif
#endif
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
#ifndef _PCREPOSIX_H
#define _PCREPOSIX_H
/* This is the header for the POSIX wrapper interface to the PCRE Perl-
Compatible Regular Expression library. It defines the things POSIX says should
be there. I hope.
Copyright (c) 1997-2012 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* Have to include stdlib.h in order to ensure that size_t is defined. */
#include <stdlib.h>
/* Allow for C++ users */
#ifdef __cplusplus
extern "C" {
#endif
/* Options, mostly defined by POSIX, but with some extras. */
#define REG_ICASE 0x0001 /* Maps to PCRE_CASELESS */
#define REG_NEWLINE 0x0002 /* Maps to PCRE_MULTILINE */
#define REG_NOTBOL 0x0004 /* Maps to PCRE_NOTBOL */
#define REG_NOTEOL 0x0008 /* Maps to PCRE_NOTEOL */
#define REG_DOTALL 0x0010 /* NOT defined by POSIX; maps to PCRE_DOTALL */
#define REG_NOSUB 0x0020 /* Maps to PCRE_NO_AUTO_CAPTURE */
#define REG_UTF8 0x0040 /* NOT defined by POSIX; maps to PCRE_UTF8 */
#define REG_STARTEND 0x0080 /* BSD feature: pass subject string by so,eo */
#define REG_NOTEMPTY 0x0100 /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */
#define REG_UNGREEDY 0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */
#define REG_UCP 0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */
/* This is not used by PCRE, but by defining it we make it easier
to slot PCRE into existing programs that make POSIX calls. */
#define REG_EXTENDED 0
/* Error values. Not all these are relevant or used by the wrapper. */
enum {
REG_ASSERT = 1, /* internal error ? */
REG_BADBR, /* invalid repeat counts in {} */
REG_BADPAT, /* pattern error */
REG_BADRPT, /* ? * + invalid */
REG_EBRACE, /* unbalanced {} */
REG_EBRACK, /* unbalanced [] */
REG_ECOLLATE, /* collation error - not relevant */
REG_ECTYPE, /* bad class */
REG_EESCAPE, /* bad escape sequence */
REG_EMPTY, /* empty expression */
REG_EPAREN, /* unbalanced () */
REG_ERANGE, /* bad range inside [] */
REG_ESIZE, /* expression too big */
REG_ESPACE, /* failed to get memory */
REG_ESUBREG, /* bad back reference */
REG_INVARG, /* bad argument */
REG_NOMATCH /* match failed */
};
/* The structure representing a compiled regular expression. */
typedef struct {
void *re_pcre;
size_t re_nsub;
size_t re_erroffset;
} regex_t;
/* The structure in which a captured offset is returned. */
typedef int regoff_t;
typedef struct {
regoff_t rm_so;
regoff_t rm_eo;
} regmatch_t;
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE, the appropriate
export settings are needed, and are set in pcreposix.c before including this
file. */
#if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL)
# define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
# define PCREPOSIX_EXP_DEFN __declspec(dllimport)
#endif
/* By default, we use the standard "extern" declarations. */
#ifndef PCREPOSIX_EXP_DECL
# ifdef __cplusplus
# define PCREPOSIX_EXP_DECL extern "C"
# define PCREPOSIX_EXP_DEFN extern "C"
# else
# define PCREPOSIX_EXP_DECL extern
# define PCREPOSIX_EXP_DEFN extern
# endif
#endif
/* The functions */
PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
regmatch_t *, int);
PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
PCREPOSIX_EXP_DECL void regfree(regex_t *);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* End of pcreposix.h */
/****************************************************************************
* Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: form.h,v 0.27 2017/02/11 16:35:42 tom Exp $ */
#ifndef FORM_H
#define FORM_H
/* *INDENT-OFF*/
#include <curses.h>
#include <eti.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef FORM_PRIV_H
typedef void *FIELD_CELL;
#endif
#ifndef NCURSES_FIELD_INTERNALS
#define NCURSES_FIELD_INTERNALS /* nothing */
#endif
typedef int Form_Options;
typedef int Field_Options;
/**********
* _PAGE *
**********/
typedef struct pagenode
#if !NCURSES_OPAQUE_FORM
{
short pmin; /* index of first field on page */
short pmax; /* index of last field on page */
short smin; /* index of top leftmost field on page */
short smax; /* index of bottom rightmost field on page */
}
#endif /* !NCURSES_OPAQUE_FORM */
_PAGE;
/**********
* FIELD *
**********/
typedef struct fieldnode
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
{
unsigned short status; /* flags */
short rows; /* size in rows */
short cols; /* size in cols */
short frow; /* first row */
short fcol; /* first col */
int drows; /* dynamic rows */
int dcols; /* dynamic cols */
int maxgrow; /* maximum field growth */
int nrow; /* off-screen rows */
short nbuf; /* additional buffers */
short just; /* justification */
short page; /* page on form */
short index; /* into form -> field */
int pad; /* pad character */
chtype fore; /* foreground attribute */
chtype back; /* background attribute */
Field_Options opts; /* options */
struct fieldnode * snext; /* sorted order pointer */
struct fieldnode * sprev; /* sorted order pointer */
struct fieldnode * link; /* linked field chain */
struct formnode * form; /* containing form */
struct typenode * type; /* field type */
void * arg; /* argument for type */
FIELD_CELL * buf; /* field buffers */
void * usrptr; /* user pointer */
/*
* The wide-character configuration requires extra information. Because
* there are existing applications that manipulate the members of FIELD
* directly, we cannot make the struct opaque, except by changing the ABI.
* Offsets of members up to this point are the same in the narrow- and
* wide-character configuration. But note that the type of buf depends on
* the configuration, and is made opaque for that reason.
*/
NCURSES_FIELD_INTERNALS
}
#endif /* NCURSES_OPAQUE_FORM */
FIELD;
/*********
* FORM *
*********/
typedef struct formnode
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
{
unsigned short status; /* flags */
short rows; /* size in rows */
short cols; /* size in cols */
int currow; /* current row in field window */
int curcol; /* current col in field window */
int toprow; /* in scrollable field window */
int begincol; /* in horiz. scrollable field */
short maxfield; /* number of fields */
short maxpage; /* number of pages */
short curpage; /* index into page */
Form_Options opts; /* options */
WINDOW * win; /* window */
WINDOW * sub; /* subwindow */
WINDOW * w; /* window for current field */
FIELD ** field; /* field [maxfield] */
FIELD * current; /* current field */
_PAGE * page; /* page [maxpage] */
void * usrptr; /* user pointer */
void (*forminit)(struct formnode *);
void (*formterm)(struct formnode *);
void (*fieldinit)(struct formnode *);
void (*fieldterm)(struct formnode *);
}
#endif /* !NCURSES_OPAQUE_FORM */
FORM;
/**************
* FIELDTYPE *
**************/
typedef struct typenode
#if !NCURSES_OPAQUE_FORM
{
unsigned short status; /* flags */
long ref; /* reference count */
struct typenode * left; /* ptr to operand for | */
struct typenode * right; /* ptr to operand for | */
void* (*makearg)(va_list *); /* make fieldtype arg */
void* (*copyarg)(const void *); /* copy fieldtype arg */
void (*freearg)(void *); /* free fieldtype arg */
#if NCURSES_INTEROP_FUNCS
union {
bool (*ofcheck)(FIELD *,const void *); /* field validation */
bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
} fieldcheck;
union {
bool (*occheck)(int,const void *); /* character validation */
bool (*gccheck)(int,FORM*,
FIELD*,const void*); /* generic char validation */
} charcheck;
union {
bool (*onext)(FIELD *,const void *); /* enumerate next value */
bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
} enum_next;
union {
bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
} enum_prev;
void* (*genericarg)(void*); /* Alternate Arg method */
#else
bool (*fcheck)(FIELD *,const void *); /* field validation */
bool (*ccheck)(int,const void *); /* character validation */
bool (*next)(FIELD *,const void *); /* enumerate next value */
bool (*prev)(FIELD *,const void *); /* enumerate prev value */
#endif
}
#endif /* !NCURSES_OPAQUE_FORM */
FIELDTYPE;
typedef void (*Form_Hook)(FORM *);
/***************************
* miscellaneous #defines *
***************************/
/* field justification */
#define NO_JUSTIFICATION (0)
#define JUSTIFY_LEFT (1)
#define JUSTIFY_CENTER (2)
#define JUSTIFY_RIGHT (3)
/* field options */
#define O_VISIBLE (0x0001U)
#define O_ACTIVE (0x0002U)
#define O_PUBLIC (0x0004U)
#define O_EDIT (0x0008U)
#define O_WRAP (0x0010U)
#define O_BLANK (0x0020U)
#define O_AUTOSKIP (0x0040U)
#define O_NULLOK (0x0080U)
#define O_PASSOK (0x0100U)
#define O_STATIC (0x0200U)
#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */
#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */
/* form options */
#define O_NL_OVERLOAD (0x0001U)
#define O_BS_OVERLOAD (0x0002U)
/* form driver commands */
#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */
#if defined(MAX_COMMAND)
# if (MAX_FORM_COMMAND > MAX_COMMAND)
# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
# elif (MAX_COMMAND != (KEY_MAX + 128))
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
# endif
#else
# define MAX_COMMAND (KEY_MAX + 128)
#endif
/*************************
* standard field types *
*************************/
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
/************************************
* built-in additional field types *
* They are not defined in SVr4 *
************************************/
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
/***********************
* FIELDTYPE routines *
***********************/
extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
bool (* const field_check)(FIELD *,const void *),
bool (* const char_check)(int,const void *));
extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(
FIELDTYPE *, FIELDTYPE *);
extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *);
extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
void * (* const make_arg)(va_list *),
void * (* const copy_arg)(const void *),
void (* const free_arg)(void *));
extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
bool (* const next_choice)(FIELD *,const void *),
bool (* const prev_choice)(FIELD *,const void *));
/*******************
* FIELD routines *
*******************/
extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int);
extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int);
extern NCURSES_EXPORT(int) free_field (FIELD *);
extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int);
extern NCURSES_EXPORT(int) move_field (FIELD *,int,int);
extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool);
extern NCURSES_EXPORT(int) set_field_just (FIELD *,int);
extern NCURSES_EXPORT(int) field_just (const FIELD *);
extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype);
extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype);
extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int);
extern NCURSES_EXPORT(int) field_pad (const FIELD *);
extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool);
extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *);
extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options);
extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options);
extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options);
extern NCURSES_EXPORT(chtype) field_fore (const FIELD *);
extern NCURSES_EXPORT(chtype) field_back (const FIELD *);
extern NCURSES_EXPORT(bool) new_page (const FIELD *);
extern NCURSES_EXPORT(bool) field_status (const FIELD *);
extern NCURSES_EXPORT(void *) field_arg (const FIELD *);
extern NCURSES_EXPORT(void *) field_userptr (const FIELD *);
extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *);
extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int);
extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *);
/******************
* FORM routines *
******************/
extern NCURSES_EXPORT(FORM *) new_form (FIELD **);
extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *);
extern NCURSES_EXPORT(FIELD *) current_field (const FORM *);
extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *);
extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *);
extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *);
extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *);
extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *);
extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *);
extern NCURSES_EXPORT(int) free_form (FORM *);
extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **);
extern NCURSES_EXPORT(int) field_count (const FORM *);
extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *);
extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *);
extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *);
extern NCURSES_EXPORT(int) unfocus_current_field (FORM *);
extern NCURSES_EXPORT(int) field_index (const FIELD *);
extern NCURSES_EXPORT(int) set_form_page (FORM *,int);
extern NCURSES_EXPORT(int) form_page (const FORM *);
extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *);
extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) post_form (FORM *);
extern NCURSES_EXPORT(int) unpost_form (FORM *);
extern NCURSES_EXPORT(int) pos_form_cursor (FORM *);
extern NCURSES_EXPORT(int) form_driver (FORM *,int);
# if NCURSES_WIDECHAR
extern NCURSES_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
# endif
extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *);
extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_request_by_name (const char *);
extern NCURSES_EXPORT(const char *) form_request_name (int);
extern NCURSES_EXPORT(void *) form_userptr (const FORM *);
extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *);
extern NCURSES_EXPORT(bool) data_ahead (const FORM *);
extern NCURSES_EXPORT(bool) data_behind (const FORM *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
#endif
#ifdef __cplusplus
}
#endif
/* *INDENT-ON*/
#endif /* FORM_H */
/* Functions for pseudo TTY handling.
Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _PTY_H
#define _PTY_H 1
#include <features.h>
struct termios;
struct winsize;
#include <termios.h>
#include <sys/ioctl.h>
__BEGIN_DECLS
/* Create pseudo tty master slave pair with NAME and set terminal
attributes according to TERMP and WINP and return handles for both
ends in AMASTER and ASLAVE. */
extern int openpty (int *__amaster, int *__aslave, char *__name,
const struct termios *__termp,
const struct winsize *__winp) __THROW;
/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
extern int forkpty (int *__amaster, char *__name,
const struct termios *__termp,
const struct winsize *__winp) __THROW;
__END_DECLS
#endif /* pty.h */
/****************************************************************************
* Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
#define CURSES 1
#define CURSES_H 1
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 6
#define NCURSES_VERSION_MINOR 1
#define NCURSES_VERSION_PATCH 20180224
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.1"
/*
* Identify the mouse encoding version.
*/
#define NCURSES_MOUSE_VERSION 2
/*
* Definitions to facilitate DLL's.
*/
#include <ncurses_dll.h>
#if 1
#include <stdint.h>
#endif
/*
* User-definable tweak to disable the include of <stdbool.h>.
*/
#ifndef NCURSES_ENABLE_STDBOOL_H
#define NCURSES_ENABLE_STDBOOL_H 1
#endif
/*
* NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
* configured using --disable-macros.
*/
#ifndef NCURSES_ATTR_T
#define NCURSES_ATTR_T int
#endif
/*
* Expands to 'const' if ncurses is configured using --enable-const. Note that
* doing so makes it incompatible with other implementations of X/Open Curses.
*/
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_INLINE
#define NCURSES_INLINE inline
/*
* The standard type used for color values, and for color-pairs. The latter
* allows the curses library to enumerate the combinations of foreground and
* background colors used by an application, and is normally the product of the
* total foreground and background colors.
*
* X/Open uses "short" for both of these types, ultimately because they are
* numbers from the SVr4 terminal database, which uses 16-bit signed values.
*/
#undef NCURSES_COLOR_T
#define NCURSES_COLOR_T short
#undef NCURSES_PAIRS_T
#define NCURSES_PAIRS_T short
/*
* Definitions used to make WINDOW and similar structs opaque.
*/
#ifndef NCURSES_INTERNALS
#define NCURSES_OPAQUE 0
#define NCURSES_OPAQUE_FORM 0
#define NCURSES_OPAQUE_MENU 0
#define NCURSES_OPAQUE_PANEL 0
#endif
/*
* Definition used to optionally suppress wattr* macros to help with the
* transition from ncurses5 to ncurses6 by allowing the header files to
* be shared across development packages for ncursesw in both ABIs.
*/
#ifndef NCURSES_WATTR_MACROS
#define NCURSES_WATTR_MACROS 0
#endif
/*
* The reentrant code relies on the opaque setting, but adds features.
*/
#ifndef NCURSES_REENTRANT
#define NCURSES_REENTRANT 0
#endif
/*
* Control whether bindings for interop support are added.
*/
#undef NCURSES_INTEROP_FUNCS
#define NCURSES_INTEROP_FUNCS 1
/*
* The internal type used for window dimensions.
*/
#undef NCURSES_SIZE_T
#define NCURSES_SIZE_T short
/*
* Control whether tparm() supports varargs or fixed-parameter list.
*/
#undef NCURSES_TPARM_VARARGS
#define NCURSES_TPARM_VARARGS 1
/*
* Control type used for tparm's arguments. While X/Open equates long and
* char* values, this is not always workable for 64-bit platforms.
*/
#undef NCURSES_TPARM_ARG
#define NCURSES_TPARM_ARG intptr_t
/*
* Control whether ncurses uses wcwidth() for checking width of line-drawing
* characters.
*/
#undef NCURSES_WCWIDTH_GRAPHICS
#define NCURSES_WCWIDTH_GRAPHICS 1
/*
* NCURSES_CH_T is used in building the library, but not used otherwise in
* this header file, since that would make the normal/wide-character versions
* of the header incompatible.
*/
#undef NCURSES_CH_T
#define NCURSES_CH_T cchar_t
#if 1 && defined(_LP64)
typedef unsigned chtype;
typedef unsigned mmask_t;
#else
typedef uint32_t chtype;
typedef uint32_t mmask_t;
#endif
/*
* We need FILE, etc. Include this before checking any feature symbols.
*/
#include <stdio.h>
/*
* With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
* conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is
* not already defined, e.g., if the platform relies upon nonstandard feature
* test macros, define it at this point if the standard feature test macros
* indicate that it should be defined.
*/
#ifndef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
#define NCURSES_WIDECHAR 1
#else
#define NCURSES_WIDECHAR 0
#endif
#endif /* NCURSES_WIDECHAR */
#include <stdarg.h> /* we need va_list */
#if NCURSES_WIDECHAR
#include <stddef.h> /* we want wchar_t */
#endif
/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also
* implement it. If so, we must use the C++ compiler's type to avoid conflict
* with other interfaces.
*
* A further complication is that <stdbool.h> may declare 'bool' to be a
* different type, such as an enum which is not necessarily compatible with
* C++. If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
* Otherwise, let it remain a typedef to avoid conflicts with other #define's.
* In either case, make a typedef for NCURSES_BOOL which can be used if needed
* from either C or C++.
*/
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0
typedef unsigned char NCURSES_BOOL;
#if defined(__cplusplus) /* __cplusplus, etc. */
/* use the C++ compiler's bool type */
#define NCURSES_BOOL bool
#else /* c89, c99, etc. */
#if NCURSES_ENABLE_STDBOOL_H
#include <stdbool.h>
/* use whatever the C compiler decides bool really is */
#define NCURSES_BOOL bool
#else
/* there is no predefined bool - use our own */
#undef bool
#define bool NCURSES_BOOL
#endif
#endif /* !__cplusplus, etc. */
#ifdef __cplusplus
extern "C" {
#define NCURSES_CAST(type,value) static_cast<type>(value)
#else
#define NCURSES_CAST(type,value) (type)(value)
#endif
#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p)))
/*
* X/Open attributes. In the ncurses implementation, they are identical to the
* A_ attributes.
*/
#define WA_ATTRIBUTES A_ATTRIBUTES
#define WA_NORMAL A_NORMAL
#define WA_STANDOUT A_STANDOUT
#define WA_UNDERLINE A_UNDERLINE
#define WA_REVERSE A_REVERSE
#define WA_BLINK A_BLINK
#define WA_DIM A_DIM
#define WA_BOLD A_BOLD
#define WA_ALTCHARSET A_ALTCHARSET
#define WA_INVIS A_INVIS
#define WA_PROTECT A_PROTECT
#define WA_HORIZONTAL A_HORIZONTAL
#define WA_LEFT A_LEFT
#define WA_LOW A_LOW
#define WA_RIGHT A_RIGHT
#define WA_TOP A_TOP
#define WA_VERTICAL A_VERTICAL
#if 1
#define WA_ITALIC A_ITALIC /* ncurses extension */
#endif
/* colors */
#define COLOR_BLACK 0
#define COLOR_RED 1
#define COLOR_GREEN 2
#define COLOR_YELLOW 3
#define COLOR_BLUE 4
#define COLOR_MAGENTA 5
#define COLOR_CYAN 6
#define COLOR_WHITE 7
/* line graphics */
#if 0 || NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(chtype*, acs_map);
#define acs_map NCURSES_PUBLIC_VAR(acs_map())
#else
extern NCURSES_EXPORT_VAR(chtype) acs_map[];
#endif
#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))])
/* VT100 symbols begin here */
#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */
#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */
#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */
#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */
#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */
#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */
#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */
#define ACS_VLINE NCURSES_ACS('x') /* vertical line */
#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */
#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */
#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */
#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */
#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */
#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */
#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */
#define ACS_BULLET NCURSES_ACS('~') /* bullet */
/* Teletype 5410v1 symbols begin here */
#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */
#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */
#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */
#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */
#define ACS_BOARD NCURSES_ACS('h') /* board of squares */
#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */
#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */
/*
* These aren't documented, but a lot of System Vs have them anyway
* (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
* The ACS_names may not match AT&T's, our source didn't know them.
*/
#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */
#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */
#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */
#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */
#define ACS_PI NCURSES_ACS('{') /* Pi */
#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */
#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */
/*
* Line drawing ACS names are of the form ACS_trbl, where t is the top, r
* is the right, b is the bottom, and l is the left. t, r, b, and l might
* be B (blank), S (single), D (double), or T (thick). The subset defined
* here only uses B and S.
*/
#define ACS_BSSB ACS_ULCORNER
#define ACS_SSBB ACS_LLCORNER
#define ACS_BBSS ACS_URCORNER
#define ACS_SBBS ACS_LRCORNER
#define ACS_SBSS ACS_RTEE
#define ACS_SSSB ACS_LTEE
#define ACS_SSBS ACS_BTEE
#define ACS_BSSS ACS_TTEE
#define ACS_BSBS ACS_HLINE
#define ACS_SBSB ACS_VLINE
#define ACS_SSSS ACS_PLUS
#undef ERR
#define ERR (-1)
#undef OK
#define OK (0)
/* values for the _flags member */
#define _SUBWIN 0x01 /* is this a sub-window? */
#define _ENDLINE 0x02 /* is the window flush right? */
#define _FULLWIN 0x04 /* is the window full-screen? */
#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */
#define _ISPAD 0x10 /* is this window a pad? */
#define _HASMOVED 0x20 /* has cursor moved since last refresh? */
#define _WRAPPED 0x40 /* cursor was just wrappped */
/*
* this value is used in the firstchar and lastchar fields to mark
* unchanged lines
*/
#define _NOCHANGE -1
/*
* this value is used in the oldindex field to mark lines created by insertions
* and scrolls.
*/
#define _NEWINDEX -1
typedef struct screen SCREEN;
typedef struct _win_st WINDOW;
typedef chtype attr_t; /* ...must be at least as wide as chtype */
#if NCURSES_WIDECHAR
#if 0
#ifdef mblen /* libutf8.h defines it w/o undefining first */
#undef mblen
#endif
#include <libutf8.h>
#endif
#if 1
#include <wchar.h> /* ...to get mbstate_t, etc. */
#endif
#if 0
typedef unsigned short wchar_t1;
#endif
#if 0
typedef unsigned int wint_t1;
#endif
/*
* cchar_t stores an array of CCHARW_MAX wide characters. The first is
* normally a spacing character. The others are non-spacing. If those
* (spacing and nonspacing) do not fill the array, a null L'\0' follows.
* Otherwise, a null is assumed to follow when extracting via getcchar().
*/
#define CCHARW_MAX 5
typedef struct
{
attr_t attr;
wchar_t chars[CCHARW_MAX];
#if 1
#undef NCURSES_EXT_COLORS
#define NCURSES_EXT_COLORS 20180224
int ext_color; /* color pair, must be more than 16-bits */
#endif
}
cchar_t;
#endif /* NCURSES_WIDECHAR */
#if !NCURSES_OPAQUE
struct ldat;
struct _win_st
{
NCURSES_SIZE_T _cury, _curx; /* current cursor position */
/* window location and size */
NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
short _flags; /* window state flags */
/* attribute tracking */
attr_t _attrs; /* current attribute for non-space character */
chtype _bkgd; /* current background char/attribute pair */
/* option values set by user */
bool _notimeout; /* no time out on function-key entry? */
bool _clear; /* consider all data in the window invalid? */
bool _leaveok; /* OK to not reset cursor on exit? */
bool _scroll; /* OK to scroll this window? */
bool _idlok; /* OK to use insert/delete line? */
bool _idcok; /* OK to use insert/delete char? */
bool _immed; /* window in immed mode? (not yet used) */
bool _sync; /* window in sync mode? */
bool _use_keypad; /* process function keys into KEY_ symbols? */
int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */
struct ldat *_line; /* the actual line data */
/* global screen state */
NCURSES_SIZE_T _regtop; /* top line of scrolling region */
NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
/* these are used only if this is a sub-window */
int _parx; /* x coordinate of this window in parent */
int _pary; /* y coordinate of this window in parent */
WINDOW *_parent; /* pointer to parent if a sub-window */
/* these are used only if this is a pad */
struct pdat
{
NCURSES_SIZE_T _pad_y, _pad_x;
NCURSES_SIZE_T _pad_top, _pad_left;
NCURSES_SIZE_T _pad_bottom, _pad_right;
} _pad;
NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
#if NCURSES_WIDECHAR
cchar_t _bkgrnd; /* current background char/attribute pair */
#if 1
int _color; /* current color-pair for non-space character */
#endif
#endif
};
#endif /* NCURSES_OPAQUE */
/*
* This is an extension to support events...
*/
#if 1
#ifdef NCURSES_WGETCH_EVENTS
#if !defined(__BEOS__) || defined(__HAIKU__)
/* Fix _nc_timed_wait() on BEOS... */
# define NCURSES_EVENT_VERSION 1
#endif /* !defined(__BEOS__) */
/*
* Bits to set in _nc_event.data.flags
*/
# define _NC_EVENT_TIMEOUT_MSEC 1
# define _NC_EVENT_FILE 2
# define _NC_EVENT_FILE_READABLE 2
# if 0 /* Not supported yet... */
# define _NC_EVENT_FILE_WRITABLE 4
# define _NC_EVENT_FILE_EXCEPTION 8
# endif
typedef struct
{
int type;
union
{
long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */
struct
{
unsigned int flags;
int fd;
unsigned int result;
} fev; /* _NC_EVENT_FILE */
} data;
} _nc_event;
typedef struct
{
int count;
int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
_nc_event *events[1];
} _nc_eventlist;
extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *); /* experimental */
extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */
#endif /* NCURSES_WGETCH_EVENTS */
#endif /* NCURSES_EXT_FUNCS */
/*
* GCC (and some other compilers) define '__attribute__'; we're using this
* macro to alert the compiler to flag inconsistencies in printf/scanf-like
* function calls. Just in case '__attribute__' isn't defined, make a dummy.
* Old versions of G++ do not accept it anyway, at least not consistently with
* GCC.
*/
#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
#define __attribute__(p) /* nothing */
#endif
/*
* We cannot define these in ncurses_cfg.h, since they require parameters to be
* passed (that is non-portable). If you happen to be using gcc with warnings
* enabled, define
* GCC_PRINTF
* GCC_SCANF
* to improve checking of calls to printw(), etc.
*/
#ifndef GCC_PRINTFLIKE
#if defined(GCC_PRINTF) && !defined(printf)
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
#else
#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
#endif
#endif
#ifndef GCC_SCANFLIKE
#if defined(GCC_SCANF) && !defined(scanf)
#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
#else
#define GCC_SCANFLIKE(fmt,var) /*nothing*/
#endif
#endif
#ifndef GCC_NORETURN
#define GCC_NORETURN /* nothing */
#endif
#ifndef GCC_UNUSED
#define GCC_UNUSED /* nothing */
#endif
/*
* Curses uses a helper function. Define our type for this to simplify
* extending it for the sp-funcs feature.
*/
typedef int (*NCURSES_OUTC)(int);
/*
* Function prototypes. This is the complete X/Open Curses list of required
* functions. Those marked `generated' will have sources generated from the
* macro definitions later in this file, in order to satisfy XPG4.2
* requirements.
*/
extern NCURSES_EXPORT(int) addch (const chtype); /* generated */
extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */
extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */
extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */
extern NCURSES_EXPORT(int) addstr (const char *); /* generated */
extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) baudrate (void); /* implemented */
extern NCURSES_EXPORT(int) beep (void); /* implemented */
extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */
extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */
extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */
extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */
extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */
extern NCURSES_EXPORT(int) cbreak (void); /* implemented */
extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) clear (void); /* generated */
extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) clrtobot (void); /* generated */
extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */
extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */
extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */
extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) curs_set (int); /* implemented */
extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */
extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */
extern NCURSES_EXPORT(int) delay_output (int); /* implemented */
extern NCURSES_EXPORT(int) delch (void); /* generated */
extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */
extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) deleteln (void); /* generated */
extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) doupdate (void); /* implemented */
extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) echo (void); /* implemented */
extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */
extern NCURSES_EXPORT(int) erase (void); /* generated */
extern NCURSES_EXPORT(int) endwin (void); /* implemented */
extern NCURSES_EXPORT(char) erasechar (void); /* implemented */
extern NCURSES_EXPORT(void) filter (void); /* implemented */
extern NCURSES_EXPORT(int) flash (void); /* implemented */
extern NCURSES_EXPORT(int) flushinp (void); /* implemented */
extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getch (void); /* generated */
extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) getstr (char *); /* generated */
extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */
extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */
extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */
extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */
extern NCURSES_EXPORT(bool) has_il (void); /* implemented */
extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */
extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(chtype) inch (void); /* generated */
extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */
extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */
extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */
extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) insch (chtype); /* generated */
extern NCURSES_EXPORT(int) insdelln (int); /* generated */
extern NCURSES_EXPORT(int) insertln (void); /* generated */
extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */
extern NCURSES_EXPORT(int) insstr (const char *); /* generated */
extern NCURSES_EXPORT(int) instr (char *); /* generated */
extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */
extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */
extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */
extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(char) killchar (void); /* implemented */
extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(char *) longname (void); /* implemented */
extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) move (int, int); /* generated */
extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */
extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */
extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */
extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */
extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */
GCC_PRINTFLIKE(3,4);
extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(3,4);
extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */
extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */
extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */
extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */
GCC_PRINTFLIKE(4,5);
extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(4,5);
extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) napms (int); /* implemented */
extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */
extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */
extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) nl (void); /* implemented */
extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */
extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) noecho (void); /* implemented */
extern NCURSES_EXPORT(int) nonl (void); /* implemented */
extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */
extern NCURSES_EXPORT(int) noraw (void); /* implemented */
extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */
extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */
GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */
extern NCURSES_EXPORT(void) qiflush (void); /* implemented */
extern NCURSES_EXPORT(int) raw (void); /* implemented */
extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) refresh (void); /* generated */
extern NCURSES_EXPORT(int) resetty (void); /* implemented */
extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */
extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */
extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */
extern NCURSES_EXPORT(int) savetty (void); /* implemented */
extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(1,2);
extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */
extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */
extern NCURSES_EXPORT(int) scrl (int); /* generated */
extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */
extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */
extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */
extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */
extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */
extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */
extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */
extern NCURSES_EXPORT(int) slk_init (int); /* implemented */
extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */
extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */
extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */
extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */
extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */
extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */
extern NCURSES_EXPORT(int) standout (void); /* generated */
extern NCURSES_EXPORT(int) standend (void); /* generated */
extern NCURSES_EXPORT(int) start_color (void); /* implemented */
extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */
extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */
extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */
extern NCURSES_EXPORT(char *) termname (void); /* implemented */
extern NCURSES_EXPORT(void) timeout (int); /* generated */
extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) typeahead (int); /* implemented */
extern NCURSES_EXPORT(int) ungetch (int); /* implemented */
extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) use_env (bool); /* implemented */
extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */
extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */
extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */
extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */
extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */
extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */
extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */
extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */
extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */
extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */
extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */
extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */
extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */
extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */
extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */
extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */
extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */
extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */
extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */
extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */
extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */
extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */
GCC_PRINTFLIKE(2,3);
extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(2,3);
extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */
extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */
/*
* These are also declared in <term.h>:
*/
extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(int) putp (const char *); /* implemented */
#if NCURSES_TPARM_VARARGS
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */
extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */
#endif
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */
/*
* X/Open says this returns a bool; SVr4 also checked for out-of-range line.
* The macro provides compatibility:
*/
#define is_linetouched(w,l) ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w),(l)))
/*
* These functions are not in X/Open, but we use them in macro definitions:
*/
extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
/*
* vid_attr() was implemented originally based on a draft of X/Open curses.
*/
#if !NCURSES_WIDECHAR
#define vid_attr(a,pair,opts) vidattr(a)
#endif
/*
* These functions are extensions - not in X/Open Curses.
*/
#if 1
#undef NCURSES_EXT_FUNCS
#define NCURSES_EXT_FUNCS 20180224
typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
extern NCURSES_EXPORT(bool) is_term_resized (int, int);
extern NCURSES_EXPORT(char *) keybound (int, int);
extern NCURSES_EXPORT(const char *) curses_version (void);
extern NCURSES_EXPORT(int) alloc_pair (int, int);
extern NCURSES_EXPORT(int) assume_default_colors (int, int);
extern NCURSES_EXPORT(int) define_key (const char *, int);
extern NCURSES_EXPORT(int) extended_color_content(int, int *, int *, int *);
extern NCURSES_EXPORT(int) extended_pair_content(int, int *, int *);
extern NCURSES_EXPORT(int) extended_slk_color(int);
extern NCURSES_EXPORT(int) find_pair (int, int);
extern NCURSES_EXPORT(int) free_pair (int);
extern NCURSES_EXPORT(int) get_escdelay (void);
extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int);
extern NCURSES_EXPORT(int) init_extended_pair(int, int, int);
extern NCURSES_EXPORT(int) key_defined (const char *);
extern NCURSES_EXPORT(int) keyok (int, bool);
extern NCURSES_EXPORT(void) reset_color_pairs (void);
extern NCURSES_EXPORT(int) resize_term (int, int);
extern NCURSES_EXPORT(int) resizeterm (int, int);
extern NCURSES_EXPORT(int) set_escdelay (int);
extern NCURSES_EXPORT(int) set_tabsize (int);
extern NCURSES_EXPORT(int) use_default_colors (void);
extern NCURSES_EXPORT(int) use_extended_names (bool);
extern NCURSES_EXPORT(int) use_legacy_coding (int);
extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
extern NCURSES_EXPORT(void) nofilter(void);
/*
* These extensions provide access to information stored in the WINDOW even
* when NCURSES_OPAQUE is set:
*/
extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
#else
#define curses_version() NCURSES_VERSION
#endif
/*
* Extra extension-functions, which pass a SCREEN pointer rather than using
* a global variable SP.
*/
#if 1
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 20180224
#define NCURSES_SP_NAME(name) name##_sp
/* Define the sp-funcs helper function */
#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC)
typedef int (*NCURSES_SP_OUTC)(SCREEN*, int);
extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#if 1
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(alloc_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content) (SCREEN*, int, int *, int *, int *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content) (SCREEN*, int, int *, int *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_slk_color) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(find_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(free_pair) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color) (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_pair) (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(reset_color_pairs) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
#endif
#else
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 0
#define NCURSES_SP_NAME(name) name
#define NCURSES_SP_OUTC NCURSES_OUTC
#endif
/* attributes */
#define NCURSES_ATTR_SHIFT 8
#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT))
#define A_NORMAL (1U - 1U)
#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U),0)
#define A_CHARTEXT (NCURSES_BITS(1U,0) - 1U)
#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0)
#define A_STANDOUT NCURSES_BITS(1U,8)
#define A_UNDERLINE NCURSES_BITS(1U,9)
#define A_REVERSE NCURSES_BITS(1U,10)
#define A_BLINK NCURSES_BITS(1U,11)
#define A_DIM NCURSES_BITS(1U,12)
#define A_BOLD NCURSES_BITS(1U,13)
#define A_ALTCHARSET NCURSES_BITS(1U,14)
#define A_INVIS NCURSES_BITS(1U,15)
#define A_PROTECT NCURSES_BITS(1U,16)
#define A_HORIZONTAL NCURSES_BITS(1U,17)
#define A_LEFT NCURSES_BITS(1U,18)
#define A_LOW NCURSES_BITS(1U,19)
#define A_RIGHT NCURSES_BITS(1U,20)
#define A_TOP NCURSES_BITS(1U,21)
#define A_VERTICAL NCURSES_BITS(1U,22)
#if 1
#define A_ITALIC NCURSES_BITS(1U,23) /* ncurses extension */
#endif
/*
* Most of the pseudo functions are macros that either provide compatibility
* with older versions of curses, or provide inline functionality to improve
* performance.
*/
/*
* These pseudo functions are always implemented as macros:
*/
#define getyx(win,y,x) (y = getcury(win), x = getcurx(win))
#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win))
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
#define getparyx(win,y,x) (y = getpary(win), x = getparx(win))
#define getsyx(y,x) do { if (newscr) { \
if (is_leaveok(newscr)) \
(y) = (x) = -1; \
else \
getyx(newscr,(y), (x)); \
} \
} while(0)
#define setsyx(y,x) do { if (newscr) { \
if ((y) == -1 && (x) == -1) \
leaveok(newscr, TRUE); \
else { \
leaveok(newscr, FALSE); \
wmove(newscr, (y), (x)); \
} \
} \
} while(0)
#ifndef NCURSES_NOMACROS
/*
* These miscellaneous pseudo functions are provided for compatibility:
*/
#define wgetstr(w, s) wgetnstr(w, s, -1)
#define getnstr(s, n) wgetnstr(stdscr, s, (n))
#define setterm(term) setupterm(term, 1, (int *)0)
#define fixterm() reset_prog_mode()
#define resetterm() reset_shell_mode()
#define saveterm() def_prog_mode()
#define crmode() cbreak()
#define nocrmode() nocbreak()
#define gettmode()
/* It seems older SYSV curses versions define these */
#if !NCURSES_OPAQUE
#define getattrs(win) NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL)
#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR)
#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR)
#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR)
#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR)
#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR)
#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR)
#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR)
#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR)
#endif /* NCURSES_OPAQUE */
#define wstandout(win) (wattrset(win,A_STANDOUT))
#define wstandend(win) (wattrset(win,A_NORMAL))
#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && 1
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \
(win)->_attrs = NCURSES_CAST(attr_t, at), \
OK) \
: ERR)
#else
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_attrs = NCURSES_CAST(attr_t, at), \
OK) \
: ERR)
#endif
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
#define scroll(win) wscrl(win,1)
#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1)
#define touchline(win, s, c) wtouchln((win), s, c, 1)
#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0)
#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
#define hline(ch, n) whline(stdscr, ch, (n))
#define vline(ch, n) wvline(stdscr, ch, (n))
#define winstr(w, s) winnstr(w, s, -1)
#define winchstr(w, s) winchnstr(w, s, -1)
#define winsstr(w, s) winsnstr(w, s, -1)
#if !NCURSES_OPAQUE
#define redrawwin(win) wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy+1 : -1))
#endif /* NCURSES_OPAQUE */
#define waddstr(win,str) waddnstr(win,str,-1)
#define waddchstr(win,str) waddchnstr(win,str,-1)
/*
* These apply to the first 256 color pairs.
*/
#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR)
#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
/*
* pseudo functions for standard screen
*/
#define addch(ch) waddch(stdscr,(ch))
#define addchnstr(str,n) waddchnstr(stdscr,(str),(n))
#define addchstr(str) waddchstr(stdscr,(str))
#define addnstr(str,n) waddnstr(stdscr,(str),(n))
#define addstr(str) waddnstr(stdscr,(str),-1)
#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o))
#define attr_off(a,o) wattr_off(stdscr,(a),(o))
#define attr_on(a,o) wattr_on(stdscr,(a),(o))
#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o))
#define attroff(at) wattroff(stdscr,(at))
#define attron(at) wattron(stdscr,(at))
#define attrset(at) wattrset(stdscr,(at))
#define bkgd(ch) wbkgd(stdscr,(ch))
#define bkgdset(ch) wbkgdset(stdscr,(ch))
#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o))
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define color_set(c,o) wcolor_set(stdscr,(c),(o))
#define delch() wdelch(stdscr)
#define deleteln() winsdelln(stdscr,-1)
#define echochar(c) wechochar(stdscr,(c))
#define erase() werase(stdscr)
#define getch() wgetch(stdscr)
#define getstr(str) wgetstr(stdscr,(str))
#define inch() winch(stdscr)
#define inchnstr(s,n) winchnstr(stdscr,(s),(n))
#define inchstr(s) winchstr(stdscr,(s))
#define innstr(s,n) winnstr(stdscr,(s),(n))
#define insch(c) winsch(stdscr,(c))
#define insdelln(n) winsdelln(stdscr,(n))
#define insertln() winsdelln(stdscr,1)
#define insnstr(s,n) winsnstr(stdscr,(s),(n))
#define insstr(s) winsstr(stdscr,(s))
#define instr(s) winstr(stdscr,(s))
#define move(y,x) wmove(stdscr,(y),(x))
#define refresh() wrefresh(stdscr)
#define scrl(n) wscrl(stdscr,(n))
#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b))
#define standend() wstandend(stdscr)
#define standout() wstandout(stdscr)
#define timeout(delay) wtimeout(stdscr,(delay))
#define wdeleteln(win) winsdelln(win,-1)
#define winsertln(win) winsdelln(win,1)
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch)))
#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n)))
#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1))
#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n)))
#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1))
#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o)))
#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win))
#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win))
#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n)))
#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str)))
#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n)))
#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n)))
#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s)))
#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n)))
#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c)))
#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n)))
#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s)))
#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s)))
#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n)))
#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch))
#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n))
#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str))
#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n))
#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str))
#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o))
#define mvdelch(y,x) mvwdelch(stdscr,(y),(x))
#define mvgetch(y,x) mvwgetch(stdscr,(y),(x))
#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n))
#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str))
#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n))
#define mvinch(y,x) mvwinch(stdscr,(y),(x))
#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n))
#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s))
#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n))
#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c))
#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n))
#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s))
#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s))
#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n))
/*
* Some wide-character functions can be implemented without the extensions.
*/
#if !NCURSES_OPAQUE
#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0)
#endif /* NCURSES_OPAQUE */
#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a))
#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a))
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && 1
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = ((a) & ~A_COLOR), \
(win)->_color = (opts) ? *(int *)(opts) : (p)), \
OK) \
: ERR)
#define wattr_get(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)(NCURSES_OK_ADDR(a) \
? (*(a) = (win)->_attrs) \
: OK), \
(void)(NCURSES_OK_ADDR(p) \
? (*(p) = (NCURSES_PAIRS_T) (win)->_color) \
: OK), \
(void)(NCURSES_OK_ADDR(opts) \
? (*(int *)(opts) = (win)->_color) \
: OK), \
OK) \
: ERR)
#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \
(attr_t)COLOR_PAIR(p))), \
OK) \
: ERR)
#define wattr_get(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)(NCURSES_OK_ADDR(a) \
? (*(a) = (win)->_attrs) \
: OK), \
(void)(NCURSES_OK_ADDR(p) \
? (*(p) = (NCURSES_PAIRS_T) PAIR_NUMBER((win)->_attrs)) \
: OK), \
OK) \
: ERR)
#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
/*
* X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
* varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to
* use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already
* use stdarg.h, so...
*/
#define vw_printw vwprintw
#define vw_scanw vwscanw
/*
* Export fallback function for use in C++ binding.
*/
#if !1
#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
#endif
/*
* These macros are extensions - not in X/Open Curses.
*/
#if 1
#if !NCURSES_OPAQUE
#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE)
#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE)
#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE)
#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE)
#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE)
#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE)
#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE)
#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE)
#define is_pad(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE)
#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE)
#define is_subwin(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE)
#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE)
#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0)
#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0)
#define wgetscrreg(win,t,b) (NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
#endif
#endif
#endif /* NCURSES_NOMACROS */
/*
* Public variables.
*
* Notes:
* a. ESCDELAY was an undocumented feature under AIX curses.
* It gives the ESC expire time in milliseconds.
* b. ttytype is needed for backward compatibility
*/
#if NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(WINDOW *, curscr);
NCURSES_WRAPPED_VAR(WINDOW *, newscr);
NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
NCURSES_WRAPPED_VAR(char *, ttytype);
NCURSES_WRAPPED_VAR(int, COLORS);
NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
NCURSES_WRAPPED_VAR(int, COLS);
NCURSES_WRAPPED_VAR(int, ESCDELAY);
NCURSES_WRAPPED_VAR(int, LINES);
NCURSES_WRAPPED_VAR(int, TABSIZE);
#define curscr NCURSES_PUBLIC_VAR(curscr())
#define newscr NCURSES_PUBLIC_VAR(newscr())
#define stdscr NCURSES_PUBLIC_VAR(stdscr())
#define ttytype NCURSES_PUBLIC_VAR(ttytype())
#define COLORS NCURSES_PUBLIC_VAR(COLORS())
#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
#define COLS NCURSES_PUBLIC_VAR(COLS())
#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY())
#define LINES NCURSES_PUBLIC_VAR(LINES())
#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE())
#else
extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
extern NCURSES_EXPORT_VAR(char) ttytype[];
extern NCURSES_EXPORT_VAR(int) COLORS;
extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
extern NCURSES_EXPORT_VAR(int) COLS;
extern NCURSES_EXPORT_VAR(int) ESCDELAY;
extern NCURSES_EXPORT_VAR(int) LINES;
extern NCURSES_EXPORT_VAR(int) TABSIZE;
#endif
/*
* Pseudo-character tokens outside ASCII range. The curses wgetch() function
* will return any given one of these only if the corresponding k- capability
* is defined in your terminal's terminfo entry.
*
* Some keys (KEY_A1, etc) are arranged like this:
* a1 up a3
* left b2 right
* c1 down c3
*
* A few key codes do not depend upon the terminfo entry.
*/
#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */
#define KEY_MIN 0401 /* Minimum curses key */
#define KEY_BREAK 0401 /* Break key (unreliable) */
#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */
#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */
/*
* These definitions were generated by ./MKkey_defs.sh ./Caps
*/
#define KEY_DOWN 0402 /* down-arrow key */
#define KEY_UP 0403 /* up-arrow key */
#define KEY_LEFT 0404 /* left-arrow key */
#define KEY_RIGHT 0405 /* right-arrow key */
#define KEY_HOME 0406 /* home key */
#define KEY_BACKSPACE 0407 /* backspace key */
#define KEY_F0 0410 /* Function keys. Space for 64 */
#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */
#define KEY_DL 0510 /* delete-line key */
#define KEY_IL 0511 /* insert-line key */
#define KEY_DC 0512 /* delete-character key */
#define KEY_IC 0513 /* insert-character key */
#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */
#define KEY_CLEAR 0515 /* clear-screen or erase key */
#define KEY_EOS 0516 /* clear-to-end-of-screen key */
#define KEY_EOL 0517 /* clear-to-end-of-line key */
#define KEY_SF 0520 /* scroll-forward key */
#define KEY_SR 0521 /* scroll-backward key */
#define KEY_NPAGE 0522 /* next-page key */
#define KEY_PPAGE 0523 /* previous-page key */
#define KEY_STAB 0524 /* set-tab key */
#define KEY_CTAB 0525 /* clear-tab key */
#define KEY_CATAB 0526 /* clear-all-tabs key */
#define KEY_ENTER 0527 /* enter/send key */
#define KEY_PRINT 0532 /* print key */
#define KEY_LL 0533 /* lower-left key (home down) */
#define KEY_A1 0534 /* upper left of keypad */
#define KEY_A3 0535 /* upper right of keypad */
#define KEY_B2 0536 /* center of keypad */
#define KEY_C1 0537 /* lower left of keypad */
#define KEY_C3 0540 /* lower right of keypad */
#define KEY_BTAB 0541 /* back-tab key */
#define KEY_BEG 0542 /* begin key */
#define KEY_CANCEL 0543 /* cancel key */
#define KEY_CLOSE 0544 /* close key */
#define KEY_COMMAND 0545 /* command key */
#define KEY_COPY 0546 /* copy key */
#define KEY_CREATE 0547 /* create key */
#define KEY_END 0550 /* end key */
#define KEY_EXIT 0551 /* exit key */
#define KEY_FIND 0552 /* find key */
#define KEY_HELP 0553 /* help key */
#define KEY_MARK 0554 /* mark key */
#define KEY_MESSAGE 0555 /* message key */
#define KEY_MOVE 0556 /* move key */
#define KEY_NEXT 0557 /* next key */
#define KEY_OPEN 0560 /* open key */
#define KEY_OPTIONS 0561 /* options key */
#define KEY_PREVIOUS 0562 /* previous key */
#define KEY_REDO 0563 /* redo key */
#define KEY_REFERENCE 0564 /* reference key */
#define KEY_REFRESH 0565 /* refresh key */
#define KEY_REPLACE 0566 /* replace key */
#define KEY_RESTART 0567 /* restart key */
#define KEY_RESUME 0570 /* resume key */
#define KEY_SAVE 0571 /* save key */
#define KEY_SBEG 0572 /* shifted begin key */
#define KEY_SCANCEL 0573 /* shifted cancel key */
#define KEY_SCOMMAND 0574 /* shifted command key */
#define KEY_SCOPY 0575 /* shifted copy key */
#define KEY_SCREATE 0576 /* shifted create key */
#define KEY_SDC 0577 /* shifted delete-character key */
#define KEY_SDL 0600 /* shifted delete-line key */
#define KEY_SELECT 0601 /* select key */
#define KEY_SEND 0602 /* shifted end key */
#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */
#define KEY_SEXIT 0604 /* shifted exit key */
#define KEY_SFIND 0605 /* shifted find key */
#define KEY_SHELP 0606 /* shifted help key */
#define KEY_SHOME 0607 /* shifted home key */
#define KEY_SIC 0610 /* shifted insert-character key */
#define KEY_SLEFT 0611 /* shifted left-arrow key */
#define KEY_SMESSAGE 0612 /* shifted message key */
#define KEY_SMOVE 0613 /* shifted move key */
#define KEY_SNEXT 0614 /* shifted next key */
#define KEY_SOPTIONS 0615 /* shifted options key */
#define KEY_SPREVIOUS 0616 /* shifted previous key */
#define KEY_SPRINT 0617 /* shifted print key */
#define KEY_SREDO 0620 /* shifted redo key */
#define KEY_SREPLACE 0621 /* shifted replace key */
#define KEY_SRIGHT 0622 /* shifted right-arrow key */
#define KEY_SRSUME 0623 /* shifted resume key */
#define KEY_SSAVE 0624 /* shifted save key */
#define KEY_SSUSPEND 0625 /* shifted suspend key */
#define KEY_SUNDO 0626 /* shifted undo key */
#define KEY_SUSPEND 0627 /* suspend key */
#define KEY_UNDO 0630 /* undo key */
#define KEY_MOUSE 0631 /* Mouse event has occurred */
#define KEY_RESIZE 0632 /* Terminal resize event */
#define KEY_EVENT 0633 /* We were interrupted by an event */
#define KEY_MAX 0777 /* Maximum key value is 0633 */
/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
* (see that file for the relevant copyright).
*/
#define _XOPEN_CURSES 1
#if NCURSES_WIDECHAR
extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))])
#define WACS_BSSB NCURSES_WACS('l')
#define WACS_SSBB NCURSES_WACS('m')
#define WACS_BBSS NCURSES_WACS('k')
#define WACS_SBBS NCURSES_WACS('j')
#define WACS_SBSS NCURSES_WACS('u')
#define WACS_SSSB NCURSES_WACS('t')
#define WACS_SSBS NCURSES_WACS('v')
#define WACS_BSSS NCURSES_WACS('w')
#define WACS_BSBS NCURSES_WACS('q')
#define WACS_SBSB NCURSES_WACS('x')
#define WACS_SSSS NCURSES_WACS('n')
#define WACS_ULCORNER WACS_BSSB
#define WACS_LLCORNER WACS_SSBB
#define WACS_URCORNER WACS_BBSS
#define WACS_LRCORNER WACS_SBBS
#define WACS_RTEE WACS_SBSS
#define WACS_LTEE WACS_SSSB
#define WACS_BTEE WACS_SSBS
#define WACS_TTEE WACS_BSSS
#define WACS_HLINE WACS_BSBS
#define WACS_VLINE WACS_SBSB
#define WACS_PLUS WACS_SSSS
#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */
#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */
#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */
#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */
#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */
#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */
#define WACS_BULLET NCURSES_WACS('~') /* bullet */
/* Teletype 5410v1 symbols */
#define WACS_LARROW NCURSES_WACS(',') /* arrow left */
#define WACS_RARROW NCURSES_WACS('+') /* arrow right */
#define WACS_DARROW NCURSES_WACS('.') /* arrow down */
#define WACS_UARROW NCURSES_WACS('-') /* arrow up */
#define WACS_BOARD NCURSES_WACS('h') /* board of squares */
#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */
#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */
/* ncurses extensions */
#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */
#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */
#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */
#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */
#define WACS_PI NCURSES_WACS('{') /* Pi */
#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */
#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */
/* double lines */
#define WACS_BDDB NCURSES_WACS('C')
#define WACS_DDBB NCURSES_WACS('D')
#define WACS_BBDD NCURSES_WACS('B')
#define WACS_DBBD NCURSES_WACS('A')
#define WACS_DBDD NCURSES_WACS('G')
#define WACS_DDDB NCURSES_WACS('F')
#define WACS_DDBD NCURSES_WACS('H')
#define WACS_BDDD NCURSES_WACS('I')
#define WACS_BDBD NCURSES_WACS('R')
#define WACS_DBDB NCURSES_WACS('Y')
#define WACS_DDDD NCURSES_WACS('E')
#define WACS_D_ULCORNER WACS_BDDB
#define WACS_D_LLCORNER WACS_DDBB
#define WACS_D_URCORNER WACS_BBDD
#define WACS_D_LRCORNER WACS_DBBD
#define WACS_D_RTEE WACS_DBDD
#define WACS_D_LTEE WACS_DDDB
#define WACS_D_BTEE WACS_DDBD
#define WACS_D_TTEE WACS_BDDD
#define WACS_D_HLINE WACS_BDBD
#define WACS_D_VLINE WACS_DBDB
#define WACS_D_PLUS WACS_DDDD
/* thick lines */
#define WACS_BTTB NCURSES_WACS('L')
#define WACS_TTBB NCURSES_WACS('M')
#define WACS_BBTT NCURSES_WACS('K')
#define WACS_TBBT NCURSES_WACS('J')
#define WACS_TBTT NCURSES_WACS('U')
#define WACS_TTTB NCURSES_WACS('T')
#define WACS_TTBT NCURSES_WACS('V')
#define WACS_BTTT NCURSES_WACS('W')
#define WACS_BTBT NCURSES_WACS('Q')
#define WACS_TBTB NCURSES_WACS('X')
#define WACS_TTTT NCURSES_WACS('N')
#define WACS_T_ULCORNER WACS_BTTB
#define WACS_T_LLCORNER WACS_TTBB
#define WACS_T_URCORNER WACS_BBTT
#define WACS_T_LRCORNER WACS_TBBT
#define WACS_T_RTEE WACS_TBTT
#define WACS_T_LTEE WACS_TTTB
#define WACS_T_BTEE WACS_TTBT
#define WACS_T_TTEE WACS_BTTT
#define WACS_T_HLINE WACS_BTBT
#define WACS_T_VLINE WACS_TBTB
#define WACS_T_PLUS WACS_TTTT
/*
* Function prototypes for wide-character operations.
*
* "generated" comments should include ":WIDEC" to make the corresponding
* functions ifdef'd in lib_gen.c
*
* "implemented" comments do not need this marker.
*/
extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */
extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */
extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */
extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */
extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */
extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */
extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */
extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */
extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* implemented */
extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */
extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *, wint_t *, int); /* implemented */
extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */
extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#endif
#ifndef NCURSES_NOMACROS
/*
* XSI curses macros for XPG4 conformance.
*/
#define add_wch(c) wadd_wch(stdscr,(c))
#define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n))
#define add_wchstr(str) wadd_wchstr(stdscr,(str))
#define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n))
#define addwstr(wstr) waddwstr(stdscr,(wstr))
#define bkgrnd(c) wbkgrnd(stdscr,(c))
#define bkgrndset(c) wbkgrndset(stdscr,(c))
#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0)
#define echo_wchar(c) wecho_wchar(stdscr,(c))
#define get_wch(c) wget_wch(stdscr,(c))
#define get_wstr(t) wget_wstr(stdscr,(t))
#define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch))
#define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n))
#define hline_set(c,n) whline_set(stdscr,(c),(n))
#define in_wch(c) win_wch(stdscr,(c))
#define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n))
#define in_wchstr(c) win_wchstr(stdscr,(c))
#define innwstr(c,n) winnwstr(stdscr,(c),(n))
#define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n))
#define ins_wch(c) wins_wch(stdscr,(c))
#define ins_wstr(t) wins_wstr(stdscr,(t))
#define inwstr(c) winwstr(stdscr,(c))
#define vline_set(c,n) wvline_set(stdscr,(c),(n))
#define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1)
#define waddwstr(win,wstr) waddnwstr((win),(wstr),-1)
#define wget_wstr(w,t) wgetn_wstr((w),(t),-1)
#define win_wchstr(w,c) win_wchnstr((w),(c),-1)
#define wins_wstr(w,t) wins_nwstr((w),(t),-1)
#if !NCURSES_OPAQUE
#define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR)
#endif
#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c))
#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n))
#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s))
#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n))
#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr))
#define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c))
#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t))
#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n))
#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n))
#define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c))
#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n))
#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c))
#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n))
#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n))
#define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c))
#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t))
#define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c))
#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n))
#define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c)))
#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n)))
#define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s)))
#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n)))
#define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr)))
#define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c)))
#define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t)))
#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n)))
#define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n)))
#define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c)))
#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n)))
#define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c)))
#define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n)))
#define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n)))
#define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c)))
#define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t)))
#define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c)))
#define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n)))
#endif /* NCURSES_NOMACROS */
#if defined(TRACE) || defined(NCURSES_TEST)
extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *);
extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);
#endif
#endif /* NCURSES_WIDECHAR */
/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
* (see that file for the relevant copyright).
*/
/* mouse interface */
#if NCURSES_MOUSE_VERSION > 1
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
#else
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
#endif
#define NCURSES_BUTTON_RELEASED 001L
#define NCURSES_BUTTON_PRESSED 002L
#define NCURSES_BUTTON_CLICKED 004L
#define NCURSES_DOUBLE_CLICKED 010L
#define NCURSES_TRIPLE_CLICKED 020L
#define NCURSES_RESERVED_EVENT 040L
/* event masks */
#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
/*
* In 32 bits the version-1 scheme does not provide enough space for a 5th
* button, unless we choose to change the ABI by omitting the reserved-events.
*/
#if NCURSES_MOUSE_VERSION > 1
#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L)
#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L)
#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L)
#else
#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L)
#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L)
#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L)
#endif
#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
/* macros to extract single event-bits from masks */
#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001))
#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002))
#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004))
#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010))
#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020))
#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040))
typedef struct
{
short id; /* ID to distinguish multiple devices */
int x, y, z; /* event coordinates (character-cell) */
mmask_t bstate; /* button state bits */
}
MEVENT;
extern NCURSES_EXPORT(bool) has_mouse(void);
extern NCURSES_EXPORT(int) getmouse (MEVENT *);
extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
extern NCURSES_EXPORT(int) mouseinterval (int);
extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *);
extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int);
#endif
#ifndef NCURSES_NOMACROS
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
#endif
/* other non-XSI functions */
extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */
extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */
#endif
/* Debugging : use with libncurses_g.a */
extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(char *) _traceattr (attr_t);
extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
extern NCURSES_EXPORT(char *) _tracechar (int);
extern NCURSES_EXPORT(char *) _tracechtype (chtype);
extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
#if NCURSES_WIDECHAR
#define _tracech_t _tracecchar_t
extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
#define _tracech_t2 _tracecchar_t2
extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
#else
#define _tracech_t _tracechtype
#define _tracech_t2 _tracechtype2
#endif
extern NCURSES_EXPORT(void) trace (const unsigned int);
/* trace masks */
#define TRACE_DISABLE 0x0000 /* turn off tracing */
#define TRACE_TIMES 0x0001 /* trace user and system times of updates */
#define TRACE_TPUTS 0x0002 /* trace tputs calls */
#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */
#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */
#define TRACE_CHARPUT 0x0010 /* trace all character outputs */
#define TRACE_ORDINARY 0x001F /* trace all update actions */
#define TRACE_CALLS 0x0020 /* trace all curses calls */
#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */
#define TRACE_IEVENT 0x0080 /* trace low-level input processing */
#define TRACE_BITS 0x0100 /* trace state of TTY control bits */
#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */
#define TRACE_CCALLS 0x0400 /* trace per-character calls */
#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */
#define TRACE_ATTRS 0x1000 /* trace attribute updates */
#define TRACE_SHIFT 13 /* number of bits in the trace masks */
#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */
#if defined(TRACE) || defined(NCURSES_TEST)
extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */
extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */
#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */
#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */
#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */
#endif
#include <unctrl.h>
#ifdef __cplusplus
#ifndef NCURSES_NOMACROS
/* these names conflict with STL */
#undef box
#undef clear
#undef erase
#undef move
#undef refresh
#endif /* NCURSES_NOMACROS */
}
#endif
#endif /* __NCURSES_H */
/* SPDX-License-Identifier: LGPL-2.1+ */
#ifndef _LIBUDEV_H_
#define _LIBUDEV_H_
#include <stdarg.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* udev - library context
*
* reads the udev config and system environment
* allows custom logging
*/
struct udev;
struct udev *udev_ref(struct udev *udev);
struct udev *udev_unref(struct udev *udev);
struct udev *udev_new(void);
void udev_set_log_fn(struct udev *udev,
void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, va_list args)) __attribute__ ((deprecated));
int udev_get_log_priority(struct udev *udev) __attribute__ ((deprecated));
void udev_set_log_priority(struct udev *udev, int priority) __attribute__ ((deprecated));
void *udev_get_userdata(struct udev *udev);
void udev_set_userdata(struct udev *udev, void *userdata);
/*
* udev_list
*
* access to libudev generated lists
*/
struct udev_list_entry;
struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry);
struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name);
const char *udev_list_entry_get_name(struct udev_list_entry *list_entry);
const char *udev_list_entry_get_value(struct udev_list_entry *list_entry);
/**
* udev_list_entry_foreach:
* @list_entry: entry to store the current position
* @first_entry: first entry to start with
*
* Helper to iterate over all entries of a list.
*/
#define udev_list_entry_foreach(list_entry, first_entry) \
for (list_entry = first_entry; \
list_entry != NULL; \
list_entry = udev_list_entry_get_next(list_entry))
/*
* udev_device
*
* access to sysfs/kernel devices
*/
struct udev_device;
struct udev_device *udev_device_ref(struct udev_device *udev_device);
struct udev_device *udev_device_unref(struct udev_device *udev_device);
struct udev *udev_device_get_udev(struct udev_device *udev_device);
struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
struct udev_device *udev_device_new_from_device_id(struct udev *udev, const char *id);
struct udev_device *udev_device_new_from_environment(struct udev *udev);
/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */
struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device,
const char *subsystem, const char *devtype);
/* retrieve device properties */
const char *udev_device_get_devpath(struct udev_device *udev_device);
const char *udev_device_get_subsystem(struct udev_device *udev_device);
const char *udev_device_get_devtype(struct udev_device *udev_device);
const char *udev_device_get_syspath(struct udev_device *udev_device);
const char *udev_device_get_sysname(struct udev_device *udev_device);
const char *udev_device_get_sysnum(struct udev_device *udev_device);
const char *udev_device_get_devnode(struct udev_device *udev_device);
int udev_device_get_is_initialized(struct udev_device *udev_device);
struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
const char *udev_device_get_driver(struct udev_device *udev_device);
dev_t udev_device_get_devnum(struct udev_device *udev_device);
const char *udev_device_get_action(struct udev_device *udev_device);
unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device);
const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
/*
* udev_monitor
*
* access to kernel uevents and udev events
*/
struct udev_monitor;
struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
struct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monitor);
struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
/* kernel and udev generated events over netlink */
struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
/* bind socket */
int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size);
int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
/* in-kernel socket filters to select messages that get delivered to a listener */
int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor,
const char *subsystem, const char *devtype);
int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag);
int udev_monitor_filter_update(struct udev_monitor *udev_monitor);
int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
/*
* udev_enumerate
*
* search sysfs for specific devices and provide a sorted list
*/
struct udev_enumerate;
struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate);
struct udev_enumerate *udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
struct udev_enumerate *udev_enumerate_new(struct udev *udev);
/* device properties filter */
int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname);
int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag);
int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent);
int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate);
int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath);
/* run enumeration with active filters */
int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate);
int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate);
/* return device list */
struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate);
/*
* udev_queue
*
* access to the currently running udev events
*/
struct udev_queue;
struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue);
struct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
struct udev_queue *udev_queue_new(struct udev *udev);
unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) __attribute__ ((deprecated));
unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) __attribute__ ((deprecated));
int udev_queue_get_udev_is_active(struct udev_queue *udev_queue);
int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue);
int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) __attribute__ ((deprecated));
int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
unsigned long long int start, unsigned long long int end) __attribute__ ((deprecated));
int udev_queue_get_fd(struct udev_queue *udev_queue);
int udev_queue_flush(struct udev_queue *udev_queue);
struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) __attribute__ ((deprecated));
/*
* udev_hwdb
*
* access to the static hardware properties database
*/
struct udev_hwdb;
struct udev_hwdb *udev_hwdb_new(struct udev *udev);
struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb);
struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb);
struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags);
/*
* udev_util
*
* udev specific utilities
*/
int udev_util_encode_string(const char *str, char *str_enc, size_t len);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
/* Definitions for use with Linux SOCK_PACKET sockets.
Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef __IF_PACKET_H
#define __IF_PACKET_H
#include <features.h>
#include <bits/sockaddr.h>
/* This is the SOCK_PACKET address structure as used in Linux 2.0.
From Linux 2.1 the AF_PACKET interface is preferred and you should
consider using it in place of this one. */
struct sockaddr_pkt
{
__SOCKADDR_COMMON (spkt_);
unsigned char spkt_device[14];
unsigned short spkt_protocol;
};
#endif
#include <linux/ppp-comp.h>
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _NET_IF_SLIP_H
#define _NET_IF_SLIP_H 1
/* We can use the kernel header. */
#include <linux/if_slip.h>
#endif /* net/if_slip.h. */
#ifndef _NET_PPP_DEFS_H
#define _NET_PPP_DEFS_H 1
#include <bits/types/time_t.h>
#include <asm/types.h>
#include <linux/ppp_defs.h>
#endif /* net/ppp_defs.h */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Based on the 4.4BSD and Linux version of this file. */
#ifndef _NET_ROUTE_H
#define _NET_ROUTE_H 1
#include <features.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <bits/wordsize.h>
/* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */
struct rtentry
{
unsigned long int rt_pad1;
struct sockaddr rt_dst; /* Target address. */
struct sockaddr rt_gateway; /* Gateway addr (RTF_GATEWAY). */
struct sockaddr rt_genmask; /* Target network mask (IP). */
unsigned short int rt_flags;
short int rt_pad2;
unsigned long int rt_pad3;
unsigned char rt_tos;
unsigned char rt_class;
#if __WORDSIZE == 64
short int rt_pad4[3];
#else
short int rt_pad4;
#endif
short int rt_metric; /* +1 for binary compatibility! */
char *rt_dev; /* Forcing the device at add. */
unsigned long int rt_mtu; /* Per route MTU/Window. */
unsigned long int rt_window; /* Window clamping. */
unsigned short int rt_irtt; /* Initial RTT. */
};
/* Compatibility hack. */
#define rt_mss rt_mtu
struct in6_rtmsg
{
struct in6_addr rtmsg_dst;
struct in6_addr rtmsg_src;
struct in6_addr rtmsg_gateway;
uint32_t rtmsg_type;
uint16_t rtmsg_dst_len;
uint16_t rtmsg_src_len;
uint32_t rtmsg_metric;
unsigned long int rtmsg_info;
uint32_t rtmsg_flags;
int rtmsg_ifindex;
};
#define RTF_UP 0x0001 /* Route usable. */
#define RTF_GATEWAY 0x0002 /* Destination is a gateway. */
#define RTF_HOST 0x0004 /* Host entry (net otherwise). */
#define RTF_REINSTATE 0x0008 /* Reinstate route after timeout. */
#define RTF_DYNAMIC 0x0010 /* Created dyn. (by redirect). */
#define RTF_MODIFIED 0x0020 /* Modified dyn. (by redirect). */
#define RTF_MTU 0x0040 /* Specific MTU for this route. */
#define RTF_MSS RTF_MTU /* Compatibility. */
#define RTF_WINDOW 0x0080 /* Per route window clamping. */
#define RTF_IRTT 0x0100 /* Initial round trip time. */
#define RTF_REJECT 0x0200 /* Reject route. */
#define RTF_STATIC 0x0400 /* Manually injected route. */
#define RTF_XRESOLVE 0x0800 /* External resolver. */
#define RTF_NOFORWARD 0x1000 /* Forwarding inhibited. */
#define RTF_THROW 0x2000 /* Go to next class. */
#define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF. */
/* for IPv6 */
#define RTF_DEFAULT 0x00010000 /* default - learned via ND */
#define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */
#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
#define RTF_LINKRT 0x00100000 /* link specific - device match */
#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
#define RTF_CACHE 0x01000000 /* cache entry */
#define RTF_FLOW 0x02000000 /* flow significant route */
#define RTF_POLICY 0x04000000 /* policy route */
#define RTCF_VALVE 0x00200000
#define RTCF_MASQ 0x00400000
#define RTCF_NAT 0x00800000
#define RTCF_DOREDIRECT 0x01000000
#define RTCF_LOG 0x02000000
#define RTCF_DIRECTSRC 0x04000000
#define RTF_LOCAL 0x80000000
#define RTF_INTERFACE 0x40000000
#define RTF_MULTICAST 0x20000000
#define RTF_BROADCAST 0x10000000
#define RTF_NAT 0x08000000
#define RTF_ADDRCLASSMASK 0xF8000000
#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23)
#define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK)
#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \
== (RTF_LOCAL|RTF_INTERFACE))
#define RT_CLASS_UNSPEC 0
#define RT_CLASS_DEFAULT 253
#define RT_CLASS_MAIN 254
#define RT_CLASS_LOCAL 255
#define RT_CLASS_MAX 255
#define RTMSG_ACK NLMSG_ACK
#define RTMSG_OVERRUN NLMSG_OVERRUN
#define RTMSG_NEWDEVICE 0x11
#define RTMSG_DELDEVICE 0x12
#define RTMSG_NEWROUTE 0x21
#define RTMSG_DELROUTE 0x22
#define RTMSG_NEWRULE 0x31
#define RTMSG_DELRULE 0x32
#define RTMSG_CONTROL 0x40
#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */
#endif /* net/route.h */
/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _NET_IF_SHAPER_H
#define _NET_IF_SHAPER_H 1
#include <sys/types.h>
#include <stdint.h>
#include <net/if.h>
#include <sys/ioctl.h>
__BEGIN_DECLS
#define SHAPER_QLEN 10
/*
* This is a bit speed dependant (read it shouldnt be a constant!)
*
* 5 is about right for 28.8 upwards. Below that double for every
* halving of speed or so. - ie about 20 for 9600 baud.
*/
#define SHAPER_LATENCY (5 * HZ)
#define SHAPER_MAXSLIP 2
#define SHAPER_BURST (HZ / 50) /* Good for >128K then */
#define SHAPER_SET_DEV 0x0001
#define SHAPER_SET_SPEED 0x0002
#define SHAPER_GET_DEV 0x0003
#define SHAPER_GET_SPEED 0x0004
struct shaperconf
{
uint16_t ss_cmd;
union
{
char ssu_name[14];
uint32_t ssu_speed;
} ss_u;
#define ss_speed ss_u.ssu_speed
#define ss_name ss_u.ssu_name
};
__END_DECLS
#endif /* net/if_shaper.h */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Based on the FreeBSD version of this file. Curiously, that file
lacks a copyright in the header. */
#ifndef __NET_ETHERNET_H
#define __NET_ETHERNET_H 1
#include <sys/types.h>
#include <stdint.h>
#include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */
__BEGIN_DECLS
/* This is a name for the 48 bit ethernet address available on many
systems. */
struct ether_addr
{
uint8_t ether_addr_octet[ETH_ALEN];
} __attribute__ ((__packed__));
/* 10Mb/s ethernet header */
struct ether_header
{
uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
uint16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));
/* Ethernet protocol ID's */
#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
#define ETHERTYPE_SPRITE 0x0500 /* Sprite */
#define ETHERTYPE_IP 0x0800 /* IP */
#define ETHERTYPE_ARP 0x0806 /* Address resolution */
#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
#define ETHERTYPE_AT 0x809B /* AppleTalk protocol */
#define ETHERTYPE_AARP 0x80F3 /* AppleTalk ARP */
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
#define ETHERTYPE_IPX 0x8137 /* IPX */
#define ETHERTYPE_IPV6 0x86dd /* IP protocol version 6 */
#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
#define ETHER_TYPE_LEN 2 /* bytes in type field */
#define ETHER_CRC_LEN 4 /* bytes in CRC field */
#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */
#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */
#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */
/* make sure ethenet length is valid */
#define ETHER_IS_VALID_LEN(foo) \
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
#define ETHERMTU ETH_DATA_LEN
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
__END_DECLS
#endif /* net/ethernet.h */
/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */
/*
* if_ppp.h - Point-to-Point Protocol definitions.
*
* Copyright (c) 1989 Carnegie Mellon University.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
* ==FILEVERSION 960926==
*
* NOTE TO MAINTAINERS:
* If you modify this file at all, please set the above date.
* if_ppp.h is shipped with a PPP distribution as well as with the kernel;
* if everyone increases the FILEVERSION number above, then scripts
* can do the right thing when deciding whether to install a new if_ppp.h
* file. Don't change the format of that line otherwise, so the
* installation script can recognize it.
*/
#ifndef __NET_IF_PPP_H
#define __NET_IF_PPP_H 1
#include <sys/types.h>
#include <stdint.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <net/ppp_defs.h>
__BEGIN_DECLS
/*
* Packet sizes
*/
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#define PPP_MAXMRU 65000 /* Largest MRU we allow */
#define PPP_VERSION "2.2.0"
#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */
#define PROTO_IPX 0x002b /* protocol numbers */
#define PROTO_DNA_RT 0x0027 /* DNA Routing */
/*
* Bit definitions for flags.
*/
#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
#define SC_COMP_AC 0x00000002 /* header compression (output) */
#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
#define SC_DEBUG 0x00010000 /* enable debug messages */
#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
#define SC_MASK 0x0fE0ffff /* bits that user can change */
/* state bits */
#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */
#define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */
#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
/*
* Ioctl definitions.
*/
struct npioctl {
int protocol; /* PPP protocol, e.g. PPP_IP */
enum NPmode mode;
};
/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
struct ppp_option_data {
uint8_t *ptr;
uint32_t length;
int transmit;
};
/* 'struct ifreq' is only available from net/if.h under __USE_MISC. */
#ifdef __USE_MISC
struct ifpppstatsreq {
struct ifreq b;
struct ppp_stats stats; /* statistic information */
};
struct ifpppcstatsreq {
struct ifreq b;
struct ppp_comp_stats stats;
};
#define ifr__name b.ifr_ifrn.ifrn_name
#define stats_ptr b.ifr_ifru.ifru_data
#endif
/*
* Ioctl definitions.
*/
#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
#if !defined(ifr_mtu)
#define ifr_mtu ifr_ifru.ifru_metric
#endif
__END_DECLS
#endif /* net/if_ppp.h */
/* Definitions for Address Resolution Protocol.
Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Based on the 4.4BSD and Linux version of this file. */
#ifndef _NET_IF_ARP_H
#define _NET_IF_ARP_H 1
#include <sys/types.h>
#include <sys/socket.h>
#include <stdint.h>
__BEGIN_DECLS
/* Some internals from deep down in the kernel. */
#define MAX_ADDR_LEN 7
/* This structure defines an ethernet arp header. */
/* ARP protocol opcodes. */
#define ARPOP_REQUEST 1 /* ARP request. */
#define ARPOP_REPLY 2 /* ARP reply. */
#define ARPOP_RREQUEST 3 /* RARP request. */
#define ARPOP_RREPLY 4 /* RARP reply. */
#define ARPOP_InREQUEST 8 /* InARP request. */
#define ARPOP_InREPLY 9 /* InARP reply. */
#define ARPOP_NAK 10 /* (ATM)ARP NAK. */
/* See RFC 826 for protocol description. ARP packets are variable
in size; the arphdr structure defines the fixed-length portion.
Protocol type values are the same as those for 10 Mb/s Ethernet.
It is followed by the variable-sized fields ar_sha, arp_spa,
arp_tha and arp_tpa in that order, according to the lengths
specified. Field names used correspond to RFC 826. */
struct arphdr
{
unsigned short int ar_hrd; /* Format of hardware address. */
unsigned short int ar_pro; /* Format of protocol address. */
unsigned char ar_hln; /* Length of hardware address. */
unsigned char ar_pln; /* Length of protocol address. */
unsigned short int ar_op; /* ARP opcode (command). */
#if 0
/* Ethernet looks like this : This bit is variable sized
however... */
unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */
unsigned char __ar_sip[4]; /* Sender IP address. */
unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */
unsigned char __ar_tip[4]; /* Target IP address. */
#endif
};
/* ARP protocol HARDWARE identifiers. */
#define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */
#define ARPHRD_ETHER 1 /* Ethernet 10/100Mbps. */
#define ARPHRD_EETHER 2 /* Experimental Ethernet. */
#define ARPHRD_AX25 3 /* AX.25 Level 2. */
#define ARPHRD_PRONET 4 /* PROnet token ring. */
#define ARPHRD_CHAOS 5 /* Chaosnet. */
#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */
#define ARPHRD_ARCNET 7 /* ARCnet. */
#define ARPHRD_APPLETLK 8 /* APPLEtalk. */
#define ARPHRD_DLCI 15 /* Frame Relay DLCI. */
#define ARPHRD_ATM 19 /* ATM. */
#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */
#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734. */
#define ARPHRD_EUI64 27 /* EUI-64. */
#define ARPHRD_INFINIBAND 32 /* InfiniBand. */
/* Dummy types for non ARP hardware */
#define ARPHRD_SLIP 256
#define ARPHRD_CSLIP 257
#define ARPHRD_SLIP6 258
#define ARPHRD_CSLIP6 259
#define ARPHRD_RSRVD 260 /* Notional KISS type. */
#define ARPHRD_ADAPT 264
#define ARPHRD_ROSE 270
#define ARPHRD_X25 271 /* CCITT X.25. */
#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware. */
#define ARPHRD_PPP 512
#define ARPHRD_CISCO 513 /* Cisco HDLC. */
#define ARPHRD_HDLC ARPHRD_CISCO
#define ARPHRD_LAPB 516 /* LAPB. */
#define ARPHRD_DDCMP 517 /* Digital's DDCMP. */
#define ARPHRD_RAWHDLC 518 /* Raw HDLC. */
#define ARPHRD_RAWIP 519 /* Raw IP. */
#define ARPHRD_TUNNEL 768 /* IPIP tunnel. */
#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */
#define ARPHRD_FRAD 770 /* Frame Relay Access Device. */
#define ARPHRD_SKIP 771 /* SKIP vif. */
#define ARPHRD_LOOPBACK 772 /* Loopback device. */
#define ARPHRD_LOCALTLK 773 /* Localtalk device. */
#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */
#define ARPHRD_BIF 775 /* AP1000 BIF. */
#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */
#define ARPHRD_IPDDP 777 /* IP-in-DDP tunnel. */
#define ARPHRD_IPGRE 778 /* GRE over IP. */
#define ARPHRD_PIMREG 779 /* PIMSM register interface. */
#define ARPHRD_HIPPI 780 /* High Performance Parallel I'face. */
#define ARPHRD_ASH 781 /* (Nexus Electronics) Ash. */
#define ARPHRD_ECONET 782 /* Acorn Econet. */
#define ARPHRD_IRDA 783 /* Linux-IrDA. */
#define ARPHRD_FCPP 784 /* Point to point fibrechanel. */
#define ARPHRD_FCAL 785 /* Fibrechanel arbitrated loop. */
#define ARPHRD_FCPL 786 /* Fibrechanel public loop. */
#define ARPHRD_FCFABRIC 787 /* Fibrechanel fabric. */
#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */
#define ARPHRD_IEEE80211 801 /* IEEE 802.11. */
#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */
#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */
#define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */
#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */
#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */
#define ARPHRD_NONE 0xFFFE /* Zero header length. */
/* ARP ioctl request. */
struct arpreq
{
struct sockaddr arp_pa; /* Protocol address. */
struct sockaddr arp_ha; /* Hardware address. */
int arp_flags; /* Flags. */
struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */
char arp_dev[16];
};
struct arpreq_old
{
struct sockaddr arp_pa; /* Protocol address. */
struct sockaddr arp_ha; /* Hardware address. */
int arp_flags; /* Flags. */
struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */
};
/* ARP Flag values. */
#define ATF_COM 0x02 /* Completed entry (ha valid). */
#define ATF_PERM 0x04 /* Permanent entry. */
#define ATF_PUBL 0x08 /* Publish entry. */
#define ATF_USETRAILERS 0x10 /* Has requested trailers. */
#define ATF_NETMASK 0x20 /* Want to use a netmask (only
for proxy entries). */
#define ATF_DONTPUB 0x40 /* Don't answer this addresses. */
#define ATF_MAGIC 0x80 /* Automatically added entry. */
/* Support for the user space arp daemon, arpd. */
#define ARPD_UPDATE 0x01
#define ARPD_LOOKUP 0x02
#define ARPD_FLUSH 0x03
struct arpd_request
{
unsigned short int req; /* Request type. */
uint32_t ip; /* IP address of entry. */
unsigned long int dev; /* Device entry is tied to. */
unsigned long int stamp;
unsigned long int updated;
unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */
};
__END_DECLS
#endif /* net/if_arp.h */
/* net/if.h -- declarations for inquiring about network interfaces
Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _NET_IF_H
#define _NET_IF_H 1
#include <features.h>
#ifdef __USE_MISC
# include <sys/types.h>
# include <sys/socket.h>
#endif
/* Length of interface name. */
#define IF_NAMESIZE 16
struct if_nameindex
{
unsigned int if_index; /* 1, 2, ... */
char *if_name; /* null terminated name: "eth0", ... */
};
#ifdef __USE_MISC
/* Standard interface flags. */
enum
{
IFF_UP = 0x1, /* Interface is up. */
# define IFF_UP IFF_UP
IFF_BROADCAST = 0x2, /* Broadcast address valid. */
# define IFF_BROADCAST IFF_BROADCAST
IFF_DEBUG = 0x4, /* Turn on debugging. */
# define IFF_DEBUG IFF_DEBUG
IFF_LOOPBACK = 0x8, /* Is a loopback net. */
# define IFF_LOOPBACK IFF_LOOPBACK
IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */
# define IFF_POINTOPOINT IFF_POINTOPOINT
IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */
# define IFF_NOTRAILERS IFF_NOTRAILERS
IFF_RUNNING = 0x40, /* Resources allocated. */
# define IFF_RUNNING IFF_RUNNING
IFF_NOARP = 0x80, /* No address resolution protocol. */
# define IFF_NOARP IFF_NOARP
IFF_PROMISC = 0x100, /* Receive all packets. */
# define IFF_PROMISC IFF_PROMISC
/* Not supported */
IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */
# define IFF_ALLMULTI IFF_ALLMULTI
IFF_MASTER = 0x400, /* Master of a load balancer. */
# define IFF_MASTER IFF_MASTER
IFF_SLAVE = 0x800, /* Slave of a load balancer. */
# define IFF_SLAVE IFF_SLAVE
IFF_MULTICAST = 0x1000, /* Supports multicast. */
# define IFF_MULTICAST IFF_MULTICAST
IFF_PORTSEL = 0x2000, /* Can set media type. */
# define IFF_PORTSEL IFF_PORTSEL
IFF_AUTOMEDIA = 0x4000, /* Auto media select active. */
# define IFF_AUTOMEDIA IFF_AUTOMEDIA
IFF_DYNAMIC = 0x8000 /* Dialup device with changing addresses. */
# define IFF_DYNAMIC IFF_DYNAMIC
};
/* The ifaddr structure contains information about one address of an
interface. They are maintained by the different address families,
are allocated and attached when an address is set, and are linked
together so all addresses for an interface can be located. */
struct ifaddr
{
struct sockaddr ifa_addr; /* Address of interface. */
union
{
struct sockaddr ifu_broadaddr;
struct sockaddr ifu_dstaddr;
} ifa_ifu;
struct iface *ifa_ifp; /* Back-pointer to interface. */
struct ifaddr *ifa_next; /* Next address for interface. */
};
# define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */
# define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */
/* Device mapping structure. I'd just gone off and designed a
beautiful scheme using only loadable modules with arguments for
driver options and along come the PCMCIA people 8)
Ah well. The get() side of this is good for WDSETUP, and it'll be
handy for debugging things. The set side is fine for now and being
very small might be worth keeping for clean configuration. */
struct ifmap
{
unsigned long int mem_start;
unsigned long int mem_end;
unsigned short int base_addr;
unsigned char irq;
unsigned char dma;
unsigned char port;
/* 3 bytes spare */
};
/* Interface request structure used for socket ioctl's. All interface
ioctl's must have parameter definitions which begin with ifr_name.
The remainder may be interface specific. */
struct ifreq
{
# define IFHWADDRLEN 6
# define IFNAMSIZ IF_NAMESIZE
union
{
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
} ifr_ifrn;
union
{
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr;
struct sockaddr ifru_netmask;
struct sockaddr ifru_hwaddr;
short int ifru_flags;
int ifru_ivalue;
int ifru_mtu;
struct ifmap ifru_map;
char ifru_slave[IFNAMSIZ]; /* Just fits the size */
char ifru_newname[IFNAMSIZ];
__caddr_t ifru_data;
} ifr_ifru;
};
# define ifr_name ifr_ifrn.ifrn_name /* interface name */
# define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
# define ifr_addr ifr_ifru.ifru_addr /* address */
# define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
# define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
# define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
# define ifr_flags ifr_ifru.ifru_flags /* flags */
# define ifr_metric ifr_ifru.ifru_ivalue /* metric */
# define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
# define ifr_map ifr_ifru.ifru_map /* device map */
# define ifr_slave ifr_ifru.ifru_slave /* slave device */
# define ifr_data ifr_ifru.ifru_data /* for use by interface */
# define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
# define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
# define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */
# define ifr_newname ifr_ifru.ifru_newname /* New name */
# define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
# define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
# define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
/* Structure used in SIOCGIFCONF request. Used to retrieve interface
configuration for machine (useful for programs which must know all
networks accessible). */
struct ifconf
{
int ifc_len; /* Size of buffer. */
union
{
__caddr_t ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
};
# define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */
# define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */
# define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */
#endif /* Misc. */
__BEGIN_DECLS
/* Convert an interface name to an index, and vice versa. */
extern unsigned int if_nametoindex (const char *__ifname) __THROW;
extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
/* Return a list of all interfaces and their indices. */
extern struct if_nameindex *if_nameindex (void) __THROW;
/* Free the data returned from if_nameindex. */
extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
__END_DECLS
#endif /* net/if.h */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _UTMPX_H
#define _UTMPX_H 1
#include <features.h>
#include <sys/time.h>
/* Required according to Unix98. */
#ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
#endif
/* Get system dependent values and data structures. */
#include <bits/utmpx.h>
#ifdef __USE_GNU
/* Compatibility names for the strings of the canonical file names. */
# define UTMPX_FILE _PATH_UTMPX
# define UTMPX_FILENAME _PATH_UTMPX
# define WTMPX_FILE _PATH_WTMPX
# define WTMPX_FILENAME _PATH_WTMPX
#endif
/* For the getutmp{,x} functions we need the `struct utmp'. */
#ifdef __USE_GNU
struct utmp;
#endif
__BEGIN_DECLS
/* Open user accounting database.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void setutxent (void);
/* Close user accounting database.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void endutxent (void);
/* Get the next entry from the user accounting database.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern struct utmpx *getutxent (void);
/* Get the user accounting database entry corresponding to ID.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern struct utmpx *getutxid (const struct utmpx *__id);
/* Get the user accounting database entry corresponding to LINE.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern struct utmpx *getutxline (const struct utmpx *__line);
/* Write the entry UTMPX into the user accounting database.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern struct utmpx *pututxline (const struct utmpx *__utmpx);
#ifdef __USE_GNU
/* Change name of the utmpx file to be examined.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int utmpxname (const char *__file);
/* Append entry UTMP to the wtmpx-like file WTMPX_FILE.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void updwtmpx (const char *__wtmpx_file,
const struct utmpx *__utmpx);
/* Copy the information in UTMPX to UTMP.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void getutmp (const struct utmpx *__utmpx,
struct utmp *__utmp);
/* Copy the information in UTMP to UTMPX.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void getutmpx (const struct utmp *__utmp, struct utmpx *__utmpx);
#endif
__END_DECLS
#endif /* utmpx.h */
/****************************************************************************
* Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */
#ifndef NCURSES_DLL_H_incl
#define NCURSES_DLL_H_incl 1
/* 2014-08-02 workaround for broken MinGW compiler.
* Oddly, only TRACE is mapped to trace - the other -D's are okay.
* suggest TDM as an alternative.
*/
#if defined(__MINGW64__)
#elif defined(__MINGW32__)
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
#ifdef trace
#undef trace
#define TRACE
#endif
#endif /* broken compiler */
#endif /* MingW */
/*
* For reentrant code, we map the various global variables into SCREEN by
* using functions to access them.
*/
#define NCURSES_PUBLIC_VAR(name) _nc_##name
#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
/* no longer needed on cygwin or mingw, thanks to auto-import */
/* but this structure may be useful at some point for an MSVC build */
/* so, for now unconditionally define the important flags */
/* "the right way" for proper static and dll+auto-import behavior */
#undef NCURSES_DLL
#define NCURSES_STATIC
#if defined(__CYGWIN__) || defined(__MINGW32__)
# if defined(NCURSES_DLL)
# if defined(NCURSES_STATIC)
# undef NCURSES_STATIC
# endif
# endif
# undef NCURSES_IMPEXP
# undef NCURSES_API
# undef NCURSES_EXPORT
# undef NCURSES_EXPORT_VAR
# if defined(NCURSES_DLL)
/* building a DLL */
# define NCURSES_IMPEXP __declspec(dllexport)
# elif defined(NCURSES_STATIC)
/* building or linking to a static library */
# define NCURSES_IMPEXP /* nothing */
# else
/* linking to the DLL */
# define NCURSES_IMPEXP __declspec(dllimport)
# endif
# define NCURSES_API __cdecl
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
#endif
/* Take care of non-cygwin platforms */
#if !defined(NCURSES_IMPEXP)
# define NCURSES_IMPEXP /* nothing */
#endif
#if !defined(NCURSES_API)
# define NCURSES_API /* nothing */
#endif
#if !defined(NCURSES_EXPORT)
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
#endif
#if !defined(NCURSES_EXPORT_VAR)
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
#endif
#endif /* NCURSES_DLL_H_incl */
/*
* jpeglib.h
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file defines the application interface for the JPEG library.
* Most applications using the library need only include this file,
* and perhaps jerror.h if they want to know the exact error codes.
*/
#ifndef JPEGLIB_H
#define JPEGLIB_H
/*
* First we include the configuration files that record how this
* installation of the JPEG library is set up. jconfig.h can be
* generated automatically for many systems. jmorecfg.h contains
* manual configuration options that most people need not worry about.
*/
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
#include "jconfig.h" /* widely used configuration options */
#endif
#include "jmorecfg.h" /* seldom changed options */
#ifdef __cplusplus
#ifndef DONT_USE_EXTERN_C
extern "C" {
#endif
#endif
/* Various constants determining the sizes of things.
* All of these are specified by the JPEG standard, so don't change them
* if you want to be compatible.
*/
#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */
#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
* the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
* If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
* to handle it. We even let you do this from the jconfig.h file. However,
* we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
* sometimes emits noncompliant files doesn't mean you should too.
*/
#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
#ifndef D_MAX_BLOCKS_IN_MCU
#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
#endif
/* Data structures for images (arrays of samples and of DCT coefficients).
*/
typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */
typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */
typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
typedef JCOEF *JCOEFPTR; /* useful in a couple of places */
/* Types for JPEG compression parameters and working tables. */
/* DCT coefficient quantization tables. */
typedef struct {
/* This array gives the coefficient quantizers in natural array order
* (not the zigzag order in which they are stored in a JPEG DQT marker).
* CAUTION: IJG versions prior to v6a kept this array in zigzag order.
*/
UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */
/* This field is used only during compression. It's initialized FALSE when
* the table is created, and set TRUE when it's been output to the file.
* You could suppress output of a table by setting this to TRUE.
* (See jpeg_suppress_tables for an example.)
*/
boolean sent_table; /* TRUE when table has been output */
} JQUANT_TBL;
/* Huffman coding tables. */
typedef struct {
/* These two fields directly represent the contents of a JPEG DHT marker */
UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
/* length k bits; bits[0] is unused */
UINT8 huffval[256]; /* The symbols, in order of incr code length */
/* This field is used only during compression. It's initialized FALSE when
* the table is created, and set TRUE when it's been output to the file.
* You could suppress output of a table by setting this to TRUE.
* (See jpeg_suppress_tables for an example.)
*/
boolean sent_table; /* TRUE when table has been output */
} JHUFF_TBL;
/* Basic info about one component (color channel). */
typedef struct {
/* These values are fixed over the whole image. */
/* For compression, they must be supplied by parameter setup; */
/* for decompression, they are read from the SOF marker. */
int component_id; /* identifier for this component (0..255) */
int component_index; /* its index in SOF or cinfo->comp_info[] */
int h_samp_factor; /* horizontal sampling factor (1..4) */
int v_samp_factor; /* vertical sampling factor (1..4) */
int quant_tbl_no; /* quantization table selector (0..3) */
/* These values may vary between scans. */
/* For compression, they must be supplied by parameter setup; */
/* for decompression, they are read from the SOS marker. */
/* The decompressor output side may not use these variables. */
int dc_tbl_no; /* DC entropy table selector (0..3) */
int ac_tbl_no; /* AC entropy table selector (0..3) */
/* Remaining fields should be treated as private by applications. */
/* These values are computed during compression or decompression startup: */
/* Component's size in DCT blocks.
* Any dummy blocks added to complete an MCU are not counted; therefore
* these values do not depend on whether a scan is interleaved or not.
*/
JDIMENSION width_in_blocks;
JDIMENSION height_in_blocks;
/* Size of a DCT block in samples. Always DCTSIZE for compression.
* For decompression this is the size of the output from one DCT block,
* reflecting any scaling we choose to apply during the IDCT step.
* Values from 1 to 16 are supported.
* Note that different components may receive different IDCT scalings.
*/
#if JPEG_LIB_VERSION >= 70
int DCT_h_scaled_size;
int DCT_v_scaled_size;
#else
int DCT_scaled_size;
#endif
/* The downsampled dimensions are the component's actual, unpadded number
* of samples at the main buffer (preprocessing/compression interface), thus
* downsampled_width = ceil(image_width * Hi/Hmax)
* and similarly for height. For decompression, IDCT scaling is included, so
* downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZE)
*/
JDIMENSION downsampled_width; /* actual width in samples */
JDIMENSION downsampled_height; /* actual height in samples */
/* This flag is used only for decompression. In cases where some of the
* components will be ignored (eg grayscale output from YCbCr image),
* we can skip most computations for the unused components.
*/
boolean component_needed; /* do we need the value of this component? */
/* These values are computed before starting a scan of the component. */
/* The decompressor output side may not use these variables. */
int MCU_width; /* number of blocks per MCU, horizontally */
int MCU_height; /* number of blocks per MCU, vertically */
int MCU_blocks; /* MCU_width * MCU_height */
int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */
int last_col_width; /* # of non-dummy blocks across in last MCU */
int last_row_height; /* # of non-dummy blocks down in last MCU */
/* Saved quantization table for component; NULL if none yet saved.
* See jdinput.c comments about the need for this information.
* This field is currently used only for decompression.
*/
JQUANT_TBL *quant_table;
/* Private per-component storage for DCT or IDCT subsystem. */
void *dct_table;
} jpeg_component_info;
/* The script for encoding a multiple-scan file is an array of these: */
typedef struct {
int comps_in_scan; /* number of components encoded in this scan */
int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
int Ss, Se; /* progressive JPEG spectral selection parms */
int Ah, Al; /* progressive JPEG successive approx. parms */
} jpeg_scan_info;
/* The decompressor can save APPn and COM markers in a list of these: */
typedef struct jpeg_marker_struct *jpeg_saved_marker_ptr;
struct jpeg_marker_struct {
jpeg_saved_marker_ptr next; /* next in list, or NULL */
UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
unsigned int original_length; /* # bytes of data in the file */
unsigned int data_length; /* # bytes of data saved at data[] */
JOCTET *data; /* the data contained in the marker */
/* the marker length word is not counted in data_length or original_length */
};
/* Known color spaces. */
#define JCS_EXTENSIONS 1
#define JCS_ALPHA_EXTENSIONS 1
typedef enum {
JCS_UNKNOWN, /* error/unspecified */
JCS_GRAYSCALE, /* monochrome */
JCS_RGB, /* red/green/blue as specified by the RGB_RED,
RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros */
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
JCS_CMYK, /* C/M/Y/K */
JCS_YCCK, /* Y/Cb/Cr/K */
JCS_EXT_RGB, /* red/green/blue */
JCS_EXT_RGBX, /* red/green/blue/x */
JCS_EXT_BGR, /* blue/green/red */
JCS_EXT_BGRX, /* blue/green/red/x */
JCS_EXT_XBGR, /* x/blue/green/red */
JCS_EXT_XRGB, /* x/red/green/blue */
/* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR,
or JCS_EXT_XRGB during decompression, the X byte is undefined, and in
order to ensure the best performance, libjpeg-turbo can set that byte to
whatever value it wishes. Use the following colorspace constants to
ensure that the X byte is set to 0xFF, so that it can be interpreted as an
opaque alpha channel. */
JCS_EXT_RGBA, /* red/green/blue/alpha */
JCS_EXT_BGRA, /* blue/green/red/alpha */
JCS_EXT_ABGR, /* alpha/blue/green/red */
JCS_EXT_ARGB, /* alpha/red/green/blue */
JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue */
} J_COLOR_SPACE;
/* DCT/IDCT algorithm options. */
typedef enum {
JDCT_ISLOW, /* slow but accurate integer algorithm */
JDCT_IFAST, /* faster, less accurate integer method */
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
} J_DCT_METHOD;
#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
#define JDCT_DEFAULT JDCT_ISLOW
#endif
#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
#define JDCT_FASTEST JDCT_IFAST
#endif
/* Dithering options for decompression. */
typedef enum {
JDITHER_NONE, /* no dithering */
JDITHER_ORDERED, /* simple ordered dither */
JDITHER_FS /* Floyd-Steinberg error diffusion dither */
} J_DITHER_MODE;
/* Common fields between JPEG compression and decompression master structs. */
#define jpeg_common_fields \
struct jpeg_error_mgr *err; /* Error handler module */\
struct jpeg_memory_mgr *mem; /* Memory manager module */\
struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */\
void *client_data; /* Available for use by application */\
boolean is_decompressor; /* So common code can tell which is which */\
int global_state /* For checking call sequence validity */
/* Routines that are to be used by both halves of the library are declared
* to receive a pointer to this structure. There are no actual instances of
* jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
*/
struct jpeg_common_struct {
jpeg_common_fields; /* Fields common to both master struct types */
/* Additional fields follow in an actual jpeg_compress_struct or
* jpeg_decompress_struct. All three structs must agree on these
* initial fields! (This would be a lot cleaner in C++.)
*/
};
typedef struct jpeg_common_struct *j_common_ptr;
typedef struct jpeg_compress_struct *j_compress_ptr;
typedef struct jpeg_decompress_struct *j_decompress_ptr;
/* Master record for a compression instance */
struct jpeg_compress_struct {
jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
/* Destination for compressed data */
struct jpeg_destination_mgr *dest;
/* Description of source image --- these fields must be filled in by
* outer application before starting compression. in_color_space must
* be correct before you can even call jpeg_set_defaults().
*/
JDIMENSION image_width; /* input image width */
JDIMENSION image_height; /* input image height */
int input_components; /* # of color components in input image */
J_COLOR_SPACE in_color_space; /* colorspace of input image */
double input_gamma; /* image gamma of input image */
/* Compression parameters --- these fields must be set before calling
* jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
* initialize everything to reasonable defaults, then changing anything
* the application specifically wants to change. That way you won't get
* burnt when new parameters are added. Also note that there are several
* helper routines to simplify changing parameters.
*/
#if JPEG_LIB_VERSION >= 70
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
JDIMENSION jpeg_width; /* scaled JPEG image width */
JDIMENSION jpeg_height; /* scaled JPEG image height */
/* Dimensions of actual JPEG image that will be written to file,
* derived from input dimensions by scaling factors above.
* These fields are computed by jpeg_start_compress().
* You can also use jpeg_calc_jpeg_dimensions() to determine these values
* in advance of calling jpeg_start_compress().
*/
#endif
int data_precision; /* bits of precision in image data */
int num_components; /* # of color components in JPEG image */
J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
jpeg_component_info *comp_info;
/* comp_info[i] describes component that appears i'th in SOF */
JQUANT_TBL *quant_tbl_ptrs[NUM_QUANT_TBLS];
#if JPEG_LIB_VERSION >= 70
int q_scale_factor[NUM_QUANT_TBLS];
#endif
/* ptrs to coefficient quantization tables, or NULL if not defined,
* and corresponding scale factors (percentage, initialized 100).
*/
JHUFF_TBL *dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
JHUFF_TBL *ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
/* ptrs to Huffman coding tables, or NULL if not defined */
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
int num_scans; /* # of entries in scan_info array */
const jpeg_scan_info *scan_info; /* script for multi-scan file, or NULL */
/* The default value of scan_info is NULL, which causes a single-scan
* sequential JPEG file to be emitted. To create a multi-scan file,
* set num_scans and scan_info to point to an array of scan definitions.
*/
boolean raw_data_in; /* TRUE=caller supplies downsampled data */
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
#if JPEG_LIB_VERSION >= 70
boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */
#endif
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
J_DCT_METHOD dct_method; /* DCT algorithm selector */
/* The restart interval can be specified in absolute MCUs by setting
* restart_interval, or in MCU rows by setting restart_in_rows
* (in which case the correct restart_interval will be figured
* for each scan).
*/
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
int restart_in_rows; /* if > 0, MCU rows per restart interval */
/* Parameters controlling emission of special markers. */
boolean write_JFIF_header; /* should a JFIF marker be written? */
UINT8 JFIF_major_version; /* What to write for the JFIF version number */
UINT8 JFIF_minor_version;
/* These three values are not used by the JPEG code, merely copied */
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
/* ratio is defined by X_density/Y_density even when density_unit=0. */
UINT8 density_unit; /* JFIF code for pixel size units */
UINT16 X_density; /* Horizontal pixel density */
UINT16 Y_density; /* Vertical pixel density */
boolean write_Adobe_marker; /* should an Adobe marker be written? */
/* State variable: index of next scanline to be written to
* jpeg_write_scanlines(). Application may use this to control its
* processing loop, e.g., "while (next_scanline < image_height)".
*/
JDIMENSION next_scanline; /* 0 .. image_height-1 */
/* Remaining fields are known throughout compressor, but generally
* should not be touched by a surrounding application.
*/
/*
* These fields are computed during compression startup
*/
boolean progressive_mode; /* TRUE if scan script uses progressive mode */
int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */
#if JPEG_LIB_VERSION >= 70
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
#endif
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
/* The coefficient controller receives data in units of MCU rows as defined
* for fully interleaved scans (whether the JPEG file is interleaved or not).
* There are v_samp_factor * DCTSIZE sample rows of each component in an
* "iMCU" (interleaved MCU) row.
*/
/*
* These fields are valid during any one scan.
* They describe the components and MCUs actually appearing in the scan.
*/
int comps_in_scan; /* # of JPEG components in this scan */
jpeg_component_info *cur_comp_info[MAX_COMPS_IN_SCAN];
/* *cur_comp_info[i] describes component that appears i'th in SOS */
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
/* MCU_membership[i] is index in cur_comp_info of component owning */
/* i'th block in an MCU */
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
#if JPEG_LIB_VERSION >= 80
int block_size; /* the basic DCT block size: 1..16 */
const int *natural_order; /* natural-order position array */
int lim_Se; /* min( Se, DCTSIZE2-1 ) */
#endif
/*
* Links to compression subobjects (methods and private variables of modules)
*/
struct jpeg_comp_master *master;
struct jpeg_c_main_controller *main;
struct jpeg_c_prep_controller *prep;
struct jpeg_c_coef_controller *coef;
struct jpeg_marker_writer *marker;
struct jpeg_color_converter *cconvert;
struct jpeg_downsampler *downsample;
struct jpeg_forward_dct *fdct;
struct jpeg_entropy_encoder *entropy;
jpeg_scan_info *script_space; /* workspace for jpeg_simple_progression */
int script_space_size;
};
/* Master record for a decompression instance */
struct jpeg_decompress_struct {
jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
/* Source of compressed data */
struct jpeg_source_mgr *src;
/* Basic description of image --- filled in by jpeg_read_header(). */
/* Application may inspect these values to decide how to process image. */
JDIMENSION image_width; /* nominal image width (from SOF marker) */
JDIMENSION image_height; /* nominal image height */
int num_components; /* # of color components in JPEG image */
J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
/* Decompression processing parameters --- these fields must be set before
* calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
* them to default values.
*/
J_COLOR_SPACE out_color_space; /* colorspace for output */
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
double output_gamma; /* image gamma wanted in output */
boolean buffered_image; /* TRUE=multiple output passes */
boolean raw_data_out; /* TRUE=downsampled data wanted */
J_DCT_METHOD dct_method; /* IDCT algorithm selector */
boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
boolean do_block_smoothing; /* TRUE=apply interblock smoothing */
boolean quantize_colors; /* TRUE=colormapped output wanted */
/* the following are ignored if not quantize_colors: */
J_DITHER_MODE dither_mode; /* type of color dithering to use */
boolean two_pass_quantize; /* TRUE=use two-pass color quantization */
int desired_number_of_colors; /* max # colors to use in created colormap */
/* these are significant only in buffered-image mode: */
boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */
boolean enable_external_quant;/* enable future use of external colormap */
boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */
/* Description of actual output image that will be returned to application.
* These fields are computed by jpeg_start_decompress().
* You can also use jpeg_calc_output_dimensions() to determine these values
* in advance of calling jpeg_start_decompress().
*/
JDIMENSION output_width; /* scaled image width */
JDIMENSION output_height; /* scaled image height */
int out_color_components; /* # of color components in out_color_space */
int output_components; /* # of color components returned */
/* output_components is 1 (a colormap index) when quantizing colors;
* otherwise it equals out_color_components.
*/
int rec_outbuf_height; /* min recommended height of scanline buffer */
/* If the buffer passed to jpeg_read_scanlines() is less than this many rows
* high, space and time will be wasted due to unnecessary data copying.
* Usually rec_outbuf_height will be 1 or 2, at most 4.
*/
/* When quantizing colors, the output colormap is described by these fields.
* The application can supply a colormap by setting colormap non-NULL before
* calling jpeg_start_decompress; otherwise a colormap is created during
* jpeg_start_decompress or jpeg_start_output.
* The map has out_color_components rows and actual_number_of_colors columns.
*/
int actual_number_of_colors; /* number of entries in use */
JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
/* State variables: these variables indicate the progress of decompression.
* The application may examine these but must not modify them.
*/
/* Row index of next scanline to be read from jpeg_read_scanlines().
* Application may use this to control its processing loop, e.g.,
* "while (output_scanline < output_height)".
*/
JDIMENSION output_scanline; /* 0 .. output_height-1 */
/* Current input scan number and number of iMCU rows completed in scan.
* These indicate the progress of the decompressor input side.
*/
int input_scan_number; /* Number of SOS markers seen so far */
JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */
/* The "output scan number" is the notional scan being displayed by the
* output side. The decompressor will not allow output scan/row number
* to get ahead of input scan/row, but it can fall arbitrarily far behind.
*/
int output_scan_number; /* Nominal scan number being displayed */
JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
/* Current progression status. coef_bits[c][i] indicates the precision
* with which component c's DCT coefficient i (in zigzag order) is known.
* It is -1 when no data has yet been received, otherwise it is the point
* transform (shift) value for the most recent scan of the coefficient
* (thus, 0 at completion of the progression).
* This pointer is NULL when reading a non-progressive file.
*/
int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */
/* Internal JPEG parameters --- the application usually need not look at
* these fields. Note that the decompressor output side may not use
* any parameters that can change between scans.
*/
/* Quantization and Huffman tables are carried forward across input
* datastreams when processing abbreviated JPEG datastreams.
*/
JQUANT_TBL *quant_tbl_ptrs[NUM_QUANT_TBLS];
/* ptrs to coefficient quantization tables, or NULL if not defined */
JHUFF_TBL *dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
JHUFF_TBL *ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
/* ptrs to Huffman coding tables, or NULL if not defined */
/* These parameters are never carried across datastreams, since they
* are given in SOF/SOS markers or defined to be reset by SOI.
*/
int data_precision; /* bits of precision in image data */
jpeg_component_info *comp_info;
/* comp_info[i] describes component that appears i'th in SOF */
#if JPEG_LIB_VERSION >= 80
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
#endif
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
/* These fields record data obtained from optional markers recognized by
* the JPEG library.
*/
boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
UINT8 JFIF_major_version; /* JFIF version number */
UINT8 JFIF_minor_version;
UINT8 density_unit; /* JFIF code for pixel size units */
UINT16 X_density; /* Horizontal pixel density */
UINT16 Y_density; /* Vertical pixel density */
boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
UINT8 Adobe_transform; /* Color transform code from Adobe marker */
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
/* Aside from the specific data retained from APPn markers known to the
* library, the uninterpreted contents of any or all APPn and COM markers
* can be saved in a list for examination by the application.
*/
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
/* Remaining fields are known throughout decompressor, but generally
* should not be touched by a surrounding application.
*/
/*
* These fields are computed during decompression startup
*/
int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */
#if JPEG_LIB_VERSION >= 70
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
#else
int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
#endif
JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
/* The coefficient controller's input and output progress is measured in
* units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
* in fully interleaved JPEG scans, but are used whether the scan is
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
* rows of each component. Therefore, the IDCT output contains
* v_samp_factor*DCT_[v_]scaled_size sample rows of a component per iMCU row.
*/
JSAMPLE *sample_range_limit; /* table for fast range-limiting */
/*
* These fields are valid during any one scan.
* They describe the components and MCUs actually appearing in the scan.
* Note that the decompressor output side must not use these fields.
*/
int comps_in_scan; /* # of JPEG components in this scan */
jpeg_component_info *cur_comp_info[MAX_COMPS_IN_SCAN];
/* *cur_comp_info[i] describes component that appears i'th in SOS */
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[D_MAX_BLOCKS_IN_MCU];
/* MCU_membership[i] is index in cur_comp_info of component owning */
/* i'th block in an MCU */
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
#if JPEG_LIB_VERSION >= 80
/* These fields are derived from Se of first SOS marker.
*/
int block_size; /* the basic DCT block size: 1..16 */
const int *natural_order; /* natural-order position array for entropy decode */
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
#endif
/* This field is shared between entropy decoder and marker parser.
* It is either zero or the code of a JPEG marker that has been
* read from the data source, but has not yet been processed.
*/
int unread_marker;
/*
* Links to decompression subobjects (methods, private variables of modules)
*/
struct jpeg_decomp_master *master;
struct jpeg_d_main_controller *main;
struct jpeg_d_coef_controller *coef;
struct jpeg_d_post_controller *post;
struct jpeg_input_controller *inputctl;
struct jpeg_marker_reader *marker;
struct jpeg_entropy_decoder *entropy;
struct jpeg_inverse_dct *idct;
struct jpeg_upsampler *upsample;
struct jpeg_color_deconverter *cconvert;
struct jpeg_color_quantizer *cquantize;
};
/* "Object" declarations for JPEG modules that may be supplied or called
* directly by the surrounding application.
* As with all objects in the JPEG library, these structs only define the
* publicly visible methods and state variables of a module. Additional
* private fields may exist after the public ones.
*/
/* Error handler object */
struct jpeg_error_mgr {
/* Error exit handler: does not return to caller */
void (*error_exit) (j_common_ptr cinfo);
/* Conditionally emit a trace or warning message */
void (*emit_message) (j_common_ptr cinfo, int msg_level);
/* Routine that actually outputs a trace or error message */
void (*output_message) (j_common_ptr cinfo);
/* Format a message string for the most recent JPEG error or message */
void (*format_message) (j_common_ptr cinfo, char *buffer);
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
/* Reset error state variables at start of a new image */
void (*reset_error_mgr) (j_common_ptr cinfo);
/* The message ID code and any parameters are saved here.
* A message can have one string parameter or up to 8 int parameters.
*/
int msg_code;
#define JMSG_STR_PARM_MAX 80
union {
int i[8];
char s[JMSG_STR_PARM_MAX];
} msg_parm;
/* Standard state variables for error facility */
int trace_level; /* max msg_level that will be displayed */
/* For recoverable corrupt-data errors, we emit a warning message,
* but keep going unless emit_message chooses to abort. emit_message
* should count warnings in num_warnings. The surrounding application
* can check for bad data by seeing if num_warnings is nonzero at the
* end of processing.
*/
long num_warnings; /* number of corrupt-data warnings */
/* These fields point to the table(s) of error message strings.
* An application can change the table pointer to switch to a different
* message list (typically, to change the language in which errors are
* reported). Some applications may wish to add additional error codes
* that will be handled by the JPEG library error mechanism; the second
* table pointer is used for this purpose.
*
* First table includes all errors generated by JPEG library itself.
* Error code 0 is reserved for a "no such error string" message.
*/
const char * const *jpeg_message_table; /* Library errors */
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
/* Second table can be added by application (see cjpeg/djpeg for example).
* It contains strings numbered first_addon_message..last_addon_message.
*/
const char * const *addon_message_table; /* Non-library errors */
int first_addon_message; /* code for first string in addon table */
int last_addon_message; /* code for last string in addon table */
};
/* Progress monitor object */
struct jpeg_progress_mgr {
void (*progress_monitor) (j_common_ptr cinfo);
long pass_counter; /* work units completed in this pass */
long pass_limit; /* total number of work units in this pass */
int completed_passes; /* passes completed so far */
int total_passes; /* total number of passes expected */
};
/* Data destination object for compression */
struct jpeg_destination_mgr {
JOCTET *next_output_byte; /* => next byte to write in buffer */
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
void (*init_destination) (j_compress_ptr cinfo);
boolean (*empty_output_buffer) (j_compress_ptr cinfo);
void (*term_destination) (j_compress_ptr cinfo);
};
/* Data source object for decompression */
struct jpeg_source_mgr {
const JOCTET *next_input_byte; /* => next byte to read from buffer */
size_t bytes_in_buffer; /* # of bytes remaining in buffer */
void (*init_source) (j_decompress_ptr cinfo);
boolean (*fill_input_buffer) (j_decompress_ptr cinfo);
void (*skip_input_data) (j_decompress_ptr cinfo, long num_bytes);
boolean (*resync_to_restart) (j_decompress_ptr cinfo, int desired);
void (*term_source) (j_decompress_ptr cinfo);
};
/* Memory manager object.
* Allocates "small" objects (a few K total), "large" objects (tens of K),
* and "really big" objects (virtual arrays with backing store if needed).
* The memory manager does not allow individual objects to be freed; rather,
* each created object is assigned to a pool, and whole pools can be freed
* at once. This is faster and more convenient than remembering exactly what
* to free, especially where malloc()/free() are not too speedy.
* NB: alloc routines never return NULL. They exit to error_exit if not
* successful.
*/
#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
#define JPOOL_NUMPOOLS 2
typedef struct jvirt_sarray_control *jvirt_sarray_ptr;
typedef struct jvirt_barray_control *jvirt_barray_ptr;
struct jpeg_memory_mgr {
/* Method pointers */
void *(*alloc_small) (j_common_ptr cinfo, int pool_id, size_t sizeofobject);
void *(*alloc_large) (j_common_ptr cinfo, int pool_id,
size_t sizeofobject);
JSAMPARRAY (*alloc_sarray) (j_common_ptr cinfo, int pool_id,
JDIMENSION samplesperrow, JDIMENSION numrows);
JBLOCKARRAY (*alloc_barray) (j_common_ptr cinfo, int pool_id,
JDIMENSION blocksperrow, JDIMENSION numrows);
jvirt_sarray_ptr (*request_virt_sarray) (j_common_ptr cinfo, int pool_id,
boolean pre_zero,
JDIMENSION samplesperrow,
JDIMENSION numrows,
JDIMENSION maxaccess);
jvirt_barray_ptr (*request_virt_barray) (j_common_ptr cinfo, int pool_id,
boolean pre_zero,
JDIMENSION blocksperrow,
JDIMENSION numrows,
JDIMENSION maxaccess);
void (*realize_virt_arrays) (j_common_ptr cinfo);
JSAMPARRAY (*access_virt_sarray) (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows,
boolean writable);
JBLOCKARRAY (*access_virt_barray) (j_common_ptr cinfo, jvirt_barray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows,
boolean writable);
void (*free_pool) (j_common_ptr cinfo, int pool_id);
void (*self_destruct) (j_common_ptr cinfo);
/* Limit on memory allocation for this JPEG object. (Note that this is
* merely advisory, not a guaranteed maximum; it only affects the space
* used for virtual-array buffers.) May be changed by outer application
* after creating the JPEG object.
*/
long max_memory_to_use;
/* Maximum allocation request accepted by alloc_large. */
long max_alloc_chunk;
};
/* Routine signature for application-supplied marker processing methods.
* Need not pass marker code since it is stored in cinfo->unread_marker.
*/
typedef boolean (*jpeg_marker_parser_method) (j_decompress_ptr cinfo);
/* Originally, this macro was used as a way of defining function prototypes
* for both modern compilers as well as older compilers that did not support
* prototype parameters. libjpeg-turbo has never supported these older,
* non-ANSI compilers, but the macro is still included because there is some
* software out there that uses it.
*/
#define JPP(arglist) arglist
/* Default error-management setup */
EXTERN(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr *err);
/* Initialization of JPEG compression objects.
* jpeg_create_compress() and jpeg_create_decompress() are the exported
* names that applications should call. These expand to calls on
* jpeg_CreateCompress and jpeg_CreateDecompress with additional information
* passed for version mismatch checking.
* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
*/
#define jpeg_create_compress(cinfo) \
jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
(size_t) sizeof(struct jpeg_compress_struct))
#define jpeg_create_decompress(cinfo) \
jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
(size_t) sizeof(struct jpeg_decompress_struct))
EXTERN(void) jpeg_CreateCompress (j_compress_ptr cinfo, int version,
size_t structsize);
EXTERN(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version,
size_t structsize);
/* Destruction of JPEG compression objects */
EXTERN(void) jpeg_destroy_compress (j_compress_ptr cinfo);
EXTERN(void) jpeg_destroy_decompress (j_decompress_ptr cinfo);
/* Standard data source and destination managers: stdio streams. */
/* Caller is responsible for opening the file before and closing after. */
EXTERN(void) jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile);
EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile);
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
/* Data source and destination managers: memory buffers. */
EXTERN(void) jpeg_mem_dest (j_compress_ptr cinfo, unsigned char **outbuffer,
unsigned long *outsize);
EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo,
const unsigned char *inbuffer,
unsigned long insize);
#endif
/* Default parameter setup for compression */
EXTERN(void) jpeg_set_defaults (j_compress_ptr cinfo);
/* Compression parameter setup aids */
EXTERN(void) jpeg_set_colorspace (j_compress_ptr cinfo,
J_COLOR_SPACE colorspace);
EXTERN(void) jpeg_default_colorspace (j_compress_ptr cinfo);
EXTERN(void) jpeg_set_quality (j_compress_ptr cinfo, int quality,
boolean force_baseline);
EXTERN(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
boolean force_baseline);
#if JPEG_LIB_VERSION >= 70
EXTERN(void) jpeg_default_qtables (j_compress_ptr cinfo,
boolean force_baseline);
#endif
EXTERN(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
const unsigned int *basic_table,
int scale_factor, boolean force_baseline);
EXTERN(int) jpeg_quality_scaling (int quality);
EXTERN(void) jpeg_simple_progression (j_compress_ptr cinfo);
EXTERN(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress);
EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo);
EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table (j_common_ptr cinfo);
/* Main entry points for compression */
EXTERN(void) jpeg_start_compress (j_compress_ptr cinfo,
boolean write_all_tables);
EXTERN(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo,
JSAMPARRAY scanlines,
JDIMENSION num_lines);
EXTERN(void) jpeg_finish_compress (j_compress_ptr cinfo);
#if JPEG_LIB_VERSION >= 70
/* Precalculate JPEG dimensions for current compression parameters. */
EXTERN(void) jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo);
#endif
/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
EXTERN(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
JDIMENSION num_lines);
/* Write a special marker. See libjpeg.txt concerning safe usage. */
EXTERN(void) jpeg_write_marker (j_compress_ptr cinfo, int marker,
const JOCTET *dataptr, unsigned int datalen);
/* Same, but piecemeal. */
EXTERN(void) jpeg_write_m_header (j_compress_ptr cinfo, int marker,
unsigned int datalen);
EXTERN(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val);
/* Alternate compression function: just write an abbreviated table file */
EXTERN(void) jpeg_write_tables (j_compress_ptr cinfo);
/* Decompression startup: read start of JPEG datastream to see what's there */
EXTERN(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image);
/* Return value is one of: */
#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
#define JPEG_HEADER_OK 1 /* Found valid image datastream */
#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
/* If you pass require_image = TRUE (normal case), you need not check for
* a TABLES_ONLY return code; an abbreviated file will cause an error exit.
* JPEG_SUSPENDED is only possible if you use a data source module that can
* give a suspension return (the stdio source module doesn't).
*/
/* Main entry points for decompression */
EXTERN(boolean) jpeg_start_decompress (j_decompress_ptr cinfo);
EXTERN(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo,
JSAMPARRAY scanlines,
JDIMENSION max_lines);
EXTERN(JDIMENSION) jpeg_skip_scanlines (j_decompress_ptr cinfo,
JDIMENSION num_lines);
EXTERN(void) jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
JDIMENSION *width);
EXTERN(boolean) jpeg_finish_decompress (j_decompress_ptr cinfo);
/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
EXTERN(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
JDIMENSION max_lines);
/* Additional entry points for buffered-image mode. */
EXTERN(boolean) jpeg_has_multiple_scans (j_decompress_ptr cinfo);
EXTERN(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number);
EXTERN(boolean) jpeg_finish_output (j_decompress_ptr cinfo);
EXTERN(boolean) jpeg_input_complete (j_decompress_ptr cinfo);
EXTERN(void) jpeg_new_colormap (j_decompress_ptr cinfo);
EXTERN(int) jpeg_consume_input (j_decompress_ptr cinfo);
/* Return value is one of: */
/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
#define JPEG_REACHED_SOS 1 /* Reached start of new scan */
#define JPEG_REACHED_EOI 2 /* Reached end of image */
#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */
#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
/* Precalculate output dimensions for current decompression parameters. */
#if JPEG_LIB_VERSION >= 80
EXTERN(void) jpeg_core_output_dimensions (j_decompress_ptr cinfo);
#endif
EXTERN(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo);
/* Control saving of COM and APPn markers into marker_list. */
EXTERN(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
unsigned int length_limit);
/* Install a special processing method for COM or APPn markers. */
EXTERN(void) jpeg_set_marker_processor (j_decompress_ptr cinfo,
int marker_code,
jpeg_marker_parser_method routine);
/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients (j_decompress_ptr cinfo);
EXTERN(void) jpeg_write_coefficients (j_compress_ptr cinfo,
jvirt_barray_ptr *coef_arrays);
EXTERN(void) jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
j_compress_ptr dstinfo);
/* If you choose to abort compression or decompression before completing
* jpeg_finish_(de)compress, then you need to clean up to release memory,
* temporary files, etc. You can just call jpeg_destroy_(de)compress
* if you're done with the JPEG object, but if you want to clean it up and
* reuse it, call this:
*/
EXTERN(void) jpeg_abort_compress (j_compress_ptr cinfo);
EXTERN(void) jpeg_abort_decompress (j_decompress_ptr cinfo);
/* Generic versions of jpeg_abort and jpeg_destroy that work on either
* flavor of JPEG object. These may be more convenient in some places.
*/
EXTERN(void) jpeg_abort (j_common_ptr cinfo);
EXTERN(void) jpeg_destroy (j_common_ptr cinfo);
/* Default restart-marker-resync procedure for use by data source modules */
EXTERN(boolean) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired);
/* These marker codes are exported since applications and data source modules
* are likely to want to use them.
*/
#define JPEG_RST0 0xD0 /* RST0 marker code */
#define JPEG_EOI 0xD9 /* EOI marker code */
#define JPEG_APP0 0xE0 /* APP0 marker code */
#define JPEG_COM 0xFE /* COM marker code */
/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
* for structure definitions that are never filled in, keep it quiet by
* supplying dummy definitions for the various substructures.
*/
#ifdef INCOMPLETE_TYPES_BROKEN
#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
struct jvirt_sarray_control { long dummy; };
struct jvirt_barray_control { long dummy; };
struct jpeg_comp_master { long dummy; };
struct jpeg_c_main_controller { long dummy; };
struct jpeg_c_prep_controller { long dummy; };
struct jpeg_c_coef_controller { long dummy; };
struct jpeg_marker_writer { long dummy; };
struct jpeg_color_converter { long dummy; };
struct jpeg_downsampler { long dummy; };
struct jpeg_forward_dct { long dummy; };
struct jpeg_entropy_encoder { long dummy; };
struct jpeg_decomp_master { long dummy; };
struct jpeg_d_main_controller { long dummy; };
struct jpeg_d_coef_controller { long dummy; };
struct jpeg_d_post_controller { long dummy; };
struct jpeg_input_controller { long dummy; };
struct jpeg_marker_reader { long dummy; };
struct jpeg_entropy_decoder { long dummy; };
struct jpeg_inverse_dct { long dummy; };
struct jpeg_upsampler { long dummy; };
struct jpeg_color_deconverter { long dummy; };
struct jpeg_color_quantizer { long dummy; };
#endif /* JPEG_INTERNALS */
#endif /* INCOMPLETE_TYPES_BROKEN */
/*
* The JPEG library modules define JPEG_INTERNALS before including this file.
* The internal structure declarations are read only when that is true.
* Applications using the library should not include jpegint.h, but may wish
* to include jerror.h.
*/
#ifdef JPEG_INTERNALS
#include "jpegint.h" /* fetch private declarations */
#include "jerror.h" /* fetch error codes too */
#endif
#ifdef __cplusplus
#ifndef DONT_USE_EXTERN_C
}
#endif
#endif
#endif /* JPEGLIB_H */
/****************************************************************************
* Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: form.h,v 0.27 2017/02/11 16:35:42 tom Exp $ */
#ifndef FORM_H
#define FORM_H
/* *INDENT-OFF*/
#include <curses.h>
#include <eti.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef FORM_PRIV_H
typedef void *FIELD_CELL;
#endif
#ifndef NCURSES_FIELD_INTERNALS
#define NCURSES_FIELD_INTERNALS /* nothing */
#endif
typedef int Form_Options;
typedef int Field_Options;
/**********
* _PAGE *
**********/
typedef struct pagenode
#if !NCURSES_OPAQUE_FORM
{
short pmin; /* index of first field on page */
short pmax; /* index of last field on page */
short smin; /* index of top leftmost field on page */
short smax; /* index of bottom rightmost field on page */
}
#endif /* !NCURSES_OPAQUE_FORM */
_PAGE;
/**********
* FIELD *
**********/
typedef struct fieldnode
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
{
unsigned short status; /* flags */
short rows; /* size in rows */
short cols; /* size in cols */
short frow; /* first row */
short fcol; /* first col */
int drows; /* dynamic rows */
int dcols; /* dynamic cols */
int maxgrow; /* maximum field growth */
int nrow; /* off-screen rows */
short nbuf; /* additional buffers */
short just; /* justification */
short page; /* page on form */
short index; /* into form -> field */
int pad; /* pad character */
chtype fore; /* foreground attribute */
chtype back; /* background attribute */
Field_Options opts; /* options */
struct fieldnode * snext; /* sorted order pointer */
struct fieldnode * sprev; /* sorted order pointer */
struct fieldnode * link; /* linked field chain */
struct formnode * form; /* containing form */
struct typenode * type; /* field type */
void * arg; /* argument for type */
FIELD_CELL * buf; /* field buffers */
void * usrptr; /* user pointer */
/*
* The wide-character configuration requires extra information. Because
* there are existing applications that manipulate the members of FIELD
* directly, we cannot make the struct opaque, except by changing the ABI.
* Offsets of members up to this point are the same in the narrow- and
* wide-character configuration. But note that the type of buf depends on
* the configuration, and is made opaque for that reason.
*/
NCURSES_FIELD_INTERNALS
}
#endif /* NCURSES_OPAQUE_FORM */
FIELD;
/*********
* FORM *
*********/
typedef struct formnode
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
{
unsigned short status; /* flags */
short rows; /* size in rows */
short cols; /* size in cols */
int currow; /* current row in field window */
int curcol; /* current col in field window */
int toprow; /* in scrollable field window */
int begincol; /* in horiz. scrollable field */
short maxfield; /* number of fields */
short maxpage; /* number of pages */
short curpage; /* index into page */
Form_Options opts; /* options */
WINDOW * win; /* window */
WINDOW * sub; /* subwindow */
WINDOW * w; /* window for current field */
FIELD ** field; /* field [maxfield] */
FIELD * current; /* current field */
_PAGE * page; /* page [maxpage] */
void * usrptr; /* user pointer */
void (*forminit)(struct formnode *);
void (*formterm)(struct formnode *);
void (*fieldinit)(struct formnode *);
void (*fieldterm)(struct formnode *);
}
#endif /* !NCURSES_OPAQUE_FORM */
FORM;
/**************
* FIELDTYPE *
**************/
typedef struct typenode
#if !NCURSES_OPAQUE_FORM
{
unsigned short status; /* flags */
long ref; /* reference count */
struct typenode * left; /* ptr to operand for | */
struct typenode * right; /* ptr to operand for | */
void* (*makearg)(va_list *); /* make fieldtype arg */
void* (*copyarg)(const void *); /* copy fieldtype arg */
void (*freearg)(void *); /* free fieldtype arg */
#if NCURSES_INTEROP_FUNCS
union {
bool (*ofcheck)(FIELD *,const void *); /* field validation */
bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
} fieldcheck;
union {
bool (*occheck)(int,const void *); /* character validation */
bool (*gccheck)(int,FORM*,
FIELD*,const void*); /* generic char validation */
} charcheck;
union {
bool (*onext)(FIELD *,const void *); /* enumerate next value */
bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
} enum_next;
union {
bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
} enum_prev;
void* (*genericarg)(void*); /* Alternate Arg method */
#else
bool (*fcheck)(FIELD *,const void *); /* field validation */
bool (*ccheck)(int,const void *); /* character validation */
bool (*next)(FIELD *,const void *); /* enumerate next value */
bool (*prev)(FIELD *,const void *); /* enumerate prev value */
#endif
}
#endif /* !NCURSES_OPAQUE_FORM */
FIELDTYPE;
typedef void (*Form_Hook)(FORM *);
/***************************
* miscellaneous #defines *
***************************/
/* field justification */
#define NO_JUSTIFICATION (0)
#define JUSTIFY_LEFT (1)
#define JUSTIFY_CENTER (2)
#define JUSTIFY_RIGHT (3)
/* field options */
#define O_VISIBLE (0x0001U)
#define O_ACTIVE (0x0002U)
#define O_PUBLIC (0x0004U)
#define O_EDIT (0x0008U)
#define O_WRAP (0x0010U)
#define O_BLANK (0x0020U)
#define O_AUTOSKIP (0x0040U)
#define O_NULLOK (0x0080U)
#define O_PASSOK (0x0100U)
#define O_STATIC (0x0200U)
#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */
#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */
/* form options */
#define O_NL_OVERLOAD (0x0001U)
#define O_BS_OVERLOAD (0x0002U)
/* form driver commands */
#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */
#if defined(MAX_COMMAND)
# if (MAX_FORM_COMMAND > MAX_COMMAND)
# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
# elif (MAX_COMMAND != (KEY_MAX + 128))
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
# endif
#else
# define MAX_COMMAND (KEY_MAX + 128)
#endif
/*************************
* standard field types *
*************************/
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
/************************************
* built-in additional field types *
* They are not defined in SVr4 *
************************************/
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
/***********************
* FIELDTYPE routines *
***********************/
extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
bool (* const field_check)(FIELD *,const void *),
bool (* const char_check)(int,const void *));
extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(
FIELDTYPE *, FIELDTYPE *);
extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *);
extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
void * (* const make_arg)(va_list *),
void * (* const copy_arg)(const void *),
void (* const free_arg)(void *));
extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
bool (* const next_choice)(FIELD *,const void *),
bool (* const prev_choice)(FIELD *,const void *));
/*******************
* FIELD routines *
*******************/
extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int);
extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int);
extern NCURSES_EXPORT(int) free_field (FIELD *);
extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int);
extern NCURSES_EXPORT(int) move_field (FIELD *,int,int);
extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool);
extern NCURSES_EXPORT(int) set_field_just (FIELD *,int);
extern NCURSES_EXPORT(int) field_just (const FIELD *);
extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype);
extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype);
extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int);
extern NCURSES_EXPORT(int) field_pad (const FIELD *);
extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool);
extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *);
extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options);
extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options);
extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options);
extern NCURSES_EXPORT(chtype) field_fore (const FIELD *);
extern NCURSES_EXPORT(chtype) field_back (const FIELD *);
extern NCURSES_EXPORT(bool) new_page (const FIELD *);
extern NCURSES_EXPORT(bool) field_status (const FIELD *);
extern NCURSES_EXPORT(void *) field_arg (const FIELD *);
extern NCURSES_EXPORT(void *) field_userptr (const FIELD *);
extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *);
extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int);
extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *);
/******************
* FORM routines *
******************/
extern NCURSES_EXPORT(FORM *) new_form (FIELD **);
extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *);
extern NCURSES_EXPORT(FIELD *) current_field (const FORM *);
extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *);
extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *);
extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *);
extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *);
extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *);
extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *);
extern NCURSES_EXPORT(int) free_form (FORM *);
extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **);
extern NCURSES_EXPORT(int) field_count (const FORM *);
extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *);
extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *);
extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *);
extern NCURSES_EXPORT(int) unfocus_current_field (FORM *);
extern NCURSES_EXPORT(int) field_index (const FIELD *);
extern NCURSES_EXPORT(int) set_form_page (FORM *,int);
extern NCURSES_EXPORT(int) form_page (const FORM *);
extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *);
extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) post_form (FORM *);
extern NCURSES_EXPORT(int) unpost_form (FORM *);
extern NCURSES_EXPORT(int) pos_form_cursor (FORM *);
extern NCURSES_EXPORT(int) form_driver (FORM *,int);
# if NCURSES_WIDECHAR
extern NCURSES_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
# endif
extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *);
extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_request_by_name (const char *);
extern NCURSES_EXPORT(const char *) form_request_name (int);
extern NCURSES_EXPORT(void *) form_userptr (const FORM *);
extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *);
extern NCURSES_EXPORT(bool) data_ahead (const FORM *);
extern NCURSES_EXPORT(bool) data_behind (const FORM *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
#endif
#ifdef __cplusplus
}
#endif
/* *INDENT-ON*/
#endif /* FORM_H */
/****************************************************************************
* Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
#define CURSES 1
#define CURSES_H 1
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 6
#define NCURSES_VERSION_MINOR 1
#define NCURSES_VERSION_PATCH 20180224
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.1"
/*
* Identify the mouse encoding version.
*/
#define NCURSES_MOUSE_VERSION 2
/*
* Definitions to facilitate DLL's.
*/
#include <ncurses_dll.h>
#if 1
#include <stdint.h>
#endif
/*
* User-definable tweak to disable the include of <stdbool.h>.
*/
#ifndef NCURSES_ENABLE_STDBOOL_H
#define NCURSES_ENABLE_STDBOOL_H 1
#endif
/*
* NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
* configured using --disable-macros.
*/
#ifndef NCURSES_ATTR_T
#define NCURSES_ATTR_T int
#endif
/*
* Expands to 'const' if ncurses is configured using --enable-const. Note that
* doing so makes it incompatible with other implementations of X/Open Curses.
*/
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_INLINE
#define NCURSES_INLINE inline
/*
* The standard type used for color values, and for color-pairs. The latter
* allows the curses library to enumerate the combinations of foreground and
* background colors used by an application, and is normally the product of the
* total foreground and background colors.
*
* X/Open uses "short" for both of these types, ultimately because they are
* numbers from the SVr4 terminal database, which uses 16-bit signed values.
*/
#undef NCURSES_COLOR_T
#define NCURSES_COLOR_T short
#undef NCURSES_PAIRS_T
#define NCURSES_PAIRS_T short
/*
* Definitions used to make WINDOW and similar structs opaque.
*/
#ifndef NCURSES_INTERNALS
#define NCURSES_OPAQUE 0
#define NCURSES_OPAQUE_FORM 0
#define NCURSES_OPAQUE_MENU 0
#define NCURSES_OPAQUE_PANEL 0
#endif
/*
* Definition used to optionally suppress wattr* macros to help with the
* transition from ncurses5 to ncurses6 by allowing the header files to
* be shared across development packages for ncursesw in both ABIs.
*/
#ifndef NCURSES_WATTR_MACROS
#define NCURSES_WATTR_MACROS 0
#endif
/*
* The reentrant code relies on the opaque setting, but adds features.
*/
#ifndef NCURSES_REENTRANT
#define NCURSES_REENTRANT 0
#endif
/*
* Control whether bindings for interop support are added.
*/
#undef NCURSES_INTEROP_FUNCS
#define NCURSES_INTEROP_FUNCS 1
/*
* The internal type used for window dimensions.
*/
#undef NCURSES_SIZE_T
#define NCURSES_SIZE_T short
/*
* Control whether tparm() supports varargs or fixed-parameter list.
*/
#undef NCURSES_TPARM_VARARGS
#define NCURSES_TPARM_VARARGS 1
/*
* Control type used for tparm's arguments. While X/Open equates long and
* char* values, this is not always workable for 64-bit platforms.
*/
#undef NCURSES_TPARM_ARG
#define NCURSES_TPARM_ARG intptr_t
/*
* Control whether ncurses uses wcwidth() for checking width of line-drawing
* characters.
*/
#undef NCURSES_WCWIDTH_GRAPHICS
#define NCURSES_WCWIDTH_GRAPHICS 1
/*
* NCURSES_CH_T is used in building the library, but not used otherwise in
* this header file, since that would make the normal/wide-character versions
* of the header incompatible.
*/
#undef NCURSES_CH_T
#define NCURSES_CH_T cchar_t
#if 1 && defined(_LP64)
typedef unsigned chtype;
typedef unsigned mmask_t;
#else
typedef uint32_t chtype;
typedef uint32_t mmask_t;
#endif
/*
* We need FILE, etc. Include this before checking any feature symbols.
*/
#include <stdio.h>
/*
* With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
* conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is
* not already defined, e.g., if the platform relies upon nonstandard feature
* test macros, define it at this point if the standard feature test macros
* indicate that it should be defined.
*/
#ifndef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
#define NCURSES_WIDECHAR 1
#else
#define NCURSES_WIDECHAR 0
#endif
#endif /* NCURSES_WIDECHAR */
#include <stdarg.h> /* we need va_list */
#if NCURSES_WIDECHAR
#include <stddef.h> /* we want wchar_t */
#endif
/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also
* implement it. If so, we must use the C++ compiler's type to avoid conflict
* with other interfaces.
*
* A further complication is that <stdbool.h> may declare 'bool' to be a
* different type, such as an enum which is not necessarily compatible with
* C++. If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
* Otherwise, let it remain a typedef to avoid conflicts with other #define's.
* In either case, make a typedef for NCURSES_BOOL which can be used if needed
* from either C or C++.
*/
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0
typedef unsigned char NCURSES_BOOL;
#if defined(__cplusplus) /* __cplusplus, etc. */
/* use the C++ compiler's bool type */
#define NCURSES_BOOL bool
#else /* c89, c99, etc. */
#if NCURSES_ENABLE_STDBOOL_H
#include <stdbool.h>
/* use whatever the C compiler decides bool really is */
#define NCURSES_BOOL bool
#else
/* there is no predefined bool - use our own */
#undef bool
#define bool NCURSES_BOOL
#endif
#endif /* !__cplusplus, etc. */
#ifdef __cplusplus
extern "C" {
#define NCURSES_CAST(type,value) static_cast<type>(value)
#else
#define NCURSES_CAST(type,value) (type)(value)
#endif
#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p)))
/*
* X/Open attributes. In the ncurses implementation, they are identical to the
* A_ attributes.
*/
#define WA_ATTRIBUTES A_ATTRIBUTES
#define WA_NORMAL A_NORMAL
#define WA_STANDOUT A_STANDOUT
#define WA_UNDERLINE A_UNDERLINE
#define WA_REVERSE A_REVERSE
#define WA_BLINK A_BLINK
#define WA_DIM A_DIM
#define WA_BOLD A_BOLD
#define WA_ALTCHARSET A_ALTCHARSET
#define WA_INVIS A_INVIS
#define WA_PROTECT A_PROTECT
#define WA_HORIZONTAL A_HORIZONTAL
#define WA_LEFT A_LEFT
#define WA_LOW A_LOW
#define WA_RIGHT A_RIGHT
#define WA_TOP A_TOP
#define WA_VERTICAL A_VERTICAL
#if 1
#define WA_ITALIC A_ITALIC /* ncurses extension */
#endif
/* colors */
#define COLOR_BLACK 0
#define COLOR_RED 1
#define COLOR_GREEN 2
#define COLOR_YELLOW 3
#define COLOR_BLUE 4
#define COLOR_MAGENTA 5
#define COLOR_CYAN 6
#define COLOR_WHITE 7
/* line graphics */
#if 0 || NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(chtype*, acs_map);
#define acs_map NCURSES_PUBLIC_VAR(acs_map())
#else
extern NCURSES_EXPORT_VAR(chtype) acs_map[];
#endif
#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))])
/* VT100 symbols begin here */
#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */
#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */
#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */
#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */
#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */
#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */
#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */
#define ACS_VLINE NCURSES_ACS('x') /* vertical line */
#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */
#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */
#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */
#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */
#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */
#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */
#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */
#define ACS_BULLET NCURSES_ACS('~') /* bullet */
/* Teletype 5410v1 symbols begin here */
#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */
#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */
#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */
#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */
#define ACS_BOARD NCURSES_ACS('h') /* board of squares */
#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */
#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */
/*
* These aren't documented, but a lot of System Vs have them anyway
* (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
* The ACS_names may not match AT&T's, our source didn't know them.
*/
#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */
#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */
#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */
#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */
#define ACS_PI NCURSES_ACS('{') /* Pi */
#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */
#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */
/*
* Line drawing ACS names are of the form ACS_trbl, where t is the top, r
* is the right, b is the bottom, and l is the left. t, r, b, and l might
* be B (blank), S (single), D (double), or T (thick). The subset defined
* here only uses B and S.
*/
#define ACS_BSSB ACS_ULCORNER
#define ACS_SSBB ACS_LLCORNER
#define ACS_BBSS ACS_URCORNER
#define ACS_SBBS ACS_LRCORNER
#define ACS_SBSS ACS_RTEE
#define ACS_SSSB ACS_LTEE
#define ACS_SSBS ACS_BTEE
#define ACS_BSSS ACS_TTEE
#define ACS_BSBS ACS_HLINE
#define ACS_SBSB ACS_VLINE
#define ACS_SSSS ACS_PLUS
#undef ERR
#define ERR (-1)
#undef OK
#define OK (0)
/* values for the _flags member */
#define _SUBWIN 0x01 /* is this a sub-window? */
#define _ENDLINE 0x02 /* is the window flush right? */
#define _FULLWIN 0x04 /* is the window full-screen? */
#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */
#define _ISPAD 0x10 /* is this window a pad? */
#define _HASMOVED 0x20 /* has cursor moved since last refresh? */
#define _WRAPPED 0x40 /* cursor was just wrappped */
/*
* this value is used in the firstchar and lastchar fields to mark
* unchanged lines
*/
#define _NOCHANGE -1
/*
* this value is used in the oldindex field to mark lines created by insertions
* and scrolls.
*/
#define _NEWINDEX -1
typedef struct screen SCREEN;
typedef struct _win_st WINDOW;
typedef chtype attr_t; /* ...must be at least as wide as chtype */
#if NCURSES_WIDECHAR
#if 0
#ifdef mblen /* libutf8.h defines it w/o undefining first */
#undef mblen
#endif
#include <libutf8.h>
#endif
#if 1
#include <wchar.h> /* ...to get mbstate_t, etc. */
#endif
#if 0
typedef unsigned short wchar_t1;
#endif
#if 0
typedef unsigned int wint_t1;
#endif
/*
* cchar_t stores an array of CCHARW_MAX wide characters. The first is
* normally a spacing character. The others are non-spacing. If those
* (spacing and nonspacing) do not fill the array, a null L'\0' follows.
* Otherwise, a null is assumed to follow when extracting via getcchar().
*/
#define CCHARW_MAX 5
typedef struct
{
attr_t attr;
wchar_t chars[CCHARW_MAX];
#if 1
#undef NCURSES_EXT_COLORS
#define NCURSES_EXT_COLORS 20180224
int ext_color; /* color pair, must be more than 16-bits */
#endif
}
cchar_t;
#endif /* NCURSES_WIDECHAR */
#if !NCURSES_OPAQUE
struct ldat;
struct _win_st
{
NCURSES_SIZE_T _cury, _curx; /* current cursor position */
/* window location and size */
NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
short _flags; /* window state flags */
/* attribute tracking */
attr_t _attrs; /* current attribute for non-space character */
chtype _bkgd; /* current background char/attribute pair */
/* option values set by user */
bool _notimeout; /* no time out on function-key entry? */
bool _clear; /* consider all data in the window invalid? */
bool _leaveok; /* OK to not reset cursor on exit? */
bool _scroll; /* OK to scroll this window? */
bool _idlok; /* OK to use insert/delete line? */
bool _idcok; /* OK to use insert/delete char? */
bool _immed; /* window in immed mode? (not yet used) */
bool _sync; /* window in sync mode? */
bool _use_keypad; /* process function keys into KEY_ symbols? */
int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */
struct ldat *_line; /* the actual line data */
/* global screen state */
NCURSES_SIZE_T _regtop; /* top line of scrolling region */
NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
/* these are used only if this is a sub-window */
int _parx; /* x coordinate of this window in parent */
int _pary; /* y coordinate of this window in parent */
WINDOW *_parent; /* pointer to parent if a sub-window */
/* these are used only if this is a pad */
struct pdat
{
NCURSES_SIZE_T _pad_y, _pad_x;
NCURSES_SIZE_T _pad_top, _pad_left;
NCURSES_SIZE_T _pad_bottom, _pad_right;
} _pad;
NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
#if NCURSES_WIDECHAR
cchar_t _bkgrnd; /* current background char/attribute pair */
#if 1
int _color; /* current color-pair for non-space character */
#endif
#endif
};
#endif /* NCURSES_OPAQUE */
/*
* This is an extension to support events...
*/
#if 1
#ifdef NCURSES_WGETCH_EVENTS
#if !defined(__BEOS__) || defined(__HAIKU__)
/* Fix _nc_timed_wait() on BEOS... */
# define NCURSES_EVENT_VERSION 1
#endif /* !defined(__BEOS__) */
/*
* Bits to set in _nc_event.data.flags
*/
# define _NC_EVENT_TIMEOUT_MSEC 1
# define _NC_EVENT_FILE 2
# define _NC_EVENT_FILE_READABLE 2
# if 0 /* Not supported yet... */
# define _NC_EVENT_FILE_WRITABLE 4
# define _NC_EVENT_FILE_EXCEPTION 8
# endif
typedef struct
{
int type;
union
{
long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */
struct
{
unsigned int flags;
int fd;
unsigned int result;
} fev; /* _NC_EVENT_FILE */
} data;
} _nc_event;
typedef struct
{
int count;
int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
_nc_event *events[1];
} _nc_eventlist;
extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *); /* experimental */
extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */
#endif /* NCURSES_WGETCH_EVENTS */
#endif /* NCURSES_EXT_FUNCS */
/*
* GCC (and some other compilers) define '__attribute__'; we're using this
* macro to alert the compiler to flag inconsistencies in printf/scanf-like
* function calls. Just in case '__attribute__' isn't defined, make a dummy.
* Old versions of G++ do not accept it anyway, at least not consistently with
* GCC.
*/
#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
#define __attribute__(p) /* nothing */
#endif
/*
* We cannot define these in ncurses_cfg.h, since they require parameters to be
* passed (that is non-portable). If you happen to be using gcc with warnings
* enabled, define
* GCC_PRINTF
* GCC_SCANF
* to improve checking of calls to printw(), etc.
*/
#ifndef GCC_PRINTFLIKE
#if defined(GCC_PRINTF) && !defined(printf)
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
#else
#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
#endif
#endif
#ifndef GCC_SCANFLIKE
#if defined(GCC_SCANF) && !defined(scanf)
#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
#else
#define GCC_SCANFLIKE(fmt,var) /*nothing*/
#endif
#endif
#ifndef GCC_NORETURN
#define GCC_NORETURN /* nothing */
#endif
#ifndef GCC_UNUSED
#define GCC_UNUSED /* nothing */
#endif
/*
* Curses uses a helper function. Define our type for this to simplify
* extending it for the sp-funcs feature.
*/
typedef int (*NCURSES_OUTC)(int);
/*
* Function prototypes. This is the complete X/Open Curses list of required
* functions. Those marked `generated' will have sources generated from the
* macro definitions later in this file, in order to satisfy XPG4.2
* requirements.
*/
extern NCURSES_EXPORT(int) addch (const chtype); /* generated */
extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */
extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */
extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */
extern NCURSES_EXPORT(int) addstr (const char *); /* generated */
extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) baudrate (void); /* implemented */
extern NCURSES_EXPORT(int) beep (void); /* implemented */
extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */
extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */
extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */
extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */
extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */
extern NCURSES_EXPORT(int) cbreak (void); /* implemented */
extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) clear (void); /* generated */
extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) clrtobot (void); /* generated */
extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */
extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */
extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */
extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) curs_set (int); /* implemented */
extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */
extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */
extern NCURSES_EXPORT(int) delay_output (int); /* implemented */
extern NCURSES_EXPORT(int) delch (void); /* generated */
extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */
extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) deleteln (void); /* generated */
extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) doupdate (void); /* implemented */
extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) echo (void); /* implemented */
extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */
extern NCURSES_EXPORT(int) erase (void); /* generated */
extern NCURSES_EXPORT(int) endwin (void); /* implemented */
extern NCURSES_EXPORT(char) erasechar (void); /* implemented */
extern NCURSES_EXPORT(void) filter (void); /* implemented */
extern NCURSES_EXPORT(int) flash (void); /* implemented */
extern NCURSES_EXPORT(int) flushinp (void); /* implemented */
extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getch (void); /* generated */
extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) getstr (char *); /* generated */
extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */
extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */
extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */
extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */
extern NCURSES_EXPORT(bool) has_il (void); /* implemented */
extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */
extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(chtype) inch (void); /* generated */
extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */
extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */
extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */
extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) insch (chtype); /* generated */
extern NCURSES_EXPORT(int) insdelln (int); /* generated */
extern NCURSES_EXPORT(int) insertln (void); /* generated */
extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */
extern NCURSES_EXPORT(int) insstr (const char *); /* generated */
extern NCURSES_EXPORT(int) instr (char *); /* generated */
extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */
extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */
extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */
extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(char) killchar (void); /* implemented */
extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(char *) longname (void); /* implemented */
extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) move (int, int); /* generated */
extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */
extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */
extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */
extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */
extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */
GCC_PRINTFLIKE(3,4);
extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(3,4);
extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */
extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */
extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */
extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */
GCC_PRINTFLIKE(4,5);
extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(4,5);
extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) napms (int); /* implemented */
extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */
extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */
extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) nl (void); /* implemented */
extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */
extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) noecho (void); /* implemented */
extern NCURSES_EXPORT(int) nonl (void); /* implemented */
extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */
extern NCURSES_EXPORT(int) noraw (void); /* implemented */
extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */
extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */
GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */
extern NCURSES_EXPORT(void) qiflush (void); /* implemented */
extern NCURSES_EXPORT(int) raw (void); /* implemented */
extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) refresh (void); /* generated */
extern NCURSES_EXPORT(int) resetty (void); /* implemented */
extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */
extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */
extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */
extern NCURSES_EXPORT(int) savetty (void); /* implemented */
extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(1,2);
extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */
extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */
extern NCURSES_EXPORT(int) scrl (int); /* generated */
extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */
extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */
extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */
extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */
extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */
extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */
extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */
extern NCURSES_EXPORT(int) slk_init (int); /* implemented */
extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */
extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */
extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */
extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */
extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */
extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */
extern NCURSES_EXPORT(int) standout (void); /* generated */
extern NCURSES_EXPORT(int) standend (void); /* generated */
extern NCURSES_EXPORT(int) start_color (void); /* implemented */
extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */
extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */
extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */
extern NCURSES_EXPORT(char *) termname (void); /* implemented */
extern NCURSES_EXPORT(void) timeout (int); /* generated */
extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) typeahead (int); /* implemented */
extern NCURSES_EXPORT(int) ungetch (int); /* implemented */
extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) use_env (bool); /* implemented */
extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */
extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */
extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */
extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */
extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */
extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */
extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */
extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */
extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */
extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */
extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */
extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */
extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */
extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */
extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */
extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */
extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */
extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */
extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */
extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */
extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */
extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */
GCC_PRINTFLIKE(2,3);
extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(2,3);
extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */
extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */
/*
* These are also declared in <term.h>:
*/
extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(int) putp (const char *); /* implemented */
#if NCURSES_TPARM_VARARGS
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */
extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */
#endif
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */
/*
* X/Open says this returns a bool; SVr4 also checked for out-of-range line.
* The macro provides compatibility:
*/
#define is_linetouched(w,l) ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w),(l)))
/*
* These functions are not in X/Open, but we use them in macro definitions:
*/
extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
/*
* vid_attr() was implemented originally based on a draft of X/Open curses.
*/
#if !NCURSES_WIDECHAR
#define vid_attr(a,pair,opts) vidattr(a)
#endif
/*
* These functions are extensions - not in X/Open Curses.
*/
#if 1
#undef NCURSES_EXT_FUNCS
#define NCURSES_EXT_FUNCS 20180224
typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
extern NCURSES_EXPORT(bool) is_term_resized (int, int);
extern NCURSES_EXPORT(char *) keybound (int, int);
extern NCURSES_EXPORT(const char *) curses_version (void);
extern NCURSES_EXPORT(int) alloc_pair (int, int);
extern NCURSES_EXPORT(int) assume_default_colors (int, int);
extern NCURSES_EXPORT(int) define_key (const char *, int);
extern NCURSES_EXPORT(int) extended_color_content(int, int *, int *, int *);
extern NCURSES_EXPORT(int) extended_pair_content(int, int *, int *);
extern NCURSES_EXPORT(int) extended_slk_color(int);
extern NCURSES_EXPORT(int) find_pair (int, int);
extern NCURSES_EXPORT(int) free_pair (int);
extern NCURSES_EXPORT(int) get_escdelay (void);
extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int);
extern NCURSES_EXPORT(int) init_extended_pair(int, int, int);
extern NCURSES_EXPORT(int) key_defined (const char *);
extern NCURSES_EXPORT(int) keyok (int, bool);
extern NCURSES_EXPORT(void) reset_color_pairs (void);
extern NCURSES_EXPORT(int) resize_term (int, int);
extern NCURSES_EXPORT(int) resizeterm (int, int);
extern NCURSES_EXPORT(int) set_escdelay (int);
extern NCURSES_EXPORT(int) set_tabsize (int);
extern NCURSES_EXPORT(int) use_default_colors (void);
extern NCURSES_EXPORT(int) use_extended_names (bool);
extern NCURSES_EXPORT(int) use_legacy_coding (int);
extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
extern NCURSES_EXPORT(void) nofilter(void);
/*
* These extensions provide access to information stored in the WINDOW even
* when NCURSES_OPAQUE is set:
*/
extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
#else
#define curses_version() NCURSES_VERSION
#endif
/*
* Extra extension-functions, which pass a SCREEN pointer rather than using
* a global variable SP.
*/
#if 1
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 20180224
#define NCURSES_SP_NAME(name) name##_sp
/* Define the sp-funcs helper function */
#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC)
typedef int (*NCURSES_SP_OUTC)(SCREEN*, int);
extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#if 1
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(alloc_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content) (SCREEN*, int, int *, int *, int *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content) (SCREEN*, int, int *, int *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_slk_color) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(find_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(free_pair) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color) (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_pair) (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(reset_color_pairs) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
#endif
#else
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 0
#define NCURSES_SP_NAME(name) name
#define NCURSES_SP_OUTC NCURSES_OUTC
#endif
/* attributes */
#define NCURSES_ATTR_SHIFT 8
#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT))
#define A_NORMAL (1U - 1U)
#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U),0)
#define A_CHARTEXT (NCURSES_BITS(1U,0) - 1U)
#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0)
#define A_STANDOUT NCURSES_BITS(1U,8)
#define A_UNDERLINE NCURSES_BITS(1U,9)
#define A_REVERSE NCURSES_BITS(1U,10)
#define A_BLINK NCURSES_BITS(1U,11)
#define A_DIM NCURSES_BITS(1U,12)
#define A_BOLD NCURSES_BITS(1U,13)
#define A_ALTCHARSET NCURSES_BITS(1U,14)
#define A_INVIS NCURSES_BITS(1U,15)
#define A_PROTECT NCURSES_BITS(1U,16)
#define A_HORIZONTAL NCURSES_BITS(1U,17)
#define A_LEFT NCURSES_BITS(1U,18)
#define A_LOW NCURSES_BITS(1U,19)
#define A_RIGHT NCURSES_BITS(1U,20)
#define A_TOP NCURSES_BITS(1U,21)
#define A_VERTICAL NCURSES_BITS(1U,22)
#if 1
#define A_ITALIC NCURSES_BITS(1U,23) /* ncurses extension */
#endif
/*
* Most of the pseudo functions are macros that either provide compatibility
* with older versions of curses, or provide inline functionality to improve
* performance.
*/
/*
* These pseudo functions are always implemented as macros:
*/
#define getyx(win,y,x) (y = getcury(win), x = getcurx(win))
#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win))
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
#define getparyx(win,y,x) (y = getpary(win), x = getparx(win))
#define getsyx(y,x) do { if (newscr) { \
if (is_leaveok(newscr)) \
(y) = (x) = -1; \
else \
getyx(newscr,(y), (x)); \
} \
} while(0)
#define setsyx(y,x) do { if (newscr) { \
if ((y) == -1 && (x) == -1) \
leaveok(newscr, TRUE); \
else { \
leaveok(newscr, FALSE); \
wmove(newscr, (y), (x)); \
} \
} \
} while(0)
#ifndef NCURSES_NOMACROS
/*
* These miscellaneous pseudo functions are provided for compatibility:
*/
#define wgetstr(w, s) wgetnstr(w, s, -1)
#define getnstr(s, n) wgetnstr(stdscr, s, (n))
#define setterm(term) setupterm(term, 1, (int *)0)
#define fixterm() reset_prog_mode()
#define resetterm() reset_shell_mode()
#define saveterm() def_prog_mode()
#define crmode() cbreak()
#define nocrmode() nocbreak()
#define gettmode()
/* It seems older SYSV curses versions define these */
#if !NCURSES_OPAQUE
#define getattrs(win) NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL)
#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR)
#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR)
#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR)
#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR)
#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR)
#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR)
#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR)
#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR)
#endif /* NCURSES_OPAQUE */
#define wstandout(win) (wattrset(win,A_STANDOUT))
#define wstandend(win) (wattrset(win,A_NORMAL))
#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && 1
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \
(win)->_attrs = NCURSES_CAST(attr_t, at), \
OK) \
: ERR)
#else
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_attrs = NCURSES_CAST(attr_t, at), \
OK) \
: ERR)
#endif
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
#define scroll(win) wscrl(win,1)
#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1)
#define touchline(win, s, c) wtouchln((win), s, c, 1)
#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0)
#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
#define hline(ch, n) whline(stdscr, ch, (n))
#define vline(ch, n) wvline(stdscr, ch, (n))
#define winstr(w, s) winnstr(w, s, -1)
#define winchstr(w, s) winchnstr(w, s, -1)
#define winsstr(w, s) winsnstr(w, s, -1)
#if !NCURSES_OPAQUE
#define redrawwin(win) wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy+1 : -1))
#endif /* NCURSES_OPAQUE */
#define waddstr(win,str) waddnstr(win,str,-1)
#define waddchstr(win,str) waddchnstr(win,str,-1)
/*
* These apply to the first 256 color pairs.
*/
#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR)
#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
/*
* pseudo functions for standard screen
*/
#define addch(ch) waddch(stdscr,(ch))
#define addchnstr(str,n) waddchnstr(stdscr,(str),(n))
#define addchstr(str) waddchstr(stdscr,(str))
#define addnstr(str,n) waddnstr(stdscr,(str),(n))
#define addstr(str) waddnstr(stdscr,(str),-1)
#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o))
#define attr_off(a,o) wattr_off(stdscr,(a),(o))
#define attr_on(a,o) wattr_on(stdscr,(a),(o))
#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o))
#define attroff(at) wattroff(stdscr,(at))
#define attron(at) wattron(stdscr,(at))
#define attrset(at) wattrset(stdscr,(at))
#define bkgd(ch) wbkgd(stdscr,(ch))
#define bkgdset(ch) wbkgdset(stdscr,(ch))
#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o))
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define color_set(c,o) wcolor_set(stdscr,(c),(o))
#define delch() wdelch(stdscr)
#define deleteln() winsdelln(stdscr,-1)
#define echochar(c) wechochar(stdscr,(c))
#define erase() werase(stdscr)
#define getch() wgetch(stdscr)
#define getstr(str) wgetstr(stdscr,(str))
#define inch() winch(stdscr)
#define inchnstr(s,n) winchnstr(stdscr,(s),(n))
#define inchstr(s) winchstr(stdscr,(s))
#define innstr(s,n) winnstr(stdscr,(s),(n))
#define insch(c) winsch(stdscr,(c))
#define insdelln(n) winsdelln(stdscr,(n))
#define insertln() winsdelln(stdscr,1)
#define insnstr(s,n) winsnstr(stdscr,(s),(n))
#define insstr(s) winsstr(stdscr,(s))
#define instr(s) winstr(stdscr,(s))
#define move(y,x) wmove(stdscr,(y),(x))
#define refresh() wrefresh(stdscr)
#define scrl(n) wscrl(stdscr,(n))
#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b))
#define standend() wstandend(stdscr)
#define standout() wstandout(stdscr)
#define timeout(delay) wtimeout(stdscr,(delay))
#define wdeleteln(win) winsdelln(win,-1)
#define winsertln(win) winsdelln(win,1)
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch)))
#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n)))
#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1))
#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n)))
#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1))
#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o)))
#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win))
#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win))
#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n)))
#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str)))
#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n)))
#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n)))
#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s)))
#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n)))
#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c)))
#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n)))
#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s)))
#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s)))
#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n)))
#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch))
#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n))
#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str))
#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n))
#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str))
#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o))
#define mvdelch(y,x) mvwdelch(stdscr,(y),(x))
#define mvgetch(y,x) mvwgetch(stdscr,(y),(x))
#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n))
#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str))
#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n))
#define mvinch(y,x) mvwinch(stdscr,(y),(x))
#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n))
#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s))
#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n))
#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c))
#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n))
#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s))
#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s))
#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n))
/*
* Some wide-character functions can be implemented without the extensions.
*/
#if !NCURSES_OPAQUE
#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0)
#endif /* NCURSES_OPAQUE */
#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a))
#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a))
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && 1
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = ((a) & ~A_COLOR), \
(win)->_color = (opts) ? *(int *)(opts) : (p)), \
OK) \
: ERR)
#define wattr_get(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)(NCURSES_OK_ADDR(a) \
? (*(a) = (win)->_attrs) \
: OK), \
(void)(NCURSES_OK_ADDR(p) \
? (*(p) = (NCURSES_PAIRS_T) (win)->_color) \
: OK), \
(void)(NCURSES_OK_ADDR(opts) \
? (*(int *)(opts) = (win)->_color) \
: OK), \
OK) \
: ERR)
#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \
(attr_t)COLOR_PAIR(p))), \
OK) \
: ERR)
#define wattr_get(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)(NCURSES_OK_ADDR(a) \
? (*(a) = (win)->_attrs) \
: OK), \
(void)(NCURSES_OK_ADDR(p) \
? (*(p) = (NCURSES_PAIRS_T) PAIR_NUMBER((win)->_attrs)) \
: OK), \
OK) \
: ERR)
#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
/*
* X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
* varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to
* use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already
* use stdarg.h, so...
*/
#define vw_printw vwprintw
#define vw_scanw vwscanw
/*
* Export fallback function for use in C++ binding.
*/
#if !1
#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
#endif
/*
* These macros are extensions - not in X/Open Curses.
*/
#if 1
#if !NCURSES_OPAQUE
#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE)
#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE)
#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE)
#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE)
#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE)
#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE)
#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE)
#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE)
#define is_pad(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE)
#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE)
#define is_subwin(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE)
#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE)
#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0)
#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0)
#define wgetscrreg(win,t,b) (NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
#endif
#endif
#endif /* NCURSES_NOMACROS */
/*
* Public variables.
*
* Notes:
* a. ESCDELAY was an undocumented feature under AIX curses.
* It gives the ESC expire time in milliseconds.
* b. ttytype is needed for backward compatibility
*/
#if NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(WINDOW *, curscr);
NCURSES_WRAPPED_VAR(WINDOW *, newscr);
NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
NCURSES_WRAPPED_VAR(char *, ttytype);
NCURSES_WRAPPED_VAR(int, COLORS);
NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
NCURSES_WRAPPED_VAR(int, COLS);
NCURSES_WRAPPED_VAR(int, ESCDELAY);
NCURSES_WRAPPED_VAR(int, LINES);
NCURSES_WRAPPED_VAR(int, TABSIZE);
#define curscr NCURSES_PUBLIC_VAR(curscr())
#define newscr NCURSES_PUBLIC_VAR(newscr())
#define stdscr NCURSES_PUBLIC_VAR(stdscr())
#define ttytype NCURSES_PUBLIC_VAR(ttytype())
#define COLORS NCURSES_PUBLIC_VAR(COLORS())
#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
#define COLS NCURSES_PUBLIC_VAR(COLS())
#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY())
#define LINES NCURSES_PUBLIC_VAR(LINES())
#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE())
#else
extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
extern NCURSES_EXPORT_VAR(char) ttytype[];
extern NCURSES_EXPORT_VAR(int) COLORS;
extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
extern NCURSES_EXPORT_VAR(int) COLS;
extern NCURSES_EXPORT_VAR(int) ESCDELAY;
extern NCURSES_EXPORT_VAR(int) LINES;
extern NCURSES_EXPORT_VAR(int) TABSIZE;
#endif
/*
* Pseudo-character tokens outside ASCII range. The curses wgetch() function
* will return any given one of these only if the corresponding k- capability
* is defined in your terminal's terminfo entry.
*
* Some keys (KEY_A1, etc) are arranged like this:
* a1 up a3
* left b2 right
* c1 down c3
*
* A few key codes do not depend upon the terminfo entry.
*/
#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */
#define KEY_MIN 0401 /* Minimum curses key */
#define KEY_BREAK 0401 /* Break key (unreliable) */
#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */
#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */
/*
* These definitions were generated by ./MKkey_defs.sh ./Caps
*/
#define KEY_DOWN 0402 /* down-arrow key */
#define KEY_UP 0403 /* up-arrow key */
#define KEY_LEFT 0404 /* left-arrow key */
#define KEY_RIGHT 0405 /* right-arrow key */
#define KEY_HOME 0406 /* home key */
#define KEY_BACKSPACE 0407 /* backspace key */
#define KEY_F0 0410 /* Function keys. Space for 64 */
#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */
#define KEY_DL 0510 /* delete-line key */
#define KEY_IL 0511 /* insert-line key */
#define KEY_DC 0512 /* delete-character key */
#define KEY_IC 0513 /* insert-character key */
#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */
#define KEY_CLEAR 0515 /* clear-screen or erase key */
#define KEY_EOS 0516 /* clear-to-end-of-screen key */
#define KEY_EOL 0517 /* clear-to-end-of-line key */
#define KEY_SF 0520 /* scroll-forward key */
#define KEY_SR 0521 /* scroll-backward key */
#define KEY_NPAGE 0522 /* next-page key */
#define KEY_PPAGE 0523 /* previous-page key */
#define KEY_STAB 0524 /* set-tab key */
#define KEY_CTAB 0525 /* clear-tab key */
#define KEY_CATAB 0526 /* clear-all-tabs key */
#define KEY_ENTER 0527 /* enter/send key */
#define KEY_PRINT 0532 /* print key */
#define KEY_LL 0533 /* lower-left key (home down) */
#define KEY_A1 0534 /* upper left of keypad */
#define KEY_A3 0535 /* upper right of keypad */
#define KEY_B2 0536 /* center of keypad */
#define KEY_C1 0537 /* lower left of keypad */
#define KEY_C3 0540 /* lower right of keypad */
#define KEY_BTAB 0541 /* back-tab key */
#define KEY_BEG 0542 /* begin key */
#define KEY_CANCEL 0543 /* cancel key */
#define KEY_CLOSE 0544 /* close key */
#define KEY_COMMAND 0545 /* command key */
#define KEY_COPY 0546 /* copy key */
#define KEY_CREATE 0547 /* create key */
#define KEY_END 0550 /* end key */
#define KEY_EXIT 0551 /* exit key */
#define KEY_FIND 0552 /* find key */
#define KEY_HELP 0553 /* help key */
#define KEY_MARK 0554 /* mark key */
#define KEY_MESSAGE 0555 /* message key */
#define KEY_MOVE 0556 /* move key */
#define KEY_NEXT 0557 /* next key */
#define KEY_OPEN 0560 /* open key */
#define KEY_OPTIONS 0561 /* options key */
#define KEY_PREVIOUS 0562 /* previous key */
#define KEY_REDO 0563 /* redo key */
#define KEY_REFERENCE 0564 /* reference key */
#define KEY_REFRESH 0565 /* refresh key */
#define KEY_REPLACE 0566 /* replace key */
#define KEY_RESTART 0567 /* restart key */
#define KEY_RESUME 0570 /* resume key */
#define KEY_SAVE 0571 /* save key */
#define KEY_SBEG 0572 /* shifted begin key */
#define KEY_SCANCEL 0573 /* shifted cancel key */
#define KEY_SCOMMAND 0574 /* shifted command key */
#define KEY_SCOPY 0575 /* shifted copy key */
#define KEY_SCREATE 0576 /* shifted create key */
#define KEY_SDC 0577 /* shifted delete-character key */
#define KEY_SDL 0600 /* shifted delete-line key */
#define KEY_SELECT 0601 /* select key */
#define KEY_SEND 0602 /* shifted end key */
#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */
#define KEY_SEXIT 0604 /* shifted exit key */
#define KEY_SFIND 0605 /* shifted find key */
#define KEY_SHELP 0606 /* shifted help key */
#define KEY_SHOME 0607 /* shifted home key */
#define KEY_SIC 0610 /* shifted insert-character key */
#define KEY_SLEFT 0611 /* shifted left-arrow key */
#define KEY_SMESSAGE 0612 /* shifted message key */
#define KEY_SMOVE 0613 /* shifted move key */
#define KEY_SNEXT 0614 /* shifted next key */
#define KEY_SOPTIONS 0615 /* shifted options key */
#define KEY_SPREVIOUS 0616 /* shifted previous key */
#define KEY_SPRINT 0617 /* shifted print key */
#define KEY_SREDO 0620 /* shifted redo key */
#define KEY_SREPLACE 0621 /* shifted replace key */
#define KEY_SRIGHT 0622 /* shifted right-arrow key */
#define KEY_SRSUME 0623 /* shifted resume key */
#define KEY_SSAVE 0624 /* shifted save key */
#define KEY_SSUSPEND 0625 /* shifted suspend key */
#define KEY_SUNDO 0626 /* shifted undo key */
#define KEY_SUSPEND 0627 /* suspend key */
#define KEY_UNDO 0630 /* undo key */
#define KEY_MOUSE 0631 /* Mouse event has occurred */
#define KEY_RESIZE 0632 /* Terminal resize event */
#define KEY_EVENT 0633 /* We were interrupted by an event */
#define KEY_MAX 0777 /* Maximum key value is 0633 */
/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
* (see that file for the relevant copyright).
*/
#define _XOPEN_CURSES 1
#if NCURSES_WIDECHAR
extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))])
#define WACS_BSSB NCURSES_WACS('l')
#define WACS_SSBB NCURSES_WACS('m')
#define WACS_BBSS NCURSES_WACS('k')
#define WACS_SBBS NCURSES_WACS('j')
#define WACS_SBSS NCURSES_WACS('u')
#define WACS_SSSB NCURSES_WACS('t')
#define WACS_SSBS NCURSES_WACS('v')
#define WACS_BSSS NCURSES_WACS('w')
#define WACS_BSBS NCURSES_WACS('q')
#define WACS_SBSB NCURSES_WACS('x')
#define WACS_SSSS NCURSES_WACS('n')
#define WACS_ULCORNER WACS_BSSB
#define WACS_LLCORNER WACS_SSBB
#define WACS_URCORNER WACS_BBSS
#define WACS_LRCORNER WACS_SBBS
#define WACS_RTEE WACS_SBSS
#define WACS_LTEE WACS_SSSB
#define WACS_BTEE WACS_SSBS
#define WACS_TTEE WACS_BSSS
#define WACS_HLINE WACS_BSBS
#define WACS_VLINE WACS_SBSB
#define WACS_PLUS WACS_SSSS
#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */
#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */
#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */
#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */
#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */
#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */
#define WACS_BULLET NCURSES_WACS('~') /* bullet */
/* Teletype 5410v1 symbols */
#define WACS_LARROW NCURSES_WACS(',') /* arrow left */
#define WACS_RARROW NCURSES_WACS('+') /* arrow right */
#define WACS_DARROW NCURSES_WACS('.') /* arrow down */
#define WACS_UARROW NCURSES_WACS('-') /* arrow up */
#define WACS_BOARD NCURSES_WACS('h') /* board of squares */
#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */
#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */
/* ncurses extensions */
#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */
#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */
#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */
#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */
#define WACS_PI NCURSES_WACS('{') /* Pi */
#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */
#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */
/* double lines */
#define WACS_BDDB NCURSES_WACS('C')
#define WACS_DDBB NCURSES_WACS('D')
#define WACS_BBDD NCURSES_WACS('B')
#define WACS_DBBD NCURSES_WACS('A')
#define WACS_DBDD NCURSES_WACS('G')
#define WACS_DDDB NCURSES_WACS('F')
#define WACS_DDBD NCURSES_WACS('H')
#define WACS_BDDD NCURSES_WACS('I')
#define WACS_BDBD NCURSES_WACS('R')
#define WACS_DBDB NCURSES_WACS('Y')
#define WACS_DDDD NCURSES_WACS('E')
#define WACS_D_ULCORNER WACS_BDDB
#define WACS_D_LLCORNER WACS_DDBB
#define WACS_D_URCORNER WACS_BBDD
#define WACS_D_LRCORNER WACS_DBBD
#define WACS_D_RTEE WACS_DBDD
#define WACS_D_LTEE WACS_DDDB
#define WACS_D_BTEE WACS_DDBD
#define WACS_D_TTEE WACS_BDDD
#define WACS_D_HLINE WACS_BDBD
#define WACS_D_VLINE WACS_DBDB
#define WACS_D_PLUS WACS_DDDD
/* thick lines */
#define WACS_BTTB NCURSES_WACS('L')
#define WACS_TTBB NCURSES_WACS('M')
#define WACS_BBTT NCURSES_WACS('K')
#define WACS_TBBT NCURSES_WACS('J')
#define WACS_TBTT NCURSES_WACS('U')
#define WACS_TTTB NCURSES_WACS('T')
#define WACS_TTBT NCURSES_WACS('V')
#define WACS_BTTT NCURSES_WACS('W')
#define WACS_BTBT NCURSES_WACS('Q')
#define WACS_TBTB NCURSES_WACS('X')
#define WACS_TTTT NCURSES_WACS('N')
#define WACS_T_ULCORNER WACS_BTTB
#define WACS_T_LLCORNER WACS_TTBB
#define WACS_T_URCORNER WACS_BBTT
#define WACS_T_LRCORNER WACS_TBBT
#define WACS_T_RTEE WACS_TBTT
#define WACS_T_LTEE WACS_TTTB
#define WACS_T_BTEE WACS_TTBT
#define WACS_T_TTEE WACS_BTTT
#define WACS_T_HLINE WACS_BTBT
#define WACS_T_VLINE WACS_TBTB
#define WACS_T_PLUS WACS_TTTT
/*
* Function prototypes for wide-character operations.
*
* "generated" comments should include ":WIDEC" to make the corresponding
* functions ifdef'd in lib_gen.c
*
* "implemented" comments do not need this marker.
*/
extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */
extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */
extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */
extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */
extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */
extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */
extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */
extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */
extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* implemented */
extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */
extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *, wint_t *, int); /* implemented */
extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */
extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#endif
#ifndef NCURSES_NOMACROS
/*
* XSI curses macros for XPG4 conformance.
*/
#define add_wch(c) wadd_wch(stdscr,(c))
#define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n))
#define add_wchstr(str) wadd_wchstr(stdscr,(str))
#define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n))
#define addwstr(wstr) waddwstr(stdscr,(wstr))
#define bkgrnd(c) wbkgrnd(stdscr,(c))
#define bkgrndset(c) wbkgrndset(stdscr,(c))
#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0)
#define echo_wchar(c) wecho_wchar(stdscr,(c))
#define get_wch(c) wget_wch(stdscr,(c))
#define get_wstr(t) wget_wstr(stdscr,(t))
#define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch))
#define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n))
#define hline_set(c,n) whline_set(stdscr,(c),(n))
#define in_wch(c) win_wch(stdscr,(c))
#define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n))
#define in_wchstr(c) win_wchstr(stdscr,(c))
#define innwstr(c,n) winnwstr(stdscr,(c),(n))
#define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n))
#define ins_wch(c) wins_wch(stdscr,(c))
#define ins_wstr(t) wins_wstr(stdscr,(t))
#define inwstr(c) winwstr(stdscr,(c))
#define vline_set(c,n) wvline_set(stdscr,(c),(n))
#define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1)
#define waddwstr(win,wstr) waddnwstr((win),(wstr),-1)
#define wget_wstr(w,t) wgetn_wstr((w),(t),-1)
#define win_wchstr(w,c) win_wchnstr((w),(c),-1)
#define wins_wstr(w,t) wins_nwstr((w),(t),-1)
#if !NCURSES_OPAQUE
#define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR)
#endif
#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c))
#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n))
#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s))
#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n))
#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr))
#define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c))
#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t))
#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n))
#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n))
#define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c))
#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n))
#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c))
#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n))
#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n))
#define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c))
#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t))
#define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c))
#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n))
#define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c)))
#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n)))
#define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s)))
#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n)))
#define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr)))
#define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c)))
#define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t)))
#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n)))
#define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n)))
#define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c)))
#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n)))
#define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c)))
#define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n)))
#define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n)))
#define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c)))
#define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t)))
#define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c)))
#define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n)))
#endif /* NCURSES_NOMACROS */
#if defined(TRACE) || defined(NCURSES_TEST)
extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *);
extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);
#endif
#endif /* NCURSES_WIDECHAR */
/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
* (see that file for the relevant copyright).
*/
/* mouse interface */
#if NCURSES_MOUSE_VERSION > 1
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
#else
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
#endif
#define NCURSES_BUTTON_RELEASED 001L
#define NCURSES_BUTTON_PRESSED 002L
#define NCURSES_BUTTON_CLICKED 004L
#define NCURSES_DOUBLE_CLICKED 010L
#define NCURSES_TRIPLE_CLICKED 020L
#define NCURSES_RESERVED_EVENT 040L
/* event masks */
#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
/*
* In 32 bits the version-1 scheme does not provide enough space for a 5th
* button, unless we choose to change the ABI by omitting the reserved-events.
*/
#if NCURSES_MOUSE_VERSION > 1
#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L)
#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L)
#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L)
#else
#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L)
#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L)
#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L)
#endif
#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
/* macros to extract single event-bits from masks */
#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001))
#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002))
#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004))
#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010))
#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020))
#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040))
typedef struct
{
short id; /* ID to distinguish multiple devices */
int x, y, z; /* event coordinates (character-cell) */
mmask_t bstate; /* button state bits */
}
MEVENT;
extern NCURSES_EXPORT(bool) has_mouse(void);
extern NCURSES_EXPORT(int) getmouse (MEVENT *);
extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
extern NCURSES_EXPORT(int) mouseinterval (int);
extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *);
extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int);
#endif
#ifndef NCURSES_NOMACROS
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
#endif
/* other non-XSI functions */
extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */
extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */
#endif
/* Debugging : use with libncurses_g.a */
extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(char *) _traceattr (attr_t);
extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
extern NCURSES_EXPORT(char *) _tracechar (int);
extern NCURSES_EXPORT(char *) _tracechtype (chtype);
extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
#if NCURSES_WIDECHAR
#define _tracech_t _tracecchar_t
extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
#define _tracech_t2 _tracecchar_t2
extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
#else
#define _tracech_t _tracechtype
#define _tracech_t2 _tracechtype2
#endif
extern NCURSES_EXPORT(void) trace (const unsigned int);
/* trace masks */
#define TRACE_DISABLE 0x0000 /* turn off tracing */
#define TRACE_TIMES 0x0001 /* trace user and system times of updates */
#define TRACE_TPUTS 0x0002 /* trace tputs calls */
#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */
#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */
#define TRACE_CHARPUT 0x0010 /* trace all character outputs */
#define TRACE_ORDINARY 0x001F /* trace all update actions */
#define TRACE_CALLS 0x0020 /* trace all curses calls */
#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */
#define TRACE_IEVENT 0x0080 /* trace low-level input processing */
#define TRACE_BITS 0x0100 /* trace state of TTY control bits */
#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */
#define TRACE_CCALLS 0x0400 /* trace per-character calls */
#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */
#define TRACE_ATTRS 0x1000 /* trace attribute updates */
#define TRACE_SHIFT 13 /* number of bits in the trace masks */
#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */
#if defined(TRACE) || defined(NCURSES_TEST)
extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */
extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */
#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */
#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */
#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */
#endif
#include <unctrl.h>
#ifdef __cplusplus
#ifndef NCURSES_NOMACROS
/* these names conflict with STL */
#undef box
#undef clear
#undef erase
#undef move
#undef refresh
#endif /* NCURSES_NOMACROS */
}
#endif
#endif /* __NCURSES_H */
/****************************************************************************
* Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */
#ifndef NCURSES_DLL_H_incl
#define NCURSES_DLL_H_incl 1
/* 2014-08-02 workaround for broken MinGW compiler.
* Oddly, only TRACE is mapped to trace - the other -D's are okay.
* suggest TDM as an alternative.
*/
#if defined(__MINGW64__)
#elif defined(__MINGW32__)
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
#ifdef trace
#undef trace
#define TRACE
#endif
#endif /* broken compiler */
#endif /* MingW */
/*
* For reentrant code, we map the various global variables into SCREEN by
* using functions to access them.
*/
#define NCURSES_PUBLIC_VAR(name) _nc_##name
#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
/* no longer needed on cygwin or mingw, thanks to auto-import */
/* but this structure may be useful at some point for an MSVC build */
/* so, for now unconditionally define the important flags */
/* "the right way" for proper static and dll+auto-import behavior */
#undef NCURSES_DLL
#define NCURSES_STATIC
#if defined(__CYGWIN__) || defined(__MINGW32__)
# if defined(NCURSES_DLL)
# if defined(NCURSES_STATIC)
# undef NCURSES_STATIC
# endif
# endif
# undef NCURSES_IMPEXP
# undef NCURSES_API
# undef NCURSES_EXPORT
# undef NCURSES_EXPORT_VAR
# if defined(NCURSES_DLL)
/* building a DLL */
# define NCURSES_IMPEXP __declspec(dllexport)
# elif defined(NCURSES_STATIC)
/* building or linking to a static library */
# define NCURSES_IMPEXP /* nothing */
# else
/* linking to the DLL */
# define NCURSES_IMPEXP __declspec(dllimport)
# endif
# define NCURSES_API __cdecl
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
#endif
/* Take care of non-cygwin platforms */
#if !defined(NCURSES_IMPEXP)
# define NCURSES_IMPEXP /* nothing */
#endif
#if !defined(NCURSES_API)
# define NCURSES_API /* nothing */
#endif
#if !defined(NCURSES_EXPORT)
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
#endif
#if !defined(NCURSES_EXPORT_VAR)
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
#endif
#endif /* NCURSES_DLL_H_incl */
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $
#ifndef NCURSES_CURSESAPP_H_incl
#define NCURSES_CURSESAPP_H_incl
#include <cursslk.h>
class NCURSES_IMPEXP NCursesApplication {
public:
typedef struct _slk_link { // This structure is used to maintain
struct _slk_link* prev; // a stack of SLKs
Soft_Label_Key_Set* SLKs;
} SLK_Link;
private:
static int rinit(NCursesWindow& w); // Internal Init function for title
static NCursesApplication* theApp; // Global ref. to the application
static SLK_Link* slk_stack;
protected:
static NCursesWindow* titleWindow; // The Title Window (if any)
bool b_Colors; // Is this a color application?
NCursesWindow* Root_Window; // This is the stdscr equiv.
// Initialization of attributes;
// Rewrite this in your derived class if you prefer other settings
virtual void init(bool bColors);
// The number of lines for the title window. Default is no title window
// You may rewrite this in your derived class
virtual int titlesize() const {
return 0;
}
// This method is called to put something into the title window initially
// You may rewrite this in your derived class
virtual void title() {
}
// The layout used for the Soft Label Keys. Default is to have no SLKs.
// You may rewrite this in your derived class
virtual Soft_Label_Key_Set::Label_Layout useSLKs() const {
return Soft_Label_Key_Set::None;
}
// This method is called to initialize the SLKs. Default is nothing.
// You may rewrite this in your derived class
virtual void init_labels(Soft_Label_Key_Set& S) const {
(void) S;
}
// Your derived class must implement this method. The return value must
// be the exit value of your application.
virtual int run() = 0;
// The constructor is protected, so you may use it in your derived
// class constructor. The argument tells whether or not you want colors.
NCursesApplication(bool wantColors = FALSE);
NCursesApplication& operator=(const NCursesApplication& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
NCursesApplication(const NCursesApplication& rhs)
: b_Colors(rhs.b_Colors),
Root_Window(rhs.Root_Window)
{
}
public:
virtual ~NCursesApplication();
// Get a pointer to the current application object
static NCursesApplication* getApplication() {
return theApp;
}
// This method runs the application and returns its exit value
int operator()(void);
// Process the commandline arguments. The default implementation simply
// ignores them. Your derived class may rewrite this.
virtual void handleArgs(int argc, char* argv[]) {
(void) argc;
(void) argv;
}
// Does this application use colors?
inline bool useColors() const {
return b_Colors;
}
// Push the Key Set S onto the SLK Stack. S then becomes the current set
// of Soft Labelled Keys.
void push(Soft_Label_Key_Set& S);
// Throw away the current set of SLKs and make the previous one the
// new current set.
bool pop();
// Retrieve the current set of Soft Labelled Keys.
Soft_Label_Key_Set* top() const;
// Attributes to use for menu and forms foregrounds
virtual chtype foregrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD;
}
// Attributes to use for menu and forms backgrounds
virtual chtype backgrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL;
}
// Attributes to use for inactive (menu) elements
virtual chtype inactives() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM;
}
// Attributes to use for (form) labels and SLKs
virtual chtype labels() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
}
// Attributes to use for form backgrounds
virtual chtype dialog_backgrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
}
// Attributes to use as default for (form) window backgrounds
virtual chtype window_backgrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL;
}
// Attributes to use for the title window
virtual chtype screen_titles() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD;
}
};
#endif /* NCURSES_CURSESAPP_H_incl */
/****************************************************************************
* Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Thomas E. Dickey 2006 *
****************************************************************************/
/* $Id: nc_tparm.h,v 1.8 2017/07/22 17:09:46 tom Exp $ */
#ifndef NC_TPARM_included
#define NC_TPARM_included 1
#include <ncurses_cfg.h>
#include <curses.h>
/*
* Cast parameters past the formatting-string for tparm() to match the
* assumption of the varargs code.
*/
#ifndef TPARM_ARG
#ifdef NCURSES_TPARM_ARG
#define TPARM_ARG NCURSES_TPARM_ARG
#else
#define TPARM_ARG long
#endif
#endif /* TPARAM_ARG */
#define TPARM_N(n) (TPARM_ARG)(n)
#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
#if NCURSES_TPARM_VARARGS
#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i))
#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h))
#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g))
#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f))
#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
#define TPARM_1(a,b) tparm(a,TPARM_N(b))
#define TPARM_0(a) tparm(a)
#else
#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
#define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
#define TPARM_1(a,b) TPARM_2(a,b,0)
#define TPARM_1(a,b) TPARM_2(a,b,0)
#define TPARM_0(a) TPARM_1(a,0)
#endif
#endif /* NC_TPARM_included */
/****************************************************************************
* Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */
#ifndef NCURSES_ETI_H_incl
#define NCURSES_ETI_H_incl 1
#define E_OK (0)
#define E_SYSTEM_ERROR (-1)
#define E_BAD_ARGUMENT (-2)
#define E_POSTED (-3)
#define E_CONNECTED (-4)
#define E_BAD_STATE (-5)
#define E_NO_ROOM (-6)
#define E_NOT_POSTED (-7)
#define E_UNKNOWN_COMMAND (-8)
#define E_NO_MATCH (-9)
#define E_NOT_SELECTABLE (-10)
#define E_NOT_CONNECTED (-11)
#define E_REQUEST_DENIED (-12)
#define E_INVALID_FIELD (-13)
#define E_CURRENT (-14)
#endif
/****************************************************************************
* Copyright (c) 1998-2015,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1998-on *
****************************************************************************/
/* $Id: term_entry.h,v 1.55 2017/04/06 22:45:34 tom Exp $ */
/*
* term_entry.h -- interface to entry-manipulation code
*/
#ifndef NCURSES_TERM_ENTRY_H_incl
#define NCURSES_TERM_ENTRY_H_incl 1
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
#include <term.h>
/*
* These macros may be used by programs that know about TERMTYPE:
*/
#if NCURSES_XNAMES
#define NUM_BOOLEANS(tp) (tp)->num_Booleans
#define NUM_NUMBERS(tp) (tp)->num_Numbers
#define NUM_STRINGS(tp) (tp)->num_Strings
#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i]
#else
#define NUM_BOOLEANS(tp) BOOLCOUNT
#define NUM_NUMBERS(tp) NUMCOUNT
#define NUM_STRINGS(tp) STRCOUNT
#define EXT_NAMES(tp,i,limit,index,table) table[i]
#endif
#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings)
#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++)
#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++)
#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++)
#if NCURSES_XNAMES
#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; (int) n < (int) NUM_BOOLEANS(tp); n++)
#define for_each_ext_number(n,tp) for(n = NUMCOUNT; (int) n < (int) NUM_NUMBERS(tp); n++)
#define for_each_ext_string(n,tp) for(n = STRCOUNT; (int) n < (int) NUM_STRINGS(tp); n++)
#endif
#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names)
#define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names)
#define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names)
/*
* The remaining type-definitions and macros are used only internally by the
* ncurses utilities.
*/
#ifdef NCURSES_INTERNALS
/*
* see db_iterator.c - this enumeration lists the places searched for a
* terminal description and defines the order in which they are searched.
*/
typedef enum {
dbdTIC = 0, /* special, used by tic when writing entry */
#if NCURSES_USE_DATABASE
dbdEnvOnce, /* the $TERMINFO environment variable */
dbdHome, /* $HOME/.terminfo */
dbdEnvList, /* the $TERMINFO_DIRS environment variable */
dbdCfgList, /* the compiled-in TERMINFO_DIRS value */
dbdCfgOnce, /* the compiled-in TERMINFO value */
#endif
#if NCURSES_USE_TERMCAP
dbdEnvOnce2, /* the $TERMCAP environment variable */
dbdEnvList2, /* the $TERMPATH environment variable */
dbdCfgList2, /* the compiled-in TERMPATH */
#endif
dbdLAST
} DBDIRS;
#define MAX_USES 32
#define MAX_CROSSLINKS 16
typedef struct entry ENTRY;
typedef struct {
char *name;
ENTRY *link;
long line;
} ENTRY_USES;
struct entry {
TERMTYPE2 tterm;
unsigned nuses;
ENTRY_USES uses[MAX_USES];
int ncrosslinks;
ENTRY *crosslinks[MAX_CROSSLINKS];
long cstart;
long cend;
long startline;
ENTRY *next;
ENTRY *last;
};
extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head;
extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail;
#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next)
#define MAX_LINE 132
#define NULLHOOK (bool(*)(ENTRY *))0
/*
* Note that WANTED and PRESENT are not simple inverses! If a capability
* has been explicitly cancelled, it's not considered WANTED.
*/
#define WANTED(s) ((s) == ABSENT_STRING)
#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
#define ANDMISSING(p,q) \
{ \
if (PRESENT(p) && !PRESENT(q)) \
_nc_warning(#p " but no " #q); \
}
#define PAIRED(p,q) \
{ \
if (PRESENT(q) && !PRESENT(p)) \
_nc_warning(#q " but no " #p); \
if (PRESENT(p) && !PRESENT(q)) \
_nc_warning(#p " but no " #q); \
}
/*
* These entrypoints are used only by the ncurses utilities such as tic.
*/
/* alloc_entry.c: elementary allocation code */
extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp);
extern NCURSES_EXPORT(char *) _nc_save_str (const char *const);
extern NCURSES_EXPORT(void) _nc_init_entry (ENTRY *const);
extern NCURSES_EXPORT(void) _nc_merge_entry (ENTRY *const, ENTRY *const);
extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool);
/* alloc_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE2 *, TERMTYPE2 *);
/* free_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_free_termtype2 (TERMTYPE2 *);
/* lib_termcap.c: trim sgr0 string for termcap users */
extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE2 *);
/* parse_entry.c: entry-parsing code */
#if NCURSES_XNAMES
extern NCURSES_EXPORT_VAR(bool) _nc_user_definable;
extern NCURSES_EXPORT_VAR(bool) _nc_disable_period;
#endif
extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool);
extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *);
/* write_entry.c: writing an entry to the file system */
extern NCURSES_EXPORT(void) _nc_set_writedir (const char *);
extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE2 *const);
extern NCURSES_EXPORT(int) _nc_write_object (TERMTYPE2 *, char *, unsigned *, unsigned);
/* comp_parse.c: entry list handling */
extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*));
extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *);
extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */
extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool);
extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *);
extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */
extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE2 *, bool);
/* trace_xnames.c */
extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
#endif /* NCURSES_INTERNALS */
/*
* These entrypoints are used by tack.
*/
/* alloc_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *);
/* lib_acs.c */
extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */
/* free_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *);
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* NCURSES_TERM_ENTRY_H_incl */
/****************************************************************************
* Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: curses.h.in,v 1.257 2017/11/21 00:11:37 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
#define CURSES 1
#define CURSES_H 1
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 6
#define NCURSES_VERSION_MINOR 1
#define NCURSES_VERSION_PATCH 20180224
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.1"
/*
* Identify the mouse encoding version.
*/
#define NCURSES_MOUSE_VERSION 2
/*
* Definitions to facilitate DLL's.
*/
#include <ncurses_dll.h>
#if 1
#include <stdint.h>
#endif
/*
* User-definable tweak to disable the include of <stdbool.h>.
*/
#ifndef NCURSES_ENABLE_STDBOOL_H
#define NCURSES_ENABLE_STDBOOL_H 1
#endif
/*
* NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
* configured using --disable-macros.
*/
#ifndef NCURSES_ATTR_T
#define NCURSES_ATTR_T int
#endif
/*
* Expands to 'const' if ncurses is configured using --enable-const. Note that
* doing so makes it incompatible with other implementations of X/Open Curses.
*/
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_INLINE
#define NCURSES_INLINE inline
/*
* The standard type used for color values, and for color-pairs. The latter
* allows the curses library to enumerate the combinations of foreground and
* background colors used by an application, and is normally the product of the
* total foreground and background colors.
*
* X/Open uses "short" for both of these types, ultimately because they are
* numbers from the SVr4 terminal database, which uses 16-bit signed values.
*/
#undef NCURSES_COLOR_T
#define NCURSES_COLOR_T short
#undef NCURSES_PAIRS_T
#define NCURSES_PAIRS_T short
/*
* Definitions used to make WINDOW and similar structs opaque.
*/
#ifndef NCURSES_INTERNALS
#define NCURSES_OPAQUE 0
#define NCURSES_OPAQUE_FORM 0
#define NCURSES_OPAQUE_MENU 0
#define NCURSES_OPAQUE_PANEL 0
#endif
/*
* Definition used to optionally suppress wattr* macros to help with the
* transition from ncurses5 to ncurses6 by allowing the header files to
* be shared across development packages for ncursesw in both ABIs.
*/
#ifndef NCURSES_WATTR_MACROS
#define NCURSES_WATTR_MACROS 0
#endif
/*
* The reentrant code relies on the opaque setting, but adds features.
*/
#ifndef NCURSES_REENTRANT
#define NCURSES_REENTRANT 0
#endif
/*
* Control whether bindings for interop support are added.
*/
#undef NCURSES_INTEROP_FUNCS
#define NCURSES_INTEROP_FUNCS 1
/*
* The internal type used for window dimensions.
*/
#undef NCURSES_SIZE_T
#define NCURSES_SIZE_T short
/*
* Control whether tparm() supports varargs or fixed-parameter list.
*/
#undef NCURSES_TPARM_VARARGS
#define NCURSES_TPARM_VARARGS 1
/*
* Control type used for tparm's arguments. While X/Open equates long and
* char* values, this is not always workable for 64-bit platforms.
*/
#undef NCURSES_TPARM_ARG
#define NCURSES_TPARM_ARG intptr_t
/*
* Control whether ncurses uses wcwidth() for checking width of line-drawing
* characters.
*/
#undef NCURSES_WCWIDTH_GRAPHICS
#define NCURSES_WCWIDTH_GRAPHICS 1
/*
* NCURSES_CH_T is used in building the library, but not used otherwise in
* this header file, since that would make the normal/wide-character versions
* of the header incompatible.
*/
#undef NCURSES_CH_T
#define NCURSES_CH_T cchar_t
#if 1 && defined(_LP64)
typedef unsigned chtype;
typedef unsigned mmask_t;
#else
typedef uint32_t chtype;
typedef uint32_t mmask_t;
#endif
/*
* We need FILE, etc. Include this before checking any feature symbols.
*/
#include <stdio.h>
/*
* With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
* conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is
* not already defined, e.g., if the platform relies upon nonstandard feature
* test macros, define it at this point if the standard feature test macros
* indicate that it should be defined.
*/
#ifndef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
#define NCURSES_WIDECHAR 1
#else
#define NCURSES_WIDECHAR 0
#endif
#endif /* NCURSES_WIDECHAR */
#include <stdarg.h> /* we need va_list */
#if NCURSES_WIDECHAR
#include <stddef.h> /* we want wchar_t */
#endif
/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also
* implement it. If so, we must use the C++ compiler's type to avoid conflict
* with other interfaces.
*
* A further complication is that <stdbool.h> may declare 'bool' to be a
* different type, such as an enum which is not necessarily compatible with
* C++. If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
* Otherwise, let it remain a typedef to avoid conflicts with other #define's.
* In either case, make a typedef for NCURSES_BOOL which can be used if needed
* from either C or C++.
*/
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0
typedef unsigned char NCURSES_BOOL;
#if defined(__cplusplus) /* __cplusplus, etc. */
/* use the C++ compiler's bool type */
#define NCURSES_BOOL bool
#else /* c89, c99, etc. */
#if NCURSES_ENABLE_STDBOOL_H
#include <stdbool.h>
/* use whatever the C compiler decides bool really is */
#define NCURSES_BOOL bool
#else
/* there is no predefined bool - use our own */
#undef bool
#define bool NCURSES_BOOL
#endif
#endif /* !__cplusplus, etc. */
#ifdef __cplusplus
extern "C" {
#define NCURSES_CAST(type,value) static_cast<type>(value)
#else
#define NCURSES_CAST(type,value) (type)(value)
#endif
#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p)))
/*
* X/Open attributes. In the ncurses implementation, they are identical to the
* A_ attributes.
*/
#define WA_ATTRIBUTES A_ATTRIBUTES
#define WA_NORMAL A_NORMAL
#define WA_STANDOUT A_STANDOUT
#define WA_UNDERLINE A_UNDERLINE
#define WA_REVERSE A_REVERSE
#define WA_BLINK A_BLINK
#define WA_DIM A_DIM
#define WA_BOLD A_BOLD
#define WA_ALTCHARSET A_ALTCHARSET
#define WA_INVIS A_INVIS
#define WA_PROTECT A_PROTECT
#define WA_HORIZONTAL A_HORIZONTAL
#define WA_LEFT A_LEFT
#define WA_LOW A_LOW
#define WA_RIGHT A_RIGHT
#define WA_TOP A_TOP
#define WA_VERTICAL A_VERTICAL
#if 1
#define WA_ITALIC A_ITALIC /* ncurses extension */
#endif
/* colors */
#define COLOR_BLACK 0
#define COLOR_RED 1
#define COLOR_GREEN 2
#define COLOR_YELLOW 3
#define COLOR_BLUE 4
#define COLOR_MAGENTA 5
#define COLOR_CYAN 6
#define COLOR_WHITE 7
/* line graphics */
#if 0 || NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(chtype*, acs_map);
#define acs_map NCURSES_PUBLIC_VAR(acs_map())
#else
extern NCURSES_EXPORT_VAR(chtype) acs_map[];
#endif
#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))])
/* VT100 symbols begin here */
#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */
#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */
#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */
#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */
#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */
#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */
#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */
#define ACS_VLINE NCURSES_ACS('x') /* vertical line */
#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */
#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */
#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */
#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */
#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */
#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */
#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */
#define ACS_BULLET NCURSES_ACS('~') /* bullet */
/* Teletype 5410v1 symbols begin here */
#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */
#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */
#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */
#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */
#define ACS_BOARD NCURSES_ACS('h') /* board of squares */
#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */
#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */
/*
* These aren't documented, but a lot of System Vs have them anyway
* (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
* The ACS_names may not match AT&T's, our source didn't know them.
*/
#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */
#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */
#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */
#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */
#define ACS_PI NCURSES_ACS('{') /* Pi */
#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */
#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */
/*
* Line drawing ACS names are of the form ACS_trbl, where t is the top, r
* is the right, b is the bottom, and l is the left. t, r, b, and l might
* be B (blank), S (single), D (double), or T (thick). The subset defined
* here only uses B and S.
*/
#define ACS_BSSB ACS_ULCORNER
#define ACS_SSBB ACS_LLCORNER
#define ACS_BBSS ACS_URCORNER
#define ACS_SBBS ACS_LRCORNER
#define ACS_SBSS ACS_RTEE
#define ACS_SSSB ACS_LTEE
#define ACS_SSBS ACS_BTEE
#define ACS_BSSS ACS_TTEE
#define ACS_BSBS ACS_HLINE
#define ACS_SBSB ACS_VLINE
#define ACS_SSSS ACS_PLUS
#undef ERR
#define ERR (-1)
#undef OK
#define OK (0)
/* values for the _flags member */
#define _SUBWIN 0x01 /* is this a sub-window? */
#define _ENDLINE 0x02 /* is the window flush right? */
#define _FULLWIN 0x04 /* is the window full-screen? */
#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */
#define _ISPAD 0x10 /* is this window a pad? */
#define _HASMOVED 0x20 /* has cursor moved since last refresh? */
#define _WRAPPED 0x40 /* cursor was just wrappped */
/*
* this value is used in the firstchar and lastchar fields to mark
* unchanged lines
*/
#define _NOCHANGE -1
/*
* this value is used in the oldindex field to mark lines created by insertions
* and scrolls.
*/
#define _NEWINDEX -1
typedef struct screen SCREEN;
typedef struct _win_st WINDOW;
typedef chtype attr_t; /* ...must be at least as wide as chtype */
#if NCURSES_WIDECHAR
#if 0
#ifdef mblen /* libutf8.h defines it w/o undefining first */
#undef mblen
#endif
#include <libutf8.h>
#endif
#if 1
#include <wchar.h> /* ...to get mbstate_t, etc. */
#endif
#if 0
typedef unsigned short wchar_t1;
#endif
#if 0
typedef unsigned int wint_t1;
#endif
/*
* cchar_t stores an array of CCHARW_MAX wide characters. The first is
* normally a spacing character. The others are non-spacing. If those
* (spacing and nonspacing) do not fill the array, a null L'\0' follows.
* Otherwise, a null is assumed to follow when extracting via getcchar().
*/
#define CCHARW_MAX 5
typedef struct
{
attr_t attr;
wchar_t chars[CCHARW_MAX];
#if 1
#undef NCURSES_EXT_COLORS
#define NCURSES_EXT_COLORS 20180224
int ext_color; /* color pair, must be more than 16-bits */
#endif
}
cchar_t;
#endif /* NCURSES_WIDECHAR */
#if !NCURSES_OPAQUE
struct ldat;
struct _win_st
{
NCURSES_SIZE_T _cury, _curx; /* current cursor position */
/* window location and size */
NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
short _flags; /* window state flags */
/* attribute tracking */
attr_t _attrs; /* current attribute for non-space character */
chtype _bkgd; /* current background char/attribute pair */
/* option values set by user */
bool _notimeout; /* no time out on function-key entry? */
bool _clear; /* consider all data in the window invalid? */
bool _leaveok; /* OK to not reset cursor on exit? */
bool _scroll; /* OK to scroll this window? */
bool _idlok; /* OK to use insert/delete line? */
bool _idcok; /* OK to use insert/delete char? */
bool _immed; /* window in immed mode? (not yet used) */
bool _sync; /* window in sync mode? */
bool _use_keypad; /* process function keys into KEY_ symbols? */
int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */
struct ldat *_line; /* the actual line data */
/* global screen state */
NCURSES_SIZE_T _regtop; /* top line of scrolling region */
NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
/* these are used only if this is a sub-window */
int _parx; /* x coordinate of this window in parent */
int _pary; /* y coordinate of this window in parent */
WINDOW *_parent; /* pointer to parent if a sub-window */
/* these are used only if this is a pad */
struct pdat
{
NCURSES_SIZE_T _pad_y, _pad_x;
NCURSES_SIZE_T _pad_top, _pad_left;
NCURSES_SIZE_T _pad_bottom, _pad_right;
} _pad;
NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
#if NCURSES_WIDECHAR
cchar_t _bkgrnd; /* current background char/attribute pair */
#if 1
int _color; /* current color-pair for non-space character */
#endif
#endif
};
#endif /* NCURSES_OPAQUE */
/*
* This is an extension to support events...
*/
#if 1
#ifdef NCURSES_WGETCH_EVENTS
#if !defined(__BEOS__) || defined(__HAIKU__)
/* Fix _nc_timed_wait() on BEOS... */
# define NCURSES_EVENT_VERSION 1
#endif /* !defined(__BEOS__) */
/*
* Bits to set in _nc_event.data.flags
*/
# define _NC_EVENT_TIMEOUT_MSEC 1
# define _NC_EVENT_FILE 2
# define _NC_EVENT_FILE_READABLE 2
# if 0 /* Not supported yet... */
# define _NC_EVENT_FILE_WRITABLE 4
# define _NC_EVENT_FILE_EXCEPTION 8
# endif
typedef struct
{
int type;
union
{
long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */
struct
{
unsigned int flags;
int fd;
unsigned int result;
} fev; /* _NC_EVENT_FILE */
} data;
} _nc_event;
typedef struct
{
int count;
int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
_nc_event *events[1];
} _nc_eventlist;
extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *); /* experimental */
extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */
#endif /* NCURSES_WGETCH_EVENTS */
#endif /* NCURSES_EXT_FUNCS */
/*
* GCC (and some other compilers) define '__attribute__'; we're using this
* macro to alert the compiler to flag inconsistencies in printf/scanf-like
* function calls. Just in case '__attribute__' isn't defined, make a dummy.
* Old versions of G++ do not accept it anyway, at least not consistently with
* GCC.
*/
#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
#define __attribute__(p) /* nothing */
#endif
/*
* We cannot define these in ncurses_cfg.h, since they require parameters to be
* passed (that is non-portable). If you happen to be using gcc with warnings
* enabled, define
* GCC_PRINTF
* GCC_SCANF
* to improve checking of calls to printw(), etc.
*/
#ifndef GCC_PRINTFLIKE
#if defined(GCC_PRINTF) && !defined(printf)
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
#else
#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
#endif
#endif
#ifndef GCC_SCANFLIKE
#if defined(GCC_SCANF) && !defined(scanf)
#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
#else
#define GCC_SCANFLIKE(fmt,var) /*nothing*/
#endif
#endif
#ifndef GCC_NORETURN
#define GCC_NORETURN /* nothing */
#endif
#ifndef GCC_UNUSED
#define GCC_UNUSED /* nothing */
#endif
/*
* Curses uses a helper function. Define our type for this to simplify
* extending it for the sp-funcs feature.
*/
typedef int (*NCURSES_OUTC)(int);
/*
* Function prototypes. This is the complete X/Open Curses list of required
* functions. Those marked `generated' will have sources generated from the
* macro definitions later in this file, in order to satisfy XPG4.2
* requirements.
*/
extern NCURSES_EXPORT(int) addch (const chtype); /* generated */
extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */
extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */
extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */
extern NCURSES_EXPORT(int) addstr (const char *); /* generated */
extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) baudrate (void); /* implemented */
extern NCURSES_EXPORT(int) beep (void); /* implemented */
extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */
extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */
extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */
extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */
extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */
extern NCURSES_EXPORT(int) cbreak (void); /* implemented */
extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) clear (void); /* generated */
extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) clrtobot (void); /* generated */
extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */
extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */
extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */
extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) curs_set (int); /* implemented */
extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */
extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */
extern NCURSES_EXPORT(int) delay_output (int); /* implemented */
extern NCURSES_EXPORT(int) delch (void); /* generated */
extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */
extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) deleteln (void); /* generated */
extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) doupdate (void); /* implemented */
extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) echo (void); /* implemented */
extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */
extern NCURSES_EXPORT(int) erase (void); /* generated */
extern NCURSES_EXPORT(int) endwin (void); /* implemented */
extern NCURSES_EXPORT(char) erasechar (void); /* implemented */
extern NCURSES_EXPORT(void) filter (void); /* implemented */
extern NCURSES_EXPORT(int) flash (void); /* implemented */
extern NCURSES_EXPORT(int) flushinp (void); /* implemented */
extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getch (void); /* generated */
extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) getstr (char *); /* generated */
extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */
extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */
extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */
extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */
extern NCURSES_EXPORT(bool) has_il (void); /* implemented */
extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */
extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(chtype) inch (void); /* generated */
extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */
extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */
extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */
extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) insch (chtype); /* generated */
extern NCURSES_EXPORT(int) insdelln (int); /* generated */
extern NCURSES_EXPORT(int) insertln (void); /* generated */
extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */
extern NCURSES_EXPORT(int) insstr (const char *); /* generated */
extern NCURSES_EXPORT(int) instr (char *); /* generated */
extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */
extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */
extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */
extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(char) killchar (void); /* implemented */
extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(char *) longname (void); /* implemented */
extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) move (int, int); /* generated */
extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */
extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */
extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */
extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */
extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */
GCC_PRINTFLIKE(3,4);
extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(3,4);
extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */
extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */
extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */
extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */
extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */
extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */
GCC_PRINTFLIKE(4,5);
extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(4,5);
extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */
extern NCURSES_EXPORT(int) napms (int); /* implemented */
extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */
extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */
extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) nl (void); /* implemented */
extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */
extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) noecho (void); /* implemented */
extern NCURSES_EXPORT(int) nonl (void); /* implemented */
extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */
extern NCURSES_EXPORT(int) noraw (void); /* implemented */
extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */
extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */
GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */
extern NCURSES_EXPORT(void) qiflush (void); /* implemented */
extern NCURSES_EXPORT(int) raw (void); /* implemented */
extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) refresh (void); /* generated */
extern NCURSES_EXPORT(int) resetty (void); /* implemented */
extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */
extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */
extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */
extern NCURSES_EXPORT(int) savetty (void); /* implemented */
extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(1,2);
extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */
extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */
extern NCURSES_EXPORT(int) scrl (int); /* generated */
extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */
extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */
extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */
extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */
extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */
extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */
extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */
extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */
extern NCURSES_EXPORT(int) slk_init (int); /* implemented */
extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */
extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */
extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */
extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */
extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */
extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */
extern NCURSES_EXPORT(int) standout (void); /* generated */
extern NCURSES_EXPORT(int) standend (void); /* generated */
extern NCURSES_EXPORT(int) start_color (void); /* implemented */
extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */
extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */
extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */
extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */
extern NCURSES_EXPORT(char *) termname (void); /* implemented */
extern NCURSES_EXPORT(void) timeout (int); /* generated */
extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) typeahead (int); /* implemented */
extern NCURSES_EXPORT(int) ungetch (int); /* implemented */
extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) use_env (bool); /* implemented */
extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */
extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */
extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */
extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */
extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */
extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */
extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */
extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */
extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */
extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */
extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */
extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */
extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */
extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */
extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */
extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */
extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */
extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */
extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */
extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */
extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */
extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */
GCC_PRINTFLIKE(2,3);
extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */
GCC_SCANFLIKE(2,3);
extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */
extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */
extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */
extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */
/*
* These are also declared in <term.h>:
*/
extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */
extern NCURSES_EXPORT(int) putp (const char *); /* implemented */
#if NCURSES_TPARM_VARARGS
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */
extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */
#endif
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */
/*
* X/Open says this returns a bool; SVr4 also checked for out-of-range line.
* The macro provides compatibility:
*/
#define is_linetouched(w,l) ((!(w) || ((l) > getmaxy(w)) || ((l) < 0)) ? ERR : (is_linetouched)((w),(l)))
/*
* These functions are not in X/Open, but we use them in macro definitions:
*/
extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
/*
* vid_attr() was implemented originally based on a draft of X/Open curses.
*/
#if !NCURSES_WIDECHAR
#define vid_attr(a,pair,opts) vidattr(a)
#endif
/*
* These functions are extensions - not in X/Open Curses.
*/
#if 1
#undef NCURSES_EXT_FUNCS
#define NCURSES_EXT_FUNCS 20180224
typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
extern NCURSES_EXPORT(bool) is_term_resized (int, int);
extern NCURSES_EXPORT(char *) keybound (int, int);
extern NCURSES_EXPORT(const char *) curses_version (void);
extern NCURSES_EXPORT(int) alloc_pair (int, int);
extern NCURSES_EXPORT(int) assume_default_colors (int, int);
extern NCURSES_EXPORT(int) define_key (const char *, int);
extern NCURSES_EXPORT(int) extended_color_content(int, int *, int *, int *);
extern NCURSES_EXPORT(int) extended_pair_content(int, int *, int *);
extern NCURSES_EXPORT(int) extended_slk_color(int);
extern NCURSES_EXPORT(int) find_pair (int, int);
extern NCURSES_EXPORT(int) free_pair (int);
extern NCURSES_EXPORT(int) get_escdelay (void);
extern NCURSES_EXPORT(int) init_extended_color(int, int, int, int);
extern NCURSES_EXPORT(int) init_extended_pair(int, int, int);
extern NCURSES_EXPORT(int) key_defined (const char *);
extern NCURSES_EXPORT(int) keyok (int, bool);
extern NCURSES_EXPORT(void) reset_color_pairs (void);
extern NCURSES_EXPORT(int) resize_term (int, int);
extern NCURSES_EXPORT(int) resizeterm (int, int);
extern NCURSES_EXPORT(int) set_escdelay (int);
extern NCURSES_EXPORT(int) set_tabsize (int);
extern NCURSES_EXPORT(int) use_default_colors (void);
extern NCURSES_EXPORT(int) use_extended_names (bool);
extern NCURSES_EXPORT(int) use_legacy_coding (int);
extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
extern NCURSES_EXPORT(void) nofilter(void);
/*
* These extensions provide access to information stored in the WINDOW even
* when NCURSES_OPAQUE is set:
*/
extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* generated */
extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
#else
#define curses_version() NCURSES_VERSION
#endif
/*
* Extra extension-functions, which pass a SCREEN pointer rather than using
* a global variable SP.
*/
#if 1
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 20180224
#define NCURSES_SP_NAME(name) name##_sp
/* Define the sp-funcs helper function */
#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC)
typedef int (*NCURSES_SP_OUTC)(SCREEN*, int);
extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#if 1
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(alloc_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_color_content) (SCREEN*, int, int *, int *, int *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_pair_content) (SCREEN*, int, int *, int *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(extended_slk_color) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(find_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(free_pair) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_color) (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_pair) (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(reset_color_pairs) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
#endif
#else
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 0
#define NCURSES_SP_NAME(name) name
#define NCURSES_SP_OUTC NCURSES_OUTC
#endif
/* attributes */
#define NCURSES_ATTR_SHIFT 8
#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT))
#define A_NORMAL (1U - 1U)
#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U),0)
#define A_CHARTEXT (NCURSES_BITS(1U,0) - 1U)
#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0)
#define A_STANDOUT NCURSES_BITS(1U,8)
#define A_UNDERLINE NCURSES_BITS(1U,9)
#define A_REVERSE NCURSES_BITS(1U,10)
#define A_BLINK NCURSES_BITS(1U,11)
#define A_DIM NCURSES_BITS(1U,12)
#define A_BOLD NCURSES_BITS(1U,13)
#define A_ALTCHARSET NCURSES_BITS(1U,14)
#define A_INVIS NCURSES_BITS(1U,15)
#define A_PROTECT NCURSES_BITS(1U,16)
#define A_HORIZONTAL NCURSES_BITS(1U,17)
#define A_LEFT NCURSES_BITS(1U,18)
#define A_LOW NCURSES_BITS(1U,19)
#define A_RIGHT NCURSES_BITS(1U,20)
#define A_TOP NCURSES_BITS(1U,21)
#define A_VERTICAL NCURSES_BITS(1U,22)
#if 1
#define A_ITALIC NCURSES_BITS(1U,23) /* ncurses extension */
#endif
/*
* Most of the pseudo functions are macros that either provide compatibility
* with older versions of curses, or provide inline functionality to improve
* performance.
*/
/*
* These pseudo functions are always implemented as macros:
*/
#define getyx(win,y,x) (y = getcury(win), x = getcurx(win))
#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win))
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
#define getparyx(win,y,x) (y = getpary(win), x = getparx(win))
#define getsyx(y,x) do { if (newscr) { \
if (is_leaveok(newscr)) \
(y) = (x) = -1; \
else \
getyx(newscr,(y), (x)); \
} \
} while(0)
#define setsyx(y,x) do { if (newscr) { \
if ((y) == -1 && (x) == -1) \
leaveok(newscr, TRUE); \
else { \
leaveok(newscr, FALSE); \
wmove(newscr, (y), (x)); \
} \
} \
} while(0)
#ifndef NCURSES_NOMACROS
/*
* These miscellaneous pseudo functions are provided for compatibility:
*/
#define wgetstr(w, s) wgetnstr(w, s, -1)
#define getnstr(s, n) wgetnstr(stdscr, s, (n))
#define setterm(term) setupterm(term, 1, (int *)0)
#define fixterm() reset_prog_mode()
#define resetterm() reset_shell_mode()
#define saveterm() def_prog_mode()
#define crmode() cbreak()
#define nocrmode() nocbreak()
#define gettmode()
/* It seems older SYSV curses versions define these */
#if !NCURSES_OPAQUE
#define getattrs(win) NCURSES_CAST(int, NCURSES_OK_ADDR(win) ? (win)->_attrs : A_NORMAL)
#define getcurx(win) (NCURSES_OK_ADDR(win) ? (win)->_curx : ERR)
#define getcury(win) (NCURSES_OK_ADDR(win) ? (win)->_cury : ERR)
#define getbegx(win) (NCURSES_OK_ADDR(win) ? (win)->_begx : ERR)
#define getbegy(win) (NCURSES_OK_ADDR(win) ? (win)->_begy : ERR)
#define getmaxx(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxx + 1) : ERR)
#define getmaxy(win) (NCURSES_OK_ADDR(win) ? ((win)->_maxy + 1) : ERR)
#define getparx(win) (NCURSES_OK_ADDR(win) ? (win)->_parx : ERR)
#define getpary(win) (NCURSES_OK_ADDR(win) ? (win)->_pary : ERR)
#endif /* NCURSES_OPAQUE */
#define wstandout(win) (wattrset(win,A_STANDOUT))
#define wstandend(win) (wattrset(win,A_NORMAL))
#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && 1
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \
(win)->_attrs = NCURSES_CAST(attr_t, at), \
OK) \
: ERR)
#else
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_attrs = NCURSES_CAST(attr_t, at), \
OK) \
: ERR)
#endif
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
#define scroll(win) wscrl(win,1)
#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1)
#define touchline(win, s, c) wtouchln((win), s, c, 1)
#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0)
#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
#define hline(ch, n) whline(stdscr, ch, (n))
#define vline(ch, n) wvline(stdscr, ch, (n))
#define winstr(w, s) winnstr(w, s, -1)
#define winchstr(w, s) winchnstr(w, s, -1)
#define winsstr(w, s) winsnstr(w, s, -1)
#if !NCURSES_OPAQUE
#define redrawwin(win) wredrawln(win, 0, (NCURSES_OK_ADDR(win) ? (win)->_maxy+1 : -1))
#endif /* NCURSES_OPAQUE */
#define waddstr(win,str) waddnstr(win,str,-1)
#define waddchstr(win,str) waddchnstr(win,str,-1)
/*
* These apply to the first 256 color pairs.
*/
#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR)
#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
/*
* pseudo functions for standard screen
*/
#define addch(ch) waddch(stdscr,(ch))
#define addchnstr(str,n) waddchnstr(stdscr,(str),(n))
#define addchstr(str) waddchstr(stdscr,(str))
#define addnstr(str,n) waddnstr(stdscr,(str),(n))
#define addstr(str) waddnstr(stdscr,(str),-1)
#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o))
#define attr_off(a,o) wattr_off(stdscr,(a),(o))
#define attr_on(a,o) wattr_on(stdscr,(a),(o))
#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o))
#define attroff(at) wattroff(stdscr,(at))
#define attron(at) wattron(stdscr,(at))
#define attrset(at) wattrset(stdscr,(at))
#define bkgd(ch) wbkgd(stdscr,(ch))
#define bkgdset(ch) wbkgdset(stdscr,(ch))
#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o))
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define color_set(c,o) wcolor_set(stdscr,(c),(o))
#define delch() wdelch(stdscr)
#define deleteln() winsdelln(stdscr,-1)
#define echochar(c) wechochar(stdscr,(c))
#define erase() werase(stdscr)
#define getch() wgetch(stdscr)
#define getstr(str) wgetstr(stdscr,(str))
#define inch() winch(stdscr)
#define inchnstr(s,n) winchnstr(stdscr,(s),(n))
#define inchstr(s) winchstr(stdscr,(s))
#define innstr(s,n) winnstr(stdscr,(s),(n))
#define insch(c) winsch(stdscr,(c))
#define insdelln(n) winsdelln(stdscr,(n))
#define insertln() winsdelln(stdscr,1)
#define insnstr(s,n) winsnstr(stdscr,(s),(n))
#define insstr(s) winsstr(stdscr,(s))
#define instr(s) winstr(stdscr,(s))
#define move(y,x) wmove(stdscr,(y),(x))
#define refresh() wrefresh(stdscr)
#define scrl(n) wscrl(stdscr,(n))
#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b))
#define standend() wstandend(stdscr)
#define standout() wstandout(stdscr)
#define timeout(delay) wtimeout(stdscr,(delay))
#define wdeleteln(win) winsdelln(win,-1)
#define winsertln(win) winsdelln(win,1)
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch)))
#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n)))
#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1))
#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n)))
#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1))
#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o)))
#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win))
#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win))
#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n)))
#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str)))
#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n)))
#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n)))
#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s)))
#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n)))
#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c)))
#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n)))
#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s)))
#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s)))
#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n)))
#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch))
#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n))
#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str))
#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n))
#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str))
#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o))
#define mvdelch(y,x) mvwdelch(stdscr,(y),(x))
#define mvgetch(y,x) mvwgetch(stdscr,(y),(x))
#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n))
#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str))
#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n))
#define mvinch(y,x) mvwinch(stdscr,(y),(x))
#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n))
#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s))
#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n))
#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c))
#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n))
#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s))
#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s))
#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n))
/*
* Some wide-character functions can be implemented without the extensions.
*/
#if !NCURSES_OPAQUE
#define getbkgd(win) (NCURSES_OK_ADDR(win) ? ((win)->_bkgd) : 0)
#endif /* NCURSES_OPAQUE */
#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a))
#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a))
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && 1
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = ((a) & ~A_COLOR), \
(win)->_color = (opts) ? *(int *)(opts) : (p)), \
OK) \
: ERR)
#define wattr_get(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)(NCURSES_OK_ADDR(a) \
? (*(a) = (win)->_attrs) \
: OK), \
(void)(NCURSES_OK_ADDR(p) \
? (*(p) = (NCURSES_PAIRS_T) (win)->_color) \
: OK), \
(void)(NCURSES_OK_ADDR(opts) \
? (*(int *)(opts) = (win)->_color) \
: OK), \
OK) \
: ERR)
#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \
(attr_t)COLOR_PAIR(p))), \
OK) \
: ERR)
#define wattr_get(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)(NCURSES_OK_ADDR(a) \
? (*(a) = (win)->_attrs) \
: OK), \
(void)(NCURSES_OK_ADDR(p) \
? (*(p) = (NCURSES_PAIRS_T) PAIR_NUMBER((win)->_attrs)) \
: OK), \
OK) \
: ERR)
#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
/*
* X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
* varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to
* use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already
* use stdarg.h, so...
*/
#define vw_printw vwprintw
#define vw_scanw vwscanw
/*
* Export fallback function for use in C++ binding.
*/
#if !1
#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
#endif
/*
* These macros are extensions - not in X/Open Curses.
*/
#if 1
#if !NCURSES_OPAQUE
#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE)
#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE)
#define is_idlok(win) (NCURSES_OK_ADDR(win) ? (win)->_idlok : FALSE)
#define is_immedok(win) (NCURSES_OK_ADDR(win) ? (win)->_immed : FALSE)
#define is_keypad(win) (NCURSES_OK_ADDR(win) ? (win)->_use_keypad : FALSE)
#define is_leaveok(win) (NCURSES_OK_ADDR(win) ? (win)->_leaveok : FALSE)
#define is_nodelay(win) (NCURSES_OK_ADDR(win) ? ((win)->_delay == 0) : FALSE)
#define is_notimeout(win) (NCURSES_OK_ADDR(win) ? (win)->_notimeout : FALSE)
#define is_pad(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _ISPAD) != 0 : FALSE)
#define is_scrollok(win) (NCURSES_OK_ADDR(win) ? (win)->_scroll : FALSE)
#define is_subwin(win) (NCURSES_OK_ADDR(win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE)
#define is_syncok(win) (NCURSES_OK_ADDR(win) ? (win)->_sync : FALSE)
#define wgetdelay(win) (NCURSES_OK_ADDR(win) ? (win)->_delay : 0)
#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0)
#define wgetscrreg(win,t,b) (NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
#endif
#endif
#endif /* NCURSES_NOMACROS */
/*
* Public variables.
*
* Notes:
* a. ESCDELAY was an undocumented feature under AIX curses.
* It gives the ESC expire time in milliseconds.
* b. ttytype is needed for backward compatibility
*/
#if NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(WINDOW *, curscr);
NCURSES_WRAPPED_VAR(WINDOW *, newscr);
NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
NCURSES_WRAPPED_VAR(char *, ttytype);
NCURSES_WRAPPED_VAR(int, COLORS);
NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
NCURSES_WRAPPED_VAR(int, COLS);
NCURSES_WRAPPED_VAR(int, ESCDELAY);
NCURSES_WRAPPED_VAR(int, LINES);
NCURSES_WRAPPED_VAR(int, TABSIZE);
#define curscr NCURSES_PUBLIC_VAR(curscr())
#define newscr NCURSES_PUBLIC_VAR(newscr())
#define stdscr NCURSES_PUBLIC_VAR(stdscr())
#define ttytype NCURSES_PUBLIC_VAR(ttytype())
#define COLORS NCURSES_PUBLIC_VAR(COLORS())
#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
#define COLS NCURSES_PUBLIC_VAR(COLS())
#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY())
#define LINES NCURSES_PUBLIC_VAR(LINES())
#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE())
#else
extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
extern NCURSES_EXPORT_VAR(char) ttytype[];
extern NCURSES_EXPORT_VAR(int) COLORS;
extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
extern NCURSES_EXPORT_VAR(int) COLS;
extern NCURSES_EXPORT_VAR(int) ESCDELAY;
extern NCURSES_EXPORT_VAR(int) LINES;
extern NCURSES_EXPORT_VAR(int) TABSIZE;
#endif
/*
* Pseudo-character tokens outside ASCII range. The curses wgetch() function
* will return any given one of these only if the corresponding k- capability
* is defined in your terminal's terminfo entry.
*
* Some keys (KEY_A1, etc) are arranged like this:
* a1 up a3
* left b2 right
* c1 down c3
*
* A few key codes do not depend upon the terminfo entry.
*/
#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */
#define KEY_MIN 0401 /* Minimum curses key */
#define KEY_BREAK 0401 /* Break key (unreliable) */
#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */
#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */
/*
* These definitions were generated by ./MKkey_defs.sh ./Caps
*/
#define KEY_DOWN 0402 /* down-arrow key */
#define KEY_UP 0403 /* up-arrow key */
#define KEY_LEFT 0404 /* left-arrow key */
#define KEY_RIGHT 0405 /* right-arrow key */
#define KEY_HOME 0406 /* home key */
#define KEY_BACKSPACE 0407 /* backspace key */
#define KEY_F0 0410 /* Function keys. Space for 64 */
#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */
#define KEY_DL 0510 /* delete-line key */
#define KEY_IL 0511 /* insert-line key */
#define KEY_DC 0512 /* delete-character key */
#define KEY_IC 0513 /* insert-character key */
#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */
#define KEY_CLEAR 0515 /* clear-screen or erase key */
#define KEY_EOS 0516 /* clear-to-end-of-screen key */
#define KEY_EOL 0517 /* clear-to-end-of-line key */
#define KEY_SF 0520 /* scroll-forward key */
#define KEY_SR 0521 /* scroll-backward key */
#define KEY_NPAGE 0522 /* next-page key */
#define KEY_PPAGE 0523 /* previous-page key */
#define KEY_STAB 0524 /* set-tab key */
#define KEY_CTAB 0525 /* clear-tab key */
#define KEY_CATAB 0526 /* clear-all-tabs key */
#define KEY_ENTER 0527 /* enter/send key */
#define KEY_PRINT 0532 /* print key */
#define KEY_LL 0533 /* lower-left key (home down) */
#define KEY_A1 0534 /* upper left of keypad */
#define KEY_A3 0535 /* upper right of keypad */
#define KEY_B2 0536 /* center of keypad */
#define KEY_C1 0537 /* lower left of keypad */
#define KEY_C3 0540 /* lower right of keypad */
#define KEY_BTAB 0541 /* back-tab key */
#define KEY_BEG 0542 /* begin key */
#define KEY_CANCEL 0543 /* cancel key */
#define KEY_CLOSE 0544 /* close key */
#define KEY_COMMAND 0545 /* command key */
#define KEY_COPY 0546 /* copy key */
#define KEY_CREATE 0547 /* create key */
#define KEY_END 0550 /* end key */
#define KEY_EXIT 0551 /* exit key */
#define KEY_FIND 0552 /* find key */
#define KEY_HELP 0553 /* help key */
#define KEY_MARK 0554 /* mark key */
#define KEY_MESSAGE 0555 /* message key */
#define KEY_MOVE 0556 /* move key */
#define KEY_NEXT 0557 /* next key */
#define KEY_OPEN 0560 /* open key */
#define KEY_OPTIONS 0561 /* options key */
#define KEY_PREVIOUS 0562 /* previous key */
#define KEY_REDO 0563 /* redo key */
#define KEY_REFERENCE 0564 /* reference key */
#define KEY_REFRESH 0565 /* refresh key */
#define KEY_REPLACE 0566 /* replace key */
#define KEY_RESTART 0567 /* restart key */
#define KEY_RESUME 0570 /* resume key */
#define KEY_SAVE 0571 /* save key */
#define KEY_SBEG 0572 /* shifted begin key */
#define KEY_SCANCEL 0573 /* shifted cancel key */
#define KEY_SCOMMAND 0574 /* shifted command key */
#define KEY_SCOPY 0575 /* shifted copy key */
#define KEY_SCREATE 0576 /* shifted create key */
#define KEY_SDC 0577 /* shifted delete-character key */
#define KEY_SDL 0600 /* shifted delete-line key */
#define KEY_SELECT 0601 /* select key */
#define KEY_SEND 0602 /* shifted end key */
#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */
#define KEY_SEXIT 0604 /* shifted exit key */
#define KEY_SFIND 0605 /* shifted find key */
#define KEY_SHELP 0606 /* shifted help key */
#define KEY_SHOME 0607 /* shifted home key */
#define KEY_SIC 0610 /* shifted insert-character key */
#define KEY_SLEFT 0611 /* shifted left-arrow key */
#define KEY_SMESSAGE 0612 /* shifted message key */
#define KEY_SMOVE 0613 /* shifted move key */
#define KEY_SNEXT 0614 /* shifted next key */
#define KEY_SOPTIONS 0615 /* shifted options key */
#define KEY_SPREVIOUS 0616 /* shifted previous key */
#define KEY_SPRINT 0617 /* shifted print key */
#define KEY_SREDO 0620 /* shifted redo key */
#define KEY_SREPLACE 0621 /* shifted replace key */
#define KEY_SRIGHT 0622 /* shifted right-arrow key */
#define KEY_SRSUME 0623 /* shifted resume key */
#define KEY_SSAVE 0624 /* shifted save key */
#define KEY_SSUSPEND 0625 /* shifted suspend key */
#define KEY_SUNDO 0626 /* shifted undo key */
#define KEY_SUSPEND 0627 /* suspend key */
#define KEY_UNDO 0630 /* undo key */
#define KEY_MOUSE 0631 /* Mouse event has occurred */
#define KEY_RESIZE 0632 /* Terminal resize event */
#define KEY_EVENT 0633 /* We were interrupted by an event */
#define KEY_MAX 0777 /* Maximum key value is 0633 */
/* $Id: curses.wide,v 1.50 2017/03/26 16:05:21 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
* (see that file for the relevant copyright).
*/
#define _XOPEN_CURSES 1
#if NCURSES_WIDECHAR
extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
#define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))])
#define WACS_BSSB NCURSES_WACS('l')
#define WACS_SSBB NCURSES_WACS('m')
#define WACS_BBSS NCURSES_WACS('k')
#define WACS_SBBS NCURSES_WACS('j')
#define WACS_SBSS NCURSES_WACS('u')
#define WACS_SSSB NCURSES_WACS('t')
#define WACS_SSBS NCURSES_WACS('v')
#define WACS_BSSS NCURSES_WACS('w')
#define WACS_BSBS NCURSES_WACS('q')
#define WACS_SBSB NCURSES_WACS('x')
#define WACS_SSSS NCURSES_WACS('n')
#define WACS_ULCORNER WACS_BSSB
#define WACS_LLCORNER WACS_SSBB
#define WACS_URCORNER WACS_BBSS
#define WACS_LRCORNER WACS_SBBS
#define WACS_RTEE WACS_SBSS
#define WACS_LTEE WACS_SSSB
#define WACS_BTEE WACS_SSBS
#define WACS_TTEE WACS_BSSS
#define WACS_HLINE WACS_BSBS
#define WACS_VLINE WACS_SBSB
#define WACS_PLUS WACS_SSSS
#define WACS_S1 NCURSES_WACS('o') /* scan line 1 */
#define WACS_S9 NCURSES_WACS('s') /* scan line 9 */
#define WACS_DIAMOND NCURSES_WACS('`') /* diamond */
#define WACS_CKBOARD NCURSES_WACS('a') /* checker board */
#define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */
#define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */
#define WACS_BULLET NCURSES_WACS('~') /* bullet */
/* Teletype 5410v1 symbols */
#define WACS_LARROW NCURSES_WACS(',') /* arrow left */
#define WACS_RARROW NCURSES_WACS('+') /* arrow right */
#define WACS_DARROW NCURSES_WACS('.') /* arrow down */
#define WACS_UARROW NCURSES_WACS('-') /* arrow up */
#define WACS_BOARD NCURSES_WACS('h') /* board of squares */
#define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */
#define WACS_BLOCK NCURSES_WACS('0') /* solid square block */
/* ncurses extensions */
#define WACS_S3 NCURSES_WACS('p') /* scan line 3 */
#define WACS_S7 NCURSES_WACS('r') /* scan line 7 */
#define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */
#define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */
#define WACS_PI NCURSES_WACS('{') /* Pi */
#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */
#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */
/* double lines */
#define WACS_BDDB NCURSES_WACS('C')
#define WACS_DDBB NCURSES_WACS('D')
#define WACS_BBDD NCURSES_WACS('B')
#define WACS_DBBD NCURSES_WACS('A')
#define WACS_DBDD NCURSES_WACS('G')
#define WACS_DDDB NCURSES_WACS('F')
#define WACS_DDBD NCURSES_WACS('H')
#define WACS_BDDD NCURSES_WACS('I')
#define WACS_BDBD NCURSES_WACS('R')
#define WACS_DBDB NCURSES_WACS('Y')
#define WACS_DDDD NCURSES_WACS('E')
#define WACS_D_ULCORNER WACS_BDDB
#define WACS_D_LLCORNER WACS_DDBB
#define WACS_D_URCORNER WACS_BBDD
#define WACS_D_LRCORNER WACS_DBBD
#define WACS_D_RTEE WACS_DBDD
#define WACS_D_LTEE WACS_DDDB
#define WACS_D_BTEE WACS_DDBD
#define WACS_D_TTEE WACS_BDDD
#define WACS_D_HLINE WACS_BDBD
#define WACS_D_VLINE WACS_DBDB
#define WACS_D_PLUS WACS_DDDD
/* thick lines */
#define WACS_BTTB NCURSES_WACS('L')
#define WACS_TTBB NCURSES_WACS('M')
#define WACS_BBTT NCURSES_WACS('K')
#define WACS_TBBT NCURSES_WACS('J')
#define WACS_TBTT NCURSES_WACS('U')
#define WACS_TTTB NCURSES_WACS('T')
#define WACS_TTBT NCURSES_WACS('V')
#define WACS_BTTT NCURSES_WACS('W')
#define WACS_BTBT NCURSES_WACS('Q')
#define WACS_TBTB NCURSES_WACS('X')
#define WACS_TTTT NCURSES_WACS('N')
#define WACS_T_ULCORNER WACS_BTTB
#define WACS_T_LLCORNER WACS_TTBB
#define WACS_T_URCORNER WACS_BBTT
#define WACS_T_LRCORNER WACS_TBBT
#define WACS_T_RTEE WACS_TBTT
#define WACS_T_LTEE WACS_TTTB
#define WACS_T_BTEE WACS_TTBT
#define WACS_T_TTEE WACS_BTTT
#define WACS_T_HLINE WACS_BTBT
#define WACS_T_VLINE WACS_TBTB
#define WACS_T_PLUS WACS_TTTT
/*
* Function prototypes for wide-character operations.
*
* "generated" comments should include ":WIDEC" to make the corresponding
* functions ifdef'd in lib_gen.c
*
* "implemented" comments do not need this marker.
*/
extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */
extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */
extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */
extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */
extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */
extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */
extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */
extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */
extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* implemented */
extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */
extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *, wint_t *, int); /* implemented */
extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */
extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#endif
#ifndef NCURSES_NOMACROS
/*
* XSI curses macros for XPG4 conformance.
*/
#define add_wch(c) wadd_wch(stdscr,(c))
#define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n))
#define add_wchstr(str) wadd_wchstr(stdscr,(str))
#define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n))
#define addwstr(wstr) waddwstr(stdscr,(wstr))
#define bkgrnd(c) wbkgrnd(stdscr,(c))
#define bkgrndset(c) wbkgrndset(stdscr,(c))
#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0)
#define echo_wchar(c) wecho_wchar(stdscr,(c))
#define get_wch(c) wget_wch(stdscr,(c))
#define get_wstr(t) wget_wstr(stdscr,(t))
#define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch))
#define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n))
#define hline_set(c,n) whline_set(stdscr,(c),(n))
#define in_wch(c) win_wch(stdscr,(c))
#define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n))
#define in_wchstr(c) win_wchstr(stdscr,(c))
#define innwstr(c,n) winnwstr(stdscr,(c),(n))
#define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n))
#define ins_wch(c) wins_wch(stdscr,(c))
#define ins_wstr(t) wins_wstr(stdscr,(t))
#define inwstr(c) winwstr(stdscr,(c))
#define vline_set(c,n) wvline_set(stdscr,(c),(n))
#define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1)
#define waddwstr(win,wstr) waddnwstr((win),(wstr),-1)
#define wget_wstr(w,t) wgetn_wstr((w),(t),-1)
#define win_wchstr(w,c) win_wchnstr((w),(c),-1)
#define wins_wstr(w,t) wins_nwstr((w),(t),-1)
#if !NCURSES_OPAQUE
#define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR)
#endif
#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c))
#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n))
#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s))
#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n))
#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr))
#define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c))
#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t))
#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n))
#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n))
#define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c))
#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n))
#define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c))
#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n))
#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n))
#define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c))
#define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t))
#define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c))
#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n))
#define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c)))
#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n)))
#define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s)))
#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n)))
#define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr)))
#define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c)))
#define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t)))
#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n)))
#define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n)))
#define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c)))
#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n)))
#define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c)))
#define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n)))
#define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n)))
#define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c)))
#define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t)))
#define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c)))
#define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n)))
#endif /* NCURSES_NOMACROS */
#if defined(TRACE) || defined(NCURSES_TEST)
extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *);
extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);
#endif
#endif /* NCURSES_WIDECHAR */
/* $Id: curses.tail,v 1.23 2016/02/13 16:37:45 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
* (see that file for the relevant copyright).
*/
/* mouse interface */
#if NCURSES_MOUSE_VERSION > 1
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
#else
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
#endif
#define NCURSES_BUTTON_RELEASED 001L
#define NCURSES_BUTTON_PRESSED 002L
#define NCURSES_BUTTON_CLICKED 004L
#define NCURSES_DOUBLE_CLICKED 010L
#define NCURSES_TRIPLE_CLICKED 020L
#define NCURSES_RESERVED_EVENT 040L
/* event masks */
#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
/*
* In 32 bits the version-1 scheme does not provide enough space for a 5th
* button, unless we choose to change the ABI by omitting the reserved-events.
*/
#if NCURSES_MOUSE_VERSION > 1
#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L)
#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L)
#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L)
#else
#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L)
#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L)
#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L)
#endif
#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
/* macros to extract single event-bits from masks */
#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001))
#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002))
#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004))
#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010))
#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020))
#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040))
typedef struct
{
short id; /* ID to distinguish multiple devices */
int x, y, z; /* event coordinates (character-cell) */
mmask_t bstate; /* button state bits */
}
MEVENT;
extern NCURSES_EXPORT(bool) has_mouse(void);
extern NCURSES_EXPORT(int) getmouse (MEVENT *);
extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
extern NCURSES_EXPORT(int) mouseinterval (int);
extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *);
extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int);
#endif
#ifndef NCURSES_NOMACROS
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
#endif
/* other non-XSI functions */
extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */
extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */
#endif
/* Debugging : use with libncurses_g.a */
extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(char *) _traceattr (attr_t);
extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
extern NCURSES_EXPORT(char *) _tracechar (int);
extern NCURSES_EXPORT(char *) _tracechtype (chtype);
extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
#if NCURSES_WIDECHAR
#define _tracech_t _tracecchar_t
extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
#define _tracech_t2 _tracecchar_t2
extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
#else
#define _tracech_t _tracechtype
#define _tracech_t2 _tracechtype2
#endif
extern NCURSES_EXPORT(void) trace (const unsigned int);
/* trace masks */
#define TRACE_DISABLE 0x0000 /* turn off tracing */
#define TRACE_TIMES 0x0001 /* trace user and system times of updates */
#define TRACE_TPUTS 0x0002 /* trace tputs calls */
#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */
#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */
#define TRACE_CHARPUT 0x0010 /* trace all character outputs */
#define TRACE_ORDINARY 0x001F /* trace all update actions */
#define TRACE_CALLS 0x0020 /* trace all curses calls */
#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */
#define TRACE_IEVENT 0x0080 /* trace low-level input processing */
#define TRACE_BITS 0x0100 /* trace state of TTY control bits */
#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */
#define TRACE_CCALLS 0x0400 /* trace per-character calls */
#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */
#define TRACE_ATTRS 0x1000 /* trace attribute updates */
#define TRACE_SHIFT 13 /* number of bits in the trace masks */
#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */
#if defined(TRACE) || defined(NCURSES_TEST)
extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */
extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */
#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */
#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */
#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */
#endif
#include <unctrl.h>
#ifdef __cplusplus
#ifndef NCURSES_NOMACROS
/* these names conflict with STL */
#undef box
#undef clear
#undef erase
#undef move
#undef refresh
#endif /* NCURSES_NOMACROS */
}
#endif
#endif /* __NCURSES_H */
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $
#ifndef NCURSES_CURSSLK_H_incl
#define NCURSES_CURSSLK_H_incl
#include <cursesw.h>
class NCURSES_IMPEXP Soft_Label_Key_Set {
public:
// This inner class represents the attributes of a Soft Label Key (SLK)
class NCURSES_IMPEXP Soft_Label_Key {
friend class Soft_Label_Key_Set;
public:
typedef enum { Left=0, Center=1, Right=2 } Justification;
private:
char *label; // The Text of the Label
Justification format; // The Justification
int num; // The number of the Label
Soft_Label_Key() : label(NULL), format(Left), num(-1) {
}
virtual ~Soft_Label_Key() {
delete[] label;
};
public:
// Set the text of the Label
Soft_Label_Key& operator=(char *text);
// Set the Justification of the Label
Soft_Label_Key& operator=(Justification just) {
format = just;
return *this;
}
// Retrieve the text of the label
inline char* operator()(void) const {
return label;
}
Soft_Label_Key& operator=(const Soft_Label_Key& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
Soft_Label_Key(const Soft_Label_Key& rhs)
: label(NULL),
format(rhs.format),
num(rhs.num)
{
*this = rhs.label;
}
};
public:
typedef enum {
None = -1,
Three_Two_Three = 0,
Four_Four = 1,
PC_Style = 2,
PC_Style_With_Index = 3
} Label_Layout;
private:
static long NCURSES_IMPEXP count; // Number of Key Sets
static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets
static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets
bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized
Soft_Label_Key *slk_array; // The array of SLK's
// Init the Key Set
void init();
// Activate or Deactivate Label# i, Label counting starts with 1!
void activate_label(int i, bool bf=TRUE);
// Activate of Deactivate all Labels
void activate_labels(bool bf);
protected:
inline void Error (const char* msg) const THROWS(NCursesException) {
THROW(new NCursesException (msg));
}
// Remove SLK's from screen
void clear() {
if (ERR==::slk_clear())
Error("slk_clear");
}
// Restore them
void restore() {
if (ERR==::slk_restore())
Error("slk_restore");
}
public:
// Construct a Key Set, use the most comfortable layout as default.
// You must create a Soft_Label_Key_Set before you create any object of
// the NCursesWindow, NCursesPanel or derived classes. (Actually before
// ::initscr() is called).
Soft_Label_Key_Set(Label_Layout fmt);
// This constructor assumes, that you already constructed a Key Set
// with a layout by the constructor above. This layout will be reused.
NCURSES_IMPEXP Soft_Label_Key_Set();
Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs)
{
if (this != &rhs) {
*this = rhs;
init(); // allocate a new slk_array[]
}
return *this;
}
Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs)
: b_attrInit(rhs.b_attrInit),
slk_array(NULL)
{
init(); // allocate a new slk_array[]
}
virtual ~Soft_Label_Key_Set();
// Get Label# i. Label counting starts with 1!
NCURSES_IMPEXP Soft_Label_Key& operator[](int i);
// Retrieve number of Labels
inline int labels() const { return num_labels; }
// Refresh the SLK portion of the screen
inline void refresh() {
if (ERR==::slk_refresh())
Error("slk_refresh");
}
// Mark the SLK portion of the screen for refresh, defer actual refresh
// until next update call.
inline void noutrefresh() {
if (ERR==::slk_noutrefresh())
Error("slk_noutrefresh");
}
// Mark the whole SLK portion of the screen as modified
inline void touch() {
if (ERR==::slk_touch())
Error("slk_touch");
}
// Activate Label# i
inline void show(int i) {
activate_label(i,FALSE);
activate_label(i,TRUE);
}
// Hide Label# i
inline void hide(int i) {
activate_label(i,FALSE);
}
// Show all Labels
inline void show() {
activate_labels(FALSE);
activate_labels(TRUE);
}
// Hide all Labels
inline void hide() {
activate_labels(FALSE);
}
inline void attron(attr_t attrs) {
if (ERR==::slk_attron(attrs))
Error("slk_attron");
}
inline void attroff(attr_t attrs) {
if (ERR==::slk_attroff(attrs))
Error("slk_attroff");
}
inline void attrset(attr_t attrs) {
if (ERR==::slk_attrset(attrs))
Error("slk_attrset");
}
inline void color(short color_pair_number) {
if (ERR==::slk_color(color_pair_number))
Error("slk_color");
}
inline attr_t attr() const {
return ::slk_attr();
}
};
#endif /* NCURSES_CURSSLK_H_incl */
/****************************************************************************
* Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************/
/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */
/* and: Eric S. Raymond <esr@snark.thyrsus.com> */
/* and: Thomas E. Dickey 1995-on */
/****************************************************************************/
/* $Id: MKterm.h.awk.in,v 1.67 2017/04/06 00:19:26 tom Exp $ */
/*
** term.h -- Definition of struct term
*/
#ifndef NCURSES_TERM_H_incl
#define NCURSES_TERM_H_incl 1
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.1"
#include <ncurses_dll.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H
* definition (based on the system for which this was configured).
*/
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_SBOOL
#define NCURSES_SBOOL char
#undef NCURSES_USE_DATABASE
#define NCURSES_USE_DATABASE 1
#undef NCURSES_USE_TERMCAP
#define NCURSES_USE_TERMCAP 0
#undef NCURSES_XNAMES
#define NCURSES_XNAMES 1
/* We will use these symbols to hide differences between
* termios/termio/sgttyb interfaces.
*/
#undef TTY
#undef SET_TTY
#undef GET_TTY
/* Assume POSIX termio if we have the header and function */
/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */
#if 1 && 1
#undef TERMIOS
#define TERMIOS 1
#include <termios.h>
#define TTY struct termios
#else /* !HAVE_TERMIOS_H */
/* #if HAVE_TERMIO_H */
#if 1
#undef TERMIOS
#define TERMIOS 1
#include <termio.h>
#define TTY struct termio
#else /* !HAVE_TERMIO_H */
#if __MINGW32__
# include <ncurses_mingw.h>
# define TTY struct termios
#else
#undef TERMIOS
#include <sgtty.h>
#include <sys/ioctl.h>
#define TTY struct sgttyb
#endif /* MINGW32 */
#endif /* HAVE_TERMIO_H */
#endif /* HAVE_TERMIOS_H */
#ifdef TERMIOS
#define GET_TTY(fd, buf) tcgetattr(fd, buf)
#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)
#else
#define GET_TTY(fd, buf) gtty(fd, buf)
#define SET_TTY(fd, buf) stty(fd, buf)
#endif
#define NAMESIZE 256
/* The cast works because TERMTYPE is the first data in TERMINAL */
#define CUR ((TERMTYPE *)(cur_term))->
#define auto_left_margin CUR Booleans[0]
#define auto_right_margin CUR Booleans[1]
#define no_esc_ctlc CUR Booleans[2]
#define ceol_standout_glitch CUR Booleans[3]
#define eat_newline_glitch CUR Booleans[4]
#define erase_overstrike CUR Booleans[5]
#define generic_type CUR Booleans[6]
#define hard_copy CUR Booleans[7]
#define has_meta_key CUR Booleans[8]
#define has_status_line CUR Booleans[9]
#define insert_null_glitch CUR Booleans[10]
#define memory_above CUR Booleans[11]
#define memory_below CUR Booleans[12]
#define move_insert_mode CUR Booleans[13]
#define move_standout_mode CUR Booleans[14]
#define over_strike CUR Booleans[15]
#define status_line_esc_ok CUR Booleans[16]
#define dest_tabs_magic_smso CUR Booleans[17]
#define tilde_glitch CUR Booleans[18]
#define transparent_underline CUR Booleans[19]
#define xon_xoff CUR Booleans[20]
#define needs_xon_xoff CUR Booleans[21]
#define prtr_silent CUR Booleans[22]
#define hard_cursor CUR Booleans[23]
#define non_rev_rmcup CUR Booleans[24]
#define no_pad_char CUR Booleans[25]
#define non_dest_scroll_region CUR Booleans[26]
#define can_change CUR Booleans[27]
#define back_color_erase CUR Booleans[28]
#define hue_lightness_saturation CUR Booleans[29]
#define col_addr_glitch CUR Booleans[30]
#define cr_cancels_micro_mode CUR Booleans[31]
#define has_print_wheel CUR Booleans[32]
#define row_addr_glitch CUR Booleans[33]
#define semi_auto_right_margin CUR Booleans[34]
#define cpi_changes_res CUR Booleans[35]
#define lpi_changes_res CUR Booleans[36]
#define columns CUR Numbers[0]
#define init_tabs CUR Numbers[1]
#define lines CUR Numbers[2]
#define lines_of_memory CUR Numbers[3]
#define magic_cookie_glitch CUR Numbers[4]
#define padding_baud_rate CUR Numbers[5]
#define virtual_terminal CUR Numbers[6]
#define width_status_line CUR Numbers[7]
#define num_labels CUR Numbers[8]
#define label_height CUR Numbers[9]
#define label_width CUR Numbers[10]
#define max_attributes CUR Numbers[11]
#define maximum_windows CUR Numbers[12]
#define max_colors CUR Numbers[13]
#define max_pairs CUR Numbers[14]
#define no_color_video CUR Numbers[15]
#define buffer_capacity CUR Numbers[16]
#define dot_vert_spacing CUR Numbers[17]
#define dot_horz_spacing CUR Numbers[18]
#define max_micro_address CUR Numbers[19]
#define max_micro_jump CUR Numbers[20]
#define micro_col_size CUR Numbers[21]
#define micro_line_size CUR Numbers[22]
#define number_of_pins CUR Numbers[23]
#define output_res_char CUR Numbers[24]
#define output_res_line CUR Numbers[25]
#define output_res_horz_inch CUR Numbers[26]
#define output_res_vert_inch CUR Numbers[27]
#define print_rate CUR Numbers[28]
#define wide_char_size CUR Numbers[29]
#define buttons CUR Numbers[30]
#define bit_image_entwining CUR Numbers[31]
#define bit_image_type CUR Numbers[32]
#define back_tab CUR Strings[0]
#define bell CUR Strings[1]
#define carriage_return CUR Strings[2]
#define change_scroll_region CUR Strings[3]
#define clear_all_tabs CUR Strings[4]
#define clear_screen CUR Strings[5]
#define clr_eol CUR Strings[6]
#define clr_eos CUR Strings[7]
#define column_address CUR Strings[8]
#define command_character CUR Strings[9]
#define cursor_address CUR Strings[10]
#define cursor_down CUR Strings[11]
#define cursor_home CUR Strings[12]
#define cursor_invisible CUR Strings[13]
#define cursor_left CUR Strings[14]
#define cursor_mem_address CUR Strings[15]
#define cursor_normal CUR Strings[16]
#define cursor_right CUR Strings[17]
#define cursor_to_ll CUR Strings[18]
#define cursor_up CUR Strings[19]
#define cursor_visible CUR Strings[20]
#define delete_character CUR Strings[21]
#define delete_line CUR Strings[22]
#define dis_status_line CUR Strings[23]
#define down_half_line CUR Strings[24]
#define enter_alt_charset_mode CUR Strings[25]
#define enter_blink_mode CUR Strings[26]
#define enter_bold_mode CUR Strings[27]
#define enter_ca_mode CUR Strings[28]
#define enter_delete_mode CUR Strings[29]
#define enter_dim_mode CUR Strings[30]
#define enter_insert_mode CUR Strings[31]
#define enter_secure_mode CUR Strings[32]
#define enter_protected_mode CUR Strings[33]
#define enter_reverse_mode CUR Strings[34]
#define enter_standout_mode CUR Strings[35]
#define enter_underline_mode CUR Strings[36]
#define erase_chars CUR Strings[37]
#define exit_alt_charset_mode CUR Strings[38]
#define exit_attribute_mode CUR Strings[39]
#define exit_ca_mode CUR Strings[40]
#define exit_delete_mode CUR Strings[41]
#define exit_insert_mode CUR Strings[42]
#define exit_standout_mode CUR Strings[43]
#define exit_underline_mode CUR Strings[44]
#define flash_screen CUR Strings[45]
#define form_feed CUR Strings[46]
#define from_status_line CUR Strings[47]
#define init_1string CUR Strings[48]
#define init_2string CUR Strings[49]
#define init_3string CUR Strings[50]
#define init_file CUR Strings[51]
#define insert_character CUR Strings[52]
#define insert_line CUR Strings[53]
#define insert_padding CUR Strings[54]
#define key_backspace CUR Strings[55]
#define key_catab CUR Strings[56]
#define key_clear CUR Strings[57]
#define key_ctab CUR Strings[58]
#define key_dc CUR Strings[59]
#define key_dl CUR Strings[60]
#define key_down CUR Strings[61]
#define key_eic CUR Strings[62]
#define key_eol CUR Strings[63]
#define key_eos CUR Strings[64]
#define key_f0 CUR Strings[65]
#define key_f1 CUR Strings[66]
#define key_f10 CUR Strings[67]
#define key_f2 CUR Strings[68]
#define key_f3 CUR Strings[69]
#define key_f4 CUR Strings[70]
#define key_f5 CUR Strings[71]
#define key_f6 CUR Strings[72]
#define key_f7 CUR Strings[73]
#define key_f8 CUR Strings[74]
#define key_f9 CUR Strings[75]
#define key_home CUR Strings[76]
#define key_ic CUR Strings[77]
#define key_il CUR Strings[78]
#define key_left CUR Strings[79]
#define key_ll CUR Strings[80]
#define key_npage CUR Strings[81]
#define key_ppage CUR Strings[82]
#define key_right CUR Strings[83]
#define key_sf CUR Strings[84]
#define key_sr CUR Strings[85]
#define key_stab CUR Strings[86]
#define key_up CUR Strings[87]
#define keypad_local CUR Strings[88]
#define keypad_xmit CUR Strings[89]
#define lab_f0 CUR Strings[90]
#define lab_f1 CUR Strings[91]
#define lab_f10 CUR Strings[92]
#define lab_f2 CUR Strings[93]
#define lab_f3 CUR Strings[94]
#define lab_f4 CUR Strings[95]
#define lab_f5 CUR Strings[96]
#define lab_f6 CUR Strings[97]
#define lab_f7 CUR Strings[98]
#define lab_f8 CUR Strings[99]
#define lab_f9 CUR Strings[100]
#define meta_off CUR Strings[101]
#define meta_on CUR Strings[102]
#define newline CUR Strings[103]
#define pad_char CUR Strings[104]
#define parm_dch CUR Strings[105]
#define parm_delete_line CUR Strings[106]
#define parm_down_cursor CUR Strings[107]
#define parm_ich CUR Strings[108]
#define parm_index CUR Strings[109]
#define parm_insert_line CUR Strings[110]
#define parm_left_cursor CUR Strings[111]
#define parm_right_cursor CUR Strings[112]
#define parm_rindex CUR Strings[113]
#define parm_up_cursor CUR Strings[114]
#define pkey_key CUR Strings[115]
#define pkey_local CUR Strings[116]
#define pkey_xmit CUR Strings[117]
#define print_screen CUR Strings[118]
#define prtr_off CUR Strings[119]
#define prtr_on CUR Strings[120]
#define repeat_char CUR Strings[121]
#define reset_1string CUR Strings[122]
#define reset_2string CUR Strings[123]
#define reset_3string CUR Strings[124]
#define reset_file CUR Strings[125]
#define restore_cursor CUR Strings[126]
#define row_address CUR Strings[127]
#define save_cursor CUR Strings[128]
#define scroll_forward CUR Strings[129]
#define scroll_reverse CUR Strings[130]
#define set_attributes CUR Strings[131]
#define set_tab CUR Strings[132]
#define set_window CUR Strings[133]
#define tab CUR Strings[134]
#define to_status_line CUR Strings[135]
#define underline_char CUR Strings[136]
#define up_half_line CUR Strings[137]
#define init_prog CUR Strings[138]
#define key_a1 CUR Strings[139]
#define key_a3 CUR Strings[140]
#define key_b2 CUR Strings[141]
#define key_c1 CUR Strings[142]
#define key_c3 CUR Strings[143]
#define prtr_non CUR Strings[144]
#define char_padding CUR Strings[145]
#define acs_chars CUR Strings[146]
#define plab_norm CUR Strings[147]
#define key_btab CUR Strings[148]
#define enter_xon_mode CUR Strings[149]
#define exit_xon_mode CUR Strings[150]
#define enter_am_mode CUR Strings[151]
#define exit_am_mode CUR Strings[152]
#define xon_character CUR Strings[153]
#define xoff_character CUR Strings[154]
#define ena_acs CUR Strings[155]
#define label_on CUR Strings[156]
#define label_off CUR Strings[157]
#define key_beg CUR Strings[158]
#define key_cancel CUR Strings[159]
#define key_close CUR Strings[160]
#define key_command CUR Strings[161]
#define key_copy CUR Strings[162]
#define key_create CUR Strings[163]
#define key_end CUR Strings[164]
#define key_enter CUR Strings[165]
#define key_exit CUR Strings[166]
#define key_find CUR Strings[167]
#define key_help CUR Strings[168]
#define key_mark CUR Strings[169]
#define key_message CUR Strings[170]
#define key_move CUR Strings[171]
#define key_next CUR Strings[172]
#define key_open CUR Strings[173]
#define key_options CUR Strings[174]
#define key_previous CUR Strings[175]
#define key_print CUR Strings[176]
#define key_redo CUR Strings[177]
#define key_reference CUR Strings[178]
#define key_refresh CUR Strings[179]
#define key_replace CUR Strings[180]
#define key_restart CUR Strings[181]
#define key_resume CUR Strings[182]
#define key_save CUR Strings[183]
#define key_suspend CUR Strings[184]
#define key_undo CUR Strings[185]
#define key_sbeg CUR Strings[186]
#define key_scancel CUR Strings[187]
#define key_scommand CUR Strings[188]
#define key_scopy CUR Strings[189]
#define key_screate CUR Strings[190]
#define key_sdc CUR Strings[191]
#define key_sdl CUR Strings[192]
#define key_select CUR Strings[193]
#define key_send CUR Strings[194]
#define key_seol CUR Strings[195]
#define key_sexit CUR Strings[196]
#define key_sfind CUR Strings[197]
#define key_shelp CUR Strings[198]
#define key_shome CUR Strings[199]
#define key_sic CUR Strings[200]
#define key_sleft CUR Strings[201]
#define key_smessage CUR Strings[202]
#define key_smove CUR Strings[203]
#define key_snext CUR Strings[204]
#define key_soptions CUR Strings[205]
#define key_sprevious CUR Strings[206]
#define key_sprint CUR Strings[207]
#define key_sredo CUR Strings[208]
#define key_sreplace CUR Strings[209]
#define key_sright CUR Strings[210]
#define key_srsume CUR Strings[211]
#define key_ssave CUR Strings[212]
#define key_ssuspend CUR Strings[213]
#define key_sundo CUR Strings[214]
#define req_for_input CUR Strings[215]
#define key_f11 CUR Strings[216]
#define key_f12 CUR Strings[217]
#define key_f13 CUR Strings[218]
#define key_f14 CUR Strings[219]
#define key_f15 CUR Strings[220]
#define key_f16 CUR Strings[221]
#define key_f17 CUR Strings[222]
#define key_f18 CUR Strings[223]
#define key_f19 CUR Strings[224]
#define key_f20 CUR Strings[225]
#define key_f21 CUR Strings[226]
#define key_f22 CUR Strings[227]
#define key_f23 CUR Strings[228]
#define key_f24 CUR Strings[229]
#define key_f25 CUR Strings[230]
#define key_f26 CUR Strings[231]
#define key_f27 CUR Strings[232]
#define key_f28 CUR Strings[233]
#define key_f29 CUR Strings[234]
#define key_f30 CUR Strings[235]
#define key_f31 CUR Strings[236]
#define key_f32 CUR Strings[237]
#define key_f33 CUR Strings[238]
#define key_f34 CUR Strings[239]
#define key_f35 CUR Strings[240]
#define key_f36 CUR Strings[241]
#define key_f37 CUR Strings[242]
#define key_f38 CUR Strings[243]
#define key_f39 CUR Strings[244]
#define key_f40 CUR Strings[245]
#define key_f41 CUR Strings[246]
#define key_f42 CUR Strings[247]
#define key_f43 CUR Strings[248]
#define key_f44 CUR Strings[249]
#define key_f45 CUR Strings[250]
#define key_f46 CUR Strings[251]
#define key_f47 CUR Strings[252]
#define key_f48 CUR Strings[253]
#define key_f49 CUR Strings[254]
#define key_f50 CUR Strings[255]
#define key_f51 CUR Strings[256]
#define key_f52 CUR Strings[257]
#define key_f53 CUR Strings[258]
#define key_f54 CUR Strings[259]
#define key_f55 CUR Strings[260]
#define key_f56 CUR Strings[261]
#define key_f57 CUR Strings[262]
#define key_f58 CUR Strings[263]
#define key_f59 CUR Strings[264]
#define key_f60 CUR Strings[265]
#define key_f61 CUR Strings[266]
#define key_f62 CUR Strings[267]
#define key_f63 CUR Strings[268]
#define clr_bol CUR Strings[269]
#define clear_margins CUR Strings[270]
#define set_left_margin CUR Strings[271]
#define set_right_margin CUR Strings[272]
#define label_format CUR Strings[273]
#define set_clock CUR Strings[274]
#define display_clock CUR Strings[275]
#define remove_clock CUR Strings[276]
#define create_window CUR Strings[277]
#define goto_window CUR Strings[278]
#define hangup CUR Strings[279]
#define dial_phone CUR Strings[280]
#define quick_dial CUR Strings[281]
#define tone CUR Strings[282]
#define pulse CUR Strings[283]
#define flash_hook CUR Strings[284]
#define fixed_pause CUR Strings[285]
#define wait_tone CUR Strings[286]
#define user0 CUR Strings[287]
#define user1 CUR Strings[288]
#define user2 CUR Strings[289]
#define user3 CUR Strings[290]
#define user4 CUR Strings[291]
#define user5 CUR Strings[292]
#define user6 CUR Strings[293]
#define user7 CUR Strings[294]
#define user8 CUR Strings[295]
#define user9 CUR Strings[296]
#define orig_pair CUR Strings[297]
#define orig_colors CUR Strings[298]
#define initialize_color CUR Strings[299]
#define initialize_pair CUR Strings[300]
#define set_color_pair CUR Strings[301]
#define set_foreground CUR Strings[302]
#define set_background CUR Strings[303]
#define change_char_pitch CUR Strings[304]
#define change_line_pitch CUR Strings[305]
#define change_res_horz CUR Strings[306]
#define change_res_vert CUR Strings[307]
#define define_char CUR Strings[308]
#define enter_doublewide_mode CUR Strings[309]
#define enter_draft_quality CUR Strings[310]
#define enter_italics_mode CUR Strings[311]
#define enter_leftward_mode CUR Strings[312]
#define enter_micro_mode CUR Strings[313]
#define enter_near_letter_quality CUR Strings[314]
#define enter_normal_quality CUR Strings[315]
#define enter_shadow_mode CUR Strings[316]
#define enter_subscript_mode CUR Strings[317]
#define enter_superscript_mode CUR Strings[318]
#define enter_upward_mode CUR Strings[319]
#define exit_doublewide_mode CUR Strings[320]
#define exit_italics_mode CUR Strings[321]
#define exit_leftward_mode CUR Strings[322]
#define exit_micro_mode CUR Strings[323]
#define exit_shadow_mode CUR Strings[324]
#define exit_subscript_mode CUR Strings[325]
#define exit_superscript_mode CUR Strings[326]
#define exit_upward_mode CUR Strings[327]
#define micro_column_address CUR Strings[328]
#define micro_down CUR Strings[329]
#define micro_left CUR Strings[330]
#define micro_right CUR Strings[331]
#define micro_row_address CUR Strings[332]
#define micro_up CUR Strings[333]
#define order_of_pins CUR Strings[334]
#define parm_down_micro CUR Strings[335]
#define parm_left_micro CUR Strings[336]
#define parm_right_micro CUR Strings[337]
#define parm_up_micro CUR Strings[338]
#define select_char_set CUR Strings[339]
#define set_bottom_margin CUR Strings[340]
#define set_bottom_margin_parm CUR Strings[341]
#define set_left_margin_parm CUR Strings[342]
#define set_right_margin_parm CUR Strings[343]
#define set_top_margin CUR Strings[344]
#define set_top_margin_parm CUR Strings[345]
#define start_bit_image CUR Strings[346]
#define start_char_set_def CUR Strings[347]
#define stop_bit_image CUR Strings[348]
#define stop_char_set_def CUR Strings[349]
#define subscript_characters CUR Strings[350]
#define superscript_characters CUR Strings[351]
#define these_cause_cr CUR Strings[352]
#define zero_motion CUR Strings[353]
#define char_set_names CUR Strings[354]
#define key_mouse CUR Strings[355]
#define mouse_info CUR Strings[356]
#define req_mouse_pos CUR Strings[357]
#define get_mouse CUR Strings[358]
#define set_a_foreground CUR Strings[359]
#define set_a_background CUR Strings[360]
#define pkey_plab CUR Strings[361]
#define device_type CUR Strings[362]
#define code_set_init CUR Strings[363]
#define set0_des_seq CUR Strings[364]
#define set1_des_seq CUR Strings[365]
#define set2_des_seq CUR Strings[366]
#define set3_des_seq CUR Strings[367]
#define set_lr_margin CUR Strings[368]
#define set_tb_margin CUR Strings[369]
#define bit_image_repeat CUR Strings[370]
#define bit_image_newline CUR Strings[371]
#define bit_image_carriage_return CUR Strings[372]
#define color_names CUR Strings[373]
#define define_bit_image_region CUR Strings[374]
#define end_bit_image_region CUR Strings[375]
#define set_color_band CUR Strings[376]
#define set_page_length CUR Strings[377]
#define display_pc_char CUR Strings[378]
#define enter_pc_charset_mode CUR Strings[379]
#define exit_pc_charset_mode CUR Strings[380]
#define enter_scancode_mode CUR Strings[381]
#define exit_scancode_mode CUR Strings[382]
#define pc_term_options CUR Strings[383]
#define scancode_escape CUR Strings[384]
#define alt_scancode_esc CUR Strings[385]
#define enter_horizontal_hl_mode CUR Strings[386]
#define enter_left_hl_mode CUR Strings[387]
#define enter_low_hl_mode CUR Strings[388]
#define enter_right_hl_mode CUR Strings[389]
#define enter_top_hl_mode CUR Strings[390]
#define enter_vertical_hl_mode CUR Strings[391]
#define set_a_attributes CUR Strings[392]
#define set_pglen_inch CUR Strings[393]
#define BOOLWRITE 37
#define NUMWRITE 33
#define STRWRITE 394
/* older synonyms for some capabilities */
#define beehive_glitch no_esc_ctlc
#define teleray_glitch dest_tabs_magic_smso
#define micro_char_size micro_col_size
#ifdef __INTERNAL_CAPS_VISIBLE
#define termcap_init2 CUR Strings[394]
#define termcap_reset CUR Strings[395]
#define magic_cookie_glitch_ul CUR Numbers[33]
#define backspaces_with_bs CUR Booleans[37]
#define crt_no_scrolling CUR Booleans[38]
#define no_correctly_working_cr CUR Booleans[39]
#define carriage_return_delay CUR Numbers[34]
#define new_line_delay CUR Numbers[35]
#define linefeed_if_not_lf CUR Strings[396]
#define backspace_if_not_bs CUR Strings[397]
#define gnu_has_meta_key CUR Booleans[40]
#define linefeed_is_newline CUR Booleans[41]
#define backspace_delay CUR Numbers[36]
#define horizontal_tab_delay CUR Numbers[37]
#define number_of_function_keys CUR Numbers[38]
#define other_non_function_keys CUR Strings[398]
#define arrow_key_map CUR Strings[399]
#define has_hardware_tabs CUR Booleans[42]
#define return_does_clr_eol CUR Booleans[43]
#define acs_ulcorner CUR Strings[400]
#define acs_llcorner CUR Strings[401]
#define acs_urcorner CUR Strings[402]
#define acs_lrcorner CUR Strings[403]
#define acs_ltee CUR Strings[404]
#define acs_rtee CUR Strings[405]
#define acs_btee CUR Strings[406]
#define acs_ttee CUR Strings[407]
#define acs_hline CUR Strings[408]
#define acs_vline CUR Strings[409]
#define acs_plus CUR Strings[410]
#define memory_lock CUR Strings[411]
#define memory_unlock CUR Strings[412]
#define box_chars_1 CUR Strings[413]
#endif /* __INTERNAL_CAPS_VISIBLE */
/*
* Predefined terminfo array sizes
*/
#define BOOLCOUNT 44
#define NUMCOUNT 39
#define STRCOUNT 414
/* used by code for comparing entries */
#define acs_chars_index 146
typedef struct termtype { /* in-core form of terminfo data */
char *term_names; /* str_table offset of term names */
char *str_table; /* pointer to string table */
NCURSES_SBOOL *Booleans; /* array of boolean values */
short *Numbers; /* array of integer values */
char **Strings; /* array of string offsets */
#if NCURSES_XNAMES
char *ext_str_table; /* pointer to extended string table */
char **ext_Names; /* corresponding names */
unsigned short num_Booleans;/* count total Booleans */
unsigned short num_Numbers; /* count total Numbers */
unsigned short num_Strings; /* count total Strings */
unsigned short ext_Booleans;/* count extensions to Booleans */
unsigned short ext_Numbers; /* count extensions to Numbers */
unsigned short ext_Strings; /* count extensions to Strings */
#endif /* NCURSES_XNAMES */
} TERMTYPE;
/*
* The only reason these structures are visible is for read-only use.
* Programs which modify the data are not, never were, portable across
* curses implementations.
*/
#ifdef NCURSES_INTERNALS
typedef struct termtype2 { /* in-core form of terminfo data */
char *term_names; /* str_table offset of term names */
char *str_table; /* pointer to string table */
NCURSES_SBOOL *Booleans; /* array of boolean values */
int *Numbers; /* array of integer values */
char **Strings; /* array of string offsets */
#if NCURSES_XNAMES
char *ext_str_table; /* pointer to extended string table */
char **ext_Names; /* corresponding names */
unsigned short num_Booleans;/* count total Booleans */
unsigned short num_Numbers; /* count total Numbers */
unsigned short num_Strings; /* count total Strings */
unsigned short ext_Booleans;/* count extensions to Booleans */
unsigned short ext_Numbers; /* count extensions to Numbers */
unsigned short ext_Strings; /* count extensions to Strings */
#endif /* NCURSES_XNAMES */
} TERMTYPE2;
typedef struct term { /* describe an actual terminal */
TERMTYPE type; /* terminal type description */
short Filedes; /* file description being written to */
TTY Ottyb; /* original state of the terminal */
TTY Nttyb; /* current state of the terminal */
int _baudrate; /* used to compute padding */
char * _termname; /* used for termname() */
TERMTYPE2 type2; /* extended terminal type description */
} TERMINAL;
#else
typedef struct term TERMINAL;
#endif /* NCURSES_INTERNALS */
#if 0 && !0
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
#elif 0
NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);
#define cur_term NCURSES_PUBLIC_VAR(cur_term())
#else
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
#endif
#if 0 || 0
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);
#define boolnames NCURSES_PUBLIC_VAR(boolnames())
#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())
#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())
#define numnames NCURSES_PUBLIC_VAR(numnames())
#define numcodes NCURSES_PUBLIC_VAR(numcodes())
#define numfnames NCURSES_PUBLIC_VAR(numfnames())
#define strnames NCURSES_PUBLIC_VAR(strnames())
#define strcodes NCURSES_PUBLIC_VAR(strcodes())
#define strfnames NCURSES_PUBLIC_VAR(strfnames())
#else
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];
#endif
/*
* These entrypoints are used only by the ncurses utilities such as tic.
*/
#ifdef NCURSES_INTERNALS
extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);
extern NCURSES_EXPORT(int) _nc_read_entry2 (const char * const, char * const, TERMTYPE2 *const);
extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE2 *);
extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE2 *, char *, int);
extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);
extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);
#endif /* NCURSES_INTERNALS */
/*
* These entrypoints are used by tack.
*/
extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);
extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);
/* Normal entry points */
extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);
extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);
/* miscellaneous entry points */
extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);
extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);
/* terminfo entry points, also declared in curses.h */
#if !defined(__NCURSES_H)
extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);
extern NCURSES_EXPORT_VAR(char) ttytype[];
extern NCURSES_EXPORT(int) putp (const char *);
extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);
#if 1 /* NCURSES_TPARM_VARARGS */
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */
extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */
#endif
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */
#endif /* __NCURSES_H */
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
#if !defined(NCURSES_TERMCAP_H_incl)
extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
#endif /* NCURSES_TERMCAP_H_incl */
/*
* Include curses.h before term.h to enable these extensions.
*/
#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);
#if 1 /* NCURSES_TPARM_VARARGS */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */
#endif
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);
extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);
#endif /* NCURSES_SP_FUNCS */
#ifdef __cplusplus
}
#endif
#endif /* NCURSES_TERM_H_incl */
/****************************************************************************
* Copyright (c) 1998-2009,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Juergen Pfeifer 1996-1999,2008 *
****************************************************************************/
/* $Id: panel.h,v 1.12 2017/02/11 16:50:28 tom Exp $ */
/* panel.h -- interface file for panels library */
#ifndef NCURSES_PANEL_H_incl
#define NCURSES_PANEL_H_incl 1
#include <curses.h>
typedef struct panel
#if !NCURSES_OPAQUE_PANEL
{
WINDOW *win;
struct panel *below;
struct panel *above;
NCURSES_CONST void *user;
}
#endif /* !NCURSES_OPAQUE_PANEL */
PANEL;
#if defined(__cplusplus)
extern "C" {
#endif
extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *);
extern NCURSES_EXPORT(void) update_panels (void);
extern NCURSES_EXPORT(int) hide_panel (PANEL *);
extern NCURSES_EXPORT(int) show_panel (PANEL *);
extern NCURSES_EXPORT(int) del_panel (PANEL *);
extern NCURSES_EXPORT(int) top_panel (PANEL *);
extern NCURSES_EXPORT(int) bottom_panel (PANEL *);
extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *);
extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *);
extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *);
extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *);
extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int);
extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *);
extern NCURSES_EXPORT(int) panel_hidden (const PANEL *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *);
extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*);
#endif
#if defined(__cplusplus)
}
#endif
#endif /* NCURSES_PANEL_H_incl */
/* end of panel.h */
/****************************************************************************
* Copyright (c) 1998-2000,2001 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
/* $Id: termcap.h.in,v 1.17 2001/03/24 21:53:27 tom Exp $ */
#ifndef NCURSES_TERMCAP_H_incl
#define NCURSES_TERMCAP_H_incl 1
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.1"
#include <ncurses_dll.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <sys/types.h>
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_OSPEED
#define NCURSES_OSPEED unsigned
extern NCURSES_EXPORT_VAR(char) PC;
extern NCURSES_EXPORT_VAR(char *) UP;
extern NCURSES_EXPORT_VAR(char *) BC;
extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed;
#if !defined(NCURSES_TERM_H_incl)
extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
#endif
#ifdef __cplusplus
}
#endif
#endif /* NCURSES_TERMCAP_H_incl */
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
#ifndef NCURSES_CURSESP_H_incl
#define NCURSES_CURSESP_H_incl 1
// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $
#include <cursesw.h>
extern "C" {
# include <panel.h>
}
class NCURSES_IMPEXP NCursesPanel
: public NCursesWindow
{
protected:
PANEL *p;
static NCursesPanel *dummy;
private:
// This structure is used for the panel's user data field to link the
// PANEL* to the C++ object and to provide extra space for a user pointer.
typedef struct {
void* m_user; // the pointer for the user's data
const NCursesPanel* m_back; // backward pointer to C++ object
const PANEL* m_owner; // the panel itself
} UserHook;
inline UserHook *UserPointer()
{
UserHook* uptr = reinterpret_cast<UserHook*>(
const_cast<void *>(::panel_userptr (p)));
return uptr;
}
void init(); // Initialize the panel object
protected:
void set_user(void *user)
{
UserHook* uptr = UserPointer();
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) {
uptr->m_user = user;
}
}
// Set the user pointer of the panel.
void *get_user()
{
UserHook* uptr = UserPointer();
void *result = 0;
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p)
result = uptr->m_user;
return result;
}
void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
{
if (err==ERR)
THROW(new NCursesPanelException (this, err));
}
// If err is equal to the curses error indicator ERR, an error handler
// is called.
// Get a keystroke. Default implementation calls getch()
virtual int getKey(void);
public:
NCursesPanel(int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0)
: NCursesWindow(nlines,ncols,begin_y,begin_x), p(0)
{
init();
}
// Create a panel with this size starting at the requested position.
NCursesPanel()
: NCursesWindow(::stdscr), p(0)
{
init();
}
// This constructor creates the default Panel associated with the
// ::stdscr window
NCursesPanel& operator=(const NCursesPanel& rhs)
{
if (this != &rhs) {
*this = rhs;
NCursesWindow::operator=(rhs);
}
return *this;
}
NCursesPanel(const NCursesPanel& rhs)
: NCursesWindow(rhs),
p(rhs.p)
{
}
virtual ~NCursesPanel();
// basic manipulation
inline void hide()
{
OnError (::hide_panel(p));
}
// Hide the panel. It stays in the stack but becomes invisible.
inline void show()
{
OnError (::show_panel(p));
}
// Show the panel, i.e. make it visible.
inline void top()
{
OnError (::top_panel(p));
}
// Make this panel the top panel in the stack.
inline void bottom()
{
OnError (::bottom_panel(p));
}
// Make this panel the bottom panel in the stack.
// N.B.: The panel associated with ::stdscr is always on the bottom. So
// actually bottom() makes the panel the first above ::stdscr.
virtual int mvwin(int y, int x)
{
OnError(::move_panel(p, y, x));
return OK;
}
inline bool hidden() const
{
return (::panel_hidden (p) ? TRUE : FALSE);
}
// Return TRUE if the panel is hidden, FALSE otherwise.
/* The functions panel_above() and panel_below() are not reflected in
the NCursesPanel class. The reason for this is, that we cannot
assume that a panel retrieved by those operations is one wrapped
by a C++ class. Although this situation might be handled, we also
need a reverse mapping from PANEL to NCursesPanel which needs some
redesign of the low level stuff. At the moment, we define them in the
interface but they will always produce an error. */
inline NCursesPanel& above() const
{
OnError(ERR);
return *dummy;
}
inline NCursesPanel& below() const
{
OnError(ERR);
return *dummy;
}
// Those two are rewrites of the corresponding virtual members of
// NCursesWindow
virtual int refresh();
// Propagate all panel changes to the virtual screen and update the
// physical screen.
virtual int noutrefresh();
// Propagate all panel changes to the virtual screen.
static void redraw();
// Redraw all panels.
// decorations
virtual void frame(const char* title=NULL,
const char* btitle=NULL);
// Put a frame around the panel and put the title centered in the top line
// and btitle in the bottom line.
virtual void boldframe(const char* title=NULL,
const char* btitle=NULL);
// Same as frame(), but use highlighted attributes.
virtual void label(const char* topLabel,
const char* bottomLabel);
// Put the title centered in the top line and btitle in the bottom line.
virtual void centertext(int row,const char* label);
// Put the label text centered in the specified row.
};
/* We use templates to provide a typesafe mechanism to associate
* user data with a panel. A NCursesUserPanel<T> is a panel
* associated with some user data of type T.
*/
template<class T> class NCursesUserPanel : public NCursesPanel
{
public:
NCursesUserPanel (int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0))
: NCursesPanel (nlines, ncols, begin_y, begin_x)
{
if (p)
set_user (const_cast<void *>(reinterpret_cast<const void*>
(p_UserData)));
};
// This creates an user panel of the requested size with associated
// user data pointed to by p_UserData.
NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
{
if (p)
set_user(const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
};
// This creates an user panel associated with the ::stdscr and user data
// pointed to by p_UserData.
virtual ~NCursesUserPanel() {};
T* UserData (void)
{
return reinterpret_cast<T*>(get_user ());
};
// Retrieve the user data associated with the panel.
virtual void setUserData (const T* p_UserData)
{
if (p)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
}
// Associate the user panel with the user data pointed to by p_UserData.
};
#endif /* NCURSES_CURSESP_H_incl */
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: cursesm.h,v 1.30 2014/08/09 22:06:18 Adam.Jiang Exp $
#ifndef NCURSES_CURSESM_H_incl
#define NCURSES_CURSESM_H_incl 1
#include <cursesp.h>
extern "C" {
# include <menu.h>
}
//
// -------------------------------------------------------------------------
// This wraps the ITEM type of <menu.h>
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP NCursesMenuItem
{
friend class NCursesMenu;
protected:
ITEM *item;
inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
if (err != E_OK)
THROW(new NCursesMenuException (err));
}
public:
NCursesMenuItem (const char* p_name = NULL,
const char* p_descript = NULL)
: item(0)
{
item = p_name ? ::new_item (p_name, p_descript) : STATIC_CAST(ITEM*)(0);
if (p_name && !item)
OnError (E_SYSTEM_ERROR);
}
// Create an item. If you pass both parameters as NULL, a delimiting
// item is constructed which can be used to terminate a list of
// NCursesMenu objects.
NCursesMenuItem& operator=(const NCursesMenuItem& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
NCursesMenuItem(const NCursesMenuItem& rhs)
: item(0)
{
(void) rhs;
}
virtual ~NCursesMenuItem ();
// Release the items memory
inline const char* name () const {
return ::item_name (item);
}
// Name of the item
inline const char* description () const {
return ::item_description (item);
}
// Description of the item
inline int (index) (void) const {
return ::item_index (item);
}
// Index of the item in an item array (or -1)
inline void options_on (Item_Options opts) {
OnError (::item_opts_on (item, opts));
}
// Switch on the items options
inline void options_off (Item_Options opts) {
OnError (::item_opts_off (item, opts));
}
// Switch off the item's option
inline Item_Options options () const {
return ::item_opts (item);
}
// Retrieve the items options
inline void set_options (Item_Options opts) {
OnError (::set_item_opts (item, opts));
}
// Set the items options
inline void set_value (bool f) {
OnError (::set_item_value (item,f));
}
// Set/Reset the items selection state
inline bool value () const {
return ::item_value (item);
}
// Retrieve the items selection state
inline bool visible () const {
return ::item_visible (item);
}
// Retrieve visibility of the item
virtual bool action();
// Perform an action associated with this item; you may use this in an
// user supplied driver for a menu; you may derive from this class and
// overload action() to supply items with different actions.
// If an action returns true, the menu will be exited. The default action
// is to do nothing.
};
// Prototype for an items callback function.
typedef bool ITEMCALLBACK(NCursesMenuItem&);
// If you don't like to create a child class for individual items to
// overload action(), you may use this class and provide a callback
// function pointer for items.
class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
{
private:
ITEMCALLBACK* p_fct;
public:
NCursesMenuCallbackItem(ITEMCALLBACK* fct = NULL,
const char* p_name = NULL,
const char* p_descript = NULL )
: NCursesMenuItem (p_name, p_descript),
p_fct (fct) {
}
NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs)
: NCursesMenuItem(rhs),
p_fct(0)
{
}
virtual ~NCursesMenuCallbackItem();
bool action();
};
// This are the built-in hook functions in this C++ binding. In C++ we use
// virtual member functions (see below On_..._Init and On_..._Termination)
// to provide this functionality in an object oriented manner.
extern "C" {
void _nc_xx_mnu_init(MENU *);
void _nc_xx_mnu_term(MENU *);
void _nc_xx_itm_init(MENU *);
void _nc_xx_itm_term(MENU *);
}
//
// -------------------------------------------------------------------------
// This wraps the MENU type of <menu.h>
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP NCursesMenu : public NCursesPanel
{
protected:
MENU *menu;
private:
NCursesWindow* sub; // the subwindow object
bool b_sub_owner; // is this our own subwindow?
bool b_framed; // has the menu a border?
bool b_autoDelete; // Delete items when deleting menu?
NCursesMenuItem** my_items; // The array of items for this menu
// This structure is used for the menu's user data field to link the
// MENU* to the C++ object and to provide extra space for a user pointer.
typedef struct {
void* m_user; // the pointer for the user's data
const NCursesMenu* m_back; // backward pointer to C++ object
const MENU* m_owner;
} UserHook;
// Get the backward pointer to the C++ object from a MENU
static inline NCursesMenu* getHook(const MENU *m) {
UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m));
assert(hook != 0 && hook->m_owner==m);
return const_cast<NCursesMenu*>(hook->m_back);
}
friend void _nc_xx_mnu_init(MENU *);
friend void _nc_xx_mnu_term(MENU *);
friend void _nc_xx_itm_init(MENU *);
friend void _nc_xx_itm_term(MENU *);
// Calculate ITEM* array for the menu
ITEM** mapItems(NCursesMenuItem* nitems[]);
protected:
// internal routines
inline void set_user(void *user) {
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu));
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu);
uptr->m_user = user;
}
inline void *get_user() {
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu));
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu);
return uptr->m_user;
}
void InitMenu (NCursesMenuItem* menu[],
bool with_frame,
bool autoDeleteItems);
inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
if (err != E_OK)
THROW(new NCursesMenuException (this, err));
}
// this wraps the menu_driver call.
virtual int driver (int c) ;
// 'Internal' constructor to create a menu without association to
// an array of items.
NCursesMenu( int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0)
: NCursesPanel(nlines,ncols,begin_y,begin_x),
menu (STATIC_CAST(MENU*)(0)),
sub(0),
b_sub_owner(0),
b_framed(0),
b_autoDelete(0),
my_items(0)
{
}
public:
// Make a full window size menu
NCursesMenu (NCursesMenuItem* Items[],
bool with_frame=FALSE, // Reserve space for a frame?
bool autoDelete_Items=FALSE) // Autocleanup of Items?
: NCursesPanel(),
menu(0),
sub(0),
b_sub_owner(0),
b_framed(0),
b_autoDelete(0),
my_items(0)
{
InitMenu(Items, with_frame, autoDelete_Items);
}
// Make a menu with a window of this size.
NCursesMenu (NCursesMenuItem* Items[],
int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0,
bool with_frame=FALSE, // Reserve space for a frame?
bool autoDelete_Items=FALSE) // Autocleanup of Items?
: NCursesPanel(nlines, ncols, begin_y, begin_x),
menu(0),
sub(0),
b_sub_owner(0),
b_framed(0),
b_autoDelete(0),
my_items(0)
{
InitMenu(Items, with_frame, autoDelete_Items);
}
NCursesMenu& operator=(const NCursesMenu& rhs)
{
if (this != &rhs) {
*this = rhs;
NCursesPanel::operator=(rhs);
}
return *this;
}
NCursesMenu(const NCursesMenu& rhs)
: NCursesPanel(rhs),
menu(rhs.menu),
sub(rhs.sub),
b_sub_owner(rhs.b_sub_owner),
b_framed(rhs.b_framed),
b_autoDelete(rhs.b_autoDelete),
my_items(rhs.my_items)
{
}
virtual ~NCursesMenu ();
// Retrieve the menus subwindow
inline NCursesWindow& subWindow() const {
assert(sub!=NULL);
return *sub;
}
// Set the menus subwindow
void setSubWindow(NCursesWindow& sub);
// Set these items for the menu
inline void setItems(NCursesMenuItem* Items[]) {
OnError(::set_menu_items(menu,mapItems(Items)));
}
// Remove the menu from the screen
inline void unpost (void) {
OnError (::unpost_menu (menu));
}
// Post the menu to the screen if flag is true, unpost it otherwise
inline void post(bool flag = TRUE) {
flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu));
}
// Get the numer of rows and columns for this menu
inline void scale (int& mrows, int& mcols) const {
OnError (::scale_menu (menu, &mrows, &mcols));
}
// Set the format of this menu
inline void set_format(int mrows, int mcols) {
OnError (::set_menu_format(menu, mrows, mcols));
}
// Get the format of this menu
inline void menu_format(int& rows,int& ncols) {
::menu_format(menu,&rows,&ncols);
}
// Items of the menu
inline NCursesMenuItem* items() const {
return *my_items;
}
// Get the number of items in this menu
inline int count() const {
return ::item_count(menu);
}
// Get the current item (i.e. the one the cursor is located)
inline NCursesMenuItem* current_item() const {
return my_items[::item_index(::current_item(menu))];
}
// Get the marker string
inline const char* mark() const {
return ::menu_mark(menu);
}
// Set the marker string
inline void set_mark(const char *marker) {
OnError (::set_menu_mark (menu, marker));
}
// Get the name of the request code c
inline static const char* request_name(int c) {
return ::menu_request_name(c);
}
// Get the current pattern
inline char* pattern() const {
return ::menu_pattern(menu);
}
// true if there is a pattern match, false otherwise.
bool set_pattern (const char *pat);
// set the default attributes for the menu
// i.e. set fore, back and grey attribute
virtual void setDefaultAttributes();
// Get the menus background attributes
inline chtype back() const {
return ::menu_back(menu);
}
// Get the menus foreground attributes
inline chtype fore() const {
return ::menu_fore(menu);
}
// Get the menus grey attributes (used for unselectable items)
inline chtype grey() const {
return ::menu_grey(menu);
}
// Set the menus background attributes
inline chtype set_background(chtype a) {
return ::set_menu_back(menu,a);
}
// Set the menus foreground attributes
inline chtype set_foreground(chtype a) {
return ::set_menu_fore(menu,a);
}
// Set the menus grey attributes (used for unselectable items)
inline chtype set_grey(chtype a) {
return ::set_menu_grey(menu,a);
}
inline void options_on (Menu_Options opts) {
OnError (::menu_opts_on (menu,opts));
}
inline void options_off(Menu_Options opts) {
OnError (::menu_opts_off(menu,opts));
}
inline Menu_Options options() const {
return ::menu_opts(menu);
}
inline void set_options (Menu_Options opts) {
OnError (::set_menu_opts (menu,opts));
}
inline int pad() const {
return ::menu_pad(menu);
}
inline void set_pad (int padch) {
OnError (::set_menu_pad (menu, padch));
}
// Position the cursor to the current item
inline void position_cursor () const {
OnError (::pos_menu_cursor (menu));
}
// Set the current item
inline void set_current(NCursesMenuItem& I) {
OnError (::set_current_item(menu, I.item));
}
// Get the current top row of the menu
inline int top_row (void) const {
return ::top_row (menu);
}
// Set the current top row of the menu
inline void set_top_row (int row) {
OnError (::set_top_row (menu, row));
}
// spacing control
// Set the spacing for the menu
inline void setSpacing(int spc_description,
int spc_rows,
int spc_columns) {
OnError(::set_menu_spacing(menu,
spc_description,
spc_rows,
spc_columns));
}
// Get the spacing info for the menu
inline void Spacing(int& spc_description,
int& spc_rows,
int& spc_columns) const {
OnError(::menu_spacing(menu,
&spc_description,
&spc_rows,
&spc_columns));
}
// Decorations
inline void frame(const char *title=NULL, const char* btitle=NULL) {
if (b_framed)
NCursesPanel::frame(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
inline void boldframe(const char *title=NULL, const char* btitle=NULL) {
if (b_framed)
NCursesPanel::boldframe(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
inline void label(const char *topLabel, const char *bottomLabel) {
if (b_framed)
NCursesPanel::label(topLabel,bottomLabel);
else
OnError(E_SYSTEM_ERROR);
}
// -----
// Hooks
// -----
// Called after the menu gets repositioned in its window.
// This is especially true if the menu is posted.
virtual void On_Menu_Init();
// Called before the menu gets repositioned in its window.
// This is especially true if the menu is unposted.
virtual void On_Menu_Termination();
// Called after the item became the current item
virtual void On_Item_Init(NCursesMenuItem& item);
// Called before this item is left as current item.
virtual void On_Item_Termination(NCursesMenuItem& item);
// Provide a default key virtualization. Translate the keyboard
// code c into a menu request code.
// The default implementation provides a hopefully straightforward
// mapping for the most common keystrokes and menu requests.
virtual int virtualize(int c);
// Operators
inline NCursesMenuItem* operator[](int i) const {
if ( (i < 0) || (i >= ::item_count (menu)) )
OnError (E_BAD_ARGUMENT);
return (my_items[i]);
}
// Perform the menu's operation
// Return the item where you left the selection mark for a single
// selection menu, or NULL for a multivalued menu.
virtual NCursesMenuItem* operator()(void);
// --------------------
// Exception handlers
// Called by operator()
// --------------------
// Called if the request is denied
virtual void On_Request_Denied(int c) const;
// Called if the item is not selectable
virtual void On_Not_Selectable(int c) const;
// Called if pattern doesn't match
virtual void On_No_Match(int c) const;
// Called if the command is unknown
virtual void On_Unknown_Command(int c) const;
};
//
// -------------------------------------------------------------------------
// This is the typical C++ typesafe way to allow to attach
// user data to an item of a menu. Its assumed that the user
// data belongs to some class T. Use T as template argument
// to create a UserItem.
// -------------------------------------------------------------------------
//
template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem
{
public:
NCursesUserItem (const char* p_name,
const char* p_descript = NULL,
const T* p_UserData = STATIC_CAST(T*)(0))
: NCursesMenuItem (p_name, p_descript) {
if (item)
OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void*>(p_UserData))));
}
virtual ~NCursesUserItem() {}
inline const T* UserData (void) const {
return reinterpret_cast<const T*>(::item_userptr (item));
};
inline virtual void setUserData(const T* p_UserData) {
if (item)
OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void *>(p_UserData))));
}
};
//
// -------------------------------------------------------------------------
// The same mechanism is used to attach user data to a menu
// -------------------------------------------------------------------------
//
template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu
{
protected:
NCursesUserMenu( int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0))
: NCursesMenu(nlines,ncols,begin_y,begin_x) {
if (menu)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
}
public:
NCursesUserMenu (NCursesMenuItem* Items[],
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Items=FALSE)
: NCursesMenu (Items, with_frame, autoDelete_Items) {
if (menu)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
};
NCursesUserMenu (NCursesMenuItem* Items[],
int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE)
: NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) {
if (menu)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
};
virtual ~NCursesUserMenu() {
};
inline T* UserData (void) {
return reinterpret_cast<T*>(get_user ());
};
inline virtual void setUserData (const T* p_UserData) {
if (menu)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
}
};
#endif /* NCURSES_CURSESM_H_incl */
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: cursesf.h,v 1.32 2014/08/09 22:06:11 Adam.Jiang Exp $
#ifndef NCURSES_CURSESF_H_incl
#define NCURSES_CURSESF_H_incl 1
#include <cursesp.h>
#ifndef __EXT_QNX
#include <string.h>
#endif
extern "C" {
# include <form.h>
}
//
// -------------------------------------------------------------------------
// The abstract base class for buitin and user defined Fieldtypes.
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP NCursesFormField; // forward declaration
// Class to represent builtin field types as well as C++ written new
// fieldtypes (see classes UserDefineFieldType...
class NCURSES_IMPEXP NCursesFieldType
{
friend class NCursesFormField;
protected:
FIELDTYPE* fieldtype;
inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) {
if (err!=E_OK)
THROW(new NCursesFormException (err));
}
NCursesFieldType(FIELDTYPE *f) : fieldtype(f) {
}
virtual ~NCursesFieldType() {}
// Set the fields f fieldtype to this one.
virtual void set(NCursesFormField& f) = 0;
public:
NCursesFieldType()
: fieldtype(STATIC_CAST(FIELDTYPE*)(0))
{
}
NCursesFieldType& operator=(const NCursesFieldType& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
NCursesFieldType(const NCursesFieldType& rhs)
: fieldtype(rhs.fieldtype)
{
}
};
//
// -------------------------------------------------------------------------
// The class representing a forms field, wrapping the lowlevel FIELD struct
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP NCursesFormField
{
friend class NCursesForm;
protected:
FIELD *field; // lowlevel structure
NCursesFieldType* ftype; // Associated field type
// Error handler
inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
if (err != E_OK)
THROW(new NCursesFormException (err));
}
public:
// Create a 'Null' field. Can be used to delimit a field list
NCursesFormField()
: field(STATIC_CAST(FIELD*)(0)),
ftype(STATIC_CAST(NCursesFieldType*)(0))
{
}
// Create a new field
NCursesFormField (int rows,
int ncols,
int first_row = 0,
int first_col = 0,
int offscreen_rows = 0,
int additional_buffers = 0)
: field(0),
ftype(STATIC_CAST(NCursesFieldType*)(0))
{
field = ::new_field(rows, ncols, first_row, first_col,
offscreen_rows, additional_buffers);
if (!field)
OnError(errno);
}
NCursesFormField& operator=(const NCursesFormField& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
NCursesFormField(const NCursesFormField& rhs)
: field(rhs.field), ftype(rhs.ftype)
{
}
virtual ~NCursesFormField ();
// Duplicate the field at a new position
inline NCursesFormField* dup(int first_row, int first_col)
{
NCursesFormField* f = new NCursesFormField();
if (!f)
OnError(E_SYSTEM_ERROR);
else {
f->ftype = ftype;
f->field = ::dup_field(field,first_row,first_col);
if (!f->field)
OnError(errno);
}
return f;
}
// Link the field to a new location
inline NCursesFormField* link(int first_row, int first_col) {
NCursesFormField* f = new NCursesFormField();
if (!f)
OnError(E_SYSTEM_ERROR);
else {
f->ftype = ftype;
f->field = ::link_field(field,first_row,first_col);
if (!f->field)
OnError(errno);
}
return f;
}
// Get the lowlevel field representation
inline FIELD* get_field() const {
return field;
}
// Retrieve info about the field
inline void info(int& rows, int& ncols,
int& first_row, int& first_col,
int& offscreen_rows, int& additional_buffers) const {
OnError(::field_info(field, &rows, &ncols,
&first_row, &first_col,
&offscreen_rows, &additional_buffers));
}
// Retrieve info about the fields dynamic properties.
inline void dynamic_info(int& dynamic_rows, int& dynamic_cols,
int& max_growth) const {
OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols,
&max_growth));
}
// For a dynamic field you may set the maximum growth limit.
// A zero means unlimited growth.
inline void set_maximum_growth(int growth = 0) {
OnError(::set_max_field(field,growth));
}
// Move the field to a new position
inline void move(int row, int col) {
OnError(::move_field(field,row,col));
}
// Mark the field to start a new page
inline void new_page(bool pageFlag = FALSE) {
OnError(::set_new_page(field,pageFlag));
}
// Retrieve whether or not the field starts a new page.
inline bool is_new_page() const {
return ::new_page(field);
}
// Set the justification for the field
inline void set_justification(int just) {
OnError(::set_field_just(field,just));
}
// Retrieve the fields justification
inline int justification() const {
return ::field_just(field);
}
// Set the foreground attribute for the field
inline void set_foreground(chtype foreground) {
OnError(::set_field_fore(field,foreground));
}
// Retrieve the fields foreground attribute
inline chtype fore() const {
return ::field_fore(field);
}
// Set the background attribute for the field
inline void set_background(chtype background) {
OnError(::set_field_back(field,background));
}
// Retrieve the fields background attribute
inline chtype back() const {
return ::field_back(field);
}
// Set the padding character for the field
inline void set_pad_character(int padding) {
OnError(::set_field_pad(field, padding));
}
// Retrieve the fields padding character
inline int pad() const {
return ::field_pad(field);
}
// Switch on the fields options
inline void options_on (Field_Options opts) {
OnError (::field_opts_on (field, opts));
}
// Switch off the fields options
inline void options_off (Field_Options opts) {
OnError (::field_opts_off (field, opts));
}
// Retrieve the fields options
inline Field_Options options () const {
return ::field_opts (field);
}
// Set the fields options
inline void set_options (Field_Options opts) {
OnError (::set_field_opts (field, opts));
}
// Mark the field as changed
inline void set_changed(bool changeFlag = TRUE) {
OnError(::set_field_status(field,changeFlag));
}
// Test whether or not the field is marked as changed
inline bool changed() const {
return ::field_status(field);
}
// Return the index of the field in the field array of a form
// or -1 if the field is not associated to a form
inline int (index)() const {
return ::field_index(field);
}
// Store a value in a fields buffer. The default buffer is nr. 0
inline void set_value(const char *val, int buffer = 0) {
OnError(::set_field_buffer(field,buffer,val));
}
// Retrieve the value of a fields buffer. The default buffer is nr. 0
inline char* value(int buffer = 0) const {
return ::field_buffer(field,buffer);
}
// Set the validation type of the field.
inline void set_fieldtype(NCursesFieldType& f) {
ftype = &f;
f.set(*this); // A good friend may do that...
}
// Retrieve the validation type of the field.
inline NCursesFieldType* fieldtype() const {
return ftype;
}
};
// This are the built-in hook functions in this C++ binding. In C++ we use
// virtual member functions (see below On_..._Init and On_..._Termination)
// to provide this functionality in an object oriented manner.
extern "C" {
void _nc_xx_frm_init(FORM *);
void _nc_xx_frm_term(FORM *);
void _nc_xx_fld_init(FORM *);
void _nc_xx_fld_term(FORM *);
}
//
// -------------------------------------------------------------------------
// The class representing a form, wrapping the lowlevel FORM struct
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP NCursesForm : public NCursesPanel
{
protected:
FORM* form; // the lowlevel structure
private:
NCursesWindow* sub; // the subwindow object
bool b_sub_owner; // is this our own subwindow?
bool b_framed; // has the form a border?
bool b_autoDelete; // Delete fields when deleting form?
NCursesFormField** my_fields; // The array of fields for this form
// This structure is used for the form's user data field to link the
// FORM* to the C++ object and to provide extra space for a user pointer.
typedef struct {
void* m_user; // the pointer for the user's data
const NCursesForm* m_back; // backward pointer to C++ object
const FORM* m_owner;
} UserHook;
// Get the backward pointer to the C++ object from a FORM
static inline NCursesForm* getHook(const FORM *f) {
UserHook* hook = reinterpret_cast<UserHook*>(::form_userptr(f));
assert(hook != 0 && hook->m_owner==f);
return const_cast<NCursesForm*>(hook->m_back);
}
friend void _nc_xx_frm_init(FORM *);
friend void _nc_xx_frm_term(FORM *);
friend void _nc_xx_fld_init(FORM *);
friend void _nc_xx_fld_term(FORM *);
// Calculate FIELD* array for the menu
FIELD** mapFields(NCursesFormField* nfields[]);
protected:
// internal routines
inline void set_user(void *user) {
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form));
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form);
uptr->m_user = user;
}
inline void *get_user() {
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form));
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form);
return uptr->m_user;
}
void InitForm (NCursesFormField* Fields[],
bool with_frame,
bool autoDeleteFields);
inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
if (err != E_OK)
THROW(new NCursesFormException (err));
}
// this wraps the form_driver call.
virtual int driver (int c) ;
// 'Internal' constructor, builds an object without association to a
// field array.
NCursesForm( int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0)
: NCursesPanel(nlines, ncols, begin_y, begin_x),
form (STATIC_CAST(FORM*)(0)),
sub(0),
b_sub_owner(0),
b_framed(0),
b_autoDelete(0),
my_fields(0)
{
}
public:
// Create form for the default panel.
NCursesForm (NCursesFormField* Fields[],
bool with_frame=FALSE, // reserve space for a frame?
bool autoDelete_Fields=FALSE) // do automatic cleanup?
: NCursesPanel(),
form(0),
sub(0),
b_sub_owner(0),
b_framed(0),
b_autoDelete(0),
my_fields(0)
{
InitForm(Fields, with_frame, autoDelete_Fields);
}
// Create a form in a panel with the given position and size.
NCursesForm (NCursesFormField* Fields[],
int nlines,
int ncols,
int begin_y,
int begin_x,
bool with_frame=FALSE, // reserve space for a frame?
bool autoDelete_Fields=FALSE) // do automatic cleanup?
: NCursesPanel(nlines, ncols, begin_y, begin_x),
form(0),
sub(0),
b_sub_owner(0),
b_framed(0),
b_autoDelete(0),
my_fields(0)
{
InitForm(Fields, with_frame, autoDelete_Fields);
}
NCursesForm& operator=(const NCursesForm& rhs)
{
if (this != &rhs) {
*this = rhs;
NCursesPanel::operator=(rhs);
}
return *this;
}
NCursesForm(const NCursesForm& rhs)
: NCursesPanel(rhs),
form(rhs.form),
sub(rhs.sub),
b_sub_owner(rhs.b_sub_owner),
b_framed(rhs.b_framed),
b_autoDelete(rhs.b_autoDelete),
my_fields(rhs.my_fields)
{
}
virtual ~NCursesForm();
// Set the default attributes for the form
virtual void setDefaultAttributes();
// Retrieve current field of the form.
inline NCursesFormField* current_field() const {
return my_fields[::field_index(::current_field(form))];
}
// Set the forms subwindow
void setSubWindow(NCursesWindow& sub);
// Set these fields for the form
inline void setFields(NCursesFormField* Fields[]) {
OnError(::set_form_fields(form,mapFields(Fields)));
}
// Remove the form from the screen
inline void unpost (void) {
OnError (::unpost_form (form));
}
// Post the form to the screen if flag is true, unpost it otherwise
inline void post(bool flag = TRUE) {
OnError (flag ? ::post_form(form) : ::unpost_form (form));
}
// Decorations
inline void frame(const char *title=NULL, const char* btitle=NULL) {
if (b_framed)
NCursesPanel::frame(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
inline void boldframe(const char *title=NULL, const char* btitle=NULL) {
if (b_framed)
NCursesPanel::boldframe(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
inline void label(const char *topLabel, const char *bottomLabel) {
if (b_framed)
NCursesPanel::label(topLabel,bottomLabel);
else
OnError(E_SYSTEM_ERROR);
}
// -----
// Hooks
// -----
// Called after the form gets repositioned in its window.
// This is especially true if the form is posted.
virtual void On_Form_Init();
// Called before the form gets repositioned in its window.
// This is especially true if the form is unposted.
virtual void On_Form_Termination();
// Called after the field became the current field
virtual void On_Field_Init(NCursesFormField& field);
// Called before this field is left as current field.
virtual void On_Field_Termination(NCursesFormField& field);
// Calculate required window size for the form.
void scale(int& rows, int& ncols) const {
OnError(::scale_form(form,&rows,&ncols));
}
// Retrieve number of fields in the form.
int count() const {
return ::field_count(form);
}
// Make the page the current page of the form.
void set_page(int pageNum) {
OnError(::set_form_page(form, pageNum));
}
// Retrieve current page number
int page() const {
return ::form_page(form);
}
// Switch on the forms options
inline void options_on (Form_Options opts) {
OnError (::form_opts_on (form, opts));
}
// Switch off the forms options
inline void options_off (Form_Options opts) {
OnError (::form_opts_off (form, opts));
}
// Retrieve the forms options
inline Form_Options options () const {
return ::form_opts (form);
}
// Set the forms options
inline void set_options (Form_Options opts) {
OnError (::set_form_opts (form, opts));
}
// Are there more data in the current field after the data shown
inline bool data_ahead() const {
return ::data_ahead(form);
}
// Are there more data in the current field before the data shown
inline bool data_behind() const {
return ::data_behind(form);
}
// Position the cursor to the current field
inline void position_cursor () {
OnError (::pos_form_cursor (form));
}
// Set the current field
inline void set_current(NCursesFormField& F) {
OnError (::set_current_field(form, F.field));
}
// Provide a default key virtualization. Translate the keyboard
// code c into a form request code.
// The default implementation provides a hopefully straightforward
// mapping for the most common keystrokes and form requests.
virtual int virtualize(int c);
// Operators
inline NCursesFormField* operator[](int i) const {
if ( (i < 0) || (i >= ::field_count (form)) )
OnError (E_BAD_ARGUMENT);
return my_fields[i];
}
// Perform the menu's operation
// Return the field where you left the form.
virtual NCursesFormField* operator()(void);
// Exception handlers. The default is a Beep.
virtual void On_Request_Denied(int c) const;
virtual void On_Invalid_Field(int c) const;
virtual void On_Unknown_Command(int c) const;
};
//
// -------------------------------------------------------------------------
// This is the typical C++ typesafe way to allow to attach
// user data to a field of a form. Its assumed that the user
// data belongs to some class T. Use T as template argument
// to create a UserField.
// -------------------------------------------------------------------------
template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField
{
public:
NCursesUserField (int rows,
int ncols,
int first_row = 0,
int first_col = 0,
const T* p_UserData = STATIC_CAST(T*)(0),
int offscreen_rows = 0,
int additional_buffers = 0)
: NCursesFormField (rows, ncols,
first_row, first_col,
offscreen_rows, additional_buffers) {
if (field)
OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData)));
}
virtual ~NCursesUserField() {};
inline const T* UserData (void) const {
return reinterpret_cast<const T*>(::field_userptr (field));
}
inline virtual void setUserData(const T* p_UserData) {
if (field)
OnError (::set_field_userptr (field, STATIC_CAST(void *)(p_UserData)));
}
};
//
// -------------------------------------------------------------------------
// The same mechanism is used to attach user data to a form
// -------------------------------------------------------------------------
//
template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm
{
protected:
// 'Internal' constructor, builds an object without association to a
// field array.
NCursesUserForm( int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0))
: NCursesForm(nlines,ncols,begin_y,begin_x) {
if (form)
set_user (const_cast<void *>(reinterpret_cast<const void*>
(p_UserData)));
}
public:
NCursesUserForm (NCursesFormField* Fields[],
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Fields=FALSE)
: NCursesForm (Fields, with_frame, autoDelete_Fields) {
if (form)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
};
NCursesUserForm (NCursesFormField* Fields[],
int nlines,
int ncols,
int begin_y = 0,
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Fields=FALSE)
: NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
with_frame, autoDelete_Fields) {
if (form)
set_user (const_cast<void *>(reinterpret_cast<const void*>
(p_UserData)));
};
virtual ~NCursesUserForm() {
};
inline T* UserData (void) {
return reinterpret_cast<T*>(get_user ());
};
inline virtual void setUserData (const T* p_UserData) {
if (form)
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
}
};
//
// -------------------------------------------------------------------------
// Builtin Fieldtypes
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType
{
private:
int min_field_width;
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width));
}
public:
Alpha_Field(int width)
: NCursesFieldType(TYPE_ALPHA),
min_field_width(width) {
}
};
class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType
{
private:
int min_field_width;
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width));
}
public:
Alphanumeric_Field(int width)
: NCursesFieldType(TYPE_ALNUM),
min_field_width(width) {
}
};
class NCURSES_IMPEXP Integer_Field : public NCursesFieldType
{
private:
int precision;
long lower_limit, upper_limit;
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,
precision,lower_limit,upper_limit));
}
public:
Integer_Field(int prec, long low=0L, long high=0L)
: NCursesFieldType(TYPE_INTEGER),
precision(prec), lower_limit(low), upper_limit(high) {
}
};
class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType
{
private:
int precision;
double lower_limit, upper_limit;
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,
precision,lower_limit,upper_limit));
}
public:
Numeric_Field(int prec, double low=0.0, double high=0.0)
: NCursesFieldType(TYPE_NUMERIC),
precision(prec), lower_limit(low), upper_limit(high) {
}
};
class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType
{
private:
char* regex;
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,regex));
}
void copy_regex(const char *source)
{
regex = new char[1 + ::strlen(source)];
(::strcpy)(regex, source);
}
public:
Regular_Expression_Field(const char *expr)
: NCursesFieldType(TYPE_REGEXP),
regex(NULL)
{
copy_regex(expr);
}
Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs)
{
if (this != &rhs) {
*this = rhs;
copy_regex(rhs.regex);
NCursesFieldType::operator=(rhs);
}
return *this;
}
Regular_Expression_Field(const Regular_Expression_Field& rhs)
: NCursesFieldType(rhs),
regex(NULL)
{
copy_regex(rhs.regex);
}
~Regular_Expression_Field() {
delete[] regex;
}
};
class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType
{
private:
const char** list;
int case_sensitive;
int non_unique_matches;
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,
list,case_sensitive,non_unique_matches));
}
public:
Enumeration_Field(const char* enums[],
bool case_sens=FALSE,
bool non_unique=FALSE)
: NCursesFieldType(TYPE_ENUM),
list(enums),
case_sensitive(case_sens ? -1 : 0),
non_unique_matches(non_unique ? -1 : 0) {
}
Enumeration_Field& operator=(const Enumeration_Field& rhs)
{
if (this != &rhs) {
*this = rhs;
NCursesFieldType::operator=(rhs);
}
return *this;
}
Enumeration_Field(const Enumeration_Field& rhs)
: NCursesFieldType(rhs),
list(rhs.list),
case_sensitive(rhs.case_sensitive),
non_unique_matches(rhs.non_unique_matches)
{
}
};
class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType
{
private:
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype));
}
public:
IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) {
}
};
extern "C" {
bool _nc_xx_fld_fcheck(FIELD *, const void*);
bool _nc_xx_fld_ccheck(int c, const void *);
void* _nc_xx_fld_makearg(va_list*);
}
//
// -------------------------------------------------------------------------
// Abstract base class for User-Defined Fieldtypes
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType
{
friend class UDF_Init; // Internal helper to set up statics
private:
// For all C++ defined fieldtypes we need only one generic lowlevel
// FIELDTYPE* element.
static FIELDTYPE* generic_fieldtype;
protected:
// This are the functions required by the low level libforms functions
// to construct a fieldtype.
friend bool _nc_xx_fld_fcheck(FIELD *, const void*);
friend bool _nc_xx_fld_ccheck(int c, const void *);
friend void* _nc_xx_fld_makearg(va_list*);
void set(NCursesFormField& f) {
OnError(::set_field_type(f.get_field(),fieldtype,&f));
}
protected:
// Redefine this function to do a field validation. The argument
// is a reference to the field you should validate.
virtual bool field_check(NCursesFormField& f) = 0;
// Redefine this function to do a character validation. The argument
// is the character to be validated.
virtual bool char_check (int c) = 0;
public:
UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {
}
};
extern "C" {
bool _nc_xx_next_choice(FIELD*, const void *);
bool _nc_xx_prev_choice(FIELD*, const void *);
}
//
// -------------------------------------------------------------------------
// Abstract base class for User-Defined Fieldtypes with Choice functions
// -------------------------------------------------------------------------
//
class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
{
friend class UDF_Init; // Internal helper to set up statics
private:
// For all C++ defined fieldtypes with choice functions we need only one
// generic lowlevel FIELDTYPE* element.
static FIELDTYPE* generic_fieldtype_with_choice;
// This are the functions required by the low level libforms functions
// to construct a fieldtype with choice functions.
friend bool _nc_xx_next_choice(FIELD*, const void *);
friend bool _nc_xx_prev_choice(FIELD*, const void *);
protected:
// Redefine this function to do the retrieval of the next choice value.
// The argument is a reference to the field tobe examined.
virtual bool next (NCursesFormField& f) = 0;
// Redefine this function to do the retrieval of the previous choice value.
// The argument is a reference to the field tobe examined.
virtual bool previous(NCursesFormField& f) = 0;
public:
UserDefinedFieldType_With_Choice() {
fieldtype = generic_fieldtype_with_choice;
}
};
#endif /* NCURSES_CURSESF_H_incl */
// * This makes emacs happy -*-Mode: C++;-*-
// vile:cppmode
/****************************************************************************
* Copyright (c) 1998-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
#ifndef NCURSES_CURSESW_H_incl
#define NCURSES_CURSESW_H_incl 1
// $Id: cursesw.h,v 1.53 2017/11/21 00:37:23 tom Exp $
extern "C" {
# include <curses.h>
}
#include <etip.h>
/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
Undefine it here, because NCursesWindow uses lines as a method. */
#undef lines
/* "Convert" macros to inlines. We'll define it as another symbol to avoid
* conflict with library symbols.
*/
#undef UNDEF
#define UNDEF(name) CUR_ ##name
#ifdef addch
inline int UNDEF(addch)(chtype ch) { return addch(ch); }
#undef addch
#define addch UNDEF(addch)
#endif
#ifdef addchstr
inline int UNDEF(addchstr)(chtype *at) { return addchstr(at); }
#undef addchstr
#define addchstr UNDEF(addchstr)
#endif
#ifdef addnstr
inline int UNDEF(addnstr)(const char *str, int n)
{ return addnstr(str, n); }
#undef addnstr
#define addnstr UNDEF(addnstr)
#endif
#ifdef addstr
inline int UNDEF(addstr)(const char * str) { return addstr(str); }
#undef addstr
#define addstr UNDEF(addstr)
#endif
#ifdef attroff
inline int UNDEF(attroff)(chtype at) { return attroff(at); }
#undef attroff
#define attroff UNDEF(attroff)
#endif
#ifdef attron
inline int UNDEF(attron)(chtype at) { return attron(at); }
#undef attron
#define attron UNDEF(attron)
#endif
#ifdef attrset
inline chtype UNDEF(attrset)(chtype at) { return attrset(at); }
#undef attrset
#define attrset UNDEF(attrset)
#endif
#ifdef bkgd
inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); }
#undef bkgd
#define bkgd UNDEF(bkgd)
#endif
#ifdef bkgdset
inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); }
#undef bkgdset
#define bkgdset UNDEF(bkgdset)
#endif
#ifdef border
inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
{ return border(ls, rs, ts, bs, tl, tr, bl, br); }
#undef border
#define border UNDEF(border)
#endif
#ifdef box
inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); }
#undef box
#define box UNDEF(box)
#endif
#ifdef chgat
inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
return chgat(n, attr, color, opts); }
#undef chgat
#define chgat UNDEF(chgat)
#endif
#ifdef clear
inline int UNDEF(clear)() { return clear(); }
#undef clear
#define clear UNDEF(clear)
#endif
#ifdef clearok
inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); }
#undef clearok
#define clearok UNDEF(clearok)
#else
extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool);
#endif
#ifdef clrtobot
inline int UNDEF(clrtobot)() { return clrtobot(); }
#undef clrtobot
#define clrtobot UNDEF(clrtobot)
#endif
#ifdef clrtoeol
inline int UNDEF(clrtoeol)() { return clrtoeol(); }
#undef clrtoeol
#define clrtoeol UNDEF(clrtoeol)
#endif
#ifdef color_set
inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); }
#undef color_set
#define color_set UNDEF(color_set)
#endif
#ifdef crmode
inline int UNDEF(crmode)(void) { return crmode(); }
#undef crmode
#define crmode UNDEF(crmode)
#endif
#ifdef delch
inline int UNDEF(delch)() { return delch(); }
#undef delch
#define delch UNDEF(delch)
#endif
#ifdef deleteln
inline int UNDEF(deleteln)() { return deleteln(); }
#undef deleteln
#define deleteln UNDEF(deleteln)
#endif
#ifdef echochar
inline int UNDEF(echochar)(chtype ch) { return echochar(ch); }
#undef echochar
#define echochar UNDEF(echochar)
#endif
#ifdef erase
inline int UNDEF(erase)() { return erase(); }
#undef erase
#define erase UNDEF(erase)
#endif
#ifdef fixterm
inline int UNDEF(fixterm)(void) { return fixterm(); }
#undef fixterm
#define fixterm UNDEF(fixterm)
#endif
#ifdef flushok
inline int UNDEF(flushok)(WINDOW* _win, bool _bf) {
return flushok(_win, _bf); }
#undef flushok
#define flushok UNDEF(flushok)
#else
#define _no_flushok
#endif
#ifdef getattrs
inline int UNDEF(getattrs)(WINDOW *win) { return getattrs(win); }
#undef getattrs
#define getattrs UNDEF(getattrs)
#endif
#ifdef getbegyx
inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); }
#undef getbegyx
#define getbegyx UNDEF(getbegyx)
#endif
#ifdef getbkgd
inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); }
#undef getbkgd
#define getbkgd UNDEF(getbkgd)
#endif
#ifdef getch
inline int UNDEF(getch)() { return getch(); }
#undef getch
#define getch UNDEF(getch)
#endif
#ifdef getmaxyx
inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); }
#undef getmaxyx
#define getmaxyx UNDEF(getmaxyx)
#endif
#ifdef getnstr
inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str, n); }
#undef getnstr
#define getnstr UNDEF(getnstr)
#endif
#ifdef getparyx
inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { getparyx(win, y, x); }
#undef getparyx
#define getparyx UNDEF(getparyx)
#endif
#ifdef getstr
inline int UNDEF(getstr)(char *_str) { return getstr(_str); }
#undef getstr
#define getstr UNDEF(getstr)
#endif
#ifdef getyx
inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) {
getyx(win, y, x); }
#undef getyx
#define getyx UNDEF(getyx)
#endif
#ifdef hline
inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); }
#undef hline
#define hline UNDEF(hline)
#endif
#ifdef inch
inline chtype UNDEF(inch)() { return inch(); }
#undef inch
#define inch UNDEF(inch)
#endif
#ifdef inchstr
inline int UNDEF(inchstr)(chtype *str) { return inchstr(str); }
#undef inchstr
#define inchstr UNDEF(inchstr)
#endif
#ifdef innstr
inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str, n); }
#undef innstr
#define innstr UNDEF(innstr)
#endif
#ifdef insch
inline int UNDEF(insch)(chtype c) { return insch(c); }
#undef insch
#define insch UNDEF(insch)
#endif
#ifdef insdelln
inline int UNDEF(insdelln)(int n) { return insdelln(n); }
#undef insdelln
#define insdelln UNDEF(insdelln)
#endif
#ifdef insertln
inline int UNDEF(insertln)() { return insertln(); }
#undef insertln
#define insertln UNDEF(insertln)
#endif
#ifdef insnstr
inline int UNDEF(insnstr)(const char *_str, int n) {
return insnstr(_str, n); }
#undef insnstr
#define insnstr UNDEF(insnstr)
#endif
#ifdef insstr
inline int UNDEF(insstr)(const char *_str) {
return insstr(_str); }
#undef insstr
#define insstr UNDEF(insstr)
#endif
#ifdef instr
inline int UNDEF(instr)(char *_str) { return instr(_str); }
#undef instr
#define instr UNDEF(instr)
#endif
#ifdef intrflush
inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); }
#undef intrflush
#define intrflush UNDEF(intrflush)
#endif
#ifdef is_linetouched
inline int UNDEF(is_linetouched)(WINDOW *w, int l) { return is_linetouched(w,l); }
#undef is_linetouched
#define is_linetouched UNDEF(is_linetouched)
#endif
#ifdef leaveok
inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); }
#undef leaveok
#define leaveok UNDEF(leaveok)
#else
extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf);
#endif
#ifdef move
inline int UNDEF(move)(int x, int y) { return move(x, y); }
#undef move
#define move UNDEF(move)
#endif
#ifdef mvaddch
inline int UNDEF(mvaddch)(int y, int x, chtype ch)
{ return mvaddch(y, x, ch); }
#undef mvaddch
#define mvaddch UNDEF(mvaddch)
#endif
#ifdef mvaddnstr
inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n)
{ return mvaddnstr(y, x, str, n); }
#undef mvaddnstr
#define mvaddnstr UNDEF(mvaddnstr)
#endif
#ifdef mvaddstr
inline int UNDEF(mvaddstr)(int y, int x, const char * str)
{ return mvaddstr(y, x, str); }
#undef mvaddstr
#define mvaddstr UNDEF(mvaddstr)
#endif
#ifdef mvchgat
inline int UNDEF(mvchgat)(int y, int x, int n,
attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
return mvchgat(y, x, n, attr, color, opts); }
#undef mvchgat
#define mvchgat UNDEF(mvchgat)
#endif
#ifdef mvdelch
inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);}
#undef mvdelch
#define mvdelch UNDEF(mvdelch)
#endif
#ifdef mvgetch
inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);}
#undef mvgetch
#define mvgetch UNDEF(mvgetch)
#endif
#ifdef mvgetnstr
inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) {
return mvgetnstr(y, x, str, n);}
#undef mvgetnstr
#define mvgetnstr UNDEF(mvgetnstr)
#endif
#ifdef mvgetstr
inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);}
#undef mvgetstr
#define mvgetstr UNDEF(mvgetstr)
#endif
#ifdef mvinch
inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);}
#undef mvinch
#define mvinch UNDEF(mvinch)
#endif
#ifdef mvinnstr
inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) {
return mvinnstr(y, x, _str, n); }
#undef mvinnstr
#define mvinnstr UNDEF(mvinnstr)
#endif
#ifdef mvinsch
inline int UNDEF(mvinsch)(int y, int x, chtype c)
{ return mvinsch(y, x, c); }
#undef mvinsch
#define mvinsch UNDEF(mvinsch)
#endif
#ifdef mvinsnstr
inline int UNDEF(mvinsnstr)(int y, int x, const char *_str, int n) {
return mvinsnstr(y, x, _str, n); }
#undef mvinsnstr
#define mvinsnstr UNDEF(mvinsnstr)
#endif
#ifdef mvinsstr
inline int UNDEF(mvinsstr)(int y, int x, const char *_str) {
return mvinsstr(y, x, _str); }
#undef mvinsstr
#define mvinsstr UNDEF(mvinsstr)
#endif
#ifdef mvwaddch
inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch)
{ return mvwaddch(win, y, x, ch); }
#undef mvwaddch
#define mvwaddch UNDEF(mvwaddch)
#endif
#ifdef mvwaddchnstr
inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, const chtype *str, int n)
{ return mvwaddchnstr(win, y, x, str, n); }
#undef mvwaddchnstr
#define mvwaddchnstr UNDEF(mvwaddchnstr)
#endif
#ifdef mvwaddchstr
inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, const chtype *str)
{ return mvwaddchstr(win, y, x, str); }
#undef mvwaddchstr
#define mvwaddchstr UNDEF(mvwaddchstr)
#endif
#ifdef mvwaddnstr
inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n)
{ return mvwaddnstr(win, y, x, str, n); }
#undef mvwaddnstr
#define mvwaddnstr UNDEF(mvwaddnstr)
#endif
#ifdef mvwaddstr
inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str)
{ return mvwaddstr(win, y, x, str); }
#undef mvwaddstr
#define mvwaddstr UNDEF(mvwaddstr)
#endif
#ifdef mvwchgat
inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
return mvwchgat(win, y, x, n, attr, color, opts); }
#undef mvwchgat
#define mvwchgat UNDEF(mvwchgat)
#endif
#ifdef mvwdelch
inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x)
{ return mvwdelch(win, y, x); }
#undef mvwdelch
#define mvwdelch UNDEF(mvwdelch)
#endif
#ifdef mvwgetch
inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);}
#undef mvwgetch
#define mvwgetch UNDEF(mvwgetch)
#endif
#ifdef mvwgetnstr
inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n)
{return mvwgetnstr(win, y, x, str, n);}
#undef mvwgetnstr
#define mvwgetnstr UNDEF(mvwgetnstr)
#endif
#ifdef mvwgetstr
inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str)
{return mvwgetstr(win, y, x, str);}
#undef mvwgetstr
#define mvwgetstr UNDEF(mvwgetstr)
#endif
#ifdef mvwhline
inline int UNDEF(mvwhline)(WINDOW *win, int y, int x, chtype c, int n) {
return mvwhline(win, y, x, c, n); }
#undef mvwhline
#define mvwhline UNDEF(mvwhline)
#endif
#ifdef mvwinch
inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) {
return mvwinch(win, y, x);}
#undef mvwinch
#define mvwinch UNDEF(mvwinch)
#endif
#ifdef mvwinchnstr
inline int UNDEF(mvwinchnstr)(WINDOW *win, int y, int x, chtype *str, int n) { return mvwinchnstr(win, y, x, str, n); }
#undef mvwinchnstr
#define mvwinchnstr UNDEF(mvwinchnstr)
#endif
#ifdef mvwinchstr
inline int UNDEF(mvwinchstr)(WINDOW *win, int y, int x, chtype *str) { return mvwinchstr(win, y, x, str); }
#undef mvwinchstr
#define mvwinchstr UNDEF(mvwinchstr)
#endif
#ifdef mvwinnstr
inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) {
return mvwinnstr(win, y, x, _str, n); }
#undef mvwinnstr
#define mvwinnstr UNDEF(mvwinnstr)
#endif
#ifdef mvwinsch
inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c)
{ return mvwinsch(win, y, x, c); }
#undef mvwinsch
#define mvwinsch UNDEF(mvwinsch)
#endif
#ifdef mvwinsnstr
inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x, const char *_str, int n) {
return mvwinsnstr(w, y, x, _str, n); }
#undef mvwinsnstr
#define mvwinsnstr UNDEF(mvwinsnstr)
#endif
#ifdef mvwinsstr
inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) {
return mvwinsstr(w, y, x, _str); }
#undef mvwinsstr
#define mvwinsstr UNDEF(mvwinsstr)
#endif
#ifdef mvwvline
inline int UNDEF(mvwvline)(WINDOW *win, int y, int x, chtype c, int n) {
return mvwvline(win, y, x, c, n); }
#undef mvwvline
#define mvwvline UNDEF(mvwvline)
#endif
#ifdef napms
inline void UNDEF(napms)(unsigned long x) { napms(x); }
#undef napms
#define napms UNDEF(napms)
#endif
#ifdef nocrmode
inline int UNDEF(nocrmode)(void) { return nocrmode(); }
#undef nocrmode
#define nocrmode UNDEF(nocrmode)
#endif
#ifdef nodelay
inline void UNDEF(nodelay)() { nodelay(); }
#undef nodelay
#define nodelay UNDEF(nodelay)
#endif
#ifdef redrawwin
inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); }
#undef redrawwin
#define redrawwin UNDEF(redrawwin)
#endif
#ifdef refresh
inline int UNDEF(refresh)() { return refresh(); }
#undef refresh
#define refresh UNDEF(refresh)
#endif
#ifdef resetterm
inline int UNDEF(resetterm)(void) { return resetterm(); }
#undef resetterm
#define resetterm UNDEF(resetterm)
#endif
#ifdef saveterm
inline int UNDEF(saveterm)(void) { return saveterm(); }
#undef saveterm
#define saveterm UNDEF(saveterm)
#endif
#ifdef scrl
inline int UNDEF(scrl)(int l) { return scrl(l); }
#undef scrl
#define scrl UNDEF(scrl)
#endif
#ifdef scroll
inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); }
#undef scroll
#define scroll UNDEF(scroll)
#endif
#ifdef scrollok
inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); }
#undef scrollok
#define scrollok UNDEF(scrollok)
#else
#if defined(__NCURSES_H)
extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool);
#else
extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char);
#endif
#endif
#ifdef setscrreg
inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); }
#undef setscrreg
#define setscrreg UNDEF(setscrreg)
#endif
#ifdef standend
inline int UNDEF(standend)() { return standend(); }
#undef standend
#define standend UNDEF(standend)
#endif
#ifdef standout
inline int UNDEF(standout)() { return standout(); }
#undef standout
#define standout UNDEF(standout)
#endif
#ifdef subpad
inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x)
{ return derwin(p, l, c, y, x); }
#undef subpad
#define subpad UNDEF(subpad)
#endif
#ifdef timeout
inline void UNDEF(timeout)(int delay) { timeout(delay); }
#undef timeout
#define timeout UNDEF(timeout)
#endif
#ifdef touchline
inline int UNDEF(touchline)(WINDOW *win, int s, int c)
{ return touchline(win, s, c); }
#undef touchline
#define touchline UNDEF(touchline)
#endif
#ifdef touchwin
inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); }
#undef touchwin
#define touchwin UNDEF(touchwin)
#endif
#ifdef untouchwin
inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); }
#undef untouchwin
#define untouchwin UNDEF(untouchwin)
#endif
#ifdef vline
inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); }
#undef vline
#define vline UNDEF(vline)
#endif
#ifdef waddchstr
inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); }
#undef waddchstr
#define waddchstr UNDEF(waddchstr)
#endif
#ifdef waddstr
inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); }
#undef waddstr
#define waddstr UNDEF(waddstr)
#endif
#ifdef wattroff
inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); }
#undef wattroff
#define wattroff UNDEF(wattroff)
#endif
#ifdef wattrset
inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); }
#undef wattrset
#define wattrset UNDEF(wattrset)
#endif
#ifdef winch
inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); }
#undef winch
#define winch UNDEF(winch)
#endif
#ifdef winchnstr
inline int UNDEF(winchnstr)(WINDOW *win, chtype *str, int n) { return winchnstr(win, str, n); }
#undef winchnstr
#define winchnstr UNDEF(winchnstr)
#endif
#ifdef winchstr
inline int UNDEF(winchstr)(WINDOW *win, chtype *str) { return winchstr(win, str); }
#undef winchstr
#define winchstr UNDEF(winchstr)
#endif
#ifdef winsstr
inline int UNDEF(winsstr)(WINDOW *w, const char *_str) {
return winsstr(w, _str); }
#undef winsstr
#define winsstr UNDEF(winsstr)
#endif
#ifdef wstandend
inline int UNDEF(wstandend)(WINDOW *win) { return wstandend(win); }
#undef wstandend
#define wstandend UNDEF(wstandend)
#endif
#ifdef wstandout
inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); }
#undef wstandout
#define wstandout UNDEF(wstandout)
#endif
/*
*
* C++ class for windows.
*
*/
extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int));
extern "C" int _nc_xx_ripoff_init(WINDOW *, int);
extern "C" int _nc_has_mouse(void);
class NCURSES_IMPEXP NCursesWindow
{
friend class NCursesMenu;
friend class NCursesForm;
private:
static bool b_initialized;
static void initialize();
void constructing();
friend int _nc_xx_ripoff_init(WINDOW *, int);
void set_keyboard();
NCURSES_COLOR_T getcolor(int getback) const;
NCURSES_PAIRS_T getPair() const;
static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair);
static int colorInitialized;
// This private constructor is only used during the initialization
// of windows generated by ripoffline() calls.
NCursesWindow(WINDOW* win, int ncols);
protected:
virtual void err_handler(const char *) const THROWS(NCursesException);
// Signal an error with the given message text.
static long count; // count of all active windows:
// We rely on the c++ promise that
// all otherwise uninitialized
// static class vars are set to 0
WINDOW* w; // the curses WINDOW
bool alloced; // TRUE if we own the WINDOW
NCursesWindow* par; // parent, if subwindow
NCursesWindow* subwins; // head of subwindows list
NCursesWindow* sib; // next subwindow of parent
void kill_subwindows(); // disable all subwindows
// Destroy all subwindows.
/* Only for use by derived classes. They are then in charge to
fill the member variables correctly. */
NCursesWindow();
public:
NCursesWindow(WINDOW* window); // useful only for stdscr
NCursesWindow(int nlines, // number of lines
int ncols, // number of columns
int begin_y, // line origin
int begin_x); // col origin
NCursesWindow(NCursesWindow& par,// parent window
int nlines, // number of lines
int ncols, // number of columns
int begin_y, // absolute or relative
int begin_x, // origins:
char absrel = 'a');// if `a', begin_y & begin_x are
// absolute screen pos, else if `r', they are relative to par origin
NCursesWindow(NCursesWindow& par,// parent window
bool do_box = TRUE);
// this is the very common case that we want to create the subwindow that
// is two lines and two columns smaller and begins at (1,1).
// We may automatically request the box around it.
NCursesWindow& operator=(const NCursesWindow& rhs)
{
if (this != &rhs)
*this = rhs;
return *this;
}
NCursesWindow(const NCursesWindow& rhs)
: w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib)
{
}
virtual ~NCursesWindow();
NCursesWindow Clone();
// Make an exact copy of the window.
// Initialization.
static void useColors(void);
// Call this routine very early if you want to have colors.
static int ripoffline(int ripoff_lines,
int (*init)(NCursesWindow& win));
// This function is used to generate a window of ripped-of lines.
// If the argument is positive, lines are removed from the top, if it
// is negative lines are removed from the bottom. This enhances the
// lowlevel ripoffline() function because it uses the internal
// implementation that allows to remove more than just a single line.
// This function must be called before any other ncurses function. The
// creation of the window is deferred until ncurses gets initialized.
// The initialization function is then called.
// -------------------------------------------------------------------------
// terminal status
// -------------------------------------------------------------------------
int lines() const { initialize(); return LINES; }
// Number of lines on terminal, *not* window
int cols() const { initialize(); return COLS; }
// Number of cols on terminal, *not* window
int tabsize() const { initialize(); return TABSIZE; }
// Size of a tab on terminal, *not* window
static int NumberOfColors();
// Number of available colors
int colors() const { return NumberOfColors(); }
// Number of available colors
// -------------------------------------------------------------------------
// window status
// -------------------------------------------------------------------------
int height() const { return maxy() + 1; }
// Number of lines in this window
int width() const { return maxx() + 1; }
// Number of columns in this window
int begx() const { return getbegx(w); }
// Column of top left corner relative to stdscr
int begy() const { return getbegy(w); }
// Line of top left corner relative to stdscr
int curx() const { return getcurx(w); }
// Column of top left corner relative to stdscr
int cury() const { return getcury(w); }
// Line of top left corner relative to stdscr
int maxx() const { return getmaxx(w) == ERR ? ERR : getmaxx(w)-1; }
// Largest x coord in window
int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; }
// Largest y coord in window
NCURSES_PAIRS_T getcolor() const;
// Actual color pair
NCURSES_COLOR_T foreground() const { return getcolor(0); }
// Actual foreground color
NCURSES_COLOR_T background() const { return getcolor(1); }
// Actual background color
int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back);
// Set color palette entry
int setcolor(NCURSES_PAIRS_T pair);
// Set actually used palette entry
// -------------------------------------------------------------------------
// window positioning
// -------------------------------------------------------------------------
virtual int mvwin(int begin_y, int begin_x) {
return ::mvwin(w, begin_y, begin_x); }
// Move window to new position with the new position as top left corner.
// This is virtual because it is redefined in NCursesPanel.
// -------------------------------------------------------------------------
// coordinate positioning
// -------------------------------------------------------------------------
int move(int y, int x) { return ::wmove(w, y, x); }
// Move cursor the this position
void getyx(int& y, int& x) const { ::getyx(w, y, x); }
// Get current position of the cursor
void getbegyx(int& y, int& x) const { ::getbegyx(w, y, x); }
// Get beginning of the window
void getmaxyx(int& y, int& x) const { ::getmaxyx(w, y, x); }
// Get size of the window
void getparyx(int& y, int& x) const { ::getparyx(w, y, x); }
// Get parent's beginning of the window
int mvcur(int oldrow, int oldcol, int newrow, int newcol) const {
return ::mvcur(oldrow, oldcol, newrow, newcol); }
// Perform lowlevel cursor motion that takes effect immediately.
// -------------------------------------------------------------------------
// input
// -------------------------------------------------------------------------
int getch() { return ::wgetch(w); }
// Get a keystroke from the window.
int getch(int y, int x) { return ::mvwgetch(w, y, x); }
// Move cursor to position and get a keystroke from the window
int getstr(char* str, int n=-1) {
return ::wgetnstr(w, str, n); }
// Read a series of characters into str until a newline or carriage return
// is received. Read at most n characters. If n is negative, the limit is
// ignored.
int getstr(int y, int x, char* str, int n=-1) {
return ::mvwgetnstr(w, y, x, str, n); }
// Move the cursor to the requested position and then perform the getstr()
// as described above.
int instr(char *s, int n=-1) { return ::winnstr(w, s, n); }
// Get a string of characters from the window into the buffer s. Retrieve
// at most n characters, if n is negative retrieve all characters up to the
// end of the current line. Attributes are stripped from the characters.
int instr(int y, int x, char *s, int n=-1) {
return ::mvwinnstr(w, y, x, s, n); }
// Move the cursor to the requested position and then perform the instr()
// as described above.
int scanw(const char* fmt, ...)
// Perform a scanw function from the window.
#if __GNUG__ >= 2
__attribute__ ((format (scanf, 2, 3)));
#else
;
#endif
int scanw(const char*, va_list);
// Perform a scanw function from the window.
int scanw(int y, int x, const char* fmt, ...)
// Move the cursor to the requested position and then perform a scanw
// from the window.
#if __GNUG__ >= 2
__attribute__ ((format (scanf, 4, 5)));
#else
;
#endif
int scanw(int y, int x, const char* fmt, va_list);
// Move the cursor to the requested position and then perform a scanw
// from the window.
// -------------------------------------------------------------------------
// output
// -------------------------------------------------------------------------
int addch(const chtype ch) { return ::waddch(w, ch); }
// Put attributed character to the window.
int addch(int y, int x, const chtype ch) {
return ::mvwaddch(w, y, x, ch); }
// Move cursor to the requested position and then put attributed character
// to the window.
int echochar(const chtype ch) { return ::wechochar(w, ch); }
// Put attributed character to the window and refresh it immediately.
int addstr(const char* str, int n=-1) {
return ::waddnstr(w, str, n); }
// Write the string str to the window, stop writing if the terminating
// NUL or the limit n is reached. If n is negative, it is ignored.
int addstr(int y, int x, const char * str, int n=-1) {
return ::mvwaddnstr(w, y, x, str, n); }
// Move the cursor to the requested position and then perform the addchstr
// as described above.
int addchstr(const chtype* str, int n=-1) {
return ::waddchnstr(w, str, n); }
// Write the string str to the window, stop writing if the terminating
// NUL or the limit n is reached. If n is negative, it is ignored.
int addchstr(int y, int x, const chtype * str, int n=-1) {
return ::mvwaddchnstr(w, y, x, str, n); }
// Move the cursor to the requested position and then perform the addchstr
// as described above.
int printw(const char* fmt, ...)
// Do a formatted print to the window.
#if (__GNUG__ >= 2) && !defined(printf)
__attribute__ ((format (printf, 2, 3)));
#else
;
#endif
int printw(int y, int x, const char * fmt, ...)
// Move the cursor and then do a formatted print to the window.
#if (__GNUG__ >= 2) && !defined(printf)
__attribute__ ((format (printf, 4, 5)));
#else
;
#endif
int printw(const char* fmt, va_list args);
// Do a formatted print to the window.
int printw(int y, int x, const char * fmt, va_list args);
// Move the cursor and then do a formatted print to the window.
chtype inch() const { return ::winch(w); }
// Retrieve attributed character under the current cursor position.
chtype inch(int y, int x) { return ::mvwinch(w, y, x); }
// Move cursor to requested position and then retrieve attributed character
// at this position.
int inchstr(chtype* str, int n=-1) {
return ::winchnstr(w, str, n); }
// Read the string str from the window, stop reading if the terminating
// NUL or the limit n is reached. If n is negative, it is ignored.
int inchstr(int y, int x, chtype * str, int n=-1) {
return ::mvwinchnstr(w, y, x, str, n); }
// Move the cursor to the requested position and then perform the inchstr
// as described above.
int insch(chtype ch) { return ::winsch(w, ch); }
// Insert attributed character into the window before current cursor
// position.
int insch(int y, int x, chtype ch) {
return ::mvwinsch(w, y, x, ch); }
// Move cursor to requested position and then insert the attributed
// character before that position.
int insertln() { return ::winsdelln(w, 1); }
// Insert an empty line above the current line.
int insdelln(int n=1) { return ::winsdelln(w, n); }
// If n>0 insert that many lines above the current line. If n<0 delete
// that many lines beginning with the current line.
int insstr(const char *s, int n=-1) {
return ::winsnstr(w, s, n); }
// Insert the string into the window before the current cursor position.
// Insert stops at end of string or when the limit n is reached. If n is
// negative, it is ignored.
int insstr(int y, int x, const char *s, int n=-1) {
return ::mvwinsnstr(w, y, x, s, n); }
// Move the cursor to the requested position and then perform the insstr()
// as described above.
int attron (chtype at) { return ::wattron (w, at); }
// Switch on the window attributes;
int attroff(chtype at) { return ::wattroff(w, static_cast<int>(at)); }
// Switch off the window attributes;
int attrset(chtype at) { return ::wattrset(w, static_cast<int>(at)); }
// Set the window attributes;
chtype attrget() { return ::getattrs(w); }
// Get the window attributes;
int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) {
return ::wcolor_set(w, color_pair_number, opts); }
// Set the window color attribute;
int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
return ::wchgat(w, n, attr, color, opts); }
// Change the attributes of the next n characters in the current line. If
// n is negative or greater than the number of remaining characters in the
// line, the attributes will be changed up to the end of the line.
int chgat(int y, int x,
int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
return ::mvwchgat(w, y, x, n, attr, color, opts); }
// Move the cursor to the requested position and then perform chgat() as
// described above.
// -------------------------------------------------------------------------
// background
// -------------------------------------------------------------------------
chtype getbkgd() const { return ::getbkgd(w); }
// Get current background setting.
int bkgd(const chtype ch) { return ::wbkgd(w, ch); }
// Set the background property and apply it to the window.
void bkgdset(chtype ch) { ::wbkgdset(w, ch); }
// Set the background property.
// -------------------------------------------------------------------------
// borders
// -------------------------------------------------------------------------
int box(chtype vert=0, chtype hor=0) {
return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); }
// Draw a box around the window with the given vertical and horizontal
// drawing characters. If you specify a zero as character, curses will try
// to find a "nice" character.
int border(chtype left=0, chtype right=0,
chtype top =0, chtype bottom=0,
chtype top_left =0, chtype top_right=0,
chtype bottom_left =0, chtype bottom_right=0) {
return ::wborder(w, left, right, top, bottom, top_left, top_right,
bottom_left, bottom_right); }
// Draw a border around the window with the given characters for the
// various parts of the border. If you pass zero for a character, curses
// will try to find "nice" characters.
// -------------------------------------------------------------------------
// lines and boxes
// -------------------------------------------------------------------------
int hline(int len, chtype ch=0) { return ::whline(w, ch, len); }
// Draw a horizontal line of len characters with the given character. If
// you pass zero for the character, curses will try to find a "nice" one.
int hline(int y, int x, int len, chtype ch=0) {
return ::mvwhline(w, y, x, ch, len); }
// Move the cursor to the requested position and then draw a horizontal line.
int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); }
// Draw a vertical line of len characters with the given character. If
// you pass zero for the character, curses will try to find a "nice" one.
int vline(int y, int x, int len, chtype ch=0) {
return ::mvwvline(w, y, x, ch, len); }
// Move the cursor to the requested position and then draw a vertical line.
// -------------------------------------------------------------------------
// erasure
// -------------------------------------------------------------------------
int erase() { return ::werase(w); }
// Erase the window.
int clear() { return ::wclear(w); }
// Clear the window.
int clearok(bool bf) { return ::clearok(w, bf); }
// Set/Reset the clear flag. If set, the next refresh() will clear the
// screen.
int clrtobot() { return ::wclrtobot(w); }
// Clear to the end of the window.
int clrtoeol() { return ::wclrtoeol(w); }
// Clear to the end of the line.
int delch() { return ::wdelch(w); }
// Delete character under the cursor.
int delch(int y, int x) { return ::mvwdelch(w, y, x); }
// Move cursor to requested position and delete the character under the
// cursor.
int deleteln() { return ::winsdelln(w, -1); }
// Delete the current line.
// -------------------------------------------------------------------------
// screen control
// -------------------------------------------------------------------------
int scroll(int amount=1) { return ::wscrl(w, amount); }
// Scroll amount lines. If amount is positive, scroll up, otherwise
// scroll down.
int scrollok(bool bf) { return ::scrollok(w, bf); }
// If bf is TRUE, window scrolls if cursor is moved off the bottom
// edge of the window or a scrolling region, otherwise the cursor is left
// at the bottom line.
int setscrreg(int from, int to) {
return ::wsetscrreg(w, from, to); }
// Define a soft scrolling region.
int idlok(bool bf) { return ::idlok(w, bf); }
// If bf is TRUE, use insert/delete line hardware support if possible.
// Otherwise do it in software.
void idcok(bool bf) { ::idcok(w, bf); }
// If bf is TRUE, use insert/delete character hardware support if possible.
// Otherwise do it in software.
int touchline(int s, int c) { return ::touchline(w, s, c); }
// Mark the given lines as modified.
int touchwin() { return ::wtouchln(w, 0, height(), 1); }
// Mark the whole window as modified.
int untouchwin() { return ::wtouchln(w, 0, height(), 0); }
// Mark the whole window as unmodified.
int touchln(int s, int cnt, bool changed=TRUE) {
return ::wtouchln(w, s, cnt, static_cast<int>(changed ? 1 : 0)); }
// Mark cnt lines beginning from line s as changed or unchanged, depending
// on the value of the changed flag.
bool is_linetouched(int line) const {
return (::is_linetouched(w, line) == TRUE ? TRUE:FALSE); }
// Return TRUE if line is marked as changed, FALSE otherwise
bool is_wintouched() const {
return (::is_wintouched(w) ? TRUE:FALSE); }
// Return TRUE if window is marked as changed, FALSE otherwise
int leaveok(bool bf) { return ::leaveok(w, bf); }
// If bf is TRUE, curses will leave the cursor after an update whereever
// it is after the update.
int redrawln(int from, int n) { return ::wredrawln(w, from, n); }
// Redraw n lines starting from the requested line
int redrawwin() { return ::wredrawln(w, 0, height()); }
// Redraw the whole window
int doupdate() { return ::doupdate(); }
// Do all outputs to make the physical screen looking like the virtual one
void syncdown() { ::wsyncdown(w); }
// Propagate the changes down to all descendant windows
void syncup() { ::wsyncup(w); }
// Propagate the changes up in the hierarchy
void cursyncup() { ::wcursyncup(w); }
// Position the cursor in all ancestor windows corresponding to our setting
int syncok(bool bf) { return ::syncok(w, bf); }
// If called with bf=TRUE, syncup() is called whenever the window is changed
#ifndef _no_flushok
int flushok(bool bf) { return ::flushok(w, bf); }
#endif
void immedok(bool bf) { ::immedok(w, bf); }
// If called with bf=TRUE, any change in the window will cause an
// automatic immediate refresh()
int intrflush(bool bf) { return ::intrflush(w, bf); }
int keypad(bool bf) { return ::keypad(w, bf); }
// If called with bf=TRUE, the application will interpret function keys.
int nodelay(bool bf) { return ::nodelay(w, bf); }
int meta(bool bf) { return ::meta(w, bf); }
// If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise
// 7-Bit characters are generated.
int standout() { return ::wstandout(w); }
// Enable "standout" attributes
int standend() { return ::wstandend(w); }
// Disable "standout" attributes
// -------------------------------------------------------------------------
// The next two are virtual, because we redefine them in the
// NCursesPanel class.
// -------------------------------------------------------------------------
virtual int refresh() { return ::wrefresh(w); }
// Propagate the changes in this window to the virtual screen and call
// doupdate(). This is redefined in NCursesPanel.
virtual int noutrefresh() { return ::wnoutrefresh(w); }
// Propagate the changes in this window to the virtual screen. This is
// redefined in NCursesPanel.
// -------------------------------------------------------------------------
// multiple window control
// -------------------------------------------------------------------------
int overlay(NCursesWindow& win) {
return ::overlay(w, win.w); }
// Overlay this window over win.
int overwrite(NCursesWindow& win) {
return ::overwrite(w, win.w); }
// Overwrite win with this window.
int copywin(NCursesWindow& win,
int sminrow, int smincol,
int dminrow, int dmincol,
int dmaxrow, int dmaxcol, bool overlaywin=TRUE) {
return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol,
dmaxrow, dmaxcol, static_cast<int>(overlaywin ? 1 : 0)); }
// Overlay or overwrite the rectangle in win given by dminrow,dmincol,
// dmaxrow,dmaxcol with the rectangle in this window beginning at
// sminrow,smincol.
// -------------------------------------------------------------------------
// Extended functions
// -------------------------------------------------------------------------
#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0)
int wresize(int newLines, int newColumns) {
return ::wresize(w, newLines, newColumns); }
#endif
// -------------------------------------------------------------------------
// Mouse related
// -------------------------------------------------------------------------
bool has_mouse() const;
// Return TRUE if terminal supports a mouse, FALSE otherwise
// -------------------------------------------------------------------------
// traversal support
// -------------------------------------------------------------------------
NCursesWindow* child() { return subwins; }
// Get the first child window.
NCursesWindow* sibling() { return sib; }
// Get the next child of my parent.
NCursesWindow* parent() { return par; }
// Get my parent.
bool isDescendant(NCursesWindow& win);
// Return TRUE if win is a descendant of this.
};
// -------------------------------------------------------------------------
// We leave this here for compatibility reasons.
// -------------------------------------------------------------------------
class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow
{
public:
NCursesColorWindow(WINDOW* &window) // useful only for stdscr
: NCursesWindow(window) {
useColors(); }
NCursesColorWindow(int nlines, // number of lines
int ncols, // number of columns
int begin_y, // line origin
int begin_x) // col origin
: NCursesWindow(nlines, ncols, begin_y, begin_x) {
useColors(); }
NCursesColorWindow(NCursesWindow& parentWin,// parent window
int nlines, // number of lines
int ncols, // number of columns
int begin_y, // absolute or relative
int begin_x, // origins:
char absrel = 'a') // if `a', by & bx are
: NCursesWindow(parentWin,
nlines, ncols, // absolute screen pos,
begin_y, begin_x, // else if `r', they are
absrel ) { // relative to par origin
useColors(); }
};
// These enum definitions really belong inside the NCursesPad class, but only
// recent compilers support that feature.
typedef enum {
REQ_PAD_REFRESH = KEY_MAX + 1,
REQ_PAD_UP,
REQ_PAD_DOWN,
REQ_PAD_LEFT,
REQ_PAD_RIGHT,
REQ_PAD_EXIT
} Pad_Request;
const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code
const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code
// -------------------------------------------------------------------------
// Pad Support. We allow an association of a pad with a "real" window
// through which the pad may be viewed.
// -------------------------------------------------------------------------
class NCURSES_IMPEXP NCursesPad : public NCursesWindow
{
private:
NCursesWindow* viewWin; // the "viewport" window
NCursesWindow* viewSub; // the "viewport" subwindow
int h_gridsize, v_gridsize;
protected:
int min_row, min_col; // top left row/col of the pads display area
NCursesWindow* Win(void) const {
// Get the window into which the pad should be copied (if any)
return (viewSub?viewSub:(viewWin?viewWin:0));
}
NCursesWindow* getWindow(void) const {
return viewWin;
}
NCursesWindow* getSubWindow(void) const {
return viewSub;
}
virtual int driver (int key); // Virtualize keystroke key
// The driver translates the keystroke c into an Pad_Request
virtual void OnUnknownOperation(int pad_req) {
(void) pad_req;
::beep();
}
// This is called if the driver returns an unknown op-code
virtual void OnNavigationError(int pad_req) {
(void) pad_req;
::beep();
}
// This is called if a navigation request couldn't be satisfied
virtual void OnOperation(int pad_req) {
(void) pad_req;
};
// OnOperation is called if a Pad_Operation was executed and just before
// the refresh() operation is done.
public:
NCursesPad(int nlines, int ncols);
// create a pad with the given size
NCursesPad& operator=(const NCursesPad& rhs)
{
if (this != &rhs) {
*this = rhs;
NCursesWindow::operator=(rhs);
}
return *this;
}
NCursesPad(const NCursesPad& rhs)
: NCursesWindow(rhs),
viewWin(rhs.viewWin),
viewSub(rhs.viewSub),
h_gridsize(rhs.h_gridsize),
v_gridsize(rhs.v_gridsize),
min_row(rhs.min_row),
min_col(rhs.min_col)
{
}
virtual ~NCursesPad() {}
int echochar(const chtype ch) { return ::pechochar(w, ch); }
// Put the attributed character onto the pad and immediately do a
// prefresh().
int refresh();
// If a viewport is defined the pad is displayed in this window, otherwise
// this is a noop.
int refresh(int pminrow, int pmincol,
int sminrow, int smincol,
int smaxrow, int smaxcol) {
return ::prefresh(w, pminrow, pmincol,
sminrow, smincol, smaxrow, smaxcol);
}
// The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle
// on the screen. <b>refresh</b> copies a rectangle of this size beginning
// with top left corner pminrow,pmincol onto the screen and calls doupdate().
int noutrefresh();
// If a viewport is defined the pad is displayed in this window, otherwise
// this is a noop.
int noutrefresh(int pminrow, int pmincol,
int sminrow, int smincol,
int smaxrow, int smaxcol) {
return ::pnoutrefresh(w, pminrow, pmincol,
sminrow, smincol, smaxrow, smaxcol);
}
// Does the same as refresh() but without calling doupdate().
virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1);
// Add the window "view" as viewing window to the pad.
virtual void setSubWindow(NCursesWindow& sub);
// Use the subwindow "sub" of the viewport window for the actual viewing.
// The full viewport window is usually used to provide some decorations
// like frames, titles etc.
virtual void operator() (void);
// Perform Pad's operation
};
// A FramedPad is constructed always with a viewport window. This viewport
// will be framed (by a box() command) and the interior of the box is the
// viewport subwindow. On the frame we display scrollbar sliders.
class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad
{
protected:
virtual void OnOperation(int pad_req);
public:
NCursesFramedPad(NCursesWindow& win, int nlines, int ncols,
int v_grid = 1, int h_grid = 1)
: NCursesPad(nlines, ncols) {
NCursesPad::setWindow(win, v_grid, h_grid);
NCursesPad::setSubWindow(*(new NCursesWindow(win)));
}
// Construct the FramedPad with the given Window win as viewport.
virtual ~NCursesFramedPad() {
delete getSubWindow();
}
void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) {
(void) view;
(void) v_grid;
(void) h_grid;
err_handler("Operation not allowed");
}
// Disable this call; the viewport is already defined
void setSubWindow(NCursesWindow& sub) {
(void) sub;
err_handler("Operation not allowed");
}
// Disable this call; the viewport subwindow is already defined
};
#endif /* NCURSES_CURSESW_H_incl */
/****************************************************************************
* Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996 on *
****************************************************************************/
/*
* $Id: tic.h,v 1.75 2017/07/29 23:21:06 tom Exp $
* tic.h - Global variables and structures for the terminfo compiler.
*/
#ifndef __TIC_H
#define __TIC_H
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
#include <ncurses_cfg.h>
#include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
/*
** The format of SVr2 compiled terminfo files is as follows:
**
** Header (12 bytes), containing information given below
** Names Section, containing the names of the terminal
** Boolean Section, containing the values of all of the
** boolean capabilities
** A null byte may be inserted here to make
** sure that the Number Section begins on an
** even word boundary.
** Number Section, containing the values of all of the numeric
** capabilities, each as a short integer
** String Section, containing short integer offsets into the
** String Table, one per string capability
** String Table, containing the actual characters of the string
** capabilities.
**
** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes
** inconvenient. The numbers are signed, to provide for absent and canceled
** values. ncurses6.1 introduced an extension to this compiled format, by
** making the Number Section a list of signed 32-bit integers.
**
** NOTE that all short integers in the file are stored using VAX/PDP-style
** byte-order, i.e., least-significant byte first.
**
** There is no structure definition here because it would only confuse
** matters. Terminfo format is a raw byte layout, not a structure
** dump. If you happen to be on a little-endian machine with 16-bit
** shorts that requires no padding between short members in a struct,
** then there is a natural C structure that captures the header, but
** not very helpfully.
*/
#define MAGIC 0432 /* first two bytes of a compiled entry */
#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */
#undef BYTE
#define BYTE(p,n) (unsigned char)((p)[n])
#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2)
#define quick_prefix(s) (!strncmp((s), "b64:", 4) || !strncmp((s), "hex:", 4))
/*
* The "maximum" here is misleading; XSI guarantees minimum values, which a
* given implementation may exceed.
*/
#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */
#define MAX_ENTRY_SIZE1 4096 /* maximum legal entry size (SVr2) */
#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */
#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR
#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2
#else
#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1
#endif
/*
* The maximum size of individual name or alias is guaranteed in XSI to be at
* least 14, since that corresponds to the older filename lengths. Newer
* systems allow longer aliases, though not many terminal descriptions are
* written to use them. The MAX_ALIAS symbol is used for warnings.
*/
#if HAVE_LONG_FILE_NAMES
#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */
#else
#define MAX_ALIAS 14 /* SVr3 filename length */
#endif
/* location of user's personal info directory */
#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */
/*
* Some traces are designed to be used via tic's verbose option (and similar in
* infocmp and toe) rather than the 'trace()' function. So we use the bits
* above the normal trace() parameter as a debug-level.
*/
#define MAX_DEBUG_LEVEL 15
#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT)
#define set_trace_level(n) \
_nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL) \
+ DEBUG_LEVEL(MAX_DEBUG_LEVEL) - 1, \
_nc_tracing |= DEBUG_LEVEL(n)
#ifdef TRACE
#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a
#else
#define DEBUG(n, a) /*nothing*/
#endif
/*
* These are the types of tokens returned by the scanner. The first
* three are also used in the hash table of capability names. The scanner
* returns one of these values after loading the specifics into the global
* structure curr_token.
*/
#define BOOLEAN 0 /* Boolean capability */
#define NUMBER 1 /* Numeric capability */
#define STRING 2 /* String-valued capability */
#define CANCEL 3 /* Capability to be cancelled in following tc's */
#define NAMES 4 /* The names for a terminal type */
#define UNDEF 5 /* Undefined */
#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */
/*
* The global structure in which the specific parts of a
* scanned token are returned.
*/
struct token
{
char *tk_name; /* name of capability */
int tk_valnumber; /* value of capability (if a number) */
char *tk_valstring; /* value of capability (if a string) */
};
/*
* Offsets to string capabilities, with the corresponding functionkey codes.
*/
struct tinfo_fkeys {
unsigned offset;
chtype code;
};
typedef short HashValue;
/*
* The file comp_captab.c contains an array of these structures, one per
* possible capability. These are indexed by a hash table array of pointers to
* the same structures for use by the parser.
*/
struct name_table_entry
{
const char *nte_name; /* name to hash on */
int nte_type; /* BOOLEAN, NUMBER or STRING */
HashValue nte_index; /* index of associated variable in its array */
HashValue nte_link; /* index in table of next hash, or -1 */
};
/*
* Use this structure to hide differences between terminfo and termcap tables.
*/
typedef struct {
unsigned table_size;
const HashValue *table_data;
HashValue (*hash_of)(const char *);
int (*compare_names)(const char *, const char *);
} HashData;
struct alias
{
const char *from;
const char *to;
const char *source;
};
#define NOTFOUND ((struct name_table_entry *) 0)
/*
* The casts are required for correct sign-propagation with systems such as
* AIX, IRIX64, Solaris which default to unsigned characters. The C standard
* leaves this detail unspecified.
*/
/* out-of-band values for representing absent capabilities */
#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */
#define ABSENT_NUMERIC (-1)
#define ABSENT_STRING (char *)0
/* out-of-band values for representing cancels */
#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */
#define CANCELLED_NUMERIC (-2)
#define CANCELLED_STRING (char *)(-1)
#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
#define VALID_NUMERIC(s) ((s) >= 0)
#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
/* termcap entries longer than this may break old binaries */
#define MAX_TERMCAP_LENGTH 1023
/* this is a documented limitation of terminfo */
#define MAX_TERMINFO_LENGTH 4096
#ifndef TERMINFO
#define TERMINFO "/usr/share/terminfo"
#endif
#ifdef NCURSES_TERM_ENTRY_H_incl
/*
* These entrypoints are used only by the ncurses utilities such as tic.
*/
#ifdef NCURSES_INTERNALS
/* access.c */
extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *);
extern NCURSES_EXPORT(char *) _nc_basename (char *);
extern NCURSES_EXPORT(char *) _nc_rootname (char *);
/* comp_captab.c */
extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool);
extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool);
extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool);
/* comp_hash.c: name lookup */
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry
(const char *, int, bool);
/* comp_scan.c: lexical analysis */
extern NCURSES_EXPORT(int) _nc_get_token (bool);
extern NCURSES_EXPORT(void) _nc_panic_mode (char);
extern NCURSES_EXPORT(void) _nc_push_token (int);
extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
extern NCURSES_EXPORT_VAR(int) _nc_syntax;
extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
extern NCURSES_EXPORT_VAR(long) _nc_start_line;
#define SYN_TERMINFO 0
#define SYN_TERMCAP 1
/* comp_error.c: warning & abort messages */
extern NCURSES_EXPORT(const char *) _nc_get_source (void);
extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
extern NCURSES_EXPORT(void) _nc_get_type (char *name);
extern NCURSES_EXPORT(void) _nc_set_source (const char *const);
extern NCURSES_EXPORT(void) _nc_set_type (const char *const);
extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings;
/* comp_scan.c */
extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token;
/* captoinfo.c: capability conversion */
extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const);
extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const);
/* home_terminfo.c */
extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
/* init_keytry.c */
#if BROKEN_LINKER
#define _nc_tinfo_fkeys _nc_tinfo_fkeysf()
extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void);
#else
extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[];
#endif
/* lib_tparm.c */
#define NUM_PARM 9
extern NCURSES_EXPORT_VAR(int) _nc_tparm_err;
extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *);
/* lib_trace.c */
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
/* lib_tputs.c */
extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */
/* comp_main.c: compiler main */
extern const char * _nc_progname;
/* db_iterator.c */
extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
extern NCURSES_EXPORT(void) _nc_last_db(void);
/* write_entry.c */
extern NCURSES_EXPORT(int) _nc_tic_written (void);
#endif /* NCURSES_INTERNALS */
/*
* These entrypoints are used by tack.
*/
/* comp_hash.c: name lookup */
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry
(const char *, const HashValue *);
extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool);
/* comp_scan.c: lexical analysis */
extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *);
/* comp_expand.c: expand string into readable form */
extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int);
/* comp_scan.c: decode string from readable form */
extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *);
#endif /* NCURSES_TERM_ENTRY_H_incl */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* __TIC_H */
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: etip.h.in,v 1.41 2017/06/24 21:57:16 tom Exp $
#ifndef NCURSES_ETIP_H_incl
#define NCURSES_ETIP_H_incl 1
// These are substituted at configure/build time
#ifndef HAVE_BUILTIN_H
#define HAVE_BUILTIN_H 0
#endif
#ifndef HAVE_GXX_BUILTIN_H
#define HAVE_GXX_BUILTIN_H 0
#endif
#ifndef HAVE_GPP_BUILTIN_H
#define HAVE_GPP_BUILTIN_H 0
#endif
#ifndef HAVE_IOSTREAM
#define HAVE_IOSTREAM 1
#endif
#ifndef HAVE_TYPEINFO
#define HAVE_TYPEINFO 1
#endif
#ifndef HAVE_VALUES_H
#define HAVE_VALUES_H 0
#endif
#ifndef ETIP_NEEDS_MATH_H
#define ETIP_NEEDS_MATH_H 0
#endif
#ifndef ETIP_NEEDS_MATH_EXCEPTION
#define ETIP_NEEDS_MATH_EXCEPTION 0
#endif
#ifndef CPP_HAS_PARAM_INIT
#define CPP_HAS_PARAM_INIT 0
#endif
#ifndef CPP_HAS_STATIC_CAST
#define CPP_HAS_STATIC_CAST 1
#endif
#ifndef IOSTREAM_NAMESPACE
#define IOSTREAM_NAMESPACE 1
#endif
#ifdef __GNUG__
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
# if HAVE_TYPEINFO
# include <typeinfo>
# endif
# endif
#endif
#if defined(__GNUG__)
# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
# if ETIP_NEEDS_MATH_H
# if ETIP_NEEDS_MATH_EXCEPTION
# undef exception
# define exception math_exception
# endif
# include <math.h>
# endif
# undef exception
# define exception builtin_exception
# if HAVE_GPP_BUILTIN_H
# include <gpp/builtin.h>
# elif HAVE_GXX_BUILTIN_H
# include <g++/builtin.h>
# else
# include <builtin.h>
# endif
# undef exception
# endif
#elif defined (__SUNPRO_CC)
# include <generic.h>
#endif
#include <ncurses_dll.h>
extern "C" {
#if HAVE_VALUES_H
# include <values.h>
#endif
#include <assert.h>
#include <eti.h>
#include <errno.h>
}
// Language features
#if CPP_HAS_PARAM_INIT
#define NCURSES_PARAM_INIT(value) = value
#else
#define NCURSES_PARAM_INIT(value) /*nothing*/
#endif
#if CPP_HAS_STATIC_CAST
#define STATIC_CAST(s) static_cast<s>
#else
#define STATIC_CAST(s) (s)
#endif
// Forward Declarations
class NCURSES_IMPEXP NCursesPanel;
class NCURSES_IMPEXP NCursesMenu;
class NCURSES_IMPEXP NCursesForm;
class NCURSES_IMPEXP NCursesException
{
public:
const char *message;
int errorno;
NCursesException (const char* msg, int err)
: message(msg), errorno (err)
{};
NCursesException (const char* msg)
: message(msg), errorno (E_SYSTEM_ERROR)
{};
NCursesException& operator=(const NCursesException& rhs)
{
errorno = rhs.errorno;
return *this;
}
NCursesException(const NCursesException& rhs)
: message(rhs.message), errorno(rhs.errorno)
{
}
virtual const char *classname() const {
return "NCursesWindow";
}
virtual ~NCursesException()
{
}
};
class NCURSES_IMPEXP NCursesPanelException : public NCursesException
{
public:
const NCursesPanel* p;
NCursesPanelException (const char *msg, int err) :
NCursesException (msg, err),
p (0)
{};
NCursesPanelException (const NCursesPanel* panel,
const char *msg,
int err) :
NCursesException (msg, err),
p (panel)
{};
NCursesPanelException (int err) :
NCursesException ("panel library error", err),
p (0)
{};
NCursesPanelException (const NCursesPanel* panel,
int err) :
NCursesException ("panel library error", err),
p (panel)
{};
NCursesPanelException& operator=(const NCursesPanelException& rhs)
{
if (this != &rhs) {
NCursesException::operator=(rhs);
p = rhs.p;
}
return *this;
}
NCursesPanelException(const NCursesPanelException& rhs)
: NCursesException(rhs), p(rhs.p)
{
}
virtual const char *classname() const {
return "NCursesPanel";
}
virtual ~NCursesPanelException()
{
}
};
class NCURSES_IMPEXP NCursesMenuException : public NCursesException
{
public:
const NCursesMenu* m;
NCursesMenuException (const char *msg, int err) :
NCursesException (msg, err),
m (0)
{};
NCursesMenuException (const NCursesMenu* menu,
const char *msg,
int err) :
NCursesException (msg, err),
m (menu)
{};
NCursesMenuException (int err) :
NCursesException ("menu library error", err),
m (0)
{};
NCursesMenuException (const NCursesMenu* menu,
int err) :
NCursesException ("menu library error", err),
m (menu)
{};
NCursesMenuException& operator=(const NCursesMenuException& rhs)
{
if (this != &rhs) {
NCursesException::operator=(rhs);
m = rhs.m;
}
return *this;
}
NCursesMenuException(const NCursesMenuException& rhs)
: NCursesException(rhs), m(rhs.m)
{
}
virtual const char *classname() const {
return "NCursesMenu";
}
virtual ~NCursesMenuException()
{
}
};
class NCURSES_IMPEXP NCursesFormException : public NCursesException
{
public:
const NCursesForm* f;
NCursesFormException (const char *msg, int err) :
NCursesException (msg, err),
f (0)
{};
NCursesFormException (const NCursesForm* form,
const char *msg,
int err) :
NCursesException (msg, err),
f (form)
{};
NCursesFormException (int err) :
NCursesException ("form library error", err),
f (0)
{};
NCursesFormException (const NCursesForm* form,
int err) :
NCursesException ("form library error", err),
f (form)
{};
NCursesFormException& operator=(const NCursesFormException& rhs)
{
if (this != &rhs) {
NCursesException::operator=(rhs);
f = rhs.f;
}
return *this;
}
NCursesFormException(const NCursesFormException& rhs)
: NCursesException(rhs), f(rhs.f)
{
}
virtual const char *classname() const {
return "NCursesForm";
}
virtual ~NCursesFormException()
{
}
};
#if !((defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || defined(__SUNPRO_CC))
# if HAVE_IOSTREAM
# include <iostream>
# if IOSTREAM_NAMESPACE
using std::cerr;
using std::endl;
# endif
# else
# include <iostream.h>
# endif
extern "C" void exit(int);
#endif
inline void THROW(const NCursesException *e) {
#if defined(__GNUG__) && defined(__EXCEPTIONS)
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
(*lib_error_handler)(e ? e->classname() : "", e ? e->message : "");
# elif (__GNUG__ >= 7)
// g++ 7.0 warns about deprecation, but lacks the predefined symbols
::endwin();
std::cerr << "Found a problem - goodbye" << std::endl;
exit(EXIT_FAILURE);
# else
# define CPP_HAS_TRY_CATCH 1
# endif
#elif defined(__SUNPRO_CC)
# if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
# else
# define CPP_HAS_TRY_CATCH 1
# endif
#else
if (e)
cerr << e->message << endl;
exit(0);
#endif
#ifndef CPP_HAS_TRY_CATCH
#define CPP_HAS_TRY_CATCH 0
#define NCURSES_CPP_TRY /* nothing */
#define NCURSES_CPP_CATCH(e) if (false)
#define THROWS(s) /* nothing */
#define THROW2(s,t) /* nothing */
#elif CPP_HAS_TRY_CATCH
throw *e;
#define NCURSES_CPP_TRY try
#define NCURSES_CPP_CATCH(e) catch(e)
#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510)
// C++17 deprecates the usage of throw().
#define THROWS(s) /* nothing */
#define THROW2(s,t) /* nothing */
#else
#define THROWS(s) throw(s)
#define THROW2(s,t) throw(s,t)
#endif
#endif
}
#endif /* NCURSES_ETIP_H_incl */
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
/*
* unctrl.h
*
* Display a printable version of a control character.
* Control characters are displayed in caret notation (^x), DELETE is displayed
* as ^?. Printable characters are displayed as is.
*/
/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */
#ifndef NCURSES_UNCTRL_H_incl
#define NCURSES_UNCTRL_H_incl 1
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.1"
#ifdef __cplusplus
extern "C" {
#endif
#include <curses.h>
#undef unctrl
NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
#if 1
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
#endif
#ifdef __cplusplus
}
#endif
#endif /* NCURSES_UNCTRL_H_incl */
/****************************************************************************
* Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: menu.h,v 1.23 2017/02/11 16:54:04 tom Exp $ */
#ifndef ETI_MENU
#define ETI_MENU
#ifdef AMIGA
#define TEXT TEXT_ncurses
#endif
#include <curses.h>
#include <eti.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int Menu_Options;
typedef int Item_Options;
/* Menu options: */
#define O_ONEVALUE (0x01)
#define O_SHOWDESC (0x02)
#define O_ROWMAJOR (0x04)
#define O_IGNORECASE (0x08)
#define O_SHOWMATCH (0x10)
#define O_NONCYCLIC (0x20)
#define O_MOUSE_MENU (0x40)
/* Item options: */
#define O_SELECTABLE (0x01)
#if !NCURSES_OPAQUE_MENU
typedef struct
{
const char* str;
unsigned short length;
} TEXT;
#endif /* !NCURSES_OPAQUE_MENU */
struct tagMENU;
typedef struct tagITEM
#if !NCURSES_OPAQUE_MENU
{
TEXT name; /* name of menu item */
TEXT description; /* description of item, optional in display */
struct tagMENU *imenu; /* Pointer to parent menu */
void *userptr; /* Pointer to user defined per item data */
Item_Options opt; /* Item options */
short index; /* Item number if connected to a menu */
short y; /* y and x location of item in menu */
short x;
bool value; /* Selection value */
struct tagITEM *left; /* neighbor items */
struct tagITEM *right;
struct tagITEM *up;
struct tagITEM *down;
}
#endif /* !NCURSES_OPAQUE_MENU */
ITEM;
typedef void (*Menu_Hook)(struct tagMENU *);
typedef struct tagMENU
#if 1 /* not yet: !NCURSES_OPAQUE_MENU */
{
short height; /* Nr. of chars high */
short width; /* Nr. of chars wide */
short rows; /* Nr. of items high */
short cols; /* Nr. of items wide */
short frows; /* Nr. of formatted items high */
short fcols; /* Nr. of formatted items wide */
short arows; /* Nr. of items high (actual) */
short namelen; /* Max. name length */
short desclen; /* Max. description length */
short marklen; /* Length of mark, if any */
short itemlen; /* Length of one item */
short spc_desc; /* Spacing for descriptor */
short spc_cols; /* Spacing for columns */
short spc_rows; /* Spacing for rows */
char *pattern; /* Buffer to store match chars */
short pindex; /* Index into pattern buffer */
WINDOW *win; /* Window containing menu */
WINDOW *sub; /* Subwindow for menu display */
WINDOW *userwin; /* User's window */
WINDOW *usersub; /* User's subwindow */
ITEM **items; /* array of items */
short nitems; /* Nr. of items in menu */
ITEM *curitem; /* Current item */
short toprow; /* Top row of menu */
chtype fore; /* Selection attribute */
chtype back; /* Nonselection attribute */
chtype grey; /* Inactive attribute */
unsigned char pad; /* Pad character */
Menu_Hook menuinit; /* User hooks */
Menu_Hook menuterm;
Menu_Hook iteminit;
Menu_Hook itemterm;
void *userptr; /* Pointer to menus user data */
char *mark; /* Pointer to marker string */
Menu_Options opt; /* Menu options */
unsigned short status; /* Internal state of menu */
}
#endif /* !NCURSES_OPAQUE_MENU */
MENU;
/* Define keys */
#define REQ_LEFT_ITEM (KEY_MAX + 1)
#define REQ_RIGHT_ITEM (KEY_MAX + 2)
#define REQ_UP_ITEM (KEY_MAX + 3)
#define REQ_DOWN_ITEM (KEY_MAX + 4)
#define REQ_SCR_ULINE (KEY_MAX + 5)
#define REQ_SCR_DLINE (KEY_MAX + 6)
#define REQ_SCR_DPAGE (KEY_MAX + 7)
#define REQ_SCR_UPAGE (KEY_MAX + 8)
#define REQ_FIRST_ITEM (KEY_MAX + 9)
#define REQ_LAST_ITEM (KEY_MAX + 10)
#define REQ_NEXT_ITEM (KEY_MAX + 11)
#define REQ_PREV_ITEM (KEY_MAX + 12)
#define REQ_TOGGLE_ITEM (KEY_MAX + 13)
#define REQ_CLEAR_PATTERN (KEY_MAX + 14)
#define REQ_BACK_PATTERN (KEY_MAX + 15)
#define REQ_NEXT_MATCH (KEY_MAX + 16)
#define REQ_PREV_MATCH (KEY_MAX + 17)
#define MIN_MENU_COMMAND (KEY_MAX + 1)
#define MAX_MENU_COMMAND (KEY_MAX + 17)
/*
* Some AT&T code expects MAX_COMMAND to be out-of-band not
* just for menu commands but for forms ones as well.
*/
#if defined(MAX_COMMAND)
# if (MAX_MENU_COMMAND > MAX_COMMAND)
# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
# elif (MAX_COMMAND != (KEY_MAX + 128))
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
# endif
#else
# define MAX_COMMAND (KEY_MAX + 128)
#endif
/* --------- prototypes for libmenu functions ----------------------------- */
extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *);
extern NCURSES_EXPORT(ITEM *) current_item (const MENU *);
extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *);
extern NCURSES_EXPORT(MENU *) new_menu (ITEM **);
extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *);
extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *);
extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *);
extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *);
extern NCURSES_EXPORT(const char *) item_description (const ITEM *);
extern NCURSES_EXPORT(const char *) item_name (const ITEM *);
extern NCURSES_EXPORT(const char *) menu_mark (const MENU *);
extern NCURSES_EXPORT(const char *) menu_request_name (int);
extern NCURSES_EXPORT(char *) menu_pattern (const MENU *);
extern NCURSES_EXPORT(void *) menu_userptr (const MENU *);
extern NCURSES_EXPORT(void *) item_userptr (const ITEM *);
extern NCURSES_EXPORT(chtype) menu_back (const MENU *);
extern NCURSES_EXPORT(chtype) menu_fore (const MENU *);
extern NCURSES_EXPORT(chtype) menu_grey (const MENU *);
extern NCURSES_EXPORT(int) free_item (ITEM *);
extern NCURSES_EXPORT(int) free_menu (MENU *);
extern NCURSES_EXPORT(int) item_count (const MENU *);
extern NCURSES_EXPORT(int) item_index (const ITEM *);
extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options);
extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options);
extern NCURSES_EXPORT(int) menu_driver (MENU *,int);
extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options);
extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options);
extern NCURSES_EXPORT(int) menu_pad (const MENU *);
extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *);
extern NCURSES_EXPORT(int) post_menu (MENU *);
extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *);
extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item);
extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options);
extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *);
extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool);
extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype);
extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype);
extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int);
extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype);
extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **);
extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *);
extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options);
extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int);
extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *);
extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *);
extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *);
extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *);
extern NCURSES_EXPORT(int) set_top_row (MENU *,int);
extern NCURSES_EXPORT(int) top_row (const MENU *);
extern NCURSES_EXPORT(int) unpost_menu (MENU *);
extern NCURSES_EXPORT(int) menu_request_by_name (const char *);
extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int);
extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *);
extern NCURSES_EXPORT(bool) item_value (const ITEM *);
extern NCURSES_EXPORT(bool) item_visible (const ITEM *);
extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
#endif
#ifdef __cplusplus
}
#endif
#endif /* ETI_MENU */
// lua.hpp
// Lua header files for C++
// <<extern "C">> not supplied automatically because Lua also compiles as C++
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SEMAPHORE_H
#define _SEMAPHORE_H 1
#include <features.h>
#include <sys/types.h>
#ifdef __USE_XOPEN2K
# include <bits/types/struct_timespec.h>
#endif
/* Get the definition for sem_t. */
#include <bits/semaphore.h>
__BEGIN_DECLS
/* Initialize semaphore object SEM to VALUE. If PSHARED then share it
with other processes. */
extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value)
__THROW;
/* Free resources associated with semaphore object SEM. */
extern int sem_destroy (sem_t *__sem) __THROW;
/* Open a named semaphore NAME with open flags OFLAG. */
extern sem_t *sem_open (const char *__name, int __oflag, ...) __THROW;
/* Close descriptor for named semaphore SEM. */
extern int sem_close (sem_t *__sem) __THROW;
/* Remove named semaphore NAME. */
extern int sem_unlink (const char *__name) __THROW;
/* Wait for SEM being posted.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int sem_wait (sem_t *__sem);
#ifdef __USE_XOPEN2K
/* Similar to `sem_wait' but wait only until ABSTIME.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int sem_timedwait (sem_t *__restrict __sem,
const struct timespec *__restrict __abstime);
#endif
/* Test whether SEM is posted. */
extern int sem_trywait (sem_t *__sem) __THROWNL;
/* Post SEM. */
extern int sem_post (sem_t *__sem) __THROWNL;
/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
__THROW;
__END_DECLS
#endif /* semaphore.h */
/*
* Header file for common error description library.
*
* Copyright 1988, Student Information Processing Board of the
* Massachusetts Institute of Technology.
*
* For copyright and distribution info, see the documentation supplied
* with this package.
*/
#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
#ifdef __GNUC__
#define COM_ERR_ATTR(x) __attribute__(x)
#else
#define COM_ERR_ATTR(x)
#endif
#include <stddef.h>
#include <stdarg.h>
typedef long errcode_t;
struct error_table {
char const * const * msgs;
long base;
int n_msgs;
};
struct et_list;
extern void com_err (const char *, long, const char *, ...)
COM_ERR_ATTR((format(printf, 3, 4)));
extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
va_list args)
COM_ERR_ATTR((format(printf, 3, 0)));
extern char const *error_message (long);
extern void (*com_err_hook) (const char *, long, const char *, va_list);
extern void (*set_com_err_hook (void (*) (const char *, long,
const char *, va_list)))
(const char *, long, const char *, va_list);
extern void (*reset_com_err_hook (void)) (const char *, long,
const char *, va_list);
extern int init_error_table(const char * const *msgs, long base, int count);
extern char *(*set_com_err_gettext (char *(*) (const char *)))
(const char *);
extern errcode_t add_error_table(const struct error_table * et);
extern errcode_t remove_error_table(const struct error_table * et);
extern void add_to_error_table(struct et_list *new_table);
/* Provided for Heimdall compatibility */
extern const char *com_right(struct et_list *list, long code);
extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len);
extern void initialize_error_table_r(struct et_list **list,
const char **messages,
int num_errors,
long base);
extern void free_error_table(struct et_list *et);
/* Provided for compatibility with other com_err libraries */
extern int et_list_lock(void);
extern int et_list_unlock(void);
#define __COM_ERR_H
#define __COM_ERR_H__
#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols and init macros */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define adler32_z z_adler32_z
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateGetDictionary z_deflateGetDictionary
# define deflateInit z_deflateInit
# define deflateInit2 z_deflateInit2
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzfread z_gzfread
# define gzfwrite z_gzfwrite
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzvprintf z_gzvprintf
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit z_inflateBackInit
# define inflateBackInit_ z_inflateBackInit_
# define inflateCodesUsed z_inflateCodesUsed
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetDictionary z_inflateGetDictionary
# define inflateGetHeader z_inflateGetHeader
# define inflateInit z_inflateInit
# define inflateInit2 z_inflateInit2
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateResetKeep z_inflateResetKeep
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateValidate z_inflateValidate
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# define uncompress2 z_uncompress2
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
#ifdef Z_SOLO
typedef unsigned long z_size_t;
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
typedef unsigned NO_SIZE_T z_size_t;
# elif defined(STDC)
# include <stddef.h>
typedef size_t z_size_t;
# else
typedef unsigned long z_size_t;
# endif
# undef z_longlong
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#if 1 /* was set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#if 1 /* was set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Define interface to NSS. This is meant for the interface functions
and for implementors of new services. */
#ifndef _NSS_H
#define _NSS_H 1
#include <features.h>
#include <stdint.h>
__BEGIN_DECLS
/* Possible results of lookup using a nss_* function. */
enum nss_status
{
NSS_STATUS_TRYAGAIN = -2,
NSS_STATUS_UNAVAIL,
NSS_STATUS_NOTFOUND,
NSS_STATUS_SUCCESS,
NSS_STATUS_RETURN
};
/* Data structure used for the 'gethostbyname4_r' function. */
struct gaih_addrtuple
{
struct gaih_addrtuple *next;
char *name;
int family;
uint32_t addr[4];
uint32_t scopeid;
};
/* Overwrite service selection for database DBNAME using specification
in STRING.
This function should only be used by system programs which have to
work around non-existing services (e.e., while booting).
Attention: Using this function repeatedly will slowly eat up the
whole memory since previous selection data cannot be freed. */
extern int __nss_configure_lookup (const char *__dbname,
const char *__string) __THROW;
__END_DECLS
#endif /* nss.h */
/*
* fontconfig/fontconfig/fcprivate.h
*
* Copyright © 2001 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the author(s) not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _FCPRIVATE_H_
#define _FCPRIVATE_H_
/*
* I tried this with functions that took va_list* arguments
* but portability concerns made me change these functions
* into macros (sigh).
*/
#define FcPatternVapBuild(result, orig, va) \
{ \
FcPattern *__p__ = (orig); \
const char *__o__; \
FcValue __v__; \
\
if (!__p__) \
{ \
__p__ = FcPatternCreate (); \
if (!__p__) \
goto _FcPatternVapBuild_bail0; \
} \
for (;;) \
{ \
__o__ = va_arg (va, const char *); \
if (!__o__) \
break; \
__v__.type = va_arg (va, int); \
switch (__v__.type) { \
case FcTypeUnknown: \
case FcTypeVoid: \
goto _FcPatternVapBuild_bail1; \
case FcTypeInteger: \
__v__.u.i = va_arg (va, int); \
break; \
case FcTypeDouble: \
__v__.u.d = va_arg (va, double); \
break; \
case FcTypeString: \
__v__.u.s = va_arg (va, const FcChar8 *); \
break; \
case FcTypeBool: \
__v__.u.b = va_arg (va, FcBool); \
break; \
case FcTypeMatrix: \
__v__.u.m = va_arg (va, const FcMatrix *); \
break; \
case FcTypeCharSet: \
__v__.u.c = va_arg (va, const FcCharSet *); \
break; \
case FcTypeFTFace: \
__v__.u.f = va_arg (va, FT_Face); \
break; \
case FcTypeLangSet: \
__v__.u.l = va_arg (va, const FcLangSet *); \
break; \
case FcTypeRange: \
__v__.u.r = va_arg (va, const FcRange *); \
break; \
} \
if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
goto _FcPatternVapBuild_bail1; \
} \
result = __p__; \
goto _FcPatternVapBuild_return; \
\
_FcPatternVapBuild_bail1: \
if (!orig) \
FcPatternDestroy (__p__); \
_FcPatternVapBuild_bail0: \
result = (void*)0; \
\
_FcPatternVapBuild_return: \
; \
}
#define FcObjectSetVapBuild(__ret__, __first__, __va__) \
{ \
FcObjectSet *__os__; \
const char *__ob__; \
\
__ret__ = 0; \
__os__ = FcObjectSetCreate (); \
if (!__os__) \
goto _FcObjectSetVapBuild_bail0; \
__ob__ = __first__; \
while (__ob__) \
{ \
if (!FcObjectSetAdd (__os__, __ob__)) \
goto _FcObjectSetVapBuild_bail1; \
__ob__ = va_arg (__va__, const char *); \
} \
__ret__ = __os__; \
\
_FcObjectSetVapBuild_bail1: \
if (!__ret__ && __os__) \
FcObjectSetDestroy (__os__); \
_FcObjectSetVapBuild_bail0: \
; \
}
#ifndef FC_ATTRIBUTE_VISIBILITY_HIDDEN
#define FC_ATTRIBUTE_VISIBILITY_HIDDEN __attribute((visibility("hidden")))
#endif
#ifndef FC_ATTRIBUTE_VISIBILITY_EXPORT
#define FC_ATTRIBUTE_VISIBILITY_EXPORT __attribute((visibility("default")))
#endif
#endif /* _FCPRIVATE_H_ */
/*
* fontconfig/fontconfig/fcfreetype.h
*
* Copyright © 2001 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the author(s) not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _FCFREETYPE_H_
#define _FCFREETYPE_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifndef FcPublic
#define FcPublic
#endif
_FCFUNCPROTOBEGIN
FcPublic FT_UInt
FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
FcPublic FcCharSet *
FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing);
FcPublic FcCharSet *
FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks);
FcPublic FcResult
FcPatternGetFTFace (const FcPattern *p, const char *object, int n, FT_Face *f);
FcPublic FcBool
FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
FcPublic FcPattern *
FcFreeTypeQueryFace (const FT_Face face,
const FcChar8 *file,
unsigned int id,
FcBlanks *blanks);
_FCFUNCPROTOEND
#endif
/*
* fontconfig/fontconfig/fontconfig.h
*
* Copyright © 2001 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the author(s) not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _FONTCONFIG_H_
#define _FONTCONFIG_H_
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <limits.h>
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0)))
#else
#define FC_ATTRIBUTE_SENTINEL(x)
#endif
#ifndef FcPublic
#define FcPublic
#endif
typedef unsigned char FcChar8;
typedef unsigned short FcChar16;
typedef unsigned int FcChar32;
typedef int FcBool;
/*
* Current Fontconfig version number. This same number
* must appear in the fontconfig configure.in file. Yes,
* it'a a pain to synchronize version numbers like this.
*/
#define FC_MAJOR 2
#define FC_MINOR 13
#define FC_REVISION 1
#define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
/*
* Current font cache file format version
* This is appended to the cache files so that multiple
* versions of the library will peacefully coexist
*
* Change this value whenever the disk format for the cache file
* changes in any non-compatible way. Try to avoid such changes as
* it means multiple copies of the font information.
*/
#define FC_CACHE_VERSION_NUMBER 7
#define _FC_STRINGIFY_(s) #s
#define _FC_STRINGIFY(s) _FC_STRINGIFY_(s)
#define FC_CACHE_VERSION _FC_STRINGIFY(FC_CACHE_VERSION_NUMBER)
#define FcFalse 0
#define FcTrue 1
#define FcDontCare 2
#define FC_FAMILY "family" /* String */
#define FC_STYLE "style" /* String */
#define FC_SLANT "slant" /* Int */
#define FC_WEIGHT "weight" /* Int */
#define FC_SIZE "size" /* Range (double) */
#define FC_ASPECT "aspect" /* Double */
#define FC_PIXEL_SIZE "pixelsize" /* Double */
#define FC_SPACING "spacing" /* Int */
#define FC_FOUNDRY "foundry" /* String */
#define FC_ANTIALIAS "antialias" /* Bool (depends) */
#define FC_HINTING "hinting" /* Bool (true) */
#define FC_HINT_STYLE "hintstyle" /* Int */
#define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
#define FC_AUTOHINT "autohint" /* Bool (false) */
/* FC_GLOBAL_ADVANCE is deprecated. this is simply ignored on freetype 2.4.5 or later */
#define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
#define FC_WIDTH "width" /* Int */
#define FC_FILE "file" /* String */
#define FC_INDEX "index" /* Int */
#define FC_FT_FACE "ftface" /* FT_Face */
#define FC_RASTERIZER "rasterizer" /* String (deprecated) */
#define FC_OUTLINE "outline" /* Bool */
#define FC_SCALABLE "scalable" /* Bool */
#define FC_COLOR "color" /* Bool */
#define FC_VARIABLE "variable" /* Bool */
#define FC_SCALE "scale" /* double (deprecated) */
#define FC_SYMBOL "symbol" /* Bool */
#define FC_DPI "dpi" /* double */
#define FC_RGBA "rgba" /* Int */
#define FC_MINSPACE "minspace" /* Bool use minimum line spacing */
#define FC_SOURCE "source" /* String (deprecated) */
#define FC_CHARSET "charset" /* CharSet */
#define FC_LANG "lang" /* String RFC 3066 langs */
#define FC_FONTVERSION "fontversion" /* Int from 'head' table */
#define FC_FULLNAME "fullname" /* String */
#define FC_FAMILYLANG "familylang" /* String RFC 3066 langs */
#define FC_STYLELANG "stylelang" /* String RFC 3066 langs */
#define FC_FULLNAMELANG "fullnamelang" /* String RFC 3066 langs */
#define FC_CAPABILITY "capability" /* String */
#define FC_FONTFORMAT "fontformat" /* String */
#define FC_EMBOLDEN "embolden" /* Bool - true if emboldening needed*/
#define FC_EMBEDDED_BITMAP "embeddedbitmap" /* Bool - true to enable embedded bitmaps */
#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */
#define FC_LCD_FILTER "lcdfilter" /* Int */
#define FC_FONT_FEATURES "fontfeatures" /* String */
#define FC_FONT_VARIATIONS "fontvariations" /* String */
#define FC_NAMELANG "namelang" /* String RFC 3866 langs */
#define FC_PRGNAME "prgname" /* String */
#define FC_HASH "hash" /* String (deprecated) */
#define FC_POSTSCRIPT_NAME "postscriptname" /* String */
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
#define FC_USER_CACHE_FILE ".fonts.cache-" FC_CACHE_VERSION
/* Adjust outline rasterizer */
#define FC_CHARWIDTH "charwidth" /* Int */
#define FC_CHAR_WIDTH FC_CHARWIDTH
#define FC_CHAR_HEIGHT "charheight"/* Int */
#define FC_MATRIX "matrix" /* FcMatrix */
#define FC_WEIGHT_THIN 0
#define FC_WEIGHT_EXTRALIGHT 40
#define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
#define FC_WEIGHT_LIGHT 50
#define FC_WEIGHT_DEMILIGHT 55
#define FC_WEIGHT_SEMILIGHT FC_WEIGHT_DEMILIGHT
#define FC_WEIGHT_BOOK 75
#define FC_WEIGHT_REGULAR 80
#define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
#define FC_WEIGHT_MEDIUM 100
#define FC_WEIGHT_DEMIBOLD 180
#define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
#define FC_WEIGHT_BOLD 200
#define FC_WEIGHT_EXTRABOLD 205
#define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD
#define FC_WEIGHT_BLACK 210
#define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
#define FC_WEIGHT_EXTRABLACK 215
#define FC_WEIGHT_ULTRABLACK FC_WEIGHT_EXTRABLACK
#define FC_SLANT_ROMAN 0
#define FC_SLANT_ITALIC 100
#define FC_SLANT_OBLIQUE 110
#define FC_WIDTH_ULTRACONDENSED 50
#define FC_WIDTH_EXTRACONDENSED 63
#define FC_WIDTH_CONDENSED 75
#define FC_WIDTH_SEMICONDENSED 87
#define FC_WIDTH_NORMAL 100
#define FC_WIDTH_SEMIEXPANDED 113
#define FC_WIDTH_EXPANDED 125
#define FC_WIDTH_EXTRAEXPANDED 150
#define FC_WIDTH_ULTRAEXPANDED 200
#define FC_PROPORTIONAL 0
#define FC_DUAL 90
#define FC_MONO 100
#define FC_CHARCELL 110
/* sub-pixel order */
#define FC_RGBA_UNKNOWN 0
#define FC_RGBA_RGB 1
#define FC_RGBA_BGR 2
#define FC_RGBA_VRGB 3
#define FC_RGBA_VBGR 4
#define FC_RGBA_NONE 5
/* hinting style */
#define FC_HINT_NONE 0
#define FC_HINT_SLIGHT 1
#define FC_HINT_MEDIUM 2
#define FC_HINT_FULL 3
/* LCD filter */
#define FC_LCD_NONE 0
#define FC_LCD_DEFAULT 1
#define FC_LCD_LIGHT 2
#define FC_LCD_LEGACY 3
typedef enum _FcType {
FcTypeUnknown = -1,
FcTypeVoid,
FcTypeInteger,
FcTypeDouble,
FcTypeString,
FcTypeBool,
FcTypeMatrix,
FcTypeCharSet,
FcTypeFTFace,
FcTypeLangSet,
FcTypeRange
} FcType;
typedef struct _FcMatrix {
double xx, xy, yx, yy;
} FcMatrix;
#define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
(m)->xy = (m)->yx = 0)
/*
* A data structure to represent the available glyphs in a font.
* This is represented as a sparse boolean btree.
*/
typedef struct _FcCharSet FcCharSet;
typedef struct _FcObjectType {
char *object;
FcType type;
} FcObjectType;
typedef struct _FcConstant {
const FcChar8 *name;
const char *object;
int value;
} FcConstant;
typedef enum _FcResult {
FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId,
FcResultOutOfMemory
} FcResult;
typedef enum _FcValueBinding {
FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
/* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
FcValueBindingEnd = INT_MAX
} FcValueBinding;
typedef struct _FcPattern FcPattern;
typedef struct _FcPatternIter {
void *dummy1;
void *dummy2;
} FcPatternIter;
typedef struct _FcLangSet FcLangSet;
typedef struct _FcRange FcRange;
typedef struct _FcValue {
FcType type;
union {
const FcChar8 *s;
int i;
FcBool b;
double d;
const FcMatrix *m;
const FcCharSet *c;
void *f;
const FcLangSet *l;
const FcRange *r;
} u;
} FcValue;
typedef struct _FcFontSet {
int nfont;
int sfont;
FcPattern **fonts;
} FcFontSet;
typedef struct _FcObjectSet {
int nobject;
int sobject;
const char **objects;
} FcObjectSet;
typedef enum _FcMatchKind {
FcMatchPattern, FcMatchFont, FcMatchScan,
FcMatchKindEnd,
FcMatchKindBegin = FcMatchPattern
} FcMatchKind;
typedef enum _FcLangResult {
FcLangEqual = 0,
FcLangDifferentCountry = 1,
FcLangDifferentTerritory = 1,
FcLangDifferentLang = 2
} FcLangResult;
typedef enum _FcSetName {
FcSetSystem = 0,
FcSetApplication = 1
} FcSetName;
typedef struct _FcConfigFileInfoIter {
void *dummy1;
void *dummy2;
void *dummy3;
} FcConfigFileInfoIter;
typedef struct _FcAtomic FcAtomic;
#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
#define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
#define _FCFUNCPROTOEND }
#else
#define _FCFUNCPROTOBEGIN
#define _FCFUNCPROTOEND
#endif
typedef enum { FcEndianBig, FcEndianLittle } FcEndian;
typedef struct _FcConfig FcConfig;
typedef struct _FcGlobalCache FcFileCache;
typedef struct _FcBlanks FcBlanks;
typedef struct _FcStrList FcStrList;
typedef struct _FcStrSet FcStrSet;
typedef struct _FcCache FcCache;
_FCFUNCPROTOBEGIN
/* fcblanks.c */
FcPublic FcBlanks *
FcBlanksCreate (void);
FcPublic void
FcBlanksDestroy (FcBlanks *b);
FcPublic FcBool
FcBlanksAdd (FcBlanks *b, FcChar32 ucs4);
FcPublic FcBool
FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
/* fccache.c */
FcPublic const FcChar8 *
FcCacheDir(const FcCache *c);
FcPublic FcFontSet *
FcCacheCopySet(const FcCache *c);
FcPublic const FcChar8 *
FcCacheSubdir (const FcCache *c, int i);
FcPublic int
FcCacheNumSubdir (const FcCache *c);
FcPublic int
FcCacheNumFont (const FcCache *c);
FcPublic FcBool
FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config);
FcPublic FcBool
FcDirCacheValid (const FcChar8 *cache_file);
FcPublic FcBool
FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose);
FcPublic void
FcCacheCreateTagFile (const FcConfig *config);
FcPublic FcBool
FcDirCacheCreateUUID (FcChar8 *dir,
FcBool force,
FcConfig *config);
FcPublic FcBool
FcDirCacheDeleteUUID (const FcChar8 *dir,
FcConfig *config);
/* fccfg.c */
FcPublic FcChar8 *
FcConfigHome (void);
FcPublic FcBool
FcConfigEnableHome (FcBool enable);
FcPublic FcChar8 *
FcConfigFilename (const FcChar8 *url);
FcPublic FcConfig *
FcConfigCreate (void);
FcPublic FcConfig *
FcConfigReference (FcConfig *config);
FcPublic void
FcConfigDestroy (FcConfig *config);
FcPublic FcBool
FcConfigSetCurrent (FcConfig *config);
FcPublic FcConfig *
FcConfigGetCurrent (void);
FcPublic FcBool
FcConfigUptoDate (FcConfig *config);
FcPublic FcBool
FcConfigBuildFonts (FcConfig *config);
FcPublic FcStrList *
FcConfigGetFontDirs (FcConfig *config);
FcPublic FcStrList *
FcConfigGetConfigDirs (FcConfig *config);
FcPublic FcStrList *
FcConfigGetConfigFiles (FcConfig *config);
FcPublic FcChar8 *
FcConfigGetCache (FcConfig *config);
FcPublic FcBlanks *
FcConfigGetBlanks (FcConfig *config);
FcPublic FcStrList *
FcConfigGetCacheDirs (const FcConfig *config);
FcPublic int
FcConfigGetRescanInterval (FcConfig *config);
FcPublic FcBool
FcConfigSetRescanInterval (FcConfig *config, int rescanInterval);
FcPublic FcFontSet *
FcConfigGetFonts (FcConfig *config,
FcSetName set);
FcPublic FcBool
FcConfigAppFontAddFile (FcConfig *config,
const FcChar8 *file);
FcPublic FcBool
FcConfigAppFontAddDir (FcConfig *config,
const FcChar8 *dir);
FcPublic void
FcConfigAppFontClear (FcConfig *config);
FcPublic FcBool
FcConfigSubstituteWithPat (FcConfig *config,
FcPattern *p,
FcPattern *p_pat,
FcMatchKind kind);
FcPublic FcBool
FcConfigSubstitute (FcConfig *config,
FcPattern *p,
FcMatchKind kind);
FcPublic const FcChar8 *
FcConfigGetSysRoot (const FcConfig *config);
FcPublic void
FcConfigSetSysRoot (FcConfig *config,
const FcChar8 *sysroot);
FcPublic void
FcConfigFileInfoIterInit (FcConfig *config,
FcConfigFileInfoIter *iter);
FcPublic FcBool
FcConfigFileInfoIterNext (FcConfig *config,
FcConfigFileInfoIter *iter);
FcPublic FcBool
FcConfigFileInfoIterGet (FcConfig *config,
FcConfigFileInfoIter *iter,
FcChar8 **name,
FcChar8 **description,
FcBool *enabled);
/* fccharset.c */
FcPublic FcCharSet*
FcCharSetCreate (void);
/* deprecated alias for FcCharSetCreate */
FcPublic FcCharSet *
FcCharSetNew (void);
FcPublic void
FcCharSetDestroy (FcCharSet *fcs);
FcPublic FcBool
FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
FcPublic FcBool
FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4);
FcPublic FcCharSet*
FcCharSetCopy (FcCharSet *src);
FcPublic FcBool
FcCharSetEqual (const FcCharSet *a, const FcCharSet *b);
FcPublic FcCharSet*
FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b);
FcPublic FcCharSet*
FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
FcPublic FcCharSet*
FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b);
FcPublic FcBool
FcCharSetMerge (FcCharSet *a, const FcCharSet *b, FcBool *changed);
FcPublic FcBool
FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4);
FcPublic FcChar32
FcCharSetCount (const FcCharSet *a);
FcPublic FcChar32
FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
FcPublic FcChar32
FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
FcPublic FcBool
FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b);
#define FC_CHARSET_MAP_SIZE (256/32)
#define FC_CHARSET_DONE ((FcChar32) -1)
FcPublic FcChar32
FcCharSetFirstPage (const FcCharSet *a,
FcChar32 map[FC_CHARSET_MAP_SIZE],
FcChar32 *next);
FcPublic FcChar32
FcCharSetNextPage (const FcCharSet *a,
FcChar32 map[FC_CHARSET_MAP_SIZE],
FcChar32 *next);
/*
* old coverage API, rather hard to use correctly
*/
FcPublic FcChar32
FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result);
/* fcdbg.c */
FcPublic void
FcValuePrint (const FcValue v);
FcPublic void
FcPatternPrint (const FcPattern *p);
FcPublic void
FcFontSetPrint (const FcFontSet *s);
/* fcdefault.c */
FcPublic FcStrSet *
FcGetDefaultLangs (void);
FcPublic void
FcDefaultSubstitute (FcPattern *pattern);
/* fcdir.c */
FcPublic FcBool
FcFileIsDir (const FcChar8 *file);
FcPublic FcBool
FcFileScan (FcFontSet *set,
FcStrSet *dirs,
FcFileCache *cache,
FcBlanks *blanks,
const FcChar8 *file,
FcBool force);
FcPublic FcBool
FcDirScan (FcFontSet *set,
FcStrSet *dirs,
FcFileCache *cache,
FcBlanks *blanks,
const FcChar8 *dir,
FcBool force);
FcPublic FcBool
FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
FcPublic FcCache *
FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file);
FcPublic FcCache *
FcDirCacheRescan (const FcChar8 *dir, FcConfig *config);
FcPublic FcCache *
FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config);
FcPublic FcCache *
FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat);
FcPublic void
FcDirCacheUnload (FcCache *cache);
/* fcfreetype.c */
FcPublic FcPattern *
FcFreeTypeQuery (const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count);
FcPublic unsigned int
FcFreeTypeQueryAll(const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count, FcFontSet *set);
/* fcfs.c */
FcPublic FcFontSet *
FcFontSetCreate (void);
FcPublic void
FcFontSetDestroy (FcFontSet *s);
FcPublic FcBool
FcFontSetAdd (FcFontSet *s, FcPattern *font);
/* fcinit.c */
FcPublic FcConfig *
FcInitLoadConfig (void);
FcPublic FcConfig *
FcInitLoadConfigAndFonts (void);
FcPublic FcBool
FcInit (void);
FcPublic void
FcFini (void);
FcPublic int
FcGetVersion (void);
FcPublic FcBool
FcInitReinitialize (void);
FcPublic FcBool
FcInitBringUptoDate (void);
/* fclang.c */
FcPublic FcStrSet *
FcGetLangs (void);
FcPublic FcChar8 *
FcLangNormalize (const FcChar8 *lang);
FcPublic const FcCharSet *
FcLangGetCharSet (const FcChar8 *lang);
FcPublic FcLangSet*
FcLangSetCreate (void);
FcPublic void
FcLangSetDestroy (FcLangSet *ls);
FcPublic FcLangSet*
FcLangSetCopy (const FcLangSet *ls);
FcPublic FcBool
FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang);
FcPublic FcBool
FcLangSetDel (FcLangSet *ls, const FcChar8 *lang);
FcPublic FcLangResult
FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang);
FcPublic FcLangResult
FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb);
FcPublic FcBool
FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb);
FcPublic FcBool
FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb);
FcPublic FcChar32
FcLangSetHash (const FcLangSet *ls);
FcPublic FcStrSet *
FcLangSetGetLangs (const FcLangSet *ls);
FcPublic FcLangSet *
FcLangSetUnion (const FcLangSet *a, const FcLangSet *b);
FcPublic FcLangSet *
FcLangSetSubtract (const FcLangSet *a, const FcLangSet *b);
/* fclist.c */
FcPublic FcObjectSet *
FcObjectSetCreate (void);
FcPublic FcBool
FcObjectSetAdd (FcObjectSet *os, const char *object);
FcPublic void
FcObjectSetDestroy (FcObjectSet *os);
FcPublic FcObjectSet *
FcObjectSetVaBuild (const char *first, va_list va);
FcPublic FcObjectSet *
FcObjectSetBuild (const char *first, ...) FC_ATTRIBUTE_SENTINEL(0);
FcPublic FcFontSet *
FcFontSetList (FcConfig *config,
FcFontSet **sets,
int nsets,
FcPattern *p,
FcObjectSet *os);
FcPublic FcFontSet *
FcFontList (FcConfig *config,
FcPattern *p,
FcObjectSet *os);
/* fcatomic.c */
FcPublic FcAtomic *
FcAtomicCreate (const FcChar8 *file);
FcPublic FcBool
FcAtomicLock (FcAtomic *atomic);
FcPublic FcChar8 *
FcAtomicNewFile (FcAtomic *atomic);
FcPublic FcChar8 *
FcAtomicOrigFile (FcAtomic *atomic);
FcPublic FcBool
FcAtomicReplaceOrig (FcAtomic *atomic);
FcPublic void
FcAtomicDeleteNew (FcAtomic *atomic);
FcPublic void
FcAtomicUnlock (FcAtomic *atomic);
FcPublic void
FcAtomicDestroy (FcAtomic *atomic);
/* fcmatch.c */
FcPublic FcPattern *
FcFontSetMatch (FcConfig *config,
FcFontSet **sets,
int nsets,
FcPattern *p,
FcResult *result);
FcPublic FcPattern *
FcFontMatch (FcConfig *config,
FcPattern *p,
FcResult *result);
FcPublic FcPattern *
FcFontRenderPrepare (FcConfig *config,
FcPattern *pat,
FcPattern *font);
FcPublic FcFontSet *
FcFontSetSort (FcConfig *config,
FcFontSet **sets,
int nsets,
FcPattern *p,
FcBool trim,
FcCharSet **csp,
FcResult *result);
FcPublic FcFontSet *
FcFontSort (FcConfig *config,
FcPattern *p,
FcBool trim,
FcCharSet **csp,
FcResult *result);
FcPublic void
FcFontSetSortDestroy (FcFontSet *fs);
/* fcmatrix.c */
FcPublic FcMatrix *
FcMatrixCopy (const FcMatrix *mat);
FcPublic FcBool
FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2);
FcPublic void
FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b);
FcPublic void
FcMatrixRotate (FcMatrix *m, double c, double s);
FcPublic void
FcMatrixScale (FcMatrix *m, double sx, double sy);
FcPublic void
FcMatrixShear (FcMatrix *m, double sh, double sv);
/* fcname.c */
/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
FcPublic const FcObjectType *
FcNameGetObjectType (const char *object);
/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameRegisterConstants (const FcConstant *consts, int nconsts);
/* Deprecated. Does nothing. Returns FcFalse. */
FcPublic FcBool
FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
FcPublic const FcConstant *
FcNameGetConstant (const FcChar8 *string);
FcPublic FcBool
FcNameConstant (const FcChar8 *string, int *result);
FcPublic FcPattern *
FcNameParse (const FcChar8 *name);
FcPublic FcChar8 *
FcNameUnparse (FcPattern *pat);
/* fcpat.c */
FcPublic FcPattern *
FcPatternCreate (void);
FcPublic FcPattern *
FcPatternDuplicate (const FcPattern *p);
FcPublic void
FcPatternReference (FcPattern *p);
FcPublic FcPattern *
FcPatternFilter (FcPattern *p, const FcObjectSet *os);
FcPublic void
FcValueDestroy (FcValue v);
FcPublic FcBool
FcValueEqual (FcValue va, FcValue vb);
FcPublic FcValue
FcValueSave (FcValue v);
FcPublic void
FcPatternDestroy (FcPattern *p);
int
FcPatternObjectCount (const FcPattern *pat);
FcPublic FcBool
FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
FcPublic FcBool
FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os);
FcPublic FcChar32
FcPatternHash (const FcPattern *p);
FcPublic FcBool
FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
FcPublic FcBool
FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append);
FcPublic FcResult
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v);
FcPublic FcResult
FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b);
FcPublic FcBool
FcPatternDel (FcPattern *p, const char *object);
FcPublic FcBool
FcPatternRemove (FcPattern *p, const char *object, int id);
FcPublic FcBool
FcPatternAddInteger (FcPattern *p, const char *object, int i);
FcPublic FcBool
FcPatternAddDouble (FcPattern *p, const char *object, double d);
FcPublic FcBool
FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
FcPublic FcBool
FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
FcPublic FcBool
FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
FcPublic FcBool
FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
FcPublic FcBool
FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls);
FcPublic FcBool
FcPatternAddRange (FcPattern *p, const char *object, const FcRange *r);
FcPublic FcResult
FcPatternGetInteger (const FcPattern *p, const char *object, int n, int *i);
FcPublic FcResult
FcPatternGetDouble (const FcPattern *p, const char *object, int n, double *d);
FcPublic FcResult
FcPatternGetString (const FcPattern *p, const char *object, int n, FcChar8 ** s);
FcPublic FcResult
FcPatternGetMatrix (const FcPattern *p, const char *object, int n, FcMatrix **s);
FcPublic FcResult
FcPatternGetCharSet (const FcPattern *p, const char *object, int n, FcCharSet **c);
FcPublic FcResult
FcPatternGetBool (const FcPattern *p, const char *object, int n, FcBool *b);
FcPublic FcResult
FcPatternGetLangSet (const FcPattern *p, const char *object, int n, FcLangSet **ls);
FcPublic FcResult
FcPatternGetRange (const FcPattern *p, const char *object, int id, FcRange **r);
FcPublic FcPattern *
FcPatternVaBuild (FcPattern *p, va_list va);
FcPublic FcPattern *
FcPatternBuild (FcPattern *p, ...) FC_ATTRIBUTE_SENTINEL(0);
FcPublic FcChar8 *
FcPatternFormat (FcPattern *pat, const FcChar8 *format);
/* fcrange.c */
FcPublic FcRange *
FcRangeCreateDouble (double begin, double end);
FcPublic FcRange *
FcRangeCreateInteger (FcChar32 begin, FcChar32 end);
FcPublic void
FcRangeDestroy (FcRange *range);
FcPublic FcRange *
FcRangeCopy (const FcRange *r);
FcPublic FcBool
FcRangeGetDouble(const FcRange *range, double *begin, double *end);
FcPublic void
FcPatternIterStart (const FcPattern *pat, FcPatternIter *iter);
FcPublic FcBool
FcPatternIterNext (const FcPattern *pat, FcPatternIter *iter);
FcPublic FcBool
FcPatternIterEqual (const FcPattern *p1, FcPatternIter *i1,
const FcPattern *p2, FcPatternIter *i2);
FcPublic FcBool
FcPatternFindIter (const FcPattern *pat, FcPatternIter *iter, const char *object);
FcPublic FcBool
FcPatternIterIsValid (const FcPattern *pat, FcPatternIter *iter);
FcPublic const char *
FcPatternIterGetObject (const FcPattern *pat, FcPatternIter *iter);
FcPublic int
FcPatternIterValueCount (const FcPattern *pat, FcPatternIter *iter);
FcPublic FcResult
FcPatternIterGetValue (const FcPattern *pat, FcPatternIter *iter, int id, FcValue *v, FcValueBinding *b);
/* fcweight.c */
FcPublic int
FcWeightFromOpenType (int ot_weight);
FcPublic double
FcWeightFromOpenTypeDouble (double ot_weight);
FcPublic int
FcWeightToOpenType (int fc_weight);
FcPublic double
FcWeightToOpenTypeDouble (double fc_weight);
/* fcstr.c */
FcPublic FcChar8 *
FcStrCopy (const FcChar8 *s);
FcPublic FcChar8 *
FcStrCopyFilename (const FcChar8 *s);
FcPublic FcChar8 *
FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
FcPublic void
FcStrFree (FcChar8 *s);
/* These are ASCII only, suitable only for pattern element names */
#define FcIsUpper(c) ((0101 <= (c) && (c) <= 0132))
#define FcIsLower(c) ((0141 <= (c) && (c) <= 0172))
#define FcToLower(c) (FcIsUpper(c) ? (c) - 0101 + 0141 : (c))
FcPublic FcChar8 *
FcStrDowncase (const FcChar8 *s);
FcPublic int
FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
FcPublic int
FcStrCmp (const FcChar8 *s1, const FcChar8 *s2);
FcPublic const FcChar8 *
FcStrStrIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
FcPublic const FcChar8 *
FcStrStr (const FcChar8 *s1, const FcChar8 *s2);
FcPublic int
FcUtf8ToUcs4 (const FcChar8 *src_orig,
FcChar32 *dst,
int len);
FcPublic FcBool
FcUtf8Len (const FcChar8 *string,
int len,
int *nchar,
int *wchar);
#define FC_UTF8_MAX_LEN 6
FcPublic int
FcUcs4ToUtf8 (FcChar32 ucs4,
FcChar8 dest[FC_UTF8_MAX_LEN]);
FcPublic int
FcUtf16ToUcs4 (const FcChar8 *src_orig,
FcEndian endian,
FcChar32 *dst,
int len); /* in bytes */
FcPublic FcBool
FcUtf16Len (const FcChar8 *string,
FcEndian endian,
int len, /* in bytes */
int *nchar,
int *wchar);
FcPublic FcChar8 *
FcStrDirname (const FcChar8 *file);
FcPublic FcChar8 *
FcStrBasename (const FcChar8 *file);
FcPublic FcStrSet *
FcStrSetCreate (void);
FcPublic FcBool
FcStrSetMember (FcStrSet *set, const FcChar8 *s);
FcPublic FcBool
FcStrSetEqual (FcStrSet *sa, FcStrSet *sb);
FcPublic FcBool
FcStrSetAdd (FcStrSet *set, const FcChar8 *s);
FcPublic FcBool
FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s);
FcPublic FcBool
FcStrSetDel (FcStrSet *set, const FcChar8 *s);
FcPublic void
FcStrSetDestroy (FcStrSet *set);
FcPublic FcStrList *
FcStrListCreate (FcStrSet *set);
FcPublic void
FcStrListFirst (FcStrList *list);
FcPublic FcChar8 *
FcStrListNext (FcStrList *list);
FcPublic void
FcStrListDone (FcStrList *list);
/* fcxml.c */
FcPublic FcBool
FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
FcPublic FcBool
FcConfigParseAndLoadFromMemory (FcConfig *config,
const FcChar8 *buffer,
FcBool complain);
_FCFUNCPROTOEND
#undef FC_ATTRIBUTE_SENTINEL
#ifndef _FCINT_H_
/*
* Deprecated functions are placed here to help users fix their code without
* digging through documentation
*/
#define FcConfigGetRescanInverval FcConfigGetRescanInverval_REPLACE_BY_FcConfigGetRescanInterval
#define FcConfigSetRescanInverval FcConfigSetRescanInverval_REPLACE_BY_FcConfigSetRescanInterval
#endif
#endif /* _FONTCONFIG_H_ */
/* Functions to access FILE structure internals.
Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* This header contains the same definitions as the header of the same name
on Sun's Solaris OS. */
#ifndef _STDIO_EXT_H
#define _STDIO_EXT_H 1
#include <stdio.h>
enum
{
/* Query current state of the locking status. */
FSETLOCKING_QUERY = 0,
#define FSETLOCKING_QUERY FSETLOCKING_QUERY
/* The library protects all uses of the stream functions, except for
uses of the *_unlocked functions, by calls equivalent to flockfile(). */
FSETLOCKING_INTERNAL,
#define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL
/* The user will take care of locking. */
FSETLOCKING_BYCALLER
#define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER
};
__BEGIN_DECLS
/* Return the size of the buffer of FP in bytes currently in use by
the given stream. */
extern size_t __fbufsize (FILE *__fp) __THROW;
/* Return non-zero value iff the stream FP is opened readonly, or if the
last operation on the stream was a read operation. */
extern int __freading (FILE *__fp) __THROW;
/* Return non-zero value iff the stream FP is opened write-only or
append-only, or if the last operation on the stream was a write
operation. */
extern int __fwriting (FILE *__fp) __THROW;
/* Return non-zero value iff stream FP is not opened write-only or
append-only. */
extern int __freadable (FILE *__fp) __THROW;
/* Return non-zero value iff stream FP is not opened read-only. */
extern int __fwritable (FILE *__fp) __THROW;
/* Return non-zero value iff the stream FP is line-buffered. */
extern int __flbf (FILE *__fp) __THROW;
/* Discard all pending buffered I/O on the stream FP. */
extern void __fpurge (FILE *__fp) __THROW;
/* Return amount of output in bytes pending on a stream FP. */
extern size_t __fpending (FILE *__fp) __THROW;
/* Flush all line-buffered files. */
extern void _flushlbf (void);
/* Set locking status of stream FP to TYPE. */
extern int __fsetlocking (FILE *__fp, int __type) __THROW;
__END_DECLS
#endif /* stdio_ext.h */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 1990, 1991, 2016 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* All rights reserved.
*
* Export of this software from the United States of America may require
* a specific license from the United States Government. It is the
* responsibility of any person or organization contemplating export to
* obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of FundsXpress. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. FundsXpress makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* KDC Database interface definitions */
/* This API is not considered as stable as the main krb5 API.
*
* - We may make arbitrary incompatible changes between feature
* releases (e.g. from 1.7 to 1.8).
* - We will make some effort to avoid making incompatible changes for
* bugfix releases, but will make them if necessary.
*/
#ifndef KRB5_KDB5__
#define KRB5_KDB5__
#include <krb5.h>
/* This version will be incremented when incompatible changes are made to the
* KDB API, and will be kept in sync with the libkdb major version. */
#define KRB5_KDB_API_VERSION 10
/* Salt types */
#define KRB5_KDB_SALTTYPE_NORMAL 0
/* #define KRB5_KDB_SALTTYPE_V4 1 */
#define KRB5_KDB_SALTTYPE_NOREALM 2
#define KRB5_KDB_SALTTYPE_ONLYREALM 3
#define KRB5_KDB_SALTTYPE_SPECIAL 4
/* #define KRB5_KDB_SALTTYPE_AFS3 5 */
#define KRB5_KDB_SALTTYPE_CERTHASH 6
/* Attributes */
#define KRB5_KDB_DISALLOW_POSTDATED 0x00000001
#define KRB5_KDB_DISALLOW_FORWARDABLE 0x00000002
#define KRB5_KDB_DISALLOW_TGT_BASED 0x00000004
#define KRB5_KDB_DISALLOW_RENEWABLE 0x00000008
#define KRB5_KDB_DISALLOW_PROXIABLE 0x00000010
#define KRB5_KDB_DISALLOW_DUP_SKEY 0x00000020
#define KRB5_KDB_DISALLOW_ALL_TIX 0x00000040
#define KRB5_KDB_REQUIRES_PRE_AUTH 0x00000080
#define KRB5_KDB_REQUIRES_HW_AUTH 0x00000100
#define KRB5_KDB_REQUIRES_PWCHANGE 0x00000200
#define KRB5_KDB_DISALLOW_SVR 0x00001000
#define KRB5_KDB_PWCHANGE_SERVICE 0x00002000
#define KRB5_KDB_SUPPORT_DESMD5 0x00004000
#define KRB5_KDB_NEW_PRINC 0x00008000
#define KRB5_KDB_OK_AS_DELEGATE 0x00100000
#define KRB5_KDB_OK_TO_AUTH_AS_DELEGATE 0x00200000 /* S4U2Self OK */
#define KRB5_KDB_NO_AUTH_DATA_REQUIRED 0x00400000
#define KRB5_KDB_LOCKDOWN_KEYS 0x00800000
/* Creation flags */
#define KRB5_KDB_CREATE_BTREE 0x00000001
#define KRB5_KDB_CREATE_HASH 0x00000002
/* Entry get flags */
/* Name canonicalization requested */
#define KRB5_KDB_FLAG_CANONICALIZE 0x00000010
/* Include authorization data generated by backend */
#define KRB5_KDB_FLAG_INCLUDE_PAC 0x00000020
/* Is AS-REQ (client referrals only) */
#define KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY 0x00000040
/* Map cross-realm principals */
#define KRB5_KDB_FLAG_MAP_PRINCIPALS 0x00000080
/* Protocol transition */
#define KRB5_KDB_FLAG_PROTOCOL_TRANSITION 0x00000100
/* Constrained delegation */
#define KRB5_KDB_FLAG_CONSTRAINED_DELEGATION 0x00000200
/* User-to-user */
#define KRB5_KDB_FLAG_USER_TO_USER 0x00000800
/* Cross-realm */
#define KRB5_KDB_FLAG_CROSS_REALM 0x00001000
/* Issuing referral */
#define KRB5_KDB_FLAG_ISSUING_REFERRAL 0x00004000
#define KRB5_KDB_FLAGS_S4U ( KRB5_KDB_FLAG_PROTOCOL_TRANSITION | \
KRB5_KDB_FLAG_CONSTRAINED_DELEGATION )
/* KDB iteration flags */
#define KRB5_DB_ITER_WRITE 0x00000001
#define KRB5_DB_ITER_REV 0x00000002
#define KRB5_DB_ITER_RECURSE 0x00000004
/* String attribute names recognized by krb5 */
#define KRB5_KDB_SK_SESSION_ENCTYPES "session_enctypes"
#define KRB5_KDB_SK_REQUIRE_AUTH "require_auth"
#define KRB5_KDB_SK_OPTIONAL_AD_SIGNEDPATH "optional_ad_signedpath"
#if !defined(_WIN32)
/*
* Note --- these structures cannot be modified without changing the
* database version number in libkdb.a, but should be expandable by
* adding new tl_data types.
*/
typedef struct _krb5_tl_data {
struct _krb5_tl_data* tl_data_next; /* NOT saved */
krb5_int16 tl_data_type;
krb5_ui_2 tl_data_length;
krb5_octet * tl_data_contents;
} krb5_tl_data;
/* String attributes (currently stored inside tl-data) map C string keys to
* values. They can be set via kadmin and consumed by KDC plugins. */
typedef struct krb5_string_attr_st {
char *key;
char *value;
} krb5_string_attr;
/*
* If this ever changes up the version number and make the arrays be as
* big as necessary.
*
* Currently the first type is the enctype and the second is the salt type.
*/
typedef struct _krb5_key_data {
krb5_int16 key_data_ver; /* Version */
krb5_ui_2 key_data_kvno; /* Key Version */
krb5_int16 key_data_type[2]; /* Array of types */
krb5_ui_2 key_data_length[2]; /* Array of lengths */
krb5_octet * key_data_contents[2]; /* Array of pointers */
} krb5_key_data;
#define KRB5_KDB_V1_KEY_DATA_ARRAY 2 /* # of array elements */
typedef struct _krb5_keysalt {
krb5_int16 type;
krb5_data data; /* Length, data */
} krb5_keysalt;
/*
* A principal database entry. Extensions to this structure currently use the
* tl_data list. The e_data and e_length fields are not used by any calling
* code except kdb5_util dump and load, which marshal and unmarshal the array
* in the dump record. KDB modules may use these fields internally as long as
* they set e_length appropriately (non-zero if the data should be marshalled
* across dump and load, zero if not) and handle null e_data values in
* caller-constructed principal entries.
*/
typedef struct _krb5_db_entry_new {
krb5_magic magic; /* NOT saved */
krb5_ui_2 len;
krb5_ui_4 mask; /* members currently changed/set */
krb5_flags attributes;
krb5_deltat max_life;
krb5_deltat max_renewable_life;
krb5_timestamp expiration; /* When the client expires */
krb5_timestamp pw_expiration; /* When its passwd expires */
krb5_timestamp last_success; /* Last successful passwd */
krb5_timestamp last_failed; /* Last failed passwd attempt */
krb5_kvno fail_auth_count; /* # of failed passwd attempt */
krb5_int16 n_tl_data;
krb5_int16 n_key_data;
krb5_ui_2 e_length; /* Length of extra data */
krb5_octet * e_data; /* Extra data to be saved */
krb5_principal princ; /* Length, data */
krb5_tl_data * tl_data; /* Linked list */
/* key_data must be sorted by kvno in descending order. */
krb5_key_data * key_data; /* Array */
} krb5_db_entry;
typedef struct _osa_policy_ent_t {
int version;
char *name;
krb5_ui_4 pw_min_life;
krb5_ui_4 pw_max_life;
krb5_ui_4 pw_min_length;
krb5_ui_4 pw_min_classes;
krb5_ui_4 pw_history_num;
krb5_ui_4 policy_refcnt; /* no longer used */
/* Only valid if version > 1 */
krb5_ui_4 pw_max_fail; /* pwdMaxFailure */
krb5_ui_4 pw_failcnt_interval; /* pwdFailureCountInterval */
krb5_ui_4 pw_lockout_duration; /* pwdLockoutDuration */
/* Only valid if version > 2 */
krb5_ui_4 attributes;
krb5_ui_4 max_life;
krb5_ui_4 max_renewable_life;
char * allowed_keysalts;
krb5_int16 n_tl_data;
krb5_tl_data * tl_data;
} osa_policy_ent_rec, *osa_policy_ent_t;
typedef void (*osa_adb_iter_policy_func) (void *, osa_policy_ent_t);
typedef struct __krb5_key_salt_tuple {
krb5_enctype ks_enctype;
krb5_int32 ks_salttype;
} krb5_key_salt_tuple;
#define KRB5_KDB_MAGIC_NUMBER 0xdbdbdbdb
#define KRB5_KDB_V1_BASE_LENGTH 38
#define KRB5_KDB_MAX_ALLOWED_KS_LEN 512
#define KRB5_TL_LAST_PWD_CHANGE 0x0001
#define KRB5_TL_MOD_PRINC 0x0002
#define KRB5_TL_KADM_DATA 0x0003
#define KRB5_TL_KADM5_E_DATA 0x0004
#define KRB5_TL_RB1_CHALLENGE 0x0005
#ifdef SECURID
#define KRB5_TL_SECURID_STATE 0x0006
#endif /* SECURID */
#define KRB5_TL_USER_CERTIFICATE 0x0007
#define KRB5_TL_MKVNO 0x0008
#define KRB5_TL_ACTKVNO 0x0009
#define KRB5_TL_MKEY_AUX 0x000a
/* String attributes may not always be represented in tl-data. kadmin clients
* must use the get_strings and set_string RPCs. */
#define KRB5_TL_STRING_ATTRS 0x000b
#define KRB5_TL_PAC_LOGON_INFO 0x0100 /* NDR encoded validation info */
#define KRB5_TL_SERVER_REFERRAL 0x0200 /* ASN.1 encoded ServerReferralInfo */
#define KRB5_TL_SVR_REFERRAL_DATA 0x0300 /* ASN.1 encoded PA-SVR-REFERRAL-DATA */
#define KRB5_TL_CONSTRAINED_DELEGATION_ACL 0x0400 /* Each entry is a permitted SPN */
#define KRB5_TL_LM_KEY 0x0500 /* LM OWF */
#define KRB5_TL_X509_SUBJECT_ISSUER_NAME 0x0600 /* <I>IssuerDN<S>SubjectDN */
#define KRB5_TL_LAST_ADMIN_UNLOCK 0x0700 /* Timestamp of admin unlock */
#define KRB5_TL_DB_ARGS 0x7fff
/* version number for KRB5_TL_ACTKVNO data */
#define KRB5_TL_ACTKVNO_VER 1
/* version number for KRB5_TL_MKEY_AUX data */
#define KRB5_TL_MKEY_AUX_VER 1
typedef struct _krb5_actkvno_node {
struct _krb5_actkvno_node *next;
krb5_kvno act_kvno;
krb5_timestamp act_time;
} krb5_actkvno_node;
typedef struct _krb5_mkey_aux_node {
struct _krb5_mkey_aux_node *next;
krb5_kvno mkey_kvno; /* kvno of mkey protecting the latest_mkey */
krb5_key_data latest_mkey; /* most recent mkey */
} krb5_mkey_aux_node;
typedef struct _krb5_keylist_node {
krb5_keyblock keyblock;
krb5_kvno kvno;
struct _krb5_keylist_node *next;
} krb5_keylist_node;
/*
* Determines the number of failed KDC requests before DISALLOW_ALL_TIX is set
* on the principal.
*/
#define KRB5_MAX_FAIL_COUNT 5
/* XXX depends on knowledge of krb5_parse_name() formats */
#define KRB5_KDB_M_NAME "K/M" /* Kerberos/Master */
/* prompts used by default when reading the KDC password from the keyboard. */
#define KRB5_KDC_MKEY_1 "Enter KDC database master key"
#define KRB5_KDC_MKEY_2 "Re-enter KDC database master key to verify"
extern char *krb5_mkey_pwd_prompt1;
extern char *krb5_mkey_pwd_prompt2;
/*
* These macros specify the encoding of data within the database.
*
* Data encoding is little-endian.
*/
#ifdef _KRB5_INT_H
#include "k5-platform.h"
#define krb5_kdb_decode_int16(cp, i16) \
*((krb5_int16 *) &(i16)) = load_16_le(cp)
#define krb5_kdb_decode_int32(cp, i32) \
*((krb5_int32 *) &(i32)) = load_32_le(cp)
#define krb5_kdb_encode_int16(i16, cp) store_16_le(i16, cp)
#define krb5_kdb_encode_int32(i32, cp) store_32_le(i32, cp)
#endif /* _KRB5_INT_H */
#define KRB5_KDB_OPEN_RW 0
#define KRB5_KDB_OPEN_RO 1
#ifndef KRB5_KDB_SRV_TYPE_KDC
#define KRB5_KDB_SRV_TYPE_KDC 0x0100
#endif
#ifndef KRB5_KDB_SRV_TYPE_ADMIN
#define KRB5_KDB_SRV_TYPE_ADMIN 0x0200
#endif
/* 0x0300 was KRB5_KDB_SRV_TYPE_PASSWD but it is no longer used. */
#ifndef KRB5_KDB_SRV_TYPE_OTHER
#define KRB5_KDB_SRV_TYPE_OTHER 0x0400
#endif
#define KRB5_KDB_OPT_SET_DB_NAME 0
#define KRB5_KDB_OPT_SET_LOCK_MODE 1
#define KRB5_DB_LOCKMODE_SHARED 0x0001
#define KRB5_DB_LOCKMODE_EXCLUSIVE 0x0002
#define KRB5_DB_LOCKMODE_PERMANENT 0x0008
/* libkdb.spec */
krb5_error_code krb5_db_setup_lib_handle(krb5_context kcontext);
krb5_error_code krb5_db_open( krb5_context kcontext, char **db_args, int mode );
krb5_error_code krb5_db_init ( krb5_context kcontext );
krb5_error_code krb5_db_create ( krb5_context kcontext, char **db_args );
krb5_error_code krb5_db_inited ( krb5_context kcontext );
krb5_error_code kdb5_db_create ( krb5_context kcontext, char **db_args );
krb5_error_code krb5_db_fini ( krb5_context kcontext );
const char * krb5_db_errcode2string ( krb5_context kcontext, long err_code );
krb5_error_code krb5_db_destroy ( krb5_context kcontext, char **db_args );
krb5_error_code krb5_db_promote ( krb5_context kcontext, char **db_args );
krb5_error_code krb5_db_get_age ( krb5_context kcontext, char *db_name, time_t *t );
krb5_error_code krb5_db_lock ( krb5_context kcontext, int lock_mode );
krb5_error_code krb5_db_unlock ( krb5_context kcontext );
krb5_error_code krb5_db_get_principal ( krb5_context kcontext,
krb5_const_principal search_for,
unsigned int flags,
krb5_db_entry **entry );
void krb5_db_free_principal ( krb5_context kcontext, krb5_db_entry *entry );
krb5_error_code krb5_db_put_principal ( krb5_context kcontext,
krb5_db_entry *entry );
krb5_error_code krb5_db_delete_principal ( krb5_context kcontext,
krb5_principal search_for );
krb5_error_code krb5_db_rename_principal ( krb5_context kcontext,
krb5_principal source,
krb5_principal target );
/*
* Iterate over principals in the KDB. If the callback may write to the DB,
* the caller must get an exclusive lock with krb5_db_lock before iterating,
* and release it with krb5_db_unlock after iterating.
*/
krb5_error_code krb5_db_iterate ( krb5_context kcontext,
char *match_entry,
int (*func) (krb5_pointer, krb5_db_entry *),
krb5_pointer func_arg, krb5_flags iterflags );
krb5_error_code krb5_db_store_master_key ( krb5_context kcontext,
char *keyfile,
krb5_principal mname,
krb5_kvno kvno,
krb5_keyblock *key,
char *master_pwd);
krb5_error_code krb5_db_store_master_key_list ( krb5_context kcontext,
char *keyfile,
krb5_principal mname,
char *master_pwd);
krb5_error_code krb5_db_fetch_mkey ( krb5_context context,
krb5_principal mname,
krb5_enctype etype,
krb5_boolean fromkeyboard,
krb5_boolean twice,
char *db_args,
krb5_kvno *kvno,
krb5_data *salt,
krb5_keyblock *key);
krb5_error_code
krb5_db_fetch_mkey_list( krb5_context context,
krb5_principal mname,
const krb5_keyblock * mkey );
krb5_error_code
krb5_dbe_find_enctype( krb5_context kcontext,
krb5_db_entry *dbentp,
krb5_int32 ktype,
krb5_int32 stype,
krb5_int32 kvno,
krb5_key_data **kdatap);
krb5_error_code krb5_dbe_search_enctype ( krb5_context kcontext,
krb5_db_entry *dbentp,
krb5_int32 *start,
krb5_int32 ktype,
krb5_int32 stype,
krb5_int32 kvno,
krb5_key_data **kdatap);
krb5_error_code
krb5_db_setup_mkey_name ( krb5_context context,
const char *keyname,
const char *realm,
char **fullname,
krb5_principal *principal);
/**
* Decrypts the key given in @@a key_data. If @a mkey is specified, that
* master key is used. If @a mkey is NULL, then all master keys are tried.
*/
krb5_error_code
krb5_dbe_decrypt_key_data( krb5_context context,
const krb5_keyblock * mkey,
const krb5_key_data * key_data,
krb5_keyblock * dbkey,
krb5_keysalt * keysalt);
krb5_error_code
krb5_dbe_encrypt_key_data( krb5_context context,
const krb5_keyblock * mkey,
const krb5_keyblock * dbkey,
const krb5_keysalt * keysalt,
int keyver,
krb5_key_data * key_data);
krb5_error_code
krb5_dbe_fetch_act_key_list(krb5_context context,
krb5_principal princ,
krb5_actkvno_node **act_key_list);
krb5_error_code
krb5_dbe_find_act_mkey( krb5_context context,
krb5_actkvno_node * act_mkey_list,
krb5_kvno * act_kvno,
krb5_keyblock ** act_mkey);
krb5_error_code
krb5_dbe_find_mkey( krb5_context context,
krb5_db_entry * entry,
krb5_keyblock ** mkey);
/* Set *mkvno to mkvno in entry tl_data, or 0 if not present. */
krb5_error_code
krb5_dbe_lookup_mkvno( krb5_context context,
krb5_db_entry * entry,
krb5_kvno * mkvno);
krb5_keylist_node *
krb5_db_mkey_list_alias( krb5_context kcontext );
/* Set *mkvno to mkvno in entry tl_data, or minimum value from mkey_list. */
krb5_error_code
krb5_dbe_get_mkvno( krb5_context context,
krb5_db_entry * entry,
krb5_kvno * mkvno);
krb5_error_code
krb5_dbe_lookup_mod_princ_data( krb5_context context,
krb5_db_entry * entry,
krb5_timestamp * mod_time,
krb5_principal * mod_princ);
krb5_error_code
krb5_dbe_lookup_mkey_aux( krb5_context context,
krb5_db_entry * entry,
krb5_mkey_aux_node ** mkey_aux_data_list);
krb5_error_code
krb5_dbe_update_mkvno( krb5_context context,
krb5_db_entry * entry,
krb5_kvno mkvno);
krb5_error_code
krb5_dbe_lookup_actkvno( krb5_context context,
krb5_db_entry * entry,
krb5_actkvno_node ** actkvno_list);
krb5_error_code
krb5_dbe_update_mkey_aux( krb5_context context,
krb5_db_entry * entry,
krb5_mkey_aux_node * mkey_aux_data_list);
krb5_error_code
krb5_dbe_update_actkvno(krb5_context context,
krb5_db_entry * entry,
const krb5_actkvno_node *actkvno_list);
krb5_error_code
krb5_dbe_update_last_pwd_change( krb5_context context,
krb5_db_entry * entry,
krb5_timestamp stamp);
krb5_error_code
krb5_dbe_update_last_admin_unlock( krb5_context context,
krb5_db_entry * entry,
krb5_timestamp stamp);
krb5_error_code
krb5_dbe_lookup_tl_data( krb5_context context,
krb5_db_entry * entry,
krb5_tl_data * ret_tl_data);
krb5_error_code
krb5_dbe_create_key_data( krb5_context context,
krb5_db_entry * entry);
krb5_error_code
krb5_dbe_update_mod_princ_data( krb5_context context,
krb5_db_entry * entry,
krb5_timestamp mod_date,
krb5_const_principal mod_princ);
/*
* These are wrappers around realloc() and free(). Applications and KDB
* modules can use them when manipulating principal and policy entries to
* ensure that they allocate and free memory in a manner compatible with the
* library. Using libkrb5 or libkbd5 functions to construct values (such as
* krb5_copy_principal() to construct the princ field of a krb5_db_entry) is
* also safe. On Unix platforms, just using malloc() and free() is safe as
* long as the application or module does not use a malloc replacement.
*/
void *krb5_db_alloc( krb5_context kcontext,
void *ptr,
size_t size );
void krb5_db_free( krb5_context kcontext,
void *ptr);
krb5_error_code
krb5_dbe_lookup_last_pwd_change( krb5_context context,
krb5_db_entry * entry,
krb5_timestamp * stamp);
krb5_error_code
krb5_dbe_lookup_last_admin_unlock( krb5_context context,
krb5_db_entry * entry,
krb5_timestamp * stamp);
/* Retrieve the set of string attributes in entry, in no particular order.
* Free *strings_out with krb5_dbe_free_strings when done. */
krb5_error_code
krb5_dbe_get_strings(krb5_context context, krb5_db_entry *entry,
krb5_string_attr **strings_out, int *count_out);
/* Retrieve a single string attribute from entry, or NULL if there is no
* attribute for key. Free *value_out with krb5_dbe_free_string when done. */
krb5_error_code
krb5_dbe_get_string(krb5_context context, krb5_db_entry *entry,
const char *key, char **value_out);
/* Change or add a string attribute in entry, or delete it if value is NULL. */
krb5_error_code
krb5_dbe_set_string(krb5_context context, krb5_db_entry *entry,
const char *key, const char *value);
krb5_error_code
krb5_dbe_delete_tl_data( krb5_context context,
krb5_db_entry * entry,
krb5_int16 tl_data_type);
krb5_error_code
krb5_db_update_tl_data(krb5_context context,
krb5_int16 * n_tl_datap,
krb5_tl_data **tl_datap,
krb5_tl_data * new_tl_data);
krb5_error_code
krb5_dbe_update_tl_data( krb5_context context,
krb5_db_entry * entry,
krb5_tl_data * new_tl_data);
/* Compute the salt for a key data entry given the corresponding principal. */
krb5_error_code
krb5_dbe_compute_salt(krb5_context context, const krb5_key_data *key,
krb5_const_principal princ, krb5_int16 *salttype_out,
krb5_data **salt_out);
/*
* Modify the key data of entry to explicitly store salt values using the
* KRB5_KDB_SALTTYPE_SPECIAL salt type.
*/
krb5_error_code
krb5_dbe_specialize_salt(krb5_context context, krb5_db_entry *entry);
krb5_error_code
krb5_dbe_cpw( krb5_context kcontext,
krb5_keyblock * master_key,
krb5_key_salt_tuple * ks_tuple,
int ks_tuple_count,
char * passwd,
int new_kvno,
krb5_boolean keepold,
krb5_db_entry * db_entry);
krb5_error_code
krb5_dbe_ark( krb5_context context,
krb5_keyblock * master_key,
krb5_key_salt_tuple * ks_tuple,
int ks_tuple_count,
krb5_db_entry * db_entry);
krb5_error_code
krb5_dbe_crk( krb5_context context,
krb5_keyblock * master_key,
krb5_key_salt_tuple * ks_tuple,
int ks_tuple_count,
krb5_boolean keepold,
krb5_db_entry * db_entry);
krb5_error_code
krb5_dbe_apw( krb5_context context,
krb5_keyblock * master_key,
krb5_key_salt_tuple * ks_tuple,
int ks_tuple_count,
char * passwd,
krb5_db_entry * db_entry);
int
krb5_db_get_key_data_kvno( krb5_context context,
int count,
krb5_key_data * data);
krb5_error_code krb5_db_sign_authdata(krb5_context kcontext,
unsigned int flags,
krb5_const_principal client_princ,
krb5_const_principal server_princ,
krb5_db_entry *client,
krb5_db_entry *server,
krb5_db_entry *header_server,
krb5_db_entry *local_tgt,
krb5_keyblock *client_key,
krb5_keyblock *server_key,
krb5_keyblock *header_key,
krb5_keyblock *local_tgt_key,
krb5_keyblock *session_key,
krb5_timestamp authtime,
krb5_authdata **tgt_auth_data,
void *ad_info,
krb5_data ***auth_indicators,
krb5_authdata ***signed_auth_data);
krb5_error_code krb5_db_check_transited_realms(krb5_context kcontext,
const krb5_data *tr_contents,
const krb5_data *client_realm,
const krb5_data *server_realm);
krb5_error_code krb5_db_check_policy_as(krb5_context kcontext,
krb5_kdc_req *request,
krb5_db_entry *client,
krb5_db_entry *server,
krb5_timestamp kdc_time,
const char **status,
krb5_pa_data ***e_data);
krb5_error_code krb5_db_check_policy_tgs(krb5_context kcontext,
krb5_kdc_req *request,
krb5_db_entry *server,
krb5_ticket *ticket,
const char **status,
krb5_pa_data ***e_data);
void krb5_db_audit_as_req(krb5_context kcontext, krb5_kdc_req *request,
const krb5_address *local_addr,
const krb5_address *remote_addr,
krb5_db_entry *client, krb5_db_entry *server,
krb5_timestamp authtime, krb5_error_code error_code);
void krb5_db_refresh_config(krb5_context kcontext);
krb5_error_code krb5_db_check_allowed_to_delegate(krb5_context kcontext,
krb5_const_principal client,
const krb5_db_entry *server,
krb5_const_principal proxy);
krb5_error_code krb5_db_get_s4u_x509_principal(krb5_context kcontext,
const krb5_data *client_cert,
krb5_const_principal in_princ,
unsigned int flags,
krb5_db_entry **entry);
krb5_error_code krb5_db_allowed_to_delegate_from(krb5_context context,
krb5_const_principal client,
krb5_const_principal server,
void *server_ad_info,
const krb5_db_entry *proxy);
krb5_error_code krb5_db_get_authdata_info(krb5_context context,
unsigned int flags,
krb5_authdata **in_authdata,
krb5_const_principal client_princ,
krb5_const_principal server_princ,
krb5_keyblock *server_key,
krb5_keyblock *krbtgt_key,
krb5_db_entry *krbtgt,
krb5_timestamp authtime,
void **ad_info_out,
krb5_principal *client_out);
void krb5_db_free_authdata_info(krb5_context context, void *ad_info);
/**
* Sort an array of @a krb5_key_data keys in descending order by their kvno.
* Key data order within a kvno is preserved.
*
* @param key_data
* The @a krb5_key_data array to sort. This is sorted in place so the
* array will be modified.
* @param key_data_length
* The length of @a key_data.
*/
void
krb5_dbe_sort_key_data(krb5_key_data *key_data, size_t key_data_length);
/* default functions. Should not be directly called */
/*
* Default functions prototype
*/
krb5_error_code
krb5_dbe_def_search_enctype( krb5_context kcontext,
krb5_db_entry *dbentp,
krb5_int32 *start,
krb5_int32 ktype,
krb5_int32 stype,
krb5_int32 kvno,
krb5_key_data **kdatap);
krb5_error_code
krb5_def_store_mkey_list( krb5_context context,
char *keyfile,
krb5_principal mname,
krb5_keylist_node *keylist,
char *master_pwd);
krb5_error_code
krb5_db_def_fetch_mkey( krb5_context context,
krb5_principal mname,
krb5_keyblock *key,
krb5_kvno *kvno,
char *db_args);
krb5_error_code
krb5_def_fetch_mkey_list( krb5_context context,
krb5_principal mprinc,
const krb5_keyblock *mkey,
krb5_keylist_node **mkeys_list);
krb5_error_code
krb5_dbe_def_cpw( krb5_context context,
krb5_keyblock * master_key,
krb5_key_salt_tuple * ks_tuple,
int ks_tuple_count,
char * passwd,
int new_kvno,
krb5_boolean keepold,
krb5_db_entry * db_entry);
krb5_error_code
krb5_dbe_def_decrypt_key_data( krb5_context context,
const krb5_keyblock * mkey,
const krb5_key_data * key_data,
krb5_keyblock * dbkey,
krb5_keysalt * keysalt);
krb5_error_code
krb5_dbe_def_encrypt_key_data( krb5_context context,
const krb5_keyblock * mkey,
const krb5_keyblock * dbkey,
const krb5_keysalt * keysalt,
int keyver,
krb5_key_data * key_data);
krb5_error_code
krb5_db_def_rename_principal( krb5_context kcontext,
krb5_const_principal source,
krb5_const_principal target);
krb5_error_code
krb5_db_create_policy( krb5_context kcontext,
osa_policy_ent_t policy);
krb5_error_code
krb5_db_get_policy ( krb5_context kcontext,
char *name,
osa_policy_ent_t *policy );
krb5_error_code
krb5_db_put_policy( krb5_context kcontext,
osa_policy_ent_t policy);
krb5_error_code
krb5_db_iter_policy( krb5_context kcontext,
char *match_entry,
osa_adb_iter_policy_func func,
void *data);
krb5_error_code
krb5_db_delete_policy( krb5_context kcontext,
char *policy);
void
krb5_db_free_policy( krb5_context kcontext,
osa_policy_ent_t policy);
krb5_error_code
krb5_db_set_context(krb5_context, void *db_context);
krb5_error_code
krb5_db_get_context(krb5_context, void **db_context);
void
krb5_dbe_free_key_data_contents(krb5_context, krb5_key_data *);
void
krb5_dbe_free_key_list(krb5_context, krb5_keylist_node *);
void
krb5_dbe_free_actkvno_list(krb5_context, krb5_actkvno_node *);
void
krb5_dbe_free_mkey_aux_list(krb5_context, krb5_mkey_aux_node *);
void
krb5_dbe_free_tl_data(krb5_context, krb5_tl_data *);
void
krb5_dbe_free_strings(krb5_context, krb5_string_attr *, int count);
void
krb5_dbe_free_string(krb5_context, char *);
/*
* Register the KDB keytab type, allowing "KDB:" to be used as a keytab name.
* For this type to work, the context used for keytab operations must have an
* associated database handle (via krb5_db_open()).
*/
krb5_error_code krb5_db_register_keytab(krb5_context context);
#define KRB5_KDB_DEF_FLAGS 0
#define KDB_MAX_DB_NAME 128
#define KDB_REALM_SECTION "realms"
#define KDB_MODULE_POINTER "database_module"
#define KDB_MODULE_DEF_SECTION "dbdefaults"
#define KDB_MODULE_SECTION "dbmodules"
#define KDB_LIB_POINTER "db_library"
#define KDB_DATABASE_CONF_FILE DEFAULT_SECURE_PROFILE_PATH
#define KDB_DATABASE_ENV_PROF KDC_PROFILE_ENV
#define KRB5_KDB_OPEN_RW 0
#define KRB5_KDB_OPEN_RO 1
#define KRB5_KDB_OPT_SET_DB_NAME 0
#define KRB5_KDB_OPT_SET_LOCK_MODE 1
/*
* This number indicates the date of the last incompatible change to the DAL.
* The maj_ver field of the module's vtable structure must match this version.
*/
#define KRB5_KDB_DAL_MAJOR_VERSION 8
/*
* A krb5_context can hold one database object. Modules should use
* krb5_db_set_context and krb5_db_get_context to store state associated with
* the database object.
*
* Some module functions are mandatory for KDC operation; others are optional
* or apply only to administrative operations. If a function is optional, a
* module can leave the function pointer as NULL. Alternatively, modules can
* return KRB5_PLUGIN_OP_NOTSUPP when asked to perform an inapplicable action.
*
* Some module functions have default implementations which will call back into
* the vtable interface. Leave these functions as NULL to use the default
* implementations.
*
* The documentation in these comments describes the DAL as it is currently
* implemented and used, not as it should be. So if anything seems off, that
* probably means the current state of things is off.
*
* Modules must allocate memory for principal entries, policy entries, and
* other structures using an allocator compatible with malloc() as seen by
* libkdb5 and libkrb5. Modules may link against libkdb5 and call
* krb5_db_alloc() to be certain that the same malloc implementation is used.
*/
typedef struct _kdb_vftabl {
short int maj_ver;
short int min_ver;
/*
* Mandatory: Invoked after the module library is loaded, when the first DB
* using the module is opened, across all contexts.
*/
krb5_error_code (*init_library)(void);
/*
* Mandatory: Invoked before the module library is unloaded, after the last
* DB using the module is closed, across all contexts.
*/
krb5_error_code (*fini_library)(void);
/*
* Mandatory: Initialize a database object. Profile settings should be
* read from conf_section inside KDB_MODULE_SECTION. db_args communicates
* command-line arguments for module-specific flags. mode will be one of
* KRB5_KDB_OPEN_{RW,RO} or'd with one of
* KRB5_KDB_SRV_TYPE_{KDC,ADMIN,PASSWD,OTHER}.
*/
krb5_error_code (*init_module)(krb5_context kcontext, char *conf_section,
char **db_args, int mode);
/*
* Mandatory: Finalize the database object contained in a context. Free
* any state contained in the db_context pointer and null it out.
*/
krb5_error_code (*fini_module)(krb5_context kcontext);
/*
* Optional: Initialize a database object while creating the underlying
* database. conf_section and db_args have the same meaning as in
* init_module. This function may return an error if the database already
* exists. Used by kdb5_util create.
*
* If db_args contains the value "temporary", the module should create an
* exclusively locked side copy of the database suitable for loading in a
* propagation from master to replica. This side copy will later be
* promoted with promote_db, allowing complete updates of the DB with no
* loss in read availability. If the module cannot comply with this
* architecture, it should return an error.
*/
krb5_error_code (*create)(krb5_context kcontext, char *conf_section,
char **db_args);
/*
* Optional: Destroy a database. conf_section and db_args have the same
* meaning as in init_module. Used by kdb5_util destroy. In current
* usage, the database is destroyed while open, so the module should handle
* that.
*/
krb5_error_code (*destroy)(krb5_context kcontext, char *conf_section,
char **db_args);
/*
* Deprecated: No longer used as of krb5 1.10; can be removed in the next
* DAL revision. Modules should leave as NULL.
*/
krb5_error_code (*get_age)(krb5_context kcontext, char *db_name,
time_t *age);
/*
* Optional: Lock the database, with semantics depending on the mode
* argument:
*
* KRB5_DB_LOCKMODE_SHARED: Lock may coexist with other shared locks.
* KRB5_DB_LOCKMODE_EXCLUSIVE: Lock may not coexist with other locks.
* KRB5_DB_LOCKMODE_PERMANENT: Exclusive lock surviving process exit.
*
* Used by the "kadmin lock" command, incremental propagation, and
* kdb5_util dump. Incremental propagation support requires shared locks
* to operate. kdb5_util dump will continue unlocked if the module returns
* KRB5_PLUGIN_OP_NOTSUPP.
*/
krb5_error_code (*lock)(krb5_context kcontext, int mode);
/* Optional: Release a lock created with db_lock. */
krb5_error_code (*unlock)(krb5_context kcontext);
/*
* Mandatory: Set *entry to an allocated entry for the principal
* search_for. If the principal is not found, return KRB5_KDB_NOENTRY.
*
* The meaning of flags are as follows:
*
* KRB5_KDB_FLAG_CANONICALIZE: Set by the KDC when looking up entries for
* an AS or TGS request with canonicalization requested. Determines
* whether the module should return out-of-realm referrals.
*
* KRB5_KDB_FLAG_INCLUDE_PAC: Set by the KDC during an AS request when the
* client requested PAC information during padata, and during most TGS
* requests. Indicates that the module should include PAC information
* when its sign_authdata method is invoked.
*
* KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY: Set by the KDC when looking up the
* client entry in an AS request. Affects how the module should return
* out-of-realm referrals.
*
* KRB5_KDB_FLAG_MAP_PRINCIPALS: Set by the KDC when looking up the client
* entry during TGS requests, except for S4U TGS requests and requests
* where the server entry has the KRB5_KDB_NO_AUTH_DATA_REQUIRED
* attribute. Indicates that the module should map foreign principals
* to local principals if it supports doing so.
*
* KRB5_KDB_FLAG_PROTOCOL_TRANSITION: Set by the KDC when looking up the
* client entry during an S4U2Self TGS request. This affects the PAC
* information which should be included when authorization data is
* generated; see the Microsoft S4U specification for details.
*
* KRB5_KDB_FLAG_CONSTRAINED_DELEGATION: Set by the KDC when looking up the
* client entry during an S4U2Proxy TGS request. Also affects PAC
* generation.
*
* KRB5_KDB_FLAG_CROSS_REALM: Set by the KDC after looking up a server
* entry during a TGS request, if the header ticket was issued by a
* different realm.
*
* KRB5_KDB_FLAG_ISSUING_REFERRAL: Set by the KDC after looking up a server
* entry during a TGS request, if the requested server principal is not
* part of the realm being served, and a referral or alternate TGT will
* be issued instead.
*
* A module may return an in-realm alias by setting (*entry)->princ to the
* canonical name. The KDC will decide based on the request whether to use
* the requested name or the canonical name in the issued ticket.
*
* A module can return a referral to another realm if
* KRB5_KDB_FLAG_CANONICALIZE is set, or if
* KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY is set and search_for->type is
* KRB5_NT_ENTERPRISE_PRINCIPAL. If KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY is
* set, the module should return a referral by simply filling in an
* out-of-realm name in (*entry)->princ and setting all other fields to
* NULL. Otherwise, the module should return the entry for the cross-realm
* TGS of the referred-to realm. For TGS referals, the module can also
* include tl-data of type KRB5_TL_SERVER_REFERRAL containing ASN.1-encoded
* Windows referral data as documented in
* draft-ietf-krb-wg-kerberos-referrals-11 appendix A; this will be
* returned to the client as encrypted padata.
*/
krb5_error_code (*get_principal)(krb5_context kcontext,
krb5_const_principal search_for,
unsigned int flags,
krb5_db_entry **entry);
/*
* Optional: Create or modify a principal entry. db_args communicates
* command-line arguments for module-specific flags.
*
* The mask field of an entry indicates the changed fields. Mask values
* are defined in kadmin's admin.h header. If KADM5_PRINCIPAL is set in
* the mask, the entry is new; otherwise it already exists. All fields of
* an entry are expected to contain correct values, regardless of whether
* they are specified in the mask, so it is acceptable for a module to
* ignore the mask and update the entire entry.
*/
krb5_error_code (*put_principal)(krb5_context kcontext,
krb5_db_entry *entry, char **db_args);
/*
* Optional: Delete the entry for the principal search_for. If the
* principal did not exist, return KRB5_KDB_NOENTRY.
*/
krb5_error_code (*delete_principal)(krb5_context kcontext,
krb5_const_principal search_for);
/*
* Optional with default: Rename a principal. If the source principal does
* not exist, return KRB5_KDB_NOENTRY. If the target exists, return an
* error.
*
* NOTE: If the module chooses to implement a custom function for renaming
* a principal instead of using the default, then rename operations will
* fail if iprop logging is enabled.
*/
krb5_error_code (*rename_principal)(krb5_context kcontext,
krb5_const_principal source,
krb5_const_principal target);
/*
* Optional: For each principal entry in the database, invoke func with the
* argments func_arg and the entry data. If match_entry is specified, the
* module may narrow the iteration to principal names matching that regular
* expression; a module may alternatively ignore match_entry.
*/
krb5_error_code (*iterate)(krb5_context kcontext,
char *match_entry,
int (*func)(krb5_pointer, krb5_db_entry *),
krb5_pointer func_arg, krb5_flags iterflags);
/*
* Optional: Create a password policy entry. Return an error if the policy
* already exists.
*/
krb5_error_code (*create_policy)(krb5_context kcontext,
osa_policy_ent_t policy);
/*
* Optional: Set *policy to the policy entry of the specified name. If the
* entry does not exist, return KRB5_KDB_NOENTRY.
*/
krb5_error_code (*get_policy)(krb5_context kcontext, char *name,
osa_policy_ent_t *policy);
/*
* Optional: Modify an existing password policy entry to match the values
* in policy. Return an error if the policy does not already exist.
*/
krb5_error_code (*put_policy)(krb5_context kcontext,
osa_policy_ent_t policy);
/*
* Optional: For each password policy entry in the database, invoke func
* with the argments data and the entry data. If match_entry is specified,
* the module may narrow the iteration to policy names matching that
* regular expression; a module may alternatively ignore match_entry.
*/
krb5_error_code (*iter_policy)(krb5_context kcontext, char *match_entry,
osa_adb_iter_policy_func func,
void *data);
/*
* Optional: Delete the password policy entry with the name policy. Return
* an error if the entry does not exist.
*/
krb5_error_code (*delete_policy)(krb5_context kcontext, char *policy);
/*
* Optional with default: Retrieve a master keyblock from the stash file
* db_args, filling in *key and *kvno. mname is the name of the master
* principal for the realm.
*
* The default implementation reads the master keyblock from a keytab or
* old-format stash file.
*/
krb5_error_code (*fetch_master_key)(krb5_context kcontext,
krb5_principal mname,
krb5_keyblock *key, krb5_kvno *kvno,
char *db_args);
/*
* Optional with default: Given a keyblock for some version of the
* database's master key, fetch the decrypted master key values from the
* database and store the list into *mkeys_list. The caller will free
* *mkeys_list using a libkdb5 function which uses the standard free()
* function, so the module must not use a custom allocator.
*
* The caller may not know the version number of the master key it has, in
* which case it will pass IGNORE_VNO.
*
* The default implementation ignores kvno and tries the key against the
* current master key data and all KRB5_TL_MKEY_AUX values, which contain
* copies of the master keys encrypted with old master keys.
*/
krb5_error_code (*fetch_master_key_list)(krb5_context kcontext,
krb5_principal mname,
const krb5_keyblock *key,
krb5_keylist_node **mkeys_list);
/*
* Optional with default: Save a list of master keyblocks, obtained from
* fetch_master_key_list, into the stash file db_arg. The caller will set
* master_pwd to NULL, so the module should just ignore it. mname is the
* name of the master principal for the realm.
*
* The default implementation saves the list of master keys in a
* keytab-format file.
*/
krb5_error_code (*store_master_key_list)(krb5_context kcontext,
char *db_arg,
krb5_principal mname,
krb5_keylist_node *keylist,
char *master_pwd);
/*
* Optional with default: Starting at position *start, scan the key data of
* a database entry for a key matching the enctype ktype, the salt type
* stype, and the version kvno. Store the resulting key into *kdatap and
* set *start to the position after the key found. If ktype is negative,
* match any enctype. If stype is negative, match any salt type. If kvno
* is zero or negative, find the most recent key version satisfying the
* other constraints.
*/
krb5_error_code (*dbe_search_enctype)(krb5_context kcontext,
krb5_db_entry *dbentp,
krb5_int32 *start, krb5_int32 ktype,
krb5_int32 stype, krb5_int32 kvno,
krb5_key_data **kdatap);
/*
* Optional with default: Change the key data for db_entry to include keys
* derived from the password passwd in each of the specified key-salt
* types, at version new_kvno. Discard the old key data if keepold is not
* set.
*
* The default implementation uses the keyblock master_key to encrypt each
* new key, via the function encrypt_key_data.
*/
krb5_error_code (*change_pwd)(krb5_context context,
krb5_keyblock *master_key,
krb5_key_salt_tuple *ks_tuple,
int ks_tuple_count, char *passwd,
int new_kvno, krb5_boolean keepold,
krb5_db_entry *db_entry);
/*
* Optional: Promote a temporary database to be the live one. context must
* be initialized with an exclusively locked database created with the
* "temporary" db_arg. On success, the database object contained in
* context will be finalized.
*
* This method is used by kdb5_util load to replace the live database with
* minimal loss of read availability.
*/
krb5_error_code (*promote_db)(krb5_context context, char *conf_section,
char **db_args);
/*
* Optional with default: Decrypt the key in key_data with master keyblock
* mkey, placing the result into dbkey. Copy the salt from key_data, if
* any, into keysalt. Either dbkey or keysalt may be left unmodified on
* successful return if key_data does not contain key or salt information.
*
* The default implementation expects the encrypted key (in krb5_c_encrypt
* format) to be stored in key_data_contents[0], with length given by
* key_data_length[0]. If key_data_ver is 2, it expects the salt to be
* stored, unencrypted, in key_data_contents[1], with length given by
* key_data_length[1].
*/
krb5_error_code (*decrypt_key_data)(krb5_context kcontext,
const krb5_keyblock *mkey,
const krb5_key_data *key_data,
krb5_keyblock *dbkey,
krb5_keysalt *keysalt);
/*
* Optional with default: Encrypt dbkey with master keyblock mkey, placing
* the result into key_data along with keysalt.
*
* The default implementation stores the encrypted key (in krb5_c_encrypt
* format) in key_data_contents[0] and the length in key_data_length[0].
* If keysalt is specified, it sets key_data_ver to 2, and stores the salt
* in key_data_contents[1] and its length in key_data_length[1]. If
* keysalt is not specified, key_data_ver is set to 1.
*/
krb5_error_code (*encrypt_key_data)(krb5_context kcontext,
const krb5_keyblock *mkey,
const krb5_keyblock *dbkey,
const krb5_keysalt *keysalt,
int keyver, krb5_key_data *key_data);
/*
* Optional: Generate signed authorization data, such as a Windows PAC, for
* the ticket to be returned to the client. Place the signed authorization
* data, if any, in *signed_auth_data. This function will be invoked for
* an AS request if the client included padata requesting a PAC. This
* function will be invoked for a TGS request if there is authorization
* data in the TGT, if the client is from another realm, or if the TGS
* request is an S4U2Self or S4U2Proxy request. This function will not be
* invoked during TGS requests if the server principal has the
* no_auth_data_required attribute set. Input parameters are:
*
* flags: The flags used to look up the client principal.
*
* client_princ: For S4U2Self and S4U2Proxy TGS requests, the client
* principal requested by the service; for regular TGS requests, the
* possibly-canonicalized client principal.
*
* server_princ: The server principal in the request.
*
* client: The DB entry of the client if it is in the local realm, NULL
* if not. For S4U2Self and S4U2Proxy TGS requests, this is the DB
* entry for the client principal requested by the service.
*
* server: The DB entry of the service principal, or of a cross-realm
* krbtgt principal in case of referral.
*
* header_server: For S4U2Proxy requests, the DB entry of the second
* ticket server. For other TGS requests, the DB entry of the header
* ticket server. For AS requests, NULL.
*
* local_tgt: the DB entry of the local krbtgt principal.
*
* client_key: The reply key for the KDC request, before any FAST armor
* is applied. For AS requests, this may be the client's long-term key
* or a key chosen by a preauth mechanism. For TGS requests, this may
* be the subkey found in the AP-REQ or the session key of the TGT.
*
* server_key: The server key used to encrypt the returned ticket.
*
* header_key: For S4U2Proxy requests, the key used to decrypt the second
* ticket. For TGS requests, the key used to decrypt the header
* ticket. For AS requests, NULL.
*
* local_tgt_key: The decrypted first key of local_tgt.
*
* session_key: The session key of the ticket being granted to the
* requestor.
*
* authtime: The timestamp of the original client authentication time.
* For AS requests, this is the current time. For TGS requests, this
* is the authtime of the subject ticket (TGT or S4U2Proxy evidence
* ticket).
*
* tgt_auth_data: For TGS requests, the authorization data present in the
* subject ticket. For AS requests, NULL.
*
* ad_info: For TGS requests, the parsed authorization data if obtained
* by get_authdata_info method from the authorization data present in
* the subject ticket. Otherwise NULL.
*
* auth_indicators: Points to NULL or a null-terminated list of krb5_data
* pointers, each containing an authentication indicator (RFC 8129).
* The method may modify this list, or free it and replace
* *auth_indicators with NULL, to change which auth indicators will be
* included in the ticket.
*/
krb5_error_code (*sign_authdata)(krb5_context kcontext,
unsigned int flags,
krb5_const_principal client_princ,
krb5_const_principal server_princ,
krb5_db_entry *client,
krb5_db_entry *server,
krb5_db_entry *header_server,
krb5_db_entry *local_tgt,
krb5_keyblock *client_key,
krb5_keyblock *server_key,
krb5_keyblock *header_key,
krb5_keyblock *local_tgt_key,
krb5_keyblock *session_key,
krb5_timestamp authtime,
krb5_authdata **tgt_auth_data,
void *ad_info,
krb5_data ***auth_indicators,
krb5_authdata ***signed_auth_data);
/*
* Optional: Perform a policy check on a cross-realm ticket's transited
* field. Return 0 if the check authoritatively succeeds,
* KRB5_PLUGIN_NO_HANDLE to use the core transited-checking mechanisms, or
* another error (other than KRB5_PLUGIN_OP_NOTSUPP) if the check fails.
*/
krb5_error_code (*check_transited_realms)(krb5_context kcontext,
const krb5_data *tr_contents,
const krb5_data *client_realm,
const krb5_data *server_realm);
/*
* Optional: Perform a policy check on an AS request, in addition to the
* standard policy checks. Return 0 if the AS request is allowed. If the
* AS request is not allowed:
* - Place a short string literal into *status.
* - If desired, place data into e_data. Any data placed here will be
* freed by the caller using the standard free function.
* - Return an appropriate error (such as KRB5KDC_ERR_POLICY).
*/
krb5_error_code (*check_policy_as)(krb5_context kcontext,
krb5_kdc_req *request,
krb5_db_entry *client,
krb5_db_entry *server,
krb5_timestamp kdc_time,
const char **status,
krb5_pa_data ***e_data);
/*
* Optional: Perform a policy check on a TGS request, in addition to the
* standard policy checks. Return 0 if the TGS request is allowed. If the
* TGS request is not allowed:
* - Place a short string literal into *status.
* - If desired, place data into e_data. Any data placed here will be
* freed by the caller using the standard free function.
* - Return an appropriate error (such as KRB5KDC_ERR_POLICY).
* The input parameter ticket contains the TGT used in the TGS request.
*/
krb5_error_code (*check_policy_tgs)(krb5_context kcontext,
krb5_kdc_req *request,
krb5_db_entry *server,
krb5_ticket *ticket,
const char **status,
krb5_pa_data ***e_data);
/*
* Optional: This method informs the module of a successful or unsuccessful
* AS request.
*/
void (*audit_as_req)(krb5_context kcontext, krb5_kdc_req *request,
const krb5_address *local_addr,
const krb5_address *remote_addr,
krb5_db_entry *client, krb5_db_entry *server,
krb5_timestamp authtime, krb5_error_code error_code);
/* Note: there is currently no method for auditing TGS requests. */
/*
* Optional: This method informs the module of a request to reload
* configuration or other state (that is, the KDC received a SIGHUP).
*/
void (*refresh_config)(krb5_context kcontext);
/*
* Optional: Perform a policy check on server being allowed to obtain
* tickets from client to proxy. (Note that proxy is the target of the
* delegation, not the delegating service; the term "proxy" is from the
* viewpoint of the delegating service asking another service to perform
* some of its work in the authentication context of the client. This
* terminology comes from the Microsoft S4U protocol documentation.)
* Return 0 if policy allows it, or an appropriate error (such as
* KRB5KDC_ERR_POLICY) if not. If this method is not implemented, all
* S4U2Proxy delegation requests will be rejected.
*/
krb5_error_code (*check_allowed_to_delegate)(krb5_context context,
krb5_const_principal client,
const krb5_db_entry *server,
krb5_const_principal proxy);
/*
* Optional: Free the e_data pointer of a database entry. If this method
* is not implemented, the e_data pointer in principal entries will be
* freed with free() as seen by libkdb5.
*/
void (*free_principal_e_data)(krb5_context kcontext, krb5_octet *e_data);
/*
* Optional: get a principal entry for S4U2Self based on X509 certificate.
*
* If flags include KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY, princ->realm
* indicates the request realm, but the data components should be ignored.
* The module can return an out-of-realm client referral as it would for
* get_principal().
*
* If flags does not include KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY, princ is
* from PA-S4U-X509-USER. If it contains data components (and not just a
* realm), the module should verify that it is the same as the lookup
* result for client_cert. The module should not return a referral.
*/
krb5_error_code (*get_s4u_x509_principal)(krb5_context kcontext,
const krb5_data *client_cert,
krb5_const_principal princ,
unsigned int flags,
krb5_db_entry **entry_out);
/*
* Optional: Perform a policy check on server being allowed to obtain
* tickets from client to proxy. This method is similar to
* check_allowed_to_delegate, but it operates on the target server DB entry
* (called "proxy" here as in Microsoft's protocol documentation) rather
* than the intermediate server entry. server_ad_info represents the
* authdata of the intermediate server, as returned by the
* get_authdata_info method on the header ticket. Return 0 if policy
* allows the delegation, or an appropriate error (such as
* KRB5KDC_ERR_POLICY) if not.
*
* This method is called for S4U2Proxy requests and implements the
* resource-based constrained delegation variant, which can support
* cross-realm delegation. If this method is not implemented or if it
* returns a policy error, the KDC will fall back to
* check_allowed_to_delegate if the intermediate and target servers are in
* the same realm and the evidence ticket is forwardable.
*/
krb5_error_code (*allowed_to_delegate_from)(krb5_context context,
krb5_const_principal client,
krb5_const_principal server,
void *server_ad_info,
const krb5_db_entry *proxy);
/*
* Optional: Perform verification and policy checks on authorization data,
* such as a Windows PAC, based on the request client lookup flags. Return
* 0 if all checks have passed. Optionally return a representation of the
* authdata in *ad_info_out, to be consumed by allowed_to_delegate_from and
* sign_authdata. Returning *ad_info_out is required to support
* resource-based constrained delegation.
*
* If the KRB5_KDB_FLAG_CONSTRAINED_DELEGATION bit is set, a PAC must be
* provided and verified, and an error should be returned if the client is
* not allowed to delegate. If the KRB5_KDB_FLAG_CROSS_REALM bit is also
* set, set *client_out to the client name in the PAC; this indicates the
* requested client principal for a cross-realm S4U2Proxy request.
*
* This method is called for TGS requests on the authorization data from
* the header ticket. For S4U2Proxy requests it is also called on the
* authorization data from the evidence ticket. If the
* KRB5_KDB_FLAG_PROTOCOL_TRANSITION bit is set in flags, the authdata is
* from the header ticket of an S4U2Self referral request, and the supplied
* client_princ is the requested client.
*/
krb5_error_code (*get_authdata_info)(krb5_context context,
unsigned int flags,
krb5_authdata **in_authdata,
krb5_const_principal client_princ,
krb5_const_principal server_princ,
krb5_keyblock *server_key,
krb5_keyblock *krbtgt_key,
krb5_db_entry *krbtgt,
krb5_timestamp authtime,
void **ad_info_out,
krb5_principal *client_out);
void (*free_authdata_info)(krb5_context context,
void *ad_info);
/* End of minor version 0 for major version 8. */
} kdb_vftabl;
#endif /* !defined(_WIN32) */
#endif /* KRB5_KDB5__ */
/*
* Copyright 2011 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*** THE FOLLOWING ARE FOR IMPLEMENTATION MODULES ONLY ***/
#ifndef VERTO_MODULE_H_
#define VERTO_MODULE_H_
#include <verto.h>
#ifndef VERTO_MODULE_TYPES
#define VERTO_MODULE_TYPES
typedef void verto_mod_ctx;
typedef void verto_mod_ev;
#endif
#define VERTO_MODULE_VERSION 3
#define VERTO_MODULE_TABLE(name) verto_module_table_ ## name
#define VERTO_MODULE(name, symb, types) \
static verto_ctx_funcs name ## _funcs = { \
name ## _ctx_new, \
name ## _ctx_default, \
name ## _ctx_free, \
name ## _ctx_run, \
name ## _ctx_run_once, \
name ## _ctx_break, \
name ## _ctx_reinitialize, \
name ## _ctx_set_flags, \
name ## _ctx_add, \
name ## _ctx_del \
}; \
verto_module VERTO_MODULE_TABLE(name) = { \
VERTO_MODULE_VERSION, \
# name, \
# symb, \
types, \
&name ## _funcs, \
}; \
verto_ctx * \
verto_new_ ## name() \
{ \
return verto_convert(name, 0, NULL); \
} \
verto_ctx * \
verto_default_ ## name() \
{ \
return verto_convert(name, 1, NULL); \
}
typedef struct {
/* Required */ verto_mod_ctx *(*ctx_new)();
/* Optional */ verto_mod_ctx *(*ctx_default)();
/* Required */ void (*ctx_free)(verto_mod_ctx *ctx);
/* Optional */ void (*ctx_run)(verto_mod_ctx *ctx);
/* Required */ void (*ctx_run_once)(verto_mod_ctx *ctx);
/* Optional */ void (*ctx_break)(verto_mod_ctx *ctx);
/* Optional */ void (*ctx_reinitialize)(verto_mod_ctx *ctx);
/* Optional */ void (*ctx_set_flags)(verto_mod_ctx *ctx,
const verto_ev *ev,
verto_mod_ev *modev);
/* Required */ verto_mod_ev *(*ctx_add)(verto_mod_ctx *ctx,
const verto_ev *ev,
verto_ev_flag *flags);
/* Required */ void (*ctx_del)(verto_mod_ctx *ctx,
const verto_ev *ev,
verto_mod_ev *modev);
} verto_ctx_funcs;
typedef struct {
unsigned int vers;
const char *name;
const char *symb;
verto_ev_type types;
verto_ctx_funcs *funcs;
} verto_module;
/**
* Converts an existing implementation specific loop to a verto_ctx.
*
* This function also sets the internal default implementation so that future
* calls to verto_new(NULL) or verto_default(NULL) will use this specific
* implementation if it was not already set.
*
* @param name The name of the module (unquoted)
* @param deflt Whether the ctx is the default context or not
* @param ctx The context to store
* @return A new verto_ctx, or NULL on error. Call verto_free() when done.
*/
#define verto_convert(name, deflt, ctx) \
verto_convert_module(&VERTO_MODULE_TABLE(name), deflt, ctx)
/**
* Converts an existing implementation specific loop to a verto_ctx.
*
* If you are a module implementation, you probably want the macro above. This
* function is generally used directly only when an application is attempting
* to expose a home-grown event loop to verto.
*
* If deflt is non-zero and a default ctx was already defined for this module
* and ctx is not NULL, than ctx will be free'd and the previously defined
* default will be returned.
*
* If ctx is non-NULL, than the pre-existing verto_mod_ctx will be converted to
* to a verto_ctx; if deflt is non-zero than this verto_mod_ctx will also be
* marked as the default loop for this process. If ctx is NULL, than the
* appropriate constructor will be called: either module->ctx_new() or
* module->ctx_default() depending on the boolean value of deflt. If
* module->ctx_default is NULL and deflt is non-zero, than module->ctx_new()
* will be called and the resulting verto_mod_ctx will be utilized as the
* default.
*
* This function also sets the internal default implementation so that future
* calls to verto_new(NULL) or verto_default(NULL) will use this specific
* implementation if it was not already set.
*
* @param name The name of the module (unquoted)
* @param ctx The context private to store
* @return A new verto_ctx, or NULL on error. Call verto_free() when done.
*/
verto_ctx *
verto_convert_module(const verto_module *module, int deflt, verto_mod_ctx *ctx);
/**
* Calls the callback of the verto_ev and then frees it via verto_del().
*
* The verto_ev is not freed (verto_del() is not called) if it is a signal event.
*
* @see verto_add_read()
* @see verto_add_write()
* @see verto_add_timeout()
* @see verto_add_idle()
* @see verto_add_signal()
* @see verto_add_child()
* @see verto_del()
* @param ev The verto_ev
*/
void
verto_fire(verto_ev *ev);
/**
* Sets the status of the pid/handle which caused this event to fire.
*
* This function does nothing if the verto_ev is not a child type.
*
* @see verto_add_child()
* @param ev The verto_ev to set the status in.
* @param status The pid/handle status.
*/
void
verto_set_proc_status(verto_ev *ev, verto_proc_status status);
/**
* Sets the state of the fd which caused this event to fire.
*
* This function does nothing if the verto_ev is not a io type.
*
* Only the flags VERTO_EV_FLAG_IO_(READ|WRITE|ERROR) are supported. All other
* flags are unset.
*
* @see verto_add_io()
* @param ev The verto_ev to set the state in.
* @param state The fd state.
*/
void
verto_set_fd_state(verto_ev *ev, verto_ev_flag state);
#endif /* VERTO_MODULE_H_ */
/* jconfig.h. Generated from jconfig.h.in by configure. */
/* Version ID for the JPEG library.
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
*/
#define JPEG_LIB_VERSION 62
/* libjpeg-turbo version */
#define LIBJPEG_TURBO_VERSION 1.5.3
/* libjpeg-turbo version in integer form */
#define LIBJPEG_TURBO_VERSION_NUMBER 1005003
/* Support arithmetic encoding */
#define C_ARITH_CODING_SUPPORTED 1
/* Support arithmetic decoding */
#define D_ARITH_CODING_SUPPORTED 1
/*
* Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting)
* 12 for 12-bit sample values
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
* JPEG standard, and the IJG code does not support anything else!
* We do not support run-time selection of data precision, sorry.
*/
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if the system has the type `unsigned char'. */
#define HAVE_UNSIGNED_CHAR 1
/* Define to 1 if the system has the type `unsigned short'. */
#define HAVE_UNSIGNED_SHORT 1
/* Compiler does not support pointers to undefined structures. */
/* #undef INCOMPLETE_TYPES_BROKEN */
/* Support in-memory source/destination managers */
#define MEM_SRCDST_SUPPORTED 1
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
memset/memcpy in <string.h>. */
/* #undef NEED_BSD_STRINGS */
/* Define if you need to include <sys/types.h> to get size_t. */
#define NEED_SYS_TYPES_H 1
/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
/* Use accelerated SIMD routines. */
#define WITH_SIMD 1
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
/* # undef __CHAR_UNSIGNED__ */
#endif
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _REGEXP_H
#define _REGEXP_H 1
/* The contents of this header file were originally standardized in
the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
the header was marked as TO BE WITHDRAWN, and new applications
were encouraged to use <regex.h> instead. It was officially
withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
The GNU C Library provided this header through version 2.22. */
#error "The GNU C Library no longer implements <regexp.h>."
#error "Please update your code to use <regex.h> instead (no trailing 'p')."
#endif /* regexp.h */
#ifndef __ASM_GENERIC_BPF_PERF_EVENT_H__
#define __ASM_GENERIC_BPF_PERF_EVENT_H__
#include <linux/ptrace.h>
/* Export kernel pt_regs structure */
typedef struct pt_regs bpf_user_pt_regs_t;
#endif /* __ASM_GENERIC_BPF_PERF_EVENT_H__ */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SIGNAL_DEFS_H
#define __ASM_GENERIC_SIGNAL_DEFS_H
#ifndef SIG_BLOCK
#define SIG_BLOCK 0 /* for blocking signals */
#endif
#ifndef SIG_UNBLOCK
#define SIG_UNBLOCK 1 /* for unblocking signals */
#endif
#ifndef SIG_SETMASK
#define SIG_SETMASK 2 /* for setting the signal mask */
#endif
#ifndef __ASSEMBLY__
typedef void __signalfn_t(int);
typedef __signalfn_t *__sighandler_t;
typedef void __restorefn_t(void);
typedef __restorefn_t *__sigrestore_t;
#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
#endif
#endif /* __ASM_GENERIC_SIGNAL_DEFS_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_UCONTEXT_H
#define __ASM_GENERIC_UCONTEXT_H
struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask; /* mask last for extensibility */
};
#endif /* __ASM_GENERIC_UCONTEXT_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SETUP_H
#define __ASM_GENERIC_SETUP_H
#define COMMAND_LINE_SIZE 512
#endif /* __ASM_GENERIC_SETUP_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SHMPARAM_H
#define __ASM_GENERIC_SHMPARAM_H
#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
#endif /* _ASM_GENERIC_SHMPARAM_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SIGNAL_H
#define __ASM_GENERIC_SIGNAL_H
#include <linux/types.h>
#define _NSIG 64
#define _NSIG_BPW __BITS_PER_LONG
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
#define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT 6
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
#define SIGSTKFLT 16
#define SIGCHLD 17
#define SIGCONT 18
#define SIGSTOP 19
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGURG 23
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPOLL SIGIO
/*
#define SIGLOST 29
*/
#define SIGPWR 30
#define SIGSYS 31
#define SIGUNUSED 31
/* These should not be considered constants from userland. */
#define SIGRTMIN 32
#ifndef SIGRTMAX
#define SIGRTMAX _NSIG
#endif
/*
* SA_FLAGS values:
*
* SA_ONSTACK indicates that a registered stack_t will be used.
* SA_RESTART flag to get restarting signals (which were the default long ago)
* SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
* SA_RESETHAND clears the handler when the signal is delivered.
* SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
* SA_NODEFER prevents the current signal from being masked in the handler.
*
* SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
* Unix names RESETHAND and NODEFER respectively.
*/
#define SA_NOCLDSTOP 0x00000001
#define SA_NOCLDWAIT 0x00000002
#define SA_SIGINFO 0x00000004
#define SA_ONSTACK 0x08000000
#define SA_RESTART 0x10000000
#define SA_NODEFER 0x40000000
#define SA_RESETHAND 0x80000000
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
/*
* New architectures should not define the obsolete
* SA_RESTORER 0x04000000
*/
#if !defined MINSIGSTKSZ || !defined SIGSTKSZ
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#endif
#ifndef __ASSEMBLY__
typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
/* not actually used, but required for linux/syscalls.h */
typedef unsigned long old_sigset_t;
#include <asm-generic/signal-defs.h>
#ifdef SA_RESTORER
#define __ARCH_HAS_SA_RESTORER
#endif
struct sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
#ifdef SA_RESTORER
__sigrestore_t sa_restorer;
#endif
sigset_t sa_mask; /* mask last for extensibility */
};
typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
} stack_t;
#endif /* __ASSEMBLY__ */
#endif /* __ASM_GENERIC_SIGNAL_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_TERMIOS_H
#define _ASM_GENERIC_TERMIOS_H
/*
* Most architectures have straight copies of the x86 code, with
* varying levels of bug fixes on top. Usually it's a good idea
* to use this generic version instead, but be careful to avoid
* ABI changes.
* New architectures should not provide their own version.
*/
#include <asm/termbits.h>
#include <asm/ioctls.h>
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
#define NCC 8
struct termio {
unsigned short c_iflag; /* input mode flags */
unsigned short c_oflag; /* output mode flags */
unsigned short c_cflag; /* control mode flags */
unsigned short c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[NCC]; /* control characters */
};
/* modem lines */
#define TIOCM_LE 0x001
#define TIOCM_DTR 0x002
#define TIOCM_RTS 0x004
#define TIOCM_ST 0x008
#define TIOCM_SR 0x010
#define TIOCM_CTS 0x020
#define TIOCM_CAR 0x040
#define TIOCM_RNG 0x080
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#endif /* _ASM_GENERIC_TERMIOS_H */
/*
* There isn't anything here, but the file must not be empty or patch
* will delete it.
*/
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_RESOURCE_H
#define _ASM_GENERIC_RESOURCE_H
/*
* Resource limit IDs
*
* ( Compatibility detail: there are architectures that have
* a different rlimit ID order in the 5-9 range and want
* to keep that order for binary compatibility. The reasons
* are historic and all new rlimits are identical across all
* arches. If an arch has such special order for some rlimits
* then it defines them prior including asm-generic/resource.h. )
*/
#define RLIMIT_CPU 0 /* CPU time in sec */
#define RLIMIT_FSIZE 1 /* Maximum filesize */
#define RLIMIT_DATA 2 /* max data size */
#define RLIMIT_STACK 3 /* max stack size */
#define RLIMIT_CORE 4 /* max core file size */
#ifndef RLIMIT_RSS
# define RLIMIT_RSS 5 /* max resident set size */
#endif
#ifndef RLIMIT_NPROC
# define RLIMIT_NPROC 6 /* max number of processes */
#endif
#ifndef RLIMIT_NOFILE
# define RLIMIT_NOFILE 7 /* max number of open files */
#endif
#ifndef RLIMIT_MEMLOCK
# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
#endif
#ifndef RLIMIT_AS
# define RLIMIT_AS 9 /* address space limit */
#endif
#define RLIMIT_LOCKS 10 /* maximum file locks held */
#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
0-39 for nice level 19 .. -20 */
#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
#define RLIM_NLIMITS 16
/*
* SuS says limits have to be unsigned.
* Which makes a ton more sense anyway.
*
* Some architectures override this (for compatibility reasons):
*/
#ifndef RLIM_INFINITY
# define RLIM_INFINITY (~0UL)
#endif
#endif /* _ASM_GENERIC_RESOURCE_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_BITS_PER_LONG
#define __ASM_GENERIC_BITS_PER_LONG
/*
* There seems to be no way of detecting this automatically from user
* space, so 64 bit architectures should override this in their
* bitsperlong.h. In particular, an architecture that supports
* both 32 and 64 bit user space must not rely on CONFIG_64BIT
* to decide it, but rather check a compiler provided macro.
*/
#ifndef __BITS_PER_LONG
#define __BITS_PER_LONG 32
#endif
#endif /* __ASM_GENERIC_BITS_PER_LONG */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SOCKET_H
#define __ASM_GENERIC_SOCKET_H
#include <asm/sockios.h>
/* For setsockopt(2) */
#define SOL_SOCKET 1
#define SO_DEBUG 1
#define SO_REUSEADDR 2
#define SO_TYPE 3
#define SO_ERROR 4
#define SO_DONTROUTE 5
#define SO_BROADCAST 6
#define SO_SNDBUF 7
#define SO_RCVBUF 8
#define SO_SNDBUFFORCE 32
#define SO_RCVBUFFORCE 33
#define SO_KEEPALIVE 9
#define SO_OOBINLINE 10
#define SO_NO_CHECK 11
#define SO_PRIORITY 12
#define SO_LINGER 13
#define SO_BSDCOMPAT 14
#define SO_REUSEPORT 15
#ifndef SO_PASSCRED /* powerpc only differs in these */
#define SO_PASSCRED 16
#define SO_PEERCRED 17
#define SO_RCVLOWAT 18
#define SO_SNDLOWAT 19
#define SO_RCVTIMEO 20
#define SO_SNDTIMEO 21
#endif
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define SO_SECURITY_ENCRYPTION_NETWORK 24
#define SO_BINDTODEVICE 25
/* Socket filtering */
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
#define SO_GET_FILTER SO_ATTACH_FILTER
#define SO_PEERNAME 28
#define SO_TIMESTAMP 29
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
#define SO_PASSSEC 34
#define SO_TIMESTAMPNS 35
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
#define SO_MARK 36
#define SO_TIMESTAMPING 37
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_PROTOCOL 38
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS
#define SO_PEEK_OFF 42
/* Instruct lower device to use last 4-bytes of skb data as FCS */
#define SO_NOFCS 43
#define SO_LOCK_FILTER 44
#define SO_SELECT_ERR_QUEUE 45
#define SO_BUSY_POLL 46
#define SO_MAX_PACING_RATE 47
#define SO_BPF_EXTENSIONS 48
#define SO_INCOMING_CPU 49
#define SO_ATTACH_BPF 50
#define SO_DETACH_BPF SO_DETACH_FILTER
#define SO_ATTACH_REUSEPORT_CBPF 51
#define SO_ATTACH_REUSEPORT_EBPF 52
#define SO_CNX_ADVICE 53
#define SCM_TIMESTAMPING_OPT_STATS 54
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#define SO_COOKIE 57
#define SCM_TIMESTAMPING_PKTINFO 58
#define SO_PEERGROUPS 59
#define SO_ZEROCOPY 60
#define SO_TXTIME 61
#define SCM_TXTIME SO_TXTIME
#define SO_BINDTOIFINDEX 62
#define SO_DETACH_REUSEPORT_BPF 68
#define SO_PREFER_BUSY_POLL 69
#define SO_BUSY_POLL_BUDGET 70
#endif /* __ASM_GENERIC_SOCKET_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SEMBUF_H
#define __ASM_GENERIC_SEMBUF_H
#include <asm/bitsperlong.h>
/*
* The semid64_ds structure for x86 architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* semid64_ds was originally meant to be architecture specific, but
* everyone just ended up making identical copies without specific
* optimizations, so we may just as well all use the same one.
*
* 64 bit architectures use a 64-bit __kernel_time_t here, while
* 32 bit architectures have a pair of unsigned long values.
* so they do not need the first two padding words.
*
* On big-endian systems, the padding is in the wrong place for
* historic reasons, so user space has to reconstruct a time_t
* value using
*
* user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
* ((long long)kernel_semid64_ds.sem_otime_high << 32)
*
* Pad space is left for 2 miscellaneous 32-bit values
*/
struct semid64_ds {
struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
#if __BITS_PER_LONG == 64
__kernel_time_t sem_otime; /* last semop time */
__kernel_time_t sem_ctime; /* last change time */
#else
unsigned long sem_otime; /* last semop time */
unsigned long sem_otime_high;
unsigned long sem_ctime; /* last change time */
unsigned long sem_ctime_high;
#endif
unsigned long sem_nsems; /* no. of semaphores in array */
unsigned long __unused3;
unsigned long __unused4;
};
#endif /* __ASM_GENERIC_SEMBUF_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* asm-generic/int-l64.h
*
* Integer declarations for architectures which use "long"
* for 64-bit types.
*/
#ifndef _ASM_GENERIC_INT_L64_H
#define _ASM_GENERIC_INT_L64_H
#include <asm/bitsperlong.h>
#ifndef __ASSEMBLY__
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
*/
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
typedef __signed__ long __s64;
typedef unsigned long __u64;
#endif /* __ASSEMBLY__ */
#endif /* _ASM_GENERIC_INT_L64_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SHMBUF_H
#define __ASM_GENERIC_SHMBUF_H
#include <asm/bitsperlong.h>
/*
* The shmid64_ds structure for x86 architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* shmid64_ds was originally meant to be architecture specific, but
* everyone just ended up making identical copies without specific
* optimizations, so we may just as well all use the same one.
*
* 64 bit architectures typically define a 64 bit __kernel_time_t,
* so they do not need the first two padding words.
* On big-endian systems, the padding is in the wrong place.
*
*
* Pad space is left for:
* - 2 miscellaneous 32-bit values
*/
struct shmid64_ds {
struct ipc64_perm shm_perm; /* operation perms */
size_t shm_segsz; /* size of segment (bytes) */
#if __BITS_PER_LONG == 64
__kernel_time_t shm_atime; /* last attach time */
__kernel_time_t shm_dtime; /* last detach time */
__kernel_time_t shm_ctime; /* last change time */
#else
unsigned long shm_atime; /* last attach time */
unsigned long shm_atime_high;
unsigned long shm_dtime; /* last detach time */
unsigned long shm_dtime_high;
unsigned long shm_ctime; /* last change time */
unsigned long shm_ctime_high;
#endif
__kernel_pid_t shm_cpid; /* pid of creator */
__kernel_pid_t shm_lpid; /* pid of last operator */
unsigned long shm_nattch; /* no. of current attaches */
unsigned long __unused4;
unsigned long __unused5;
};
struct shminfo64 {
unsigned long shmmax;
unsigned long shmmin;
unsigned long shmmni;
unsigned long shmseg;
unsigned long shmall;
unsigned long __unused1;
unsigned long __unused2;
unsigned long __unused3;
unsigned long __unused4;
};
#endif /* __ASM_GENERIC_SHMBUF_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_IOCTL_H
#define _ASM_GENERIC_IOCTL_H
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
* size of the parameter structure in the lower 14 bits of the
* upper 16 bits.
* Encoding the size of the parameter structure in the ioctl request
* is useful for catching programs compiled with old versions
* and to avoid overwriting user space outside the user buffer area.
* The highest 2 bits are reserved for indicating the ``access mode''.
* NOTE: This limits the max parameter size to 16kB -1 !
*/
/*
* The following is for compatibility across the various Linux
* platforms. The generic ioctl numbering scheme doesn't really enforce
* a type field. De facto, however, the top 8 bits of the lower 16
* bits are indeed used as a type field, so we might just as well make
* this explicit here. Please be sure to use the decoding macros
* below from now on.
*/
#define _IOC_NRBITS 8
#define _IOC_TYPEBITS 8
/*
* Let any architecture override either of the following before
* including this file.
*/
#ifndef _IOC_SIZEBITS
# define _IOC_SIZEBITS 14
#endif
#ifndef _IOC_DIRBITS
# define _IOC_DIRBITS 2
#endif
#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
#define _IOC_NRSHIFT 0
#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
/*
* Direction bits, which any architecture can choose to override
* before including this file.
*
* NOTE: _IOC_WRITE means userland is writing and kernel is
* reading. _IOC_READ means userland is reading and kernel is writing.
*/
#ifndef _IOC_NONE
# define _IOC_NONE 0U
#endif
#ifndef _IOC_WRITE
# define _IOC_WRITE 1U
#endif
#ifndef _IOC_READ
# define _IOC_READ 2U
#endif
#define _IOC(dir,type,nr,size) \
(((dir) << _IOC_DIRSHIFT) | \
((type) << _IOC_TYPESHIFT) | \
((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT))
#define _IOC_TYPECHECK(t) (sizeof(t))
/*
* Used to create numbers.
*
* NOTE: _IOW means userland is writing and kernel is reading. _IOR
* means userland is reading and kernel is writing.
*/
#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
/* used to decode ioctl numbers.. */
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
/* ...and for the drivers/sound files... */
#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
#endif /* _ASM_GENERIC_IOCTL_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_IOCTLS_H
#define __ASM_GENERIC_IOCTLS_H
#include <linux/ioctl.h>
/*
* These are the most common definitions for tty ioctl numbers.
* Most of them do not use the recommended _IOC(), but there is
* probably some source code out there hardcoding the number,
* so we might as well use them for all new platforms.
*
* The architectures that use different values here typically
* try to be compatible with some Unix variants for the same
* architecture.
*/
/* 0x54 is just a magic number to make these relatively unique ('T') */
#define TCGETS 0x5401
#define TCSETS 0x5402
#define TCSETSW 0x5403
#define TCSETSF 0x5404
#define TCGETA 0x5405
#define TCSETA 0x5406
#define TCSETAW 0x5407
#define TCSETAF 0x5408
#define TCSBRK 0x5409
#define TCXONC 0x540A
#define TCFLSH 0x540B
#define TIOCEXCL 0x540C
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E
#define TIOCGPGRP 0x540F
#define TIOCSPGRP 0x5410
#define TIOCOUTQ 0x5411
#define TIOCSTI 0x5412
#define TIOCGWINSZ 0x5413
#define TIOCSWINSZ 0x5414
#define TIOCMGET 0x5415
#define TIOCMBIS 0x5416
#define TIOCMBIC 0x5417
#define TIOCMSET 0x5418
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
#define FIONREAD 0x541B
#define TIOCINQ FIONREAD
#define TIOCLINUX 0x541C
#define TIOCCONS 0x541D
#define TIOCGSERIAL 0x541E
#define TIOCSSERIAL 0x541F
#define TIOCPKT 0x5420
#define FIONBIO 0x5421
#define TIOCNOTTY 0x5422
#define TIOCSETD 0x5423
#define TIOCGETD 0x5424
#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
#define TIOCSBRK 0x5427 /* BSD compatibility */
#define TIOCCBRK 0x5428 /* BSD compatibility */
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TCGETS2 _IOR('T', 0x2A, struct termios2)
#define TCSETS2 _IOW('T', 0x2B, struct termios2)
#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
#define TIOCGRS485 0x542E
#ifndef TIOCSRS485
#define TIOCSRS485 0x542F
#endif
#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
#define TCSETX 0x5433
#define TCSETXF 0x5434
#define TCSETXW 0x5435
#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
#define TIOCVHANGUP 0x5437
#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
#define TIOCGISO7816 _IOR('T', 0x42, struct serial_iso7816)
#define TIOCSISO7816 _IOWR('T', 0x43, struct serial_iso7816)
#define FIONCLEX 0x5450
#define FIOCLEX 0x5451
#define FIOASYNC 0x5452
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
#define TIOCSERGETLSR 0x5459 /* Get line status register */
#define TIOCSERGETMULTI 0x545A /* Get multiport config */
#define TIOCSERSETMULTI 0x545B /* Set multiport config */
#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
#define TIOCGICOUNT 0x545D /* read serial port __inline__ interrupt counts */
/*
* Some arches already define FIOQSIZE due to a historical
* conflict with a Hayes modem-specific ioctl value.
*/
#ifndef FIOQSIZE
# define FIOQSIZE 0x5460
#endif
/* Used for packet mode */
#define TIOCPKT_DATA 0
#define TIOCPKT_FLUSHREAD 1
#define TIOCPKT_FLUSHWRITE 2
#define TIOCPKT_STOP 4
#define TIOCPKT_START 8
#define TIOCPKT_NOSTOP 16
#define TIOCPKT_DOSTOP 32
#define TIOCPKT_IOCTL 64
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
#endif /* __ASM_GENERIC_IOCTLS_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_TYPES_H
#define _ASM_GENERIC_TYPES_H
/*
* int-ll64 is used everywhere now.
*/
#include <asm-generic/int-ll64.h>
#endif /* _ASM_GENERIC_TYPES_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_POSIX_TYPES_H
#define __ASM_GENERIC_POSIX_TYPES_H
#include <asm/bitsperlong.h>
/*
* This file is generally used by user-level software, so you need to
* be a little careful about namespace pollution etc.
*
* First the types that are often defined in different ways across
* architectures, so that you can override them.
*/
#ifndef __kernel_long_t
typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;
#endif
#ifndef __kernel_ino_t
typedef __kernel_ulong_t __kernel_ino_t;
#endif
#ifndef __kernel_mode_t
typedef unsigned int __kernel_mode_t;
#endif
#ifndef __kernel_pid_t
typedef int __kernel_pid_t;
#endif
#ifndef __kernel_ipc_pid_t
typedef int __kernel_ipc_pid_t;
#endif
#ifndef __kernel_uid_t
typedef unsigned int __kernel_uid_t;
typedef unsigned int __kernel_gid_t;
#endif
#ifndef __kernel_suseconds_t
typedef __kernel_long_t __kernel_suseconds_t;
#endif
#ifndef __kernel_daddr_t
typedef int __kernel_daddr_t;
#endif
#ifndef __kernel_uid32_t
typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;
#endif
#ifndef __kernel_old_uid_t
typedef __kernel_uid_t __kernel_old_uid_t;
typedef __kernel_gid_t __kernel_old_gid_t;
#endif
#ifndef __kernel_old_dev_t
typedef unsigned int __kernel_old_dev_t;
#endif
/*
* Most 32 bit architectures use "unsigned int" size_t,
* and all 64 bit architectures use "unsigned long" size_t.
*/
#ifndef __kernel_size_t
#if __BITS_PER_LONG != 64
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
#else
typedef __kernel_ulong_t __kernel_size_t;
typedef __kernel_long_t __kernel_ssize_t;
typedef __kernel_long_t __kernel_ptrdiff_t;
#endif
#endif
#ifndef __kernel_fsid_t
typedef struct {
int val[2];
} __kernel_fsid_t;
#endif
/*
* anything below here should be completely generic
*/
typedef __kernel_long_t __kernel_off_t;
typedef long long __kernel_loff_t;
typedef __kernel_long_t __kernel_old_time_t;
typedef __kernel_long_t __kernel_time_t;
typedef long long __kernel_time64_t;
typedef __kernel_long_t __kernel_clock_t;
typedef int __kernel_timer_t;
typedef int __kernel_clockid_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
#endif /* __ASM_GENERIC_POSIX_TYPES_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_SOCKIOS_H
#define __ASM_GENERIC_SOCKIOS_H
/* Socket-level I/O control calls. */
#define FIOSETOWN 0x8901
#define SIOCSPGRP 0x8902
#define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* __ASM_GENERIC_SOCKIOS_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_MMAN_H
#define __ASM_GENERIC_MMAN_H
#include <asm-generic/mman-common.h>
#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
#define MAP_LOCKED 0x2000 /* pages are locked */
#define MAP_NORESERVE 0x4000 /* don't check for reservations */
/*
* Bits [26:31] are reserved, see asm-generic/hugetlb_encode.h
* for MAP_HUGETLB usage
*/
#define MCL_CURRENT 1 /* lock all current mappings */
#define MCL_FUTURE 2 /* lock all future mappings */
#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
#endif /* __ASM_GENERIC_MMAN_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_MMAN_COMMON_H
#define __ASM_GENERIC_MMAN_COMMON_H
/*
Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
Based on: asm-xxx/mman.h
*/
#define PROT_READ 0x1 /* page can be read */
#define PROT_WRITE 0x2 /* page can be written */
#define PROT_EXEC 0x4 /* page can be executed */
#define PROT_SEM 0x8 /* page may be used for atomic ops */
#define PROT_NONE 0x0 /* page can not be accessed */
#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
#define MAP_SHARED 0x01 /* Share changes */
#define MAP_PRIVATE 0x02 /* Changes are private */
#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
#define MAP_TYPE 0x0f /* Mask for type of mapping */
#define MAP_FIXED 0x10 /* Interpret addr exactly */
#define MAP_ANONYMOUS 0x20 /* don't use a file */
/* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */
#define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */
#define MAP_NONBLOCK 0x010000 /* do not block on IO */
#define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */
#define MAP_HUGETLB 0x040000 /* create a huge page mapping */
#define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */
#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be
* uninitialized */
/*
* Flags for mlock
*/
#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
#define MS_ASYNC 1 /* sync memory asynchronously */
#define MS_INVALIDATE 2 /* invalidate the caches */
#define MS_SYNC 4 /* synchronous memory sync */
#define MADV_NORMAL 0 /* no further special treatment */
#define MADV_RANDOM 1 /* expect random page references */
#define MADV_SEQUENTIAL 2 /* expect sequential page references */
#define MADV_WILLNEED 3 /* will need these pages */
#define MADV_DONTNEED 4 /* don't need these pages */
/* common parameters: try to keep these consistent across architectures */
#define MADV_FREE 8 /* free pages only if memory pressure */
#define MADV_REMOVE 9 /* remove these pages & resources */
#define MADV_DONTFORK 10 /* don't inherit across fork */
#define MADV_DOFORK 11 /* do inherit across fork */
#define MADV_HWPOISON 100 /* poison a page for testing */
#define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */
#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
overrides the coredump filter bits */
#define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */
#define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */
#define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */
#define MADV_COLD 20 /* deactivate these pages */
#define MADV_PAGEOUT 21 /* reclaim these pages */
/* compatibility flags */
#define MAP_FILE 0
#define PKEY_DISABLE_ACCESS 0x1
#define PKEY_DISABLE_WRITE 0x2
#define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\
PKEY_DISABLE_WRITE)
#endif /* __ASM_GENERIC_MMAN_COMMON_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_FCNTL_H
#define _ASM_GENERIC_FCNTL_H
#include <linux/types.h>
/*
* FMODE_EXEC is 0x20
* FMODE_NONOTIFY is 0x4000000
* These cannot be used by userspace O_* until internal and external open
* flags are split.
* -Eric Paris
*/
/*
* When introducing new O_* bits, please check its uniqueness in fcntl_init().
*/
#define O_ACCMODE 00000003
#define O_RDONLY 00000000
#define O_WRONLY 00000001
#define O_RDWR 00000002
#ifndef O_CREAT
#define O_CREAT 00000100 /* not fcntl */
#endif
#ifndef O_EXCL
#define O_EXCL 00000200 /* not fcntl */
#endif
#ifndef O_NOCTTY
#define O_NOCTTY 00000400 /* not fcntl */
#endif
#ifndef O_TRUNC
#define O_TRUNC 00001000 /* not fcntl */
#endif
#ifndef O_APPEND
#define O_APPEND 00002000
#endif
#ifndef O_NONBLOCK
#define O_NONBLOCK 00004000
#endif
#ifndef O_DSYNC
#define O_DSYNC 00010000 /* used to be O_SYNC, see below */
#endif
#ifndef FASYNC
#define FASYNC 00020000 /* fcntl, for BSD compatibility */
#endif
#ifndef O_DIRECT
#define O_DIRECT 00040000 /* direct disk access hint */
#endif
#ifndef O_LARGEFILE
#define O_LARGEFILE 00100000
#endif
#ifndef O_DIRECTORY
#define O_DIRECTORY 00200000 /* must be a directory */
#endif
#ifndef O_NOFOLLOW
#define O_NOFOLLOW 00400000 /* don't follow links */
#endif
#ifndef O_NOATIME
#define O_NOATIME 01000000
#endif
#ifndef O_CLOEXEC
#define O_CLOEXEC 02000000 /* set close_on_exec */
#endif
/*
* Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
* the O_SYNC flag. We continue to use the existing numerical value
* for O_DSYNC semantics now, but using the correct symbolic name for it.
* This new value is used to request true Posix O_SYNC semantics. It is
* defined in this strange way to make sure applications compiled against
* new headers get at least O_DSYNC semantics on older kernels.
*
* This has the nice side-effect that we can simply test for O_DSYNC
* wherever we do not care if O_DSYNC or O_SYNC is used.
*
* Note: __O_SYNC must never be used directly.
*/
#ifndef O_SYNC
#define __O_SYNC 04000000
#define O_SYNC (__O_SYNC|O_DSYNC)
#endif
#ifndef O_PATH
#define O_PATH 010000000
#endif
#ifndef __O_TMPFILE
#define __O_TMPFILE 020000000
#endif
/* a horrid kludge trying to make sure that this will fail on old kernels */
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
#ifndef O_NDELAY
#define O_NDELAY O_NONBLOCK
#endif
#define F_DUPFD 0 /* dup */
#define F_GETFD 1 /* get close_on_exec */
#define F_SETFD 2 /* set/clear close_on_exec */
#define F_GETFL 3 /* get file->f_flags */
#define F_SETFL 4 /* set file->f_flags */
#ifndef F_GETLK
#define F_GETLK 5
#define F_SETLK 6
#define F_SETLKW 7
#endif
#ifndef F_SETOWN
#define F_SETOWN 8 /* for sockets. */
#define F_GETOWN 9 /* for sockets. */
#endif
#ifndef F_SETSIG
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
#endif
#ifndef CONFIG_64BIT
#ifndef F_GETLK64
#define F_GETLK64 12 /* using 'struct flock64' */
#define F_SETLK64 13
#define F_SETLKW64 14
#endif
#endif
#ifndef F_SETOWN_EX
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
#endif
#ifndef F_GETOWNER_UIDS
#define F_GETOWNER_UIDS 17
#endif
/*
* Open File Description Locks
*
* Usually record locks held by a process are released on *any* close and are
* not inherited across a fork().
*
* These cmd values will set locks that conflict with process-associated
* record locks, but are "owned" by the open file description, not the
* process. This means that they are inherited across fork() like BSD (flock)
* locks, and they are only released automatically when the last reference to
* the the open file against which they were acquired is put.
*/
#define F_OFD_GETLK 36
#define F_OFD_SETLK 37
#define F_OFD_SETLKW 38
#define F_OWNER_TID 0
#define F_OWNER_PID 1
#define F_OWNER_PGRP 2
struct f_owner_ex {
int type;
__kernel_pid_t pid;
};
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* for posix fcntl() and lockf() */
#ifndef F_RDLCK
#define F_RDLCK 0
#define F_WRLCK 1
#define F_UNLCK 2
#endif
/* for old implementation of bsd flock () */
#ifndef F_EXLCK
#define F_EXLCK 4 /* or 3 */
#define F_SHLCK 8 /* or 4 */
#endif
/* operations for bsd flock(), also used by the kernel implementation */
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* or'd with one of the above to prevent
blocking */
#define LOCK_UN 8 /* remove lock */
#define LOCK_MAND 32 /* This is a mandatory flock ... */
#define LOCK_READ 64 /* which allows concurrent read operations */
#define LOCK_WRITE 128 /* which allows concurrent write operations */
#define LOCK_RW 192 /* which allows concurrent read & write ops */
#define F_LINUX_SPECIFIC_BASE 1024
#ifndef HAVE_ARCH_STRUCT_FLOCK
#ifndef __ARCH_FLOCK_PAD
#define __ARCH_FLOCK_PAD
#endif
struct flock {
short l_type;
short l_whence;
__kernel_off_t l_start;
__kernel_off_t l_len;
__kernel_pid_t l_pid;
__ARCH_FLOCK_PAD
};
#endif
#ifndef HAVE_ARCH_STRUCT_FLOCK64
#ifndef __ARCH_FLOCK64_PAD
#define __ARCH_FLOCK64_PAD
#endif
struct flock64 {
short l_type;
short l_whence;
__kernel_loff_t l_start;
__kernel_loff_t l_len;
__kernel_pid_t l_pid;
__ARCH_FLOCK64_PAD
};
#endif
#endif /* _ASM_GENERIC_FCNTL_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* asm-generic/int-ll64.h
*
* Integer declarations for architectures which use "long long"
* for 64-bit types.
*/
#ifndef _ASM_GENERIC_INT_LL64_H
#define _ASM_GENERIC_INT_LL64_H
#include <asm/bitsperlong.h>
#ifndef __ASSEMBLY__
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
*/
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
#ifdef __GNUC__
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#else
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
#endif
#endif /* __ASSEMBLY__ */
#endif /* _ASM_GENERIC_INT_LL64_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Argument list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child processes */
#define EAGAIN 11 /* Try again */
#define ENOMEM 12 /* Out of memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Device or resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math argument out of domain of func */
#define ERANGE 34 /* Math result not representable */
#endif
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_TERMBITS_H
#define __ASM_GENERIC_TERMBITS_H
#include <linux/posix_types.h>
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
#define NCCS 19
struct termios {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */
};
struct termios2 {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
};
struct ktermios {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
};
/* c_cc characters */
#define VINTR 0
#define VQUIT 1
#define VERASE 2
#define VKILL 3
#define VEOF 4
#define VTIME 5
#define VMIN 6
#define VSWTC 7
#define VSTART 8
#define VSTOP 9
#define VSUSP 10
#define VEOL 11
#define VREPRINT 12
#define VDISCARD 13
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
/* c_iflag bits */
#define IGNBRK 0000001
#define BRKINT 0000002
#define IGNPAR 0000004
#define PARMRK 0000010
#define INPCK 0000020
#define ISTRIP 0000040
#define INLCR 0000100
#define IGNCR 0000200
#define ICRNL 0000400
#define IUCLC 0001000
#define IXON 0002000
#define IXANY 0004000
#define IXOFF 0010000
#define IMAXBEL 0020000
#define IUTF8 0040000
/* c_oflag bits */
#define OPOST 0000001
#define OLCUC 0000002
#define ONLCR 0000004
#define OCRNL 0000010
#define ONOCR 0000020
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
#define CRDLY 0003000
#define CR0 0000000
#define CR1 0001000
#define CR2 0002000
#define CR3 0003000
#define TABDLY 0014000
#define TAB0 0000000
#define TAB1 0004000
#define TAB2 0010000
#define TAB3 0014000
#define XTABS 0014000
#define BSDLY 0020000
#define BS0 0000000
#define BS1 0020000
#define VTDLY 0040000
#define VT0 0000000
#define VT1 0040000
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
/* c_cflag bit meaning */
#define CBAUD 0010017
#define B0 0000000 /* hang up */
#define B50 0000001
#define B75 0000002
#define B110 0000003
#define B134 0000004
#define B150 0000005
#define B200 0000006
#define B300 0000007
#define B600 0000010
#define B1200 0000011
#define B1800 0000012
#define B2400 0000013
#define B4800 0000014
#define B9600 0000015
#define B19200 0000016
#define B38400 0000017
#define EXTA B19200
#define EXTB B38400
#define CSIZE 0000060
#define CS5 0000000
#define CS6 0000020
#define CS7 0000040
#define CS8 0000060
#define CSTOPB 0000100
#define CREAD 0000200
#define PARENB 0000400
#define PARODD 0001000
#define HUPCL 0002000
#define CLOCAL 0004000
#define CBAUDEX 0010000
#define BOTHER 0010000
#define B57600 0010001
#define B115200 0010002
#define B230400 0010003
#define B460800 0010004
#define B500000 0010005
#define B576000 0010006
#define B921600 0010007
#define B1000000 0010010
#define B1152000 0010011
#define B1500000 0010012
#define B2000000 0010013
#define B2500000 0010014
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
/* c_lflag bits */
#define ISIG 0000001
#define ICANON 0000002
#define XCASE 0000004
#define ECHO 0000010
#define ECHOE 0000020
#define ECHOK 0000040
#define ECHONL 0000100
#define NOFLSH 0000200
#define TOSTOP 0000400
#define ECHOCTL 0001000
#define ECHOPRT 0002000
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
#define IEXTEN 0100000
#define EXTPROC 0200000
/* tcflow() and TCXONC use these */
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
#define TCION 3
/* tcflush() and TCFLSH use these */
#define TCIFLUSH 0
#define TCOFLUSH 1
#define TCIOFLUSH 2
/* tcsetattr uses these */
#define TCSANOW 0
#define TCSADRAIN 1
#define TCSAFLUSH 2
#endif /* __ASM_GENERIC_TERMBITS_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_POLL_H
#define __ASM_GENERIC_POLL_H
/* These are specified by iBCS2 */
#define POLLIN 0x0001
#define POLLPRI 0x0002
#define POLLOUT 0x0004
#define POLLERR 0x0008
#define POLLHUP 0x0010
#define POLLNVAL 0x0020
/* The rest seem to be more-or-less nonstandard. Check them! */
#define POLLRDNORM 0x0040
#define POLLRDBAND 0x0080
#ifndef POLLWRNORM
#define POLLWRNORM 0x0100
#endif
#ifndef POLLWRBAND
#define POLLWRBAND 0x0200
#endif
#ifndef POLLMSG
#define POLLMSG 0x0400
#endif
#ifndef POLLREMOVE
#define POLLREMOVE 0x1000
#endif
#ifndef POLLRDHUP
#define POLLRDHUP 0x2000
#endif
#define POLLFREE (__poll_t)0x4000 /* currently only for epoll */
#define POLL_BUSY_LOOP (__poll_t)0x8000
struct pollfd {
int fd;
short events;
short revents;
};
#endif /* __ASM_GENERIC_POLL_H */
#ifndef __ASM_GENERIC_AUXVEC_H
#define __ASM_GENERIC_AUXVEC_H
/*
* Not all architectures need their own auxvec.h, the most
* common definitions are already in linux/auxvec.h.
*/
#endif /* __ASM_GENERIC_AUXVEC_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_SIGINFO_H
#define _ASM_GENERIC_SIGINFO_H
#include <linux/types.h>
typedef union sigval {
int sival_int;
void *sival_ptr;
} sigval_t;
#define SI_MAX_SIZE 128
/*
* The default "si_band" type is "long", as specified by POSIX.
* However, some architectures want to override this to "int"
* for historical compatibility reasons, so we allow that.
*/
#ifndef __ARCH_SI_BAND_T
#define __ARCH_SI_BAND_T long
#endif
#ifndef __ARCH_SI_CLOCK_T
#define __ARCH_SI_CLOCK_T __kernel_clock_t
#endif
#ifndef __ARCH_SI_ATTRIBUTES
#define __ARCH_SI_ATTRIBUTES
#endif
/*
* RHEL8: The old and new siginfo structures have the same offsets for
* their fields. They are just constructed in different ways.
*/
#ifdef __GENKSYMS__
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
typedef struct siginfo {
int si_signo;
#ifndef __ARCH_HAS_SWAPPED_SIGINFO
int si_errno;
int si_code;
#else
int si_code;
int si_errno;
#endif
union {
int _pad[SI_PAD_SIZE];
/* kill() */
struct {
__kernel_pid_t _pid; /* sender's pid */
__kernel_uid32_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
struct {
__kernel_timer_t _tid; /* timer id */
int _overrun; /* overrun count */
sigval_t _sigval; /* same as below */
int _sys_private; /* not to be passed to user */
} _timer;
/* POSIX.1b signals */
struct {
__kernel_pid_t _pid; /* sender's pid */
__kernel_uid32_t _uid; /* sender's uid */
sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct {
__kernel_pid_t _pid; /* which child */
__kernel_uid32_t _uid; /* sender's uid */
int _status; /* exit code */
__ARCH_SI_CLOCK_T _utime;
__ARCH_SI_CLOCK_T _stime;
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
struct {
void *_addr; /* faulting insn/memory ref. */
#ifdef __ARCH_SI_TRAPNO
int _trapno; /* TRAP # which caused the signal */
#endif
#ifdef __ia64__
int _imm; /* immediate value for "break" */
unsigned int _flags; /* see ia64 si_flags */
unsigned long _isr; /* isr */
#endif
#define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \
sizeof(short) : __alignof__(void *))
union {
/*
* used when si_code=BUS_MCEERR_AR or
* used when si_code=BUS_MCEERR_AO
*/
short _addr_lsb; /* LSB of the reported address */
/* used when si_code=SEGV_BNDERR */
struct {
char _dummy_bnd[__ADDR_BND_PKEY_PAD];
void *_lower;
void *_upper;
} _addr_bnd;
/* used when si_code=SEGV_PKUERR */
struct {
char _dummy_pkey[__ADDR_BND_PKEY_PAD];
__u32 _pkey;
} _addr_pkey;
};
} _sigfault;
/* SIGPOLL */
struct {
__ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
int _fd;
} _sigpoll;
/* SIGSYS */
struct {
void *_call_addr; /* calling user insn */
int _syscall; /* triggering system call number */
unsigned int _arch; /* AUDIT_ARCH_* of syscall */
} _sigsys;
} _sifields;
} __ARCH_SI_ATTRIBUTES siginfo_t;
#else /* __GENKSYMS__ */
union __sifields {
/* kill() */
struct {
__kernel_pid_t _pid; /* sender's pid */
__kernel_uid32_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
struct {
__kernel_timer_t _tid; /* timer id */
int _overrun; /* overrun count */
sigval_t _sigval; /* same as below */
int _sys_private; /* not to be passed to user */
} _timer;
/* POSIX.1b signals */
struct {
__kernel_pid_t _pid; /* sender's pid */
__kernel_uid32_t _uid; /* sender's uid */
sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct {
__kernel_pid_t _pid; /* which child */
__kernel_uid32_t _uid; /* sender's uid */
int _status; /* exit code */
__ARCH_SI_CLOCK_T _utime;
__ARCH_SI_CLOCK_T _stime;
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
struct {
void *_addr; /* faulting insn/memory ref. */
#ifdef __ARCH_SI_TRAPNO
int _trapno; /* TRAP # which caused the signal */
#endif
#ifdef __ia64__
int _imm; /* immediate value for "break" */
unsigned int _flags; /* see ia64 si_flags */
unsigned long _isr; /* isr */
#endif
#define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \
sizeof(short) : __alignof__(void *))
union {
/*
* used when si_code=BUS_MCEERR_AR or
* used when si_code=BUS_MCEERR_AO
*/
short _addr_lsb; /* LSB of the reported address */
/* used when si_code=SEGV_BNDERR */
struct {
char _dummy_bnd[__ADDR_BND_PKEY_PAD];
void *_lower;
void *_upper;
} _addr_bnd;
/* used when si_code=SEGV_PKUERR */
struct {
char _dummy_pkey[__ADDR_BND_PKEY_PAD];
__u32 _pkey;
} _addr_pkey;
};
} _sigfault;
/* SIGPOLL */
struct {
__ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
int _fd;
} _sigpoll;
/* SIGSYS */
struct {
void *_call_addr; /* calling user insn */
int _syscall; /* triggering system call number */
unsigned int _arch; /* AUDIT_ARCH_* of syscall */
} _sigsys;
};
#ifndef __ARCH_HAS_SWAPPED_SIGINFO
#define __SIGINFO \
struct { \
int si_signo; \
int si_errno; \
int si_code; \
union __sifields _sifields; \
}
#else
#define __SIGINFO \
struct { \
int si_signo; \
int si_code; \
int si_errno; \
union __sifields _sifields; \
}
#endif /* __ARCH_HAS_SWAPPED_SIGINFO */
typedef struct siginfo {
union {
__SIGINFO;
int _si_pad[SI_MAX_SIZE/sizeof(int)];
};
} __ARCH_SI_ATTRIBUTES siginfo_t;
#endif /* __GENKSYMS__ */
/*
* How these fields are to be accessed.
*/
#define si_pid _sifields._kill._pid
#define si_uid _sifields._kill._uid
#define si_tid _sifields._timer._tid
#define si_overrun _sifields._timer._overrun
#define si_sys_private _sifields._timer._sys_private
#define si_status _sifields._sigchld._status
#define si_utime _sifields._sigchld._utime
#define si_stime _sifields._sigchld._stime
#define si_value _sifields._rt._sigval
#define si_int _sifields._rt._sigval.sival_int
#define si_ptr _sifields._rt._sigval.sival_ptr
#define si_addr _sifields._sigfault._addr
#ifdef __ARCH_SI_TRAPNO
#define si_trapno _sifields._sigfault._trapno
#endif
#define si_addr_lsb _sifields._sigfault._addr_lsb
#define si_lower _sifields._sigfault._addr_bnd._lower
#define si_upper _sifields._sigfault._addr_bnd._upper
#define si_pkey _sifields._sigfault._addr_pkey._pkey
#define si_band _sifields._sigpoll._band
#define si_fd _sifields._sigpoll._fd
#define si_call_addr _sifields._sigsys._call_addr
#define si_syscall _sifields._sigsys._syscall
#define si_arch _sifields._sigsys._arch
/*
* si_code values
* Digital reserves positive values for kernel-generated signals.
*/
#define SI_USER 0 /* sent by kill, sigsend, raise */
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
#define SI_QUEUE -1 /* sent by sigqueue */
#define SI_TIMER -2 /* sent by timer expiration */
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
#define SI_TKILL -6 /* sent by tkill system call */
#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
#define SI_ASYNCNL -60 /* sent by glibc async name lookup completion */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
/*
* SIGILL si_codes
*/
#define ILL_ILLOPC 1 /* illegal opcode */
#define ILL_ILLOPN 2 /* illegal operand */
#define ILL_ILLADR 3 /* illegal addressing mode */
#define ILL_ILLTRP 4 /* illegal trap */
#define ILL_PRVOPC 5 /* privileged opcode */
#define ILL_PRVREG 6 /* privileged register */
#define ILL_COPROC 7 /* coprocessor error */
#define ILL_BADSTK 8 /* internal stack error */
#define ILL_BADIADDR 9 /* unimplemented instruction address */
#define __ILL_BREAK 10 /* illegal break */
#define __ILL_BNDMOD 11 /* bundle-update (modification) in progress */
#define NSIGILL 11
/*
* SIGFPE si_codes
*/
#define FPE_INTDIV 1 /* integer divide by zero */
#define FPE_INTOVF 2 /* integer overflow */
#define FPE_FLTDIV 3 /* floating point divide by zero */
#define FPE_FLTOVF 4 /* floating point overflow */
#define FPE_FLTUND 5 /* floating point underflow */
#define FPE_FLTRES 6 /* floating point inexact result */
#define FPE_FLTINV 7 /* floating point invalid operation */
#define FPE_FLTSUB 8 /* subscript out of range */
#define __FPE_DECOVF 9 /* decimal overflow */
#define __FPE_DECDIV 10 /* decimal division by zero */
#define __FPE_DECERR 11 /* packed decimal error */
#define __FPE_INVASC 12 /* invalid ASCII digit */
#define __FPE_INVDEC 13 /* invalid decimal digit */
#define FPE_FLTUNK 14 /* undiagnosed floating-point exception */
#define FPE_CONDTRAP 15 /* trap on condition */
#define NSIGFPE 15
/*
* SIGSEGV si_codes
*/
#define SEGV_MAPERR 1 /* address not mapped to object */
#define SEGV_ACCERR 2 /* invalid permissions for mapped object */
#define SEGV_BNDERR 3 /* failed address bound checks */
#ifdef __ia64__
# define __SEGV_PSTKOVF 4 /* paragraph stack overflow */
#else
# define SEGV_PKUERR 4 /* failed protection key checks */
#endif
#define SEGV_ACCADI 5 /* ADI not enabled for mapped object */
#define SEGV_ADIDERR 6 /* Disrupting MCD error */
#define SEGV_ADIPERR 7 /* Precise MCD exception */
#define NSIGSEGV 7
/*
* SIGBUS si_codes
*/
#define BUS_ADRALN 1 /* invalid address alignment */
#define BUS_ADRERR 2 /* non-existent physical address */
#define BUS_OBJERR 3 /* object specific hardware error */
/* hardware memory error consumed on a machine check: action required */
#define BUS_MCEERR_AR 4
/* hardware memory error detected in process but not consumed: action optional*/
#define BUS_MCEERR_AO 5
#define NSIGBUS 5
/*
* SIGTRAP si_codes
*/
#define TRAP_BRKPT 1 /* process breakpoint */
#define TRAP_TRACE 2 /* process trace trap */
#define TRAP_BRANCH 3 /* process taken branch trap */
#define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */
#define TRAP_UNK 5 /* undiagnosed trap */
#define NSIGTRAP 5
/*
* There is an additional set of SIGTRAP si_codes used by ptrace
* that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP)
*/
/*
* SIGCHLD si_codes
*/
#define CLD_EXITED 1 /* child has exited */
#define CLD_KILLED 2 /* child was killed */
#define CLD_DUMPED 3 /* child terminated abnormally */
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
#define NSIGCHLD 6
/*
* SIGPOLL (or any other signal without signal specific si_codes) si_codes
*/
#define POLL_IN 1 /* data input available */
#define POLL_OUT 2 /* output buffers available */
#define POLL_MSG 3 /* input message available */
#define POLL_ERR 4 /* i/o error */
#define POLL_PRI 5 /* high priority input available */
#define POLL_HUP 6 /* device disconnected */
#define NSIGPOLL 6
/*
* SIGSYS si_codes
*/
#define SYS_SECCOMP 1 /* seccomp triggered */
#define NSIGSYS 1
/*
* SIGEMT si_codes
*/
#define EMT_TAGOVF 1 /* tag overflow */
#define NSIGEMT 1
/*
* sigevent definitions
*
* It seems likely that SIGEV_THREAD will have to be handled from
* userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
* thread manager then catches and does the appropriate nonsense.
* However, everything is written out here so as to not get lost.
*/
#define SIGEV_SIGNAL 0 /* notify via signal */
#define SIGEV_NONE 1 /* other notification: meaningless */
#define SIGEV_THREAD 2 /* deliver via thread creation */
#define SIGEV_THREAD_ID 4 /* deliver to thread */
/*
* This works because the alignment is ok on all current architectures
* but we leave open this being overridden in the future
*/
#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
#endif
#define SIGEV_MAX_SIZE 64
#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
/ sizeof(int))
typedef struct sigevent {
sigval_t sigev_value;
int sigev_signo;
int sigev_notify;
union {
int _pad[SIGEV_PAD_SIZE];
int _tid;
struct {
void (*_function)(sigval_t);
void *_attribute; /* really pthread_attr_t */
} _sigev_thread;
} _sigev_un;
} sigevent_t;
#define sigev_notify_function _sigev_un._sigev_thread._function
#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
#define sigev_notify_thread_id _sigev_un._tid
#endif /* _ASM_GENERIC_SIGINFO_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_STAT_H
#define __ASM_GENERIC_STAT_H
/*
* Everybody gets this wrong and has to stick with it for all
* eternity. Hopefully, this version gets used by new architectures
* so they don't fall into the same traps.
*
* stat64 is copied from powerpc64, with explicit padding added.
* stat is the same structure layout on 64-bit, without the 'long long'
* types.
*
* By convention, 64 bit architectures use the stat interface, while
* 32 bit architectures use the stat64 interface. Note that we don't
* provide an __old_kernel_stat here, which new architecture should
* not have to start with.
*/
#include <asm/bitsperlong.h>
#define STAT_HAVE_NSEC 1
struct stat {
unsigned long st_dev; /* Device. */
unsigned long st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
unsigned int st_nlink; /* Link count. */
unsigned int st_uid; /* User ID of the file's owner. */
unsigned int st_gid; /* Group ID of the file's group. */
unsigned long st_rdev; /* Device number, if device. */
unsigned long __pad1;
long st_size; /* Size of file, in bytes. */
int st_blksize; /* Optimal block size for I/O. */
int __pad2;
long st_blocks; /* Number 512-byte blocks allocated. */
long st_atime; /* Time of last access. */
unsigned long st_atime_nsec;
long st_mtime; /* Time of last modification. */
unsigned long st_mtime_nsec;
long st_ctime; /* Time of last status change. */
unsigned long st_ctime_nsec;
unsigned int __unused4;
unsigned int __unused5;
};
/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
struct stat64 {
unsigned long long st_dev; /* Device. */
unsigned long long st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
unsigned int st_nlink; /* Link count. */
unsigned int st_uid; /* User ID of the file's owner. */
unsigned int st_gid; /* Group ID of the file's group. */
unsigned long long st_rdev; /* Device number, if device. */
unsigned long long __pad1;
long long st_size; /* Size of file, in bytes. */
int st_blksize; /* Optimal block size for I/O. */
int __pad2;
long long st_blocks; /* Number 512-byte blocks allocated. */
int st_atime; /* Time of last access. */
unsigned int st_atime_nsec;
int st_mtime; /* Time of last modification. */
unsigned int st_mtime_nsec;
int st_ctime; /* Time of last status change. */
unsigned int st_ctime_nsec;
unsigned int __unused4;
unsigned int __unused5;
};
#endif
#endif /* __ASM_GENERIC_STAT_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_SWAB_H
#define _ASM_GENERIC_SWAB_H
#include <asm/bitsperlong.h>
/*
* 32 bit architectures typically (but not always) want to
* set __SWAB_64_THRU_32__. In user space, this is only
* valid if the compiler supports 64 bit data types.
*/
#if __BITS_PER_LONG == 32
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
#define __SWAB_64_THRU_32__
#endif
#endif
#endif /* _ASM_GENERIC_SWAB_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENERIC_ERRNO_H
#include <asm-generic/errno-base.h>
#define EDEADLK 35 /* Resource deadlock would occur */
#define ENAMETOOLONG 36 /* File name too long */
#define ENOLCK 37 /* No record locks available */
/*
* This error code is special: arch syscall entry code will return
* -ENOSYS if users try to call a syscall that doesn't exist. To keep
* failures of syscalls that really do exist distinguishable from
* failures due to attempts to use a nonexistent syscall, syscall
* implementations should refrain from returning -ENOSYS.
*/
#define ENOSYS 38 /* Invalid system call number */
#define ENOTEMPTY 39 /* Directory not empty */
#define ELOOP 40 /* Too many symbolic links encountered */
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define ENOMSG 42 /* No message of desired type */
#define EIDRM 43 /* Identifier removed */
#define ECHRNG 44 /* Channel number out of range */
#define EL2NSYNC 45 /* Level 2 not synchronized */
#define EL3HLT 46 /* Level 3 halted */
#define EL3RST 47 /* Level 3 reset */
#define ELNRNG 48 /* Link number out of range */
#define EUNATCH 49 /* Protocol driver not attached */
#define ENOCSI 50 /* No CSI structure available */
#define EL2HLT 51 /* Level 2 halted */
#define EBADE 52 /* Invalid exchange */
#define EBADR 53 /* Invalid request descriptor */
#define EXFULL 54 /* Exchange full */
#define ENOANO 55 /* No anode */
#define EBADRQC 56 /* Invalid request code */
#define EBADSLT 57 /* Invalid slot */
#define EDEADLOCK EDEADLK
#define EBFONT 59 /* Bad font file format */
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* No data available */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* Object is remote */
#define ENOLINK 67 /* Link has been severed */
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#define EPROTO 71 /* Protocol error */
#define EMULTIHOP 72 /* Multihop attempted */
#define EDOTDOT 73 /* RFS specific error */
#define EBADMSG 74 /* Not a data message */
#define EOVERFLOW 75 /* Value too large for defined data type */
#define ENOTUNIQ 76 /* Name not unique on network */
#define EBADFD 77 /* File descriptor in bad state */
#define EREMCHG 78 /* Remote address changed */
#define ELIBACC 79 /* Can not access a needed shared library */
#define ELIBBAD 80 /* Accessing a corrupted shared library */
#define ELIBSCN 81 /* .lib section in a.out corrupted */
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
#define EILSEQ 84 /* Illegal byte sequence */
#define ERESTART 85 /* Interrupted system call should be restarted */
#define ESTRPIPE 86 /* Streams pipe error */
#define EUSERS 87 /* Too many users */
#define ENOTSOCK 88 /* Socket operation on non-socket */
#define EDESTADDRREQ 89 /* Destination address required */
#define EMSGSIZE 90 /* Message too long */
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
#define ENOPROTOOPT 92 /* Protocol not available */
#define EPROTONOSUPPORT 93 /* Protocol not supported */
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 96 /* Protocol family not supported */
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
#define EADDRINUSE 98 /* Address already in use */
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
#define ENETDOWN 100 /* Network is down */
#define ENETUNREACH 101 /* Network is unreachable */
#define ENETRESET 102 /* Network dropped connection because of reset */
#define ECONNABORTED 103 /* Software caused connection abort */
#define ECONNRESET 104 /* Connection reset by peer */
#define ENOBUFS 105 /* No buffer space available */
#define EISCONN 106 /* Transport endpoint is already connected */
#define ENOTCONN 107 /* Transport endpoint is not connected */
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
#define ETIMEDOUT 110 /* Connection timed out */
#define ECONNREFUSED 111 /* Connection refused */
#define EHOSTDOWN 112 /* Host is down */
#define EHOSTUNREACH 113 /* No route to host */
#define EALREADY 114 /* Operation already in progress */
#define EINPROGRESS 115 /* Operation now in progress */
#define ESTALE 116 /* Stale file handle */
#define EUCLEAN 117 /* Structure needs cleaning */
#define ENOTNAM 118 /* Not a XENIX named type file */
#define ENAVAIL 119 /* No XENIX semaphores available */
#define EISNAM 120 /* Is a named type file */
#define EREMOTEIO 121 /* Remote I/O error */
#define EDQUOT 122 /* Quota exceeded */
#define ENOMEDIUM 123 /* No medium found */
#define EMEDIUMTYPE 124 /* Wrong medium type */
#define ECANCELED 125 /* Operation Canceled */
#define ENOKEY 126 /* Required key not available */
#define EKEYEXPIRED 127 /* Key has expired */
#define EKEYREVOKED 128 /* Key has been revoked */
#define EKEYREJECTED 129 /* Key was rejected by service */
/* for robust mutexes */
#define EOWNERDEAD 130 /* Owner died */
#define ENOTRECOVERABLE 131 /* State not recoverable */
#define ERFKILL 132 /* Operation not possible due to RF-kill */
#define EHWPOISON 133 /* Memory page has hardware error */
#endif
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_MSGBUF_H
#define __ASM_GENERIC_MSGBUF_H
#include <asm/bitsperlong.h>
/*
* generic msqid64_ds structure.
*
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* msqid64_ds was originally meant to be architecture specific, but
* everyone just ended up making identical copies without specific
* optimizations, so we may just as well all use the same one.
*
* 64 bit architectures typically define a 64 bit __kernel_time_t,
* so they do not need the first three padding words.
* On big-endian systems, the padding is in the wrong place.
*
* Pad space is left for:
* - 2 miscellaneous 32-bit values
*/
struct msqid64_ds {
struct ipc64_perm msg_perm;
#if __BITS_PER_LONG == 64
__kernel_time_t msg_stime; /* last msgsnd time */
__kernel_time_t msg_rtime; /* last msgrcv time */
__kernel_time_t msg_ctime; /* last change time */
#else
unsigned long msg_stime; /* last msgsnd time */
unsigned long msg_stime_high;
unsigned long msg_rtime; /* last msgrcv time */
unsigned long msg_rtime_high;
unsigned long msg_ctime; /* last change time */
unsigned long msg_ctime_high;
#endif
unsigned long msg_cbytes; /* current number of bytes on queue */
unsigned long msg_qnum; /* number of messages in queue */
unsigned long msg_qbytes; /* max number of bytes on queue */
__kernel_pid_t msg_lspid; /* pid of last msgsnd */
__kernel_pid_t msg_lrpid; /* last receive pid */
unsigned long __unused4;
unsigned long __unused5;
};
#endif /* __ASM_GENERIC_MSGBUF_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_IPCBUF_H
#define __ASM_GENERIC_IPCBUF_H
/*
* The generic ipc64_perm structure:
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* ipc64_perm was originally meant to be architecture specific, but
* everyone just ended up making identical copies without specific
* optimizations, so we may just as well all use the same one.
*
* Pad space is left for:
* - 32-bit mode_t on architectures that only had 16 bit
* - 32-bit seq
* - 2 miscellaneous 32-bit values
*/
struct ipc64_perm {
__kernel_key_t key;
__kernel_uid32_t uid;
__kernel_gid32_t gid;
__kernel_uid32_t cuid;
__kernel_gid32_t cgid;
__kernel_mode_t mode;
/* pad if mode_t is u16: */
unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
unsigned short seq;
unsigned short __pad2;
__kernel_ulong_t __unused1;
__kernel_ulong_t __unused2;
};
#endif /* __ASM_GENERIC_IPCBUF_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _GENERIC_STATFS_H
#define _GENERIC_STATFS_H
#include <linux/types.h>
/*
* Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
* Yes, they differ in signedness as well as size.
* Special cases can override it for themselves -- except for S390x, which
* is just a little too special for us. And MIPS, which I'm not touching
* with a 10' pole.
*/
#ifndef __statfs_word
#if __BITS_PER_LONG == 64
#define __statfs_word __kernel_long_t
#else
#define __statfs_word __u32
#endif
#endif
struct statfs {
__statfs_word f_type;
__statfs_word f_bsize;
__statfs_word f_blocks;
__statfs_word f_bfree;
__statfs_word f_bavail;
__statfs_word f_files;
__statfs_word f_ffree;
__kernel_fsid_t f_fsid;
__statfs_word f_namelen;
__statfs_word f_frsize;
__statfs_word f_flags;
__statfs_word f_spare[4];
};
/*
* ARM needs to avoid the 32-bit padding at the end, for consistency
* between EABI and OABI
*/
#ifndef ARCH_PACK_STATFS64
#define ARCH_PACK_STATFS64
#endif
struct statfs64 {
__statfs_word f_type;
__statfs_word f_bsize;
__u64 f_blocks;
__u64 f_bfree;
__u64 f_bavail;
__u64 f_files;
__u64 f_ffree;
__kernel_fsid_t f_fsid;
__statfs_word f_namelen;
__statfs_word f_frsize;
__statfs_word f_flags;
__statfs_word f_spare[4];
} ARCH_PACK_STATFS64;
/*
* IA64 and x86_64 need to avoid the 32-bit padding at the end,
* to be compatible with the i386 ABI
*/
#ifndef ARCH_PACK_COMPAT_STATFS64
#define ARCH_PACK_COMPAT_STATFS64
#endif
struct compat_statfs64 {
__u32 f_type;
__u32 f_bsize;
__u64 f_blocks;
__u64 f_bfree;
__u64 f_bavail;
__u64 f_files;
__u64 f_ffree;
__kernel_fsid_t f_fsid;
__u32 f_namelen;
__u32 f_frsize;
__u32 f_flags;
__u32 f_spare[4];
} ARCH_PACK_COMPAT_STATFS64;
#endif /* _GENERIC_STATFS_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __ASM_GENERIC_PARAM_H
#define __ASM_GENERIC_PARAM_H
#ifndef HZ
#define HZ 100
#endif
#ifndef EXEC_PAGESIZE
#define EXEC_PAGESIZE 4096
#endif
#ifndef NOGROUP
#define NOGROUP (-1)
#endif
#define MAXHOSTNAMELEN 64 /* max length of hostname */
#endif /* __ASM_GENERIC_PARAM_H */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#include <asm/bitsperlong.h>
/*
* This file contains the system call numbers, based on the
* layout of the x86-64 architecture, which embeds the
* pointer to the syscall in the table.
*
* As a basic principle, no duplication of functionality
* should be added, e.g. we don't use lseek when llseek
* is present. New architectures should use this file
* and implement the less feature-full calls in user space.
*/
#ifndef __SYSCALL
#define __SYSCALL(x, y)
#endif
#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
#else
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
#endif
#ifdef __SYSCALL_COMPAT
#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
#else
#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
#endif
#define __NR_io_setup 0
__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
#define __NR_io_destroy 1
__SYSCALL(__NR_io_destroy, sys_io_destroy)
#define __NR_io_submit 2
__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
#define __NR_io_cancel 3
__SYSCALL(__NR_io_cancel, sys_io_cancel)
#define __NR_io_getevents 4
__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
/* fs/xattr.c */
#define __NR_setxattr 5
__SYSCALL(__NR_setxattr, sys_setxattr)
#define __NR_lsetxattr 6
__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
#define __NR_fsetxattr 7
__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
#define __NR_getxattr 8
__SYSCALL(__NR_getxattr, sys_getxattr)
#define __NR_lgetxattr 9
__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
#define __NR_fgetxattr 10
__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
#define __NR_listxattr 11
__SYSCALL(__NR_listxattr, sys_listxattr)
#define __NR_llistxattr 12
__SYSCALL(__NR_llistxattr, sys_llistxattr)
#define __NR_flistxattr 13
__SYSCALL(__NR_flistxattr, sys_flistxattr)
#define __NR_removexattr 14
__SYSCALL(__NR_removexattr, sys_removexattr)
#define __NR_lremovexattr 15
__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
#define __NR_fremovexattr 16
__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
/* fs/dcache.c */
#define __NR_getcwd 17
__SYSCALL(__NR_getcwd, sys_getcwd)
/* fs/cookies.c */
#define __NR_lookup_dcookie 18
__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
/* fs/eventfd.c */
#define __NR_eventfd2 19
__SYSCALL(__NR_eventfd2, sys_eventfd2)
/* fs/eventpoll.c */
#define __NR_epoll_create1 20
__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
#define __NR_epoll_ctl 21
__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
#define __NR_epoll_pwait 22
__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
/* fs/fcntl.c */
#define __NR_dup 23
__SYSCALL(__NR_dup, sys_dup)
#define __NR_dup3 24
__SYSCALL(__NR_dup3, sys_dup3)
#define __NR3264_fcntl 25
__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
/* fs/inotify_user.c */
#define __NR_inotify_init1 26
__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
#define __NR_inotify_add_watch 27
__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
#define __NR_inotify_rm_watch 28
__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
/* fs/ioctl.c */
#define __NR_ioctl 29
__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
/* fs/ioprio.c */
#define __NR_ioprio_set 30
__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
#define __NR_ioprio_get 31
__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
/* fs/locks.c */
#define __NR_flock 32
__SYSCALL(__NR_flock, sys_flock)
/* fs/namei.c */
#define __NR_mknodat 33
__SYSCALL(__NR_mknodat, sys_mknodat)
#define __NR_mkdirat 34
__SYSCALL(__NR_mkdirat, sys_mkdirat)
#define __NR_unlinkat 35
__SYSCALL(__NR_unlinkat, sys_unlinkat)
#define __NR_symlinkat 36
__SYSCALL(__NR_symlinkat, sys_symlinkat)
#define __NR_linkat 37
__SYSCALL(__NR_linkat, sys_linkat)
#ifdef __ARCH_WANT_RENAMEAT
/* renameat is superseded with flags by renameat2 */
#define __NR_renameat 38
__SYSCALL(__NR_renameat, sys_renameat)
#endif /* __ARCH_WANT_RENAMEAT */
/* fs/namespace.c */
#define __NR_umount2 39
__SYSCALL(__NR_umount2, sys_umount)
#define __NR_mount 40
__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
#define __NR_pivot_root 41
__SYSCALL(__NR_pivot_root, sys_pivot_root)
/* fs/nfsctl.c */
#define __NR_nfsservctl 42
__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
/* fs/open.c */
#define __NR3264_statfs 43
__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
compat_sys_statfs64)
#define __NR3264_fstatfs 44
__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
compat_sys_fstatfs64)
#define __NR3264_truncate 45
__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
compat_sys_truncate64)
#define __NR3264_ftruncate 46
__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
compat_sys_ftruncate64)
#define __NR_fallocate 47
__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
#define __NR_faccessat 48
__SYSCALL(__NR_faccessat, sys_faccessat)
#define __NR_chdir 49
__SYSCALL(__NR_chdir, sys_chdir)
#define __NR_fchdir 50
__SYSCALL(__NR_fchdir, sys_fchdir)
#define __NR_chroot 51
__SYSCALL(__NR_chroot, sys_chroot)
#define __NR_fchmod 52
__SYSCALL(__NR_fchmod, sys_fchmod)
#define __NR_fchmodat 53
__SYSCALL(__NR_fchmodat, sys_fchmodat)
#define __NR_fchownat 54
__SYSCALL(__NR_fchownat, sys_fchownat)
#define __NR_fchown 55
__SYSCALL(__NR_fchown, sys_fchown)
#define __NR_openat 56
__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
#define __NR_close 57
__SYSCALL(__NR_close, sys_close)
#define __NR_vhangup 58
__SYSCALL(__NR_vhangup, sys_vhangup)
/* fs/pipe.c */
#define __NR_pipe2 59
__SYSCALL(__NR_pipe2, sys_pipe2)
/* fs/quota.c */
#define __NR_quotactl 60
__SYSCALL(__NR_quotactl, sys_quotactl)
/* fs/readdir.c */
#define __NR_getdents64 61
__SYSCALL(__NR_getdents64, sys_getdents64)
/* fs/read_write.c */
#define __NR3264_lseek 62
__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
#define __NR_read 63
__SYSCALL(__NR_read, sys_read)
#define __NR_write 64
__SYSCALL(__NR_write, sys_write)
#define __NR_readv 65
__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
#define __NR_writev 66
__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
#define __NR_pread64 67
__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
#define __NR_pwrite64 68
__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
#define __NR_preadv 69
__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
#define __NR_pwritev 70
__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
/* fs/sendfile.c */
#define __NR3264_sendfile 71
__SYSCALL(__NR3264_sendfile, sys_sendfile64)
/* fs/select.c */
#define __NR_pselect6 72
__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
#define __NR_ppoll 73
__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
/* fs/signalfd.c */
#define __NR_signalfd4 74
__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
/* fs/splice.c */
#define __NR_vmsplice 75
__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
#define __NR_splice 76
__SYSCALL(__NR_splice, sys_splice)
#define __NR_tee 77
__SYSCALL(__NR_tee, sys_tee)
/* fs/stat.c */
#define __NR_readlinkat 78
__SYSCALL(__NR_readlinkat, sys_readlinkat)
#define __NR3264_fstatat 79
__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
#define __NR3264_fstat 80
__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
/* fs/sync.c */
#define __NR_sync 81
__SYSCALL(__NR_sync, sys_sync)
#define __NR_fsync 82
__SYSCALL(__NR_fsync, sys_fsync)
#define __NR_fdatasync 83
__SYSCALL(__NR_fdatasync, sys_fdatasync)
#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
#define __NR_sync_file_range2 84
__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
compat_sys_sync_file_range2)
#else
#define __NR_sync_file_range 84
__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
compat_sys_sync_file_range)
#endif
/* fs/timerfd.c */
#define __NR_timerfd_create 85
__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
#define __NR_timerfd_settime 86
__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
compat_sys_timerfd_settime)
#define __NR_timerfd_gettime 87
__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
compat_sys_timerfd_gettime)
/* fs/utimes.c */
#define __NR_utimensat 88
__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
/* kernel/acct.c */
#define __NR_acct 89
__SYSCALL(__NR_acct, sys_acct)
/* kernel/capability.c */
#define __NR_capget 90
__SYSCALL(__NR_capget, sys_capget)
#define __NR_capset 91
__SYSCALL(__NR_capset, sys_capset)
/* kernel/exec_domain.c */
#define __NR_personality 92
__SYSCALL(__NR_personality, sys_personality)
/* kernel/exit.c */
#define __NR_exit 93
__SYSCALL(__NR_exit, sys_exit)
#define __NR_exit_group 94
__SYSCALL(__NR_exit_group, sys_exit_group)
#define __NR_waitid 95
__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
/* kernel/fork.c */
#define __NR_set_tid_address 96
__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
#define __NR_unshare 97
__SYSCALL(__NR_unshare, sys_unshare)
/* kernel/futex.c */
#define __NR_futex 98
__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
#define __NR_set_robust_list 99
__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
compat_sys_set_robust_list)
#define __NR_get_robust_list 100
__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
compat_sys_get_robust_list)
/* kernel/hrtimer.c */
#define __NR_nanosleep 101
__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
/* kernel/itimer.c */
#define __NR_getitimer 102
__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
#define __NR_setitimer 103
__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
/* kernel/kexec.c */
#define __NR_kexec_load 104
__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
/* kernel/module.c */
#define __NR_init_module 105
__SYSCALL(__NR_init_module, sys_init_module)
#define __NR_delete_module 106
__SYSCALL(__NR_delete_module, sys_delete_module)
/* kernel/posix-timers.c */
#define __NR_timer_create 107
__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
#define __NR_timer_gettime 108
__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
#define __NR_timer_getoverrun 109
__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
#define __NR_timer_settime 110
__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
#define __NR_timer_delete 111
__SYSCALL(__NR_timer_delete, sys_timer_delete)
#define __NR_clock_settime 112
__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
#define __NR_clock_gettime 113
__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
#define __NR_clock_getres 114
__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
#define __NR_clock_nanosleep 115
__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
compat_sys_clock_nanosleep)
/* kernel/printk.c */
#define __NR_syslog 116
__SYSCALL(__NR_syslog, sys_syslog)
/* kernel/ptrace.c */
#define __NR_ptrace 117
__SYSCALL(__NR_ptrace, sys_ptrace)
/* kernel/sched/core.c */
#define __NR_sched_setparam 118
__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
#define __NR_sched_setscheduler 119
__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
#define __NR_sched_getscheduler 120
__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
#define __NR_sched_getparam 121
__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
#define __NR_sched_setaffinity 122
__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
compat_sys_sched_setaffinity)
#define __NR_sched_getaffinity 123
__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
compat_sys_sched_getaffinity)
#define __NR_sched_yield 124
__SYSCALL(__NR_sched_yield, sys_sched_yield)
#define __NR_sched_get_priority_max 125
__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
#define __NR_sched_get_priority_min 126
__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
#define __NR_sched_rr_get_interval 127
__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
compat_sys_sched_rr_get_interval)
/* kernel/signal.c */
#define __NR_restart_syscall 128
__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
#define __NR_kill 129
__SYSCALL(__NR_kill, sys_kill)
#define __NR_tkill 130
__SYSCALL(__NR_tkill, sys_tkill)
#define __NR_tgkill 131
__SYSCALL(__NR_tgkill, sys_tgkill)
#define __NR_sigaltstack 132
__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
#define __NR_rt_sigsuspend 133
__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
#define __NR_rt_sigaction 134
__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
#define __NR_rt_sigprocmask 135
__SC_COMP(__NR_rt_sigprocmask, sys_rt_sigprocmask, compat_sys_rt_sigprocmask)
#define __NR_rt_sigpending 136
__SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending)
#define __NR_rt_sigtimedwait 137
__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
compat_sys_rt_sigtimedwait)
#define __NR_rt_sigqueueinfo 138
__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
compat_sys_rt_sigqueueinfo)
#define __NR_rt_sigreturn 139
__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
/* kernel/sys.c */
#define __NR_setpriority 140
__SYSCALL(__NR_setpriority, sys_setpriority)
#define __NR_getpriority 141
__SYSCALL(__NR_getpriority, sys_getpriority)
#define __NR_reboot 142
__SYSCALL(__NR_reboot, sys_reboot)
#define __NR_setregid 143
__SYSCALL(__NR_setregid, sys_setregid)
#define __NR_setgid 144
__SYSCALL(__NR_setgid, sys_setgid)
#define __NR_setreuid 145
__SYSCALL(__NR_setreuid, sys_setreuid)
#define __NR_setuid 146
__SYSCALL(__NR_setuid, sys_setuid)
#define __NR_setresuid 147
__SYSCALL(__NR_setresuid, sys_setresuid)
#define __NR_getresuid 148
__SYSCALL(__NR_getresuid, sys_getresuid)
#define __NR_setresgid 149
__SYSCALL(__NR_setresgid, sys_setresgid)
#define __NR_getresgid 150
__SYSCALL(__NR_getresgid, sys_getresgid)
#define __NR_setfsuid 151
__SYSCALL(__NR_setfsuid, sys_setfsuid)
#define __NR_setfsgid 152
__SYSCALL(__NR_setfsgid, sys_setfsgid)
#define __NR_times 153
__SC_COMP(__NR_times, sys_times, compat_sys_times)
#define __NR_setpgid 154
__SYSCALL(__NR_setpgid, sys_setpgid)
#define __NR_getpgid 155
__SYSCALL(__NR_getpgid, sys_getpgid)
#define __NR_getsid 156
__SYSCALL(__NR_getsid, sys_getsid)
#define __NR_setsid 157
__SYSCALL(__NR_setsid, sys_setsid)
#define __NR_getgroups 158
__SYSCALL(__NR_getgroups, sys_getgroups)
#define __NR_setgroups 159
__SYSCALL(__NR_setgroups, sys_setgroups)
#define __NR_uname 160
__SYSCALL(__NR_uname, sys_newuname)
#define __NR_sethostname 161
__SYSCALL(__NR_sethostname, sys_sethostname)
#define __NR_setdomainname 162
__SYSCALL(__NR_setdomainname, sys_setdomainname)
#define __NR_getrlimit 163
__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
#define __NR_setrlimit 164
__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
#define __NR_getrusage 165
__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
#define __NR_umask 166
__SYSCALL(__NR_umask, sys_umask)
#define __NR_prctl 167
__SYSCALL(__NR_prctl, sys_prctl)
#define __NR_getcpu 168
__SYSCALL(__NR_getcpu, sys_getcpu)
/* kernel/time.c */
#define __NR_gettimeofday 169
__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
#define __NR_settimeofday 170
__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
#define __NR_adjtimex 171
__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
/* kernel/timer.c */
#define __NR_getpid 172
__SYSCALL(__NR_getpid, sys_getpid)
#define __NR_getppid 173
__SYSCALL(__NR_getppid, sys_getppid)
#define __NR_getuid 174
__SYSCALL(__NR_getuid, sys_getuid)
#define __NR_geteuid 175
__SYSCALL(__NR_geteuid, sys_geteuid)
#define __NR_getgid 176
__SYSCALL(__NR_getgid, sys_getgid)
#define __NR_getegid 177
__SYSCALL(__NR_getegid, sys_getegid)
#define __NR_gettid 178
__SYSCALL(__NR_gettid, sys_gettid)
#define __NR_sysinfo 179
__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
/* ipc/mqueue.c */
#define __NR_mq_open 180
__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
#define __NR_mq_unlink 181
__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
#define __NR_mq_timedsend 182
__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
#define __NR_mq_timedreceive 183
__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
compat_sys_mq_timedreceive)
#define __NR_mq_notify 184
__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
#define __NR_mq_getsetattr 185
__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
/* ipc/msg.c */
#define __NR_msgget 186
__SYSCALL(__NR_msgget, sys_msgget)
#define __NR_msgctl 187
__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
#define __NR_msgrcv 188
__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
#define __NR_msgsnd 189
__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
/* ipc/sem.c */
#define __NR_semget 190
__SYSCALL(__NR_semget, sys_semget)
#define __NR_semctl 191
__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
#define __NR_semtimedop 192
__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
#define __NR_semop 193
__SYSCALL(__NR_semop, sys_semop)
/* ipc/shm.c */
#define __NR_shmget 194
__SYSCALL(__NR_shmget, sys_shmget)
#define __NR_shmctl 195
__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
#define __NR_shmat 196
__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
#define __NR_shmdt 197
__SYSCALL(__NR_shmdt, sys_shmdt)
/* net/socket.c */
#define __NR_socket 198
__SYSCALL(__NR_socket, sys_socket)
#define __NR_socketpair 199
__SYSCALL(__NR_socketpair, sys_socketpair)
#define __NR_bind 200
__SYSCALL(__NR_bind, sys_bind)
#define __NR_listen 201
__SYSCALL(__NR_listen, sys_listen)
#define __NR_accept 202
__SYSCALL(__NR_accept, sys_accept)
#define __NR_connect 203
__SYSCALL(__NR_connect, sys_connect)
#define __NR_getsockname 204
__SYSCALL(__NR_getsockname, sys_getsockname)
#define __NR_getpeername 205
__SYSCALL(__NR_getpeername, sys_getpeername)
#define __NR_sendto 206
__SYSCALL(__NR_sendto, sys_sendto)
#define __NR_recvfrom 207
__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
#define __NR_setsockopt 208
__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
#define __NR_getsockopt 209
__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
#define __NR_shutdown 210
__SYSCALL(__NR_shutdown, sys_shutdown)
#define __NR_sendmsg 211
__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
#define __NR_recvmsg 212
__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
/* mm/filemap.c */
#define __NR_readahead 213
__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
/* mm/nommu.c, also with MMU */
#define __NR_brk 214
__SYSCALL(__NR_brk, sys_brk)
#define __NR_munmap 215
__SYSCALL(__NR_munmap, sys_munmap)
#define __NR_mremap 216
__SYSCALL(__NR_mremap, sys_mremap)
/* security/keys/keyctl.c */
#define __NR_add_key 217
__SYSCALL(__NR_add_key, sys_add_key)
#define __NR_request_key 218
__SYSCALL(__NR_request_key, sys_request_key)
#define __NR_keyctl 219
__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
/* arch/example/kernel/sys_example.c */
#define __NR_clone 220
__SYSCALL(__NR_clone, sys_clone)
#define __NR_execve 221
__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
#define __NR3264_mmap 222
__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
/* mm/fadvise.c */
#define __NR3264_fadvise64 223
__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
/* mm/, CONFIG_MMU only */
#ifndef __ARCH_NOMMU
#define __NR_swapon 224
__SYSCALL(__NR_swapon, sys_swapon)
#define __NR_swapoff 225
__SYSCALL(__NR_swapoff, sys_swapoff)
#define __NR_mprotect 226
__SYSCALL(__NR_mprotect, sys_mprotect)
#define __NR_msync 227
__SYSCALL(__NR_msync, sys_msync)
#define __NR_mlock 228
__SYSCALL(__NR_mlock, sys_mlock)
#define __NR_munlock 229
__SYSCALL(__NR_munlock, sys_munlock)
#define __NR_mlockall 230
__SYSCALL(__NR_mlockall, sys_mlockall)
#define __NR_munlockall 231
__SYSCALL(__NR_munlockall, sys_munlockall)
#define __NR_mincore 232
__SYSCALL(__NR_mincore, sys_mincore)
#define __NR_madvise 233
__SYSCALL(__NR_madvise, sys_madvise)
#define __NR_remap_file_pages 234
__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
#define __NR_mbind 235
__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
#define __NR_get_mempolicy 236
__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
#define __NR_set_mempolicy 237
__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
#define __NR_migrate_pages 238
__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
#define __NR_move_pages 239
__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
#endif
#define __NR_rt_tgsigqueueinfo 240
__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
compat_sys_rt_tgsigqueueinfo)
#define __NR_perf_event_open 241
__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
#define __NR_accept4 242
__SYSCALL(__NR_accept4, sys_accept4)
#define __NR_recvmmsg 243
__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
/*
* Architectures may provide up to 16 syscalls of their own
* starting with this value.
*/
#define __NR_arch_specific_syscall 244
#define __NR_wait4 260
__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
#define __NR_prlimit64 261
__SYSCALL(__NR_prlimit64, sys_prlimit64)
#define __NR_fanotify_init 262
__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
#define __NR_fanotify_mark 263
__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
#define __NR_name_to_handle_at 264
__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
#define __NR_open_by_handle_at 265
__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
compat_sys_open_by_handle_at)
#define __NR_clock_adjtime 266
__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
#define __NR_syncfs 267
__SYSCALL(__NR_syncfs, sys_syncfs)
#define __NR_setns 268
__SYSCALL(__NR_setns, sys_setns)
#define __NR_sendmmsg 269
__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
#define __NR_process_vm_readv 270
__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
compat_sys_process_vm_readv)
#define __NR_process_vm_writev 271
__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
compat_sys_process_vm_writev)
#define __NR_kcmp 272
__SYSCALL(__NR_kcmp, sys_kcmp)
#define __NR_finit_module 273
__SYSCALL(__NR_finit_module, sys_finit_module)
#define __NR_sched_setattr 274
__SYSCALL(__NR_sched_setattr, sys_sched_setattr)
#define __NR_sched_getattr 275
__SYSCALL(__NR_sched_getattr, sys_sched_getattr)
#define __NR_renameat2 276
__SYSCALL(__NR_renameat2, sys_renameat2)
#define __NR_seccomp 277
__SYSCALL(__NR_seccomp, sys_seccomp)
#define __NR_getrandom 278
__SYSCALL(__NR_getrandom, sys_getrandom)
#define __NR_memfd_create 279
__SYSCALL(__NR_memfd_create, sys_memfd_create)
#define __NR_bpf 280
__SYSCALL(__NR_bpf, sys_bpf)
#define __NR_execveat 281
__SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat)
#define __NR_userfaultfd 282
__SYSCALL(__NR_userfaultfd, sys_userfaultfd)
#define __NR_membarrier 283
__SYSCALL(__NR_membarrier, sys_membarrier)
#define __NR_mlock2 284
__SYSCALL(__NR_mlock2, sys_mlock2)
#define __NR_copy_file_range 285
__SYSCALL(__NR_copy_file_range, sys_copy_file_range)
#define __NR_preadv2 286
__SC_COMP(__NR_preadv2, sys_preadv2, compat_sys_preadv2)
#define __NR_pwritev2 287
__SC_COMP(__NR_pwritev2, sys_pwritev2, compat_sys_pwritev2)
#define __NR_pkey_mprotect 288
__SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect)
#define __NR_pkey_alloc 289
__SYSCALL(__NR_pkey_alloc, sys_pkey_alloc)
#define __NR_pkey_free 290
__SYSCALL(__NR_pkey_free, sys_pkey_free)
#define __NR_statx 291
__SYSCALL(__NR_statx, sys_statx)
#define __NR_io_pgetevents 292
__SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents)
#define __NR_rseq 293
__SYSCALL(__NR_rseq, sys_rseq)
#define __NR_kexec_file_load 294
__SYSCALL(__NR_kexec_file_load, sys_kexec_file_load)
#if __BITS_PER_LONG == 32
#define __NR_clock_gettime64 403
__SYSCALL(__NR_clock_gettime64, sys_clock_gettime)
#define __NR_clock_settime64 404
__SYSCALL(__NR_clock_settime64, sys_clock_settime)
#define __NR_clock_adjtime64 405
__SYSCALL(__NR_clock_adjtime64, sys_clock_adjtime)
#define __NR_clock_getres_time64 406
__SYSCALL(__NR_clock_getres_time64, sys_clock_getres)
#define __NR_clock_nanosleep_time64 407
__SYSCALL(__NR_clock_nanosleep_time64, sys_clock_nanosleep)
#define __NR_timer_gettime64 408
__SYSCALL(__NR_timer_gettime64, sys_timer_gettime)
#define __NR_timer_settime64 409
__SYSCALL(__NR_timer_settime64, sys_timer_settime)
#define __NR_timerfd_gettime64 410
__SYSCALL(__NR_timerfd_gettime64, sys_timerfd_gettime)
#define __NR_timerfd_settime64 411
__SYSCALL(__NR_timerfd_settime64, sys_timerfd_settime)
#define __NR_utimensat_time64 412
__SYSCALL(__NR_utimensat_time64, sys_utimensat)
#define __NR_io_pgetevents_time64 416
__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents)
#define __NR_mq_timedsend_time64 418
__SYSCALL(__NR_mq_timedsend_time64, sys_mq_timedsend)
#define __NR_mq_timedreceive_time64 419
__SYSCALL(__NR_mq_timedreceive_time64, sys_mq_timedreceive)
#define __NR_semtimedop_time64 420
__SYSCALL(__NR_semtimedop_time64, sys_semtimedop)
#define __NR_futex_time64 422
__SYSCALL(__NR_futex_time64, sys_futex)
#define __NR_sched_rr_get_interval_time64 423
__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval)
#endif
#define __NR_pidfd_send_signal 424
__SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal)
#define __NR_io_uring_setup 425
__SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)
#define __NR_io_uring_enter 426
__SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)
#define __NR_io_uring_register 427
__SYSCALL(__NR_io_uring_register, sys_io_uring_register)
#define __NR_open_tree 428
__SYSCALL(__NR_open_tree, sys_open_tree)
#define __NR_move_mount 429
__SYSCALL(__NR_move_mount, sys_move_mount)
#define __NR_fsopen 430
__SYSCALL(__NR_fsopen, sys_fsopen)
#define __NR_fsconfig 431
__SYSCALL(__NR_fsconfig, sys_fsconfig)
#define __NR_fsmount 432
__SYSCALL(__NR_fsmount, sys_fsmount)
#define __NR_fspick 433
__SYSCALL(__NR_fspick, sys_fspick)
#define __NR_close_range 436
__SYSCALL(__NR_close_range, sys_close_range)
#define __NR_faccessat2 439
__SYSCALL(__NR_faccessat2, sys_faccessat2)
#define __NR_openat2 437
__SYSCALL(__NR_openat2, sys_openat2)
#undef __NR_syscalls
#define __NR_syscalls 441
/*
* 32 bit systems traditionally used different
* syscalls for off_t and loff_t arguments, while
* 64 bit systems only need the off_t version.
* For new 32 bit platforms, there is no need to
* implement the old 32 bit off_t syscalls, so
* they take different names.
* Here we map the numbers so that both versions
* use the same syscall table layout.
*/
#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
#define __NR_fcntl __NR3264_fcntl
#define __NR_statfs __NR3264_statfs
#define __NR_fstatfs __NR3264_fstatfs
#define __NR_truncate __NR3264_truncate
#define __NR_ftruncate __NR3264_ftruncate
#define __NR_lseek __NR3264_lseek
#define __NR_sendfile __NR3264_sendfile
#define __NR_newfstatat __NR3264_fstatat
#define __NR_fstat __NR3264_fstat
#define __NR_mmap __NR3264_mmap
#define __NR_fadvise64 __NR3264_fadvise64
#ifdef __NR3264_stat
#define __NR_stat __NR3264_stat
#define __NR_lstat __NR3264_lstat
#endif
#else
#define __NR_fcntl64 __NR3264_fcntl
#define __NR_statfs64 __NR3264_statfs
#define __NR_fstatfs64 __NR3264_fstatfs
#define __NR_truncate64 __NR3264_truncate
#define __NR_ftruncate64 __NR3264_ftruncate
#define __NR_llseek __NR3264_lseek
#define __NR_sendfile64 __NR3264_sendfile
#define __NR_fstatat64 __NR3264_fstatat
#define __NR_fstat64 __NR3264_fstat
#define __NR_mmap2 __NR3264_mmap
#define __NR_fadvise64_64 __NR3264_fadvise64
#ifdef __NR3264_stat
#define __NR_stat64 __NR3264_stat
#define __NR_lstat64 __NR3264_lstat
#endif
#endif
#ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
#define _ASM_GENERIC_HUGETLB_ENCODE_H_
/*
* Several system calls take a flag to request "hugetlb" huge pages.
* Without further specification, these system calls will use the
* system's default huge page size. If a system supports multiple
* huge page sizes, the desired huge page size can be specified in
* bits [26:31] of the flag arguments. The value in these 6 bits
* will encode the log2 of the huge page size.
*
* The following definitions are associated with this huge page size
* encoding in flag arguments. System call specific header files
* that use this encoding should include this file. They can then
* provide definitions based on these with their own specific prefix.
* for example:
* #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
*/
#define HUGETLB_FLAG_ENCODE_SHIFT 26
#define HUGETLB_FLAG_ENCODE_MASK 0x3f
#define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT)
#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
/* 4.4BSD utility functions for error messages.
Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _ERR_H
#define _ERR_H 1
#include <features.h>
#define __need___va_list
#include <stdarg.h>
#ifndef __GNUC_VA_LIST
# define __gnuc_va_list void *
#endif
__BEGIN_DECLS
/* Print "program: ", FORMAT, ": ", the standard error string for errno,
and a newline, on stderr. */
extern void warn (const char *__format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
extern void vwarn (const char *__format, __gnuc_va_list)
__attribute__ ((__format__ (__printf__, 1, 0)));
/* Likewise, but without ": " and the standard error string. */
extern void warnx (const char *__format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
extern void vwarnx (const char *__format, __gnuc_va_list)
__attribute__ ((__format__ (__printf__, 1, 0)));
/* Likewise, and then exit with STATUS. */
extern void err (int __status, const char *__format, ...)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
extern void verr (int __status, const char *__format, __gnuc_va_list)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
extern void errx (int __status, const char *__format, ...)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
extern void verrx (int __status, const char *, __gnuc_va_list)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
__END_DECLS
#endif /* err.h */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _BYTESWAP_H
#define _BYTESWAP_H 1
#include <features.h>
/* Get the machine specific, optimized definitions. */
#include <bits/byteswap.h>
/* The following definitions must all be macros since otherwise some
of the possible optimizations are not possible. */
/* Return a value with all bytes in the 16 bit argument swapped. */
#define bswap_16(x) __bswap_16 (x)
/* Return a value with all bytes in the 32 bit argument swapped. */
#define bswap_32(x) __bswap_32 (x)
/* Return a value with all bytes in the 64 bit argument swapped. */
#define bswap_64(x) __bswap_64 (x)
#endif /* byteswap.h */
/* gpg-error.h or gpgrt.h - Common code for GnuPG and others. -*- c -*-
* Copyright (C) 2001-2018 g10 Code GmbH
*
* This file is part of libgpg-error (aka libgpgrt).
*
* libgpg-error is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* libgpg-error is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1+
*
* Do not edit. Generated from gpg-error.h.in.
*/
/* The GnuPG project consists of many components. Error codes are
* exchanged between all components. The common error codes and their
* user-presentable descriptions are kept into a shared library to
* allow adding new error codes and components without recompiling any
* of the other components. In addition to error codes this library
* also features several other groups of functions which are common to
* all GnuPG components. They may be used by independet project as
* well. The interfaces will not change in a backward incompatible way.
*
* An error code together with an error source build up an error
* value. As the error value is been passed from one component to
* another, it preserves the information about the source and nature
* of the error.
*
* A component of the GnuPG project can define the following macros to
* tune the behaviour of the library:
*
* GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
* gpg_err_source_t to make that source the default for gpg_error().
* Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default.
*
* GPG_ERR_ENABLE_GETTEXT_MACROS: Define to provide macros to map the
* internal gettext API to standard names. This has only an effect on
* Windows platforms.
*
* GPGRT_ENABLE_ES_MACROS: Define to provide "es_" macros for the
* estream functions.
*
* GPGRT_ENABLE_LOG_MACROS: Define to provide short versions of the
* log functions.
*
* GPGRT_ENABLE_ARGPARSE_MACROS: Needs to be defined to provide the
* mandatory macros of the argparse interface.
*/
#ifndef GPG_ERROR_H
#define GPG_ERROR_H 1
#ifndef GPGRT_H
#define GPGRT_H 1
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
/* The version string of this header. */
#define GPG_ERROR_VERSION "1.31"
#define GPGRT_VERSION "1.31"
/* The version number of this header. */
#define GPG_ERROR_VERSION_NUMBER 0x011f00
#define GPGRT_VERSION_NUMBER 0x011f00
#ifdef __GNUC__
# define GPG_ERR_INLINE __inline__
#elif defined(_MSC_VER) && _MSC_VER >= 1300
# define GPG_ERR_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define GPG_ERR_INLINE inline
#else
# ifndef GPG_ERR_INLINE
# define GPG_ERR_INLINE
# endif
#endif
#ifdef __cplusplus
extern "C" {
#if 0 /* just to make Emacs auto-indent happy */
}
#endif
#endif /* __cplusplus */
/* The error source type gpg_err_source_t.
*
* Where as the Poo out of a welle small
* Taketh his firste springing and his sours.
* --Chaucer.
*/
/* Only use free slots, never change or reorder the existing
* entries. */
typedef enum
{
GPG_ERR_SOURCE_UNKNOWN = 0,
GPG_ERR_SOURCE_GCRYPT = 1,
GPG_ERR_SOURCE_GPG = 2,
GPG_ERR_SOURCE_GPGSM = 3,
GPG_ERR_SOURCE_GPGAGENT = 4,
GPG_ERR_SOURCE_PINENTRY = 5,
GPG_ERR_SOURCE_SCD = 6,
GPG_ERR_SOURCE_GPGME = 7,
GPG_ERR_SOURCE_KEYBOX = 8,
GPG_ERR_SOURCE_KSBA = 9,
GPG_ERR_SOURCE_DIRMNGR = 10,
GPG_ERR_SOURCE_GSTI = 11,
GPG_ERR_SOURCE_GPA = 12,
GPG_ERR_SOURCE_KLEO = 13,
GPG_ERR_SOURCE_G13 = 14,
GPG_ERR_SOURCE_ASSUAN = 15,
GPG_ERR_SOURCE_TLS = 17,
GPG_ERR_SOURCE_ANY = 31,
GPG_ERR_SOURCE_USER_1 = 32,
GPG_ERR_SOURCE_USER_2 = 33,
GPG_ERR_SOURCE_USER_3 = 34,
GPG_ERR_SOURCE_USER_4 = 35,
/* This is one more than the largest allowed entry. */
GPG_ERR_SOURCE_DIM = 128
} gpg_err_source_t;
/* The error code type gpg_err_code_t. */
/* Only use free slots, never change or reorder the existing
* entries. */
typedef enum
{
GPG_ERR_NO_ERROR = 0,
GPG_ERR_GENERAL = 1,
GPG_ERR_UNKNOWN_PACKET = 2,
GPG_ERR_UNKNOWN_VERSION = 3,
GPG_ERR_PUBKEY_ALGO = 4,
GPG_ERR_DIGEST_ALGO = 5,
GPG_ERR_BAD_PUBKEY = 6,
GPG_ERR_BAD_SECKEY = 7,
GPG_ERR_BAD_SIGNATURE = 8,
GPG_ERR_NO_PUBKEY = 9,
GPG_ERR_CHECKSUM = 10,
GPG_ERR_BAD_PASSPHRASE = 11,
GPG_ERR_CIPHER_ALGO = 12,
GPG_ERR_KEYRING_OPEN = 13,
GPG_ERR_INV_PACKET = 14,
GPG_ERR_INV_ARMOR = 15,
GPG_ERR_NO_USER_ID = 16,
GPG_ERR_NO_SECKEY = 17,
GPG_ERR_WRONG_SECKEY = 18,
GPG_ERR_BAD_KEY = 19,
GPG_ERR_COMPR_ALGO = 20,
GPG_ERR_NO_PRIME = 21,
GPG_ERR_NO_ENCODING_METHOD = 22,
GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
GPG_ERR_NO_SIGNATURE_SCHEME = 24,
GPG_ERR_INV_ATTR = 25,
GPG_ERR_NO_VALUE = 26,
GPG_ERR_NOT_FOUND = 27,
GPG_ERR_VALUE_NOT_FOUND = 28,
GPG_ERR_SYNTAX = 29,
GPG_ERR_BAD_MPI = 30,
GPG_ERR_INV_PASSPHRASE = 31,
GPG_ERR_SIG_CLASS = 32,
GPG_ERR_RESOURCE_LIMIT = 33,
GPG_ERR_INV_KEYRING = 34,
GPG_ERR_TRUSTDB = 35,
GPG_ERR_BAD_CERT = 36,
GPG_ERR_INV_USER_ID = 37,
GPG_ERR_UNEXPECTED = 38,
GPG_ERR_TIME_CONFLICT = 39,
GPG_ERR_KEYSERVER = 40,
GPG_ERR_WRONG_PUBKEY_ALGO = 41,
GPG_ERR_TRIBUTE_TO_D_A = 42,
GPG_ERR_WEAK_KEY = 43,
GPG_ERR_INV_KEYLEN = 44,
GPG_ERR_INV_ARG = 45,
GPG_ERR_BAD_URI = 46,
GPG_ERR_INV_URI = 47,
GPG_ERR_NETWORK = 48,
GPG_ERR_UNKNOWN_HOST = 49,
GPG_ERR_SELFTEST_FAILED = 50,
GPG_ERR_NOT_ENCRYPTED = 51,
GPG_ERR_NOT_PROCESSED = 52,
GPG_ERR_UNUSABLE_PUBKEY = 53,
GPG_ERR_UNUSABLE_SECKEY = 54,
GPG_ERR_INV_VALUE = 55,
GPG_ERR_BAD_CERT_CHAIN = 56,
GPG_ERR_MISSING_CERT = 57,
GPG_ERR_NO_DATA = 58,
GPG_ERR_BUG = 59,
GPG_ERR_NOT_SUPPORTED = 60,
GPG_ERR_INV_OP = 61,
GPG_ERR_TIMEOUT = 62,
GPG_ERR_INTERNAL = 63,
GPG_ERR_EOF_GCRYPT = 64,
GPG_ERR_INV_OBJ = 65,
GPG_ERR_TOO_SHORT = 66,
GPG_ERR_TOO_LARGE = 67,
GPG_ERR_NO_OBJ = 68,
GPG_ERR_NOT_IMPLEMENTED = 69,
GPG_ERR_CONFLICT = 70,
GPG_ERR_INV_CIPHER_MODE = 71,
GPG_ERR_INV_FLAG = 72,
GPG_ERR_INV_HANDLE = 73,
GPG_ERR_TRUNCATED = 74,
GPG_ERR_INCOMPLETE_LINE = 75,
GPG_ERR_INV_RESPONSE = 76,
GPG_ERR_NO_AGENT = 77,
GPG_ERR_AGENT = 78,
GPG_ERR_INV_DATA = 79,
GPG_ERR_ASSUAN_SERVER_FAULT = 80,
GPG_ERR_ASSUAN = 81,
GPG_ERR_INV_SESSION_KEY = 82,
GPG_ERR_INV_SEXP = 83,
GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
GPG_ERR_NO_PIN_ENTRY = 85,
GPG_ERR_PIN_ENTRY = 86,
GPG_ERR_BAD_PIN = 87,
GPG_ERR_INV_NAME = 88,
GPG_ERR_BAD_DATA = 89,
GPG_ERR_INV_PARAMETER = 90,
GPG_ERR_WRONG_CARD = 91,
GPG_ERR_NO_DIRMNGR = 92,
GPG_ERR_DIRMNGR = 93,
GPG_ERR_CERT_REVOKED = 94,
GPG_ERR_NO_CRL_KNOWN = 95,
GPG_ERR_CRL_TOO_OLD = 96,
GPG_ERR_LINE_TOO_LONG = 97,
GPG_ERR_NOT_TRUSTED = 98,
GPG_ERR_CANCELED = 99,
GPG_ERR_BAD_CA_CERT = 100,
GPG_ERR_CERT_EXPIRED = 101,
GPG_ERR_CERT_TOO_YOUNG = 102,
GPG_ERR_UNSUPPORTED_CERT = 103,
GPG_ERR_UNKNOWN_SEXP = 104,
GPG_ERR_UNSUPPORTED_PROTECTION = 105,
GPG_ERR_CORRUPTED_PROTECTION = 106,
GPG_ERR_AMBIGUOUS_NAME = 107,
GPG_ERR_CARD = 108,
GPG_ERR_CARD_RESET = 109,
GPG_ERR_CARD_REMOVED = 110,
GPG_ERR_INV_CARD = 111,
GPG_ERR_CARD_NOT_PRESENT = 112,
GPG_ERR_NO_PKCS15_APP = 113,
GPG_ERR_NOT_CONFIRMED = 114,
GPG_ERR_CONFIGURATION = 115,
GPG_ERR_NO_POLICY_MATCH = 116,
GPG_ERR_INV_INDEX = 117,
GPG_ERR_INV_ID = 118,
GPG_ERR_NO_SCDAEMON = 119,
GPG_ERR_SCDAEMON = 120,
GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
GPG_ERR_BAD_PIN_METHOD = 122,
GPG_ERR_CARD_NOT_INITIALIZED = 123,
GPG_ERR_UNSUPPORTED_OPERATION = 124,
GPG_ERR_WRONG_KEY_USAGE = 125,
GPG_ERR_NOTHING_FOUND = 126,
GPG_ERR_WRONG_BLOB_TYPE = 127,
GPG_ERR_MISSING_VALUE = 128,
GPG_ERR_HARDWARE = 129,
GPG_ERR_PIN_BLOCKED = 130,
GPG_ERR_USE_CONDITIONS = 131,
GPG_ERR_PIN_NOT_SYNCED = 132,
GPG_ERR_INV_CRL = 133,
GPG_ERR_BAD_BER = 134,
GPG_ERR_INV_BER = 135,
GPG_ERR_ELEMENT_NOT_FOUND = 136,
GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
GPG_ERR_INV_TAG = 138,
GPG_ERR_INV_LENGTH = 139,
GPG_ERR_INV_KEYINFO = 140,
GPG_ERR_UNEXPECTED_TAG = 141,
GPG_ERR_NOT_DER_ENCODED = 142,
GPG_ERR_NO_CMS_OBJ = 143,
GPG_ERR_INV_CMS_OBJ = 144,
GPG_ERR_UNKNOWN_CMS_OBJ = 145,
GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
GPG_ERR_UNSUPPORTED_ENCODING = 147,
GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
GPG_ERR_UNKNOWN_ALGORITHM = 149,
GPG_ERR_INV_ENGINE = 150,
GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
GPG_ERR_DECRYPT_FAILED = 152,
GPG_ERR_KEY_EXPIRED = 153,
GPG_ERR_SIG_EXPIRED = 154,
GPG_ERR_ENCODING_PROBLEM = 155,
GPG_ERR_INV_STATE = 156,
GPG_ERR_DUP_VALUE = 157,
GPG_ERR_MISSING_ACTION = 158,
GPG_ERR_MODULE_NOT_FOUND = 159,
GPG_ERR_INV_OID_STRING = 160,
GPG_ERR_INV_TIME = 161,
GPG_ERR_INV_CRL_OBJ = 162,
GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
GPG_ERR_INV_CERT_OBJ = 164,
GPG_ERR_UNKNOWN_NAME = 165,
GPG_ERR_LOCALE_PROBLEM = 166,
GPG_ERR_NOT_LOCKED = 167,
GPG_ERR_PROTOCOL_VIOLATION = 168,
GPG_ERR_INV_MAC = 169,
GPG_ERR_INV_REQUEST = 170,
GPG_ERR_UNKNOWN_EXTN = 171,
GPG_ERR_UNKNOWN_CRIT_EXTN = 172,
GPG_ERR_LOCKED = 173,
GPG_ERR_UNKNOWN_OPTION = 174,
GPG_ERR_UNKNOWN_COMMAND = 175,
GPG_ERR_NOT_OPERATIONAL = 176,
GPG_ERR_NO_PASSPHRASE = 177,
GPG_ERR_NO_PIN = 178,
GPG_ERR_NOT_ENABLED = 179,
GPG_ERR_NO_ENGINE = 180,
GPG_ERR_MISSING_KEY = 181,
GPG_ERR_TOO_MANY = 182,
GPG_ERR_LIMIT_REACHED = 183,
GPG_ERR_NOT_INITIALIZED = 184,
GPG_ERR_MISSING_ISSUER_CERT = 185,
GPG_ERR_NO_KEYSERVER = 186,
GPG_ERR_INV_CURVE = 187,
GPG_ERR_UNKNOWN_CURVE = 188,
GPG_ERR_DUP_KEY = 189,
GPG_ERR_AMBIGUOUS = 190,
GPG_ERR_NO_CRYPT_CTX = 191,
GPG_ERR_WRONG_CRYPT_CTX = 192,
GPG_ERR_BAD_CRYPT_CTX = 193,
GPG_ERR_CRYPT_CTX_CONFLICT = 194,
GPG_ERR_BROKEN_PUBKEY = 195,
GPG_ERR_BROKEN_SECKEY = 196,
GPG_ERR_MAC_ALGO = 197,
GPG_ERR_FULLY_CANCELED = 198,
GPG_ERR_UNFINISHED = 199,
GPG_ERR_BUFFER_TOO_SHORT = 200,
GPG_ERR_SEXP_INV_LEN_SPEC = 201,
GPG_ERR_SEXP_STRING_TOO_LONG = 202,
GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
GPG_ERR_SEXP_NOT_CANONICAL = 204,
GPG_ERR_SEXP_BAD_CHARACTER = 205,
GPG_ERR_SEXP_BAD_QUOTATION = 206,
GPG_ERR_SEXP_ZERO_PREFIX = 207,
GPG_ERR_SEXP_NESTED_DH = 208,
GPG_ERR_SEXP_UNMATCHED_DH = 209,
GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
GPG_ERR_SUBKEYS_EXP_OR_REV = 217,
GPG_ERR_DB_CORRUPTED = 218,
GPG_ERR_SERVER_FAILED = 219,
GPG_ERR_NO_NAME = 220,
GPG_ERR_NO_KEY = 221,
GPG_ERR_LEGACY_KEY = 222,
GPG_ERR_REQUEST_TOO_SHORT = 223,
GPG_ERR_REQUEST_TOO_LONG = 224,
GPG_ERR_OBJ_TERM_STATE = 225,
GPG_ERR_NO_CERT_CHAIN = 226,
GPG_ERR_CERT_TOO_LARGE = 227,
GPG_ERR_INV_RECORD = 228,
GPG_ERR_BAD_MAC = 229,
GPG_ERR_UNEXPECTED_MSG = 230,
GPG_ERR_COMPR_FAILED = 231,
GPG_ERR_WOULD_WRAP = 232,
GPG_ERR_FATAL_ALERT = 233,
GPG_ERR_NO_CIPHER = 234,
GPG_ERR_MISSING_CLIENT_CERT = 235,
GPG_ERR_CLOSE_NOTIFY = 236,
GPG_ERR_TICKET_EXPIRED = 237,
GPG_ERR_BAD_TICKET = 238,
GPG_ERR_UNKNOWN_IDENTITY = 239,
GPG_ERR_BAD_HS_CERT = 240,
GPG_ERR_BAD_HS_CERT_REQ = 241,
GPG_ERR_BAD_HS_CERT_VER = 242,
GPG_ERR_BAD_HS_CHANGE_CIPHER = 243,
GPG_ERR_BAD_HS_CLIENT_HELLO = 244,
GPG_ERR_BAD_HS_SERVER_HELLO = 245,
GPG_ERR_BAD_HS_SERVER_HELLO_DONE = 246,
GPG_ERR_BAD_HS_FINISHED = 247,
GPG_ERR_BAD_HS_SERVER_KEX = 248,
GPG_ERR_BAD_HS_CLIENT_KEX = 249,
GPG_ERR_BOGUS_STRING = 250,
GPG_ERR_FORBIDDEN = 251,
GPG_ERR_KEY_DISABLED = 252,
GPG_ERR_KEY_ON_CARD = 253,
GPG_ERR_INV_LOCK_OBJ = 254,
GPG_ERR_TRUE = 255,
GPG_ERR_FALSE = 256,
GPG_ERR_ASS_GENERAL = 257,
GPG_ERR_ASS_ACCEPT_FAILED = 258,
GPG_ERR_ASS_CONNECT_FAILED = 259,
GPG_ERR_ASS_INV_RESPONSE = 260,
GPG_ERR_ASS_INV_VALUE = 261,
GPG_ERR_ASS_INCOMPLETE_LINE = 262,
GPG_ERR_ASS_LINE_TOO_LONG = 263,
GPG_ERR_ASS_NESTED_COMMANDS = 264,
GPG_ERR_ASS_NO_DATA_CB = 265,
GPG_ERR_ASS_NO_INQUIRE_CB = 266,
GPG_ERR_ASS_NOT_A_SERVER = 267,
GPG_ERR_ASS_NOT_A_CLIENT = 268,
GPG_ERR_ASS_SERVER_START = 269,
GPG_ERR_ASS_READ_ERROR = 270,
GPG_ERR_ASS_WRITE_ERROR = 271,
GPG_ERR_ASS_TOO_MUCH_DATA = 273,
GPG_ERR_ASS_UNEXPECTED_CMD = 274,
GPG_ERR_ASS_UNKNOWN_CMD = 275,
GPG_ERR_ASS_SYNTAX = 276,
GPG_ERR_ASS_CANCELED = 277,
GPG_ERR_ASS_NO_INPUT = 278,
GPG_ERR_ASS_NO_OUTPUT = 279,
GPG_ERR_ASS_PARAMETER = 280,
GPG_ERR_ASS_UNKNOWN_INQUIRE = 281,
GPG_ERR_ENGINE_TOO_OLD = 300,
GPG_ERR_WINDOW_TOO_SMALL = 301,
GPG_ERR_WINDOW_TOO_LARGE = 302,
GPG_ERR_MISSING_ENVVAR = 303,
GPG_ERR_USER_ID_EXISTS = 304,
GPG_ERR_NAME_EXISTS = 305,
GPG_ERR_DUP_NAME = 306,
GPG_ERR_TOO_YOUNG = 307,
GPG_ERR_TOO_OLD = 308,
GPG_ERR_UNKNOWN_FLAG = 309,
GPG_ERR_INV_ORDER = 310,
GPG_ERR_ALREADY_FETCHED = 311,
GPG_ERR_TRY_LATER = 312,
GPG_ERR_WRONG_NAME = 313,
GPG_ERR_SYSTEM_BUG = 666,
GPG_ERR_DNS_UNKNOWN = 711,
GPG_ERR_DNS_SECTION = 712,
GPG_ERR_DNS_ADDRESS = 713,
GPG_ERR_DNS_NO_QUERY = 714,
GPG_ERR_DNS_NO_ANSWER = 715,
GPG_ERR_DNS_CLOSED = 716,
GPG_ERR_DNS_VERIFY = 717,
GPG_ERR_DNS_TIMEOUT = 718,
GPG_ERR_LDAP_GENERAL = 721,
GPG_ERR_LDAP_ATTR_GENERAL = 722,
GPG_ERR_LDAP_NAME_GENERAL = 723,
GPG_ERR_LDAP_SECURITY_GENERAL = 724,
GPG_ERR_LDAP_SERVICE_GENERAL = 725,
GPG_ERR_LDAP_UPDATE_GENERAL = 726,
GPG_ERR_LDAP_E_GENERAL = 727,
GPG_ERR_LDAP_X_GENERAL = 728,
GPG_ERR_LDAP_OTHER_GENERAL = 729,
GPG_ERR_LDAP_X_CONNECTING = 750,
GPG_ERR_LDAP_REFERRAL_LIMIT = 751,
GPG_ERR_LDAP_CLIENT_LOOP = 752,
GPG_ERR_LDAP_NO_RESULTS = 754,
GPG_ERR_LDAP_CONTROL_NOT_FOUND = 755,
GPG_ERR_LDAP_NOT_SUPPORTED = 756,
GPG_ERR_LDAP_CONNECT = 757,
GPG_ERR_LDAP_NO_MEMORY = 758,
GPG_ERR_LDAP_PARAM = 759,
GPG_ERR_LDAP_USER_CANCELLED = 760,
GPG_ERR_LDAP_FILTER = 761,
GPG_ERR_LDAP_AUTH_UNKNOWN = 762,
GPG_ERR_LDAP_TIMEOUT = 763,
GPG_ERR_LDAP_DECODING = 764,
GPG_ERR_LDAP_ENCODING = 765,
GPG_ERR_LDAP_LOCAL = 766,
GPG_ERR_LDAP_SERVER_DOWN = 767,
GPG_ERR_LDAP_SUCCESS = 768,
GPG_ERR_LDAP_OPERATIONS = 769,
GPG_ERR_LDAP_PROTOCOL = 770,
GPG_ERR_LDAP_TIMELIMIT = 771,
GPG_ERR_LDAP_SIZELIMIT = 772,
GPG_ERR_LDAP_COMPARE_FALSE = 773,
GPG_ERR_LDAP_COMPARE_TRUE = 774,
GPG_ERR_LDAP_UNSUPPORTED_AUTH = 775,
GPG_ERR_LDAP_STRONG_AUTH_RQRD = 776,
GPG_ERR_LDAP_PARTIAL_RESULTS = 777,
GPG_ERR_LDAP_REFERRAL = 778,
GPG_ERR_LDAP_ADMINLIMIT = 779,
GPG_ERR_LDAP_UNAVAIL_CRIT_EXTN = 780,
GPG_ERR_LDAP_CONFIDENT_RQRD = 781,
GPG_ERR_LDAP_SASL_BIND_INPROG = 782,
GPG_ERR_LDAP_NO_SUCH_ATTRIBUTE = 784,
GPG_ERR_LDAP_UNDEFINED_TYPE = 785,
GPG_ERR_LDAP_BAD_MATCHING = 786,
GPG_ERR_LDAP_CONST_VIOLATION = 787,
GPG_ERR_LDAP_TYPE_VALUE_EXISTS = 788,
GPG_ERR_LDAP_INV_SYNTAX = 789,
GPG_ERR_LDAP_NO_SUCH_OBJ = 800,
GPG_ERR_LDAP_ALIAS_PROBLEM = 801,
GPG_ERR_LDAP_INV_DN_SYNTAX = 802,
GPG_ERR_LDAP_IS_LEAF = 803,
GPG_ERR_LDAP_ALIAS_DEREF = 804,
GPG_ERR_LDAP_X_PROXY_AUTH_FAIL = 815,
GPG_ERR_LDAP_BAD_AUTH = 816,
GPG_ERR_LDAP_INV_CREDENTIALS = 817,
GPG_ERR_LDAP_INSUFFICIENT_ACC = 818,
GPG_ERR_LDAP_BUSY = 819,
GPG_ERR_LDAP_UNAVAILABLE = 820,
GPG_ERR_LDAP_UNWILL_TO_PERFORM = 821,
GPG_ERR_LDAP_LOOP_DETECT = 822,
GPG_ERR_LDAP_NAMING_VIOLATION = 832,
GPG_ERR_LDAP_OBJ_CLS_VIOLATION = 833,
GPG_ERR_LDAP_NOT_ALLOW_NONLEAF = 834,
GPG_ERR_LDAP_NOT_ALLOW_ON_RDN = 835,
GPG_ERR_LDAP_ALREADY_EXISTS = 836,
GPG_ERR_LDAP_NO_OBJ_CLASS_MODS = 837,
GPG_ERR_LDAP_RESULTS_TOO_LARGE = 838,
GPG_ERR_LDAP_AFFECTS_MULT_DSAS = 839,
GPG_ERR_LDAP_VLV = 844,
GPG_ERR_LDAP_OTHER = 848,
GPG_ERR_LDAP_CUP_RESOURCE_LIMIT = 881,
GPG_ERR_LDAP_CUP_SEC_VIOLATION = 882,
GPG_ERR_LDAP_CUP_INV_DATA = 883,
GPG_ERR_LDAP_CUP_UNSUP_SCHEME = 884,
GPG_ERR_LDAP_CUP_RELOAD = 885,
GPG_ERR_LDAP_CANCELLED = 886,
GPG_ERR_LDAP_NO_SUCH_OPERATION = 887,
GPG_ERR_LDAP_TOO_LATE = 888,
GPG_ERR_LDAP_CANNOT_CANCEL = 889,
GPG_ERR_LDAP_ASSERTION_FAILED = 890,
GPG_ERR_LDAP_PROX_AUTH_DENIED = 891,
GPG_ERR_USER_1 = 1024,
GPG_ERR_USER_2 = 1025,
GPG_ERR_USER_3 = 1026,
GPG_ERR_USER_4 = 1027,
GPG_ERR_USER_5 = 1028,
GPG_ERR_USER_6 = 1029,
GPG_ERR_USER_7 = 1030,
GPG_ERR_USER_8 = 1031,
GPG_ERR_USER_9 = 1032,
GPG_ERR_USER_10 = 1033,
GPG_ERR_USER_11 = 1034,
GPG_ERR_USER_12 = 1035,
GPG_ERR_USER_13 = 1036,
GPG_ERR_USER_14 = 1037,
GPG_ERR_USER_15 = 1038,
GPG_ERR_USER_16 = 1039,
GPG_ERR_MISSING_ERRNO = 16381,
GPG_ERR_UNKNOWN_ERRNO = 16382,
GPG_ERR_EOF = 16383,
/* The following error codes are used to map system errors. */
#define GPG_ERR_SYSTEM_ERROR (1 << 15)
GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
/* This is one more than the largest allowed entry. */
GPG_ERR_CODE_DIM = 65536
} gpg_err_code_t;
/* The error value type gpg_error_t. */
/* We would really like to use bit-fields in a struct, but using
* structs as return values can cause binary compatibility issues, in
* particular if you want to do it efficiently (also see
* -freg-struct-return option to GCC). */
typedef unsigned int gpg_error_t;
/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th
* bit indicates system errors. */
#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
/* Bits 17 to 24 are reserved. */
/* We use the upper 7 bits of gpg_error_t for error sources. */
#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
#define GPG_ERR_SOURCE_SHIFT 24
/* The highest bit is reserved. It shouldn't be used to prevent
* potential negative numbers when transmitting error values as
* text. */
/*
* GCC feature test.
*/
#if __GNUC__
# define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#else
# define _GPG_ERR_GCC_VERSION 0
#endif
#undef _GPG_ERR_HAVE_CONSTRUCTOR
#if _GPG_ERR_GCC_VERSION > 30100
# define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
# define _GPG_ERR_HAVE_CONSTRUCTOR
#else
# define _GPG_ERR_CONSTRUCTOR
#endif
#define GPGRT_GCC_VERSION _GPG_ERR_GCC_VERSION
#if _GPG_ERR_GCC_VERSION >= 29200
# define _GPGRT__RESTRICT __restrict__
#else
# define _GPGRT__RESTRICT
#endif
/* The noreturn attribute. */
#if _GPG_ERR_GCC_VERSION >= 20500
# define GPGRT_ATTR_NORETURN __attribute__ ((noreturn))
#else
# define GPGRT_ATTR_NORETURN
#endif
/* The printf attributes. */
#if _GPG_ERR_GCC_VERSION >= 40400
# define GPGRT_ATTR_PRINTF(f, a) \
__attribute__ ((format(__gnu_printf__,f,a)))
# define GPGRT_ATTR_NR_PRINTF(f, a) \
__attribute__ ((noreturn, format(__gnu_printf__,f,a)))
#elif _GPG_ERR_GCC_VERSION >= 20500
# define GPGRT_ATTR_PRINTF(f, a) \
__attribute__ ((format(printf,f,a)))
# define GPGRT_ATTR_NR_PRINTF(f, a) \
__attribute__ ((noreturn, format(printf,f,a)))
#else
# define GPGRT_ATTR_PRINTF(f, a)
# define GPGRT_ATTR_NR_PRINTF(f, a)
#endif
#if _GPG_ERR_GCC_VERSION >= 20800
# define GPGRT_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a)))
#else
# define GPGRT_ATTR_FORMAT_ARG(a)
#endif
/* The sentinel attribute. */
#if _GPG_ERR_GCC_VERSION >= 40000
# define GPGRT_ATTR_SENTINEL(a) __attribute__ ((sentinel(a)))
#else
# define GPGRT_ATTR_SENTINEL(a)
#endif
/* The used and unused attributes.
* I am not sure since when the unused attribute is really supported.
* In any case it it only needed for gcc versions which print a
* warning. Thus let us require gcc >= 3.5. */
#if _GPG_ERR_GCC_VERSION >= 40000
# define GPGRT_ATTR_USED __attribute__ ((used))
#else
# define GPGRT_ATTR_USED
#endif
#if _GPG_ERR_GCC_VERSION >= 30500
# define GPGRT_ATTR_UNUSED __attribute__ ((unused))
#else
# define GPGRT_ATTR_UNUSED
#endif
/* The deprecated attribute. */
#if _GPG_ERR_GCC_VERSION >= 30100
# define GPGRT_ATTR_DEPRECATED __attribute__ ((__deprecated__))
#else
# define GPGRT_ATTR_DEPRECATED
#endif
/* The pure attribute. */
#if _GPG_ERR_GCC_VERSION >= 29600
# define GPGRT_ATTR_PURE __attribute__ ((__pure__))
#else
# define GPGRT_ATTR_PURE
#endif
/* The malloc attribute. */
#if _GPG_ERR_GCC_VERSION >= 30200
# define GPGRT_ATTR_MALLOC __attribute__ ((__malloc__))
#else
# define GPGRT_ATTR_MALLOC
#endif
/* A macro defined if a GCC style __FUNCTION__ macro is available. */
#undef GPGRT_HAVE_MACRO_FUNCTION
#if _GPG_ERR_GCC_VERSION >= 20500
# define GPGRT_HAVE_MACRO_FUNCTION 1
#endif
/* A macro defined if the pragma GCC push_options is available. */
#undef GPGRT_HAVE_PRAGMA_GCC_PUSH
#if _GPG_ERR_GCC_VERSION >= 40400
# define GPGRT_HAVE_PRAGMA_GCC_PUSH 1
#endif
/* Detect LeakSanitizer (LSan) support for GCC and Clang based on
* whether AddressSanitizer (ASAN) is enabled via -fsanitize=address).
* Note that -fsanitize=leak just affect the linker options which
* cannot be detected here. In that case you have to define the
* GPGRT_HAVE_LEAK_SANITIZER macro manually. */
#ifdef __GNUC__
# ifdef __SANITIZE_ADDRESS__
# define GPGRT_HAVE_LEAK_SANITIZER
# elif defined(__has_feature)
# if __has_feature(address_sanitizer)
# define GPGRT_HAVE_LEAK_SANITIZER
# endif
# endif
#endif
/* The new name for the inline macro. */
#define GPGRT_INLINE GPG_ERR_INLINE
#ifdef GPGRT_HAVE_LEAK_SANITIZER
# include <sanitizer/lsan_interface.h>
#endif
/* Mark heap objects as non-leaked memory. */
static GPGRT_INLINE void
gpgrt_annotate_leaked_object (const void *p)
{
#ifdef GPGRT_HAVE_LEAK_SANITIZER
__lsan_ignore_object(p);
#else
(void)p;
#endif
}
/*
* Initialization function.
*/
/* Initialize the library. This function should be run early. */
gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
/* If this is defined, the library is already initialized by the
constructor and does not need to be initialized explicitely. */
#undef GPG_ERR_INITIALIZED
#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
# define GPG_ERR_INITIALIZED 1
# define gpgrt_init() do { gpg_err_init (); } while (0)
#else
# define gpgrt_init() do { ; } while (0)
#endif
/* See the source on how to use the deinit function; it is usually not
required. */
void gpg_err_deinit (int mode);
/* Register blocking system I/O clamping functions. */
void gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void));
/* Get current I/O clamping functions. */
void gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void));
/* Register a custom malloc/realloc/free function. */
void gpgrt_set_alloc_func (void *(*f)(void *a, size_t n));
/*
* Constructor and accessor functions.
*/
/* Construct an error value from an error code and source. Within a
* subsystem, use gpg_error. */
static GPG_ERR_INLINE gpg_error_t
gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
{
return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
: (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
| (code & GPG_ERR_CODE_MASK));
}
/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
* file to specify a default source for gpg_error. */
#ifndef GPG_ERR_SOURCE_DEFAULT
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
#endif
static GPG_ERR_INLINE gpg_error_t
gpg_error (gpg_err_code_t code)
{
return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
}
/* Retrieve the error code from an error value. */
static GPG_ERR_INLINE gpg_err_code_t
gpg_err_code (gpg_error_t err)
{
return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
}
/* Retrieve the error source from an error value. */
static GPG_ERR_INLINE gpg_err_source_t
gpg_err_source (gpg_error_t err)
{
return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
& GPG_ERR_SOURCE_MASK);
}
/* String functions. */
/* Return a pointer to a string containing a description of the error
* code in the error value ERR. This function is not thread-safe. */
const char *gpg_strerror (gpg_error_t err);
/* Return the error string for ERR in the user-supplied buffer BUF of
* size BUFLEN. This function is, in contrast to gpg_strerror,
* thread-safe if a thread-safe strerror_r() function is provided by
* the system. If the function succeeds, 0 is returned and BUF
* contains the string describing the error. If the buffer was not
* large enough, ERANGE is returned and BUF contains as much of the
* beginning of the error string as fits into the buffer. */
int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
/* Return a pointer to a string containing a description of the error
* source in the error value ERR. */
const char *gpg_strsource (gpg_error_t err);
/*
* Mapping of system errors (errno).
*/
/* Retrieve the error code for the system error ERR. This returns
* GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
* this). */
gpg_err_code_t gpg_err_code_from_errno (int err);
/* Retrieve the system error for the error code CODE. This returns 0
* if CODE is not a system error code. */
int gpg_err_code_to_errno (gpg_err_code_t code);
/* Retrieve the error code directly from the ERRNO variable. This
* returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
* (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
gpg_err_code_t gpg_err_code_from_syserror (void);
/* Set the ERRNO variable. This function is the preferred way to set
* ERRNO due to peculiarities on WindowsCE. */
void gpg_err_set_errno (int err);
/* Return or check the version. Both functions are identical. */
const char *gpgrt_check_version (const char *req_version);
const char *gpg_error_check_version (const char *req_version);
/* System specific type definitions. */
#include <sys/types.h>
typedef ssize_t gpgrt_ssize_t;
#include <stdint.h>
typedef int64_t gpgrt_off_t;
/* Self-documenting convenience functions. */
static GPG_ERR_INLINE gpg_error_t
gpg_err_make_from_errno (gpg_err_source_t source, int err)
{
return gpg_err_make (source, gpg_err_code_from_errno (err));
}
static GPG_ERR_INLINE gpg_error_t
gpg_error_from_errno (int err)
{
return gpg_error (gpg_err_code_from_errno (err));
}
static GPG_ERR_INLINE gpg_error_t
gpg_error_from_syserror (void)
{
return gpg_error (gpg_err_code_from_syserror ());
}
/*
* Malloc and friends
*/
void *gpgrt_realloc (void *a, size_t n);
void *gpgrt_malloc (size_t n);
void *gpgrt_calloc (size_t n, size_t m);
char *gpgrt_strdup (const char *string);
char *gpgrt_strconcat (const char *s1, ...) GPGRT_ATTR_SENTINEL(0);
void gpgrt_free (void *a);
/*
* System specific function wrappers.
*/
/* A getenv replacement which mallocs the returned string. */
char *gpgrt_getenv (const char *name);
/* A setenv and a unsetenv replacement.*/
gpg_err_code_t gpgrt_setenv (const char *name,
const char *value, int overwrite);
#define gpgrt_unsetenv(n) gpgrt_setenv ((n), NULL, 1)
/* A wrapper around mkdir using a string for the mode. */
gpg_err_code_t gpgrt_mkdir (const char *name, const char *modestr);
/* A simple wrapper around chdir. */
gpg_err_code_t gpgrt_chdir (const char *name);
/* Return the current WD as a malloced string. */
char *gpgrt_getcwd (void);
/*
* Lock functions.
*/
#include <pthread.h>
typedef struct
{
long _vers;
union {
volatile char _priv[sizeof(pthread_mutex_t)];
long _x_align;
long *_xp_align;
} u;
} gpgrt_lock_t;
#define GPGRT_LOCK_INITIALIZER {1,{{0}}}
#define GPGRT_LOCK_DEFINE(name) \
static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER
/* NB: If GPGRT_LOCK_DEFINE is not used, zero out the lock variable
before passing it to gpgrt_lock_init. */
gpg_err_code_t gpgrt_lock_init (gpgrt_lock_t *lockhd);
gpg_err_code_t gpgrt_lock_lock (gpgrt_lock_t *lockhd);
gpg_err_code_t gpgrt_lock_trylock (gpgrt_lock_t *lockhd);
gpg_err_code_t gpgrt_lock_unlock (gpgrt_lock_t *lockhd);
gpg_err_code_t gpgrt_lock_destroy (gpgrt_lock_t *lockhd);
/*
* Thread functions.
*/
gpg_err_code_t gpgrt_yield (void);
/*
* Estream
*/
/* The definition of this struct is entirely private. You must not
use it for anything. It is only here so some functions can be
implemented as macros. */
struct _gpgrt_stream_internal;
struct _gpgrt__stream
{
/* The layout of this struct must never change. It may be grown,
but only if all functions which access the new members are
versioned. */
/* Various flags. */
struct {
unsigned int magic: 16;
unsigned int writing: 1;
unsigned int reserved: 15;
} flags;
/* A pointer to the stream buffer. */
unsigned char *buffer;
/* The size of the buffer in bytes. */
size_t buffer_size;
/* The length of the usable data in the buffer, only valid when in
read mode (see flags). */
size_t data_len;
/* The current position of the offset pointer, valid in read and
write mode. */
size_t data_offset;
size_t data_flushed;
unsigned char *unread_buffer;
size_t unread_buffer_size;
/* The number of unread bytes. */
size_t unread_data_len;
/* A pointer to our internal data for this stream. */
struct _gpgrt_stream_internal *intern;
};
/* The opaque type for an estream. */
typedef struct _gpgrt__stream *gpgrt_stream_t;
#ifdef GPGRT_ENABLE_ES_MACROS
typedef struct _gpgrt__stream *estream_t;
#endif
typedef ssize_t (*gpgrt_cookie_read_function_t) (void *cookie,
void *buffer, size_t size);
typedef ssize_t (*gpgrt_cookie_write_function_t) (void *cookie,
const void *buffer,
size_t size);
typedef int (*gpgrt_cookie_seek_function_t) (void *cookie,
gpgrt_off_t *pos, int whence);
typedef int (*gpgrt_cookie_close_function_t) (void *cookie);
struct _gpgrt_cookie_io_functions
{
gpgrt_cookie_read_function_t func_read;
gpgrt_cookie_write_function_t func_write;
gpgrt_cookie_seek_function_t func_seek;
gpgrt_cookie_close_function_t func_close;
};
typedef struct _gpgrt_cookie_io_functions gpgrt_cookie_io_functions_t;
#ifdef GPGRT_ENABLE_ES_MACROS
typedef struct _gpgrt_cookie_io_functions es_cookie_io_functions_t;
#define es_cookie_read_function_t gpgrt_cookie_read_function_t
#define es_cookie_write_function_t gpgrt_cookie_read_function_t
#define es_cookie_seek_function_t gpgrt_cookie_read_function_t
#define es_cookie_close_function_t gpgrt_cookie_read_function_t
#endif
enum gpgrt_syshd_types
{
GPGRT_SYSHD_NONE = 0, /* No system handle available. */
GPGRT_SYSHD_FD = 1, /* A file descriptor as returned by open(). */
GPGRT_SYSHD_SOCK = 2, /* A socket as returned by socket(). */
GPGRT_SYSHD_RVID = 3, /* A rendezvous id (see libassuan's gpgcedev.c). */
GPGRT_SYSHD_HANDLE = 4 /* A HANDLE object (Windows). */
};
struct _gpgrt_syshd
{
enum gpgrt_syshd_types type;
union {
int fd;
int sock;
int rvid;
void *handle;
} u;
};
typedef struct _gpgrt_syshd gpgrt_syshd_t;
#ifdef GPGRT_ENABLE_ES_MACROS
typedef struct _gpgrt_syshd es_syshd_t;
#define ES_SYSHD_NONE GPGRT_SYSHD_NONE
#define ES_SYSHD_FD GPGRT_SYSHD_FD
#define ES_SYSHD_SOCK GPGRT_SYSHD_SOCK
#define ES_SYSHD_RVID GPGRT_SYSHD_RVID
#define ES_SYSHD_HANDLE GPGRT_SYSHD_HANDLE
#endif
/* The object used with gpgrt_poll. */
struct _gpgrt_poll_s
{
gpgrt_stream_t stream;
unsigned int want_read:1;
unsigned int want_write:1;
unsigned int want_oob:1;
unsigned int want_rdhup:1;
unsigned int _reserv1:4;
unsigned int got_read:1;
unsigned int got_write:1;
unsigned int got_oob:1;
unsigned int got_rdhup:1;
unsigned int _reserv2:4;
unsigned int got_err:1;
unsigned int got_hup:1;
unsigned int got_nval:1;
unsigned int _reserv3:4;
unsigned int ignore:1;
unsigned int user:8; /* For application use. */
};
typedef struct _gpgrt_poll_s gpgrt_poll_t;
#ifdef GPGRT_ENABLE_ES_MACROS
typedef struct _gpgrt_poll_s es_poll_t;
#endif
gpgrt_stream_t gpgrt_fopen (const char *_GPGRT__RESTRICT path,
const char *_GPGRT__RESTRICT mode);
gpgrt_stream_t gpgrt_mopen (void *_GPGRT__RESTRICT data,
size_t data_n, size_t data_len,
unsigned int grow,
void *(*func_realloc) (void *mem, size_t size),
void (*func_free) (void *mem),
const char *_GPGRT__RESTRICT mode);
gpgrt_stream_t gpgrt_fopenmem (size_t memlimit,
const char *_GPGRT__RESTRICT mode);
gpgrt_stream_t gpgrt_fopenmem_init (size_t memlimit,
const char *_GPGRT__RESTRICT mode,
const void *data, size_t datalen);
gpgrt_stream_t gpgrt_fdopen (int filedes, const char *mode);
gpgrt_stream_t gpgrt_fdopen_nc (int filedes, const char *mode);
gpgrt_stream_t gpgrt_sysopen (gpgrt_syshd_t *syshd, const char *mode);
gpgrt_stream_t gpgrt_sysopen_nc (gpgrt_syshd_t *syshd, const char *mode);
gpgrt_stream_t gpgrt_fpopen (FILE *fp, const char *mode);
gpgrt_stream_t gpgrt_fpopen_nc (FILE *fp, const char *mode);
gpgrt_stream_t gpgrt_freopen (const char *_GPGRT__RESTRICT path,
const char *_GPGRT__RESTRICT mode,
gpgrt_stream_t _GPGRT__RESTRICT stream);
gpgrt_stream_t gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie,
const char *_GPGRT__RESTRICT mode,
gpgrt_cookie_io_functions_t functions);
int gpgrt_fclose (gpgrt_stream_t stream);
int gpgrt_fclose_snatch (gpgrt_stream_t stream,
void **r_buffer, size_t *r_buflen);
int gpgrt_onclose (gpgrt_stream_t stream, int mode,
void (*fnc) (gpgrt_stream_t, void*), void *fnc_value);
int gpgrt_fileno (gpgrt_stream_t stream);
int gpgrt_fileno_unlocked (gpgrt_stream_t stream);
int gpgrt_syshd (gpgrt_stream_t stream, gpgrt_syshd_t *syshd);
int gpgrt_syshd_unlocked (gpgrt_stream_t stream, gpgrt_syshd_t *syshd);
void _gpgrt_set_std_fd (int no, int fd);
gpgrt_stream_t _gpgrt_get_std_stream (int fd);
#define gpgrt_stdin _gpgrt_get_std_stream (0)
#define gpgrt_stdout _gpgrt_get_std_stream (1)
#define gpgrt_stderr _gpgrt_get_std_stream (2)
void gpgrt_flockfile (gpgrt_stream_t stream);
int gpgrt_ftrylockfile (gpgrt_stream_t stream);
void gpgrt_funlockfile (gpgrt_stream_t stream);
int gpgrt_feof (gpgrt_stream_t stream);
int gpgrt_feof_unlocked (gpgrt_stream_t stream);
int gpgrt_ferror (gpgrt_stream_t stream);
int gpgrt_ferror_unlocked (gpgrt_stream_t stream);
void gpgrt_clearerr (gpgrt_stream_t stream);
void gpgrt_clearerr_unlocked (gpgrt_stream_t stream);
int _gpgrt_pending (gpgrt_stream_t stream); /* (private) */
int _gpgrt_pending_unlocked (gpgrt_stream_t stream); /* (private) */
#define gpgrt_pending(stream) _gpgrt_pending (stream)
#define gpgrt_pending_unlocked(stream) \
(((!(stream)->flags.writing) \
&& (((stream)->data_offset < (stream)->data_len) \
|| ((stream)->unread_data_len))) \
? 1 : _gpgrt_pending_unlocked ((stream)))
int gpgrt_fflush (gpgrt_stream_t stream);
int gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence);
int gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence);
long int gpgrt_ftell (gpgrt_stream_t stream);
gpgrt_off_t gpgrt_ftello (gpgrt_stream_t stream);
void gpgrt_rewind (gpgrt_stream_t stream);
int gpgrt_fgetc (gpgrt_stream_t stream);
int gpgrt_fputc (int c, gpgrt_stream_t stream);
int _gpgrt_getc_underflow (gpgrt_stream_t stream); /* (private) */
int _gpgrt_putc_overflow (int c, gpgrt_stream_t stream); /* (private) */
#define gpgrt_getc_unlocked(stream) \
(((!(stream)->flags.writing) \
&& ((stream)->data_offset < (stream)->data_len) \
&& (! (stream)->unread_data_len)) \
? ((int) (stream)->buffer[((stream)->data_offset)++]) \
: _gpgrt_getc_underflow ((stream)))
#define gpgrt_putc_unlocked(c, stream) \
(((stream)->flags.writing \
&& ((stream)->data_offset < (stream)->buffer_size) \
&& (c != '\n')) \
? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c))) \
: _gpgrt_putc_overflow ((c), (stream)))
#define gpgrt_getc(stream) gpgrt_fgetc (stream)
#define gpgrt_putc(c, stream) gpgrt_fputc (c, stream)
int gpgrt_ungetc (int c, gpgrt_stream_t stream);
int gpgrt_read (gpgrt_stream_t _GPGRT__RESTRICT stream,
void *_GPGRT__RESTRICT buffer, size_t bytes_to_read,
size_t *_GPGRT__RESTRICT bytes_read);
int gpgrt_write (gpgrt_stream_t _GPGRT__RESTRICT stream,
const void *_GPGRT__RESTRICT buffer, size_t bytes_to_write,
size_t *_GPGRT__RESTRICT bytes_written);
int gpgrt_write_sanitized (gpgrt_stream_t _GPGRT__RESTRICT stream,
const void *_GPGRT__RESTRICT buffer, size_t length,
const char *delimiters,
size_t *_GPGRT__RESTRICT bytes_written);
int gpgrt_write_hexstring (gpgrt_stream_t _GPGRT__RESTRICT stream,
const void *_GPGRT__RESTRICT buffer, size_t length,
int reserved,
size_t *_GPGRT__RESTRICT bytes_written);
size_t gpgrt_fread (void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems,
gpgrt_stream_t _GPGRT__RESTRICT stream);
size_t gpgrt_fwrite (const void *_GPGRT__RESTRICT ptr, size_t size, size_t memb,
gpgrt_stream_t _GPGRT__RESTRICT stream);
char *gpgrt_fgets (char *_GPGRT__RESTRICT s, int n,
gpgrt_stream_t _GPGRT__RESTRICT stream);
int gpgrt_fputs (const char *_GPGRT__RESTRICT s,
gpgrt_stream_t _GPGRT__RESTRICT stream);
int gpgrt_fputs_unlocked (const char *_GPGRT__RESTRICT s,
gpgrt_stream_t _GPGRT__RESTRICT stream);
ssize_t gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr,
size_t *_GPGRT__RESTRICT n,
gpgrt_stream_t stream);
ssize_t gpgrt_read_line (gpgrt_stream_t stream,
char **addr_of_buffer, size_t *length_of_buffer,
size_t *max_length);
int gpgrt_fprintf (gpgrt_stream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(2,3);
int gpgrt_fprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(2,3);
int gpgrt_printf (const char *_GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(1,2);
int gpgrt_printf_unlocked (const char *_GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(1,2);
int gpgrt_vfprintf (gpgrt_stream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format, va_list ap)
GPGRT_ATTR_PRINTF(2,0);
int gpgrt_vfprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream,
const char *_GPGRT__RESTRICT format, va_list ap)
GPGRT_ATTR_PRINTF(2,0);
int gpgrt_setvbuf (gpgrt_stream_t _GPGRT__RESTRICT stream,
char *_GPGRT__RESTRICT buf, int mode, size_t size);
void gpgrt_setbuf (gpgrt_stream_t _GPGRT__RESTRICT stream,
char *_GPGRT__RESTRICT buf);
void gpgrt_set_binary (gpgrt_stream_t stream);
int gpgrt_set_nonblock (gpgrt_stream_t stream, int onoff);
int gpgrt_get_nonblock (gpgrt_stream_t stream);
int gpgrt_poll (gpgrt_poll_t *fdlist, unsigned int nfds, int timeout);
gpgrt_stream_t gpgrt_tmpfile (void);
void gpgrt_opaque_set (gpgrt_stream_t _GPGRT__RESTRICT stream,
void *_GPGRT__RESTRICT opaque);
void *gpgrt_opaque_get (gpgrt_stream_t stream);
void gpgrt_fname_set (gpgrt_stream_t stream, const char *fname);
const char *gpgrt_fname_get (gpgrt_stream_t stream);
int gpgrt_asprintf (char **r_buf, const char * _GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(2,3);
int gpgrt_vasprintf (char **r_buf, const char * _GPGRT__RESTRICT format,
va_list ap)
GPGRT_ATTR_PRINTF(2,0);
char *gpgrt_bsprintf (const char * _GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(1,2);
char *gpgrt_vbsprintf (const char * _GPGRT__RESTRICT format, va_list ap)
GPGRT_ATTR_PRINTF(1,0);
int gpgrt_snprintf (char *buf, size_t bufsize,
const char * _GPGRT__RESTRICT format, ...)
GPGRT_ATTR_PRINTF(3,4);
int gpgrt_vsnprintf (char *buf,size_t bufsize,
const char * _GPGRT__RESTRICT format, va_list arg_ptr)
GPGRT_ATTR_PRINTF(3,0);
#ifdef GPGRT_ENABLE_ES_MACROS
# define es_fopen gpgrt_fopen
# define es_mopen gpgrt_mopen
# define es_fopenmem gpgrt_fopenmem
# define es_fopenmem_init gpgrt_fopenmem_init
# define es_fdopen gpgrt_fdopen
# define es_fdopen_nc gpgrt_fdopen_nc
# define es_sysopen gpgrt_sysopen
# define es_sysopen_nc gpgrt_sysopen_nc
# define es_fpopen gpgrt_fpopen
# define es_fpopen_nc gpgrt_fpopen_nc
# define es_freopen gpgrt_freopen
# define es_fopencookie gpgrt_fopencookie
# define es_fclose gpgrt_fclose
# define es_fclose_snatch gpgrt_fclose_snatch
# define es_onclose gpgrt_onclose
# define es_fileno gpgrt_fileno
# define es_fileno_unlocked gpgrt_fileno_unlocked
# define es_syshd gpgrt_syshd
# define es_syshd_unlocked gpgrt_syshd_unlocked
# define es_stdin _gpgrt_get_std_stream (0)
# define es_stdout _gpgrt_get_std_stream (1)
# define es_stderr _gpgrt_get_std_stream (2)
# define es_flockfile gpgrt_flockfile
# define es_ftrylockfile gpgrt_ftrylockfile
# define es_funlockfile gpgrt_funlockfile
# define es_feof gpgrt_feof
# define es_feof_unlocked gpgrt_feof_unlocked
# define es_ferror gpgrt_ferror
# define es_ferror_unlocked gpgrt_ferror_unlocked
# define es_clearerr gpgrt_clearerr
# define es_clearerr_unlocked gpgrt_clearerr_unlocked
# define es_pending gpgrt_pending
# define es_pending_unlocked gpgrt_pending_unlocked
# define es_fflush gpgrt_fflush
# define es_fseek gpgrt_fseek
# define es_fseeko gpgrt_fseeko
# define es_ftell gpgrt_ftell
# define es_ftello gpgrt_ftello
# define es_rewind gpgrt_rewind
# define es_fgetc gpgrt_fgetc
# define es_fputc gpgrt_fputc
# define es_getc_unlocked gpgrt_getc_unlocked
# define es_putc_unlocked gpgrt_putc_unlocked
# define es_getc gpgrt_getc
# define es_putc gpgrt_putc
# define es_ungetc gpgrt_ungetc
# define es_read gpgrt_read
# define es_write gpgrt_write
# define es_write_sanitized gpgrt_write_sanitized
# define es_write_hexstring gpgrt_write_hexstring
# define es_fread gpgrt_fread
# define es_fwrite gpgrt_fwrite
# define es_fgets gpgrt_fgets
# define es_fputs gpgrt_fputs
# define es_fputs_unlocked gpgrt_fputs_unlocked
# define es_getline gpgrt_getline
# define es_read_line gpgrt_read_line
# define es_free gpgrt_free
# define es_fprintf gpgrt_fprintf
# define es_fprintf_unlocked gpgrt_fprintf_unlocked
# define es_printf gpgrt_printf
# define es_printf_unlocked gpgrt_printf_unlocked
# define es_vfprintf gpgrt_vfprintf
# define es_vfprintf_unlocked gpgrt_vfprintf_unlocked
# define es_setvbuf gpgrt_setvbuf
# define es_setbuf gpgrt_setbuf
# define es_set_binary gpgrt_set_binary
# define es_set_nonblock gpgrt_set_nonblock
# define es_get_nonblock gpgrt_get_nonblock
# define es_poll gpgrt_poll
# define es_tmpfile gpgrt_tmpfile
# define es_opaque_set gpgrt_opaque_set
# define es_opaque_get gpgrt_opaque_get
# define es_fname_set gpgrt_fname_set
# define es_fname_get gpgrt_fname_get
# define es_asprintf gpgrt_asprintf
# define es_vasprintf gpgrt_vasprintf
# define es_bsprintf gpgrt_bsprintf
# define es_vbsprintf gpgrt_vbsprintf
#endif /*GPGRT_ENABLE_ES_MACROS*/
/*
* Base64 encode and decode functions.
*/
struct _gpgrt_b64state;
typedef struct _gpgrt_b64state *gpgrt_b64state_t;
gpgrt_b64state_t gpgrt_b64enc_start (gpgrt_stream_t stream, const char *title);
gpg_err_code_t gpgrt_b64enc_write (gpgrt_b64state_t state,
const void *buffer, size_t nbytes);
gpg_err_code_t gpgrt_b64enc_finish (gpgrt_b64state_t state);
gpgrt_b64state_t gpgrt_b64dec_start (const char *title);
gpg_error_t gpgrt_b64dec_proc (gpgrt_b64state_t state,
void *buffer, size_t length,
size_t *r_nbytes);
gpg_error_t gpgrt_b64dec_finish (gpgrt_b64state_t state);
/*
* Logging functions
*/
/* Flag values for gpgrt_log_set_prefix. */
#define GPGRT_LOG_WITH_PREFIX 1
#define GPGRT_LOG_WITH_TIME 2
#define GPGRT_LOG_WITH_PID 4
#define GPGRT_LOG_RUN_DETACHED 256
#define GPGRT_LOG_NO_REGISTRY 512
/* Log levels as used by gpgrt_log. */
enum gpgrt_log_levels
{
GPGRT_LOGLVL_BEGIN,
GPGRT_LOGLVL_CONT,
GPGRT_LOGLVL_INFO,
GPGRT_LOGLVL_WARN,
GPGRT_LOGLVL_ERROR,
GPGRT_LOGLVL_FATAL,
GPGRT_LOGLVL_BUG,
GPGRT_LOGLVL_DEBUG
};
/* The next 4 functions are not thread-safe - call them early. */
void gpgrt_log_set_sink (const char *name, gpgrt_stream_t stream, int fd);
void gpgrt_log_set_socket_dir_cb (const char *(*fnc)(void));
void gpgrt_log_set_pid_suffix_cb (int (*cb)(unsigned long *r_value));
void gpgrt_log_set_prefix (const char *text, unsigned int flags);
int gpgrt_get_errorcount (int clear);
void gpgrt_inc_errorcount (void);
const char *gpgrt_log_get_prefix (unsigned int *flags);
int gpgrt_log_test_fd (int fd);
int gpgrt_log_get_fd (void);
gpgrt_stream_t gpgrt_log_get_stream (void);
void gpgrt_log (int level, const char *fmt, ...) GPGRT_ATTR_PRINTF(2,3);
void gpgrt_logv (int level, const char *fmt, va_list arg_ptr);
void gpgrt_logv_prefix (int level, const char *prefix,
const char *fmt, va_list arg_ptr);
void gpgrt_log_string (int level, const char *string);
void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2);
void gpgrt_log_fatal (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2);
void gpgrt_log_error (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void gpgrt_log_info (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void gpgrt_log_debug (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void gpgrt_log_debug_string (const char *string,
const char *fmt, ...) GPGRT_ATTR_PRINTF(2,3);
void gpgrt_log_printf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void gpgrt_log_printhex (const void *buffer, size_t length,
const char *fmt, ...) GPGRT_ATTR_PRINTF(3,4);
void gpgrt_log_clock (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void gpgrt_log_flush (void);
void _gpgrt_log_assert (const char *expr, const char *file, int line,
const char *func) GPGRT_ATTR_NORETURN;
#ifdef GPGRT_HAVE_MACRO_FUNCTION
# define gpgrt_assert(expr) \
((expr) \
? (void) 0 \
: _gpgrt_log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
#else /*!GPGRT_HAVE_MACRO_FUNCTION*/
# define gpgrt_assert(expr) \
((expr) \
? (void) 0 \
: _gpgrt_log_assert (#expr, __FILE__, __LINE__, NULL))
#endif /*!GPGRT_HAVE_MACRO_FUNCTION*/
#ifdef GPGRT_ENABLE_LOG_MACROS
# define log_get_errorcount gpgrt_get_errorcount
# define log_inc_errorcount gpgrt_inc_errorcount
# define log_set_file(a) gpgrt_log_set_sink ((a), NULL, -1)
# define log_set_fd(a) gpgrt_log_set_sink (NULL, NULL, (a))
# define log_set_stream(a) gpgrt_log_set_sink (NULL, (a), -1)
# define log_set_socket_dir_cb gpgrt_log_set_socket_dir_cb
# define log_set_pid_suffix_cb gpgrt_log_set_pid_suffix_cb
# define log_set_prefix gpgrt_log_set_prefix
# define log_get_prefix gpgrt_log_get_prefix
# define log_test_fd gpgrt_log_test_fd
# define log_get_fd gpgrt_log_get_fd
# define log_get_stream gpgrt_log_get_stream
# define log_log gpgrt_log
# define log_logv gpgrt_logv
# define log_logv_prefix gpgrt_logv_prefix
# define log_string gpgrt_log_string
# define log_bug gpgrt_log_bug
# define log_fatal gpgrt_log_fatal
# define log_error gpgrt_log_error
# define log_info gpgrt_log_info
# define log_debug gpgrt_log_debug
# define log_debug_string gpgrt_log_debug_string
# define log_printf gpgrt_log_printf
# define log_printhex gpgrt_log_printhex
# define log_clock gpgrt_log_clock
# define log_flush gpgrt_log_flush
# ifdef GPGRT_HAVE_MACRO_FUNCTION
# define log_assert(expr) \
((expr) \
? (void) 0 \
: _gpgrt_log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
# else /*!GPGRT_HAVE_MACRO_FUNCTION*/
# define log_assert(expr) \
((expr) \
? (void) 0 \
: _gpgrt_log_assert (#expr, __FILE__, __LINE__, NULL))
# endif /*!GPGRT_HAVE_MACRO_FUNCTION*/
#endif /*GPGRT_ENABLE_LOG_MACROS*/
/*
* Spawn functions (Not yet available)
*/
#define GPGRT_SPAWN_NONBLOCK 16 /* Set the streams to non-blocking. */
#define GPGRT_SPAWN_RUN_ASFW 64 /* Use AllowSetForegroundWindow on W32. */
#define GPGRT_SPAWN_DETACHED 128 /* Start the process in the background. */
#if 0
/* Function and convenience macros to create pipes. */
gpg_err_code_t gpgrt_make_pipe (int filedes[2], gpgrt_stream_t *r_fp,
int direction, int nonblock);
#define gpgrt_create_pipe(a) gpgrt_make_pipe ((a),NULL, 0, 0);
#define gpgrt_create_inbound_pipe(a,b,c) gpgrt_make_pipe ((a), (b), -1,(c));
#define gpgrt_create_outbound_pipe(a,b,c) gpgrt_make_pipe ((a), (b), 1,(c));
/* Fork and exec PGMNAME. */
gpg_err_code_t gpgrt_spawn_process (const char *pgmname, const char *argv[],
int *execpt, void (*preexec)(void),
unsigned int flags,
gpgrt_stream_t *r_infp,
gpgrt_stream_t *r_outfp,
gpgrt_stream_t *r_errfp,
pid_t *pid);
/* Fork and exec PGNNAME and connect the process to the given FDs. */
gpg_err_code_t gpgrt_spawn_process_fd (const char *pgmname, const char *argv[],
int infd, int outfd, int errfd,
pid_t *pid);
/* Fork and exec PGMNAME as a detached process. */
gpg_err_code_t gpgrt_spawn_process_detached (const char *pgmname,
const char *argv[],
const char *envp[] );
/* Wait for a single process. */
gpg_err_code_t gpgrt_wait_process (const char *pgmname, pid_t pid, int hang,
int *r_exitcode);
/* Wait for a multiple processes. */
gpg_err_code_t gpgrt_wait_processes (const char **pgmnames, pid_t *pids,
size_t count, int hang, int *r_exitcodes);
/* Kill the process identified by PID. */
void gpgrt_kill_process (pid_t pid);
/* Release process resources identified by PID. */
void gpgrt_release_process (pid_t pid);
#endif /*0*/
/*
* Option parsing.
*/
struct _gpgrt_argparse_internal_s;
typedef struct
{
int *argc; /* Pointer to ARGC (value subject to change). */
char ***argv; /* Pointer to ARGV (value subject to change). */
unsigned int flags; /* Global flags. May be set prior to calling the
parser. The parser may change the value. */
int err; /* Print error description for last option.
Either 0, ARGPARSE_PRINT_WARNING or
ARGPARSE_PRINT_ERROR. */
unsigned int lineno;/* The current line number. */
int r_opt; /* Returns option code. */
int r_type; /* Returns type of option value. */
union {
int ret_int;
long ret_long;
unsigned long ret_ulong;
char *ret_str;
} r; /* Return values */
struct _gpgrt_argparse_internal_s *internal;
} gpgrt_argparse_t;
typedef struct
{
int short_opt;
const char *long_opt;
unsigned int flags;
const char *description; /* Optional description. */
} gpgrt_opt_t;
#ifdef GPGRT_ENABLE_ARGPARSE_MACROS
/* Global flags for (gpgrt_argparse_t).flags. */
#define ARGPARSE_FLAG_KEEP 1 /* Do not remove options form argv. */
#define ARGPARSE_FLAG_ALL 2 /* Do not stop at last option but return
remaining args with R_OPT set to -1. */
#define ARGPARSE_FLAG_MIXED 4 /* Assume options and args are mixed. */
#define ARGPARSE_FLAG_NOSTOP 8 /* Do not stop processing at "--". */
#define ARGPARSE_FLAG_ARG0 16 /* Do not skip the first arg. */
#define ARGPARSE_FLAG_ONEDASH 32 /* Allow long options with one dash. */
#define ARGPARSE_FLAG_NOVERSION 64 /* No output for "--version". */
#define ARGPARSE_FLAG_RESET 128 /* Request to reset the internal state. */
#define ARGPARSE_FLAG_STOP_SEEN 256 /* Set to true if a "--" has been seen. */
#define ARGPARSE_FLAG_NOLINENO 512 /* Do not zero the lineno field. */
/* Constants for (gpgrt_argparse_t).err. */
#define ARGPARSE_PRINT_WARNING 1 /* Print a diagnostic. */
#define ARGPARSE_PRINT_ERROR 2 /* Print a diagnostic and call exit. */
/* Special return values of gpgrt_argparse. */
#define ARGPARSE_IS_ARG (-1)
#define ARGPARSE_INVALID_OPTION (-2)
#define ARGPARSE_MISSING_ARG (-3)
#define ARGPARSE_KEYWORD_TOO_LONG (-4)
#define ARGPARSE_READ_ERROR (-5)
#define ARGPARSE_UNEXPECTED_ARG (-6)
#define ARGPARSE_INVALID_COMMAND (-7)
#define ARGPARSE_AMBIGUOUS_OPTION (-8)
#define ARGPARSE_AMBIGUOUS_COMMAND (-9)
#define ARGPARSE_INVALID_ALIAS (-10)
#define ARGPARSE_OUT_OF_CORE (-11)
#define ARGPARSE_INVALID_ARG (-12)
/* Flags for the option descriptor (gpgrt_opt_t)->flags. Note that
* a TYPE constant may be or-ed with the OPT constants. */
#define ARGPARSE_TYPE_NONE 0 /* Does not take an argument. */
#define ARGPARSE_TYPE_INT 1 /* Takes an int argument. */
#define ARGPARSE_TYPE_STRING 2 /* Takes a string argument. */
#define ARGPARSE_TYPE_LONG 3 /* Takes a long argument. */
#define ARGPARSE_TYPE_ULONG 4 /* Takes an unsigned long argument. */
#define ARGPARSE_OPT_OPTIONAL (1<<3) /* Argument is optional. */
#define ARGPARSE_OPT_PREFIX (1<<4) /* Allow 0x etc. prefixed values. */
#define ARGPARSE_OPT_IGNORE (1<<6) /* Ignore command or option. */
#define ARGPARSE_OPT_COMMAND (1<<7) /* The argument is a command. */
/* A set of macros to make option definitions easier to read. */
#define ARGPARSE_x(s,l,t,f,d) \
{ (s), (l), ARGPARSE_TYPE_ ## t | (f), (d) }
#define ARGPARSE_s(s,l,t,d) \
{ (s), (l), ARGPARSE_TYPE_ ## t, (d) }
#define ARGPARSE_s_n(s,l,d) \
{ (s), (l), ARGPARSE_TYPE_NONE, (d) }
#define ARGPARSE_s_i(s,l,d) \
{ (s), (l), ARGPARSE_TYPE_INT, (d) }
#define ARGPARSE_s_s(s,l,d) \
{ (s), (l), ARGPARSE_TYPE_STRING, (d) }
#define ARGPARSE_s_l(s,l,d) \
{ (s), (l), ARGPARSE_TYPE_LONG, (d) }
#define ARGPARSE_s_u(s,l,d) \
{ (s), (l), ARGPARSE_TYPE_ULONG, (d) }
#define ARGPARSE_o(s,l,t,d) \
{ (s), (l), (ARGPARSE_TYPE_ ## t | ARGPARSE_OPT_OPTIONAL), (d) }
#define ARGPARSE_o_n(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_OPTIONAL), (d) }
#define ARGPARSE_o_i(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_INT | ARGPARSE_OPT_OPTIONAL), (d) }
#define ARGPARSE_o_s(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_STRING | ARGPARSE_OPT_OPTIONAL), (d) }
#define ARGPARSE_o_l(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_LONG | ARGPARSE_OPT_OPTIONAL), (d) }
#define ARGPARSE_o_u(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_ULONG | ARGPARSE_OPT_OPTIONAL), (d) }
#define ARGPARSE_p(s,l,t,d) \
{ (s), (l), (ARGPARSE_TYPE_ ## t | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_p_n(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_p_i(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_INT | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_p_s(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_STRING | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_p_l(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_LONG | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_p_u(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_ULONG | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_op(s,l,t,d) \
{ (s), (l), (ARGPARSE_TYPE_ ## t \
| ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_op_n(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_NONE \
| ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_op_i(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_INT \
| ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_op_s(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_STRING \
| ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_op_l(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_LONG \
| ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_op_u(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_ULONG \
| ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) }
#define ARGPARSE_c(s,l,d) \
{ (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_COMMAND), (d) }
#define ARGPARSE_ignore(s,l) \
{ (s), (l), (ARGPARSE_OPT_IGNORE), "@" }
#define ARGPARSE_group(s,d) \
{ (s), NULL, 0, (d) }
/* Mark the end of the list (mandatory). */
#define ARGPARSE_end() \
{ 0, NULL, 0, NULL }
#endif /* GPGRT_ENABLE_ARGPARSE_MACROS */
/* Take care: gpgrt_argparse keeps state in ARG and requires that
* either ARGPARSE_FLAG_RESET is used after OPTS has been changed or
* gpgrt_argparse (NULL, ARG, NULL) is called first. */
int gpgrt_argparse (gpgrt_stream_t fp,
gpgrt_argparse_t *arg, gpgrt_opt_t *opts);
void gpgrt_usage (int level);
const char *gpgrt_strusage (int level);
void gpgrt_set_strusage (const char *(*f)(int));
void gpgrt_set_usage_outfnc (int (*f)(int, const char *));
void gpgrt_set_fixed_string_mapper (const char *(*f)(const char*));
#ifdef __cplusplus
}
#endif
#endif /* GPGRT_H */
#endif /* GPG_ERROR_H */
/*
Local Variables:
buffer-read-only: t
End:
*/
/*
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EVENT1_EVDNS_H_INCLUDED_
#define EVENT1_EVDNS_H_INCLUDED_
/** @file evdns.h
A dns subsystem for Libevent.
The <evdns.h> header is deprecated in Libevent 2.0 and later; please
use <event2/evdns.h> instead. Depending on what functionality you
need, you may also want to include more of the other <event2/...>
headers.
*/
#include <event.h>
#include <event2/dns.h>
#include <event2/dns_compat.h>
#include <event2/dns_struct.h>
#endif /* EVENT1_EVDNS_H_INCLUDED_ */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __CPUPOWER_CPUIDLE_H__
#define __CPUPOWER_CPUIDLE_H__
int cpuidle_is_state_disabled(unsigned int cpu,
unsigned int idlestate);
int cpuidle_state_disable(unsigned int cpu, unsigned int idlestate,
unsigned int disable);
unsigned long cpuidle_state_latency(unsigned int cpu,
unsigned int idlestate);
unsigned long cpuidle_state_usage(unsigned int cpu,
unsigned int idlestate);
unsigned long long cpuidle_state_time(unsigned int cpu,
unsigned int idlestate);
char *cpuidle_state_name(unsigned int cpu,
unsigned int idlestate);
char *cpuidle_state_desc(unsigned int cpu,
unsigned int idlestate);
unsigned int cpuidle_state_count(unsigned int cpu);
char *cpuidle_get_governor(void);
char *cpuidle_get_driver(void);
#endif /* __CPUPOWER_HELPERS_SYSFS_H__ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fstab.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _FSTAB_H
#define _FSTAB_H 1
#include <features.h>
/*
* File system table, see fstab(5).
*
* Used by dump, mount, umount, swapon, fsck, df, ...
*
* For ufs fs_spec field is the block special name. Programs that want to
* use the character special name must create that name by prepending a 'r'
* after the right most slash. Quota files are always named "quotas", so
* if type is "rq", then use concatenation of fs_file and "quotas" to locate
* quota file.
*/
#define _PATH_FSTAB "/etc/fstab"
#define FSTAB "/etc/fstab" /* deprecated */
#define FSTAB_RW "rw" /* read/write device */
#define FSTAB_RQ "rq" /* read/write with quotas */
#define FSTAB_RO "ro" /* read-only device */
#define FSTAB_SW "sw" /* swap device */
#define FSTAB_XX "xx" /* ignore totally */
struct fstab
{
char *fs_spec; /* block special device name */
char *fs_file; /* file system path prefix */
char *fs_vfstype; /* File system type, ufs, nfs */
char *fs_mntops; /* Mount options ala -o */
const char *fs_type; /* FSTAB_* from fs_mntops */
int fs_freq; /* dump frequency, in days */
int fs_passno; /* pass number on parallel dump */
};
__BEGIN_DECLS
extern struct fstab *getfsent (void) __THROW;
extern struct fstab *getfsspec (const char *__name) __THROW;
extern struct fstab *getfsfile (const char *__name) __THROW;
extern int setfsent (void) __THROW;
extern void endfsent (void) __THROW;
__END_DECLS
#endif /* fstab.h */
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* SVID
*/
#ifndef _MEMORY_H
#define _MEMORY_H 1
#include <features.h>
#ifndef _STRING_H
# include <string.h>
#endif /* string.h */
#endif /* memory.h */
/* Definitions for use with Linux AF_PACKET sockets.
Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef __NETPACKET_PACKET_H
#define __NETPACKET_PACKET_H 1
struct sockaddr_ll
{
unsigned short int sll_family;
unsigned short int sll_protocol;
int sll_ifindex;
unsigned short int sll_hatype;
unsigned char sll_pkttype;
unsigned char sll_halen;
unsigned char sll_addr[8];
};
/* Packet types. */
#define PACKET_HOST 0 /* To us. */
#define PACKET_BROADCAST 1 /* To all. */
#define PACKET_MULTICAST 2 /* To group. */
#define PACKET_OTHERHOST 3 /* To someone else. */
#define PACKET_OUTGOING 4 /* Originated by us . */
#define PACKET_LOOPBACK 5
#define PACKET_FASTROUTE 6
/* Packet socket options. */
#define PACKET_ADD_MEMBERSHIP 1
#define PACKET_DROP_MEMBERSHIP 2
#define PACKET_RECV_OUTPUT 3
#define PACKET_RX_RING 5
#define PACKET_STATISTICS 6
#define PACKET_COPY_THRESH 7
#define PACKET_AUXDATA 8
#define PACKET_ORIGDEV 9
#define PACKET_VERSION 10
#define PACKET_HDRLEN 11
#define PACKET_RESERVE 12
#define PACKET_TX_RING 13
#define PACKET_LOSS 14
#define PACKET_VNET_HDR 15
#define PACKET_TX_TIMESTAMP 16
#define PACKET_TIMESTAMP 17
#define PACKET_FANOUT 18
#define PACKET_TX_HAS_OFF 19
#define PACKET_QDISC_BYPASS 20
#define PACKET_ROLLOVER_STATS 21
#define PACKET_FANOUT_DATA 22
struct packet_mreq
{
int mr_ifindex;
unsigned short int mr_type;
unsigned short int mr_alen;
unsigned char mr_address[8];
};
#define PACKET_MR_MULTICAST 0
#define PACKET_MR_PROMISC 1
#define PACKET_MR_ALLMULTI 2
#define PACKET_MR_UNICAST 3
#endif /* netpacket/packet.h */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* System V ABI compliant user-level context switching support. */
#ifndef _UCONTEXT_H
#define _UCONTEXT_H 1
#include <features.h>
/* Get definition of __INDIRECT_RETURN. */
#include <bits/indirect-return.h>
/* Get machine dependent definition of data structures. */
#include <sys/ucontext.h>
__BEGIN_DECLS
/* Get user context and store it in variable pointed to by UCP. */
extern int getcontext (ucontext_t *__ucp) __THROWNL;
/* Set user context from information of variable pointed to by UCP. */
extern int setcontext (const ucontext_t *__ucp) __THROWNL;
/* Save current context in context variable pointed to by OUCP and set
context from variable pointed to by UCP. */
extern int swapcontext (ucontext_t *__restrict __oucp,
const ucontext_t *__restrict __ucp)
__THROWNL __INDIRECT_RETURN;
/* Manipulate user context UCP to continue with calling functions FUNC
and the ARGC-1 parameters following ARGC when the context is used
the next time in `setcontext' or `swapcontext'.
We cannot say anything about the parameters FUNC takes; `void'
is as good as any other choice. */
extern void makecontext (ucontext_t *__ucp, void (*__func) (void),
int __argc, ...) __THROW;
__END_DECLS
#endif /* ucontext.h */
/* External interfaces usable by dynamic objects loaded into GNU Make.
--THIS API IS A "TECHNOLOGY PREVIEW" ONLY. IT IS NOT A STABLE INTERFACE--
Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GNUMAKE_H_
#define _GNUMAKE_H_
/* Specify the location of elements read from makefiles. */
typedef struct
{
const char *filenm;
unsigned long lineno;
} gmk_floc;
typedef char *(*gmk_func_ptr)(const char *nm, unsigned int argc, char **argv);
#ifdef _WIN32
# ifdef GMK_BUILDING_MAKE
# define GMK_EXPORT __declspec(dllexport)
# else
# define GMK_EXPORT __declspec(dllimport)
# endif
#else
# define GMK_EXPORT
#endif
/* Free memory returned by the gmk_expand() function. */
GMK_EXPORT void gmk_free (char *str);
/* Allocate memory in GNU make's context. */
GMK_EXPORT char *gmk_alloc (unsigned int len);
/* Run $(eval ...) on the provided string BUFFER. */
GMK_EXPORT void gmk_eval (const char *buffer, const gmk_floc *floc);
/* Run GNU make expansion on the provided string STR.
Returns an allocated buffer that the caller must free with gmk_free(). */
GMK_EXPORT char *gmk_expand (const char *str);
/* Register a new GNU make function NAME (maximum of 255 chars long).
When the function is expanded in the makefile, FUNC will be invoked with
the appropriate arguments.
The return value of FUNC must be either NULL, in which case it expands to
the empty string, or a pointer to the result of the expansion in a string
created by gmk_alloc(). GNU make will free the memory when it's done.
MIN_ARGS is the minimum number of arguments the function requires.
MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum).
MIN_ARGS and MAX_ARGS may not exceed 255.
The FLAGS value may be GMK_FUNC_DEFAULT, or one or more of the following
flags OR'd together:
GMK_FUNC_NOEXPAND: the arguments to the function will be not be expanded
before FUNC is called.
*/
GMK_EXPORT void gmk_add_function (const char *name, gmk_func_ptr func,
unsigned int min_args, unsigned int max_args,
unsigned int flags);
#define GMK_FUNC_DEFAULT 0x00
#define GMK_FUNC_NOEXPAND 0x01
#endif /* _GNUMAKE_H_ */
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.25
* Wide character classification and mapping utilities <wctype.h>
*/
#ifndef _WCTYPE_H
#define _WCTYPE_H 1
#include <features.h>
#include <bits/types.h>
#include <bits/types/wint_t.h>
/* Constant expression of type `wint_t' whose value does not correspond
to any member of the extended character set. */
#ifndef WEOF
# define WEOF (0xffffffffu)
#endif
/* Some definitions from this header also appear in <wchar.h> in
Unix98 mode. */
#include <bits/wctype-wchar.h>
/*
* Extensible wide-character mapping functions: 7.15.3.2.
*/
__BEGIN_DECLS
/* Scalar type that can hold values which represent locale-specific
character mappings. */
typedef const __int32_t *wctrans_t;
/* Construct value that describes a mapping between wide characters
identified by the string argument PROPERTY. */
extern wctrans_t wctrans (const char *__property) __THROW;
/* Map the wide character WC using the mapping described by DESC. */
extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
# ifdef __USE_XOPEN2K8
/* POSIX.1-2008 extended locale interface (see locale.h). */
# include <bits/types/locale_t.h>
/* Test for any wide character for which `iswalpha' or `iswdigit' is
true. */
extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character for which `iswupper' or 'iswlower' is
true, or any wide character that is one of a locale-specific set of
wide-characters for which none of `iswcntrl', `iswdigit',
`iswpunct', or `iswspace' is true. */
extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any control wide character. */
extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character that corresponds to a decimal-digit
character. */
extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character for which `iswprint' is true and
`iswspace' is false. */
extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character that corresponds to a lowercase letter
or is one of a locale-specific set of wide characters for which
none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any printing wide character. */
extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any printing wide character that is one of a
locale-specific et of wide characters for which neither `iswspace'
nor `iswalnum' is true. */
extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character that corresponds to a locale-specific
set of wide characters for which none of `iswalnum', `iswgraph', or
`iswpunct' is true. */
extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character that corresponds to an uppercase letter
or is one of a locale-specific set of wide character for which none
of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character that corresponds to a hexadecimal-digit
character equivalent to that performed be the functions described
in the previous subclause. */
extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW;
/* Test for any wide character that corresponds to a standard blank
wide character or a locale-specific set of wide characters for
which `iswalnum' is false. */
extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW;
/* Construct value that describes a class of wide characters identified
by the string argument PROPERTY. */
extern wctype_t wctype_l (const char *__property, locale_t __locale)
__THROW;
/* Determine whether the wide-character WC has the property described by
DESC. */
extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
__THROW;
/*
* Wide-character case-mapping functions.
*/
/* Converts an uppercase letter to the corresponding lowercase letter. */
extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW;
/* Converts an lowercase letter to the corresponding uppercase letter. */
extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW;
/* Construct value that describes a mapping between wide characters
identified by the string argument PROPERTY. */
extern wctrans_t wctrans_l (const char *__property, locale_t __locale)
__THROW;
/* Map the wide character WC using the mapping described by DESC. */
extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
locale_t __locale) __THROW;
# endif /* Use POSIX 2008. */
__END_DECLS
#endif /* wctype.h */
#ifdef __cplusplus
extern "C" {
#endif
/*
* gdcache.h
*
* Caches of pointers to user structs in which the least-recently-used
* element is replaced in the event of a cache miss after the cache has
* reached a given size.
*
* John Ellson (ellson@graphviz.org) Oct 31, 1997
*
* Test this with:
* gcc -o gdcache -g -Wall -DTEST gdcache.c
*
* The cache is implemented by a singly-linked list of elements
* each containing a pointer to a user struct that is being managed by
* the cache.
*
* The head structure has a pointer to the most-recently-used
* element, and elements are moved to this position in the list each
* time they are used. The head also contains pointers to three
* user defined functions:
* - a function to test if a cached userdata matches some keydata
* - a function to provide a new userdata struct to the cache
* if there has been a cache miss.
* - a function to release a userdata struct when it is
* no longer being managed by the cache
*
* In the event of a cache miss the cache is allowed to grow up to
* a specified maximum size. After the maximum size is reached then
* the least-recently-used element is discarded to make room for the
* new. The most-recently-returned value is always left at the
* beginning of the list after retrieval.
*
* In the current implementation the cache is traversed by a linear
* search from most-recent to least-recent. This linear search
* probably limits the usefulness of this implementation to cache
* sizes of a few tens of elements.
*/
/*********************************************************/
/* header */
/*********************************************************/
#include <stdlib.h>
#ifndef NULL
# define NULL (void *)0
#endif
/* user defined function templates */
typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata);
typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata);
typedef void (*gdCacheReleaseFn_t)(void *userdata);
/* element structure */
typedef struct gdCache_element_s gdCache_element_t;
struct gdCache_element_s {
gdCache_element_t *next;
void *userdata;
};
/* head structure */
typedef struct gdCache_head_s gdCache_head_t;
struct gdCache_head_s {
gdCache_element_t *mru;
int size;
char *error;
gdCacheTestFn_t gdCacheTest;
gdCacheFetchFn_t gdCacheFetch;
gdCacheReleaseFn_t gdCacheRelease;
};
/* function templates */
gdCache_head_t *gdCacheCreate(int size,
gdCacheTestFn_t gdCacheTest,
gdCacheFetchFn_t gdCacheFetch,
gdCacheReleaseFn_t gdCacheRelease
);
void gdCacheDelete(gdCache_head_t *head);
void *gdCacheGet(gdCache_head_t *head, void *keydata);
#ifdef __cplusplus
}
#endif
/* This file defines standard ELF types, structures, and macros.
Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _ELF_H
#define _ELF_H 1
#include <features.h>
__BEGIN_DECLS
/* Standard ELF types. */
#include <stdint.h>
/* Type for a 16-bit quantity. */
typedef uint16_t Elf32_Half;
typedef uint16_t Elf64_Half;
/* Types for signed and unsigned 32-bit quantities. */
typedef uint32_t Elf32_Word;
typedef int32_t Elf32_Sword;
typedef uint32_t Elf64_Word;
typedef int32_t Elf64_Sword;
/* Types for signed and unsigned 64-bit quantities. */
typedef uint64_t Elf32_Xword;
typedef int64_t Elf32_Sxword;
typedef uint64_t Elf64_Xword;
typedef int64_t Elf64_Sxword;
/* Type of addresses. */
typedef uint32_t Elf32_Addr;
typedef uint64_t Elf64_Addr;
/* Type of file offsets. */
typedef uint32_t Elf32_Off;
typedef uint64_t Elf64_Off;
/* Type for section indices, which are 16-bit quantities. */
typedef uint16_t Elf32_Section;
typedef uint16_t Elf64_Section;
/* Type for version symbol information. */
typedef Elf32_Half Elf32_Versym;
typedef Elf64_Half Elf64_Versym;
/* The ELF file header. This appears at the start of every ELF file. */
#define EI_NIDENT (16)
typedef struct
{
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
Elf32_Half e_type; /* Object file type */
Elf32_Half e_machine; /* Architecture */
Elf32_Word e_version; /* Object file version */
Elf32_Addr e_entry; /* Entry point virtual address */
Elf32_Off e_phoff; /* Program header table file offset */
Elf32_Off e_shoff; /* Section header table file offset */
Elf32_Word e_flags; /* Processor-specific flags */
Elf32_Half e_ehsize; /* ELF header size in bytes */
Elf32_Half e_phentsize; /* Program header table entry size */
Elf32_Half e_phnum; /* Program header table entry count */
Elf32_Half e_shentsize; /* Section header table entry size */
Elf32_Half e_shnum; /* Section header table entry count */
Elf32_Half e_shstrndx; /* Section header string table index */
} Elf32_Ehdr;
typedef struct
{
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
Elf64_Half e_type; /* Object file type */
Elf64_Half e_machine; /* Architecture */
Elf64_Word e_version; /* Object file version */
Elf64_Addr e_entry; /* Entry point virtual address */
Elf64_Off e_phoff; /* Program header table file offset */
Elf64_Off e_shoff; /* Section header table file offset */
Elf64_Word e_flags; /* Processor-specific flags */
Elf64_Half e_ehsize; /* ELF header size in bytes */
Elf64_Half e_phentsize; /* Program header table entry size */
Elf64_Half e_phnum; /* Program header table entry count */
Elf64_Half e_shentsize; /* Section header table entry size */
Elf64_Half e_shnum; /* Section header table entry count */
Elf64_Half e_shstrndx; /* Section header string table index */
} Elf64_Ehdr;
/* Fields in the e_ident array. The EI_* macros are indices into the
array. The macros under each EI_* macro are the values the byte
may have. */
#define EI_MAG0 0 /* File identification byte 0 index */
#define ELFMAG0 0x7f /* Magic number byte 0 */
#define EI_MAG1 1 /* File identification byte 1 index */
#define ELFMAG1 'E' /* Magic number byte 1 */
#define EI_MAG2 2 /* File identification byte 2 index */
#define ELFMAG2 'L' /* Magic number byte 2 */
#define EI_MAG3 3 /* File identification byte 3 index */
#define ELFMAG3 'F' /* Magic number byte 3 */
/* Conglomeration of the identification bytes, for easy testing as a word. */
#define ELFMAG "\177ELF"
#define SELFMAG 4
#define EI_CLASS 4 /* File class byte index */
#define ELFCLASSNONE 0 /* Invalid class */
#define ELFCLASS32 1 /* 32-bit objects */
#define ELFCLASS64 2 /* 64-bit objects */
#define ELFCLASSNUM 3
#define EI_DATA 5 /* Data encoding byte index */
#define ELFDATANONE 0 /* Invalid data encoding */
#define ELFDATA2LSB 1 /* 2's complement, little endian */
#define ELFDATA2MSB 2 /* 2's complement, big endian */
#define ELFDATANUM 3
#define EI_VERSION 6 /* File version byte index */
/* Value must be EV_CURRENT */
#define EI_OSABI 7 /* OS ABI identification */
#define ELFOSABI_NONE 0 /* UNIX System V ABI */
#define ELFOSABI_SYSV 0 /* Alias. */
#define ELFOSABI_HPUX 1 /* HP-UX */
#define ELFOSABI_NETBSD 2 /* NetBSD. */
#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */
#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */
#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
#define ELFOSABI_AIX 7 /* IBM AIX. */
#define ELFOSABI_IRIX 8 /* SGI Irix. */
#define ELFOSABI_FREEBSD 9 /* FreeBSD. */
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */
#define ELFOSABI_ARM 97 /* ARM */
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
#define EI_ABIVERSION 8 /* ABI version */
#define EI_PAD 9 /* Byte index of padding bytes */
/* Legal values for e_type (object file type). */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* Relocatable file */
#define ET_EXEC 2 /* Executable file */
#define ET_DYN 3 /* Shared object file */
#define ET_CORE 4 /* Core file */
#define ET_NUM 5 /* Number of defined types */
#define ET_LOOS 0xfe00 /* OS-specific range start */
#define ET_HIOS 0xfeff /* OS-specific range end */
#define ET_LOPROC 0xff00 /* Processor-specific range start */
#define ET_HIPROC 0xffff /* Processor-specific range end */
/* Legal values for e_machine (architecture). */
#define EM_NONE 0 /* No machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SUN SPARC */
#define EM_386 3 /* Intel 80386 */
#define EM_68K 4 /* Motorola m68k family */
#define EM_88K 5 /* Motorola m88k family */
#define EM_IAMCU 6 /* Intel MCU */
#define EM_860 7 /* Intel 80860 */
#define EM_MIPS 8 /* MIPS R3000 big-endian */
#define EM_S370 9 /* IBM System/370 */
#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
/* reserved 11-14 */
#define EM_PARISC 15 /* HPPA */
/* reserved 16 */
#define EM_VPP500 17 /* Fujitsu VPP500 */
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
#define EM_960 19 /* Intel 80960 */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* PowerPC 64-bit */
#define EM_S390 22 /* IBM S390 */
#define EM_SPU 23 /* IBM SPU/SPC */
/* reserved 24-35 */
#define EM_V800 36 /* NEC V800 series */
#define EM_FR20 37 /* Fujitsu FR20 */
#define EM_RH32 38 /* TRW RH-32 */
#define EM_RCE 39 /* Motorola RCE */
#define EM_ARM 40 /* ARM */
#define EM_FAKE_ALPHA 41 /* Digital Alpha */
#define EM_SH 42 /* Hitachi SH */
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
#define EM_TRICORE 44 /* Siemens Tricore */
#define EM_ARC 45 /* Argonaut RISC Core */
#define EM_H8_300 46 /* Hitachi H8/300 */
#define EM_H8_300H 47 /* Hitachi H8/300H */
#define EM_H8S 48 /* Hitachi H8S */
#define EM_H8_500 49 /* Hitachi H8/500 */
#define EM_IA_64 50 /* Intel Merced */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola Coldfire */
#define EM_68HC12 53 /* Motorola M68HC12 */
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
#define EM_PCP 55 /* Siemens PCP */
#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
#define EM_STARCORE 58 /* Motorola Start*Core processor */
#define EM_ME16 59 /* Toyota ME16 processor */
#define EM_ST100 60 /* STMicroelectronic ST100 processor */
#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam */
#define EM_X86_64 62 /* AMD x86-64 architecture */
#define EM_PDSP 63 /* Sony DSP Processor */
#define EM_PDP10 64 /* Digital PDP-10 */
#define EM_PDP11 65 /* Digital PDP-11 */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
#define EM_SVX 73 /* Silicon Graphics SVx */
#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
#define EM_VAX 75 /* Digital VAX */
#define EM_CRIS 76 /* Axis Communications 32-bit emb.proc */
#define EM_JAVELIN 77 /* Infineon Technologies 32-bit emb.proc */
#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
#define EM_MMIX 80 /* Donald Knuth's educational 64-bit proc */
#define EM_HUANY 81 /* Harvard University machine-independent object files */
#define EM_PRISM 82 /* SiTera Prism */
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
#define EM_FR30 84 /* Fujitsu FR30 */
#define EM_D10V 85 /* Mitsubishi D10V */
#define EM_D30V 86 /* Mitsubishi D30V */
#define EM_V850 87 /* NEC v850 */
#define EM_M32R 88 /* Mitsubishi M32R */
#define EM_MN10300 89 /* Matsushita MN10300 */
#define EM_MN10200 90 /* Matsushita MN10200 */
#define EM_PJ 91 /* picoJava */
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
#define EM_ARC_COMPACT 93 /* ARC International ARCompact */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore */
#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Proc */
#define EM_NS32K 97 /* National Semi. 32000 */
#define EM_TPC 98 /* Tenor Network TPC */
#define EM_SNP1K 99 /* Trebia SNP 1000 */
#define EM_ST200 100 /* STMicroelectronics ST200 */
#define EM_IP2K 101 /* Ubicom IP2xxx */
#define EM_MAX 102 /* MAX processor */
#define EM_CR 103 /* National Semi. CompactRISC */
#define EM_F2MC16 104 /* Fujitsu F2MC16 */
#define EM_MSP430 105 /* Texas Instruments msp430 */
#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */
#define EM_SE_C33 107 /* Seiko Epson S1C33 family */
#define EM_SEP 108 /* Sharp embedded microprocessor */
#define EM_ARCA 109 /* Arca RISC */
#define EM_UNICORE 110 /* PKU-Unity & MPRC Peking Uni. mc series */
#define EM_EXCESS 111 /* eXcess configurable cpu */
#define EM_DXP 112 /* Icera Semi. Deep Execution Processor */
#define EM_ALTERA_NIOS2 113 /* Altera Nios II */
#define EM_CRX 114 /* National Semi. CompactRISC CRX */
#define EM_XGATE 115 /* Motorola XGATE */
#define EM_C166 116 /* Infineon C16x/XC16x */
#define EM_M16C 117 /* Renesas M16C */
#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F */
#define EM_CE 119 /* Freescale Communication Engine RISC */
#define EM_M32C 120 /* Renesas M32C */
/* reserved 121-130 */
#define EM_TSK3000 131 /* Altium TSK3000 */
#define EM_RS08 132 /* Freescale RS08 */
#define EM_SHARC 133 /* Analog Devices SHARC family */
#define EM_ECOG2 134 /* Cyan Technology eCOG2 */
#define EM_SCORE7 135 /* Sunplus S+core7 RISC */
#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP */
#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III */
#define EM_LATTICEMICO32 138 /* RISC for Lattice FPGA */
#define EM_SE_C17 139 /* Seiko Epson C17 */
#define EM_TI_C6000 140 /* Texas Instruments TMS320C6000 DSP */
#define EM_TI_C2000 141 /* Texas Instruments TMS320C2000 DSP */
#define EM_TI_C5500 142 /* Texas Instruments TMS320C55x DSP */
#define EM_TI_ARP32 143 /* Texas Instruments App. Specific RISC */
#define EM_TI_PRU 144 /* Texas Instruments Prog. Realtime Unit */
/* reserved 145-159 */
#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW DSP */
#define EM_CYPRESS_M8C 161 /* Cypress M8C */
#define EM_R32C 162 /* Renesas R32C */
#define EM_TRIMEDIA 163 /* NXP Semi. TriMedia */
#define EM_QDSP6 164 /* QUALCOMM DSP6 */
#define EM_8051 165 /* Intel 8051 and variants */
#define EM_STXP7X 166 /* STMicroelectronics STxP7x */
#define EM_NDS32 167 /* Andes Tech. compact code emb. RISC */
#define EM_ECOG1X 168 /* Cyan Technology eCOG1X */
#define EM_MAXQ30 169 /* Dallas Semi. MAXQ30 mc */
#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP */
#define EM_MANIK 171 /* M2000 Reconfigurable RISC */
#define EM_CRAYNV2 172 /* Cray NV2 vector architecture */
#define EM_RX 173 /* Renesas RX */
#define EM_METAG 174 /* Imagination Tech. META */
#define EM_MCST_ELBRUS 175 /* MCST Elbrus */
#define EM_ECOG16 176 /* Cyan Technology eCOG16 */
#define EM_CR16 177 /* National Semi. CompactRISC CR16 */
#define EM_ETPU 178 /* Freescale Extended Time Processing Unit */
#define EM_SLE9X 179 /* Infineon Tech. SLE9X */
#define EM_L10M 180 /* Intel L10M */
#define EM_K10M 181 /* Intel K10M */
/* reserved 182 */
#define EM_AARCH64 183 /* ARM AARCH64 */
/* reserved 184 */
#define EM_AVR32 185 /* Amtel 32-bit microprocessor */
#define EM_STM8 186 /* STMicroelectronics STM8 */
#define EM_TILE64 187 /* Tileta TILE64 */
#define EM_TILEPRO 188 /* Tilera TILEPro */
#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
#define EM_CUDA 190 /* NVIDIA CUDA */
#define EM_TILEGX 191 /* Tilera TILE-Gx */
#define EM_CLOUDSHIELD 192 /* CloudShield */
#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */
#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd gen. */
#define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */
#define EM_OPEN8 196 /* Open8 RISC */
#define EM_RL78 197 /* Renesas RL78 */
#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */
#define EM_78KOR 199 /* Renesas 78KOR */
#define EM_56800EX 200 /* Freescale 56800EX DSC */
#define EM_BA1 201 /* Beyond BA1 */
#define EM_BA2 202 /* Beyond BA2 */
#define EM_XCORE 203 /* XMOS xCORE */
#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) */
/* reserved 205-209 */
#define EM_KM32 210 /* KM211 KM32 */
#define EM_KMX32 211 /* KM211 KMX32 */
#define EM_EMX16 212 /* KM211 KMX16 */
#define EM_EMX8 213 /* KM211 KMX8 */
#define EM_KVARC 214 /* KM211 KVARC */
#define EM_CDP 215 /* Paneve CDP */
#define EM_COGE 216 /* Cognitive Smart Memory Processor */
#define EM_COOL 217 /* Bluechip CoolEngine */
#define EM_NORC 218 /* Nanoradio Optimized RISC */
#define EM_CSR_KALIMBA 219 /* CSR Kalimba */
#define EM_Z80 220 /* Zilog Z80 */
#define EM_VISIUM 221 /* Controls and Data Services VISIUMcore */
#define EM_FT32 222 /* FTDI Chip FT32 */
#define EM_MOXIE 223 /* Moxie processor */
#define EM_AMDGPU 224 /* AMD GPU */
/* reserved 225-242 */
#define EM_RISCV 243 /* RISC-V */
#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
#define EM_NUM 248
/* Old spellings/synonyms. */
#define EM_ARC_A5 EM_ARC_COMPACT
/* If it is necessary to assign new unofficial EM_* values, please
pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
chances of collision with official or non-GNU unofficial values. */
#define EM_ALPHA 0x9026
/* Legal values for e_version (version). */
#define EV_NONE 0 /* Invalid ELF version */
#define EV_CURRENT 1 /* Current version */
#define EV_NUM 2
/* Section header. */
typedef struct
{
Elf32_Word sh_name; /* Section name (string tbl index) */
Elf32_Word sh_type; /* Section type */
Elf32_Word sh_flags; /* Section flags */
Elf32_Addr sh_addr; /* Section virtual addr at execution */
Elf32_Off sh_offset; /* Section file offset */
Elf32_Word sh_size; /* Section size in bytes */
Elf32_Word sh_link; /* Link to another section */
Elf32_Word sh_info; /* Additional section information */
Elf32_Word sh_addralign; /* Section alignment */
Elf32_Word sh_entsize; /* Entry size if section holds table */
} Elf32_Shdr;
typedef struct
{
Elf64_Word sh_name; /* Section name (string tbl index) */
Elf64_Word sh_type; /* Section type */
Elf64_Xword sh_flags; /* Section flags */
Elf64_Addr sh_addr; /* Section virtual addr at execution */
Elf64_Off sh_offset; /* Section file offset */
Elf64_Xword sh_size; /* Section size in bytes */
Elf64_Word sh_link; /* Link to another section */
Elf64_Word sh_info; /* Additional section information */
Elf64_Xword sh_addralign; /* Section alignment */
Elf64_Xword sh_entsize; /* Entry size if section holds table */
} Elf64_Shdr;
/* Special section indices. */
#define SHN_UNDEF 0 /* Undefined section */
#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
#define SHN_LOPROC 0xff00 /* Start of processor-specific */
#define SHN_BEFORE 0xff00 /* Order section before all others
(Solaris). */
#define SHN_AFTER 0xff01 /* Order section after all others
(Solaris). */
#define SHN_HIPROC 0xff1f /* End of processor-specific */
#define SHN_LOOS 0xff20 /* Start of OS-specific */
#define SHN_HIOS 0xff3f /* End of OS-specific */
#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
#define SHN_COMMON 0xfff2 /* Associated symbol is common */
#define SHN_XINDEX 0xffff /* Index is in extra table. */
#define SHN_HIRESERVE 0xffff /* End of reserved indices */
/* Legal values for sh_type (section type). */
#define SHT_NULL 0 /* Section header table entry unused */
#define SHT_PROGBITS 1 /* Program data */
#define SHT_SYMTAB 2 /* Symbol table */
#define SHT_STRTAB 3 /* String table */
#define SHT_RELA 4 /* Relocation entries with addends */
#define SHT_HASH 5 /* Symbol hash table */
#define SHT_DYNAMIC 6 /* Dynamic linking information */
#define SHT_NOTE 7 /* Notes */
#define SHT_NOBITS 8 /* Program space with no data (bss) */
#define SHT_REL 9 /* Relocation entries, no addends */
#define SHT_SHLIB 10 /* Reserved */
#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
#define SHT_INIT_ARRAY 14 /* Array of constructors */
#define SHT_FINI_ARRAY 15 /* Array of destructors */
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
#define SHT_NUM 19 /* Number of defined types. */
#define SHT_LOOS 0x60000000 /* Start OS-specific. */
#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */
#define SHT_SUNW_move 0x6ffffffa
#define SHT_SUNW_COMDAT 0x6ffffffb
#define SHT_SUNW_syminfo 0x6ffffffc
#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
#define SHT_HIOS 0x6fffffff /* End OS-specific type */
#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
#define SHT_LOUSER 0x80000000 /* Start of application-specific */
#define SHT_HIUSER 0x8fffffff /* End of application-specific */
/* Legal values for sh_flags (section flags). */
#define SHF_WRITE (1 << 0) /* Writable */
#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
#define SHF_EXECINSTR (1 << 2) /* Executable */
#define SHF_MERGE (1 << 4) /* Might be merged */
#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling
required */
#define SHF_GROUP (1 << 9) /* Section is member of a group. */
#define SHF_TLS (1 << 10) /* Section hold thread-local data. */
#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
#define SHF_ORDERED (1 << 30) /* Special ordering requirement
(Solaris). */
#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
referenced or allocated (Solaris).*/
/* Section compression header. Used when SHF_COMPRESSED is set. */
typedef struct
{
Elf32_Word ch_type; /* Compression format. */
Elf32_Word ch_size; /* Uncompressed data size. */
Elf32_Word ch_addralign; /* Uncompressed data alignment. */
} Elf32_Chdr;
typedef struct
{
Elf64_Word ch_type; /* Compression format. */
Elf64_Word ch_reserved;
Elf64_Xword ch_size; /* Uncompressed data size. */
Elf64_Xword ch_addralign; /* Uncompressed data alignment. */
} Elf64_Chdr;
/* Legal values for ch_type (compression algorithm). */
#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */
#define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */
#define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */
#define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */
#define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */
/* Section group handling. */
#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */
/* Symbol table entry. */
typedef struct
{
Elf32_Word st_name; /* Symbol name (string tbl index) */
Elf32_Addr st_value; /* Symbol value */
Elf32_Word st_size; /* Symbol size */
unsigned char st_info; /* Symbol type and binding */
unsigned char st_other; /* Symbol visibility */
Elf32_Section st_shndx; /* Section index */
} Elf32_Sym;
typedef struct
{
Elf64_Word st_name; /* Symbol name (string tbl index) */
unsigned char st_info; /* Symbol type and binding */
unsigned char st_other; /* Symbol visibility */
Elf64_Section st_shndx; /* Section index */
Elf64_Addr st_value; /* Symbol value */
Elf64_Xword st_size; /* Symbol size */
} Elf64_Sym;
/* The syminfo section if available contains additional information about
every dynamic symbol. */
typedef struct
{
Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
Elf32_Half si_flags; /* Per symbol flags */
} Elf32_Syminfo;
typedef struct
{
Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
Elf64_Half si_flags; /* Per symbol flags */
} Elf64_Syminfo;
/* Possible values for si_boundto. */
#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
/* Possible bitmasks for si_flags. */
#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
loaded */
/* Syminfo version values. */
#define SYMINFO_NONE 0
#define SYMINFO_CURRENT 1
#define SYMINFO_NUM 2
/* How to extract and insert information held in the st_info field. */
#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
#define ELF32_ST_TYPE(val) ((val) & 0xf)
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
/* Legal values for ST_BIND subfield of st_info (symbol binding). */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* Weak symbol */
#define STB_NUM 3 /* Number of defined types. */
#define STB_LOOS 10 /* Start of OS-specific */
#define STB_GNU_UNIQUE 10 /* Unique symbol. */
#define STB_HIOS 12 /* End of OS-specific */
#define STB_LOPROC 13 /* Start of processor-specific */
#define STB_HIPROC 15 /* End of processor-specific */
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
#define STT_NOTYPE 0 /* Symbol type is unspecified */
#define STT_OBJECT 1 /* Symbol is a data object */
#define STT_FUNC 2 /* Symbol is a code object */
#define STT_SECTION 3 /* Symbol associated with a section */
#define STT_FILE 4 /* Symbol's name is file name */
#define STT_COMMON 5 /* Symbol is a common data object */
#define STT_TLS 6 /* Symbol is thread-local data object*/
#define STT_NUM 7 /* Number of defined types. */
#define STT_LOOS 10 /* Start of OS-specific */
#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
#define STT_HIOS 12 /* End of OS-specific */
#define STT_LOPROC 13 /* Start of processor-specific */
#define STT_HIPROC 15 /* End of processor-specific */
/* Symbol table indices are found in the hash buckets and chain table
of a symbol hash table section. This special index value indicates
the end of a chain, meaning no further symbols are found in that bucket. */
#define STN_UNDEF 0 /* End of a chain. */
/* How to extract and insert information held in the st_other field. */
#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
/* For ELF64 the definitions are the same. */
#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
/* Symbol visibility specification encoded in the st_other field. */
#define STV_DEFAULT 0 /* Default symbol visibility rules */
#define STV_INTERNAL 1 /* Processor specific hidden class */
#define STV_HIDDEN 2 /* Sym unavailable in other modules */
#define STV_PROTECTED 3 /* Not preemptible, not exported */
/* Relocation table entry without addend (in section of type SHT_REL). */
typedef struct
{
Elf32_Addr r_offset; /* Address */
Elf32_Word r_info; /* Relocation type and symbol index */
} Elf32_Rel;
/* I have seen two different definitions of the Elf64_Rel and
Elf64_Rela structures, so we'll leave them out until Novell (or
whoever) gets their act together. */
/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
typedef struct
{
Elf64_Addr r_offset; /* Address */
Elf64_Xword r_info; /* Relocation type and symbol index */
} Elf64_Rel;
/* Relocation table entry with addend (in section of type SHT_RELA). */
typedef struct
{
Elf32_Addr r_offset; /* Address */
Elf32_Word r_info; /* Relocation type and symbol index */
Elf32_Sword r_addend; /* Addend */
} Elf32_Rela;
typedef struct
{
Elf64_Addr r_offset; /* Address */
Elf64_Xword r_info; /* Relocation type and symbol index */
Elf64_Sxword r_addend; /* Addend */
} Elf64_Rela;
/* How to extract and insert information held in the r_info field. */
#define ELF32_R_SYM(val) ((val) >> 8)
#define ELF32_R_TYPE(val) ((val) & 0xff)
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
#define ELF64_R_SYM(i) ((i) >> 32)
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
/* Program segment header. */
typedef struct
{
Elf32_Word p_type; /* Segment type */
Elf32_Off p_offset; /* Segment file offset */
Elf32_Addr p_vaddr; /* Segment virtual address */
Elf32_Addr p_paddr; /* Segment physical address */
Elf32_Word p_filesz; /* Segment size in file */
Elf32_Word p_memsz; /* Segment size in memory */
Elf32_Word p_flags; /* Segment flags */
Elf32_Word p_align; /* Segment alignment */
} Elf32_Phdr;
typedef struct
{
Elf64_Word p_type; /* Segment type */
Elf64_Word p_flags; /* Segment flags */
Elf64_Off p_offset; /* Segment file offset */
Elf64_Addr p_vaddr; /* Segment virtual address */
Elf64_Addr p_paddr; /* Segment physical address */
Elf64_Xword p_filesz; /* Segment size in file */
Elf64_Xword p_memsz; /* Segment size in memory */
Elf64_Xword p_align; /* Segment alignment */
} Elf64_Phdr;
/* Special value for e_phnum. This indicates that the real number of
program headers is too large to fit into e_phnum. Instead the real
value is in the field sh_info of section 0. */
#define PN_XNUM 0xffff
/* Legal values for p_type (segment type). */
#define PT_NULL 0 /* Program header table entry unused */
#define PT_LOAD 1 /* Loadable program segment */
#define PT_DYNAMIC 2 /* Dynamic linking information */
#define PT_INTERP 3 /* Program interpreter */
#define PT_NOTE 4 /* Auxiliary information */
#define PT_SHLIB 5 /* Reserved */
#define PT_PHDR 6 /* Entry for header table itself */
#define PT_TLS 7 /* Thread-local storage segment */
#define PT_NUM 8 /* Number of defined types */
#define PT_LOOS 0x60000000 /* Start of OS-specific */
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
#define PT_HISUNW 0x6fffffff
#define PT_HIOS 0x6fffffff /* End of OS-specific */
#define PT_LOPROC 0x70000000 /* Start of processor-specific */
#define PT_HIPROC 0x7fffffff /* End of processor-specific */
/* Legal values for p_flags (segment flags). */
#define PF_X (1 << 0) /* Segment is executable */
#define PF_W (1 << 1) /* Segment is writable */
#define PF_R (1 << 2) /* Segment is readable */
#define PF_MASKOS 0x0ff00000 /* OS-specific */
#define PF_MASKPROC 0xf0000000 /* Processor-specific */
/* Legal values for note segment descriptor types for core files. */
#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
#define NT_PRFPREG 2 /* Contains copy of fpregset
struct. */
#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
#define NT_PRXREG 4 /* Contains copy of prxregset struct */
#define NT_TASKSTRUCT 4 /* Contains copy of task structure */
#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
#define NT_AUXV 6 /* Contains copy of auxv array */
#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
#define NT_ASRS 8 /* Contains copy of asrset struct */
#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
#define NT_PSINFO 13 /* Contains copy of psinfo struct */
#define NT_PRCRED 14 /* Contains copy of prcred struct */
#define NT_UTSNAME 15 /* Contains copy of utsname struct */
#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */
#define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t,
size might increase */
#define NT_FILE 0x46494c45 /* Contains information about mapped
files */
#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
#define NT_PPC_TAR 0x103 /* Target Address Register */
#define NT_PPC_PPR 0x104 /* Program Priority Register */
#define NT_PPC_DSCR 0x105 /* Data Stream Control Register */
#define NT_PPC_EBB 0x106 /* Event Based Branch Registers */
#define NT_PPC_PMU 0x107 /* Performance Monitor Registers */
#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address
Register */
#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority
Register */
#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control
Register */
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys
registers. */
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
#define NT_S390_TIMER 0x301 /* s390 timer register */
#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
#define NT_S390_CTRS 0x304 /* s390 control registers */
#define NT_S390_PREFIX 0x305 /* s390 prefix register */
#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15
upper half. */
#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31. */
#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers. */
#define NT_S390_GS_BC 0x30c /* s390 guarded storage
broadcast control block. */
#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */
#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
#define NT_ARM_TLS 0x401 /* ARM TLS register */
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension
registers */
/* Legal values for the note segment descriptor types for object files. */
#define NT_VERSION 1 /* Contains a version string. */
/* Dynamic section entry. */
typedef struct
{
Elf32_Sword d_tag; /* Dynamic entry type */
union
{
Elf32_Word d_val; /* Integer value */
Elf32_Addr d_ptr; /* Address value */
} d_un;
} Elf32_Dyn;
typedef struct
{
Elf64_Sxword d_tag; /* Dynamic entry type */
union
{
Elf64_Xword d_val; /* Integer value */
Elf64_Addr d_ptr; /* Address value */
} d_un;
} Elf64_Dyn;
/* Legal values for d_tag (dynamic entry type). */
#define DT_NULL 0 /* Marks end of dynamic section */
#define DT_NEEDED 1 /* Name of needed library */
#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
#define DT_PLTGOT 3 /* Processor defined value */
#define DT_HASH 4 /* Address of symbol hash table */
#define DT_STRTAB 5 /* Address of string table */
#define DT_SYMTAB 6 /* Address of symbol table */
#define DT_RELA 7 /* Address of Rela relocs */
#define DT_RELASZ 8 /* Total size of Rela relocs */
#define DT_RELAENT 9 /* Size of one Rela reloc */
#define DT_STRSZ 10 /* Size of string table */
#define DT_SYMENT 11 /* Size of one symbol table entry */
#define DT_INIT 12 /* Address of init function */
#define DT_FINI 13 /* Address of termination function */
#define DT_SONAME 14 /* Name of shared object */
#define DT_RPATH 15 /* Library search path (deprecated) */
#define DT_SYMBOLIC 16 /* Start symbol search here */
#define DT_REL 17 /* Address of Rel relocs */
#define DT_RELSZ 18 /* Total size of Rel relocs */
#define DT_RELENT 19 /* Size of one Rel reloc */
#define DT_PLTREL 20 /* Type of reloc in PLT */
#define DT_DEBUG 21 /* For debugging; unspecified */
#define DT_TEXTREL 22 /* Reloc might modify .text */
#define DT_JMPREL 23 /* Address of PLT relocs */
#define DT_BIND_NOW 24 /* Process relocations of object */
#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
#define DT_RUNPATH 29 /* Library search path */
#define DT_FLAGS 30 /* Flags for the object being loaded */
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
#define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */
#define DT_NUM 35 /* Number used */
#define DT_LOOS 0x6000000d /* Start of OS-specific */
#define DT_HIOS 0x6ffff000 /* End of OS-specific */
#define DT_LOPROC 0x70000000 /* Start of processor-specific */
#define DT_HIPROC 0x7fffffff /* End of processor-specific */
#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
approach. */
#define DT_VALRNGLO 0x6ffffd00
#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
#define DT_CHECKSUM 0x6ffffdf8
#define DT_PLTPADSZ 0x6ffffdf9
#define DT_MOVEENT 0x6ffffdfa
#define DT_MOVESZ 0x6ffffdfb
#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
the following DT_* entry. */
#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
#define DT_VALRNGHI 0x6ffffdff
#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */
#define DT_VALNUM 12
/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
If any adjustment is made to the ELF object after it has been
built these entries will need to be adjusted. */
#define DT_ADDRRNGLO 0x6ffffe00
#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */
#define DT_TLSDESC_PLT 0x6ffffef6
#define DT_TLSDESC_GOT 0x6ffffef7
#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
#define DT_CONFIG 0x6ffffefa /* Configuration information. */
#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */
#define DT_AUDIT 0x6ffffefc /* Object auditing. */
#define DT_PLTPAD 0x6ffffefd /* PLT padding. */
#define DT_MOVETAB 0x6ffffefe /* Move table. */
#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */
#define DT_ADDRRNGHI 0x6ffffeff
#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */
#define DT_ADDRNUM 11
/* The versioning entry types. The next are defined as part of the
GNU extension. */
#define DT_VERSYM 0x6ffffff0
#define DT_RELACOUNT 0x6ffffff9
#define DT_RELCOUNT 0x6ffffffa
/* These were chosen by Sun. */
#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
#define DT_VERDEF 0x6ffffffc /* Address of version definition
table */
#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
#define DT_VERNEED 0x6ffffffe /* Address of table with needed
versions */
#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
#define DT_VERSIONTAGNUM 16
/* Sun added these machine-independent extensions in the "processor-specific"
range. Be compatible. */
#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
#define DT_FILTER 0x7fffffff /* Shared object to get values from */
#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
#define DT_EXTRANUM 3
/* Values of `d_un.d_val' in the DT_FLAGS entry. */
#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */
#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */
#define DF_TEXTREL 0x00000004 /* Object contains text relocations */
#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
entry in the dynamic section. */
#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */
#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */
#define DF_1_TRANS 0x00000200
#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */
#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */
#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */
#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/
#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
#define DF_1_NODIRECT 0x00020000 /* Object has no-direct binding. */
#define DF_1_IGNMULDEF 0x00040000
#define DF_1_NOKSYMS 0x00080000
#define DF_1_NOHDR 0x00100000
#define DF_1_EDITED 0x00200000 /* Object is modified after built. */
#define DF_1_NORELOC 0x00400000
#define DF_1_SYMINTPOSE 0x00800000 /* Object has individual interposers. */
#define DF_1_GLOBAUDIT 0x01000000 /* Global auditing required. */
#define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */
#define DF_1_STUB 0x04000000
#define DF_1_PIE 0x08000000
/* Flags for the feature selection in DT_FEATURE_1. */
#define DTF_1_PARINIT 0x00000001
#define DTF_1_CONFEXP 0x00000002
/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not
generally available. */
/* Version definition sections. */
typedef struct
{
Elf32_Half vd_version; /* Version revision */
Elf32_Half vd_flags; /* Version information */
Elf32_Half vd_ndx; /* Version Index */
Elf32_Half vd_cnt; /* Number of associated aux entries */
Elf32_Word vd_hash; /* Version name hash value */
Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
Elf32_Word vd_next; /* Offset in bytes to next verdef
entry */
} Elf32_Verdef;
typedef struct
{
Elf64_Half vd_version; /* Version revision */
Elf64_Half vd_flags; /* Version information */
Elf64_Half vd_ndx; /* Version Index */
Elf64_Half vd_cnt; /* Number of associated aux entries */
Elf64_Word vd_hash; /* Version name hash value */
Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
Elf64_Word vd_next; /* Offset in bytes to next verdef
entry */
} Elf64_Verdef;
/* Legal values for vd_version (version revision). */
#define VER_DEF_NONE 0 /* No version */
#define VER_DEF_CURRENT 1 /* Current version */
#define VER_DEF_NUM 2 /* Given version number */
/* Legal values for vd_flags (version information flags). */
#define VER_FLG_BASE 0x1 /* Version definition of file itself */
#define VER_FLG_WEAK 0x2 /* Weak version identifier. Also
used by vna_flags below. */
/* Versym symbol index values. */
#define VER_NDX_LOCAL 0 /* Symbol is local. */
#define VER_NDX_GLOBAL 1 /* Symbol is global. */
#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
/* Auxialiary version information. */
typedef struct
{
Elf32_Word vda_name; /* Version or dependency names */
Elf32_Word vda_next; /* Offset in bytes to next verdaux
entry */
} Elf32_Verdaux;
typedef struct
{
Elf64_Word vda_name; /* Version or dependency names */
Elf64_Word vda_next; /* Offset in bytes to next verdaux
entry */
} Elf64_Verdaux;
/* Version dependency section. */
typedef struct
{
Elf32_Half vn_version; /* Version of structure */
Elf32_Half vn_cnt; /* Number of associated aux entries */
Elf32_Word vn_file; /* Offset of filename for this
dependency */
Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
Elf32_Word vn_next; /* Offset in bytes to next verneed
entry */
} Elf32_Verneed;
typedef struct
{
Elf64_Half vn_version; /* Version of structure */
Elf64_Half vn_cnt; /* Number of associated aux entries */
Elf64_Word vn_file; /* Offset of filename for this
dependency */
Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
Elf64_Word vn_next; /* Offset in bytes to next verneed
entry */
} Elf64_Verneed;
/* Legal values for vn_version (version revision). */
#define VER_NEED_NONE 0 /* No version */
#define VER_NEED_CURRENT 1 /* Current version */
#define VER_NEED_NUM 2 /* Given version number */
/* Auxiliary needed version information. */
typedef struct
{
Elf32_Word vna_hash; /* Hash value of dependency name */
Elf32_Half vna_flags; /* Dependency specific information */
Elf32_Half vna_other; /* Unused */
Elf32_Word vna_name; /* Dependency name string offset */
Elf32_Word vna_next; /* Offset in bytes to next vernaux
entry */
} Elf32_Vernaux;
typedef struct
{
Elf64_Word vna_hash; /* Hash value of dependency name */
Elf64_Half vna_flags; /* Dependency specific information */
Elf64_Half vna_other; /* Unused */
Elf64_Word vna_name; /* Dependency name string offset */
Elf64_Word vna_next; /* Offset in bytes to next vernaux
entry */
} Elf64_Vernaux;
/* Auxiliary vector. */
/* This vector is normally only used by the program interpreter. The
usual definition in an ABI supplement uses the name auxv_t. The
vector is not usually defined in a standard <elf.h> file, but it
can't hurt. We rename it to avoid conflicts. The sizes of these
types are an arrangement between the exec server and the program
interpreter, so we don't fully specify them here. */
typedef struct
{
uint32_t a_type; /* Entry type */
union
{
uint32_t a_val; /* Integer value */
/* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
} a_un;
} Elf32_auxv_t;
typedef struct
{
uint64_t a_type; /* Entry type */
union
{
uint64_t a_val; /* Integer value */
/* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
} a_un;
} Elf64_auxv_t;
/* Legal values for a_type (entry type). */
#define AT_NULL 0 /* End of vector */
#define AT_IGNORE 1 /* Entry should be ignored */
#define AT_EXECFD 2 /* File descriptor of program */
#define AT_PHDR 3 /* Program headers for program */
#define AT_PHENT 4 /* Size of program header entry */
#define AT_PHNUM 5 /* Number of program headers */
#define AT_PAGESZ 6 /* System page size */
#define AT_BASE 7 /* Base address of interpreter */
#define AT_FLAGS 8 /* Flags */
#define AT_ENTRY 9 /* Entry point of program */
#define AT_NOTELF 10 /* Program is not ELF */
#define AT_UID 11 /* Real uid */
#define AT_EUID 12 /* Effective uid */
#define AT_GID 13 /* Real gid */
#define AT_EGID 14 /* Effective gid */
#define AT_CLKTCK 17 /* Frequency of times() */
/* Some more special a_type values describing the hardware. */
#define AT_PLATFORM 15 /* String identifying platform. */
#define AT_HWCAP 16 /* Machine-dependent hints about
processor capabilities. */
/* This entry gives some information about the FPU initialization
performed by the kernel. */
#define AT_FPUCW 18 /* Used FPU control word. */
/* Cache block sizes. */
#define AT_DCACHEBSIZE 19 /* Data cache block size. */
#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */
#define AT_UCACHEBSIZE 21 /* Unified cache block size. */
/* A special ignored value for PPC, used by the kernel to control the
interpretation of the AUXV. Must be > 16. */
#define AT_IGNOREPPC 22 /* Entry should be ignored. */
#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/
#define AT_RANDOM 25 /* Address of 16 random bytes. */
#define AT_HWCAP2 26 /* More machine-dependent hints about
processor capabilities. */
#define AT_EXECFN 31 /* Filename of executable. */
/* Pointer to the global system page used for system calls and other
nice things. */
#define AT_SYSINFO 32
#define AT_SYSINFO_EHDR 33
/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
log2 of line size; mask those to get cache size. */
#define AT_L1I_CACHESHAPE 34
#define AT_L1D_CACHESHAPE 35
#define AT_L2_CACHESHAPE 36
#define AT_L3_CACHESHAPE 37
/* Shapes of the caches, with more room to describe them.
*GEOMETRY are comprised of cache line size in bytes in the bottom 16 bits
and the cache associativity in the next 16 bits. */
#define AT_L1I_CACHESIZE 40
#define AT_L1I_CACHEGEOMETRY 41
#define AT_L1D_CACHESIZE 42
#define AT_L1D_CACHEGEOMETRY 43
#define AT_L2_CACHESIZE 44
#define AT_L2_CACHEGEOMETRY 45
#define AT_L3_CACHESIZE 46
#define AT_L3_CACHEGEOMETRY 47
/* Note section contents. Each entry in the note section begins with
a header of a fixed form. */
typedef struct
{
Elf32_Word n_namesz; /* Length of the note's name. */
Elf32_Word n_descsz; /* Length of the note's descriptor. */
Elf32_Word n_type; /* Type of the note. */
} Elf32_Nhdr;
typedef struct
{
Elf64_Word n_namesz; /* Length of the note's name. */
Elf64_Word n_descsz; /* Length of the note's descriptor. */
Elf64_Word n_type; /* Type of the note. */
} Elf64_Nhdr;
/* Known names of notes. */
/* Solaris entries in the note section have this name. */
#define ELF_NOTE_SOLARIS "SUNW Solaris"
/* Note entries for GNU systems have this name. */
#define ELF_NOTE_GNU "GNU"
/* Defined types of notes for Solaris. */
/* Value of descriptor (one word) is desired pagesize for the binary. */
#define ELF_NOTE_PAGESIZE_HINT 1
/* Defined note types for GNU systems. */
/* ABI information. The descriptor consists of words:
word 0: OS descriptor
word 1: major version of the ABI
word 2: minor version of the ABI
word 3: subminor version of the ABI
*/
#define NT_GNU_ABI_TAG 1
#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */
/* Known OSes. These values can appear in word 0 of an
NT_GNU_ABI_TAG note section entry. */
#define ELF_NOTE_OS_LINUX 0
#define ELF_NOTE_OS_GNU 1
#define ELF_NOTE_OS_SOLARIS2 2
#define ELF_NOTE_OS_FREEBSD 3
/* Synthetic hwcap information. The descriptor begins with two words:
word 0: number of entries
word 1: bitmask of enabled entries
Then follow variable-length entries, one byte followed by a
'\0'-terminated hwcap name string. The byte gives the bit
number to test if enabled, (1U << bit) & bitmask. */
#define NT_GNU_HWCAP 2
/* Build ID bits as generated by ld --build-id.
The descriptor consists of any nonzero number of bytes. */
#define NT_GNU_BUILD_ID 3
/* Version note generated by GNU gold containing a version string. */
#define NT_GNU_GOLD_VERSION 4
/* Program property. */
#define NT_GNU_PROPERTY_TYPE_0 5
/* Note section name of program property. */
#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"
/* Values used in GNU .note.gnu.property notes (NT_GNU_PROPERTY_TYPE_0). */
/* Stack size. */
#define GNU_PROPERTY_STACK_SIZE 1
/* No copy relocation on protected data symbol. */
#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
/* Processor-specific semantics, lo */
#define GNU_PROPERTY_LOPROC 0xc0000000
/* Processor-specific semantics, hi */
#define GNU_PROPERTY_HIPROC 0xdfffffff
/* Application-specific semantics, lo */
#define GNU_PROPERTY_LOUSER 0xe0000000
/* Application-specific semantics, hi */
#define GNU_PROPERTY_HIUSER 0xffffffff
/* The x86 instruction sets indicated by the corresponding bits are
used in program. Their support in the hardware is optional. */
#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
/* The x86 instruction sets indicated by the corresponding bits are
used in program and they must be supported by the hardware. */
#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
/* X86 processor-specific features used in program. */
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
#define GNU_PROPERTY_X86_ISA_1_486 (1U << 0)
#define GNU_PROPERTY_X86_ISA_1_586 (1U << 1)
#define GNU_PROPERTY_X86_ISA_1_686 (1U << 2)
#define GNU_PROPERTY_X86_ISA_1_SSE (1U << 3)
#define GNU_PROPERTY_X86_ISA_1_SSE2 (1U << 4)
#define GNU_PROPERTY_X86_ISA_1_SSE3 (1U << 5)
#define GNU_PROPERTY_X86_ISA_1_SSSE3 (1U << 6)
#define GNU_PROPERTY_X86_ISA_1_SSE4_1 (1U << 7)
#define GNU_PROPERTY_X86_ISA_1_SSE4_2 (1U << 8)
#define GNU_PROPERTY_X86_ISA_1_AVX (1U << 9)
#define GNU_PROPERTY_X86_ISA_1_AVX2 (1U << 10)
#define GNU_PROPERTY_X86_ISA_1_AVX512F (1U << 11)
#define GNU_PROPERTY_X86_ISA_1_AVX512CD (1U << 12)
#define GNU_PROPERTY_X86_ISA_1_AVX512ER (1U << 13)
#define GNU_PROPERTY_X86_ISA_1_AVX512PF (1U << 14)
#define GNU_PROPERTY_X86_ISA_1_AVX512VL (1U << 15)
#define GNU_PROPERTY_X86_ISA_1_AVX512DQ (1U << 16)
#define GNU_PROPERTY_X86_ISA_1_AVX512BW (1U << 17)
/* This indicates that all executable sections are compatible with
IBT. */
#define GNU_PROPERTY_X86_FEATURE_1_IBT (1U << 0)
/* This indicates that all executable sections are compatible with
SHSTK. */
#define GNU_PROPERTY_X86_FEATURE_1_SHSTK (1U << 1)
/* Move records. */
typedef struct
{
Elf32_Xword m_value; /* Symbol value. */
Elf32_Word m_info; /* Size and index. */
Elf32_Word m_poffset; /* Symbol offset. */
Elf32_Half m_repeat; /* Repeat count. */
Elf32_Half m_stride; /* Stride info. */
} Elf32_Move;
typedef struct
{
Elf64_Xword m_value; /* Symbol value. */
Elf64_Xword m_info; /* Size and index. */
Elf64_Xword m_poffset; /* Symbol offset. */
Elf64_Half m_repeat; /* Repeat count. */
Elf64_Half m_stride; /* Stride info. */
} Elf64_Move;
/* Macro to construct move records. */
#define ELF32_M_SYM(info) ((info) >> 8)
#define ELF32_M_SIZE(info) ((unsigned char) (info))
#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
#define ELF64_M_SYM(info) ELF32_M_SYM (info)
#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
/* Motorola 68k specific definitions. */
/* Values for Elf32_Ehdr.e_flags. */
#define EF_CPU32 0x00810000
/* m68k relocs. */
#define R_68K_NONE 0 /* No reloc */
#define R_68K_32 1 /* Direct 32 bit */
#define R_68K_16 2 /* Direct 16 bit */
#define R_68K_8 3 /* Direct 8 bit */
#define R_68K_PC32 4 /* PC relative 32 bit */
#define R_68K_PC16 5 /* PC relative 16 bit */
#define R_68K_PC8 6 /* PC relative 8 bit */
#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
#define R_68K_GOT32O 10 /* 32 bit GOT offset */
#define R_68K_GOT16O 11 /* 16 bit GOT offset */
#define R_68K_GOT8O 12 /* 8 bit GOT offset */
#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
#define R_68K_PLT32O 16 /* 32 bit PLT offset */
#define R_68K_PLT16O 17 /* 16 bit PLT offset */
#define R_68K_PLT8O 18 /* 8 bit PLT offset */
#define R_68K_COPY 19 /* Copy symbol at runtime */
#define R_68K_GLOB_DAT 20 /* Create GOT entry */
#define R_68K_JMP_SLOT 21 /* Create PLT entry */
#define R_68K_RELATIVE 22 /* Adjust by program base */
#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */
#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */
#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */
#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */
#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */
#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */
#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */
#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */
#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */
#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */
#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */
#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */
#define R_68K_TLS_LE32 37 /* 32 bit offset relative to
static TLS block */
#define R_68K_TLS_LE16 38 /* 16 bit offset relative to
static TLS block */
#define R_68K_TLS_LE8 39 /* 8 bit offset relative to
static TLS block */
#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */
#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */
#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */
/* Keep this the last entry. */
#define R_68K_NUM 43
/* Intel 80386 specific definitions. */
/* i386 relocs. */
#define R_386_NONE 0 /* No reloc */
#define R_386_32 1 /* Direct 32 bit */
#define R_386_PC32 2 /* PC relative 32 bit */
#define R_386_GOT32 3 /* 32 bit GOT entry */
#define R_386_PLT32 4 /* 32 bit PLT address */
#define R_386_COPY 5 /* Copy symbol at runtime */
#define R_386_GLOB_DAT 6 /* Create GOT entry */
#define R_386_JMP_SLOT 7 /* Create PLT entry */
#define R_386_RELATIVE 8 /* Adjust by program base */
#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
#define R_386_32PLT 11
#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */
#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS
block offset */
#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block
offset */
#define R_386_TLS_LE 17 /* Offset relative to static TLS
block */
#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of
general dynamic thread local data */
#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of
local dynamic thread local data
in LE code */
#define R_386_16 20
#define R_386_PC16 21
#define R_386_8 22
#define R_386_PC8 23
#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic
thread local data */
#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */
#define R_386_TLS_GD_CALL 26 /* Relocation for call to
__tls_get_addr() */
#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */
#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic
thread local data in LE code */
#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */
#define R_386_TLS_LDM_CALL 30 /* Relocation for call to
__tls_get_addr() in LDM code */
#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */
#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */
#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS
block offset */
#define R_386_TLS_LE_32 34 /* Negated offset relative to static
TLS block */
#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */
#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */
#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */
#define R_386_SIZE32 38 /* 32-bit symbol size */
#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */
#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS
descriptor for
relaxation. */
#define R_386_TLS_DESC 41 /* TLS descriptor containing
pointer to code and to
argument, returning the TLS
offset for the symbol. */
#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */
#define R_386_GOT32X 43 /* Load from 32 bit GOT entry,
relaxable. */
/* Keep this the last entry. */
#define R_386_NUM 44
/* SUN SPARC specific definitions. */
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */
/* Values for Elf64_Ehdr.e_flags. */
#define EF_SPARCV9_MM 3
#define EF_SPARCV9_TSO 0
#define EF_SPARCV9_PSO 1
#define EF_SPARCV9_RMO 2
#define EF_SPARC_LEDATA 0x800000 /* little endian data */
#define EF_SPARC_EXT_MASK 0xFFFF00
#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */
#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */
#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */
/* SPARC relocs. */
#define R_SPARC_NONE 0 /* No reloc */
#define R_SPARC_8 1 /* Direct 8 bit */
#define R_SPARC_16 2 /* Direct 16 bit */
#define R_SPARC_32 3 /* Direct 32 bit */
#define R_SPARC_DISP8 4 /* PC relative 8 bit */
#define R_SPARC_DISP16 5 /* PC relative 16 bit */
#define R_SPARC_DISP32 6 /* PC relative 32 bit */
#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
#define R_SPARC_HI22 9 /* High 22 bit */
#define R_SPARC_22 10 /* Direct 22 bit */
#define R_SPARC_13 11 /* Direct 13 bit */
#define R_SPARC_LO10 12 /* Truncated 10 bit */
#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
#define R_SPARC_COPY 19 /* Copy symbol at runtime */
#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
#define R_SPARC_RELATIVE 22 /* Adjust by program base */
#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
/* Additional Sparc64 relocs. */
#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
#define R_SPARC_10 30 /* Direct 10 bit */
#define R_SPARC_11 31 /* Direct 11 bit */
#define R_SPARC_64 32 /* Direct 64 bit */
#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */
#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */
#define R_SPARC_7 43 /* Direct 7 bit */
#define R_SPARC_5 44 /* Direct 5 bit */
#define R_SPARC_6 45 /* Direct 6 bit */
#define R_SPARC_DISP64 46 /* PC relative 64 bit */
#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
#define R_SPARC_HIX22 48 /* High 22 bit complemented */
#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
#define R_SPARC_REGISTER 53 /* Global register usage */
#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
#define R_SPARC_TLS_GD_HI22 56
#define R_SPARC_TLS_GD_LO10 57
#define R_SPARC_TLS_GD_ADD 58
#define R_SPARC_TLS_GD_CALL 59
#define R_SPARC_TLS_LDM_HI22 60
#define R_SPARC_TLS_LDM_LO10 61
#define R_SPARC_TLS_LDM_ADD 62
#define R_SPARC_TLS_LDM_CALL 63
#define R_SPARC_TLS_LDO_HIX22 64
#define R_SPARC_TLS_LDO_LOX10 65
#define R_SPARC_TLS_LDO_ADD 66
#define R_SPARC_TLS_IE_HI22 67
#define R_SPARC_TLS_IE_LO10 68
#define R_SPARC_TLS_IE_LD 69
#define R_SPARC_TLS_IE_LDX 70
#define R_SPARC_TLS_IE_ADD 71
#define R_SPARC_TLS_LE_HIX22 72
#define R_SPARC_TLS_LE_LOX10 73
#define R_SPARC_TLS_DTPMOD32 74
#define R_SPARC_TLS_DTPMOD64 75
#define R_SPARC_TLS_DTPOFF32 76
#define R_SPARC_TLS_DTPOFF64 77
#define R_SPARC_TLS_TPOFF32 78
#define R_SPARC_TLS_TPOFF64 79
#define R_SPARC_GOTDATA_HIX22 80
#define R_SPARC_GOTDATA_LOX10 81
#define R_SPARC_GOTDATA_OP_HIX22 82
#define R_SPARC_GOTDATA_OP_LOX10 83
#define R_SPARC_GOTDATA_OP 84
#define R_SPARC_H34 85
#define R_SPARC_SIZE32 86
#define R_SPARC_SIZE64 87
#define R_SPARC_WDISP10 88
#define R_SPARC_JMP_IREL 248
#define R_SPARC_IRELATIVE 249
#define R_SPARC_GNU_VTINHERIT 250
#define R_SPARC_GNU_VTENTRY 251
#define R_SPARC_REV32 252
/* Keep this the last entry. */
#define R_SPARC_NUM 253
/* For Sparc64, legal values for d_tag of Elf64_Dyn. */
#define DT_SPARC_REGISTER 0x70000001
#define DT_SPARC_NUM 2
/* MIPS R3000 specific definitions. */
/* Legal values for e_flags field of Elf32_Ehdr. */
#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used. */
#define EF_MIPS_PIC 2 /* Contains PIC code. */
#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence. */
#define EF_MIPS_XGOT 8
#define EF_MIPS_64BIT_WHIRL 16
#define EF_MIPS_ABI2 32
#define EF_MIPS_ABI_ON32 64
#define EF_MIPS_FP64 512 /* Uses FP64 (12 callee-saved). */
#define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */
#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */
/* Legal values for MIPS architecture level. */
#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */
#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */
/* The following are unofficial names and should not be used. */
#define E_MIPS_ARCH_1 EF_MIPS_ARCH_1
#define E_MIPS_ARCH_2 EF_MIPS_ARCH_2
#define E_MIPS_ARCH_3 EF_MIPS_ARCH_3
#define E_MIPS_ARCH_4 EF_MIPS_ARCH_4
#define E_MIPS_ARCH_5 EF_MIPS_ARCH_5
#define E_MIPS_ARCH_32 EF_MIPS_ARCH_32
#define E_MIPS_ARCH_64 EF_MIPS_ARCH_64
/* Special section indices. */
#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols. */
#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols. */
#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols. */
/* Legal values for sh_type field of Elf32_Shdr. */
#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link. */
#define SHT_MIPS_MSYM 0x70000001
#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols. */
#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes. */
#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging info. */
#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information. */
#define SHT_MIPS_PACKAGE 0x70000007
#define SHT_MIPS_PACKSYM 0x70000008
#define SHT_MIPS_RELD 0x70000009
#define SHT_MIPS_IFACE 0x7000000b
#define SHT_MIPS_CONTENT 0x7000000c
#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
#define SHT_MIPS_SHDR 0x70000010
#define SHT_MIPS_FDESC 0x70000011
#define SHT_MIPS_EXTSYM 0x70000012
#define SHT_MIPS_DENSE 0x70000013
#define SHT_MIPS_PDESC 0x70000014
#define SHT_MIPS_LOCSYM 0x70000015
#define SHT_MIPS_AUXSYM 0x70000016
#define SHT_MIPS_OPTSYM 0x70000017
#define SHT_MIPS_LOCSTR 0x70000018
#define SHT_MIPS_LINE 0x70000019
#define SHT_MIPS_RFDESC 0x7000001a
#define SHT_MIPS_DELTASYM 0x7000001b
#define SHT_MIPS_DELTAINST 0x7000001c
#define SHT_MIPS_DELTACLASS 0x7000001d
#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
#define SHT_MIPS_DELTADECL 0x7000001f
#define SHT_MIPS_SYMBOL_LIB 0x70000020
#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
#define SHT_MIPS_TRANSLATE 0x70000022
#define SHT_MIPS_PIXIE 0x70000023
#define SHT_MIPS_XLATE 0x70000024
#define SHT_MIPS_XLATE_DEBUG 0x70000025
#define SHT_MIPS_WHIRL 0x70000026
#define SHT_MIPS_EH_REGION 0x70000027
#define SHT_MIPS_XLATE_OLD 0x70000028
#define SHT_MIPS_PDR_EXCEPTION 0x70000029
#define SHT_MIPS_XHASH 0x7000002b
/* Legal values for sh_flags field of Elf32_Shdr. */
#define SHF_MIPS_GPREL 0x10000000 /* Must be in global data area. */
#define SHF_MIPS_MERGE 0x20000000
#define SHF_MIPS_ADDR 0x40000000
#define SHF_MIPS_STRINGS 0x80000000
#define SHF_MIPS_NOSTRIP 0x08000000
#define SHF_MIPS_LOCAL 0x04000000
#define SHF_MIPS_NAMES 0x02000000
#define SHF_MIPS_NODUPE 0x01000000
/* Symbol tables. */
/* MIPS specific values for `st_other'. */
#define STO_MIPS_DEFAULT 0x0
#define STO_MIPS_INTERNAL 0x1
#define STO_MIPS_HIDDEN 0x2
#define STO_MIPS_PROTECTED 0x3
#define STO_MIPS_PLT 0x8
#define STO_MIPS_SC_ALIGN_UNUSED 0xff
/* MIPS specific values for `st_info'. */
#define STB_MIPS_SPLIT_COMMON 13
/* Entries found in sections of type SHT_MIPS_GPTAB. */
typedef union
{
struct
{
Elf32_Word gt_current_g_value; /* -G value used for compilation. */
Elf32_Word gt_unused; /* Not used. */
} gt_header; /* First entry in section. */
struct
{
Elf32_Word gt_g_value; /* If this value were used for -G. */
Elf32_Word gt_bytes; /* This many bytes would be used. */
} gt_entry; /* Subsequent entries in section. */
} Elf32_gptab;
/* Entry found in sections of type SHT_MIPS_REGINFO. */
typedef struct
{
Elf32_Word ri_gprmask; /* General registers used. */
Elf32_Word ri_cprmask[4]; /* Coprocessor registers used. */
Elf32_Sword ri_gp_value; /* $gp register value. */
} Elf32_RegInfo;
/* Entries found in sections of type SHT_MIPS_OPTIONS. */
typedef struct
{
unsigned char kind; /* Determines interpretation of the
variable part of descriptor. */
unsigned char size; /* Size of descriptor, including header. */
Elf32_Section section; /* Section header index of section affected,
0 for global options. */
Elf32_Word info; /* Kind-specific information. */
} Elf_Options;
/* Values for `kind' field in Elf_Options. */
#define ODK_NULL 0 /* Undefined. */
#define ODK_REGINFO 1 /* Register usage information. */
#define ODK_EXCEPTIONS 2 /* Exception processing options. */
#define ODK_PAD 3 /* Section padding options. */
#define ODK_HWPATCH 4 /* Hardware workarounds performed */
#define ODK_FILL 5 /* record the fill value used by the linker. */
#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */
#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
#define OEX_SMM 0x20000 /* Force sequential memory mode? */
#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
#define OEX_PRECISEFP OEX_FPDBUG
#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
#define OEX_FPU_INVAL 0x10
#define OEX_FPU_DIV0 0x08
#define OEX_FPU_OFLO 0x04
#define OEX_FPU_UFLO 0x02
#define OEX_FPU_INEX 0x01
/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */
#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
#define OPAD_PREFIX 0x1
#define OPAD_POSTFIX 0x2
#define OPAD_SYMBOL 0x4
/* Entry found in `.options' section. */
typedef struct
{
Elf32_Word hwp_flags1; /* Extra flags. */
Elf32_Word hwp_flags2; /* Extra flags. */
} Elf_Options_Hw;
/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */
#define OHWA0_R4KEOP_CHECKED 0x00000001
#define OHWA1_R4KEOP_CLEAN 0x00000002
/* MIPS relocs. */
#define R_MIPS_NONE 0 /* No reloc */
#define R_MIPS_16 1 /* Direct 16 bit */
#define R_MIPS_32 2 /* Direct 32 bit */
#define R_MIPS_REL32 3 /* PC relative 32 bit */
#define R_MIPS_26 4 /* Direct 26 bit shifted */
#define R_MIPS_HI16 5 /* High 16 bit */
#define R_MIPS_LO16 6 /* Low 16 bit */
#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
#define R_MIPS_PC16 10 /* PC relative 16 bit */
#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
#define R_MIPS_SHIFT5 16
#define R_MIPS_SHIFT6 17
#define R_MIPS_64 18
#define R_MIPS_GOT_DISP 19
#define R_MIPS_GOT_PAGE 20
#define R_MIPS_GOT_OFST 21
#define R_MIPS_GOT_HI16 22
#define R_MIPS_GOT_LO16 23
#define R_MIPS_SUB 24
#define R_MIPS_INSERT_A 25
#define R_MIPS_INSERT_B 26
#define R_MIPS_DELETE 27
#define R_MIPS_HIGHER 28
#define R_MIPS_HIGHEST 29
#define R_MIPS_CALL_HI16 30
#define R_MIPS_CALL_LO16 31
#define R_MIPS_SCN_DISP 32
#define R_MIPS_REL16 33
#define R_MIPS_ADD_IMMEDIATE 34
#define R_MIPS_PJUMP 35
#define R_MIPS_RELGOT 36
#define R_MIPS_JALR 37
#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
#define R_MIPS_GLOB_DAT 51
#define R_MIPS_COPY 126
#define R_MIPS_JUMP_SLOT 127
/* Keep this the last entry. */
#define R_MIPS_NUM 128
/* Legal values for p_type field of Elf32_Phdr. */
#define PT_MIPS_REGINFO 0x70000000 /* Register usage information. */
#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
#define PT_MIPS_OPTIONS 0x70000002
#define PT_MIPS_ABIFLAGS 0x70000003 /* FP mode requirement. */
/* Special program header types. */
#define PF_MIPS_LOCAL 0x10000000
/* Legal values for d_tag field of Elf32_Dyn. */
#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
#define DT_MIPS_FLAGS 0x70000005 /* Flags */
#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
#define DT_MIPS_MSYM 0x70000007
#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in
DT_MIPS_DELTA_CLASS. */
#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
DT_MIPS_DELTA_INSTANCE. */
#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
DT_MIPS_DELTA_RELOC. */
#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta
relocations refer to. */
#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
DT_MIPS_DELTA_SYM. */
#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
class declaration. */
#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
DT_MIPS_DELTA_CLASSSYM. */
#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
#define DT_MIPS_PIXIE_INIT 0x70000023
#define DT_MIPS_SYMBOL_LIB 0x70000024
#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
#define DT_MIPS_LOCAL_GOTIDX 0x70000026
#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
function stored in GOT. */
#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added
by rld on dlopen() calls. */
#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
/* The address of .got.plt in an executable using the new non-PIC ABI. */
#define DT_MIPS_PLTGOT 0x70000032
/* The base of the PLT in an executable using the new non-PIC ABI if that
PLT is writable. For a non-writable PLT, this is omitted or has a zero
value. */
#define DT_MIPS_RWPLT 0x70000034
/* An alternative description of the classic MIPS RLD_MAP that is usable
in a PIE as it stores a relative offset from the address of the tag
rather than an absolute address. */
#define DT_MIPS_RLD_MAP_REL 0x70000035
/* GNU-style hash table with xlat. */
#define DT_MIPS_XHASH 0x70000036
#define DT_MIPS_NUM 0x37
/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
#define RHF_NONE 0 /* No flags */
#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
#define RHF_NO_MOVE (1 << 3)
#define RHF_SGI_ONLY (1 << 4)
#define RHF_GUARANTEE_INIT (1 << 5)
#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
#define RHF_GUARANTEE_START_INIT (1 << 7)
#define RHF_PIXIE (1 << 8)
#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
#define RHF_REQUICKSTART (1 << 10)
#define RHF_REQUICKSTARTED (1 << 11)
#define RHF_CORD (1 << 12)
#define RHF_NO_UNRES_UNDEF (1 << 13)
#define RHF_RLD_ORDER_SAFE (1 << 14)
/* Entries found in sections of type SHT_MIPS_LIBLIST. */
typedef struct
{
Elf32_Word l_name; /* Name (string table index) */
Elf32_Word l_time_stamp; /* Timestamp */
Elf32_Word l_checksum; /* Checksum */
Elf32_Word l_version; /* Interface version */
Elf32_Word l_flags; /* Flags */
} Elf32_Lib;
typedef struct
{
Elf64_Word l_name; /* Name (string table index) */
Elf64_Word l_time_stamp; /* Timestamp */
Elf64_Word l_checksum; /* Checksum */
Elf64_Word l_version; /* Interface version */
Elf64_Word l_flags; /* Flags */
} Elf64_Lib;
/* Legal values for l_flags. */
#define LL_NONE 0
#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
#define LL_REQUIRE_MINOR (1 << 2)
#define LL_EXPORTS (1 << 3)
#define LL_DELAY_LOAD (1 << 4)
#define LL_DELTA (1 << 5)
/* Entries found in sections of type SHT_MIPS_CONFLICT. */
typedef Elf32_Addr Elf32_Conflict;
typedef struct
{
/* Version of flags structure. */
Elf32_Half version;
/* The level of the ISA: 1-5, 32, 64. */
unsigned char isa_level;
/* The revision of ISA: 0 for MIPS V and below, 1-n otherwise. */
unsigned char isa_rev;
/* The size of general purpose registers. */
unsigned char gpr_size;
/* The size of co-processor 1 registers. */
unsigned char cpr1_size;
/* The size of co-processor 2 registers. */
unsigned char cpr2_size;
/* The floating-point ABI. */
unsigned char fp_abi;
/* Processor-specific extension. */
Elf32_Word isa_ext;
/* Mask of ASEs used. */
Elf32_Word ases;
/* Mask of general flags. */
Elf32_Word flags1;
Elf32_Word flags2;
} Elf_MIPS_ABIFlags_v0;
/* Values for the register size bytes of an abi flags structure. */
#define MIPS_AFL_REG_NONE 0x00 /* No registers. */
#define MIPS_AFL_REG_32 0x01 /* 32-bit registers. */
#define MIPS_AFL_REG_64 0x02 /* 64-bit registers. */
#define MIPS_AFL_REG_128 0x03 /* 128-bit registers. */
/* Masks for the ases word of an ABI flags structure. */
#define MIPS_AFL_ASE_DSP 0x00000001 /* DSP ASE. */
#define MIPS_AFL_ASE_DSPR2 0x00000002 /* DSP R2 ASE. */
#define MIPS_AFL_ASE_EVA 0x00000004 /* Enhanced VA Scheme. */
#define MIPS_AFL_ASE_MCU 0x00000008 /* MCU (MicroController) ASE. */
#define MIPS_AFL_ASE_MDMX 0x00000010 /* MDMX ASE. */
#define MIPS_AFL_ASE_MIPS3D 0x00000020 /* MIPS-3D ASE. */
#define MIPS_AFL_ASE_MT 0x00000040 /* MT ASE. */
#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 /* SmartMIPS ASE. */
#define MIPS_AFL_ASE_VIRT 0x00000100 /* VZ ASE. */
#define MIPS_AFL_ASE_MSA 0x00000200 /* MSA ASE. */
#define MIPS_AFL_ASE_MIPS16 0x00000400 /* MIPS16 ASE. */
#define MIPS_AFL_ASE_MICROMIPS 0x00000800 /* MICROMIPS ASE. */
#define MIPS_AFL_ASE_XPA 0x00001000 /* XPA ASE. */
#define MIPS_AFL_ASE_MASK 0x00001fff /* All ASEs. */
/* Values for the isa_ext word of an ABI flags structure. */
#define MIPS_AFL_EXT_XLR 1 /* RMI Xlr instruction. */
#define MIPS_AFL_EXT_OCTEON2 2 /* Cavium Networks Octeon2. */
#define MIPS_AFL_EXT_OCTEONP 3 /* Cavium Networks OcteonP. */
#define MIPS_AFL_EXT_LOONGSON_3A 4 /* Loongson 3A. */
#define MIPS_AFL_EXT_OCTEON 5 /* Cavium Networks Octeon. */
#define MIPS_AFL_EXT_5900 6 /* MIPS R5900 instruction. */
#define MIPS_AFL_EXT_4650 7 /* MIPS R4650 instruction. */
#define MIPS_AFL_EXT_4010 8 /* LSI R4010 instruction. */
#define MIPS_AFL_EXT_4100 9 /* NEC VR4100 instruction. */
#define MIPS_AFL_EXT_3900 10 /* Toshiba R3900 instruction. */
#define MIPS_AFL_EXT_10000 11 /* MIPS R10000 instruction. */
#define MIPS_AFL_EXT_SB1 12 /* Broadcom SB-1 instruction. */
#define MIPS_AFL_EXT_4111 13 /* NEC VR4111/VR4181 instruction. */
#define MIPS_AFL_EXT_4120 14 /* NEC VR4120 instruction. */
#define MIPS_AFL_EXT_5400 15 /* NEC VR5400 instruction. */
#define MIPS_AFL_EXT_5500 16 /* NEC VR5500 instruction. */
#define MIPS_AFL_EXT_LOONGSON_2E 17 /* ST Microelectronics Loongson 2E. */
#define MIPS_AFL_EXT_LOONGSON_2F 18 /* ST Microelectronics Loongson 2F. */
/* Masks for the flags1 word of an ABI flags structure. */
#define MIPS_AFL_FLAGS1_ODDSPREG 1 /* Uses odd single-precision registers. */
/* Object attribute values. */
enum
{
/* Not tagged or not using any ABIs affected by the differences. */
Val_GNU_MIPS_ABI_FP_ANY = 0,
/* Using hard-float -mdouble-float. */
Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
/* Using hard-float -msingle-float. */
Val_GNU_MIPS_ABI_FP_SINGLE = 2,
/* Using soft-float. */
Val_GNU_MIPS_ABI_FP_SOFT = 3,
/* Using -mips32r2 -mfp64. */
Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
/* Using -mfpxx. */
Val_GNU_MIPS_ABI_FP_XX = 5,
/* Using -mips32r2 -mfp64. */
Val_GNU_MIPS_ABI_FP_64 = 6,
/* Using -mips32r2 -mfp64 -mno-odd-spreg. */
Val_GNU_MIPS_ABI_FP_64A = 7,
/* Maximum allocated FP ABI value. */
Val_GNU_MIPS_ABI_FP_MAX = 7
};
/* HPPA specific definitions. */
/* Legal values for e_flags field of Elf32_Ehdr. */
#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */
#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch
prediction. */
#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
/* Defined values for `e_flags & EF_PARISC_ARCH' are: */
#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */
#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
/* Additional section indeces. */
#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
symbols in ANSI C. */
#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
/* Legal values for sh_type field of Elf32_Shdr. */
#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */
#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */
#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */
/* Legal values for sh_flags field of Elf32_Shdr. */
#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */
#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
#define STT_HP_OPAQUE (STT_LOOS + 0x1)
#define STT_HP_STUB (STT_LOOS + 0x2)
/* HPPA relocs. */
#define R_PARISC_NONE 0 /* No reloc. */
#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */
#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */
#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */
#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */
#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */
#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
#define R_PARISC_FPTR64 64 /* 64 bits function address. */
#define R_PARISC_PLABEL32 65 /* 32 bits function address. */
#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */
#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */
#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */
#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */
#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */
#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */
#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */
#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */
#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */
#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */
#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */
#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */
#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */
#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */
#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */
#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */
#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */
#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */
#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */
#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */
#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */
#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */
#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */
#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */
#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */
#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */
#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */
#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */
#define R_PARISC_LORESERVE 128
#define R_PARISC_COPY 128 /* Copy relocation. */
#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */
#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */
#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */
#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */
#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */
#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */
#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/
#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */
#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */
#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */
#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */
#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */
#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */
#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */
#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */
#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/
#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/
#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */
#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */
#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */
#define R_PARISC_GNU_VTENTRY 232
#define R_PARISC_GNU_VTINHERIT 233
#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */
#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */
#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */
#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */
#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */
#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */
#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */
#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */
#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */
#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */
#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */
#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */
#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L
#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R
#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L
#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R
#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32
#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64
#define R_PARISC_HIRESERVE 255
/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
#define PT_HP_TLS (PT_LOOS + 0x0)
#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
#define PT_HP_PARALLEL (PT_LOOS + 0x10)
#define PT_HP_FASTBIND (PT_LOOS + 0x11)
#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
#define PT_HP_STACK (PT_LOOS + 0x14)
#define PT_PARISC_ARCHEXT 0x70000000
#define PT_PARISC_UNWIND 0x70000001
/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */
#define PF_PARISC_SBP 0x08000000
#define PF_HP_PAGE_SIZE 0x00100000
#define PF_HP_FAR_SHARED 0x00200000
#define PF_HP_NEAR_SHARED 0x00400000
#define PF_HP_CODE 0x01000000
#define PF_HP_MODIFY 0x02000000
#define PF_HP_LAZYSWAP 0x04000000
#define PF_HP_SBP 0x08000000
/* Alpha specific definitions. */
/* Legal values for e_flags field of Elf64_Ehdr. */
#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
/* Legal values for sh_type field of Elf64_Shdr. */
/* These two are primerily concerned with ECOFF debugging info. */
#define SHT_ALPHA_DEBUG 0x70000001
#define SHT_ALPHA_REGINFO 0x70000002
/* Legal values for sh_flags field of Elf64_Shdr. */
#define SHF_ALPHA_GPREL 0x10000000
/* Legal values for st_other field of Elf64_Sym. */
#define STO_ALPHA_NOPV 0x80 /* No PV required. */
#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
/* Alpha relocs. */
#define R_ALPHA_NONE 0 /* No reloc */
#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
#define R_ALPHA_TLS_GD_HI 28
#define R_ALPHA_TLSGD 29
#define R_ALPHA_TLS_LDM 30
#define R_ALPHA_DTPMOD64 31
#define R_ALPHA_GOTDTPREL 32
#define R_ALPHA_DTPREL64 33
#define R_ALPHA_DTPRELHI 34
#define R_ALPHA_DTPRELLO 35
#define R_ALPHA_DTPREL16 36
#define R_ALPHA_GOTTPREL 37
#define R_ALPHA_TPREL64 38
#define R_ALPHA_TPRELHI 39
#define R_ALPHA_TPRELLO 40
#define R_ALPHA_TPREL16 41
/* Keep this the last entry. */
#define R_ALPHA_NUM 46
/* Magic values of the LITUSE relocation addend. */
#define LITUSE_ALPHA_ADDR 0
#define LITUSE_ALPHA_BASE 1
#define LITUSE_ALPHA_BYTOFF 2
#define LITUSE_ALPHA_JSR 3
#define LITUSE_ALPHA_TLS_GD 4
#define LITUSE_ALPHA_TLS_LDM 5
/* Legal values for d_tag of Elf64_Dyn. */
#define DT_ALPHA_PLTRO (DT_LOPROC + 0)
#define DT_ALPHA_NUM 1
/* PowerPC specific declarations */
/* Values for Elf32/64_Ehdr.e_flags. */
#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
/* Cygnus local bits below */
#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
flag */
/* PowerPC relocations defined by the ABIs */
#define R_PPC_NONE 0
#define R_PPC_ADDR32 1 /* 32bit absolute address */
#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
#define R_PPC_ADDR16 3 /* 16bit absolute address */
#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
#define R_PPC_ADDR14_BRTAKEN 8
#define R_PPC_ADDR14_BRNTAKEN 9
#define R_PPC_REL24 10 /* PC relative 26 bit */
#define R_PPC_REL14 11 /* PC relative 16 bit */
#define R_PPC_REL14_BRTAKEN 12
#define R_PPC_REL14_BRNTAKEN 13
#define R_PPC_GOT16 14
#define R_PPC_GOT16_LO 15
#define R_PPC_GOT16_HI 16
#define R_PPC_GOT16_HA 17
#define R_PPC_PLTREL24 18
#define R_PPC_COPY 19
#define R_PPC_GLOB_DAT 20
#define R_PPC_JMP_SLOT 21
#define R_PPC_RELATIVE 22
#define R_PPC_LOCAL24PC 23
#define R_PPC_UADDR32 24
#define R_PPC_UADDR16 25
#define R_PPC_REL32 26
#define R_PPC_PLT32 27
#define R_PPC_PLTREL32 28
#define R_PPC_PLT16_LO 29
#define R_PPC_PLT16_HI 30
#define R_PPC_PLT16_HA 31
#define R_PPC_SDAREL16 32
#define R_PPC_SECTOFF 33
#define R_PPC_SECTOFF_LO 34
#define R_PPC_SECTOFF_HI 35
#define R_PPC_SECTOFF_HA 36
/* PowerPC relocations defined for the TLS access ABI. */
#define R_PPC_TLS 67 /* none (sym+add)@tls */
#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
#define R_PPC_TLSGD 95 /* none (sym+add)@tlsgd */
#define R_PPC_TLSLD 96 /* none (sym+add)@tlsld */
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
#define R_PPC_EMB_NADDR32 101
#define R_PPC_EMB_NADDR16 102
#define R_PPC_EMB_NADDR16_LO 103
#define R_PPC_EMB_NADDR16_HI 104
#define R_PPC_EMB_NADDR16_HA 105
#define R_PPC_EMB_SDAI16 106
#define R_PPC_EMB_SDA2I16 107
#define R_PPC_EMB_SDA2REL 108
#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
#define R_PPC_EMB_MRKREF 110
#define R_PPC_EMB_RELSEC16 111
#define R_PPC_EMB_RELST_LO 112
#define R_PPC_EMB_RELST_HI 113
#define R_PPC_EMB_RELST_HA 114
#define R_PPC_EMB_BIT_FLD 115
#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
/* Diab tool relocations. */
#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
/* GNU extension to support local ifunc. */
#define R_PPC_IRELATIVE 248
/* GNU relocs used in PIC code sequences. */
#define R_PPC_REL16 249 /* half16 (sym+add-.) */
#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */
#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */
#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */
/* This is a phony reloc to handle any old fashioned TOC16 references
that may still be in object files. */
#define R_PPC_TOC16 255
/* PowerPC specific values for the Dyn d_tag field. */
#define DT_PPC_GOT (DT_LOPROC + 0)
#define DT_PPC_OPT (DT_LOPROC + 1)
#define DT_PPC_NUM 2
/* PowerPC specific values for the DT_PPC_OPT Dyn entry. */
#define PPC_OPT_TLS 1
/* PowerPC64 relocations defined by the ABIs */
#define R_PPC64_NONE R_PPC_NONE
#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */
#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */
#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */
#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */
#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */
#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */
#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */
#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
#define R_PPC64_GOT16 R_PPC_GOT16
#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
#define R_PPC64_COPY R_PPC_COPY
#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
#define R_PPC64_RELATIVE R_PPC_RELATIVE
#define R_PPC64_UADDR32 R_PPC_UADDR32
#define R_PPC64_UADDR16 R_PPC_UADDR16
#define R_PPC64_REL32 R_PPC_REL32
#define R_PPC64_PLT32 R_PPC_PLT32
#define R_PPC64_PLTREL32 R_PPC_PLTREL32
#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
#define R_PPC64_SECTOFF R_PPC_SECTOFF
#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */
#define R_PPC64_ADDR64 38 /* doubleword64 S + A */
#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */
#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */
#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */
#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */
#define R_PPC64_UADDR64 43 /* doubleword64 S + A */
#define R_PPC64_REL64 44 /* doubleword64 S + A - P */
#define R_PPC64_PLT64 45 /* doubleword64 L + A */
#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */
#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */
#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */
#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */
#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */
#define R_PPC64_TOC 51 /* doubleword64 .TOC */
#define R_PPC64_PLTGOT16 52 /* half16* M + A */
#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */
#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */
#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */
#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */
#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */
#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */
#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */
#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */
#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */
#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */
#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */
#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */
#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */
#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */
/* PowerPC64 relocations defined for the TLS access ABI. */
#define R_PPC64_TLS 67 /* none (sym+add)@tls */
#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
#define R_PPC64_TLSGD 107 /* none (sym+add)@tlsgd */
#define R_PPC64_TLSLD 108 /* none (sym+add)@tlsld */
#define R_PPC64_TOCSAVE 109 /* none */
/* Added when HA and HI relocs were changed to report overflows. */
#define R_PPC64_ADDR16_HIGH 110
#define R_PPC64_ADDR16_HIGHA 111
#define R_PPC64_TPREL16_HIGH 112
#define R_PPC64_TPREL16_HIGHA 113
#define R_PPC64_DTPREL16_HIGH 114
#define R_PPC64_DTPREL16_HIGHA 115
/* GNU extension to support local ifunc. */
#define R_PPC64_JMP_IREL 247
#define R_PPC64_IRELATIVE 248
#define R_PPC64_REL16 249 /* half16 (sym+add-.) */
#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */
#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */
#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */
/* e_flags bits specifying ABI.
1 for original function descriptor using ABI,
2 for revised ABI without function descriptors,
0 for unspecified or not using any features affected by the differences. */
#define EF_PPC64_ABI 3
/* PowerPC64 specific values for the Dyn d_tag field. */
#define DT_PPC64_GLINK (DT_LOPROC + 0)
#define DT_PPC64_OPD (DT_LOPROC + 1)
#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
#define DT_PPC64_OPT (DT_LOPROC + 3)
#define DT_PPC64_NUM 4
/* PowerPC64 specific bits in the DT_PPC64_OPT Dyn entry. */
#define PPC64_OPT_TLS 1
#define PPC64_OPT_MULTI_TOC 2
#define PPC64_OPT_LOCALENTRY 4
/* PowerPC64 specific values for the Elf64_Sym st_other field. */
#define STO_PPC64_LOCAL_BIT 5
#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT)
#define PPC64_LOCAL_ENTRY_OFFSET(other) \
(((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
/* ARM specific declarations */
/* Processor specific flags for the ELF header e_flags field. */
#define EF_ARM_RELEXEC 0x01
#define EF_ARM_HASENTRY 0x02
#define EF_ARM_INTERWORK 0x04
#define EF_ARM_APCS_26 0x08
#define EF_ARM_APCS_FLOAT 0x10
#define EF_ARM_PIC 0x20
#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */
#define EF_ARM_NEW_ABI 0x80
#define EF_ARM_OLD_ABI 0x100
#define EF_ARM_SOFT_FLOAT 0x200
#define EF_ARM_VFP_FLOAT 0x400
#define EF_ARM_MAVERICK_FLOAT 0x800
#define EF_ARM_ABI_FLOAT_SOFT 0x200 /* NB conflicts with EF_ARM_SOFT_FLOAT */
#define EF_ARM_ABI_FLOAT_HARD 0x400 /* NB conflicts with EF_ARM_VFP_FLOAT */
/* Other constants defined in the ARM ELF spec. version B-01. */
/* NB. These conflict with values defined above. */
#define EF_ARM_SYMSARESORTED 0x04
#define EF_ARM_DYNSYMSUSESEGIDX 0x08
#define EF_ARM_MAPSYMSFIRST 0x10
#define EF_ARM_EABIMASK 0XFF000000
/* Constants defined in AAELF. */
#define EF_ARM_BE8 0x00800000
#define EF_ARM_LE8 0x00400000
#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
#define EF_ARM_EABI_UNKNOWN 0x00000000
#define EF_ARM_EABI_VER1 0x01000000
#define EF_ARM_EABI_VER2 0x02000000
#define EF_ARM_EABI_VER3 0x03000000
#define EF_ARM_EABI_VER4 0x04000000
#define EF_ARM_EABI_VER5 0x05000000
/* Additional symbol types for Thumb. */
#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
/* ARM-specific values for sh_flags */
#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
in the input to a link step. */
/* ARM-specific program header flags */
#define PF_ARM_SB 0x10000000 /* Segment contains the location
addressed by the static base. */
#define PF_ARM_PI 0x20000000 /* Position-independent segment. */
#define PF_ARM_ABS 0x40000000 /* Absolute segment. */
/* Processor specific values for the Phdr p_type field. */
#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
/* Processor specific values for the Shdr sh_type field. */
#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
/* AArch64 relocs. */
#define R_AARCH64_NONE 0 /* No relocation. */
/* ILP32 AArch64 relocs. */
#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
/* LP64 AArch64 relocs. */
#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
#define R_AARCH64_PREL64 260 /* PC-relative 64-bit. */
#define R_AARCH64_PREL32 261 /* PC-relative 32-bit. */
#define R_AARCH64_PREL16 262 /* PC-relative 16-bit. */
#define R_AARCH64_MOVW_UABS_G0 263 /* Dir. MOVZ imm. from bits 15:0. */
#define R_AARCH64_MOVW_UABS_G0_NC 264 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_UABS_G1 265 /* Dir. MOVZ imm. from bits 31:16. */
#define R_AARCH64_MOVW_UABS_G1_NC 266 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_UABS_G2 267 /* Dir. MOVZ imm. from bits 47:32. */
#define R_AARCH64_MOVW_UABS_G2_NC 268 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_UABS_G3 269 /* Dir. MOV{K,Z} imm. from 63:48. */
#define R_AARCH64_MOVW_SABS_G0 270 /* Dir. MOV{N,Z} imm. from 15:0. */
#define R_AARCH64_MOVW_SABS_G1 271 /* Dir. MOV{N,Z} imm. from 31:16. */
#define R_AARCH64_MOVW_SABS_G2 272 /* Dir. MOV{N,Z} imm. from 47:32. */
#define R_AARCH64_LD_PREL_LO19 273 /* PC-rel. LD imm. from bits 20:2. */
#define R_AARCH64_ADR_PREL_LO21 274 /* PC-rel. ADR imm. from bits 20:0. */
#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page-rel. ADRP imm. from 32:12. */
#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Likewise; no overflow check. */
#define R_AARCH64_ADD_ABS_LO12_NC 277 /* Dir. ADD imm. from bits 11:0. */
#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* Likewise for LD/ST; no check. */
#define R_AARCH64_TSTBR14 279 /* PC-rel. TBZ/TBNZ imm. from 15:2. */
#define R_AARCH64_CONDBR19 280 /* PC-rel. cond. br. imm. from 20:2. */
#define R_AARCH64_JUMP26 282 /* PC-rel. B imm. from bits 27:2. */
#define R_AARCH64_CALL26 283 /* Likewise for CALL. */
#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* Dir. ADD imm. from bits 11:1. */
#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* Likewise for bits 11:2. */
#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* Likewise for bits 11:3. */
#define R_AARCH64_MOVW_PREL_G0 287 /* PC-rel. MOV{N,Z} imm. from 15:0. */
#define R_AARCH64_MOVW_PREL_G0_NC 288 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_PREL_G1 289 /* PC-rel. MOV{N,Z} imm. from 31:16. */
#define R_AARCH64_MOVW_PREL_G1_NC 290 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_PREL_G2 291 /* PC-rel. MOV{N,Z} imm. from 47:32. */
#define R_AARCH64_MOVW_PREL_G2_NC 292 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_PREL_G3 293 /* PC-rel. MOV{N,Z} imm. from 63:48. */
#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* Dir. ADD imm. from bits 11:4. */
#define R_AARCH64_MOVW_GOTOFF_G0 300 /* GOT-rel. off. MOV{N,Z} imm. 15:0. */
#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_GOTOFF_G1 302 /* GOT-rel. o. MOV{N,Z} imm. 31:16. */
#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_GOTOFF_G2 304 /* GOT-rel. o. MOV{N,Z} imm. 47:32. */
#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* Likewise for MOVK; no check. */
#define R_AARCH64_MOVW_GOTOFF_G3 306 /* GOT-rel. o. MOV{N,Z} imm. 63:48. */
#define R_AARCH64_GOTREL64 307 /* GOT-relative 64-bit. */
#define R_AARCH64_GOTREL32 308 /* GOT-relative 32-bit. */
#define R_AARCH64_GOT_LD_PREL19 309 /* PC-rel. GOT off. load imm. 20:2. */
#define R_AARCH64_LD64_GOTOFF_LO15 310 /* GOT-rel. off. LD/ST imm. 14:3. */
#define R_AARCH64_ADR_GOT_PAGE 311 /* P-page-rel. GOT off. ADRP 32:12. */
#define R_AARCH64_LD64_GOT_LO12_NC 312 /* Dir. GOT off. LD/ST imm. 11:3. */
#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* GOT-page-rel. GOT off. LD/ST 14:3 */
#define R_AARCH64_TLSGD_ADR_PREL21 512 /* PC-relative ADR imm. 20:0. */
#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* page-rel. ADRP imm. 32:12. */
#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* direct ADD imm. from 11:0. */
#define R_AARCH64_TLSGD_MOVW_G1 515 /* GOT-rel. MOV{N,Z} 31:16. */
#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* GOT-rel. MOVK imm. 15:0. */
#define R_AARCH64_TLSLD_ADR_PREL21 517 /* Like 512; local dynamic model. */
#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Like 513; local dynamic model. */
#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* Like 514; local dynamic model. */
#define R_AARCH64_TLSLD_MOVW_G1 520 /* Like 515; local dynamic model. */
#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* Like 516; local dynamic model. */
#define R_AARCH64_TLSLD_LD_PREL19 522 /* TLS PC-rel. load imm. 20:2. */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* TLS DTP-rel. MOV{N,Z} 47:32. */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* TLS DTP-rel. MOV{N,Z} 31:16. */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* Likewise; MOVK; no check. */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* TLS DTP-rel. MOV{N,Z} 15:0. */
#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* Likewise; MOVK; no check. */
#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTP-rel. ADD imm. from 23:12. */
#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTP-rel. ADD imm. from 11:0. */
#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* Likewise; no ovfl. check. */
#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTP-rel. LD/ST imm. 11:0. */
#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* Likewise; no check. */
#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTP-rel. LD/ST imm. 11:1. */
#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* Likewise; no check. */
#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTP-rel. LD/ST imm. 11:2. */
#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* Likewise; no check. */
#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTP-rel. LD/ST imm. 11:3. */
#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* Likewise; no check. */
#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* GOT-rel. MOV{N,Z} 31:16. */
#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* GOT-rel. MOVK 15:0. */
#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page-rel. ADRP 32:12. */
#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* Direct LD off. 11:3. */
#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* PC-rel. load imm. 20:2. */
#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TLS TP-rel. MOV{N,Z} 47:32. */
#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TLS TP-rel. MOV{N,Z} 31:16. */
#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* Likewise; MOVK; no check. */
#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TLS TP-rel. MOV{N,Z} 15:0. */
#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* Likewise; MOVK; no check. */
#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TP-rel. ADD imm. 23:12. */
#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TP-rel. ADD imm. 11:0. */
#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* Likewise; no ovfl. check. */
#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TP-rel. LD/ST off. 11:0. */
#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* Likewise; no ovfl. check. */
#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TP-rel. LD/ST off. 11:1. */
#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* Likewise; no check. */
#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TP-rel. LD/ST off. 11:2. */
#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* Likewise; no check. */
#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TP-rel. LD/ST off. 11:3. */
#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* Likewise; no check. */
#define R_AARCH64_TLSDESC_LD_PREL19 560 /* PC-rel. load immediate 20:2. */
#define R_AARCH64_TLSDESC_ADR_PREL21 561 /* PC-rel. ADR immediate 20:0. */
#define R_AARCH64_TLSDESC_ADR_PAGE21 562 /* Page-rel. ADRP imm. 32:12. */
#define R_AARCH64_TLSDESC_LD64_LO12 563 /* Direct LD off. from 11:3. */
#define R_AARCH64_TLSDESC_ADD_LO12 564 /* Direct ADD imm. from 11:0. */
#define R_AARCH64_TLSDESC_OFF_G1 565 /* GOT-rel. MOV{N,Z} imm. 31:16. */
#define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* GOT-rel. MOVK imm. 15:0; no ck. */
#define R_AARCH64_TLSDESC_LDR 567 /* Relax LDR. */
#define R_AARCH64_TLSDESC_ADD 568 /* Relax ADD. */
#define R_AARCH64_TLSDESC_CALL 569 /* Relax BLR. */
#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TP-rel. LD/ST off. 11:4. */
#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* Likewise; no check. */
#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTP-rel. LD/ST imm. 11:4. */
#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* Likewise; no check. */
#define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */
#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
/* AArch64 specific values for the Dyn d_tag field. */
#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
#define DT_AARCH64_NUM 6
/* AArch64 specific values for the st_other field. */
#define STO_AARCH64_VARIANT_PCS 0x80
/* ARM relocs. */
#define R_ARM_NONE 0 /* No reloc */
#define R_ARM_PC24 1 /* Deprecated PC relative 26
bit branch. */
#define R_ARM_ABS32 2 /* Direct 32 bit */
#define R_ARM_REL32 3 /* PC relative 32 bit */
#define R_ARM_PC13 4
#define R_ARM_ABS16 5 /* Direct 16 bit */
#define R_ARM_ABS12 6 /* Direct 12 bit */
#define R_ARM_THM_ABS5 7 /* Direct & 0x7C (LDR, STR). */
#define R_ARM_ABS8 8 /* Direct 8 bit */
#define R_ARM_SBREL32 9
#define R_ARM_THM_PC22 10 /* PC relative 24 bit (Thumb32 BL). */
#define R_ARM_THM_PC8 11 /* PC relative & 0x3FC
(Thumb16 LDR, ADD, ADR). */
#define R_ARM_AMP_VCALL9 12
#define R_ARM_SWI24 13 /* Obsolete static relocation. */
#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */
#define R_ARM_THM_SWI8 14 /* Reserved. */
#define R_ARM_XPC25 15 /* Reserved. */
#define R_ARM_THM_XPC22 16 /* Reserved. */
#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */
#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */
#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */
#define R_ARM_COPY 20 /* Copy symbol at runtime */
#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
#define R_ARM_RELATIVE 23 /* Adjust by program base */
#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
#define R_ARM_GOT32 26 /* 32 bit GOT entry */
#define R_ARM_PLT32 27 /* Deprecated, 32 bit PLT address. */
#define R_ARM_CALL 28 /* PC relative 24 bit (BL, BLX). */
#define R_ARM_JUMP24 29 /* PC relative 24 bit
(B, BL<cond>). */
#define R_ARM_THM_JUMP24 30 /* PC relative 24 bit (Thumb32 B.W). */
#define R_ARM_BASE_ABS 31 /* Adjust by program base. */
#define R_ARM_ALU_PCREL_7_0 32 /* Obsolete. */
#define R_ARM_ALU_PCREL_15_8 33 /* Obsolete. */
#define R_ARM_ALU_PCREL_23_15 34 /* Obsolete. */
#define R_ARM_LDR_SBREL_11_0 35 /* Deprecated, prog. base relative. */
#define R_ARM_ALU_SBREL_19_12 36 /* Deprecated, prog. base relative. */
#define R_ARM_ALU_SBREL_27_20 37 /* Deprecated, prog. base relative. */
#define R_ARM_TARGET1 38
#define R_ARM_SBREL31 39 /* Program base relative. */
#define R_ARM_V4BX 40
#define R_ARM_TARGET2 41
#define R_ARM_PREL31 42 /* 32 bit PC relative. */
#define R_ARM_MOVW_ABS_NC 43 /* Direct 16-bit (MOVW). */
#define R_ARM_MOVT_ABS 44 /* Direct high 16-bit (MOVT). */
#define R_ARM_MOVW_PREL_NC 45 /* PC relative 16-bit (MOVW). */
#define R_ARM_MOVT_PREL 46 /* PC relative (MOVT). */
#define R_ARM_THM_MOVW_ABS_NC 47 /* Direct 16 bit (Thumb32 MOVW). */
#define R_ARM_THM_MOVT_ABS 48 /* Direct high 16 bit
(Thumb32 MOVT). */
#define R_ARM_THM_MOVW_PREL_NC 49 /* PC relative 16 bit
(Thumb32 MOVW). */
#define R_ARM_THM_MOVT_PREL 50 /* PC relative high 16 bit
(Thumb32 MOVT). */
#define R_ARM_THM_JUMP19 51 /* PC relative 20 bit
(Thumb32 B<cond>.W). */
#define R_ARM_THM_JUMP6 52 /* PC relative X & 0x7E
(Thumb16 CBZ, CBNZ). */
#define R_ARM_THM_ALU_PREL_11_0 53 /* PC relative 12 bit
(Thumb32 ADR.W). */
#define R_ARM_THM_PC12 54 /* PC relative 12 bit
(Thumb32 LDR{D,SB,H,SH}). */
#define R_ARM_ABS32_NOI 55 /* Direct 32-bit. */
#define R_ARM_REL32_NOI 56 /* PC relative 32-bit. */
#define R_ARM_ALU_PC_G0_NC 57 /* PC relative (ADD, SUB). */
#define R_ARM_ALU_PC_G0 58 /* PC relative (ADD, SUB). */
#define R_ARM_ALU_PC_G1_NC 59 /* PC relative (ADD, SUB). */
#define R_ARM_ALU_PC_G1 60 /* PC relative (ADD, SUB). */
#define R_ARM_ALU_PC_G2 61 /* PC relative (ADD, SUB). */
#define R_ARM_LDR_PC_G1 62 /* PC relative (LDR,STR,LDRB,STRB). */
#define R_ARM_LDR_PC_G2 63 /* PC relative (LDR,STR,LDRB,STRB). */
#define R_ARM_LDRS_PC_G0 64 /* PC relative (STR{D,H},
LDR{D,SB,H,SH}). */
#define R_ARM_LDRS_PC_G1 65 /* PC relative (STR{D,H},
LDR{D,SB,H,SH}). */
#define R_ARM_LDRS_PC_G2 66 /* PC relative (STR{D,H},
LDR{D,SB,H,SH}). */
#define R_ARM_LDC_PC_G0 67 /* PC relative (LDC, STC). */
#define R_ARM_LDC_PC_G1 68 /* PC relative (LDC, STC). */
#define R_ARM_LDC_PC_G2 69 /* PC relative (LDC, STC). */
#define R_ARM_ALU_SB_G0_NC 70 /* Program base relative (ADD,SUB). */
#define R_ARM_ALU_SB_G0 71 /* Program base relative (ADD,SUB). */
#define R_ARM_ALU_SB_G1_NC 72 /* Program base relative (ADD,SUB). */
#define R_ARM_ALU_SB_G1 73 /* Program base relative (ADD,SUB). */
#define R_ARM_ALU_SB_G2 74 /* Program base relative (ADD,SUB). */
#define R_ARM_LDR_SB_G0 75 /* Program base relative (LDR,
STR, LDRB, STRB). */
#define R_ARM_LDR_SB_G1 76 /* Program base relative
(LDR, STR, LDRB, STRB). */
#define R_ARM_LDR_SB_G2 77 /* Program base relative
(LDR, STR, LDRB, STRB). */
#define R_ARM_LDRS_SB_G0 78 /* Program base relative
(LDR, STR, LDRB, STRB). */
#define R_ARM_LDRS_SB_G1 79 /* Program base relative
(LDR, STR, LDRB, STRB). */
#define R_ARM_LDRS_SB_G2 80 /* Program base relative
(LDR, STR, LDRB, STRB). */
#define R_ARM_LDC_SB_G0 81 /* Program base relative (LDC,STC). */
#define R_ARM_LDC_SB_G1 82 /* Program base relative (LDC,STC). */
#define R_ARM_LDC_SB_G2 83 /* Program base relative (LDC,STC). */
#define R_ARM_MOVW_BREL_NC 84 /* Program base relative 16
bit (MOVW). */
#define R_ARM_MOVT_BREL 85 /* Program base relative high
16 bit (MOVT). */
#define R_ARM_MOVW_BREL 86 /* Program base relative 16
bit (MOVW). */
#define R_ARM_THM_MOVW_BREL_NC 87 /* Program base relative 16
bit (Thumb32 MOVW). */
#define R_ARM_THM_MOVT_BREL 88 /* Program base relative high
16 bit (Thumb32 MOVT). */
#define R_ARM_THM_MOVW_BREL 89 /* Program base relative 16
bit (Thumb32 MOVW). */
#define R_ARM_TLS_GOTDESC 90
#define R_ARM_TLS_CALL 91
#define R_ARM_TLS_DESCSEQ 92 /* TLS relaxation. */
#define R_ARM_THM_TLS_CALL 93
#define R_ARM_PLT32_ABS 94
#define R_ARM_GOT_ABS 95 /* GOT entry. */
#define R_ARM_GOT_PREL 96 /* PC relative GOT entry. */
#define R_ARM_GOT_BREL12 97 /* GOT entry relative to GOT
origin (LDR). */
#define R_ARM_GOTOFF12 98 /* 12 bit, GOT entry relative
to GOT origin (LDR, STR). */
#define R_ARM_GOTRELAX 99
#define R_ARM_GNU_VTENTRY 100
#define R_ARM_GNU_VTINHERIT 101
#define R_ARM_THM_PC11 102 /* PC relative & 0xFFE (Thumb16 B). */
#define R_ARM_THM_PC9 103 /* PC relative & 0x1FE
(Thumb16 B/B<cond>). */
#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic
thread local data */
#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic
thread local data */
#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS
block */
#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of
static TLS block offset */
#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static
TLS block */
#define R_ARM_TLS_LDO12 109 /* 12 bit relative to TLS
block (LDR, STR). */
#define R_ARM_TLS_LE12 110 /* 12 bit relative to static
TLS block (LDR, STR). */
#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
to GOT origin (LDR). */
#define R_ARM_ME_TOO 128 /* Obsolete. */
#define R_ARM_THM_TLS_DESCSEQ 129
#define R_ARM_THM_TLS_DESCSEQ16 129
#define R_ARM_THM_TLS_DESCSEQ32 130
#define R_ARM_THM_GOT_BREL12 131 /* GOT entry relative to GOT
origin, 12 bit (Thumb32 LDR). */
#define R_ARM_IRELATIVE 160
#define R_ARM_RXPC25 249
#define R_ARM_RSBREL32 250
#define R_ARM_THM_RPC22 251
#define R_ARM_RREL32 252
#define R_ARM_RABS22 253
#define R_ARM_RPC24 254
#define R_ARM_RBASE 255
/* Keep this the last entry. */
#define R_ARM_NUM 256
/* IA-64 specific declarations. */
/* Processor specific flags for the Ehdr e_flags field. */
#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */
#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */
#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */
/* Processor specific values for the Phdr p_type field. */
#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */
#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */
#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12)
#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13)
#define PT_IA_64_HP_STACK (PT_LOOS + 0x14)
/* Processor specific flags for the Phdr p_flags field. */
#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */
/* Processor specific values for the Shdr sh_type field. */
#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
/* Processor specific flags for the Shdr sh_flags field. */
#define SHF_IA_64_SHORT 0x10000000 /* section near gp */
#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */
/* Processor specific values for the Dyn d_tag field. */
#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
#define DT_IA_64_NUM 1
/* IA-64 relocations. */
#define R_IA64_NONE 0x00 /* none */
#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */
#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */
#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */
#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */
#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */
#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */
#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */
#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */
#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */
#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */
#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */
#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */
#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */
#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */
#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */
#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */
#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */
#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */
#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */
#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */
#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */
#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */
#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */
#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */
#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */
#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */
#define R_IA64_COPY 0x84 /* copy relocation */
#define R_IA64_SUB 0x85 /* Addend and symbol difference */
#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */
#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */
#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */
#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */
#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */
#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */
#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */
#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */
#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */
#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */
#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */
#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */
#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */
#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */
#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */
#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
/* SH specific declarations */
/* Processor specific flags for the ELF header e_flags field. */
#define EF_SH_MACH_MASK 0x1f
#define EF_SH_UNKNOWN 0x0
#define EF_SH1 0x1
#define EF_SH2 0x2
#define EF_SH3 0x3
#define EF_SH_DSP 0x4
#define EF_SH3_DSP 0x5
#define EF_SH4AL_DSP 0x6
#define EF_SH3E 0x8
#define EF_SH4 0x9
#define EF_SH2E 0xb
#define EF_SH4A 0xc
#define EF_SH2A 0xd
#define EF_SH4_NOFPU 0x10
#define EF_SH4A_NOFPU 0x11
#define EF_SH4_NOMMU_NOFPU 0x12
#define EF_SH2A_NOFPU 0x13
#define EF_SH3_NOMMU 0x14
#define EF_SH2A_SH4_NOFPU 0x15
#define EF_SH2A_SH3_NOFPU 0x16
#define EF_SH2A_SH4 0x17
#define EF_SH2A_SH3E 0x18
/* SH relocs. */
#define R_SH_NONE 0
#define R_SH_DIR32 1
#define R_SH_REL32 2
#define R_SH_DIR8WPN 3
#define R_SH_IND12W 4
#define R_SH_DIR8WPL 5
#define R_SH_DIR8WPZ 6
#define R_SH_DIR8BP 7
#define R_SH_DIR8W 8
#define R_SH_DIR8L 9
#define R_SH_SWITCH16 25
#define R_SH_SWITCH32 26
#define R_SH_USES 27
#define R_SH_COUNT 28
#define R_SH_ALIGN 29
#define R_SH_CODE 30
#define R_SH_DATA 31
#define R_SH_LABEL 32
#define R_SH_SWITCH8 33
#define R_SH_GNU_VTINHERIT 34
#define R_SH_GNU_VTENTRY 35
#define R_SH_TLS_GD_32 144
#define R_SH_TLS_LD_32 145
#define R_SH_TLS_LDO_32 146
#define R_SH_TLS_IE_32 147
#define R_SH_TLS_LE_32 148
#define R_SH_TLS_DTPMOD32 149
#define R_SH_TLS_DTPOFF32 150
#define R_SH_TLS_TPOFF32 151
#define R_SH_GOT32 160
#define R_SH_PLT32 161
#define R_SH_COPY 162
#define R_SH_GLOB_DAT 163
#define R_SH_JMP_SLOT 164
#define R_SH_RELATIVE 165
#define R_SH_GOTOFF 166
#define R_SH_GOTPC 167
/* Keep this the last entry. */
#define R_SH_NUM 256
/* S/390 specific definitions. */
/* Valid values for the e_flags field. */
#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */
/* Additional s390 relocs */
#define R_390_NONE 0 /* No reloc. */
#define R_390_8 1 /* Direct 8 bit. */
#define R_390_12 2 /* Direct 12 bit. */
#define R_390_16 3 /* Direct 16 bit. */
#define R_390_32 4 /* Direct 32 bit. */
#define R_390_PC32 5 /* PC relative 32 bit. */
#define R_390_GOT12 6 /* 12 bit GOT offset. */
#define R_390_GOT32 7 /* 32 bit GOT offset. */
#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
#define R_390_COPY 9 /* Copy symbol at runtime. */
#define R_390_GLOB_DAT 10 /* Create GOT entry. */
#define R_390_JMP_SLOT 11 /* Create PLT entry. */
#define R_390_RELATIVE 12 /* Adjust by program base. */
#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */
#define R_390_GOT16 15 /* 16 bit GOT offset. */
#define R_390_PC16 16 /* PC relative 16 bit. */
#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
#define R_390_64 22 /* Direct 64 bit. */
#define R_390_PC64 23 /* PC relative 64 bit. */
#define R_390_GOT64 24 /* 64 bit GOT offset. */
#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
#define R_390_TLS_GDCALL 38 /* Tag for function call in general
dynamic TLS code. */
#define R_390_TLS_LDCALL 39 /* Tag for function call in local
dynamic TLS code. */
#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
thread local data. */
#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
thread local data. */
#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
block offset. */
#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
block offset. */
#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
block offset. */
#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
thread local data in LE code. */
#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
thread local data in LE code. */
#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
negated static TLS block offset. */
#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
negated static TLS block offset. */
#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
negated static TLS block offset. */
#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
static TLS block. */
#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
static TLS block. */
#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
block. */
#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
block. */
#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS
block. */
#define R_390_20 57 /* Direct 20 bit. */
#define R_390_GOT20 58 /* 20 bit GOT offset. */
#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
block offset. */
#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */
/* Keep this the last entry. */
#define R_390_NUM 62
/* CRIS relocations. */
#define R_CRIS_NONE 0
#define R_CRIS_8 1
#define R_CRIS_16 2
#define R_CRIS_32 3
#define R_CRIS_8_PCREL 4
#define R_CRIS_16_PCREL 5
#define R_CRIS_32_PCREL 6
#define R_CRIS_GNU_VTINHERIT 7
#define R_CRIS_GNU_VTENTRY 8
#define R_CRIS_COPY 9
#define R_CRIS_GLOB_DAT 10
#define R_CRIS_JUMP_SLOT 11
#define R_CRIS_RELATIVE 12
#define R_CRIS_16_GOT 13
#define R_CRIS_32_GOT 14
#define R_CRIS_16_GOTPLT 15
#define R_CRIS_32_GOTPLT 16
#define R_CRIS_32_GOTREL 17
#define R_CRIS_32_PLT_GOTREL 18
#define R_CRIS_32_PLT_PCREL 19
#define R_CRIS_NUM 20
/* AMD x86-64 relocations. */
#define R_X86_64_NONE 0 /* No reloc */
#define R_X86_64_64 1 /* Direct 64 bit */
#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
#define R_X86_64_PLT32 4 /* 32 bit PLT address */
#define R_X86_64_COPY 5 /* Copy symbol at runtime */
#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
#define R_X86_64_RELATIVE 8 /* Adjust by program base */
#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
offset to GOT */
#define R_X86_64_32 10 /* Direct 32 bit zero extended */
#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
#define R_X86_64_16 12 /* Direct 16 bit zero extended */
#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
#define R_X86_64_8 14 /* Direct 8 bit sign extended */
#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
to two GOT entries for GD symbol */
#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
to two GOT entries for LD symbol */
#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
to GOT entry for IE symbol */
#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
#define R_X86_64_PC64 24 /* PC relative 64 bit */
#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */
#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative
offset to GOT */
#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */
#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset
to GOT entry */
#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */
#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */
#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset
to PLT entry */
#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */
#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */
#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */
#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS
descriptor. */
#define R_X86_64_TLSDESC 36 /* TLS descriptor. */
#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */
#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */
/* 39 Reserved was R_X86_64_PC32_BND */
/* 40 Reserved was R_X86_64_PLT32_BND */
#define R_X86_64_GOTPCRELX 41 /* Load from 32 bit signed pc relative
offset to GOT entry without REX
prefix, relaxable. */
#define R_X86_64_REX_GOTPCRELX 42 /* Load from 32 bit signed pc relative
offset to GOT entry with REX prefix,
relaxable. */
#define R_X86_64_NUM 43
/* x86-64 sh_type values. */
#define SHT_X86_64_UNWIND 0x70000001 /* Unwind information. */
/* AM33 relocations. */
#define R_MN10300_NONE 0 /* No reloc. */
#define R_MN10300_32 1 /* Direct 32 bit. */
#define R_MN10300_16 2 /* Direct 16 bit. */
#define R_MN10300_8 3 /* Direct 8 bit. */
#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */
#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */
#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */
#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */
#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */
#define R_MN10300_24 9 /* Direct 24 bit. */
#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */
#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */
#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */
#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */
#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */
#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */
#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */
#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */
#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */
#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */
#define R_MN10300_COPY 20 /* Copy symbol at runtime. */
#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */
#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */
#define R_MN10300_RELATIVE 23 /* Adjust by program base. */
#define R_MN10300_TLS_GD 24 /* 32-bit offset for global dynamic. */
#define R_MN10300_TLS_LD 25 /* 32-bit offset for local dynamic. */
#define R_MN10300_TLS_LDO 26 /* Module-relative offset. */
#define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block
offset. */
#define R_MN10300_TLS_IE 28 /* GOT address for static TLS block
offset. */
#define R_MN10300_TLS_LE 29 /* Offset relative to static TLS
block. */
#define R_MN10300_TLS_DTPMOD 30 /* ID of module containing symbol. */
#define R_MN10300_TLS_DTPOFF 31 /* Offset in module TLS block. */
#define R_MN10300_TLS_TPOFF 32 /* Offset in static TLS block. */
#define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed
by linker relaxation. */
#define R_MN10300_ALIGN 34 /* Alignment requirement for linker
relaxation. */
#define R_MN10300_NUM 35
/* M32R relocs. */
#define R_M32R_NONE 0 /* No reloc. */
#define R_M32R_16 1 /* Direct 16 bit. */
#define R_M32R_32 2 /* Direct 32 bit. */
#define R_M32R_24 3 /* Direct 24 bit. */
#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */
#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */
#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */
#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */
#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */
#define R_M32R_LO16 9 /* Low 16 bit. */
#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */
#define R_M32R_GNU_VTINHERIT 11
#define R_M32R_GNU_VTENTRY 12
/* M32R relocs use SHT_RELA. */
#define R_M32R_16_RELA 33 /* Direct 16 bit. */
#define R_M32R_32_RELA 34 /* Direct 32 bit. */
#define R_M32R_24_RELA 35 /* Direct 24 bit. */
#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */
#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */
#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */
#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */
#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */
#define R_M32R_LO16_RELA 41 /* Low 16 bit */
#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */
#define R_M32R_RELA_GNU_VTINHERIT 43
#define R_M32R_RELA_GNU_VTENTRY 44
#define R_M32R_REL32 45 /* PC relative 32 bit. */
#define R_M32R_GOT24 48 /* 24 bit GOT entry */
#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */
#define R_M32R_COPY 50 /* Copy symbol at runtime */
#define R_M32R_GLOB_DAT 51 /* Create GOT entry */
#define R_M32R_JMP_SLOT 52 /* Create PLT entry */
#define R_M32R_RELATIVE 53 /* Adjust by program base */
#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */
#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */
#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned
low */
#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed
low */
#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */
#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to
GOT with unsigned low */
#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to
GOT with signed low */
#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to
GOT */
#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT
with unsigned low */
#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT
with signed low */
#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */
#define R_M32R_NUM 256 /* Keep this the last entry. */
/* MicroBlaze relocations */
#define R_MICROBLAZE_NONE 0 /* No reloc. */
#define R_MICROBLAZE_32 1 /* Direct 32 bit. */
#define R_MICROBLAZE_32_PCREL 2 /* PC relative 32 bit. */
#define R_MICROBLAZE_64_PCREL 3 /* PC relative 64 bit. */
#define R_MICROBLAZE_32_PCREL_LO 4 /* Low 16 bits of PCREL32. */
#define R_MICROBLAZE_64 5 /* Direct 64 bit. */
#define R_MICROBLAZE_32_LO 6 /* Low 16 bit. */
#define R_MICROBLAZE_SRO32 7 /* Read-only small data area. */
#define R_MICROBLAZE_SRW32 8 /* Read-write small data area. */
#define R_MICROBLAZE_64_NONE 9 /* No reloc. */
#define R_MICROBLAZE_32_SYM_OP_SYM 10 /* Symbol Op Symbol relocation. */
#define R_MICROBLAZE_GNU_VTINHERIT 11 /* GNU C++ vtable hierarchy. */
#define R_MICROBLAZE_GNU_VTENTRY 12 /* GNU C++ vtable member usage. */
#define R_MICROBLAZE_GOTPC_64 13 /* PC-relative GOT offset. */
#define R_MICROBLAZE_GOT_64 14 /* GOT entry offset. */
#define R_MICROBLAZE_PLT_64 15 /* PLT offset (PC-relative). */
#define R_MICROBLAZE_REL 16 /* Adjust by program base. */
#define R_MICROBLAZE_JUMP_SLOT 17 /* Create PLT entry. */
#define R_MICROBLAZE_GLOB_DAT 18 /* Create GOT entry. */
#define R_MICROBLAZE_GOTOFF_64 19 /* 64 bit offset to GOT. */
#define R_MICROBLAZE_GOTOFF_32 20 /* 32 bit offset to GOT. */
#define R_MICROBLAZE_COPY 21 /* Runtime copy. */
#define R_MICROBLAZE_TLS 22 /* TLS Reloc. */
#define R_MICROBLAZE_TLSGD 23 /* TLS General Dynamic. */
#define R_MICROBLAZE_TLSLD 24 /* TLS Local Dynamic. */
#define R_MICROBLAZE_TLSDTPMOD32 25 /* TLS Module ID. */
#define R_MICROBLAZE_TLSDTPREL32 26 /* TLS Offset Within TLS Block. */
#define R_MICROBLAZE_TLSDTPREL64 27 /* TLS Offset Within TLS Block. */
#define R_MICROBLAZE_TLSGOTTPREL32 28 /* TLS Offset From Thread Pointer. */
#define R_MICROBLAZE_TLSTPREL32 29 /* TLS Offset From Thread Pointer. */
/* Legal values for d_tag (dynamic entry type). */
#define DT_NIOS2_GP 0x70000002 /* Address of _gp. */
/* Nios II relocations. */
#define R_NIOS2_NONE 0 /* No reloc. */
#define R_NIOS2_S16 1 /* Direct signed 16 bit. */
#define R_NIOS2_U16 2 /* Direct unsigned 16 bit. */
#define R_NIOS2_PCREL16 3 /* PC relative 16 bit. */
#define R_NIOS2_CALL26 4 /* Direct call. */
#define R_NIOS2_IMM5 5 /* 5 bit constant expression. */
#define R_NIOS2_CACHE_OPX 6 /* 5 bit expression, shift 22. */
#define R_NIOS2_IMM6 7 /* 6 bit constant expression. */
#define R_NIOS2_IMM8 8 /* 8 bit constant expression. */
#define R_NIOS2_HI16 9 /* High 16 bit. */
#define R_NIOS2_LO16 10 /* Low 16 bit. */
#define R_NIOS2_HIADJ16 11 /* High 16 bit, adjusted. */
#define R_NIOS2_BFD_RELOC_32 12 /* 32 bit symbol value + addend. */
#define R_NIOS2_BFD_RELOC_16 13 /* 16 bit symbol value + addend. */
#define R_NIOS2_BFD_RELOC_8 14 /* 8 bit symbol value + addend. */
#define R_NIOS2_GPREL 15 /* 16 bit GP pointer offset. */
#define R_NIOS2_GNU_VTINHERIT 16 /* GNU C++ vtable hierarchy. */
#define R_NIOS2_GNU_VTENTRY 17 /* GNU C++ vtable member usage. */
#define R_NIOS2_UJMP 18 /* Unconditional branch. */
#define R_NIOS2_CJMP 19 /* Conditional branch. */
#define R_NIOS2_CALLR 20 /* Indirect call through register. */
#define R_NIOS2_ALIGN 21 /* Alignment requirement for
linker relaxation. */
#define R_NIOS2_GOT16 22 /* 16 bit GOT entry. */
#define R_NIOS2_CALL16 23 /* 16 bit GOT entry for function. */
#define R_NIOS2_GOTOFF_LO 24 /* %lo of offset to GOT pointer. */
#define R_NIOS2_GOTOFF_HA 25 /* %hiadj of offset to GOT pointer. */
#define R_NIOS2_PCREL_LO 26 /* %lo of PC relative offset. */
#define R_NIOS2_PCREL_HA 27 /* %hiadj of PC relative offset. */
#define R_NIOS2_TLS_GD16 28 /* 16 bit GOT offset for TLS GD. */
#define R_NIOS2_TLS_LDM16 29 /* 16 bit GOT offset for TLS LDM. */
#define R_NIOS2_TLS_LDO16 30 /* 16 bit module relative offset. */
#define R_NIOS2_TLS_IE16 31 /* 16 bit GOT offset for TLS IE. */
#define R_NIOS2_TLS_LE16 32 /* 16 bit LE TP-relative offset. */
#define R_NIOS2_TLS_DTPMOD 33 /* Module number. */
#define R_NIOS2_TLS_DTPREL 34 /* Module-relative offset. */
#define R_NIOS2_TLS_TPREL 35 /* TP-relative offset. */
#define R_NIOS2_COPY 36 /* Copy symbol at runtime. */
#define R_NIOS2_GLOB_DAT 37 /* Create GOT entry. */
#define R_NIOS2_JUMP_SLOT 38 /* Create PLT entry. */
#define R_NIOS2_RELATIVE 39 /* Adjust by program base. */
#define R_NIOS2_GOTOFF 40 /* 16 bit offset to GOT pointer. */
#define R_NIOS2_CALL26_NOAT 41 /* Direct call in .noat section. */
#define R_NIOS2_GOT_LO 42 /* %lo() of GOT entry. */
#define R_NIOS2_GOT_HA 43 /* %hiadj() of GOT entry. */
#define R_NIOS2_CALL_LO 44 /* %lo() of function GOT entry. */
#define R_NIOS2_CALL_HA 45 /* %hiadj() of function GOT entry. */
/* TILEPro relocations. */
#define R_TILEPRO_NONE 0 /* No reloc */
#define R_TILEPRO_32 1 /* Direct 32 bit */
#define R_TILEPRO_16 2 /* Direct 16 bit */
#define R_TILEPRO_8 3 /* Direct 8 bit */
#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */
#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */
#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */
#define R_TILEPRO_LO16 7 /* Low 16 bit */
#define R_TILEPRO_HI16 8 /* High 16 bit */
#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */
#define R_TILEPRO_COPY 10 /* Copy relocation */
#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */
#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */
#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */
#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */
#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */
#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */
#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */
#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */
#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */
#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */
#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */
#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */
#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */
#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */
#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */
#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */
#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */
#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */
#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */
#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */
#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */
#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */
#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */
#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */
#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */
#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */
#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */
#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */
#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */
#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */
#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */
#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */
#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */
#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */
#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */
#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */
#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */
#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */
#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */
#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */
#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */
#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */
#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */
#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */
#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */
/* Relocs 56-59 are currently not defined. */
#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */
#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */
#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */
#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */
#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */
#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */
#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */
#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */
#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */
#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */
#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */
#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */
#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */
#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */
#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */
#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */
#define R_TILEPRO_NUM 130
/* TILE-Gx relocations. */
#define R_TILEGX_NONE 0 /* No reloc */
#define R_TILEGX_64 1 /* Direct 64 bit */
#define R_TILEGX_32 2 /* Direct 32 bit */
#define R_TILEGX_16 3 /* Direct 16 bit */
#define R_TILEGX_8 4 /* Direct 8 bit */
#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */
#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */
#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */
#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */
#define R_TILEGX_HW0 9 /* hword 0 16-bit */
#define R_TILEGX_HW1 10 /* hword 1 16-bit */
#define R_TILEGX_HW2 11 /* hword 2 16-bit */
#define R_TILEGX_HW3 12 /* hword 3 16-bit */
#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */
#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */
#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */
#define R_TILEGX_COPY 16 /* Copy relocation */
#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */
#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */
#define R_TILEGX_RELATIVE 19 /* Adjust by program base */
#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */
#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */
#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */
#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */
#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */
#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */
#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */
#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */
#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */
#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */
#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */
#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */
#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */
#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */
#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */
#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */
#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */
#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */
#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */
#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */
#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */
#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */
#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */
#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */
#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */
#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */
#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */
#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */
#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */
#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */
#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */
#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */
#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */
#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */
#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */
#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */
#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */
#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */
#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */
#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */
#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */
#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */
#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */
#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */
#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */
#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */
#define R_TILEGX_IMM16_X0_HW0_PLT_PCREL 66 /* X0 pipe PC-rel PLT hword 0 */
#define R_TILEGX_IMM16_X1_HW0_PLT_PCREL 67 /* X1 pipe PC-rel PLT hword 0 */
#define R_TILEGX_IMM16_X0_HW1_PLT_PCREL 68 /* X0 pipe PC-rel PLT hword 1 */
#define R_TILEGX_IMM16_X1_HW1_PLT_PCREL 69 /* X1 pipe PC-rel PLT hword 1 */
#define R_TILEGX_IMM16_X0_HW2_PLT_PCREL 70 /* X0 pipe PC-rel PLT hword 2 */
#define R_TILEGX_IMM16_X1_HW2_PLT_PCREL 71 /* X1 pipe PC-rel PLT hword 2 */
#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */
#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */
#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */
#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */
#define R_TILEGX_IMM16_X0_HW3_PLT_PCREL 76 /* X0 pipe PC-rel PLT hword 3 */
#define R_TILEGX_IMM16_X1_HW3_PLT_PCREL 77 /* X1 pipe PC-rel PLT hword 3 */
#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */
#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */
#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */
#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */
#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */
#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */
#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */
#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */
#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */
#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */
#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */
#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */
/* Relocs 90-91 are currently not defined. */
#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */
#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */
#define R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL 94 /* X0 pipe PC-rel PLT last hword 0 */
#define R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL 95 /* X1 pipe PC-rel PLT last hword 0 */
#define R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL 96 /* X0 pipe PC-rel PLT last hword 1 */
#define R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL 97 /* X1 pipe PC-rel PLT last hword 1 */
#define R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL 98 /* X0 pipe PC-rel PLT last hword 2 */
#define R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL 99 /* X1 pipe PC-rel PLT last hword 2 */
#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */
#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */
#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */
#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */
/* Relocs 104-105 are currently not defined. */
#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */
#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */
#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */
#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */
#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */
#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */
#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */
#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */
#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */
#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */
#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */
#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */
#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */
#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */
#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */
#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */
#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */
#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */
#define R_TILEGX_NUM 130
/* RISC-V ELF Flags */
#define EF_RISCV_RVC 0x0001
#define EF_RISCV_FLOAT_ABI 0x0006
#define EF_RISCV_FLOAT_ABI_SOFT 0x0000
#define EF_RISCV_FLOAT_ABI_SINGLE 0x0002
#define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004
#define EF_RISCV_FLOAT_ABI_QUAD 0x0006
/* RISC-V relocations. */
#define R_RISCV_NONE 0
#define R_RISCV_32 1
#define R_RISCV_64 2
#define R_RISCV_RELATIVE 3
#define R_RISCV_COPY 4
#define R_RISCV_JUMP_SLOT 5
#define R_RISCV_TLS_DTPMOD32 6
#define R_RISCV_TLS_DTPMOD64 7
#define R_RISCV_TLS_DTPREL32 8
#define R_RISCV_TLS_DTPREL64 9
#define R_RISCV_TLS_TPREL32 10
#define R_RISCV_TLS_TPREL64 11
#define R_RISCV_BRANCH 16
#define R_RISCV_JAL 17
#define R_RISCV_CALL 18
#define R_RISCV_CALL_PLT 19
#define R_RISCV_GOT_HI20 20
#define R_RISCV_TLS_GOT_HI20 21
#define R_RISCV_TLS_GD_HI20 22
#define R_RISCV_PCREL_HI20 23
#define R_RISCV_PCREL_LO12_I 24
#define R_RISCV_PCREL_LO12_S 25
#define R_RISCV_HI20 26
#define R_RISCV_LO12_I 27
#define R_RISCV_LO12_S 28
#define R_RISCV_TPREL_HI20 29
#define R_RISCV_TPREL_LO12_I 30
#define R_RISCV_TPREL_LO12_S 31
#define R_RISCV_TPREL_ADD 32
#define R_RISCV_ADD8 33
#define R_RISCV_ADD16 34
#define R_RISCV_ADD32 35
#define R_RISCV_ADD64 36
#define R_RISCV_SUB8 37
#define R_RISCV_SUB16 38
#define R_RISCV_SUB32 39
#define R_RISCV_SUB64 40
#define R_RISCV_GNU_VTINHERIT 41
#define R_RISCV_GNU_VTENTRY 42
#define R_RISCV_ALIGN 43
#define R_RISCV_RVC_BRANCH 44
#define R_RISCV_RVC_JUMP 45
#define R_RISCV_RVC_LUI 46
#define R_RISCV_GPREL_I 47
#define R_RISCV_GPREL_S 48
#define R_RISCV_TPREL_I 49
#define R_RISCV_TPREL_S 50
#define R_RISCV_RELAX 51
#define R_RISCV_SUB6 52
#define R_RISCV_SET6 53
#define R_RISCV_SET8 54
#define R_RISCV_SET16 55
#define R_RISCV_SET32 56
#define R_RISCV_32_PCREL 57
#define R_RISCV_NUM 58
/* BPF specific declarations. */
#define R_BPF_NONE 0 /* No reloc */
#define R_BPF_64_64 1
#define R_BPF_64_32 10
/* Imagination Meta specific relocations. */
#define R_METAG_HIADDR16 0
#define R_METAG_LOADDR16 1
#define R_METAG_ADDR32 2 /* 32bit absolute address */
#define R_METAG_NONE 3 /* No reloc */
#define R_METAG_RELBRANCH 4
#define R_METAG_GETSETOFF 5
/* Backward compatability */
#define R_METAG_REG32OP1 6
#define R_METAG_REG32OP2 7
#define R_METAG_REG32OP3 8
#define R_METAG_REG16OP1 9
#define R_METAG_REG16OP2 10
#define R_METAG_REG16OP3 11
#define R_METAG_REG32OP4 12
#define R_METAG_HIOG 13
#define R_METAG_LOOG 14
#define R_METAG_REL8 15
#define R_METAG_REL16 16
/* GNU */
#define R_METAG_GNU_VTINHERIT 30
#define R_METAG_GNU_VTENTRY 31
/* PIC relocations */
#define R_METAG_HI16_GOTOFF 32
#define R_METAG_LO16_GOTOFF 33
#define R_METAG_GETSET_GOTOFF 34
#define R_METAG_GETSET_GOT 35
#define R_METAG_HI16_GOTPC 36
#define R_METAG_LO16_GOTPC 37
#define R_METAG_HI16_PLT 38
#define R_METAG_LO16_PLT 39
#define R_METAG_RELBRANCH_PLT 40
#define R_METAG_GOTOFF 41
#define R_METAG_PLT 42
#define R_METAG_COPY 43
#define R_METAG_JMP_SLOT 44
#define R_METAG_RELATIVE 45
#define R_METAG_GLOB_DAT 46
/* TLS relocations */
#define R_METAG_TLS_GD 47
#define R_METAG_TLS_LDM 48
#define R_METAG_TLS_LDO_HI16 49
#define R_METAG_TLS_LDO_LO16 50
#define R_METAG_TLS_LDO 51
#define R_METAG_TLS_IE 52
#define R_METAG_TLS_IENONPIC 53
#define R_METAG_TLS_IENONPIC_HI16 54
#define R_METAG_TLS_IENONPIC_LO16 55
#define R_METAG_TLS_TPOFF 56
#define R_METAG_TLS_DTPMOD 57
#define R_METAG_TLS_DTPOFF 58
#define R_METAG_TLS_LE 59
#define R_METAG_TLS_LE_HI16 60
#define R_METAG_TLS_LE_LO16 61
/* NDS32 relocations. */
#define R_NDS32_NONE 0
#define R_NDS32_32_RELA 20
#define R_NDS32_COPY 39
#define R_NDS32_GLOB_DAT 40
#define R_NDS32_JMP_SLOT 41
#define R_NDS32_RELATIVE 42
#define R_NDS32_TLS_TPOFF 102
#define R_NDS32_TLS_DESC 119
__END_DECLS
#endif /* elf.h */
/* $Id: tiff.h,v 1.70 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFF_
#define _TIFF_
#include "tiffconf.h"
/*
* Tag Image File Format (TIFF)
*
* Based on Rev 6.0 from:
* Developer's Desk
* Aldus Corporation
* 411 First Ave. South
* Suite 200
* Seattle, WA 98104
* 206-622-5500
*
* (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
*
* For BigTIFF design notes see the following links
* http://www.remotesensing.org/libtiff/bigtiffdesign.html
* http://www.awaresystems.be/imaging/tiff/bigtiff.html
*/
#define TIFF_VERSION_CLASSIC 42
#define TIFF_VERSION_BIG 43
#define TIFF_BIGENDIAN 0x4d4d
#define TIFF_LITTLEENDIAN 0x4949
#define MDI_LITTLEENDIAN 0x5045
#define MDI_BIGENDIAN 0x4550
/*
* Intrinsic data types required by the file format:
*
* 8-bit quantities int8/uint8
* 16-bit quantities int16/uint16
* 32-bit quantities int32/uint32
* 64-bit quantities int64/uint64
* strings unsigned char*
*/
typedef TIFF_INT8_T int8;
typedef TIFF_UINT8_T uint8;
typedef TIFF_INT16_T int16;
typedef TIFF_UINT16_T uint16;
typedef TIFF_INT32_T int32;
typedef TIFF_UINT32_T uint32;
typedef TIFF_INT64_T int64;
typedef TIFF_UINT64_T uint64;
/*
* Some types as promoted in a variable argument list
* We use uint16_vap rather then directly using int, because this way
* we document the type we actually want to pass through, conceptually,
* rather then confusing the issue by merely stating the type it gets
* promoted to
*/
typedef int uint16_vap;
/*
* TIFF header.
*/
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
uint16 tiff_version; /* TIFF version number */
} TIFFHeaderCommon;
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
uint16 tiff_version; /* TIFF version number */
uint32 tiff_diroff; /* byte offset to first directory */
} TIFFHeaderClassic;
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
uint16 tiff_version; /* TIFF version number */
uint16 tiff_offsetsize; /* size of offsets, should be 8 */
uint16 tiff_unused; /* unused word, should be 0 */
uint64 tiff_diroff; /* byte offset to first directory */
} TIFFHeaderBig;
/*
* NB: In the comments below,
* - items marked with a + are obsoleted by revision 5.0,
* - items marked with a ! are introduced in revision 6.0.
* - items marked with a % are introduced post revision 6.0.
* - items marked with a $ are obsoleted by revision 6.0.
* - items marked with a & are introduced by Adobe DNG specification.
*/
/*
* Tag data type information.
*
* Note: RATIONALs are the ratio of two 32-bit integer values.
*/
typedef enum {
TIFF_NOTYPE = 0, /* placeholder */
TIFF_BYTE = 1, /* 8-bit unsigned integer */
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
TIFF_SHORT = 3, /* 16-bit unsigned integer */
TIFF_LONG = 4, /* 32-bit unsigned integer */
TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
TIFF_SBYTE = 6, /* !8-bit signed integer */
TIFF_UNDEFINED = 7, /* !8-bit untyped data */
TIFF_SSHORT = 8, /* !16-bit signed integer */
TIFF_SLONG = 9, /* !32-bit signed integer */
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
TIFF_IFD = 13, /* %32-bit unsigned integer (offset) */
TIFF_LONG8 = 16, /* BigTIFF 64-bit unsigned integer */
TIFF_SLONG8 = 17, /* BigTIFF 64-bit signed integer */
TIFF_IFD8 = 18 /* BigTIFF 64-bit unsigned integer (offset) */
} TIFFDataType;
/*
* TIFF Tag Definitions.
*/
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
#define FILETYPE_PAGE 0x2 /* one page of many */
#define FILETYPE_MASK 0x4 /* transparency mask */
#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */
#define OFILETYPE_IMAGE 1 /* full resolution image data */
#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */
#define OFILETYPE_PAGE 3 /* one page of many */
#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */
#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */
#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */
#define TIFFTAG_COMPRESSION 259 /* data compression technique */
#define COMPRESSION_NONE 1 /* dump mode */
#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */
#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */
#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */
#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */
#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */
#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */
#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */
#define COMPRESSION_T85 9 /* !TIFF/FX T.85 JBIG compression */
#define COMPRESSION_T43 10 /* !TIFF/FX T.43 colour by layered JBIG compression */
#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */
#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
#define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
#define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */
#define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */
/* compression codes 32908-32911 are reserved for Pixar */
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
as recognized by Adobe */
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
#define COMPRESSION_LZMA 34925 /* LZMA2 */
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
#define PHOTOMETRIC_RGB 2 /* RGB color model */
#define PHOTOMETRIC_PALETTE 3 /* color map indexed */
#define PHOTOMETRIC_MASK 4 /* $holdout mask */
#define PHOTOMETRIC_SEPARATED 5 /* !color separations */
#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */
#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */
#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */
#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */
#define PHOTOMETRIC_CFA 32803 /* color filter array */
#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */
#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */
#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */
#define THRESHHOLD_BILEVEL 1 /* b&w art scan */
#define THRESHHOLD_HALFTONE 2 /* or dithered scan */
#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */
#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */
#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */
#define TIFFTAG_FILLORDER 266 /* data order within a byte */
#define FILLORDER_MSB2LSB 1 /* most significant -> least */
#define FILLORDER_LSB2MSB 2 /* least significant -> most */
#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */
#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */
#define TIFFTAG_MAKE 271 /* scanner manufacturer name */
#define TIFFTAG_MODEL 272 /* scanner model name/number */
#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */
#define TIFFTAG_ORIENTATION 274 /* +image orientation */
#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */
#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */
#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */
#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */
#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */
#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */
#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */
#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */
#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */
#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */
#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */
#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */
#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */
#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */
#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */
#define TIFFTAG_PLANARCONFIG 284 /* storage organization */
#define PLANARCONFIG_CONTIG 1 /* single image plane */
#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */
#define TIFFTAG_PAGENAME 285 /* page name image is from */
#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */
#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */
#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */
#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */
#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */
#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */
#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */
#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */
#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */
#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */
#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */
#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */
#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */
#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */
#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */
#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */
#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */
#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */
#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */
#define RESUNIT_NONE 1 /* no meaningful units */
#define RESUNIT_INCH 2 /* english */
#define RESUNIT_CENTIMETER 3 /* metric */
#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */
#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */
#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */
#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */
#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */
#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */
#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */
#define TIFFTAG_SOFTWARE 305 /* name & release */
#define TIFFTAG_DATETIME 306 /* creation date and time */
#define TIFFTAG_ARTIST 315 /* creator of image */
#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */
#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */
#define PREDICTOR_NONE 1 /* no prediction scheme used */
#define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */
#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */
#define TIFFTAG_WHITEPOINT 318 /* image white point */
#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
#define TIFFTAG_COLORMAP 320 /* RGB map for palette image */
#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */
#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */
#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */
#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */
#define CLEANFAXDATA_CLEAN 0 /* no errors detected */
#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */
#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */
#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
#define TIFFTAG_SUBIFD 330 /* subimage descriptors */
#define TIFFTAG_INKSET 332 /* !inks in separated image */
#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */
#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */
#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */
#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */
#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */
#define TIFFTAG_TARGETPRINTER 337 /* !separation target */
#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */
#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */
#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */
#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */
#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */
#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */
#define SAMPLEFORMAT_INT 2 /* !signed integer data */
#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */
#define SAMPLEFORMAT_VOID 4 /* !untyped data */
#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
[Adobe TIFF technote 2] */
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_INDEXED 346 /* %Indexed
[Adobe TIFF Technote 3] */
#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
/* Tags 400-435 are from the TIFF/FX spec */
#define TIFFTAG_GLOBALPARAMETERSIFD 400 /* ! */
#define TIFFTAG_PROFILETYPE 401 /* ! */
#define PROFILETYPE_UNSPECIFIED 0 /* ! */
#define PROFILETYPE_G3_FAX 1 /* ! */
#define TIFFTAG_FAXPROFILE 402 /* ! */
#define FAXPROFILE_S 1 /* !TIFF/FX FAX profile S */
#define FAXPROFILE_F 2 /* !TIFF/FX FAX profile F */
#define FAXPROFILE_J 3 /* !TIFF/FX FAX profile J */
#define FAXPROFILE_C 4 /* !TIFF/FX FAX profile C */
#define FAXPROFILE_L 5 /* !TIFF/FX FAX profile L */
#define FAXPROFILE_M 6 /* !TIFF/FX FAX profile LM */
#define TIFFTAG_CODINGMETHODS 403 /* !TIFF/FX coding methods */
#define CODINGMETHODS_T4_1D (1 << 1) /* !T.4 1D */
#define CODINGMETHODS_T4_2D (1 << 2) /* !T.4 2D */
#define CODINGMETHODS_T6 (1 << 3) /* !T.6 */
#define CODINGMETHODS_T85 (1 << 4) /* !T.85 JBIG */
#define CODINGMETHODS_T42 (1 << 5) /* !T.42 JPEG */
#define CODINGMETHODS_T43 (1 << 6) /* !T.43 colour by layered JBIG */
#define TIFFTAG_VERSIONYEAR 404 /* !TIFF/FX version year */
#define TIFFTAG_MODENUMBER 405 /* !TIFF/FX mode number */
#define TIFFTAG_DECODE 433 /* !TIFF/FX decode */
#define TIFFTAG_IMAGEBASECOLOR 434 /* !TIFF/FX image base colour */
#define TIFFTAG_T82OPTIONS 435 /* !TIFF/FX T.82 options */
/*
* Tags 512-521 are obsoleted by Technical Note #2 which specifies a
* revised JPEG-in-TIFF scheme.
*/
#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */
#define JPEGPROC_BASELINE 1 /* !baseline sequential */
#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */
#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */
#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */
#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
#define TIFFTAG_JPEGQTABLES 519 /* !Q matrix offsets */
#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */
#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */
#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */
#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
#define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */
#define TIFFTAG_XMLPACKET 700 /* %XML packet
[Adobe XMP Specification,
January 2004 */
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
[Adobe TIFF technote] */
/* tags 32952-32956 are private tags registered to Island Graphics */
#define TIFFTAG_REFPTS 32953 /* image reference points */
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */
#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */
/* tags 32995-32999 are private tags registered to SGI */
#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */
#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */
#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */
/* tags 33300-33309 are private tags registered to Pixar */
/*
* TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
* are set when an image has been cropped out of a larger image.
* They reflect the size of the original uncropped image.
* The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
* to determine the position of the smaller image in the larger one.
*/
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
/* Tags 33302-33306 are used to identify special image modes and data
* used by Pixar's texture formats.
*/
#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */
#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */
#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
/* tag 33405 is a private tag registered to Eastman Kodak */
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
#define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* dimensions of CFA pattern */
#define TIFFTAG_CFAPATTERN 33422 /* color filter array pattern */
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
/* IPTC TAG from RichTIFF specifications */
#define TIFFTAG_RICHTIFFIPTC 33723
/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define TIFFTAG_IT8SITE 34016 /* site name */
#define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */
#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
#define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */
#define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */
#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
(untrapped=0, trapped=1) */
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
/* tags 34232-34236 are private tags registered to Texas Instruments */
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
/* tag 34377 is private tag registered to Adobe for PhotoShop */
#define TIFFTAG_PHOTOSHOP 34377
/* tags 34665, 34853 and 40965 are documented in EXIF specification */
#define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */
/* tag 34750 is a private tag registered to Adobe? */
#define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */
#define TIFFTAG_IMAGELAYER 34732 /* !TIFF/FX image layer information */
/* tag 34750 is a private tag registered to Pixel Magic */
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
#define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */
/* tags 34908-34914 are private tags registered to SGI */
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
#define TIFFTAG_STONITS 37439 /* Sample value to Nits */
/* tag 34929 is a private tag registered to FedEx */
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
/* Adobe Digital Negative (DNG) format tags */
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
name */
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
mapping */
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
the BlackLevel tag */
#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
differences (columns) */
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
differences (rows) */
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
level */
#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
area */
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
area */
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
transformation matrix 1 */
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
transformation matrix 2 */
#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
matrix 1 */
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
matrix 2 */
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
values*/
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
linear reference space */
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
x-y chromaticity
coordinates */
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
point */
#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
sharpening */
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
the green pixels in the
blue/green rows track the
values of the green pixels
in the red/green rows */
#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
camera's anti-alias filter */
#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
tag is safe to preserve
along with the rest of the
EXIF data */
#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
the raw image data */
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
raw file */
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original
raw file */
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels
of the sensor */
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates
of fully masked pixels */
#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */
#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space
into ICC profile space */
#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */
#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
/* tag 65535 is an undefined tag used by Eastman Kodak */
#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */
/*
* The following are ``pseudo tags'' that can be used to control
* codec-specific functionality. These tags are not written to file.
* Note that these values start at 0xffff+1 so that they'll never
* collide with Aldus-assigned tags.
*
* If you want your private pseudo tags ``registered'' (i.e. added to
* this file), please post a bug report via the tracking system at
* http://www.remotesensing.org/libtiff/bugs.html with the appropriate
* C definitions to add.
*/
#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */
#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */
#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */
#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */
#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */
#define FAXMODE_WORDALIGN 0x0008 /* word align row */
#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */
/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */
#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */
#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */
#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */
#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */
#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */
/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */
#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */
#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */
#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */
#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */
#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */
#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */
/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */
#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */
#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */
#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */
#define DCSIMAGERFILTER_IR 0 /* infrared filter */
#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */
#define DCSIMAGERFILTER_CFA 2 /* color filter array */
#define DCSIMAGERFILTER_OTHER 3 /* other filter */
#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */
#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */
#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */
#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */
#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */
#define TIFFTAG_DCSGAMMA 65554 /* gamma value */
#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */
#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */
/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */
#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */
#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */
#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */
#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */
#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */
#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */
#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/
#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/
#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */
#define TIFFTAG_LZMAPRESET 65562 /* LZMA2 preset (compression level) */
#define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */
#define PERSAMPLE_MERGED 0 /* present as a single value */
#define PERSAMPLE_MULTI 1 /* present as multiple values */
/*
* EXIF tags
*/
#define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */
#define EXIFTAG_FNUMBER 33437 /* F number */
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
#define EXIFTAG_OECF 34856 /* Optoelectric conversion
factor */
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
data generation */
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
data generation */
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
#define EXIFTAG_APERTUREVALUE 37378 /* Aperture */
#define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */
#define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */
#define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */
#define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */
#define EXIFTAG_METERINGMODE 37383 /* Metering mode */
#define EXIFTAG_LIGHTSOURCE 37384 /* Light source */
#define EXIFTAG_FLASH 37385 /* Flash */
#define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */
#define EXIFTAG_SUBJECTAREA 37396 /* Subject area */
#define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */
#define EXIFTAG_USERCOMMENT 37510 /* User comments */
#define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */
#define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */
#define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */
#define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */
#define EXIFTAG_COLORSPACE 40961 /* Color space information */
#define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */
#define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */
#define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */
#define EXIFTAG_FLASHENERGY 41483 /* Flash energy */
#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */
#define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */
#define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */
#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */
#define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */
#define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */
#define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */
#define EXIFTAG_FILESOURCE 41728 /* File source */
#define EXIFTAG_SCENETYPE 41729 /* Scene type */
#define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */
#define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */
#define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */
#define EXIFTAG_WHITEBALANCE 41987 /* White balance */
#define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */
#define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */
#define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
#define EXIFTAG_CONTRAST 41992 /* Contrast */
#define EXIFTAG_SATURATION 41993 /* Saturation */
#define EXIFTAG_SHARPNESS 41994 /* Sharpness */
#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */
#endif /* _TIFF_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
// Copyright (c) 2005, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Sanjay Ghemawat
//
// Regular-expression based scanner for parsing an input stream.
//
// Example 1: parse a sequence of "var = number" entries from input:
//
// Scanner scanner(input);
// string var;
// int number;
// scanner.SetSkipExpression("\\s+"); // Skip any white space we encounter
// while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) {
// ...;
// }
#ifndef _PCRE_SCANNER_H
#define _PCRE_SCANNER_H
#include <assert.h>
#include <string>
#include <vector>
#include <pcrecpp.h>
#include <pcre_stringpiece.h>
namespace pcrecpp {
class PCRECPP_EXP_DEFN Scanner {
public:
Scanner();
explicit Scanner(const std::string& input);
~Scanner();
// Return current line number. The returned line-number is
// one-based. I.e. it returns 1 + the number of consumed newlines.
//
// Note: this method may be slow. It may take time proportional to
// the size of the input.
int LineNumber() const;
// Return the byte-offset that the scanner is looking in the
// input data;
int Offset() const;
// Return true iff the start of the remaining input matches "re"
bool LookingAt(const RE& re) const;
// Return true iff all of the following are true
// a. the start of the remaining input matches "re",
// b. if any arguments are supplied, matched sub-patterns can be
// parsed and stored into the arguments.
// If it returns true, it skips over the matched input and any
// following input that matches the "skip" regular expression.
bool Consume(const RE& re,
const Arg& arg0 = RE::no_arg,
const Arg& arg1 = RE::no_arg,
const Arg& arg2 = RE::no_arg
// TODO: Allow more arguments?
);
// Set the "skip" regular expression. If after consuming some data,
// a prefix of the input matches this RE, it is automatically
// skipped. For example, a programming language scanner would use
// a skip RE that matches white space and comments.
//
// scanner.SetSkipExpression("\\s+|//.*|/[*](.|\n)*?[*]/");
//
// Skipping repeats as long as it succeeds. We used to let people do
// this by writing "(...)*" in the regular expression, but that added
// up to lots of recursive calls within the pcre library, so now we
// control repetition explicitly via the function call API.
//
// You can pass NULL for "re" if you do not want any data to be skipped.
void Skip(const char* re); // DEPRECATED; does *not* repeat
void SetSkipExpression(const char* re);
// Temporarily pause "skip"ing. This
// Skip("Foo"); code ; DisableSkip(); code; EnableSkip()
// is similar to
// Skip("Foo"); code ; Skip(NULL); code ; Skip("Foo");
// but avoids creating/deleting new RE objects.
void DisableSkip();
// Reenable previously paused skipping. Any prefix of the input
// that matches the skip pattern is immediately dropped.
void EnableSkip();
/***** Special wrappers around SetSkip() for some common idioms *****/
// Arranges to skip whitespace, C comments, C++ comments.
// The overall RE is a disjunction of the following REs:
// \\s whitespace
// //.*\n C++ comment
// /[*](.|\n)*?[*]/ C comment (x*? means minimal repetitions of x)
// We get repetition via the semantics of SetSkipExpression, not by using *
void SkipCXXComments() {
SetSkipExpression("\\s|//.*\n|/[*](?:\n|.)*?[*]/");
}
void set_save_comments(bool comments) {
save_comments_ = comments;
}
bool save_comments() {
return save_comments_;
}
// Append to vector ranges the comments found in the
// byte range [start,end] (inclusive) of the input data.
// Only comments that were extracted entirely within that
// range are returned: no range splitting of atomically-extracted
// comments is performed.
void GetComments(int start, int end, std::vector<StringPiece> *ranges);
// Append to vector ranges the comments added
// since the last time this was called. This
// functionality is provided for efficiency when
// interleaving scanning with parsing.
void GetNextComments(std::vector<StringPiece> *ranges);
private:
std::string data_; // All the input data
StringPiece input_; // Unprocessed input
RE* skip_; // If non-NULL, RE for skipping input
bool should_skip_; // If true, use skip_
bool skip_repeat_; // If true, repeat skip_ as long as it works
bool save_comments_; // If true, aggregate the skip expression
// the skipped comments
// TODO: later consider requiring that the StringPieces be added
// in order by their start position
std::vector<StringPiece> *comments_;
// the offset into comments_ that has been returned by GetNextComments
int comments_offset_;
// helper function to consume *skip_ and honour
// save_comments_
void ConsumeSkip();
};
} // namespace pcrecpp
#endif /* _PCRE_SCANNER_H */
/*
* Public include file for the UUID library
*
* Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifndef _UUID_UUID_H
#define _UUID_UUID_H
#include <sys/types.h>
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
typedef unsigned char uuid_t[16];
/* UUID Variant definitions */
#define UUID_VARIANT_NCS 0
#define UUID_VARIANT_DCE 1
#define UUID_VARIANT_MICROSOFT 2
#define UUID_VARIANT_OTHER 3
#define UUID_VARIANT_SHIFT 5
#define UUID_VARIANT_MASK 0x7
/* UUID Type definitions */
#define UUID_TYPE_DCE_TIME 1
#define UUID_TYPE_DCE_SECURITY 2
#define UUID_TYPE_DCE_MD5 3
#define UUID_TYPE_DCE_RANDOM 4
#define UUID_TYPE_DCE_SHA1 5
#define UUID_TYPE_SHIFT 4
#define UUID_TYPE_MASK 0xf
#define UUID_STR_LEN 37
/* Allow UUID constants to be defined */
#ifdef __GNUC__
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#else
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* clear.c */
extern void uuid_clear(uuid_t uu);
/* compare.c */
extern int uuid_compare(const uuid_t uu1, const uuid_t uu2);
/* copy.c */
extern void uuid_copy(uuid_t dst, const uuid_t src);
/* gen_uuid.c */
extern void uuid_generate(uuid_t out);
extern void uuid_generate_random(uuid_t out);
extern void uuid_generate_time(uuid_t out);
extern int uuid_generate_time_safe(uuid_t out);
extern void uuid_generate_md5(uuid_t out, const uuid_t ns, const char *name, size_t len);
extern void uuid_generate_sha1(uuid_t out, const uuid_t ns, const char *name, size_t len);
/* isnull.c */
extern int uuid_is_null(const uuid_t uu);
/* parse.c */
extern int uuid_parse(const char *in, uuid_t uu);
/* unparse.c */
extern void uuid_unparse(const uuid_t uu, char *out);
extern void uuid_unparse_lower(const uuid_t uu, char *out);
extern void uuid_unparse_upper(const uuid_t uu, char *out);
/* uuid_time.c */
extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
extern int uuid_type(const uuid_t uu);
extern int uuid_variant(const uuid_t uu);
/* predefined.c */
extern const uuid_t *uuid_get_template(const char *alias);
#ifdef __cplusplus
}
#endif
#endif /* _UUID_UUID_H */
/* $Id: tiffio.hxx,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFFIO_HXX_
#define _TIFFIO_HXX_
/*
* TIFF I/O library definitions which provide C++ streams API.
*/
#include <iostream>
#include "tiff.h"
extern TIFF* TIFFStreamOpen(const char*, std::ostream *);
extern TIFF* TIFFStreamOpen(const char*, std::istream *);
#endif /* _TIFFIO_HXX_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c++
* c-basic-offset: 8
* fill-column: 78
* End:
*/
/***************************************************************************/
/* */
/* ftmac.h */
/* */
/* Additional Mac-specific API. */
/* */
/* Copyright 1996-2018 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* NOTE: Include this file after FT_FREETYPE_H and after any */
/* Mac-specific headers (because this header uses Mac types such as */
/* Handle, FSSpec, FSRef, etc.) */
/* */
/***************************************************************************/
#ifndef FTMAC_H_
#define FTMAC_H_
#include <ft2build.h>
FT_BEGIN_HEADER
/* gcc-3.1 and later can warn about functions tagged as deprecated */
#ifndef FT_DEPRECATED_ATTRIBUTE
#if defined( __GNUC__ ) && \
( ( __GNUC__ >= 4 ) || \
( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) )
#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated ))
#else
#define FT_DEPRECATED_ATTRIBUTE
#endif
#endif
/*************************************************************************/
/* */
/* <Section> */
/* mac_specific */
/* */
/* <Title> */
/* Mac Specific Interface */
/* */
/* <Abstract> */
/* Only available on the Macintosh. */
/* */
/* <Description> */
/* The following definitions are only available if FreeType is */
/* compiled on a Macintosh. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Face_From_FOND */
/* */
/* <Description> */
/* Create a new face object from a FOND resource. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* fond :: A FOND resource. */
/* */
/* face_index :: Only supported for the -1 `sanity check' special */
/* case. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Notes> */
/* This function can be used to create @FT_Face objects from fonts */
/* that are installed in the system as follows. */
/* */
/* { */
/* fond = GetResource( 'FOND', fontName ); */
/* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */
/* } */
/* */
FT_EXPORT( FT_Error )
FT_New_Face_From_FOND( FT_Library library,
Handle fond,
FT_Long face_index,
FT_Face *aface )
FT_DEPRECATED_ATTRIBUTE;
/*************************************************************************/
/* */
/* <Function> */
/* FT_GetFile_From_Mac_Name */
/* */
/* <Description> */
/* Return an FSSpec for the disk file containing the named font. */
/* */
/* <Input> */
/* fontName :: Mac OS name of the font (e.g., Times New Roman */
/* Bold). */
/* */
/* <Output> */
/* pathSpec :: FSSpec to the file. For passing to */
/* @FT_New_Face_From_FSSpec. */
/* */
/* face_index :: Index of the face. For passing to */
/* @FT_New_Face_From_FSSpec. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_GetFile_From_Mac_Name( const char* fontName,
FSSpec* pathSpec,
FT_Long* face_index )
FT_DEPRECATED_ATTRIBUTE;
/*************************************************************************/
/* */
/* <Function> */
/* FT_GetFile_From_Mac_ATS_Name */
/* */
/* <Description> */
/* Return an FSSpec for the disk file containing the named font. */
/* */
/* <Input> */
/* fontName :: Mac OS name of the font in ATS framework. */
/* */
/* <Output> */
/* pathSpec :: FSSpec to the file. For passing to */
/* @FT_New_Face_From_FSSpec. */
/* */
/* face_index :: Index of the face. For passing to */
/* @FT_New_Face_From_FSSpec. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_GetFile_From_Mac_ATS_Name( const char* fontName,
FSSpec* pathSpec,
FT_Long* face_index )
FT_DEPRECATED_ATTRIBUTE;
/*************************************************************************/
/* */
/* <Function> */
/* FT_GetFilePath_From_Mac_ATS_Name */
/* */
/* <Description> */
/* Return a pathname of the disk file and face index for given font */
/* name that is handled by ATS framework. */
/* */
/* <Input> */
/* fontName :: Mac OS name of the font in ATS framework. */
/* */
/* <Output> */
/* path :: Buffer to store pathname of the file. For passing */
/* to @FT_New_Face. The client must allocate this */
/* buffer before calling this function. */
/* */
/* maxPathSize :: Lengths of the buffer `path' that client allocated. */
/* */
/* face_index :: Index of the face. For passing to @FT_New_Face. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,
UInt8* path,
UInt32 maxPathSize,
FT_Long* face_index )
FT_DEPRECATED_ATTRIBUTE;
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Face_From_FSSpec */
/* */
/* <Description> */
/* Create a new face object from a given resource and typeface index */
/* using an FSSpec to the font file. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* spec :: FSSpec to the font file. */
/* */
/* face_index :: The index of the face within the resource. The */
/* first face has index~0. */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */
/* it accepts an FSSpec instead of a path. */
/* */
FT_EXPORT( FT_Error )
FT_New_Face_From_FSSpec( FT_Library library,
const FSSpec *spec,
FT_Long face_index,
FT_Face *aface )
FT_DEPRECATED_ATTRIBUTE;
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Face_From_FSRef */
/* */
/* <Description> */
/* Create a new face object from a given resource and typeface index */
/* using an FSRef to the font file. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* spec :: FSRef to the font file. */
/* */
/* face_index :: The index of the face within the resource. The */
/* first face has index~0. */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* @FT_New_Face_From_FSRef is identical to @FT_New_Face except */
/* it accepts an FSRef instead of a path. */
/* */
FT_EXPORT( FT_Error )
FT_New_Face_From_FSRef( FT_Library library,
const FSRef *ref,
FT_Long face_index,
FT_Face *aface )
FT_DEPRECATED_ATTRIBUTE;
/* */
FT_END_HEADER
#endif /* FTMAC_H_ */
/* END */
/***************************************************************************/
/* */
/* ftsizes.h */
/* */
/* FreeType size objects management (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* Typical application would normally not need to use these functions. */
/* However, they have been placed in a public API for the rare cases */
/* where they are needed. */
/* */
/*************************************************************************/
#ifndef FTSIZES_H_
#define FTSIZES_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* sizes_management */
/* */
/* <Title> */
/* Size Management */
/* */
/* <Abstract> */
/* Managing multiple sizes per face. */
/* */
/* <Description> */
/* When creating a new face object (e.g., with @FT_New_Face), an */
/* @FT_Size object is automatically created and used to store all */
/* pixel-size dependent information, available in the `face->size' */
/* field. */
/* */
/* It is however possible to create more sizes for a given face, */
/* mostly in order to manage several character pixel sizes of the */
/* same font family and style. See @FT_New_Size and @FT_Done_Size. */
/* */
/* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */
/* modify the contents of the current `active' size; you thus need */
/* to use @FT_Activate_Size to change it. */
/* */
/* 99% of applications won't need the functions provided here, */
/* especially if they use the caching sub-system, so be cautious */
/* when using these. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Size */
/* */
/* <Description> */
/* Create a new size object from a given face object. */
/* */
/* <Input> */
/* face :: A handle to a parent face object. */
/* */
/* <Output> */
/* asize :: A handle to a new size object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You need to call @FT_Activate_Size in order to select the new size */
/* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */
/* @FT_Load_Glyph, @FT_Load_Char, etc. */
/* */
FT_EXPORT( FT_Error )
FT_New_Size( FT_Face face,
FT_Size* size );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Size */
/* */
/* <Description> */
/* Discard a given size object. Note that @FT_Done_Face */
/* automatically discards all size objects allocated with */
/* @FT_New_Size. */
/* */
/* <Input> */
/* size :: A handle to a target size object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_Size( FT_Size size );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Activate_Size */
/* */
/* <Description> */
/* Even though it is possible to create several size objects for a */
/* given face (see @FT_New_Size for details), functions like */
/* @FT_Load_Glyph or @FT_Load_Char only use the one that has been */
/* activated last to determine the `current character pixel size'. */
/* */
/* This function can be used to `activate' a previously created size */
/* object. */
/* */
/* <Input> */
/* size :: A handle to a target size object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* If `face' is the size's parent face object, this function changes */
/* the value of `face->size' to the input size handle. */
/* */
FT_EXPORT( FT_Error )
FT_Activate_Size( FT_Size size );
/* */
FT_END_HEADER
#endif /* FTSIZES_H_ */
/* END */
/***************************************************************************/
/* */
/* ftdriver.h */
/* */
/* FreeType API for controlling driver modules (specification only). */
/* */
/* Copyright 2017-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTDRIVER_H_
#define FTDRIVER_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* auto_hinter
*
* @title:
* The auto-hinter
*
* @abstract:
* Controlling the auto-hinting module.
*
* @description:
* While FreeType's auto-hinter doesn't expose API functions by itself,
* it is possible to control its behaviour with @FT_Property_Set and
* @FT_Property_Get. The following lists the available properties
* together with the necessary macros and structures.
*
* Note that the auto-hinter's module name is `autofitter' for
* historical reasons.
*
* Available properties are @increase-x-height, @no-stem-darkening
* (experimental), @darkening-parameters (experimental), @warping
* (experimental), @glyph-to-script-map (experimental), @fallback-script
* (experimental), and @default-script (experimental), as documented in
* the @properties section.
*
*/
/**************************************************************************
*
* @section:
* cff_driver
*
* @title:
* The CFF driver
*
* @abstract:
* Controlling the CFF driver module.
*
* @description:
* While FreeType's CFF driver doesn't expose API functions by itself,
* it is possible to control its behaviour with @FT_Property_Set and
* @FT_Property_Get.
*
* The CFF driver's module name is `cff'.
*
* Available properties are @hinting-engine, @no-stem-darkening,
* @darkening-parameters, and @random-seed, as documented in the
* @properties section.
*
*
* *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine*
*
* The rasterizer is positioning horizontal features (e.g., ascender
* height & x-height, or crossbars) on the pixel grid and minimizing the
* amount of antialiasing applied to them, while placing vertical
* features (vertical stems) on the pixel grid without hinting, thus
* representing the stem position and weight accurately. Sometimes the
* vertical stems may be only partially black. In this context,
* `antialiasing' means that stems are not positioned exactly on pixel
* borders, causing a fuzzy appearance.
*
* There are two principles behind this approach.
*
* 1) No hinting in the horizontal direction: Unlike `superhinted'
* TrueType, which changes glyph widths to accommodate regular
* inter-glyph spacing, Adobe's approach is `faithful to the design' in
* representing both the glyph width and the inter-glyph spacing
* designed for the font. This makes the screen display as close as it
* can be to the result one would get with infinite resolution, while
* preserving what is considered the key characteristics of each glyph.
* Note that the distances between unhinted and grid-fitted positions at
* small sizes are comparable to kerning values and thus would be
* noticeable (and distracting) while reading if hinting were applied.
*
* One of the reasons to not hint horizontally is antialiasing for LCD
* screens: The pixel geometry of modern displays supplies three
* vertical subpixels as the eye moves horizontally across each visible
* pixel. On devices where we can be certain this characteristic is
* present a rasterizer can take advantage of the subpixels to add
* increments of weight. In Western writing systems this turns out to
* be the more critical direction anyway; the weights and spacing of
* vertical stems (see above) are central to Armenian, Cyrillic, Greek,
* and Latin type designs. Even when the rasterizer uses greyscale
* antialiasing instead of color (a necessary compromise when one
* doesn't know the screen characteristics), the unhinted vertical
* features preserve the design's weight and spacing much better than
* aliased type would.
*
* 2) Alignment in the vertical direction: Weights and spacing along the
* y~axis are less critical; what is much more important is the visual
* alignment of related features (like cap-height and x-height). The
* sense of alignment for these is enhanced by the sharpness of grid-fit
* edges, while the cruder vertical resolution (full pixels instead of
* 1/3 pixels) is less of a problem.
*
* On the technical side, horizontal alignment zones for ascender,
* x-height, and other important height values (traditionally called
* `blue zones') as defined in the font are positioned independently,
* each being rounded to the nearest pixel edge, taking care of
* overshoot suppression at small sizes, stem darkening, and scaling.
*
* Hstems (this is, hint values defined in the font to help align
* horizontal features) that fall within a blue zone are said to be
* `captured' and are aligned to that zone. Uncaptured stems are moved
* in one of four ways, top edge up or down, bottom edge up or down.
* Unless there are conflicting hstems, the smallest movement is taken
* to minimize distortion.
*
*/
/**************************************************************************
*
* @section:
* pcf_driver
*
* @title:
* The PCF driver
*
* @abstract:
* Controlling the PCF driver module.
*
* @description:
* While FreeType's PCF driver doesn't expose API functions by itself,
* it is possible to control its behaviour with @FT_Property_Set and
* @FT_Property_Get. Right now, there is a single property
* @no-long-family-names available if FreeType is compiled with
* PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.
*
* The PCF driver's module name is `pcf'.
*
*/
/**************************************************************************
*
* @section:
* t1_cid_driver
*
* @title:
* The Type 1 and CID drivers
*
* @abstract:
* Controlling the Type~1 and CID driver modules.
*
* @description:
* It is possible to control the behaviour of FreeType's Type~1 and
* Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get.
*
* Behind the scenes, both drivers use the Adobe CFF engine for hinting;
* however, the used properties must be specified separately.
*
* The Type~1 driver's module name is `type1'; the CID driver's module
* name is `t1cid'.
*
* Available properties are @hinting-engine, @no-stem-darkening,
* @darkening-parameters, and @random-seed, as documented in the
* @properties section.
*
* Please see the @cff_driver section for more details on the new
* hinting engine.
*
*/
/**************************************************************************
*
* @section:
* tt_driver
*
* @title:
* The TrueType driver
*
* @abstract:
* Controlling the TrueType driver module.
*
* @description:
* While FreeType's TrueType driver doesn't expose API functions by
* itself, it is possible to control its behaviour with @FT_Property_Set
* and @FT_Property_Get. The following lists the available properties
* together with the necessary macros and structures.
*
* The TrueType driver's module name is `truetype'.
*
* A single property @interpreter-version is available, as documented in
* the @properties section.
*
* We start with a list of definitions, kindly provided by Greg
* Hitchcock.
*
* _Bi-Level_ _Rendering_
*
* Monochromatic rendering, exclusively used in the early days of
* TrueType by both Apple and Microsoft. Microsoft's GDI interface
* supported hinting of the right-side bearing point, such that the
* advance width could be non-linear. Most often this was done to
* achieve some level of glyph symmetry. To enable reasonable
* performance (e.g., not having to run hinting on all glyphs just to
* get the widths) there was a bit in the head table indicating if the
* side bearing was hinted, and additional tables, `hdmx' and `LTSH', to
* cache hinting widths across multiple sizes and device aspect ratios.
*
* _Font_ _Smoothing_
*
* Microsoft's GDI implementation of anti-aliasing. Not traditional
* anti-aliasing as the outlines were hinted before the sampling. The
* widths matched the bi-level rendering.
*
* _ClearType_ _Rendering_
*
* Technique that uses physical subpixels to improve rendering on LCD
* (and other) displays. Because of the higher resolution, many methods
* of improving symmetry in glyphs through hinting the right-side
* bearing were no longer necessary. This lead to what GDI calls
* `natural widths' ClearType, see
* http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting
* has extra resolution, most non-linearity went away, but it is still
* possible for hints to change the advance widths in this mode.
*
* _ClearType_ _Compatible_ _Widths_
*
* One of the earliest challenges with ClearType was allowing the
* implementation in GDI to be selected without requiring all UI and
* documents to reflow. To address this, a compatible method of
* rendering ClearType was added where the font hints are executed once
* to determine the width in bi-level rendering, and then re-run in
* ClearType, with the difference in widths being absorbed in the font
* hints for ClearType (mostly in the white space of hints); see
* http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by
* definition, compatible width ClearType allows for non-linear widths,
* but only when the bi-level version has non-linear widths.
*
* _ClearType_ _Subpixel_ _Positioning_
*
* One of the nice benefits of ClearType is the ability to more crisply
* display fractional widths; unfortunately, the GDI model of integer
* bitmaps did not support this. However, the WPF and Direct Write
* frameworks do support fractional widths. DWrite calls this `natural
* mode', not to be confused with GDI's `natural widths'. Subpixel
* positioning, in the current implementation of Direct Write,
* unfortunately does not support hinted advance widths, see
* http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the
* TrueType interpreter fully allows the advance width to be adjusted in
* this mode, just the DWrite client will ignore those changes.
*
* _ClearType_ _Backward_ _Compatibility_
*
* This is a set of exceptions made in the TrueType interpreter to
* minimize hinting techniques that were problematic with the extra
* resolution of ClearType; see
* http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx.
* This technique is not to be confused with ClearType compatible
* widths. ClearType backward compatibility has no direct impact on
* changing advance widths, but there might be an indirect impact on
* disabling some deltas. This could be worked around in backward
* compatibility mode.
*
* _Native_ _ClearType_ _Mode_
*
* (Not to be confused with `natural widths'.) This mode removes all
* the exceptions in the TrueType interpreter when running with
* ClearType. Any issues on widths would still apply, though.
*
*/
/**************************************************************************
*
* @section:
* properties
*
* @title:
* Driver properties
*
* @abstract:
* Controlling driver modules.
*
* @description:
* Driver modules can be controlled by setting and unsetting properties,
* using the functions @FT_Property_Set and @FT_Property_Get. This
* section documents the available properties, together with auxiliary
* macros and structures.
*
*/
/**************************************************************************
*
* @enum:
* FT_HINTING_XXX
*
* @description:
* A list of constants used for the @hinting-engine property to
* select the hinting engine for CFF, Type~1, and CID fonts.
*
* @values:
* FT_HINTING_FREETYPE ::
* Use the old FreeType hinting engine.
*
* FT_HINTING_ADOBE ::
* Use the hinting engine contributed by Adobe.
*
* @since:
* 2.9
*
*/
#define FT_HINTING_FREETYPE 0
#define FT_HINTING_ADOBE 1
/* these constants (introduced in 2.4.12) are deprecated */
#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE
#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE
/**************************************************************************
*
* @property:
* hinting-engine
*
* @description:
* Thanks to Adobe, which contributed a new hinting (and parsing)
* engine, an application can select between `freetype' and `adobe' if
* compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration
* macro isn't defined, `hinting-engine' does nothing.
*
* The same holds for the Type~1 and CID modules if compiled with
* T1_CONFIG_OPTION_OLD_ENGINE.
*
* For the `cff' module, the default engine is `freetype' if
* CFF_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' otherwise.
*
* For both the `type1' and `t1cid' modules, the default engine is
* `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe'
* otherwise.
*
* The following example code demonstrates how to select Adobe's hinting
* engine for the `cff' module (omitting the error handling).
*
* {
* FT_Library library;
* FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "cff",
* "hinting-engine", &hinting_engine );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable (using values `adobe' or `freetype').
*
* @since:
* 2.4.12 (for `cff' module)
*
* 2.9 (for `type1' and `t1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* no-stem-darkening
*
* @description:
* All glyphs that pass through the auto-hinter will be emboldened
* unless this property is set to TRUE. The same is true for the CFF,
* Type~1, and CID font modules if the `Adobe' engine is selected (which
* is the default).
*
* Stem darkening emboldens glyphs at smaller sizes to make them more
* readable on common low-DPI screens when using linear alpha blending
* and gamma correction, see @FT_Render_Glyph. When not using linear
* alpha blending and gamma correction, glyphs will appear heavy and
* fuzzy!
*
* Gamma correction essentially lightens fonts since shades of grey are
* shifted to higher pixel values (=~higher brightness) to match the
* original intention to the reality of our screens. The side-effect is
* that glyphs `thin out'. Mac OS~X and Adobe's proprietary font
* rendering library implement a counter-measure: stem darkening at
* smaller sizes where shades of gray dominate. By emboldening a glyph
* slightly in relation to its pixel size, individual pixels get higher
* coverage of filled-in outlines and are therefore `blacker'. This
* counteracts the `thinning out' of glyphs, making text remain readable
* at smaller sizes.
*
* By default, the Adobe engines for CFF, Type~1, and CID fonts darken
* stems at smaller sizes, regardless of hinting, to enhance contrast.
* Setting this property, stem darkening gets switched off.
*
* For the auto-hinter, stem-darkening is experimental currently and
* thus switched off by default (this is, `no-stem-darkening' is set to
* TRUE by default). Total consistency with the CFF driver is not
* achieved right now because the emboldening method differs and glyphs
* must be scaled down on the Y-axis to keep outline points inside their
* precomputed blue zones. The smaller the size (especially 9ppem and
* down), the higher the loss of emboldening versus the CFF driver.
*
* Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is
* set.
*
* {
* FT_Library library;
* FT_Bool no_stem_darkening = TRUE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "cff",
* "no-stem-darkening", &no_stem_darkening );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable (using values 1 and 0 for `on' and `off', respectively).
* It can also be set per face using @FT_Face_Properties with
* @FT_PARAM_TAG_STEM_DARKENING.
*
* @since:
* 2.4.12 (for `cff' module)
*
* 2.6.2 (for `autofitter' module)
*
* 2.9 (for `type1' and `t1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* darkening-parameters
*
* @description:
* By default, the Adobe hinting engine, as used by the CFF, Type~1, and
* CID font drivers, darkens stems as follows (if the
* `no-stem-darkening' property isn't set):
*
* {
* stem width <= 0.5px: darkening amount = 0.4px
* stem width = 1px: darkening amount = 0.275px
* stem width = 1.667px: darkening amount = 0.275px
* stem width >= 2.333px: darkening amount = 0px
* }
*
* and piecewise linear in-between. At configuration time, these four
* control points can be set with the macro
* `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'; the CFF, Type~1, and CID
* drivers share these values. At runtime, the control points can be
* changed using the `darkening-parameters' property, as the following
* example demonstrates for the Type~1 driver.
*
* {
* FT_Library library;
* FT_Int darken_params[8] = { 500, 300, // x1, y1
* 1000, 200, // x2, y2
* 1500, 100, // x3, y3
* 2000, 0 }; // x4, y4
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "type1",
* "darkening-parameters", darken_params );
* }
*
* The x~values give the stem width, and the y~values the darkening
* amount. The unit is 1000th of pixels. All coordinate values must be
* positive; the x~values must be monotonically increasing; the
* y~values must be monotonically decreasing and smaller than or
* equal to 500 (corresponding to half a pixel); the slope of each
* linear piece must be shallower than -1 (e.g., -.4).
*
* The auto-hinter provides this property, too, as an experimental
* feature. See @no-stem-darkening for more.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable, using eight comma-separated integers without spaces. Here
* the above example, using `\' to break the line for readability.
*
* {
* FREETYPE_PROPERTIES=\
* type1:darkening-parameters=500,300,1000,200,1500,100,2000,0
* }
*
* @since:
* 2.5.1 (for `cff' module)
*
* 2.6.2 (for `autofitter' module)
*
* 2.9 (for `type1' and `t1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* random-seed
*
* @description:
* By default, the seed value for the CFF `random' operator and the
* similar `0 28 callothersubr pop' command for the Type~1 and CID
* drivers is set to a random value. However, mainly for debugging
* purposes, it is often necessary to use a known value as a seed so
* that the pseudo-random number sequences generated by `random' are
* repeatable.
*
* The `random-seed' property does that. Its argument is a signed 32bit
* integer; if the value is zero or negative, the seed given by the
* `intitialRandomSeed' private DICT operator in a CFF file gets used
* (or a default value if there is no such operator). If the value is
* positive, use it instead of `initialRandomSeed', which is
* consequently ignored.
*
* @note:
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable. It can also be set per face using @FT_Face_Properties with
* @FT_PARAM_TAG_RANDOM_SEED.
*
* @since:
* 2.8 (for `cff' module)
*
* 2.9 (for `type1' and `t1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* no-long-family-names
*
* @description:
* If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling
* FreeType, the PCF driver constructs long family names.
*
* There are many PCF fonts just called `Fixed' which look completely
* different, and which have nothing to do with each other. When
* selecting `Fixed' in KDE or Gnome one gets results that appear rather
* random, the style changes often if one changes the size and one
* cannot select some fonts at all. The improve this situation, the PCF
* module prepends the foundry name (plus a space) to the family name.
* It also checks whether there are `wide' characters; all put together,
* family names like `Sony Fixed' or `Misc Fixed Wide' are constructed.
*
* If `no-long-family-names' is set, this feature gets switched off.
*
* {
* FT_Library library;
* FT_Bool no_long_family_names = TRUE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "pcf",
* "no-long-family-names",
* &no_long_family_names );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable (using values 1 and 0 for `on' and `off', respectively).
*
* @since:
* 2.8
*/
/**************************************************************************
*
* @enum:
* TT_INTERPRETER_VERSION_XXX
*
* @description:
* A list of constants used for the @interpreter-version property to
* select the hinting engine for Truetype fonts.
*
* The numeric value in the constant names represents the version
* number as returned by the `GETINFO' bytecode instruction.
*
* @values:
* TT_INTERPRETER_VERSION_35 ::
* Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in
* Windows~98; only grayscale and B/W rasterizing is supported.
*
* TT_INTERPRETER_VERSION_38 ::
* Version~38 corresponds to MS rasterizer v.1.9; it is roughly
* equivalent to the hinting provided by DirectWrite ClearType (as can
* be found, for example, in the Internet Explorer~9 running on
* Windows~7). It is used in FreeType to select the `Infinality'
* subpixel hinting code. The code may be removed in a future
* version.
*
* TT_INTERPRETER_VERSION_40 ::
* Version~40 corresponds to MS rasterizer v.2.1; it is roughly
* equivalent to the hinting provided by DirectWrite ClearType (as can
* be found, for example, in Microsoft's Edge Browser on Windows~10).
* It is used in FreeType to select the `minimal' subpixel hinting
* code, a stripped-down and higher performance version of the
* `Infinality' code.
*
* @note:
* This property controls the behaviour of the bytecode interpreter
* and thus how outlines get hinted. It does *not* control how glyph
* get rasterized! In particular, it does not control subpixel color
* filtering.
*
* If FreeType has not been compiled with the configuration option
* TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes
* an `FT_Err_Unimplemented_Feature' error.
*
* Depending on the graphics framework, Microsoft uses different
* bytecode and rendering engines. As a consequence, the version
* numbers returned by a call to the `GETINFO' bytecode instruction are
* more convoluted than desired.
*
* Here are two tables that try to shed some light on the possible
* values for the MS rasterizer engine, together with the additional
* features introduced by it.
*
* {
* GETINFO framework version feature
* -------------------------------------------------------------------
* 3 GDI (Win 3.1), v1.0 16-bit, first version
* TrueImage
* 33 GDI (Win NT 3.1), v1.5 32-bit
* HP Laserjet
* 34 GDI (Win 95) v1.6 font smoothing,
* new SCANTYPE opcode
* 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET
* bits in composite glyphs
* 36 MGDI (Win CE 2) v1.6+ classic ClearType
* 37 GDI (XP and later), v1.8 ClearType
* GDI+ old (before Vista)
* 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType,
* WPF Y-direction ClearType,
* additional error checking
* 39 DWrite (before Win 8) v2.0 subpixel ClearType flags
* in GETINFO opcode,
* bug fixes
* 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag
* DWrite (Win 8) in GETINFO opcode,
* Gray ClearType
* }
*
* The `version' field gives a rough orientation only, since some
* applications provided certain features much earlier (as an example,
* Microsoft Reader used subpixel and Y-direction ClearType already in
* Windows 2000). Similarly, updates to a given framework might include
* improved hinting support.
*
* {
* version sampling rendering comment
* x y x y
* --------------------------------------------------------------
* v1.0 normal normal B/W B/W bi-level
* v1.6 high high gray gray grayscale
* v1.8 high normal color-filter B/W (GDI) ClearType
* v1.9 high high color-filter gray Color ClearType
* v2.1 high normal gray B/W Gray ClearType
* v2.1 high high gray gray Gray ClearType
* }
*
* Color and Gray ClearType are the two available variants of
* `Y-direction ClearType', meaning grayscale rasterization along the
* Y-direction; the name used in the TrueType specification for this
* feature is `symmetric smoothing'. `Classic ClearType' is the
* original algorithm used before introducing a modified version in
* Win~XP. Another name for v1.6's grayscale rendering is `font
* smoothing', and `Color ClearType' is sometimes also called `DWrite
* ClearType'. To differentiate between today's Color ClearType and the
* earlier ClearType variant with B/W rendering along the vertical axis,
* the latter is sometimes called `GDI ClearType'.
*
* `Normal' and `high' sampling describe the (virtual) resolution to
* access the rasterized outline after the hinting process. `Normal'
* means 1 sample per grid line (i.e., B/W). In the current Microsoft
* implementation, `high' means an extra virtual resolution of 16x16 (or
* 16x1) grid lines per pixel for bytecode instructions like `MIRP'.
* After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid
* lines for color filtering if Color ClearType is activated.
*
* Note that `Gray ClearType' is essentially the same as v1.6's
* grayscale rendering. However, the GETINFO instruction handles it
* differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1
* returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing),
* and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for
* the version~1 gasp table exclusively (like Color ClearType), while
* v1.6 only respects the values of version~0 (bits 0 and~1).
*
* Keep in mind that the features of the above interpreter versions
* might not map exactly to FreeType features or behavior because it is
* a fundamentally different library with different internals.
*
*/
#define TT_INTERPRETER_VERSION_35 35
#define TT_INTERPRETER_VERSION_38 38
#define TT_INTERPRETER_VERSION_40 40
/**************************************************************************
*
* @property:
* interpreter-version
*
* @description:
* Currently, three versions are available, two representing the
* bytecode interpreter with subpixel hinting support (old `Infinality'
* code and new stripped-down and higher performance `minimal' code) and
* one without, respectively. The default is subpixel support if
* TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support
* otherwise (since it isn't available then).
*
* If subpixel hinting is on, many TrueType bytecode instructions behave
* differently compared to B/W or grayscale rendering (except if `native
* ClearType' is selected by the font). Microsoft's main idea is to
* render at a much increased horizontal resolution, then sampling down
* the created output to subpixel precision. However, many older fonts
* are not suited to this and must be specially taken care of by
* applying (hardcoded) tweaks in Microsoft's interpreter.
*
* Details on subpixel hinting and some of the necessary tweaks can be
* found in Greg Hitchcock's whitepaper at
* `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.
* Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2,
* or 6x5 supersampling) like discussed in the paper. Depending on the
* chosen interpreter, it simply ignores instructions on vertical stems
* to arrive at very similar results.
*
* The following example code demonstrates how to deactivate subpixel
* hinting (omitting the error handling).
*
* {
* FT_Library library;
* FT_Face face;
* FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "truetype",
* "interpreter-version",
* &interpreter_version );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable (using values `35', `38', or `40').
*
* @since:
* 2.5
*/
/**************************************************************************
*
* @property:
* glyph-to-script-map
*
* @description:
* *Experimental* *only*
*
* The auto-hinter provides various script modules to hint glyphs.
* Examples of supported scripts are Latin or CJK. Before a glyph is
* auto-hinted, the Unicode character map of the font gets examined, and
* the script is then determined based on Unicode character ranges, see
* below.
*
* OpenType fonts, however, often provide much more glyphs than
* character codes (small caps, superscripts, ligatures, swashes, etc.),
* to be controlled by so-called `features'. Handling OpenType features
* can be quite complicated and thus needs a separate library on top of
* FreeType.
*
* The mapping between glyph indices and scripts (in the auto-hinter
* sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an
* array with `num_glyphs' elements, as found in the font's @FT_Face
* structure. The `glyph-to-script-map' property returns a pointer to
* this array, which can be modified as needed. Note that the
* modification should happen before the first glyph gets processed by
* the auto-hinter so that the global analysis of the font shapes
* actually uses the modified mapping.
*
* The following example code demonstrates how to access it (omitting
* the error handling).
*
* {
* FT_Library library;
* FT_Face face;
* FT_Prop_GlyphToScriptMap prop;
*
*
* FT_Init_FreeType( &library );
* FT_New_Face( library, "foo.ttf", 0, &face );
*
* prop.face = face;
*
* FT_Property_Get( library, "autofitter",
* "glyph-to-script-map", &prop );
*
* // adjust `prop.map' as needed right here
*
* FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );
* }
*
* @since:
* 2.4.11
*
*/
/**************************************************************************
*
* @enum:
* FT_AUTOHINTER_SCRIPT_XXX
*
* @description:
* *Experimental* *only*
*
* A list of constants used for the @glyph-to-script-map property to
* specify the script submodule the auto-hinter should use for hinting a
* particular glyph.
*
* @values:
* FT_AUTOHINTER_SCRIPT_NONE ::
* Don't auto-hint this glyph.
*
* FT_AUTOHINTER_SCRIPT_LATIN ::
* Apply the latin auto-hinter. For the auto-hinter, `latin' is a
* very broad term, including Cyrillic and Greek also since characters
* from those scripts share the same design constraints.
*
* By default, characters from the following Unicode ranges are
* assigned to this submodule.
*
* {
* U+0020 - U+007F // Basic Latin (no control characters)
* U+00A0 - U+00FF // Latin-1 Supplement (no control characters)
* U+0100 - U+017F // Latin Extended-A
* U+0180 - U+024F // Latin Extended-B
* U+0250 - U+02AF // IPA Extensions
* U+02B0 - U+02FF // Spacing Modifier Letters
* U+0300 - U+036F // Combining Diacritical Marks
* U+0370 - U+03FF // Greek and Coptic
* U+0400 - U+04FF // Cyrillic
* U+0500 - U+052F // Cyrillic Supplement
* U+1D00 - U+1D7F // Phonetic Extensions
* U+1D80 - U+1DBF // Phonetic Extensions Supplement
* U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement
* U+1E00 - U+1EFF // Latin Extended Additional
* U+1F00 - U+1FFF // Greek Extended
* U+2000 - U+206F // General Punctuation
* U+2070 - U+209F // Superscripts and Subscripts
* U+20A0 - U+20CF // Currency Symbols
* U+2150 - U+218F // Number Forms
* U+2460 - U+24FF // Enclosed Alphanumerics
* U+2C60 - U+2C7F // Latin Extended-C
* U+2DE0 - U+2DFF // Cyrillic Extended-A
* U+2E00 - U+2E7F // Supplemental Punctuation
* U+A640 - U+A69F // Cyrillic Extended-B
* U+A720 - U+A7FF // Latin Extended-D
* U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures)
* U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols
* U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement
* }
*
* FT_AUTOHINTER_SCRIPT_CJK ::
* Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old
* Vietnamese, and some other scripts.
*
* By default, characters from the following Unicode ranges are
* assigned to this submodule.
*
* {
* U+1100 - U+11FF // Hangul Jamo
* U+2E80 - U+2EFF // CJK Radicals Supplement
* U+2F00 - U+2FDF // Kangxi Radicals
* U+2FF0 - U+2FFF // Ideographic Description Characters
* U+3000 - U+303F // CJK Symbols and Punctuation
* U+3040 - U+309F // Hiragana
* U+30A0 - U+30FF // Katakana
* U+3100 - U+312F // Bopomofo
* U+3130 - U+318F // Hangul Compatibility Jamo
* U+3190 - U+319F // Kanbun
* U+31A0 - U+31BF // Bopomofo Extended
* U+31C0 - U+31EF // CJK Strokes
* U+31F0 - U+31FF // Katakana Phonetic Extensions
* U+3200 - U+32FF // Enclosed CJK Letters and Months
* U+3300 - U+33FF // CJK Compatibility
* U+3400 - U+4DBF // CJK Unified Ideographs Extension A
* U+4DC0 - U+4DFF // Yijing Hexagram Symbols
* U+4E00 - U+9FFF // CJK Unified Ideographs
* U+A960 - U+A97F // Hangul Jamo Extended-A
* U+AC00 - U+D7AF // Hangul Syllables
* U+D7B0 - U+D7FF // Hangul Jamo Extended-B
* U+F900 - U+FAFF // CJK Compatibility Ideographs
* U+FE10 - U+FE1F // Vertical forms
* U+FE30 - U+FE4F // CJK Compatibility Forms
* U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms
* U+1B000 - U+1B0FF // Kana Supplement
* U+1D300 - U+1D35F // Tai Xuan Hing Symbols
* U+1F200 - U+1F2FF // Enclosed Ideographic Supplement
* U+20000 - U+2A6DF // CJK Unified Ideographs Extension B
* U+2A700 - U+2B73F // CJK Unified Ideographs Extension C
* U+2B740 - U+2B81F // CJK Unified Ideographs Extension D
* U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement
* }
*
* FT_AUTOHINTER_SCRIPT_INDIC ::
* Apply the indic auto-hinter, covering all major scripts from the
* Indian sub-continent and some other related scripts like Thai, Lao,
* or Tibetan.
*
* By default, characters from the following Unicode ranges are
* assigned to this submodule.
*
* {
* U+0900 - U+0DFF // Indic Range
* U+0F00 - U+0FFF // Tibetan
* U+1900 - U+194F // Limbu
* U+1B80 - U+1BBF // Sundanese
* U+A800 - U+A82F // Syloti Nagri
* U+ABC0 - U+ABFF // Meetei Mayek
* U+11800 - U+118DF // Sharada
* }
*
* Note that currently Indic support is rudimentary only, missing blue
* zone support.
*
* @since:
* 2.4.11
*
*/
#define FT_AUTOHINTER_SCRIPT_NONE 0
#define FT_AUTOHINTER_SCRIPT_LATIN 1
#define FT_AUTOHINTER_SCRIPT_CJK 2
#define FT_AUTOHINTER_SCRIPT_INDIC 3
/**************************************************************************
*
* @struct:
* FT_Prop_GlyphToScriptMap
*
* @description:
* *Experimental* *only*
*
* The data exchange structure for the @glyph-to-script-map property.
*
* @since:
* 2.4.11
*
*/
typedef struct FT_Prop_GlyphToScriptMap_
{
FT_Face face;
FT_UShort* map;
} FT_Prop_GlyphToScriptMap;
/**************************************************************************
*
* @property:
* fallback-script
*
* @description:
* *Experimental* *only*
*
* If no auto-hinter script module can be assigned to a glyph, a
* fallback script gets assigned to it (see also the
* @glyph-to-script-map property). By default, this is
* @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property,
* this fallback value can be changed.
*
* {
* FT_Library library;
* FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "autofitter",
* "fallback-script", &fallback_script );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* It's important to use the right timing for changing this value: The
* creation of the glyph-to-script map that eventually uses the
* fallback script value gets triggered either by setting or reading a
* face-specific property like @glyph-to-script-map, or by auto-hinting
* any glyph from that face. In particular, if you have already created
* an @FT_Face structure but not loaded any glyph (using the
* auto-hinter), a change of the fallback script will affect this face.
*
* @since:
* 2.4.11
*
*/
/**************************************************************************
*
* @property:
* default-script
*
* @description:
* *Experimental* *only*
*
* If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make
* the HarfBuzz library access OpenType features for getting better
* glyph coverages, this property sets the (auto-fitter) script to be
* used for the default (OpenType) script data of a font's GSUB table.
* Features for the default script are intended for all scripts not
* explicitly handled in GSUB; an example is a `dlig' feature,
* containing the combination of the characters `T', `E', and `L' to
* form a `TEL' ligature.
*
* By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the
* `default-script' property, this default value can be changed.
*
* {
* FT_Library library;
* FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "autofitter",
* "default-script", &default_script );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* It's important to use the right timing for changing this value: The
* creation of the glyph-to-script map that eventually uses the
* default script value gets triggered either by setting or reading a
* face-specific property like @glyph-to-script-map, or by auto-hinting
* any glyph from that face. In particular, if you have already created
* an @FT_Face structure but not loaded any glyph (using the
* auto-hinter), a change of the default script will affect this face.
*
* @since:
* 2.5.3
*
*/
/**************************************************************************
*
* @property:
* increase-x-height
*
* @description:
* For ppem values in the range 6~<= ppem <= `increase-x-height', round
* up the font's x~height much more often than normally. If the value
* is set to~0, which is the default, this feature is switched off. Use
* this property to improve the legibility of small font sizes if
* necessary.
*
* {
* FT_Library library;
* FT_Face face;
* FT_Prop_IncreaseXHeight prop;
*
*
* FT_Init_FreeType( &library );
* FT_New_Face( library, "foo.ttf", 0, &face );
* FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );
*
* prop.face = face;
* prop.limit = 14;
*
* FT_Property_Set( library, "autofitter",
* "increase-x-height", &prop );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* Set this value right after calling @FT_Set_Char_Size, but before
* loading any glyph (using the auto-hinter).
*
* @since:
* 2.4.11
*
*/
/**************************************************************************
*
* @struct:
* FT_Prop_IncreaseXHeight
*
* @description:
* The data exchange structure for the @increase-x-height property.
*
*/
typedef struct FT_Prop_IncreaseXHeight_
{
FT_Face face;
FT_UInt limit;
} FT_Prop_IncreaseXHeight;
/**************************************************************************
*
* @property:
* warping
*
* @description:
* *Experimental* *only*
*
* If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to
* activate the warp hinting code in the auto-hinter, this property
* switches warping on and off.
*
* Warping only works in `normal' auto-hinting mode replacing it.
* The idea of the code is to slightly scale and shift a glyph along
* the non-hinted dimension (which is usually the horizontal axis) so
* that as much of its segments are aligned (more or less) to the grid.
* To find out a glyph's optimal scaling and shifting value, various
* parameter combinations are tried and scored.
*
* By default, warping is off. The example below shows how to switch on
* warping (omitting the error handling).
*
* {
* FT_Library library;
* FT_Bool warping = 1;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "autofitter",
* "warping", &warping );
* }
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES' environment
* variable (using values 1 and 0 for `on' and `off', respectively).
*
* The warping code can also change advance widths. Have a look at the
* `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure
* for details on improving inter-glyph distances while rendering.
*
* Since warping is a global property of the auto-hinter it is best to
* change its value before rendering any face. Otherwise, you should
* reload all faces that get auto-hinted in `normal' hinting mode.
*
* @since:
* 2.6
*
*/
/* */
FT_END_HEADER
#endif /* FTDRIVER_H_ */
/* END */
/***************************************************************************/
/* */
/* ftoutln.h */
/* */
/* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTOUTLN_H_
#define FTOUTLN_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* outline_processing */
/* */
/* <Title> */
/* Outline Processing */
/* */
/* <Abstract> */
/* Functions to create, transform, and render vectorial glyph images. */
/* */
/* <Description> */
/* This section contains routines used to create and destroy scalable */
/* glyph images known as `outlines'. These can also be measured, */
/* transformed, and converted into bitmaps and pixmaps. */
/* */
/* <Order> */
/* FT_Outline */
/* FT_Outline_New */
/* FT_Outline_Done */
/* FT_Outline_Copy */
/* FT_Outline_Translate */
/* FT_Outline_Transform */
/* FT_Outline_Embolden */
/* FT_Outline_EmboldenXY */
/* FT_Outline_Reverse */
/* FT_Outline_Check */
/* */
/* FT_Outline_Get_CBox */
/* FT_Outline_Get_BBox */
/* */
/* FT_Outline_Get_Bitmap */
/* FT_Outline_Render */
/* FT_Outline_Decompose */
/* FT_Outline_Funcs */
/* FT_Outline_MoveToFunc */
/* FT_Outline_LineToFunc */
/* FT_Outline_ConicToFunc */
/* FT_Outline_CubicToFunc */
/* */
/* FT_Orientation */
/* FT_Outline_Get_Orientation */
/* */
/* FT_OUTLINE_XXX */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Decompose */
/* */
/* <Description> */
/* Walk over an outline's structure to decompose it into individual */
/* segments and Bezier arcs. This function also emits `move to' */
/* operations to indicate the start of new contours in the outline. */
/* */
/* <Input> */
/* outline :: A pointer to the source target. */
/* */
/* func_interface :: A table of `emitters', i.e., function pointers */
/* called during decomposition to indicate path */
/* operations. */
/* */
/* <InOut> */
/* user :: A typeless pointer that is passed to each */
/* emitter during the decomposition. It can be */
/* used to store the state during the */
/* decomposition. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* A contour that contains a single point only is represented by a */
/* `move to' operation followed by `line to' to the same point. In */
/* most cases, it is best to filter this out before using the */
/* outline for stroking purposes (otherwise it would result in a */
/* visible dot when round caps are used). */
/* */
/* Similarly, the function returns success for an empty outline also */
/* (doing nothing, this is, not calling any emitter); if necessary, */
/* you should filter this out, too. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Decompose( FT_Outline* outline,
const FT_Outline_Funcs* func_interface,
void* user );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_New */
/* */
/* <Description> */
/* Create a new outline of a given size. */
/* */
/* <Input> */
/* library :: A handle to the library object from where the */
/* outline is allocated. Note however that the new */
/* outline will *not* necessarily be *freed*, when */
/* destroying the library, by @FT_Done_FreeType. */
/* */
/* numPoints :: The maximum number of points within the outline. */
/* Must be smaller than or equal to 0xFFFF (65535). */
/* */
/* numContours :: The maximum number of contours within the outline. */
/* This value must be in the range 0 to `numPoints'. */
/* */
/* <Output> */
/* anoutline :: A handle to the new outline. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The reason why this function takes a `library' parameter is simply */
/* to use the library's memory allocator. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_New( FT_Library library,
FT_UInt numPoints,
FT_Int numContours,
FT_Outline *anoutline );
FT_EXPORT( FT_Error )
FT_Outline_New_Internal( FT_Memory memory,
FT_UInt numPoints,
FT_Int numContours,
FT_Outline *anoutline );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Done */
/* */
/* <Description> */
/* Destroy an outline created with @FT_Outline_New. */
/* */
/* <Input> */
/* library :: A handle of the library object used to allocate the */
/* outline. */
/* */
/* outline :: A pointer to the outline object to be discarded. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* If the outline's `owner' field is not set, only the outline */
/* descriptor will be released. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Done( FT_Library library,
FT_Outline* outline );
FT_EXPORT( FT_Error )
FT_Outline_Done_Internal( FT_Memory memory,
FT_Outline* outline );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Check */
/* */
/* <Description> */
/* Check the contents of an outline descriptor. */
/* */
/* <Input> */
/* outline :: A handle to a source outline. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* An empty outline, or an outline with a single point only is also */
/* valid. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Check( FT_Outline* outline );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Get_CBox */
/* */
/* <Description> */
/* Return an outline's `control box'. The control box encloses all */
/* the outline's points, including Bezier control points. Though it */
/* coincides with the exact bounding box for most glyphs, it can be */
/* slightly larger in some situations (like when rotating an outline */
/* that contains Bezier outside arcs). */
/* */
/* Computing the control box is very fast, while getting the bounding */
/* box can take much more time as it needs to walk over all segments */
/* and arcs in the outline. To get the latter, you can use the */
/* `ftbbox' component, which is dedicated to this single task. */
/* */
/* <Input> */
/* outline :: A pointer to the source outline descriptor. */
/* */
/* <Output> */
/* acbox :: The outline's control box. */
/* */
/* <Note> */
/* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */
/* */
FT_EXPORT( void )
FT_Outline_Get_CBox( const FT_Outline* outline,
FT_BBox *acbox );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Translate */
/* */
/* <Description> */
/* Apply a simple translation to the points of an outline. */
/* */
/* <InOut> */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* <Input> */
/* xOffset :: The horizontal offset. */
/* */
/* yOffset :: The vertical offset. */
/* */
FT_EXPORT( void )
FT_Outline_Translate( const FT_Outline* outline,
FT_Pos xOffset,
FT_Pos yOffset );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Copy */
/* */
/* <Description> */
/* Copy an outline into another one. Both objects must have the */
/* same sizes (number of points & number of contours) when this */
/* function is called. */
/* */
/* <Input> */
/* source :: A handle to the source outline. */
/* */
/* <Output> */
/* target :: A handle to the target outline. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Copy( const FT_Outline* source,
FT_Outline *target );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Transform */
/* */
/* <Description> */
/* Apply a simple 2x2 matrix to all of an outline's points. Useful */
/* for applying rotations, slanting, flipping, etc. */
/* */
/* <InOut> */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* <Input> */
/* matrix :: A pointer to the transformation matrix. */
/* */
/* <Note> */
/* You can use @FT_Outline_Translate if you need to translate the */
/* outline's points. */
/* */
FT_EXPORT( void )
FT_Outline_Transform( const FT_Outline* outline,
const FT_Matrix* matrix );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Embolden */
/* */
/* <Description> */
/* Embolden an outline. The new outline will be at most 4~times */
/* `strength' pixels wider and higher. You may think of the left and */
/* bottom borders as unchanged. */
/* */
/* Negative `strength' values to reduce the outline thickness are */
/* possible also. */
/* */
/* <InOut> */
/* outline :: A handle to the target outline. */
/* */
/* <Input> */
/* strength :: How strong the glyph is emboldened. Expressed in */
/* 26.6 pixel format. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The used algorithm to increase or decrease the thickness of the */
/* glyph doesn't change the number of points; this means that certain */
/* situations like acute angles or intersections are sometimes */
/* handled incorrectly. */
/* */
/* If you need `better' metrics values you should call */
/* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */
/* */
/* Example call: */
/* */
/* { */
/* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */
/* if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) */
/* FT_Outline_Embolden( &face->glyph->outline, strength ); */
/* } */
/* */
/* To get meaningful results, font scaling values must be set with */
/* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Embolden( FT_Outline* outline,
FT_Pos strength );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_EmboldenXY */
/* */
/* <Description> */
/* Embolden an outline. The new outline will be `xstrength' pixels */
/* wider and `ystrength' pixels higher. Otherwise, it is similar to */
/* @FT_Outline_Embolden, which uses the same strength in both */
/* directions. */
/* */
/* <Since> */
/* 2.4.10 */
/* */
FT_EXPORT( FT_Error )
FT_Outline_EmboldenXY( FT_Outline* outline,
FT_Pos xstrength,
FT_Pos ystrength );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Reverse */
/* */
/* <Description> */
/* Reverse the drawing direction of an outline. This is used to */
/* ensure consistent fill conventions for mirrored glyphs. */
/* */
/* <InOut> */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* <Note> */
/* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */
/* the outline's `flags' field. */
/* */
/* It shouldn't be used by a normal client application, unless it */
/* knows what it is doing. */
/* */
FT_EXPORT( void )
FT_Outline_Reverse( FT_Outline* outline );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Get_Bitmap */
/* */
/* <Description> */
/* Render an outline within a bitmap. The outline's image is simply */
/* OR-ed to the target bitmap. */
/* */
/* <Input> */
/* library :: A handle to a FreeType library object. */
/* */
/* outline :: A pointer to the source outline descriptor. */
/* */
/* <InOut> */
/* abitmap :: A pointer to the target bitmap descriptor. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function does NOT CREATE the bitmap, it only renders an */
/* outline image within the one you pass to it! Consequently, the */
/* various fields in `abitmap' should be set accordingly. */
/* */
/* It will use the raster corresponding to the default glyph format. */
/* */
/* The value of the `num_grays' field in `abitmap' is ignored. If */
/* you select the gray-level rasterizer, and you want less than 256 */
/* gray levels, you have to use @FT_Outline_Render directly. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Get_Bitmap( FT_Library library,
FT_Outline* outline,
const FT_Bitmap *abitmap );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Render */
/* */
/* <Description> */
/* Render an outline within a bitmap using the current scan-convert. */
/* This function uses an @FT_Raster_Params structure as an argument, */
/* allowing advanced features like direct composition, translucency, */
/* etc. */
/* */
/* <Input> */
/* library :: A handle to a FreeType library object. */
/* */
/* outline :: A pointer to the source outline descriptor. */
/* */
/* <InOut> */
/* params :: A pointer to an @FT_Raster_Params structure used to */
/* describe the rendering operation. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You should know what you are doing and how @FT_Raster_Params works */
/* to use this function. */
/* */
/* The field `params.source' will be set to `outline' before the scan */
/* converter is called, which means that the value you give to it is */
/* actually ignored. */
/* */
/* The gray-level rasterizer always uses 256 gray levels. If you */
/* want less gray levels, you have to provide your own span callback. */
/* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */
/* @FT_Raster_Params structure for more details. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Render( FT_Library library,
FT_Outline* outline,
FT_Raster_Params* params );
/**************************************************************************
*
* @enum:
* FT_Orientation
*
* @description:
* A list of values used to describe an outline's contour orientation.
*
* The TrueType and PostScript specifications use different conventions
* to determine whether outline contours should be filled or unfilled.
*
* @values:
* FT_ORIENTATION_TRUETYPE ::
* According to the TrueType specification, clockwise contours must
* be filled, and counter-clockwise ones must be unfilled.
*
* FT_ORIENTATION_POSTSCRIPT ::
* According to the PostScript specification, counter-clockwise contours
* must be filled, and clockwise ones must be unfilled.
*
* FT_ORIENTATION_FILL_RIGHT ::
* This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
* remember that in TrueType, everything that is to the right of
* the drawing direction of a contour must be filled.
*
* FT_ORIENTATION_FILL_LEFT ::
* This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
* remember that in PostScript, everything that is to the left of
* the drawing direction of a contour must be filled.
*
* FT_ORIENTATION_NONE ::
* The orientation cannot be determined. That is, different parts of
* the glyph have different orientation.
*
*/
typedef enum FT_Orientation_
{
FT_ORIENTATION_TRUETYPE = 0,
FT_ORIENTATION_POSTSCRIPT = 1,
FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT,
FT_ORIENTATION_NONE
} FT_Orientation;
/**************************************************************************
*
* @function:
* FT_Outline_Get_Orientation
*
* @description:
* This function analyzes a glyph outline and tries to compute its
* fill orientation (see @FT_Orientation). This is done by integrating
* the total area covered by the outline. The positive integral
* corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT
* is returned. The negative integral corresponds to the counter-clockwise
* orientation and @FT_ORIENTATION_TRUETYPE is returned.
*
* Note that this will return @FT_ORIENTATION_TRUETYPE for empty
* outlines.
*
* @input:
* outline ::
* A handle to the source outline.
*
* @return:
* The orientation.
*
*/
FT_EXPORT( FT_Orientation )
FT_Outline_Get_Orientation( FT_Outline* outline );
/* */
FT_END_HEADER
#endif /* FTOUTLN_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/***************************************************************************/
/* */
/* ftlcdfil.h */
/* */
/* FreeType API for color filtering of subpixel bitmap glyphs */
/* (specification). */
/* */
/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTLCDFIL_H_
#define FTLCDFIL_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/***************************************************************************
*
* @section:
* lcd_filtering
*
* @title:
* LCD Filtering
*
* @abstract:
* Reduce color fringes of subpixel-rendered bitmaps.
*
* @description:
* Should you #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your
* `ftoption.h', which enables patented ClearType-style rendering,
* the LCD-optimized glyph bitmaps should be filtered to reduce color
* fringes inherent to this technology. The default FreeType LCD
* rendering uses different technology, and API described below,
* although available, does nothing.
*
* ClearType-style LCD rendering exploits the color-striped structure of
* LCD pixels, increasing the available resolution in the direction of
* the stripe (usually horizontal RGB) by a factor of~3. Since these
* subpixels are color pixels, using them unfiltered creates severe
* color fringes. Use the @FT_Library_SetLcdFilter API to specify a
* low-pass filter, which is then applied to subpixel-rendered bitmaps
* generated through @FT_Render_Glyph. The filter sacrifices some of
* the higher resolution to reduce color fringes, making the glyph image
* slightly blurrier. Positional improvements will remain.
*
* A filter should have two properties:
*
* 1) It should be normalized, meaning the sum of the 5~components
* should be 256 (0x100). It is possible to go above or under this
* target sum, however: going under means tossing out contrast, going
* over means invoking clamping and thereby non-linearities that
* increase contrast somewhat at the expense of greater distortion
* and color-fringing. Contrast is better enhanced through stem
* darkening.
*
* 2) It should be color-balanced, meaning a filter `{~a, b, c, b, a~}'
* where a~+ b~=~c. It distributes the computed coverage for one
* subpixel to all subpixels equally, sacrificing some won resolution
* but drastically reducing color-fringing. Positioning improvements
* remain! Note that color-fringing can only really be minimized
* when using a color-balanced filter and alpha-blending the glyph
* onto a surface in linear space; see @FT_Render_Glyph.
*
* Regarding the form, a filter can be a `boxy' filter or a `beveled'
* filter. Boxy filters are sharper but are less forgiving of non-ideal
* gamma curves of a screen (viewing angles!), beveled filters are
* fuzzier but more tolerant.
*
* Examples:
*
* - [0x10 0x40 0x70 0x40 0x10] is beveled and neither balanced nor
* normalized.
*
* - [0x1A 0x33 0x4D 0x33 0x1A] is beveled and balanced but not
* normalized.
*
* - [0x19 0x33 0x66 0x4c 0x19] is beveled and normalized but not
* balanced.
*
* - [0x00 0x4c 0x66 0x4c 0x00] is boxily beveled and normalized but not
* balanced.
*
* - [0x00 0x55 0x56 0x55 0x00] is boxy, normalized, and almost
* balanced.
*
* - [0x08 0x4D 0x56 0x4D 0x08] is beveled, normalized and, almost
* balanced.
*
* The filter affects glyph bitmaps rendered through @FT_Render_Glyph,
* @FT_Load_Glyph, and @FT_Load_Char. It does _not_ affect the output
* of @FT_Outline_Render and @FT_Outline_Get_Bitmap.
*
* If this feature is activated, the dimensions of LCD glyph bitmaps are
* either wider or taller than the dimensions of the corresponding
* outline with regard to the pixel grid. For example, for
* @FT_RENDER_MODE_LCD, the filter adds 3~subpixels to the left, and
* 3~subpixels to the right. The bitmap offset values are adjusted
* accordingly, so clients shouldn't need to modify their layout and
* glyph positioning code when enabling the filter.
*
* It is important to understand that linear alpha blending and gamma
* correction is critical for correctly rendering glyphs onto surfaces
* without artifacts and even more critical when subpixel rendering is
* involved.
*
* Each of the 3~alpha values (subpixels) is independently used to blend
* one color channel. That is, red alpha blends the red channel of the
* text color with the red channel of the background pixel. The
* distribution of density values by the color-balanced filter assumes
* alpha blending is done in linear space; only then color artifacts
* cancel out.
*/
/****************************************************************************
*
* @enum:
* FT_LcdFilter
*
* @description:
* A list of values to identify various types of LCD filters.
*
* @values:
* FT_LCD_FILTER_NONE ::
* Do not perform filtering. When used with subpixel rendering, this
* results in sometimes severe color fringes.
*
* FT_LCD_FILTER_DEFAULT ::
* The default filter reduces color fringes considerably, at the cost
* of a slight blurriness in the output.
*
* It is a beveled, normalized, and color-balanced five-tap filter
* that is more forgiving to screens with non-ideal gamma curves and
* viewing angles. Note that while color-fringing is reduced, it can
* only be minimized by using linear alpha blending and gamma
* correction to render glyphs onto surfaces. The default filter
* weights are [0x08 0x4D 0x56 0x4D 0x08].
*
* FT_LCD_FILTER_LIGHT ::
* The light filter is a variant that is sharper at the cost of
* slightly more color fringes than the default one.
*
* It is a boxy, normalized, and color-balanced three-tap filter that
* is less forgiving to screens with non-ideal gamma curves and
* viewing angles. This filter works best when the rendering system
* uses linear alpha blending and gamma correction to render glyphs
* onto surfaces. The light filter weights are
* [0x00 0x55 0x56 0x55 0x00].
*
* FT_LCD_FILTER_LEGACY ::
* This filter corresponds to the original libXft color filter. It
* provides high contrast output but can exhibit really bad color
* fringes if glyphs are not extremely well hinted to the pixel grid.
* In other words, it only works well if the TrueType bytecode
* interpreter is enabled *and* high-quality hinted fonts are used.
*
* This filter is only provided for comparison purposes, and might be
* disabled or stay unsupported in the future.
*
* FT_LCD_FILTER_LEGACY1 ::
* For historical reasons, the FontConfig library returns a different
* enumeration value for legacy LCD filtering. To make code work that
* (incorrectly) forwards FontConfig's enumeration value to
* @FT_Library_SetLcdFilter without proper mapping, it is thus easiest
* to have another enumeration value, which is completely equal to
* `FT_LCD_FILTER_LEGACY'.
*
* @since:
* 2.3.0 (`FT_LCD_FILTER_LEGACY1' since 2.6.2)
*/
typedef enum FT_LcdFilter_
{
FT_LCD_FILTER_NONE = 0,
FT_LCD_FILTER_DEFAULT = 1,
FT_LCD_FILTER_LIGHT = 2,
FT_LCD_FILTER_LEGACY1 = 3,
FT_LCD_FILTER_LEGACY = 16,
FT_LCD_FILTER_MAX /* do not remove */
} FT_LcdFilter;
/**************************************************************************
*
* @func:
* FT_Library_SetLcdFilter
*
* @description:
* This function is used to apply color filtering to LCD decimated
* bitmaps, like the ones used when calling @FT_Render_Glyph with
* @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
*
* @input:
* library ::
* A handle to the target library instance.
*
* filter ::
* The filter type.
*
* You can use @FT_LCD_FILTER_NONE here to disable this feature, or
* @FT_LCD_FILTER_DEFAULT to use a default filter that should work
* well on most LCD screens.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This feature is always disabled by default. Clients must make an
* explicit call to this function with a `filter' value other than
* @FT_LCD_FILTER_NONE in order to enable it.
*
* Due to *PATENTS* covering subpixel rendering, this function doesn't
* do anything except returning `FT_Err_Unimplemented_Feature' if the
* configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
* defined in your build of the library, which should correspond to all
* default builds of FreeType.
*
* @since:
* 2.3.0
*/
FT_EXPORT( FT_Error )
FT_Library_SetLcdFilter( FT_Library library,
FT_LcdFilter filter );
/**************************************************************************
*
* @func:
* FT_Library_SetLcdFilterWeights
*
* @description:
* This function can be used to enable LCD filter with custom weights,
* instead of using presets in @FT_Library_SetLcdFilter.
*
* @input:
* library ::
* A handle to the target library instance.
*
* weights ::
* A pointer to an array; the function copies the first five bytes and
* uses them to specify the filter weights.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Due to *PATENTS* covering subpixel rendering, this function doesn't
* do anything except returning `FT_Err_Unimplemented_Feature' if the
* configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
* defined in your build of the library, which should correspond to all
* default builds of FreeType.
*
* LCD filter weights can also be set per face using @FT_Face_Properties
* with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS.
*
* @since:
* 2.4.0
*/
FT_EXPORT( FT_Error )
FT_Library_SetLcdFilterWeights( FT_Library library,
unsigned char *weights );
/*
* @type:
* FT_LcdFiveTapFilter
*
* @description:
* A typedef for passing the five LCD filter weights to
* @FT_Face_Properties within an @FT_Parameter structure.
*
* @since:
* 2.8
*
*/
#define FT_LCD_FILTER_FIVE_TAPS 5
typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS];
/* */
FT_END_HEADER
#endif /* FTLCDFIL_H_ */
/* END */
/***************************************************************************/
/* */
/* ftsnames.h */
/* */
/* Simple interface to access SFNT `name' tables (which are used */
/* to hold font names, copyright info, notices, etc.) (specification). */
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTSNAMES_H_
#define FTSNAMES_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* sfnt_names */
/* */
/* <Title> */
/* SFNT Names */
/* */
/* <Abstract> */
/* Access the names embedded in TrueType and OpenType files. */
/* */
/* <Description> */
/* The TrueType and OpenType specifications allow the inclusion of */
/* a special names table (`name') in font files. This table contains */
/* textual (and internationalized) information regarding the font, */
/* like family name, copyright, version, etc. */
/* */
/* The definitions below are used to access them if available. */
/* */
/* Note that this has nothing to do with glyph names! */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_SfntName */
/* */
/* <Description> */
/* A structure used to model an SFNT `name' table entry. */
/* */
/* <Fields> */
/* platform_id :: The platform ID for `string'. */
/* See @TT_PLATFORM_XXX for possible values. */
/* */
/* encoding_id :: The encoding ID for `string'. */
/* See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */
/* @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX */
/* for possible values. */
/* */
/* language_id :: The language ID for `string'. */
/* See @TT_MAC_LANGID_XXX and @TT_MS_LANGID_XXX for */
/* possible values. */
/* */
/* Registered OpenType values for `language_id' are */
/* always smaller than 0x8000; values equal or larger */
/* than 0x8000 usually indicate a language tag string */
/* (introduced in OpenType version 1.6). Use function */
/* @FT_Get_Sfnt_LangTag with `language_id' as its */
/* argument to retrieve the associated language tag. */
/* */
/* name_id :: An identifier for `string'. */
/* See @TT_NAME_ID_XXX for possible values. */
/* */
/* string :: The `name' string. Note that its format differs */
/* depending on the (platform,encoding) pair, being */
/* either a string of bytes (without a terminating */
/* NULL byte) or containing UTF-16BE entities. */
/* */
/* string_len :: The length of `string' in bytes. */
/* */
/* <Note> */
/* Please refer to the TrueType or OpenType specification for more */
/* details. */
/* */
typedef struct FT_SfntName_
{
FT_UShort platform_id;
FT_UShort encoding_id;
FT_UShort language_id;
FT_UShort name_id;
FT_Byte* string; /* this string is *not* null-terminated! */
FT_UInt string_len; /* in bytes */
} FT_SfntName;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Sfnt_Name_Count */
/* */
/* <Description> */
/* Retrieve the number of name strings in the SFNT `name' table. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* <Return> */
/* The number of strings in the `name' table. */
/* */
FT_EXPORT( FT_UInt )
FT_Get_Sfnt_Name_Count( FT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Sfnt_Name */
/* */
/* <Description> */
/* Retrieve a string of the SFNT `name' table for a given index. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* idx :: The index of the `name' string. */
/* */
/* <Output> */
/* aname :: The indexed @FT_SfntName structure. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The `string' array returned in the `aname' structure is not */
/* null-terminated. Note that you don't have to deallocate `string' */
/* by yourself; FreeType takes care of it if you call @FT_Done_Face. */
/* */
/* Use @FT_Get_Sfnt_Name_Count to get the total number of available */
/* `name' table entries, then do a loop until you get the right */
/* platform, encoding, and name ID. */
/* */
/* `name' table format~1 entries can use language tags also, see */
/* @FT_Get_Sfnt_LangTag. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Sfnt_Name( FT_Face face,
FT_UInt idx,
FT_SfntName *aname );
/*************************************************************************/
/* */
/* <Struct> */
/* FT_SfntLangTag */
/* */
/* <Description> */
/* A structure to model a language tag entry from an SFNT `name' */
/* table. */
/* */
/* <Fields> */
/* string :: The language tag string, encoded in UTF-16BE */
/* (without trailing NULL bytes). */
/* */
/* string_len :: The length of `string' in *bytes*. */
/* */
/* <Note> */
/* Please refer to the TrueType or OpenType specification for more */
/* details. */
/* */
/* <Since> */
/* 2.8 */
/* */
typedef struct FT_SfntLangTag_
{
FT_Byte* string; /* this string is *not* null-terminated! */
FT_UInt string_len; /* in bytes */
} FT_SfntLangTag;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Sfnt_LangTag */
/* */
/* <Description> */
/* Retrieve the language tag associated with a language ID of an SFNT */
/* `name' table entry. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* langID :: The language ID, as returned by @FT_Get_Sfnt_Name. */
/* This is always a value larger than 0x8000. */
/* */
/* <Output> */
/* alangTag :: The language tag associated with the `name' table */
/* entry's language ID. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The `string' array returned in the `alangTag' structure is not */
/* null-terminated. Note that you don't have to deallocate `string' */
/* by yourself; FreeType takes care of it if you call @FT_Done_Face. */
/* */
/* Only `name' table format~1 supports language tags. For format~0 */
/* tables, this function always returns FT_Err_Invalid_Table. For */
/* invalid format~1 language ID values, FT_Err_Invalid_Argument is */
/* returned. */
/* */
/* <Since> */
/* 2.8 */
/* */
FT_EXPORT( FT_Error )
FT_Get_Sfnt_LangTag( FT_Face face,
FT_UInt langID,
FT_SfntLangTag *alangTag );
/* */
FT_END_HEADER
#endif /* FTSNAMES_H_ */
/* END */
/***************************************************************************/
/* */
/* ftgzip.h */
/* */
/* Gzip-compressed stream support. */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTGZIP_H_
#define FTGZIP_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* gzip */
/* */
/* <Title> */
/* GZIP Streams */
/* */
/* <Abstract> */
/* Using gzip-compressed font files. */
/* */
/* <Description> */
/* This section contains the declaration of Gzip-specific functions. */
/* */
/*************************************************************************/
/************************************************************************
*
* @function:
* FT_Stream_OpenGzip
*
* @description:
* Open a new stream to parse gzip-compressed font files. This is
* mainly used to support the compressed `*.pcf.gz' fonts that come
* with XFree86.
*
* @input:
* stream ::
* The target embedding stream.
*
* source ::
* The source stream.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
*
* Calling the internal function `FT_Stream_Close' on the new stream will
* *not* call `FT_Stream_Close' on the source stream. None of the stream
* objects will be released to the heap.
*
* The stream implementation is very basic and resets the decompression
* process each time seeking backwards is needed within the stream.
*
* In certain builds of the library, gzip compression recognition is
* automatically handled when calling @FT_New_Face or @FT_Open_Face.
* This means that if no font driver is capable of handling the raw
* compressed file, the library will try to open a gzipped stream from
* it and re-open the face with it.
*
* This function may return `FT_Err_Unimplemented_Feature' if your build
* of FreeType was not compiled with zlib support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenGzip( FT_Stream stream,
FT_Stream source );
/************************************************************************
*
* @function:
* FT_Gzip_Uncompress
*
* @description:
* Decompress a zipped input buffer into an output buffer. This function
* is modeled after zlib's `uncompress' function.
*
* @input:
* memory ::
* A FreeType memory handle.
*
* input ::
* The input buffer.
*
* input_len ::
* The length of the input buffer.
*
* @output:
* output::
* The output buffer.
*
* @inout:
* output_len ::
* Before calling the function, this is the total size of the output
* buffer, which must be large enough to hold the entire uncompressed
* data (so the size of the uncompressed data must be known in
* advance). After calling the function, `output_len' is the size of
* the used data in `output'.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function may return `FT_Err_Unimplemented_Feature' if your build
* of FreeType was not compiled with zlib support.
*
* @since:
* 2.5.1
*/
FT_EXPORT( FT_Error )
FT_Gzip_Uncompress( FT_Memory memory,
FT_Byte* output,
FT_ULong* output_len,
const FT_Byte* input,
FT_ULong input_len );
/* */
FT_END_HEADER
#endif /* FTGZIP_H_ */
/* END */
/***************************************************************************/
/* */
/* ftimage.h */
/* */
/* FreeType glyph image formats and default raster interface */
/* (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* Note: A `raster' is simply a scan-line converter, used to render */
/* FT_Outlines into FT_Bitmaps. */
/* */
/*************************************************************************/
#ifndef FTIMAGE_H_
#define FTIMAGE_H_
/* STANDALONE_ is from ftgrays.c */
#ifndef STANDALONE_
#include <ft2build.h>
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* basic_types */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Pos */
/* */
/* <Description> */
/* The type FT_Pos is used to store vectorial coordinates. Depending */
/* on the context, these can represent distances in integer font */
/* units, or 16.16, or 26.6 fixed-point pixel coordinates. */
/* */
typedef signed long FT_Pos;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Vector */
/* */
/* <Description> */
/* A simple structure used to store a 2D vector; coordinates are of */
/* the FT_Pos type. */
/* */
/* <Fields> */
/* x :: The horizontal coordinate. */
/* y :: The vertical coordinate. */
/* */
typedef struct FT_Vector_
{
FT_Pos x;
FT_Pos y;
} FT_Vector;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_BBox */
/* */
/* <Description> */
/* A structure used to hold an outline's bounding box, i.e., the */
/* coordinates of its extrema in the horizontal and vertical */
/* directions. */
/* */
/* <Fields> */
/* xMin :: The horizontal minimum (left-most). */
/* */
/* yMin :: The vertical minimum (bottom-most). */
/* */
/* xMax :: The horizontal maximum (right-most). */
/* */
/* yMax :: The vertical maximum (top-most). */
/* */
/* <Note> */
/* The bounding box is specified with the coordinates of the lower */
/* left and the upper right corner. In PostScript, those values are */
/* often called (llx,lly) and (urx,ury), respectively. */
/* */
/* If `yMin' is negative, this value gives the glyph's descender. */
/* Otherwise, the glyph doesn't descend below the baseline. */
/* Similarly, if `ymax' is positive, this value gives the glyph's */
/* ascender. */
/* */
/* `xMin' gives the horizontal distance from the glyph's origin to */
/* the left edge of the glyph's bounding box. If `xMin' is negative, */
/* the glyph extends to the left of the origin. */
/* */
typedef struct FT_BBox_
{
FT_Pos xMin, yMin;
FT_Pos xMax, yMax;
} FT_BBox;
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Pixel_Mode */
/* */
/* <Description> */
/* An enumeration type used to describe the format of pixels in a */
/* given bitmap. Note that additional formats may be added in the */
/* future. */
/* */
/* <Values> */
/* FT_PIXEL_MODE_NONE :: */
/* Value~0 is reserved. */
/* */
/* FT_PIXEL_MODE_MONO :: */
/* A monochrome bitmap, using 1~bit per pixel. Note that pixels */
/* are stored in most-significant order (MSB), which means that */
/* the left-most pixel in a byte has value 128. */
/* */
/* FT_PIXEL_MODE_GRAY :: */
/* An 8-bit bitmap, generally used to represent anti-aliased glyph */
/* images. Each pixel is stored in one byte. Note that the number */
/* of `gray' levels is stored in the `num_grays' field of the */
/* @FT_Bitmap structure (it generally is 256). */
/* */
/* FT_PIXEL_MODE_GRAY2 :: */
/* A 2-bit per pixel bitmap, used to represent embedded */
/* anti-aliased bitmaps in font files according to the OpenType */
/* specification. We haven't found a single font using this */
/* format, however. */
/* */
/* FT_PIXEL_MODE_GRAY4 :: */
/* A 4-bit per pixel bitmap, representing embedded anti-aliased */
/* bitmaps in font files according to the OpenType specification. */
/* We haven't found a single font using this format, however. */
/* */
/* FT_PIXEL_MODE_LCD :: */
/* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
/* used for display on LCD displays; the bitmap is three times */
/* wider than the original glyph image. See also */
/* @FT_RENDER_MODE_LCD. */
/* */
/* FT_PIXEL_MODE_LCD_V :: */
/* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
/* used for display on rotated LCD displays; the bitmap is three */
/* times taller than the original glyph image. See also */
/* @FT_RENDER_MODE_LCD_V. */
/* */
/* FT_PIXEL_MODE_BGRA :: */
/* [Since 2.5] An image with four 8-bit channels per pixel, */
/* representing a color image (such as emoticons) with alpha */
/* channel. For each pixel, the format is BGRA, which means, the */
/* blue channel comes first in memory. The color channels are */
/* pre-multiplied and in the sRGB colorspace. For example, full */
/* red at half-translucent opacity will be represented as */
/* `00,00,80,80', not `00,00,FF,80'. See also @FT_LOAD_COLOR. */
/* */
typedef enum FT_Pixel_Mode_
{
FT_PIXEL_MODE_NONE = 0,
FT_PIXEL_MODE_MONO,
FT_PIXEL_MODE_GRAY,
FT_PIXEL_MODE_GRAY2,
FT_PIXEL_MODE_GRAY4,
FT_PIXEL_MODE_LCD,
FT_PIXEL_MODE_LCD_V,
FT_PIXEL_MODE_BGRA,
FT_PIXEL_MODE_MAX /* do not remove */
} FT_Pixel_Mode;
/* these constants are deprecated; use the corresponding `FT_Pixel_Mode' */
/* values instead. */
#define ft_pixel_mode_none FT_PIXEL_MODE_NONE
#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Bitmap */
/* */
/* <Description> */
/* A structure used to describe a bitmap or pixmap to the raster. */
/* Note that we now manage pixmaps of various depths through the */
/* `pixel_mode' field. */
/* */
/* <Fields> */
/* rows :: The number of bitmap rows. */
/* */
/* width :: The number of pixels in bitmap row. */
/* */
/* pitch :: The pitch's absolute value is the number of bytes */
/* taken by one bitmap row, including padding. */
/* However, the pitch is positive when the bitmap has */
/* a `down' flow, and negative when it has an `up' */
/* flow. In all cases, the pitch is an offset to add */
/* to a bitmap pointer in order to go down one row. */
/* */
/* Note that `padding' means the alignment of a */
/* bitmap to a byte border, and FreeType functions */
/* normally align to the smallest possible integer */
/* value. */
/* */
/* For the B/W rasterizer, `pitch' is always an even */
/* number. */
/* */
/* To change the pitch of a bitmap (say, to make it a */
/* multiple of 4), use @FT_Bitmap_Convert. */
/* Alternatively, you might use callback functions to */
/* directly render to the application's surface; see */
/* the file `example2.cpp' in the tutorial for a */
/* demonstration. */
/* */
/* buffer :: A typeless pointer to the bitmap buffer. This */
/* value should be aligned on 32-bit boundaries in */
/* most cases. */
/* */
/* num_grays :: This field is only used with */
/* @FT_PIXEL_MODE_GRAY; it gives the number of gray */
/* levels used in the bitmap. */
/* */
/* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */
/* See @FT_Pixel_Mode for possible values. */
/* */
/* palette_mode :: This field is intended for paletted pixel modes; */
/* it indicates how the palette is stored. Not */
/* used currently. */
/* */
/* palette :: A typeless pointer to the bitmap palette; this */
/* field is intended for paletted pixel modes. Not */
/* used currently. */
/* */
typedef struct FT_Bitmap_
{
unsigned int rows;
unsigned int width;
int pitch;
unsigned char* buffer;
unsigned short num_grays;
unsigned char pixel_mode;
unsigned char palette_mode;
void* palette;
} FT_Bitmap;
/*************************************************************************/
/* */
/* <Section> */
/* outline_processing */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Outline */
/* */
/* <Description> */
/* This structure is used to describe an outline to the scan-line */
/* converter. */
/* */
/* <Fields> */
/* n_contours :: The number of contours in the outline. */
/* */
/* n_points :: The number of points in the outline. */
/* */
/* points :: A pointer to an array of `n_points' @FT_Vector */
/* elements, giving the outline's point coordinates. */
/* */
/* tags :: A pointer to an array of `n_points' chars, giving */
/* each outline point's type. */
/* */
/* If bit~0 is unset, the point is `off' the curve, */
/* i.e., a Bezier control point, while it is `on' if */
/* set. */
/* */
/* Bit~1 is meaningful for `off' points only. If set, */
/* it indicates a third-order Bezier arc control point; */
/* and a second-order control point if unset. */
/* */
/* If bit~2 is set, bits 5-7 contain the drop-out mode */
/* (as defined in the OpenType specification; the value */
/* is the same as the argument to the SCANMODE */
/* instruction). */
/* */
/* Bits 3 and~4 are reserved for internal purposes. */
/* */
/* contours :: An array of `n_contours' shorts, giving the end */
/* point of each contour within the outline. For */
/* example, the first contour is defined by the points */
/* `0' to `contours[0]', the second one is defined by */
/* the points `contours[0]+1' to `contours[1]', etc. */
/* */
/* flags :: A set of bit flags used to characterize the outline */
/* and give hints to the scan-converter and hinter on */
/* how to convert/grid-fit it. See @FT_OUTLINE_XXX. */
/* */
/* <Note> */
/* The B/W rasterizer only checks bit~2 in the `tags' array for the */
/* first point of each contour. The drop-out mode as given with */
/* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */
/* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */
/* */
typedef struct FT_Outline_
{
short n_contours; /* number of contours in glyph */
short n_points; /* number of points in the glyph */
FT_Vector* points; /* the outline's points */
char* tags; /* the points flags */
short* contours; /* the contour end points */
int flags; /* outline masks */
} FT_Outline;
/* */
/* Following limits must be consistent with */
/* FT_Outline.{n_contours,n_points} */
#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX
#define FT_OUTLINE_POINTS_MAX SHRT_MAX
/*************************************************************************/
/* */
/* <Enum> */
/* FT_OUTLINE_XXX */
/* */
/* <Description> */
/* A list of bit-field constants use for the flags in an outline's */
/* `flags' field. */
/* */
/* <Values> */
/* FT_OUTLINE_NONE :: */
/* Value~0 is reserved. */
/* */
/* FT_OUTLINE_OWNER :: */
/* If set, this flag indicates that the outline's field arrays */
/* (i.e., `points', `flags', and `contours') are `owned' by the */
/* outline object, and should thus be freed when it is destroyed. */
/* */
/* FT_OUTLINE_EVEN_ODD_FILL :: */
/* By default, outlines are filled using the non-zero winding rule. */
/* If set to 1, the outline will be filled using the even-odd fill */
/* rule (only works with the smooth rasterizer). */
/* */
/* FT_OUTLINE_REVERSE_FILL :: */
/* By default, outside contours of an outline are oriented in */
/* clock-wise direction, as defined in the TrueType specification. */
/* This flag is set if the outline uses the opposite direction */
/* (typically for Type~1 fonts). This flag is ignored by the scan */
/* converter. */
/* */
/* FT_OUTLINE_IGNORE_DROPOUTS :: */
/* By default, the scan converter will try to detect drop-outs in */
/* an outline and correct the glyph bitmap to ensure consistent */
/* shape continuity. If set, this flag hints the scan-line */
/* converter to ignore such cases. See below for more information. */
/* */
/* FT_OUTLINE_SMART_DROPOUTS :: */
/* Select smart dropout control. If unset, use simple dropout */
/* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */
/* below for more information. */
/* */
/* FT_OUTLINE_INCLUDE_STUBS :: */
/* If set, turn pixels on for `stubs', otherwise exclude them. */
/* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */
/* more information. */
/* */
/* FT_OUTLINE_HIGH_PRECISION :: */
/* This flag indicates that the scan-line converter should try to */
/* convert this outline to bitmaps with the highest possible */
/* quality. It is typically set for small character sizes. Note */
/* that this is only a hint that might be completely ignored by a */
/* given scan-converter. */
/* */
/* FT_OUTLINE_SINGLE_PASS :: */
/* This flag is set to force a given scan-converter to only use a */
/* single pass over the outline to render a bitmap glyph image. */
/* Normally, it is set for very large character sizes. It is only */
/* a hint that might be completely ignored by a given */
/* scan-converter. */
/* */
/* <Note> */
/* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
/* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */
/* rasterizer. */
/* */
/* There exists a second mechanism to pass the drop-out mode to the */
/* B/W rasterizer; see the `tags' field in @FT_Outline. */
/* */
/* Please refer to the description of the `SCANTYPE' instruction in */
/* the OpenType specification (in file `ttinst1.doc') how simple */
/* drop-outs, smart drop-outs, and stubs are defined. */
/* */
#define FT_OUTLINE_NONE 0x0
#define FT_OUTLINE_OWNER 0x1
#define FT_OUTLINE_EVEN_ODD_FILL 0x2
#define FT_OUTLINE_REVERSE_FILL 0x4
#define FT_OUTLINE_IGNORE_DROPOUTS 0x8
#define FT_OUTLINE_SMART_DROPOUTS 0x10
#define FT_OUTLINE_INCLUDE_STUBS 0x20
#define FT_OUTLINE_HIGH_PRECISION 0x100
#define FT_OUTLINE_SINGLE_PASS 0x200
/* these constants are deprecated; use the corresponding */
/* `FT_OUTLINE_XXX' values instead */
#define ft_outline_none FT_OUTLINE_NONE
#define ft_outline_owner FT_OUTLINE_OWNER
#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL
#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL
#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS
#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION
#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS
/* */
#define FT_CURVE_TAG( flag ) ( flag & 3 )
#define FT_CURVE_TAG_ON 1
#define FT_CURVE_TAG_CONIC 0
#define FT_CURVE_TAG_CUBIC 2
#define FT_CURVE_TAG_HAS_SCANMODE 4
#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */
#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */
#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \
FT_CURVE_TAG_TOUCH_Y )
#define FT_Curve_Tag_On FT_CURVE_TAG_ON
#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC
#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC
#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X
#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Outline_MoveToFunc */
/* */
/* <Description> */
/* A function pointer type used to describe the signature of a `move */
/* to' function during outline walking/decomposition. */
/* */
/* A `move to' is emitted to start a new contour in an outline. */
/* */
/* <Input> */
/* to :: A pointer to the target point of the `move to'. */
/* */
/* user :: A typeless pointer, which is passed from the caller of the */
/* decomposition function. */
/* */
/* <Return> */
/* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_MoveToFunc)( const FT_Vector* to,
void* user );
#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Outline_LineToFunc */
/* */
/* <Description> */
/* A function pointer type used to describe the signature of a `line */
/* to' function during outline walking/decomposition. */
/* */
/* A `line to' is emitted to indicate a segment in the outline. */
/* */
/* <Input> */
/* to :: A pointer to the target point of the `line to'. */
/* */
/* user :: A typeless pointer, which is passed from the caller of the */
/* decomposition function. */
/* */
/* <Return> */
/* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_LineToFunc)( const FT_Vector* to,
void* user );
#define FT_Outline_LineTo_Func FT_Outline_LineToFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Outline_ConicToFunc */
/* */
/* <Description> */
/* A function pointer type used to describe the signature of a `conic */
/* to' function during outline walking or decomposition. */
/* */
/* A `conic to' is emitted to indicate a second-order Bezier arc in */
/* the outline. */
/* */
/* <Input> */
/* control :: An intermediate control point between the last position */
/* and the new target in `to'. */
/* */
/* to :: A pointer to the target end point of the conic arc. */
/* */
/* user :: A typeless pointer, which is passed from the caller of */
/* the decomposition function. */
/* */
/* <Return> */
/* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_ConicToFunc)( const FT_Vector* control,
const FT_Vector* to,
void* user );
#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Outline_CubicToFunc */
/* */
/* <Description> */
/* A function pointer type used to describe the signature of a `cubic */
/* to' function during outline walking or decomposition. */
/* */
/* A `cubic to' is emitted to indicate a third-order Bezier arc. */
/* */
/* <Input> */
/* control1 :: A pointer to the first Bezier control point. */
/* */
/* control2 :: A pointer to the second Bezier control point. */
/* */
/* to :: A pointer to the target end point. */
/* */
/* user :: A typeless pointer, which is passed from the caller of */
/* the decomposition function. */
/* */
/* <Return> */
/* Error code. 0~means success. */
/* */
typedef int
(*FT_Outline_CubicToFunc)( const FT_Vector* control1,
const FT_Vector* control2,
const FT_Vector* to,
void* user );
#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Outline_Funcs */
/* */
/* <Description> */
/* A structure to hold various function pointers used during outline */
/* decomposition in order to emit segments, conic, and cubic Beziers. */
/* */
/* <Fields> */
/* move_to :: The `move to' emitter. */
/* */
/* line_to :: The segment emitter. */
/* */
/* conic_to :: The second-order Bezier arc emitter. */
/* */
/* cubic_to :: The third-order Bezier arc emitter. */
/* */
/* shift :: The shift that is applied to coordinates before they */
/* are sent to the emitter. */
/* */
/* delta :: The delta that is applied to coordinates before they */
/* are sent to the emitter, but after the shift. */
/* */
/* <Note> */
/* The point coordinates sent to the emitters are the transformed */
/* version of the original coordinates (this is important for high */
/* accuracy during scan-conversion). The transformation is simple: */
/* */
/* { */
/* x' = (x << shift) - delta */
/* y' = (y << shift) - delta */
/* } */
/* */
/* Set the values of `shift' and `delta' to~0 to get the original */
/* point coordinates. */
/* */
typedef struct FT_Outline_Funcs_
{
FT_Outline_MoveToFunc move_to;
FT_Outline_LineToFunc line_to;
FT_Outline_ConicToFunc conic_to;
FT_Outline_CubicToFunc cubic_to;
int shift;
FT_Pos delta;
} FT_Outline_Funcs;
/*************************************************************************/
/* */
/* <Section> */
/* basic_types */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Macro> */
/* FT_IMAGE_TAG */
/* */
/* <Description> */
/* This macro converts four-letter tags to an unsigned long type. */
/* */
/* <Note> */
/* Since many 16-bit compilers don't like 32-bit enumerations, you */
/* should redefine this macro in case of problems to something like */
/* this: */
/* */
/* { */
/* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
/* } */
/* */
/* to get a simple enumeration without assigning special numbers. */
/* */
#ifndef FT_IMAGE_TAG
#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
value = ( ( (unsigned long)_x1 << 24 ) | \
( (unsigned long)_x2 << 16 ) | \
( (unsigned long)_x3 << 8 ) | \
(unsigned long)_x4 )
#endif /* FT_IMAGE_TAG */
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Glyph_Format */
/* */
/* <Description> */
/* An enumeration type used to describe the format of a given glyph */
/* image. Note that this version of FreeType only supports two image */
/* formats, even though future font drivers will be able to register */
/* their own format. */
/* */
/* <Values> */
/* FT_GLYPH_FORMAT_NONE :: */
/* The value~0 is reserved. */
/* */
/* FT_GLYPH_FORMAT_COMPOSITE :: */
/* The glyph image is a composite of several other images. This */
/* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */
/* report compound glyphs (like accented characters). */
/* */
/* FT_GLYPH_FORMAT_BITMAP :: */
/* The glyph image is a bitmap, and can be described as an */
/* @FT_Bitmap. You generally need to access the `bitmap' field of */
/* the @FT_GlyphSlotRec structure to read it. */
/* */
/* FT_GLYPH_FORMAT_OUTLINE :: */
/* The glyph image is a vectorial outline made of line segments */
/* and Bezier arcs; it can be described as an @FT_Outline; you */
/* generally want to access the `outline' field of the */
/* @FT_GlyphSlotRec structure to read it. */
/* */
/* FT_GLYPH_FORMAT_PLOTTER :: */
/* The glyph image is a vectorial path with no inside and outside */
/* contours. Some Type~1 fonts, like those in the Hershey family, */
/* contain glyphs in this format. These are described as */
/* @FT_Outline, but FreeType isn't currently capable of rendering */
/* them correctly. */
/* */
typedef enum FT_Glyph_Format_
{
FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
} FT_Glyph_Format;
/* these constants are deprecated; use the corresponding */
/* `FT_Glyph_Format' values instead. */
#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE
#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE
#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP
#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** R A S T E R D E F I N I T I O N S *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* A raster is a scan converter, in charge of rendering an outline into */
/* a bitmap. This section contains the public API for rasters. */
/* */
/* Note that in FreeType 2, all rasters are now encapsulated within */
/* specific modules called `renderers'. See `ftrender.h' for more */
/* details on renderers. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* raster */
/* */
/* <Title> */
/* Scanline Converter */
/* */
/* <Abstract> */
/* How vectorial outlines are converted into bitmaps and pixmaps. */
/* */
/* <Description> */
/* This section contains technical definitions. */
/* */
/* <Order> */
/* FT_Raster */
/* FT_Span */
/* FT_SpanFunc */
/* */
/* FT_Raster_Params */
/* FT_RASTER_FLAG_XXX */
/* */
/* FT_Raster_NewFunc */
/* FT_Raster_DoneFunc */
/* FT_Raster_ResetFunc */
/* FT_Raster_SetModeFunc */
/* FT_Raster_RenderFunc */
/* FT_Raster_Funcs */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Raster */
/* */
/* <Description> */
/* An opaque handle (pointer) to a raster object. Each object can be */
/* used independently to convert an outline into a bitmap or pixmap. */
/* */
typedef struct FT_RasterRec_* FT_Raster;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Span */
/* */
/* <Description> */
/* A structure used to model a single span of gray pixels when */
/* rendering an anti-aliased bitmap. */
/* */
/* <Fields> */
/* x :: The span's horizontal start position. */
/* */
/* len :: The span's length in pixels. */
/* */
/* coverage :: The span color/coverage, ranging from 0 (background) */
/* to 255 (foreground). */
/* */
/* <Note> */
/* This structure is used by the span drawing callback type named */
/* @FT_SpanFunc that takes the y~coordinate of the span as a */
/* parameter. */
/* */
/* The coverage value is always between 0 and 255. If you want less */
/* gray values, the callback function has to reduce them. */
/* */
typedef struct FT_Span_
{
short x;
unsigned short len;
unsigned char coverage;
} FT_Span;
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_SpanFunc */
/* */
/* <Description> */
/* A function used as a call-back by the anti-aliased renderer in */
/* order to let client applications draw themselves the gray pixel */
/* spans on each scan line. */
/* */
/* <Input> */
/* y :: The scanline's y~coordinate. */
/* */
/* count :: The number of spans to draw on this scanline. */
/* */
/* spans :: A table of `count' spans to draw on the scanline. */
/* */
/* user :: User-supplied data that is passed to the callback. */
/* */
/* <Note> */
/* This callback allows client applications to directly render the */
/* gray spans of the anti-aliased bitmap to any kind of surfaces. */
/* */
/* This can be used to write anti-aliased outlines directly to a */
/* given background bitmap, and even perform translucency. */
/* */
typedef void
(*FT_SpanFunc)( int y,
int count,
const FT_Span* spans,
void* user );
#define FT_Raster_Span_Func FT_SpanFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_BitTest_Func */
/* */
/* <Description> */
/* Deprecated, unimplemented. */
/* */
typedef int
(*FT_Raster_BitTest_Func)( int y,
int x,
void* user );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_BitSet_Func */
/* */
/* <Description> */
/* Deprecated, unimplemented. */
/* */
typedef void
(*FT_Raster_BitSet_Func)( int y,
int x,
void* user );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_RASTER_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flag constants as used in the `flags' field of a */
/* @FT_Raster_Params structure. */
/* */
/* <Values> */
/* FT_RASTER_FLAG_DEFAULT :: This value is 0. */
/* */
/* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
/* anti-aliased glyph image should be */
/* generated. Otherwise, it will be */
/* monochrome (1-bit). */
/* */
/* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
/* rendering. In this mode, client */
/* applications must provide their own span */
/* callback. This lets them directly */
/* draw or compose over an existing bitmap. */
/* If this bit is not set, the target */
/* pixmap's buffer _must_ be zeroed before */
/* rendering. */
/* */
/* Direct rendering is only possible with */
/* anti-aliased glyphs. */
/* */
/* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */
/* rendering mode. If set, the output will */
/* be clipped to a box specified in the */
/* `clip_box' field of the */
/* @FT_Raster_Params structure. */
/* */
/* Note that by default, the glyph bitmap */
/* is clipped to the target pixmap, except */
/* in direct rendering mode where all spans */
/* are generated if no clipping box is set. */
/* */
#define FT_RASTER_FLAG_DEFAULT 0x0
#define FT_RASTER_FLAG_AA 0x1
#define FT_RASTER_FLAG_DIRECT 0x2
#define FT_RASTER_FLAG_CLIP 0x4
/* these constants are deprecated; use the corresponding */
/* `FT_RASTER_FLAG_XXX' values instead */
#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT
#define ft_raster_flag_aa FT_RASTER_FLAG_AA
#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT
#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Raster_Params */
/* */
/* <Description> */
/* A structure to hold the arguments used by a raster's render */
/* function. */
/* */
/* <Fields> */
/* target :: The target bitmap. */
/* */
/* source :: A pointer to the source glyph image (e.g., an */
/* @FT_Outline). */
/* */
/* flags :: The rendering flags. */
/* */
/* gray_spans :: The gray span drawing callback. */
/* */
/* black_spans :: Unused. */
/* */
/* bit_test :: Unused. */
/* */
/* bit_set :: Unused. */
/* */
/* user :: User-supplied data that is passed to each drawing */
/* callback. */
/* */
/* clip_box :: An optional clipping box. It is only used in */
/* direct rendering mode. Note that coordinates here */
/* should be expressed in _integer_ pixels (and not in */
/* 26.6 fixed-point units). */
/* */
/* <Note> */
/* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */
/* bit flag is set in the `flags' field, otherwise a monochrome */
/* bitmap is generated. */
/* */
/* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */
/* raster will call the `gray_spans' callback to draw gray pixel */
/* spans. This allows direct composition over a pre-existing bitmap */
/* through user-provided callbacks to perform the span drawing and */
/* composition. Not supported by the monochrome rasterizer. */
/* */
typedef struct FT_Raster_Params_
{
const FT_Bitmap* target;
const void* source;
int flags;
FT_SpanFunc gray_spans;
FT_SpanFunc black_spans; /* unused */
FT_Raster_BitTest_Func bit_test; /* unused */
FT_Raster_BitSet_Func bit_set; /* unused */
void* user;
FT_BBox clip_box;
} FT_Raster_Params;
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_NewFunc */
/* */
/* <Description> */
/* A function used to create a new raster object. */
/* */
/* <Input> */
/* memory :: A handle to the memory allocator. */
/* */
/* <Output> */
/* raster :: A handle to the new raster object. */
/* */
/* <Return> */
/* Error code. 0~means success. */
/* */
/* <Note> */
/* The `memory' parameter is a typeless pointer in order to avoid */
/* un-wanted dependencies on the rest of the FreeType code. In */
/* practice, it is an @FT_Memory object, i.e., a handle to the */
/* standard FreeType memory allocator. However, this field can be */
/* completely ignored by a given raster implementation. */
/* */
typedef int
(*FT_Raster_NewFunc)( void* memory,
FT_Raster* raster );
#define FT_Raster_New_Func FT_Raster_NewFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_DoneFunc */
/* */
/* <Description> */
/* A function used to destroy a given raster object. */
/* */
/* <Input> */
/* raster :: A handle to the raster object. */
/* */
typedef void
(*FT_Raster_DoneFunc)( FT_Raster raster );
#define FT_Raster_Done_Func FT_Raster_DoneFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_ResetFunc */
/* */
/* <Description> */
/* FreeType used to provide an area of memory called the `render */
/* pool' available to all registered rasterizers. This was not */
/* thread safe, however, and now FreeType never allocates this pool. */
/* */
/* This function is called after a new raster object is created. */
/* */
/* <Input> */
/* raster :: A handle to the new raster object. */
/* */
/* pool_base :: Previously, the address in memory of the render pool. */
/* Set this to NULL. */
/* */
/* pool_size :: Previously, the size in bytes of the render pool. */
/* Set this to 0. */
/* */
/* <Note> */
/* Rasterizers should rely on dynamic or stack allocation if they */
/* want to (a handle to the memory allocator is passed to the */
/* rasterizer constructor). */
/* */
typedef void
(*FT_Raster_ResetFunc)( FT_Raster raster,
unsigned char* pool_base,
unsigned long pool_size );
#define FT_Raster_Reset_Func FT_Raster_ResetFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_SetModeFunc */
/* */
/* <Description> */
/* This function is a generic facility to change modes or attributes */
/* in a given raster. This can be used for debugging purposes, or */
/* simply to allow implementation-specific `features' in a given */
/* raster module. */
/* */
/* <Input> */
/* raster :: A handle to the new raster object. */
/* */
/* mode :: A 4-byte tag used to name the mode or property. */
/* */
/* args :: A pointer to the new mode/property to use. */
/* */
typedef int
(*FT_Raster_SetModeFunc)( FT_Raster raster,
unsigned long mode,
void* args );
#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Raster_RenderFunc */
/* */
/* <Description> */
/* Invoke a given raster to scan-convert a given glyph image into a */
/* target bitmap. */
/* */
/* <Input> */
/* raster :: A handle to the raster object. */
/* */
/* params :: A pointer to an @FT_Raster_Params structure used to */
/* store the rendering parameters. */
/* */
/* <Return> */
/* Error code. 0~means success. */
/* */
/* <Note> */
/* The exact format of the source image depends on the raster's glyph */
/* format defined in its @FT_Raster_Funcs structure. It can be an */
/* @FT_Outline or anything else in order to support a large array of */
/* glyph formats. */
/* */
/* Note also that the render function can fail and return a */
/* `FT_Err_Unimplemented_Feature' error code if the raster used does */
/* not support direct composition. */
/* */
/* XXX: For now, the standard raster doesn't support direct */
/* composition but this should change for the final release (see */
/* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */
/* for examples of distinct implementations that support direct */
/* composition). */
/* */
typedef int
(*FT_Raster_RenderFunc)( FT_Raster raster,
const FT_Raster_Params* params );
#define FT_Raster_Render_Func FT_Raster_RenderFunc
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Raster_Funcs */
/* */
/* <Description> */
/* A structure used to describe a given raster class to the library. */
/* */
/* <Fields> */
/* glyph_format :: The supported glyph format for this raster. */
/* */
/* raster_new :: The raster constructor. */
/* */
/* raster_reset :: Used to reset the render pool within the raster. */
/* */
/* raster_render :: A function to render a glyph into a given bitmap. */
/* */
/* raster_done :: The raster destructor. */
/* */
typedef struct FT_Raster_Funcs_
{
FT_Glyph_Format glyph_format;
FT_Raster_NewFunc raster_new;
FT_Raster_ResetFunc raster_reset;
FT_Raster_SetModeFunc raster_set_mode;
FT_Raster_RenderFunc raster_render;
FT_Raster_DoneFunc raster_done;
} FT_Raster_Funcs;
/* */
FT_END_HEADER
#endif /* FTIMAGE_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/***************************************************************************/
/* */
/* ftlist.h */
/* */
/* Generic list support for FreeType (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file implements functions relative to list processing. Its */
/* data structures are defined in `freetype.h'. */
/* */
/*************************************************************************/
#ifndef FTLIST_H_
#define FTLIST_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* list_processing */
/* */
/* <Title> */
/* List Processing */
/* */
/* <Abstract> */
/* Simple management of lists. */
/* */
/* <Description> */
/* This section contains various definitions related to list */
/* processing using doubly-linked nodes. */
/* */
/* <Order> */
/* FT_List */
/* FT_ListNode */
/* FT_ListRec */
/* FT_ListNodeRec */
/* */
/* FT_List_Add */
/* FT_List_Insert */
/* FT_List_Find */
/* FT_List_Remove */
/* FT_List_Up */
/* FT_List_Iterate */
/* FT_List_Iterator */
/* FT_List_Finalize */
/* FT_List_Destructor */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Find */
/* */
/* <Description> */
/* Find the list node for a given listed object. */
/* */
/* <Input> */
/* list :: A pointer to the parent list. */
/* data :: The address of the listed object. */
/* */
/* <Return> */
/* List node. NULL if it wasn't found. */
/* */
FT_EXPORT( FT_ListNode )
FT_List_Find( FT_List list,
void* data );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Add */
/* */
/* <Description> */
/* Append an element to the end of a list. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
/* node :: The node to append. */
/* */
FT_EXPORT( void )
FT_List_Add( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Insert */
/* */
/* <Description> */
/* Insert an element at the head of a list. */
/* */
/* <InOut> */
/* list :: A pointer to parent list. */
/* node :: The node to insert. */
/* */
FT_EXPORT( void )
FT_List_Insert( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Remove */
/* */
/* <Description> */
/* Remove a node from a list. This function doesn't check whether */
/* the node is in the list! */
/* */
/* <Input> */
/* node :: The node to remove. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
/* */
FT_EXPORT( void )
FT_List_Remove( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Up */
/* */
/* <Description> */
/* Move a node to the head/top of a list. Used to maintain LRU */
/* lists. */
/* */
/* <InOut> */
/* list :: A pointer to the parent list. */
/* node :: The node to move. */
/* */
FT_EXPORT( void )
FT_List_Up( FT_List list,
FT_ListNode node );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_List_Iterator */
/* */
/* <Description> */
/* An FT_List iterator function that is called during a list parse */
/* by @FT_List_Iterate. */
/* */
/* <Input> */
/* node :: The current iteration list node. */
/* */
/* user :: A typeless pointer passed to @FT_List_Iterate. */
/* Can be used to point to the iteration's state. */
/* */
typedef FT_Error
(*FT_List_Iterator)( FT_ListNode node,
void* user );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Iterate */
/* */
/* <Description> */
/* Parse a list and calls a given iterator function on each element. */
/* Note that parsing is stopped as soon as one of the iterator calls */
/* returns a non-zero value. */
/* */
/* <Input> */
/* list :: A handle to the list. */
/* iterator :: An iterator function, called on each node of the list. */
/* user :: A user-supplied field that is passed as the second */
/* argument to the iterator. */
/* */
/* <Return> */
/* The result (a FreeType error code) of the last iterator call. */
/* */
FT_EXPORT( FT_Error )
FT_List_Iterate( FT_List list,
FT_List_Iterator iterator,
void* user );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_List_Destructor */
/* */
/* <Description> */
/* An @FT_List iterator function that is called during a list */
/* finalization by @FT_List_Finalize to destroy all elements in a */
/* given list. */
/* */
/* <Input> */
/* system :: The current system object. */
/* */
/* data :: The current object to destroy. */
/* */
/* user :: A typeless pointer passed to @FT_List_Iterate. It can */
/* be used to point to the iteration's state. */
/* */
typedef void
(*FT_List_Destructor)( FT_Memory memory,
void* data,
void* user );
/*************************************************************************/
/* */
/* <Function> */
/* FT_List_Finalize */
/* */
/* <Description> */
/* Destroy all elements in the list as well as the list itself. */
/* */
/* <Input> */
/* list :: A handle to the list. */
/* */
/* destroy :: A list destructor that will be applied to each element */
/* of the list. Set this to NULL if not needed. */
/* */
/* memory :: The current memory object that handles deallocation. */
/* */
/* user :: A user-supplied field that is passed as the last */
/* argument to the destructor. */
/* */
/* <Note> */
/* This function expects that all nodes added by @FT_List_Add or */
/* @FT_List_Insert have been dynamically allocated. */
/* */
FT_EXPORT( void )
FT_List_Finalize( FT_List list,
FT_List_Destructor destroy,
FT_Memory memory,
void* user );
/* */
FT_END_HEADER
#endif /* FTLIST_H_ */
/* END */
/***************************************************************************/
/* */
/* ftcache.h */
/* */
/* FreeType Cache subsystem (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTCACHE_H_
#define FTCACHE_H_
#include <ft2build.h>
#include FT_GLYPH_H
FT_BEGIN_HEADER
/*************************************************************************
*
* <Section>
* cache_subsystem
*
* <Title>
* Cache Sub-System
*
* <Abstract>
* How to cache face, size, and glyph data with FreeType~2.
*
* <Description>
* This section describes the FreeType~2 cache sub-system, which is used
* to limit the number of concurrently opened @FT_Face and @FT_Size
* objects, as well as caching information like character maps and glyph
* images while limiting their maximum memory usage.
*
* Note that all types and functions begin with the `FTC_' prefix.
*
* The cache is highly portable and thus doesn't know anything about the
* fonts installed on your system, or how to access them. This implies
* the following scheme:
*
* First, available or installed font faces are uniquely identified by
* @FTC_FaceID values, provided to the cache by the client. Note that
* the cache only stores and compares these values, and doesn't try to
* interpret them in any way.
*
* Second, the cache calls, only when needed, a client-provided function
* to convert an @FTC_FaceID into a new @FT_Face object. The latter is
* then completely managed by the cache, including its termination
* through @FT_Done_Face. To monitor termination of face objects, the
* finalizer callback in the `generic' field of the @FT_Face object can
* be used, which might also be used to store the @FTC_FaceID of the
* face.
*
* Clients are free to map face IDs to anything else. The most simple
* usage is to associate them to a (pathname,face_index) pair that is
* used to call @FT_New_Face. However, more complex schemes are also
* possible.
*
* Note that for the cache to work correctly, the face ID values must be
* *persistent*, which means that the contents they point to should not
* change at runtime, or that their value should not become invalid.
*
* If this is unavoidable (e.g., when a font is uninstalled at runtime),
* you should call @FTC_Manager_RemoveFaceID as soon as possible, to let
* the cache get rid of any references to the old @FTC_FaceID it may
* keep internally. Failure to do so will lead to incorrect behaviour
* or even crashes.
*
* To use the cache, start with calling @FTC_Manager_New to create a new
* @FTC_Manager object, which models a single cache instance. You can
* then look up @FT_Face and @FT_Size objects with
* @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.
*
* If you want to use the charmap caching, call @FTC_CMapCache_New, then
* later use @FTC_CMapCache_Lookup to perform the equivalent of
* @FT_Get_Char_Index, only much faster.
*
* If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then
* later use @FTC_ImageCache_Lookup to retrieve the corresponding
* @FT_Glyph objects from the cache.
*
* If you need lots of small bitmaps, it is much more memory efficient
* to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This
* returns @FTC_SBitRec structures, which are used to store small
* bitmaps directly. (A small bitmap is one whose metrics and
* dimensions all fit into 8-bit integers).
*
* We hope to also provide a kerning cache in the near future.
*
*
* <Order>
* FTC_Manager
* FTC_FaceID
* FTC_Face_Requester
*
* FTC_Manager_New
* FTC_Manager_Reset
* FTC_Manager_Done
* FTC_Manager_LookupFace
* FTC_Manager_LookupSize
* FTC_Manager_RemoveFaceID
*
* FTC_Node
* FTC_Node_Unref
*
* FTC_ImageCache
* FTC_ImageCache_New
* FTC_ImageCache_Lookup
*
* FTC_SBit
* FTC_SBitCache
* FTC_SBitCache_New
* FTC_SBitCache_Lookup
*
* FTC_CMapCache
* FTC_CMapCache_New
* FTC_CMapCache_Lookup
*
*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** BASIC TYPE DEFINITIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************
*
* @type: FTC_FaceID
*
* @description:
* An opaque pointer type that is used to identity face objects. The
* contents of such objects is application-dependent.
*
* These pointers are typically used to point to a user-defined
* structure containing a font file path, and face index.
*
* @note:
* Never use NULL as a valid @FTC_FaceID.
*
* Face IDs are passed by the client to the cache manager that calls,
* when needed, the @FTC_Face_Requester to translate them into new
* @FT_Face objects.
*
* If the content of a given face ID changes at runtime, or if the value
* becomes invalid (e.g., when uninstalling a font), you should
* immediately call @FTC_Manager_RemoveFaceID before any other cache
* function.
*
* Failure to do so will result in incorrect behaviour or even
* memory leaks and crashes.
*/
typedef FT_Pointer FTC_FaceID;
/************************************************************************
*
* @functype:
* FTC_Face_Requester
*
* @description:
* A callback function provided by client applications. It is used by
* the cache manager to translate a given @FTC_FaceID into a new valid
* @FT_Face object, on demand.
*
* <Input>
* face_id ::
* The face ID to resolve.
*
* library ::
* A handle to a FreeType library object.
*
* req_data ::
* Application-provided request data (see note below).
*
* <Output>
* aface ::
* A new @FT_Face handle.
*
* <Return>
* FreeType error code. 0~means success.
*
* <Note>
* The third parameter `req_data' is the same as the one passed by the
* client when @FTC_Manager_New is called.
*
* The face requester should not perform funny things on the returned
* face object, like creating a new @FT_Size for it, or setting a
* transformation through @FT_Set_Transform!
*/
typedef FT_Error
(*FTC_Face_Requester)( FTC_FaceID face_id,
FT_Library library,
FT_Pointer req_data,
FT_Face* aface );
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CACHE MANAGER OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FTC_Manager */
/* */
/* <Description> */
/* This object corresponds to one instance of the cache-subsystem. */
/* It is used to cache one or more @FT_Face objects, along with */
/* corresponding @FT_Size objects. */
/* */
/* The manager intentionally limits the total number of opened */
/* @FT_Face and @FT_Size objects to control memory usage. See the */
/* `max_faces' and `max_sizes' parameters of @FTC_Manager_New. */
/* */
/* The manager is also used to cache `nodes' of various types while */
/* limiting their total memory usage. */
/* */
/* All limitations are enforced by keeping lists of managed objects */
/* in most-recently-used order, and flushing old nodes to make room */
/* for new ones. */
/* */
typedef struct FTC_ManagerRec_* FTC_Manager;
/*************************************************************************/
/* */
/* <Type> */
/* FTC_Node */
/* */
/* <Description> */
/* An opaque handle to a cache node object. Each cache node is */
/* reference-counted. A node with a count of~0 might be flushed */
/* out of a full cache whenever a lookup request is performed. */
/* */
/* If you look up nodes, you have the ability to `acquire' them, */
/* i.e., to increment their reference count. This will prevent the */
/* node from being flushed out of the cache until you explicitly */
/* `release' it (see @FTC_Node_Unref). */
/* */
/* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */
/* */
typedef struct FTC_NodeRec_* FTC_Node;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_New */
/* */
/* <Description> */
/* Create a new cache manager. */
/* */
/* <Input> */
/* library :: The parent FreeType library handle to use. */
/* */
/* max_faces :: Maximum number of opened @FT_Face objects managed by */
/* this cache instance. Use~0 for defaults. */
/* */
/* max_sizes :: Maximum number of opened @FT_Size objects managed by */
/* this cache instance. Use~0 for defaults. */
/* */
/* max_bytes :: Maximum number of bytes to use for cached data nodes. */
/* Use~0 for defaults. Note that this value does not */
/* account for managed @FT_Face and @FT_Size objects. */
/* */
/* requester :: An application-provided callback used to translate */
/* face IDs into real @FT_Face objects. */
/* */
/* req_data :: A generic pointer that is passed to the requester */
/* each time it is called (see @FTC_Face_Requester). */
/* */
/* <Output> */
/* amanager :: A handle to a new manager object. 0~in case of */
/* failure. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_New( FT_Library library,
FT_UInt max_faces,
FT_UInt max_sizes,
FT_ULong max_bytes,
FTC_Face_Requester requester,
FT_Pointer req_data,
FTC_Manager *amanager );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_Reset */
/* */
/* <Description> */
/* Empty a given cache manager. This simply gets rid of all the */
/* currently cached @FT_Face and @FT_Size objects within the manager. */
/* */
/* <InOut> */
/* manager :: A handle to the manager. */
/* */
FT_EXPORT( void )
FTC_Manager_Reset( FTC_Manager manager );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_Done */
/* */
/* <Description> */
/* Destroy a given manager after emptying it. */
/* */
/* <Input> */
/* manager :: A handle to the target cache manager object. */
/* */
FT_EXPORT( void )
FTC_Manager_Done( FTC_Manager manager );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_LookupFace */
/* */
/* <Description> */
/* Retrieve the @FT_Face object that corresponds to a given face ID */
/* through a cache manager. */
/* */
/* <Input> */
/* manager :: A handle to the cache manager. */
/* */
/* face_id :: The ID of the face object. */
/* */
/* <Output> */
/* aface :: A handle to the face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned @FT_Face object is always owned by the manager. You */
/* should never try to discard it yourself. */
/* */
/* The @FT_Face object doesn't necessarily have a current size object */
/* (i.e., face->size can be~0). If you need a specific `font size', */
/* use @FTC_Manager_LookupSize instead. */
/* */
/* Never change the face's transformation matrix (i.e., never call */
/* the @FT_Set_Transform function) on a returned face! If you need */
/* to transform glyphs, do it yourself after glyph loading. */
/* */
/* When you perform a lookup, out-of-memory errors are detected */
/* _within_ the lookup and force incremental flushes of the cache */
/* until enough memory is released for the lookup to succeed. */
/* */
/* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */
/* already been completely flushed, and still no memory was available */
/* for the operation. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_LookupFace( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_ScalerRec */
/* */
/* <Description> */
/* A structure used to describe a given character size in either */
/* pixels or points to the cache manager. See */
/* @FTC_Manager_LookupSize. */
/* */
/* <Fields> */
/* face_id :: The source face ID. */
/* */
/* width :: The character width. */
/* */
/* height :: The character height. */
/* */
/* pixel :: A Boolean. If 1, the `width' and `height' fields are */
/* interpreted as integer pixel character sizes. */
/* Otherwise, they are expressed as 1/64th of points. */
/* */
/* x_res :: Only used when `pixel' is value~0 to indicate the */
/* horizontal resolution in dpi. */
/* */
/* y_res :: Only used when `pixel' is value~0 to indicate the */
/* vertical resolution in dpi. */
/* */
/* <Note> */
/* This type is mainly used to retrieve @FT_Size objects through the */
/* cache manager. */
/* */
typedef struct FTC_ScalerRec_
{
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int pixel;
FT_UInt x_res;
FT_UInt y_res;
} FTC_ScalerRec;
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_Scaler */
/* */
/* <Description> */
/* A handle to an @FTC_ScalerRec structure. */
/* */
typedef struct FTC_ScalerRec_* FTC_Scaler;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_LookupSize */
/* */
/* <Description> */
/* Retrieve the @FT_Size object that corresponds to a given */
/* @FTC_ScalerRec pointer through a cache manager. */
/* */
/* <Input> */
/* manager :: A handle to the cache manager. */
/* */
/* scaler :: A scaler handle. */
/* */
/* <Output> */
/* asize :: A handle to the size object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned @FT_Size object is always owned by the manager. You */
/* should never try to discard it by yourself. */
/* */
/* You can access the parent @FT_Face object simply as `size->face' */
/* if you need it. Note that this object is also owned by the */
/* manager. */
/* */
/* <Note> */
/* When you perform a lookup, out-of-memory errors are detected */
/* _within_ the lookup and force incremental flushes of the cache */
/* until enough memory is released for the lookup to succeed. */
/* */
/* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */
/* already been completely flushed, and still no memory is available */
/* for the operation. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Node_Unref */
/* */
/* <Description> */
/* Decrement a cache node's internal reference count. When the count */
/* reaches 0, it is not destroyed but becomes eligible for subsequent */
/* cache flushes. */
/* */
/* <Input> */
/* node :: The cache node handle. */
/* */
/* manager :: The cache manager handle. */
/* */
FT_EXPORT( void )
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager );
/*************************************************************************
*
* @function:
* FTC_Manager_RemoveFaceID
*
* @description:
* A special function used to indicate to the cache manager that
* a given @FTC_FaceID is no longer valid, either because its
* content changed, or because it was deallocated or uninstalled.
*
* @input:
* manager ::
* The cache manager handle.
*
* face_id ::
* The @FTC_FaceID to be removed.
*
* @note:
* This function flushes all nodes from the cache corresponding to this
* `face_id', with the exception of nodes with a non-null reference
* count.
*
* Such nodes are however modified internally so as to never appear
* in later lookups with the same `face_id' value, and to be immediately
* destroyed when released by all their users.
*
*/
FT_EXPORT( void )
FTC_Manager_RemoveFaceID( FTC_Manager manager,
FTC_FaceID face_id );
/*************************************************************************
*
* @type:
* FTC_CMapCache
*
* @description:
* An opaque handle used to model a charmap cache. This cache is to
* hold character codes -> glyph indices mappings.
*
*/
typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
/*************************************************************************
*
* @function:
* FTC_CMapCache_New
*
* @description:
* Create a new charmap cache.
*
* @input:
* manager ::
* A handle to the cache manager.
*
* @output:
* acache ::
* A new cache handle. NULL in case of error.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Like all other caches, this one will be destroyed with the cache
* manager.
*
*/
FT_EXPORT( FT_Error )
FTC_CMapCache_New( FTC_Manager manager,
FTC_CMapCache *acache );
/************************************************************************
*
* @function:
* FTC_CMapCache_Lookup
*
* @description:
* Translate a character code into a glyph index, using the charmap
* cache.
*
* @input:
* cache ::
* A charmap cache handle.
*
* face_id ::
* The source face ID.
*
* cmap_index ::
* The index of the charmap in the source face. Any negative value
* means to use the cache @FT_Face's default charmap.
*
* char_code ::
* The character code (in the corresponding charmap).
*
* @return:
* Glyph index. 0~means `no glyph'.
*
*/
FT_EXPORT( FT_UInt )
FTC_CMapCache_Lookup( FTC_CMapCache cache,
FTC_FaceID face_id,
FT_Int cmap_index,
FT_UInt32 char_code );
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** IMAGE CACHE OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************
*
* @struct:
* FTC_ImageTypeRec
*
* @description:
* A structure used to model the type of images in a glyph cache.
*
* @fields:
* face_id ::
* The face ID.
*
* width ::
* The width in pixels.
*
* height ::
* The height in pixels.
*
* flags ::
* The load flags, as in @FT_Load_Glyph.
*
*/
typedef struct FTC_ImageTypeRec_
{
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int32 flags;
} FTC_ImageTypeRec;
/*************************************************************************
*
* @type:
* FTC_ImageType
*
* @description:
* A handle to an @FTC_ImageTypeRec structure.
*
*/
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
/* */
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( (d1)->face_id == (d2)->face_id && \
(d1)->width == (d2)->width && \
(d1)->flags == (d2)->flags )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_ImageCache */
/* */
/* <Description> */
/* A handle to a glyph image cache object. They are designed to */
/* hold many distinct glyph images while not exceeding a certain */
/* memory threshold. */
/* */
typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_New */
/* */
/* <Description> */
/* Create a new glyph image cache. */
/* */
/* <Input> */
/* manager :: The parent manager for the image cache. */
/* */
/* <Output> */
/* acache :: A handle to the new glyph image cache object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_New( FTC_Manager manager,
FTC_ImageCache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_Lookup */
/* */
/* <Description> */
/* Retrieve a given glyph image from a glyph image cache. */
/* */
/* <Input> */
/* cache :: A handle to the source glyph image cache. */
/* */
/* type :: A pointer to a glyph image type descriptor. */
/* */
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
/* failure. */
/* */
/* anode :: Used to return the address of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
/* Never try to transform or discard it manually! You can however */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the glyph image, after increasing its reference */
/* count. This ensures that the node (as well as the @FT_Glyph) will */
/* always be kept in the cache until you call @FTC_Node_Unref to */
/* `release' it. */
/* */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the @FT_Glyph could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_Lookup( FTC_ImageCache cache,
FTC_ImageType type,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_ImageCache_LookupScaler */
/* */
/* <Description> */
/* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec */
/* to specify the face ID and its size. */
/* */
/* <Input> */
/* cache :: A handle to the source glyph image cache. */
/* */
/* scaler :: A pointer to a scaler descriptor. */
/* */
/* load_flags :: The corresponding load flags. */
/* */
/* gindex :: The glyph index to retrieve. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
/* failure. */
/* */
/* anode :: Used to return the address of the corresponding */
/* cache node after incrementing its reference count */
/* (see note below). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The returned glyph is owned and managed by the glyph image cache. */
/* Never try to transform or discard it manually! You can however */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the glyph image, after increasing its reference */
/* count. This ensures that the node (as well as the @FT_Glyph) will */
/* always be kept in the cache until you call @FTC_Node_Unref to */
/* `release' it. */
/* */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the @FT_Glyph could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
/* Calls to @FT_Set_Char_Size and friends have no effect on cached */
/* glyphs; you should always use the FreeType cache API instead. */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_LookupScaler( FTC_ImageCache cache,
FTC_Scaler scaler,
FT_ULong load_flags,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit */
/* */
/* <Description> */
/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
/* structure for details. */
/* */
typedef struct FTC_SBitRec_* FTC_SBit;
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_SBitRec */
/* */
/* <Description> */
/* A very compact structure used to describe a small glyph bitmap. */
/* */
/* <Fields> */
/* width :: The bitmap width in pixels. */
/* */
/* height :: The bitmap height in pixels. */
/* */
/* left :: The horizontal distance from the pen position to the */
/* left bitmap border (a.k.a. `left side bearing', or */
/* `lsb'). */
/* */
/* top :: The vertical distance from the pen position (on the */
/* baseline) to the upper bitmap border (a.k.a. `top */
/* side bearing'). The distance is positive for upwards */
/* y~coordinates. */
/* */
/* format :: The format of the glyph bitmap (monochrome or gray). */
/* */
/* max_grays :: Maximum gray level value (in the range 1 to~255). */
/* */
/* pitch :: The number of bytes per bitmap line. May be positive */
/* or negative. */
/* */
/* xadvance :: The horizontal advance width in pixels. */
/* */
/* yadvance :: The vertical advance height in pixels. */
/* */
/* buffer :: A pointer to the bitmap pixels. */
/* */
typedef struct FTC_SBitRec_
{
FT_Byte width;
FT_Byte height;
FT_Char left;
FT_Char top;
FT_Byte format;
FT_Byte max_grays;
FT_Short pitch;
FT_Char xadvance;
FT_Char yadvance;
FT_Byte* buffer;
} FTC_SBitRec;
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBitCache */
/* */
/* <Description> */
/* A handle to a small bitmap cache. These are special cache objects */
/* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
/* much more efficient way than the traditional glyph image cache */
/* implemented by @FTC_ImageCache. */
/* */
typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_New */
/* */
/* <Description> */
/* Create a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_Lookup */
/* */
/* <Description> */
/* Look up a given small glyph bitmap in a given sbit cache and */
/* `lock' it to prevent its flushing from the cache until needed. */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
/* */
/* type :: A pointer to the glyph image type descriptor. */
/* */
/* gindex :: The glyph index. */
/* */
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* anode :: Used to return the address of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
/* cache and should never be freed by the application. They might */
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
/* The descriptor's `buffer' field is set to~0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the bitmap, after increasing its reference count. */
/* This ensures that the node (as well as the image) will always be */
/* kept in the cache until you call @FTC_Node_Unref to `release' it. */
/* */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the bitmap could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_LookupScaler */
/* */
/* <Description> */
/* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec */
/* to specify the face ID and its size. */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
/* */
/* scaler :: A pointer to the scaler descriptor. */
/* */
/* load_flags :: The corresponding load flags. */
/* */
/* gindex :: The glyph index. */
/* */
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* anode :: Used to return the address of the corresponding */
/* cache node after incrementing its reference count */
/* (see note below). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The small bitmap descriptor and its bit buffer are owned by the */
/* cache and should never be freed by the application. They might */
/* as well disappear from memory on the next cache lookup, so don't */
/* treat them as persistent data. */
/* */
/* The descriptor's `buffer' field is set to~0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the bitmap, after increasing its reference count. */
/* This ensures that the node (as well as the image) will always be */
/* kept in the cache until you call @FTC_Node_Unref to `release' it. */
/* */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the bitmap could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_LookupScaler( FTC_SBitCache cache,
FTC_Scaler scaler,
FT_ULong load_flags,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
/* */
FT_END_HEADER
#endif /* FTCACHE_H_ */
/* END */
/***************************************************************************/
/* */
/* ftotval.h */
/* */
/* FreeType API for validating OpenType tables (specification). */
/* */
/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* */
/* Warning: This module might be moved to a different library in the */
/* future to avoid a tight dependency between FreeType and the */
/* OpenType specification. */
/* */
/* */
/***************************************************************************/
#ifndef FTOTVAL_H_
#define FTOTVAL_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* ot_validation */
/* */
/* <Title> */
/* OpenType Validation */
/* */
/* <Abstract> */
/* An API to validate OpenType tables. */
/* */
/* <Description> */
/* This section contains the declaration of functions to validate */
/* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */
/* */
/* <Order> */
/* FT_OpenType_Validate */
/* FT_OpenType_Free */
/* */
/* FT_VALIDATE_OTXXX */
/* */
/*************************************************************************/
/**********************************************************************
*
* @enum:
* FT_VALIDATE_OTXXX
*
* @description:
* A list of bit-field constants used with @FT_OpenType_Validate to
* indicate which OpenType tables should be validated.
*
* @values:
* FT_VALIDATE_BASE ::
* Validate BASE table.
*
* FT_VALIDATE_GDEF ::
* Validate GDEF table.
*
* FT_VALIDATE_GPOS ::
* Validate GPOS table.
*
* FT_VALIDATE_GSUB ::
* Validate GSUB table.
*
* FT_VALIDATE_JSTF ::
* Validate JSTF table.
*
* FT_VALIDATE_MATH ::
* Validate MATH table.
*
* FT_VALIDATE_OT ::
* Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).
*
*/
#define FT_VALIDATE_BASE 0x0100
#define FT_VALIDATE_GDEF 0x0200
#define FT_VALIDATE_GPOS 0x0400
#define FT_VALIDATE_GSUB 0x0800
#define FT_VALIDATE_JSTF 0x1000
#define FT_VALIDATE_MATH 0x2000
#define FT_VALIDATE_OT ( FT_VALIDATE_BASE | \
FT_VALIDATE_GDEF | \
FT_VALIDATE_GPOS | \
FT_VALIDATE_GSUB | \
FT_VALIDATE_JSTF | \
FT_VALIDATE_MATH )
/**********************************************************************
*
* @function:
* FT_OpenType_Validate
*
* @description:
* Validate various OpenType tables to assure that all offsets and
* indices are valid. The idea is that a higher-level library that
* actually does the text layout can access those tables without
* error checking (which can be quite time consuming).
*
* @input:
* face ::
* A handle to the input face.
*
* validation_flags ::
* A bit field that specifies the tables to be validated. See
* @FT_VALIDATE_OTXXX for possible values.
*
* @output:
* BASE_table ::
* A pointer to the BASE table.
*
* GDEF_table ::
* A pointer to the GDEF table.
*
* GPOS_table ::
* A pointer to the GPOS table.
*
* GSUB_table ::
* A pointer to the GSUB table.
*
* JSTF_table ::
* A pointer to the JSTF table.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with OpenType fonts, returning an error
* otherwise.
*
* After use, the application should deallocate the five tables with
* @FT_OpenType_Free. A NULL value indicates that the table either
* doesn't exist in the font, or the application hasn't asked for
* validation.
*/
FT_EXPORT( FT_Error )
FT_OpenType_Validate( FT_Face face,
FT_UInt validation_flags,
FT_Bytes *BASE_table,
FT_Bytes *GDEF_table,
FT_Bytes *GPOS_table,
FT_Bytes *GSUB_table,
FT_Bytes *JSTF_table );
/**********************************************************************
*
* @function:
* FT_OpenType_Free
*
* @description:
* Free the buffer allocated by OpenType validator.
*
* @input:
* face ::
* A handle to the input face.
*
* table ::
* The pointer to the buffer that is allocated by
* @FT_OpenType_Validate.
*
* @note:
* This function must be used to free the buffer allocated by
* @FT_OpenType_Validate only.
*/
FT_EXPORT( void )
FT_OpenType_Free( FT_Face face,
FT_Bytes table );
/* */
FT_END_HEADER
#endif /* FTOTVAL_H_ */
/* END */
/***************************************************************************/
/* */
/* ftbbox.h */
/* */
/* FreeType exact bbox computation (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This component has a _single_ role: to compute exact outline bounding */
/* boxes. */
/* */
/* It is separated from the rest of the engine for various technical */
/* reasons. It may well be integrated in `ftoutln' later. */
/* */
/*************************************************************************/
#ifndef FTBBOX_H_
#define FTBBOX_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* outline_processing */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_Get_BBox */
/* */
/* <Description> */
/* Compute the exact bounding box of an outline. This is slower */
/* than computing the control box. However, it uses an advanced */
/* algorithm that returns _very_ quickly when the two boxes */
/* coincide. Otherwise, the outline Bezier arcs are traversed to */
/* extract their extrema. */
/* */
/* <Input> */
/* outline :: A pointer to the source outline. */
/* */
/* <Output> */
/* abbox :: The outline's exact bounding box. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* If the font is tricky and the glyph has been loaded with */
/* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */
/* reasonable values for the BBox it is necessary to load the glyph */
/* at a large ppem value (so that the hinting instructions can */
/* properly shift and scale the subglyphs), then extracting the BBox, */
/* which can be eventually converted back to font units. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_Get_BBox( FT_Outline* outline,
FT_BBox *abbox );
/* */
FT_END_HEADER
#endif /* FTBBOX_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/***************************************************************************/
/* */
/* tttables.h */
/* */
/* Basic SFNT/TrueType tables definitions and interface */
/* (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef TTTABLES_H_
#define TTTABLES_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* truetype_tables */
/* */
/* <Title> */
/* TrueType Tables */
/* */
/* <Abstract> */
/* TrueType specific table types and functions. */
/* */
/* <Description> */
/* This section contains definitions of some basic tables specific to */
/* TrueType and OpenType as well as some routines used to access and */
/* process them. */
/* */
/* <Order> */
/* TT_Header */
/* TT_HoriHeader */
/* TT_VertHeader */
/* TT_OS2 */
/* TT_Postscript */
/* TT_PCLT */
/* TT_MaxProfile */
/* */
/* FT_Sfnt_Tag */
/* FT_Get_Sfnt_Table */
/* FT_Load_Sfnt_Table */
/* FT_Sfnt_Table_Info */
/* */
/* FT_Get_CMap_Language_ID */
/* FT_Get_CMap_Format */
/* */
/* FT_PARAM_TAG_UNPATENTED_HINTING */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Header */
/* */
/* <Description> */
/* A structure to model a TrueType font header table. All fields */
/* follow the OpenType specification. */
/* */
typedef struct TT_Header_
{
FT_Fixed Table_Version;
FT_Fixed Font_Revision;
FT_Long CheckSum_Adjust;
FT_Long Magic_Number;
FT_UShort Flags;
FT_UShort Units_Per_EM;
FT_Long Created [2];
FT_Long Modified[2];
FT_Short xMin;
FT_Short yMin;
FT_Short xMax;
FT_Short yMax;
FT_UShort Mac_Style;
FT_UShort Lowest_Rec_PPEM;
FT_Short Font_Direction;
FT_Short Index_To_Loc_Format;
FT_Short Glyph_Data_Format;
} TT_Header;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_HoriHeader */
/* */
/* <Description> */
/* A structure to model a TrueType horizontal header, the `hhea' */
/* table, as well as the corresponding horizontal metrics table, */
/* `hmtx'. */
/* */
/* <Fields> */
/* Version :: The table version. */
/* */
/* Ascender :: The font's ascender, i.e., the distance */
/* from the baseline to the top-most of all */
/* glyph points found in the font. */
/* */
/* This value is invalid in many fonts, as */
/* it is usually set by the font designer, */
/* and often reflects only a portion of the */
/* glyphs found in the font (maybe ASCII). */
/* */
/* You should use the `sTypoAscender' field */
/* of the `OS/2' table instead if you want */
/* the correct one. */
/* */
/* Descender :: The font's descender, i.e., the distance */
/* from the baseline to the bottom-most of */
/* all glyph points found in the font. It */
/* is negative. */
/* */
/* This value is invalid in many fonts, as */
/* it is usually set by the font designer, */
/* and often reflects only a portion of the */
/* glyphs found in the font (maybe ASCII). */
/* */
/* You should use the `sTypoDescender' */
/* field of the `OS/2' table instead if you */
/* want the correct one. */
/* */
/* Line_Gap :: The font's line gap, i.e., the distance */
/* to add to the ascender and descender to */
/* get the BTB, i.e., the */
/* baseline-to-baseline distance for the */
/* font. */
/* */
/* advance_Width_Max :: This field is the maximum of all advance */
/* widths found in the font. It can be */
/* used to compute the maximum width of an */
/* arbitrary string of text. */
/* */
/* min_Left_Side_Bearing :: The minimum left side bearing of all */
/* glyphs within the font. */
/* */
/* min_Right_Side_Bearing :: The minimum right side bearing of all */
/* glyphs within the font. */
/* */
/* xMax_Extent :: The maximum horizontal extent (i.e., the */
/* `width' of a glyph's bounding box) for */
/* all glyphs in the font. */
/* */
/* caret_Slope_Rise :: The rise coefficient of the cursor's */
/* slope of the cursor (slope=rise/run). */
/* */
/* caret_Slope_Run :: The run coefficient of the cursor's */
/* slope. */
/* */
/* caret_Offset :: The cursor's offset for slanted fonts. */
/* */
/* Reserved :: 8~reserved bytes. */
/* */
/* metric_Data_Format :: Always~0. */
/* */
/* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */
/* table -- this value can be smaller than */
/* the total number of glyphs in the font. */
/* */
/* long_metrics :: A pointer into the `hmtx' table. */
/* */
/* short_metrics :: A pointer into the `hmtx' table. */
/* */
/* <Note> */
/* For an OpenType variation font, the values of the following fields */
/* can change after a call to @FT_Set_Var_Design_Coordinates (and */
/* friends) if the font contains an `MVAR' table: `caret_Slope_Rise', */
/* `caret_Slope_Run', and `caret_Offset'. */
/* */
typedef struct TT_HoriHeader_
{
FT_Fixed Version;
FT_Short Ascender;
FT_Short Descender;
FT_Short Line_Gap;
FT_UShort advance_Width_Max; /* advance width maximum */
FT_Short min_Left_Side_Bearing; /* minimum left-sb */
FT_Short min_Right_Side_Bearing; /* minimum right-sb */
FT_Short xMax_Extent; /* xmax extents */
FT_Short caret_Slope_Rise;
FT_Short caret_Slope_Run;
FT_Short caret_Offset;
FT_Short Reserved[4];
FT_Short metric_Data_Format;
FT_UShort number_Of_HMetrics;
/* The following fields are not defined by the OpenType specification */
/* but they are used to connect the metrics header to the relevant */
/* `hmtx' table. */
void* long_metrics;
void* short_metrics;
} TT_HoriHeader;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_VertHeader */
/* */
/* <Description> */
/* A structure used to model a TrueType vertical header, the `vhea' */
/* table, as well as the corresponding vertical metrics table, */
/* `vmtx'. */
/* */
/* <Fields> */
/* Version :: The table version. */
/* */
/* Ascender :: The font's ascender, i.e., the distance */
/* from the baseline to the top-most of */
/* all glyph points found in the font. */
/* */
/* This value is invalid in many fonts, as */
/* it is usually set by the font designer, */
/* and often reflects only a portion of */
/* the glyphs found in the font (maybe */
/* ASCII). */
/* */
/* You should use the `sTypoAscender' */
/* field of the `OS/2' table instead if */
/* you want the correct one. */
/* */
/* Descender :: The font's descender, i.e., the */
/* distance from the baseline to the */
/* bottom-most of all glyph points found */
/* in the font. It is negative. */
/* */
/* This value is invalid in many fonts, as */
/* it is usually set by the font designer, */
/* and often reflects only a portion of */
/* the glyphs found in the font (maybe */
/* ASCII). */
/* */
/* You should use the `sTypoDescender' */
/* field of the `OS/2' table instead if */
/* you want the correct one. */
/* */
/* Line_Gap :: The font's line gap, i.e., the distance */
/* to add to the ascender and descender to */
/* get the BTB, i.e., the */
/* baseline-to-baseline distance for the */
/* font. */
/* */
/* advance_Height_Max :: This field is the maximum of all */
/* advance heights found in the font. It */
/* can be used to compute the maximum */
/* height of an arbitrary string of text. */
/* */
/* min_Top_Side_Bearing :: The minimum top side bearing of all */
/* glyphs within the font. */
/* */
/* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */
/* glyphs within the font. */
/* */
/* yMax_Extent :: The maximum vertical extent (i.e., the */
/* `height' of a glyph's bounding box) for */
/* all glyphs in the font. */
/* */
/* caret_Slope_Rise :: The rise coefficient of the cursor's */
/* slope of the cursor (slope=rise/run). */
/* */
/* caret_Slope_Run :: The run coefficient of the cursor's */
/* slope. */
/* */
/* caret_Offset :: The cursor's offset for slanted fonts. */
/* */
/* Reserved :: 8~reserved bytes. */
/* */
/* metric_Data_Format :: Always~0. */
/* */
/* number_Of_VMetrics :: Number of VMetrics entries in the */
/* `vmtx' table -- this value can be */
/* smaller than the total number of glyphs */
/* in the font. */
/* */
/* long_metrics :: A pointer into the `vmtx' table. */
/* */
/* short_metrics :: A pointer into the `vmtx' table. */
/* */
/* <Note> */
/* For an OpenType variation font, the values of the following fields */
/* can change after a call to @FT_Set_Var_Design_Coordinates (and */
/* friends) if the font contains an `MVAR' table: `Ascender', */
/* `Descender', `Line_Gap', `caret_Slope_Rise', `caret_Slope_Run', */
/* and `caret_Offset'. */
/* */
typedef struct TT_VertHeader_
{
FT_Fixed Version;
FT_Short Ascender;
FT_Short Descender;
FT_Short Line_Gap;
FT_UShort advance_Height_Max; /* advance height maximum */
FT_Short min_Top_Side_Bearing; /* minimum top-sb */
FT_Short min_Bottom_Side_Bearing; /* minimum bottom-sb */
FT_Short yMax_Extent; /* ymax extents */
FT_Short caret_Slope_Rise;
FT_Short caret_Slope_Run;
FT_Short caret_Offset;
FT_Short Reserved[4];
FT_Short metric_Data_Format;
FT_UShort number_Of_VMetrics;
/* The following fields are not defined by the OpenType specification */
/* but they are used to connect the metrics header to the relevant */
/* `vmtx' table. */
void* long_metrics;
void* short_metrics;
} TT_VertHeader;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_OS2 */
/* */
/* <Description> */
/* A structure to model a TrueType `OS/2' table. All fields comply */
/* to the OpenType specification. */
/* */
/* Note that we now support old Mac fonts that do not include an */
/* `OS/2' table. In this case, the `version' field is always set to */
/* 0xFFFF. */
/* */
/* <Note> */
/* For an OpenType variation font, the values of the following fields */
/* can change after a call to @FT_Set_Var_Design_Coordinates (and */
/* friends) if the font contains an `MVAR' table: `sCapHeight', */
/* `sTypoAscender', `sTypoDescender', `sTypoLineGap', `sxHeight', */
/* `usWinAscent', `usWinDescent', `yStrikeoutPosition', */
/* `yStrikeoutSize', `ySubscriptXOffset', `ySubScriptXSize', */
/* `ySubscriptYOffset', `ySubscriptYSize', `ySuperscriptXOffset', */
/* `ySuperscriptXSize', `ySuperscriptYOffset', and */
/* `ySuperscriptYSize'. */
/* */
/* Possible values for bits in the `ulUnicodeRangeX' fields are given */
/* by the @TT_UCR_XXX macros. */
/* */
typedef struct TT_OS2_
{
FT_UShort version; /* 0x0001 - more or 0xFFFF */
FT_Short xAvgCharWidth;
FT_UShort usWeightClass;
FT_UShort usWidthClass;
FT_UShort fsType;
FT_Short ySubscriptXSize;
FT_Short ySubscriptYSize;
FT_Short ySubscriptXOffset;
FT_Short ySubscriptYOffset;
FT_Short ySuperscriptXSize;
FT_Short ySuperscriptYSize;
FT_Short ySuperscriptXOffset;
FT_Short ySuperscriptYOffset;
FT_Short yStrikeoutSize;
FT_Short yStrikeoutPosition;
FT_Short sFamilyClass;
FT_Byte panose[10];
FT_ULong ulUnicodeRange1; /* Bits 0-31 */
FT_ULong ulUnicodeRange2; /* Bits 32-63 */
FT_ULong ulUnicodeRange3; /* Bits 64-95 */
FT_ULong ulUnicodeRange4; /* Bits 96-127 */
FT_Char achVendID[4];
FT_UShort fsSelection;
FT_UShort usFirstCharIndex;
FT_UShort usLastCharIndex;
FT_Short sTypoAscender;
FT_Short sTypoDescender;
FT_Short sTypoLineGap;
FT_UShort usWinAscent;
FT_UShort usWinDescent;
/* only version 1 and higher: */
FT_ULong ulCodePageRange1; /* Bits 0-31 */
FT_ULong ulCodePageRange2; /* Bits 32-63 */
/* only version 2 and higher: */
FT_Short sxHeight;
FT_Short sCapHeight;
FT_UShort usDefaultChar;
FT_UShort usBreakChar;
FT_UShort usMaxContext;
/* only version 5 and higher: */
FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */
FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */
} TT_OS2;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Postscript */
/* */
/* <Description> */
/* A structure to model a TrueType `post' table. All fields comply */
/* to the OpenType specification. This structure does not reference */
/* a font's PostScript glyph names; use @FT_Get_Glyph_Name to */
/* retrieve them. */
/* */
/* <Note> */
/* For an OpenType variation font, the values of the following fields */
/* can change after a call to @FT_Set_Var_Design_Coordinates (and */
/* friends) if the font contains an `MVAR' table: `underlinePosition' */
/* and `underlineThickness'. */
/* */
typedef struct TT_Postscript_
{
FT_Fixed FormatType;
FT_Fixed italicAngle;
FT_Short underlinePosition;
FT_Short underlineThickness;
FT_ULong isFixedPitch;
FT_ULong minMemType42;
FT_ULong maxMemType42;
FT_ULong minMemType1;
FT_ULong maxMemType1;
/* Glyph names follow in the `post' table, but we don't */
/* load them by default. */
} TT_Postscript;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_PCLT */
/* */
/* <Description> */
/* A structure to model a TrueType `PCLT' table. All fields comply */
/* to the OpenType specification. */
/* */
typedef struct TT_PCLT_
{
FT_Fixed Version;
FT_ULong FontNumber;
FT_UShort Pitch;
FT_UShort xHeight;
FT_UShort Style;
FT_UShort TypeFamily;
FT_UShort CapHeight;
FT_UShort SymbolSet;
FT_Char TypeFace[16];
FT_Char CharacterComplement[8];
FT_Char FileName[6];
FT_Char StrokeWeight;
FT_Char WidthType;
FT_Byte SerifStyle;
FT_Byte Reserved;
} TT_PCLT;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_MaxProfile */
/* */
/* <Description> */
/* The maximum profile (`maxp') table contains many max values, which */
/* can be used to pre-allocate arrays for speeding up glyph loading */
/* and hinting. */
/* */
/* <Fields> */
/* version :: The version number. */
/* */
/* numGlyphs :: The number of glyphs in this TrueType */
/* font. */
/* */
/* maxPoints :: The maximum number of points in a */
/* non-composite TrueType glyph. See also */
/* `maxCompositePoints'. */
/* */
/* maxContours :: The maximum number of contours in a */
/* non-composite TrueType glyph. See also */
/* `maxCompositeContours'. */
/* */
/* maxCompositePoints :: The maximum number of points in a */
/* composite TrueType glyph. See also */
/* `maxPoints'. */
/* */
/* maxCompositeContours :: The maximum number of contours in a */
/* composite TrueType glyph. See also */
/* `maxContours'. */
/* */
/* maxZones :: The maximum number of zones used for */
/* glyph hinting. */
/* */
/* maxTwilightPoints :: The maximum number of points in the */
/* twilight zone used for glyph hinting. */
/* */
/* maxStorage :: The maximum number of elements in the */
/* storage area used for glyph hinting. */
/* */
/* maxFunctionDefs :: The maximum number of function */
/* definitions in the TrueType bytecode for */
/* this font. */
/* */
/* maxInstructionDefs :: The maximum number of instruction */
/* definitions in the TrueType bytecode for */
/* this font. */
/* */
/* maxStackElements :: The maximum number of stack elements used */
/* during bytecode interpretation. */
/* */
/* maxSizeOfInstructions :: The maximum number of TrueType opcodes */
/* used for glyph hinting. */
/* */
/* maxComponentElements :: The maximum number of simple (i.e., non- */
/* composite) glyphs in a composite glyph. */
/* */
/* maxComponentDepth :: The maximum nesting depth of composite */
/* glyphs. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_MaxProfile_
{
FT_Fixed version;
FT_UShort numGlyphs;
FT_UShort maxPoints;
FT_UShort maxContours;
FT_UShort maxCompositePoints;
FT_UShort maxCompositeContours;
FT_UShort maxZones;
FT_UShort maxTwilightPoints;
FT_UShort maxStorage;
FT_UShort maxFunctionDefs;
FT_UShort maxInstructionDefs;
FT_UShort maxStackElements;
FT_UShort maxSizeOfInstructions;
FT_UShort maxComponentElements;
FT_UShort maxComponentDepth;
} TT_MaxProfile;
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Sfnt_Tag */
/* */
/* <Description> */
/* An enumeration to specify indices of SFNT tables loaded and parsed */
/* by FreeType during initialization of an SFNT font. Used in the */
/* @FT_Get_Sfnt_Table API function. */
/* */
/* <Values> */
/* FT_SFNT_HEAD :: To access the font's @TT_Header structure. */
/* */
/* FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure. */
/* */
/* FT_SFNT_OS2 :: To access the font's @TT_OS2 structure. */
/* */
/* FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure. */
/* */
/* FT_SFNT_VHEA :: To access the font's @TT_VertHeader structure. */
/* */
/* FT_SFNT_POST :: To access the font's @TT_Postscript structure. */
/* */
/* FT_SFNT_PCLT :: To access the font's @TT_PCLT structure. */
/* */
typedef enum FT_Sfnt_Tag_
{
FT_SFNT_HEAD,
FT_SFNT_MAXP,
FT_SFNT_OS2,
FT_SFNT_HHEA,
FT_SFNT_VHEA,
FT_SFNT_POST,
FT_SFNT_PCLT,
FT_SFNT_MAX
} FT_Sfnt_Tag;
/* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */
/* values instead */
#define ft_sfnt_head FT_SFNT_HEAD
#define ft_sfnt_maxp FT_SFNT_MAXP
#define ft_sfnt_os2 FT_SFNT_OS2
#define ft_sfnt_hhea FT_SFNT_HHEA
#define ft_sfnt_vhea FT_SFNT_VHEA
#define ft_sfnt_post FT_SFNT_POST
#define ft_sfnt_pclt FT_SFNT_PCLT
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Sfnt_Table */
/* */
/* <Description> */
/* Return a pointer to a given SFNT table stored within a face. */
/* */
/* <Input> */
/* face :: A handle to the source. */
/* */
/* tag :: The index of the SFNT table. */
/* */
/* <Return> */
/* A type-less pointer to the table. This will be NULL in case of */
/* error, or if the corresponding table was not found *OR* loaded */
/* from the file. */
/* */
/* Use a typecast according to `tag' to access the structure */
/* elements. */
/* */
/* <Note> */
/* The table is owned by the face object and disappears with it. */
/* */
/* This function is only useful to access SFNT tables that are loaded */
/* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */
/* a list. */
/* */
/* Here an example how to access the `vhea' table: */
/* */
/* { */
/* TT_VertHeader* vert_header; */
/* */
/* */
/* vert_header = */
/* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */
/* } */
/* */
FT_EXPORT( void* )
FT_Get_Sfnt_Table( FT_Face face,
FT_Sfnt_Tag tag );
/**************************************************************************
*
* @function:
* FT_Load_Sfnt_Table
*
* @description:
* Load any SFNT font table into client memory.
*
* @input:
* face ::
* A handle to the source face.
*
* tag ::
* The four-byte tag of the table to load. Use value~0 if you want
* to access the whole font file. Otherwise, you can use one of the
* definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
* one with @FT_MAKE_TAG.
*
* offset ::
* The starting offset in the table (or file if tag~==~0).
*
* @output:
* buffer ::
* The target buffer address. The client must ensure that the memory
* array is big enough to hold the data.
*
* @inout:
* length ::
* If the `length' parameter is NULL, try to load the whole table.
* Return an error code if it fails.
*
* Else, if `*length' is~0, exit immediately while returning the
* table's (or file) full size in it.
*
* Else the number of bytes to read from the table or file, from the
* starting offset.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If you need to determine the table's length you should first call this
* function with `*length' set to~0, as in the following example:
*
* {
* FT_ULong length = 0;
*
*
* error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
* if ( error ) { ... table does not exist ... }
*
* buffer = malloc( length );
* if ( buffer == NULL ) { ... not enough memory ... }
*
* error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );
* if ( error ) { ... could not load table ... }
* }
*
* Note that structures like @TT_Header or @TT_OS2 can't be used with
* this function; they are limited to @FT_Get_Sfnt_Table. Reason is that
* those structures depend on the processor architecture, with varying
* size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian).
*
*/
FT_EXPORT( FT_Error )
FT_Load_Sfnt_Table( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
/**************************************************************************
*
* @function:
* FT_Sfnt_Table_Info
*
* @description:
* Return information on an SFNT table.
*
* @input:
* face ::
* A handle to the source face.
*
* table_index ::
* The index of an SFNT table. The function returns
* FT_Err_Table_Missing for an invalid value.
*
* @inout:
* tag ::
* The name tag of the SFNT table. If the value is NULL, `table_index'
* is ignored, and `length' returns the number of SFNT tables in the
* font.
*
* @output:
* length ::
* The length of the SFNT table (or the number of SFNT tables, depending
* on `tag').
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* While parsing fonts, FreeType handles SFNT tables with length zero as
* missing.
*
*/
FT_EXPORT( FT_Error )
FT_Sfnt_Table_Info( FT_Face face,
FT_UInt table_index,
FT_ULong *tag,
FT_ULong *length );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_CMap_Language_ID */
/* */
/* <Description> */
/* Return cmap language ID as specified in the OpenType standard. */
/* Definitions of language ID values are in file @FT_TRUETYPE_IDS_H. */
/* */
/* <Input> */
/* charmap :: */
/* The target charmap. */
/* */
/* <Return> */
/* The language ID of `charmap'. If `charmap' doesn't belong to an */
/* SFNT face, just return~0 as the default value. */
/* */
/* For a format~14 cmap (to access Unicode IVS), the return value is */
/* 0xFFFFFFFF. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_CMap_Format */
/* */
/* <Description> */
/* Return the format of an SFNT `cmap' table. */
/* */
/* <Input> */
/* charmap :: */
/* The target charmap. */
/* */
/* <Return> */
/* The format of `charmap'. If `charmap' doesn't belong to an SFNT */
/* face, return -1. */
/* */
FT_EXPORT( FT_Long )
FT_Get_CMap_Format( FT_CharMap charmap );
/* */
FT_END_HEADER
#endif /* TTTABLES_H_ */
/* END */
/***************************************************************************/
/* */
/* ftbdf.h */
/* */
/* FreeType API for accessing BDF-specific strings (specification). */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTBDF_H_
#define FTBDF_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* bdf_fonts */
/* */
/* <Title> */
/* BDF and PCF Files */
/* */
/* <Abstract> */
/* BDF and PCF specific API. */
/* */
/* <Description> */
/* This section contains the declaration of functions specific to BDF */
/* and PCF fonts. */
/* */
/*************************************************************************/
/**********************************************************************
*
* @enum:
* BDF_PropertyType
*
* @description:
* A list of BDF property types.
*
* @values:
* BDF_PROPERTY_TYPE_NONE ::
* Value~0 is used to indicate a missing property.
*
* BDF_PROPERTY_TYPE_ATOM ::
* Property is a string atom.
*
* BDF_PROPERTY_TYPE_INTEGER ::
* Property is a 32-bit signed integer.
*
* BDF_PROPERTY_TYPE_CARDINAL ::
* Property is a 32-bit unsigned integer.
*/
typedef enum BDF_PropertyType_
{
BDF_PROPERTY_TYPE_NONE = 0,
BDF_PROPERTY_TYPE_ATOM = 1,
BDF_PROPERTY_TYPE_INTEGER = 2,
BDF_PROPERTY_TYPE_CARDINAL = 3
} BDF_PropertyType;
/**********************************************************************
*
* @type:
* BDF_Property
*
* @description:
* A handle to a @BDF_PropertyRec structure to model a given
* BDF/PCF property.
*/
typedef struct BDF_PropertyRec_* BDF_Property;
/**********************************************************************
*
* @struct:
* BDF_PropertyRec
*
* @description:
* This structure models a given BDF/PCF property.
*
* @fields:
* type ::
* The property type.
*
* u.atom ::
* The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be
* NULL, indicating an empty string.
*
* u.integer ::
* A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.
*
* u.cardinal ::
* An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.
*/
typedef struct BDF_PropertyRec_
{
BDF_PropertyType type;
union {
const char* atom;
FT_Int32 integer;
FT_UInt32 cardinal;
} u;
} BDF_PropertyRec;
/**********************************************************************
*
* @function:
* FT_Get_BDF_Charset_ID
*
* @description:
* Retrieve a BDF font character set identity, according to
* the BDF specification.
*
* @input:
* face ::
* A handle to the input face.
*
* @output:
* acharset_encoding ::
* Charset encoding, as a C~string, owned by the face.
*
* acharset_registry ::
* Charset registry, as a C~string, owned by the face.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with BDF faces, returning an error otherwise.
*/
FT_EXPORT( FT_Error )
FT_Get_BDF_Charset_ID( FT_Face face,
const char* *acharset_encoding,
const char* *acharset_registry );
/**********************************************************************
*
* @function:
* FT_Get_BDF_Property
*
* @description:
* Retrieve a BDF property from a BDF or PCF font file.
*
* @input:
* face :: A handle to the input face.
*
* name :: The property name.
*
* @output:
* aproperty :: The property.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function works with BDF _and_ PCF fonts. It returns an error
* otherwise. It also returns an error if the property is not in the
* font.
*
* A `property' is a either key-value pair within the STARTPROPERTIES
* ... ENDPROPERTIES block of a BDF font or a key-value pair from the
* `info->props' array within a `FontRec' structure of a PCF font.
*
* Integer properties are always stored as `signed' within PCF fonts;
* consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value
* for BDF fonts only.
*
* In case of error, `aproperty->type' is always set to
* @BDF_PROPERTY_TYPE_NONE.
*/
FT_EXPORT( FT_Error )
FT_Get_BDF_Property( FT_Face face,
const char* prop_name,
BDF_PropertyRec *aproperty );
/* */
FT_END_HEADER
#endif /* FTBDF_H_ */
/* END */
/***************************************************************************/
/* */
/* ftbzip2.h */
/* */
/* Bzip2-compressed stream support. */
/* */
/* Copyright 2010-2018 by */
/* Joel Klinghed. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTBZIP2_H_
#define FTBZIP2_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* bzip2 */
/* */
/* <Title> */
/* BZIP2 Streams */
/* */
/* <Abstract> */
/* Using bzip2-compressed font files. */
/* */
/* <Description> */
/* This section contains the declaration of Bzip2-specific functions. */
/* */
/*************************************************************************/
/************************************************************************
*
* @function:
* FT_Stream_OpenBzip2
*
* @description:
* Open a new stream to parse bzip2-compressed font files. This is
* mainly used to support the compressed `*.pcf.bz2' fonts that come
* with XFree86.
*
* @input:
* stream ::
* The target embedding stream.
*
* source ::
* The source stream.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
*
* Calling the internal function `FT_Stream_Close' on the new stream will
* *not* call `FT_Stream_Close' on the source stream. None of the stream
* objects will be released to the heap.
*
* The stream implementation is very basic and resets the decompression
* process each time seeking backwards is needed within the stream.
*
* In certain builds of the library, bzip2 compression recognition is
* automatically handled when calling @FT_New_Face or @FT_Open_Face.
* This means that if no font driver is capable of handling the raw
* compressed file, the library will try to open a bzip2 compressed stream
* from it and re-open the face with it.
*
* This function may return `FT_Err_Unimplemented_Feature' if your build
* of FreeType was not compiled with bzip2 support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenBzip2( FT_Stream stream,
FT_Stream source );
/* */
FT_END_HEADER
#endif /* FTBZIP2_H_ */
/* END */
/***************************************************************************/
/* */
/* ftadvanc.h */
/* */
/* Quick computation of advance widths (specification only). */
/* */
/* Copyright 2008-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTADVANC_H_
#define FTADVANC_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* quick_advance
*
* @title:
* Quick retrieval of advance values
*
* @abstract:
* Retrieve horizontal and vertical advance values without processing
* glyph outlines, if possible.
*
* @description:
* This section contains functions to quickly extract advance values
* without handling glyph outlines, if possible.
*
* @order:
* FT_Get_Advance
* FT_Get_Advances
*
*/
/*************************************************************************/
/* */
/* <Const> */
/* FT_ADVANCE_FLAG_FAST_ONLY */
/* */
/* <Description> */
/* A bit-flag to be OR-ed with the `flags' parameter of the */
/* @FT_Get_Advance and @FT_Get_Advances functions. */
/* */
/* If set, it indicates that you want these functions to fail if the */
/* corresponding hinting mode or font driver doesn't allow for very */
/* quick advance computation. */
/* */
/* Typically, glyphs that are either unscaled, unhinted, bitmapped, */
/* or light-hinted can have their advance width computed very */
/* quickly. */
/* */
/* Normal and bytecode hinted modes that require loading, scaling, */
/* and hinting of the glyph outline, are extremely slow by */
/* comparison. */
/* */
#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Advance */
/* */
/* <Description> */
/* Retrieve the advance value of a given glyph outline in an */
/* @FT_Face. */
/* */
/* <Input> */
/* face :: The source @FT_Face handle. */
/* */
/* gindex :: The glyph index. */
/* */
/* load_flags :: A set of bit flags similar to those used when */
/* calling @FT_Load_Glyph, used to determine what kind */
/* of advances you need. */
/* <Output> */
/* padvance :: The advance value. If scaling is performed (based on */
/* the value of `load_flags'), the advance value is in */
/* 16.16 format. Otherwise, it is in font units. */
/* */
/* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
/* vertical advance corresponding to a vertical layout. */
/* Otherwise, it is the horizontal advance in a */
/* horizontal layout. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
/* if the corresponding font backend doesn't have a quick way to */
/* retrieve the advances. */
/* */
/* A scaled advance is returned in 16.16 format but isn't transformed */
/* by the affine transformation specified by @FT_Set_Transform. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Advance( FT_Face face,
FT_UInt gindex,
FT_Int32 load_flags,
FT_Fixed *padvance );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Advances */
/* */
/* <Description> */
/* Retrieve the advance values of several glyph outlines in an */
/* @FT_Face. */
/* */
/* <Input> */
/* face :: The source @FT_Face handle. */
/* */
/* start :: The first glyph index. */
/* */
/* count :: The number of advance values you want to retrieve. */
/* */
/* load_flags :: A set of bit flags similar to those used when */
/* calling @FT_Load_Glyph. */
/* */
/* <Output> */
/* padvance :: The advance values. This array, to be provided by the */
/* caller, must contain at least `count' elements. */
/* */
/* If scaling is performed (based on the value of */
/* `load_flags'), the advance values are in 16.16 format. */
/* Otherwise, they are in font units. */
/* */
/* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
/* vertical advances corresponding to a vertical layout. */
/* Otherwise, they are the horizontal advances in a */
/* horizontal layout. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
/* if the corresponding font backend doesn't have a quick way to */
/* retrieve the advances. */
/* */
/* Scaled advances are returned in 16.16 format but aren't */
/* transformed by the affine transformation specified by */
/* @FT_Set_Transform. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Advances( FT_Face face,
FT_UInt start,
FT_UInt count,
FT_Int32 load_flags,
FT_Fixed *padvances );
/* */
FT_END_HEADER
#endif /* FTADVANC_H_ */
/* END */
/***************************************************************************/
/* */
/* ftrender.h */
/* */
/* FreeType renderer modules public interface (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTRENDER_H_
#define FTRENDER_H_
#include <ft2build.h>
#include FT_MODULE_H
#include FT_GLYPH_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* module_management */
/* */
/*************************************************************************/
/* create a new glyph object */
typedef FT_Error
(*FT_Glyph_InitFunc)( FT_Glyph glyph,
FT_GlyphSlot slot );
/* destroys a given glyph object */
typedef void
(*FT_Glyph_DoneFunc)( FT_Glyph glyph );
typedef void
(*FT_Glyph_TransformFunc)( FT_Glyph glyph,
const FT_Matrix* matrix,
const FT_Vector* delta );
typedef void
(*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,
FT_BBox* abbox );
typedef FT_Error
(*FT_Glyph_CopyFunc)( FT_Glyph source,
FT_Glyph target );
typedef FT_Error
(*FT_Glyph_PrepareFunc)( FT_Glyph glyph,
FT_GlyphSlot slot );
/* deprecated */
#define FT_Glyph_Init_Func FT_Glyph_InitFunc
#define FT_Glyph_Done_Func FT_Glyph_DoneFunc
#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc
#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc
#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc
#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc
struct FT_Glyph_Class_
{
FT_Long glyph_size;
FT_Glyph_Format glyph_format;
FT_Glyph_InitFunc glyph_init;
FT_Glyph_DoneFunc glyph_done;
FT_Glyph_CopyFunc glyph_copy;
FT_Glyph_TransformFunc glyph_transform;
FT_Glyph_GetBBoxFunc glyph_bbox;
FT_Glyph_PrepareFunc glyph_prepare;
};
typedef FT_Error
(*FT_Renderer_RenderFunc)( FT_Renderer renderer,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin );
typedef FT_Error
(*FT_Renderer_TransformFunc)( FT_Renderer renderer,
FT_GlyphSlot slot,
const FT_Matrix* matrix,
const FT_Vector* delta );
typedef void
(*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,
FT_GlyphSlot slot,
FT_BBox* cbox );
typedef FT_Error
(*FT_Renderer_SetModeFunc)( FT_Renderer renderer,
FT_ULong mode_tag,
FT_Pointer mode_ptr );
/* deprecated identifiers */
#define FTRenderer_render FT_Renderer_RenderFunc
#define FTRenderer_transform FT_Renderer_TransformFunc
#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc
#define FTRenderer_setMode FT_Renderer_SetModeFunc
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Renderer_Class */
/* */
/* <Description> */
/* The renderer module class descriptor. */
/* */
/* <Fields> */
/* root :: The root @FT_Module_Class fields. */
/* */
/* glyph_format :: The glyph image format this renderer handles. */
/* */
/* render_glyph :: A method used to render the image that is in a */
/* given glyph slot into a bitmap. */
/* */
/* transform_glyph :: A method used to transform the image that is in */
/* a given glyph slot. */
/* */
/* get_glyph_cbox :: A method used to access the glyph's cbox. */
/* */
/* set_mode :: A method used to pass additional parameters. */
/* */
/* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */
/* This is a pointer to its raster's class. */
/* */
typedef struct FT_Renderer_Class_
{
FT_Module_Class root;
FT_Glyph_Format glyph_format;
FT_Renderer_RenderFunc render_glyph;
FT_Renderer_TransformFunc transform_glyph;
FT_Renderer_GetCBoxFunc get_glyph_cbox;
FT_Renderer_SetModeFunc set_mode;
FT_Raster_Funcs* raster_class;
} FT_Renderer_Class;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Renderer */
/* */
/* <Description> */
/* Retrieve the current renderer for a given glyph format. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
/* */
/* format :: The glyph format. */
/* */
/* <Return> */
/* A renderer handle. 0~if none found. */
/* */
/* <Note> */
/* An error will be returned if a module already exists by that name, */
/* or if the module requires a version of FreeType that is too great. */
/* */
/* To add a new renderer, simply use @FT_Add_Module. To retrieve a */
/* renderer by its name, use @FT_Get_Module. */
/* */
FT_EXPORT( FT_Renderer )
FT_Get_Renderer( FT_Library library,
FT_Glyph_Format format );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Renderer */
/* */
/* <Description> */
/* Set the current renderer to use, and set additional mode. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
/* */
/* <Input> */
/* renderer :: A handle to the renderer object. */
/* */
/* num_params :: The number of additional parameters. */
/* */
/* parameters :: Additional parameters. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* In case of success, the renderer will be used to convert glyph */
/* images in the renderer's known format into bitmaps. */
/* */
/* This doesn't change the current renderer for other formats. */
/* */
/* Currently, no FreeType renderer module uses `parameters'; you */
/* should thus always pass NULL as the value. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Renderer( FT_Library library,
FT_Renderer renderer,
FT_UInt num_params,
FT_Parameter* parameters );
/* */
FT_END_HEADER
#endif /* FTRENDER_H_ */
/* END */
/***************************************************************************/
/* */
/* fterrors.h */
/* */
/* FreeType error code handling (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* error_enumerations */
/* */
/* <Title> */
/* Error Enumerations */
/* */
/* <Abstract> */
/* How to handle errors and error strings. */
/* */
/* <Description> */
/* The header file `fterrors.h' (which is automatically included by */
/* `freetype.h' defines the handling of FreeType's enumeration */
/* constants. It can also be used to generate error message strings */
/* with a small macro trick explained below. */
/* */
/* *Error* *Formats* */
/* */
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
/* defined in `ftoption.h' in order to make the higher byte indicate */
/* the module where the error has happened (this is not compatible */
/* with standard builds of FreeType~2, however). See the file */
/* `ftmoderr.h' for more details. */
/* */
/* *Error* *Message* *Strings* */
/* */
/* Error definitions are set up with special macros that allow client */
/* applications to build a table of error message strings. The */
/* strings are not included in a normal build of FreeType~2 to save */
/* space (most client applications do not use them). */
/* */
/* To do so, you have to define the following macros before including */
/* this file. */
/* */
/* { */
/* FT_ERROR_START_LIST */
/* } */
/* */
/* This macro is called before anything else to define the start of */
/* the error list. It is followed by several FT_ERROR_DEF calls. */
/* */
/* { */
/* FT_ERROR_DEF( e, v, s ) */
/* } */
/* */
/* This macro is called to define one single error. `e' is the error */
/* code identifier (e.g., `Invalid_Argument'), `v' is the error's */
/* numerical value, and `s' is the corresponding error string. */
/* */
/* { */
/* FT_ERROR_END_LIST */
/* } */
/* */
/* This macro ends the list. */
/* */
/* Additionally, you have to undefine `FTERRORS_H_' before #including */
/* this file. */
/* */
/* Here is a simple example. */
/* */
/* { */
/* #undef FTERRORS_H_ */
/* #define FT_ERRORDEF( e, v, s ) { e, s }, */
/* #define FT_ERROR_START_LIST { */
/* #define FT_ERROR_END_LIST { 0, NULL } }; */
/* */
/* const struct */
/* { */
/* int err_code; */
/* const char* err_msg; */
/* } ft_errors[] = */
/* */
/* #include FT_ERRORS_H */
/* } */
/* */
/* Note that `FT_Err_Ok' is _not_ defined with `FT_ERRORDEF' but with */
/* `FT_NOERRORDEF'; it is always zero. */
/* */
/*************************************************************************/
/* */
/* In previous FreeType versions we used `__FTERRORS_H__'. However, */
/* using two successive underscores in a non-system symbol name */
/* violates the C (and C++) standard, so it was changed to the */
/* current form. In spite of this, we have to make */
/* */
/* #undefine __FTERRORS_H__ */
/* */
/* work for backward compatibility. */
/* */
#if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) )
#define FTERRORS_H_
#define __FTERRORS_H__
/* include module base error codes */
#include FT_MODULE_ERRORS_H
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SETUP MACROS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#undef FT_NEED_EXTERN_C
/* FT_ERR_PREFIX is used as a prefix for error identifiers. */
/* By default, we use `FT_Err_'. */
/* */
#ifndef FT_ERR_PREFIX
#define FT_ERR_PREFIX FT_Err_
#endif
/* FT_ERR_BASE is used as the base for module-specific errors. */
/* */
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
#ifndef FT_ERR_BASE
#define FT_ERR_BASE FT_Mod_Err_Base
#endif
#else
#undef FT_ERR_BASE
#define FT_ERR_BASE 0
#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
/* If FT_ERRORDEF is not defined, we need to define a simple */
/* enumeration type. */
/* */
#ifndef FT_ERRORDEF
#define FT_ERRORDEF( e, v, s ) e = v,
#define FT_ERROR_START_LIST enum {
#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
#ifdef __cplusplus
#define FT_NEED_EXTERN_C
extern "C" {
#endif
#endif /* !FT_ERRORDEF */
/* this macro is used to define an error */
#define FT_ERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
/* this is only used for <module>_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
#ifdef FT_ERROR_START_LIST
FT_ERROR_START_LIST
#endif
/* now include the error codes */
#include FT_ERROR_DEFINITIONS_H
#ifdef FT_ERROR_END_LIST
FT_ERROR_END_LIST
#endif
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SIMPLE CLEANUP *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_NEED_EXTERN_C
}
#endif
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
#undef FT_ERRORDEF_
#undef FT_NOERRORDEF_
#undef FT_NEED_EXTERN_C
#undef FT_ERR_BASE
/* FT_ERR_PREFIX is needed internally */
#ifndef FT2_BUILD_LIBRARY
#undef FT_ERR_PREFIX
#endif
#endif /* !(FTERRORS_H_ && __FTERRORS_H__) */
/* END */
/***************************************************************************/
/* */
/* ftmodapi.h */
/* */
/* FreeType modules public interface (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTMODAPI_H_
#define FTMODAPI_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* module_management */
/* */
/* <Title> */
/* Module Management */
/* */
/* <Abstract> */
/* How to add, upgrade, remove, and control modules from FreeType. */
/* */
/* <Description> */
/* The definitions below are used to manage modules within FreeType. */
/* Modules can be added, upgraded, and removed at runtime. */
/* Additionally, some module properties can be controlled also. */
/* */
/* Here is a list of possible values of the `module_name' field in */
/* the @FT_Module_Class structure. */
/* */
/* { */
/* autofitter */
/* bdf */
/* cff */
/* gxvalid */
/* otvalid */
/* pcf */
/* pfr */
/* psaux */
/* pshinter */
/* psnames */
/* raster1 */
/* sfnt */
/* smooth, smooth-lcd, smooth-lcdv */
/* truetype */
/* type1 */
/* type42 */
/* t1cid */
/* winfonts */
/* } */
/* */
/* Note that the FreeType Cache sub-system is not a FreeType module. */
/* */
/* <Order> */
/* FT_Module */
/* FT_Module_Constructor */
/* FT_Module_Destructor */
/* FT_Module_Requester */
/* FT_Module_Class */
/* */
/* FT_Add_Module */
/* FT_Get_Module */
/* FT_Remove_Module */
/* FT_Add_Default_Modules */
/* */
/* FT_Property_Set */
/* FT_Property_Get */
/* FT_Set_Default_Properties */
/* */
/* FT_New_Library */
/* FT_Done_Library */
/* FT_Reference_Library */
/* */
/* FT_Renderer */
/* FT_Renderer_Class */
/* */
/* FT_Get_Renderer */
/* FT_Set_Renderer */
/* */
/* FT_Set_Debug_Hook */
/* */
/*************************************************************************/
/* module bit flags */
#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */
#define FT_MODULE_RENDERER 2 /* this module is a renderer */
#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */
#define FT_MODULE_STYLER 8 /* this module is a styler */
#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
/* scalable fonts */
#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
/* support vector outlines */
#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
/* own hinter */
#define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */
/* produces LIGHT hints */
/* deprecated values */
#define ft_module_font_driver FT_MODULE_FONT_DRIVER
#define ft_module_renderer FT_MODULE_RENDERER
#define ft_module_hinter FT_MODULE_HINTER
#define ft_module_styler FT_MODULE_STYLER
#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
#define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY
typedef FT_Pointer FT_Module_Interface;
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Module_Constructor */
/* */
/* <Description> */
/* A function used to initialize (not create) a new module object. */
/* */
/* <Input> */
/* module :: The module to initialize. */
/* */
typedef FT_Error
(*FT_Module_Constructor)( FT_Module module );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Module_Destructor */
/* */
/* <Description> */
/* A function used to finalize (not destroy) a given module object. */
/* */
/* <Input> */
/* module :: The module to finalize. */
/* */
typedef void
(*FT_Module_Destructor)( FT_Module module );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Module_Requester */
/* */
/* <Description> */
/* A function used to query a given module for a specific interface. */
/* */
/* <Input> */
/* module :: The module to be searched. */
/* */
/* name :: The name of the interface in the module. */
/* */
typedef FT_Module_Interface
(*FT_Module_Requester)( FT_Module module,
const char* name );
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Module_Class */
/* */
/* <Description> */
/* The module class descriptor. */
/* */
/* <Fields> */
/* module_flags :: Bit flags describing the module. */
/* */
/* module_size :: The size of one module object/instance in */
/* bytes. */
/* */
/* module_name :: The name of the module. */
/* */
/* module_version :: The version, as a 16.16 fixed number */
/* (major.minor). */
/* */
/* module_requires :: The version of FreeType this module requires, */
/* as a 16.16 fixed number (major.minor). Starts */
/* at version 2.0, i.e., 0x20000. */
/* */
/* module_init :: The initializing function. */
/* */
/* module_done :: The finalizing function. */
/* */
/* get_interface :: The interface requesting function. */
/* */
typedef struct FT_Module_Class_
{
FT_ULong module_flags;
FT_Long module_size;
const FT_String* module_name;
FT_Fixed module_version;
FT_Fixed module_requires;
const void* module_interface;
FT_Module_Constructor module_init;
FT_Module_Destructor module_done;
FT_Module_Requester get_interface;
} FT_Module_Class;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Add_Module */
/* */
/* <Description> */
/* Add a new module to a given library instance. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
/* */
/* <Input> */
/* clazz :: A pointer to class descriptor for the module. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* An error will be returned if a module already exists by that name, */
/* or if the module requires a version of FreeType that is too great. */
/* */
FT_EXPORT( FT_Error )
FT_Add_Module( FT_Library library,
const FT_Module_Class* clazz );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Module */
/* */
/* <Description> */
/* Find a module by its name. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
/* */
/* module_name :: The module's name (as an ASCII string). */
/* */
/* <Return> */
/* A module handle. 0~if none was found. */
/* */
/* <Note> */
/* FreeType's internal modules aren't documented very well, and you */
/* should look up the source code for details. */
/* */
FT_EXPORT( FT_Module )
FT_Get_Module( FT_Library library,
const char* module_name );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Remove_Module */
/* */
/* <Description> */
/* Remove a given module from a library instance. */
/* */
/* <InOut> */
/* library :: A handle to a library object. */
/* */
/* <Input> */
/* module :: A handle to a module object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The module object is destroyed by the function in case of success. */
/* */
FT_EXPORT( FT_Error )
FT_Remove_Module( FT_Library library,
FT_Module module );
/**********************************************************************
*
* @function:
* FT_Property_Set
*
* @description:
* Set a property for a given module.
*
* @input:
* library ::
* A handle to the library the module is part of.
*
* module_name ::
* The module name.
*
* property_name ::
* The property name. Properties are described in section
* @properties.
*
* Note that only a few modules have properties.
*
* value ::
* A generic pointer to a variable or structure that gives the new
* value of the property. The exact definition of `value' is
* dependent on the property; see section @properties.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If `module_name' isn't a valid module name, or `property_name'
* doesn't specify a valid property, or if `value' doesn't represent a
* valid value for the given property, an error is returned.
*
* The following example sets property `bar' (a simple integer) in
* module `foo' to value~1.
*
* {
* FT_UInt bar;
*
*
* bar = 1;
* FT_Property_Set( library, "foo", "bar", &bar );
* }
*
* Note that the FreeType Cache sub-system doesn't recognize module
* property changes. To avoid glyph lookup confusion within the cache
* you should call @FTC_Manager_Reset to completely flush the cache if
* a module property gets changed after @FTC_Manager_New has been
* called.
*
* It is not possible to set properties of the FreeType Cache
* sub-system itself with FT_Property_Set; use @FTC_Property_Set
* instead.
*
* @since:
* 2.4.11
*
*/
FT_EXPORT( FT_Error )
FT_Property_Set( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
const void* value );
/**********************************************************************
*
* @function:
* FT_Property_Get
*
* @description:
* Get a module's property value.
*
* @input:
* library ::
* A handle to the library the module is part of.
*
* module_name ::
* The module name.
*
* property_name ::
* The property name. Properties are described in section
* @properties.
*
* @inout:
* value ::
* A generic pointer to a variable or structure that gives the
* value of the property. The exact definition of `value' is
* dependent on the property; see section @properties.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If `module_name' isn't a valid module name, or `property_name'
* doesn't specify a valid property, or if `value' doesn't represent a
* valid value for the given property, an error is returned.
*
* The following example gets property `baz' (a range) in module `foo'.
*
* {
* typedef range_
* {
* FT_Int32 min;
* FT_Int32 max;
*
* } range;
*
* range baz;
*
*
* FT_Property_Get( library, "foo", "baz", &baz );
* }
*
* It is not possible to retrieve properties of the FreeType Cache
* sub-system with FT_Property_Get; use @FTC_Property_Get instead.
*
* @since:
* 2.4.11
*
*/
FT_EXPORT( FT_Error )
FT_Property_Get( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
void* value );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Default_Properties */
/* */
/* <Description> */
/* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */
/* set, this function reads the `FREETYPE_PROPERTIES' environment */
/* variable to control driver properties. See section @properties */
/* for more. */
/* */
/* If the compilation option is not set, this function does nothing. */
/* */
/* `FREETYPE_PROPERTIES' has the following syntax form (broken here */
/* into multiple lines for better readability). */
/* */
/* { */
/* <optional whitespace> */
/* <module-name1> ':' */
/* <property-name1> '=' <property-value1> */
/* <whitespace> */
/* <module-name2> ':' */
/* <property-name2> '=' <property-value2> */
/* ... */
/* } */
/* */
/* Example: */
/* */
/* { */
/* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ */
/* cff:no-stem-darkening=1 \ */
/* autofitter:warping=1 */
/* } */
/* */
/* <InOut> */
/* library :: A handle to a new library object. */
/* */
/* <Since> */
/* 2.8 */
/* */
FT_EXPORT( void )
FT_Set_Default_Properties( FT_Library library );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Reference_Library */
/* */
/* <Description> */
/* A counter gets initialized to~1 at the time an @FT_Library */
/* structure is created. This function increments the counter. */
/* @FT_Done_Library then only destroys a library if the counter is~1, */
/* otherwise it simply decrements the counter. */
/* */
/* This function helps in managing life-cycles of structures that */
/* reference @FT_Library objects. */
/* */
/* <Input> */
/* library :: A handle to a target library object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.4.2 */
/* */
FT_EXPORT( FT_Error )
FT_Reference_Library( FT_Library library );
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Library */
/* */
/* <Description> */
/* This function is used to create a new FreeType library instance */
/* from a given memory object. It is thus possible to use libraries */
/* with distinct memory allocators within the same program. Note, */
/* however, that the used @FT_Memory structure is expected to remain */
/* valid for the life of the @FT_Library object. */
/* */
/* Normally, you would call this function (followed by a call to */
/* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module, */
/* and a call to @FT_Set_Default_Properties) instead of */
/* @FT_Init_FreeType to initialize the FreeType library. */
/* */
/* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */
/* library instance. */
/* */
/* <Input> */
/* memory :: A handle to the original memory object. */
/* */
/* <Output> */
/* alibrary :: A pointer to handle of a new library object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Library. */
/* */
FT_EXPORT( FT_Error )
FT_New_Library( FT_Memory memory,
FT_Library *alibrary );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Library */
/* */
/* <Description> */
/* Discard a given library object. This closes all drivers and */
/* discards all resource objects. */
/* */
/* <Input> */
/* library :: A handle to the target library. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Library. */
/* */
FT_EXPORT( FT_Error )
FT_Done_Library( FT_Library library );
/* */
typedef void
(*FT_DebugHook_Func)( void* arg );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Debug_Hook */
/* */
/* <Description> */
/* Set a debug hook function for debugging the interpreter of a font */
/* format. */
/* */
/* <InOut> */
/* library :: A handle to the library object. */
/* */
/* <Input> */
/* hook_index :: The index of the debug hook. You should use the */
/* values defined in `ftobjs.h', e.g., */
/* `FT_DEBUG_HOOK_TRUETYPE'. */
/* */
/* debug_hook :: The function used to debug the interpreter. */
/* */
/* <Note> */
/* Currently, four debug hook slots are available, but only two (for */
/* the TrueType and the Type~1 interpreter) are defined. */
/* */
/* Since the internal headers of FreeType are no longer installed, */
/* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */
/* This is a bug and will be fixed in a forthcoming release. */
/* */
FT_EXPORT( void )
FT_Set_Debug_Hook( FT_Library library,
FT_UInt hook_index,
FT_DebugHook_Func debug_hook );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Add_Default_Modules */
/* */
/* <Description> */
/* Add the set of default drivers to a given library object. */
/* This is only useful when you create a library object with */
/* @FT_New_Library (usually to plug a custom memory manager). */
/* */
/* <InOut> */
/* library :: A handle to a new library object. */
/* */
FT_EXPORT( void )
FT_Add_Default_Modules( FT_Library library );
/**************************************************************************
*
* @section:
* truetype_engine
*
* @title:
* The TrueType Engine
*
* @abstract:
* TrueType bytecode support.
*
* @description:
* This section contains a function used to query the level of TrueType
* bytecode support compiled in this version of the library.
*
*/
/**************************************************************************
*
* @enum:
* FT_TrueTypeEngineType
*
* @description:
* A list of values describing which kind of TrueType bytecode
* engine is implemented in a given FT_Library instance. It is used
* by the @FT_Get_TrueType_Engine_Type function.
*
* @values:
* FT_TRUETYPE_ENGINE_TYPE_NONE ::
* The library doesn't implement any kind of bytecode interpreter.
*
* FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::
* Deprecated and removed.
*
* FT_TRUETYPE_ENGINE_TYPE_PATENTED ::
* The library implements a bytecode interpreter that covers
* the full instruction set of the TrueType virtual machine (this
* was governed by patents until May 2010, hence the name).
*
* @since:
* 2.2
*
*/
typedef enum FT_TrueTypeEngineType_
{
FT_TRUETYPE_ENGINE_TYPE_NONE = 0,
FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,
FT_TRUETYPE_ENGINE_TYPE_PATENTED
} FT_TrueTypeEngineType;
/**************************************************************************
*
* @func:
* FT_Get_TrueType_Engine_Type
*
* @description:
* Return an @FT_TrueTypeEngineType value to indicate which level of
* the TrueType virtual machine a given library instance supports.
*
* @input:
* library ::
* A library instance.
*
* @return:
* A value indicating which level is supported.
*
* @since:
* 2.2
*
*/
FT_EXPORT( FT_TrueTypeEngineType )
FT_Get_TrueType_Engine_Type( FT_Library library );
/* */
FT_END_HEADER
#endif /* FTMODAPI_H_ */
/* END */
/***************************************************************************/
/* */
/* ftcid.h */
/* */
/* FreeType API for accessing CID font information (specification). */
/* */
/* Copyright 2007-2018 by */
/* Dereg Clegg and Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTCID_H_
#define FTCID_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* cid_fonts */
/* */
/* <Title> */
/* CID Fonts */
/* */
/* <Abstract> */
/* CID-keyed font specific API. */
/* */
/* <Description> */
/* This section contains the declaration of CID-keyed font specific */
/* functions. */
/* */
/*************************************************************************/
/**********************************************************************
*
* @function:
* FT_Get_CID_Registry_Ordering_Supplement
*
* @description:
* Retrieve the Registry/Ordering/Supplement triple (also known as the
* "R/O/S") from a CID-keyed font.
*
* @input:
* face ::
* A handle to the input face.
*
* @output:
* registry ::
* The registry, as a C~string, owned by the face.
*
* ordering ::
* The ordering, as a C~string, owned by the face.
*
* supplement ::
* The supplement.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces, returning an error
* otherwise.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_Error )
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
const char* *registry,
const char* *ordering,
FT_Int *supplement );
/**********************************************************************
*
* @function:
* FT_Get_CID_Is_Internally_CID_Keyed
*
* @description:
* Retrieve the type of the input face, CID keyed or not. In
* contrast to the @FT_IS_CID_KEYED macro this function returns
* successfully also for CID-keyed fonts in an SFNT wrapper.
*
* @input:
* face ::
* A handle to the input face.
*
* @output:
* is_cid ::
* The type of the face as an @FT_Bool.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces and OpenType fonts,
* returning an error otherwise.
*
* @since:
* 2.3.9
*/
FT_EXPORT( FT_Error )
FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
FT_Bool *is_cid );
/**********************************************************************
*
* @function:
* FT_Get_CID_From_Glyph_Index
*
* @description:
* Retrieve the CID of the input glyph index.
*
* @input:
* face ::
* A handle to the input face.
*
* glyph_index ::
* The input glyph index.
*
* @output:
* cid ::
* The CID as an @FT_UInt.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces and OpenType fonts,
* returning an error otherwise.
*
* @since:
* 2.3.9
*/
FT_EXPORT( FT_Error )
FT_Get_CID_From_Glyph_Index( FT_Face face,
FT_UInt glyph_index,
FT_UInt *cid );
/* */
FT_END_HEADER
#endif /* FTCID_H_ */
/* END */
/***************************************************************************/
/* */
/* ftsystem.h */
/* */
/* FreeType low-level system interface definition (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTSYSTEM_H_
#define FTSYSTEM_H_
#include <ft2build.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* system_interface */
/* */
/* <Title> */
/* System Interface */
/* */
/* <Abstract> */
/* How FreeType manages memory and i/o. */
/* */
/* <Description> */
/* This section contains various definitions related to memory */
/* management and i/o access. You need to understand this */
/* information if you want to use a custom memory manager or you own */
/* i/o streams. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* M E M O R Y M A N A G E M E N T */
/* */
/*************************************************************************/
/*************************************************************************
*
* @type:
* FT_Memory
*
* @description:
* A handle to a given memory manager object, defined with an
* @FT_MemoryRec structure.
*
*/
typedef struct FT_MemoryRec_* FT_Memory;
/*************************************************************************
*
* @functype:
* FT_Alloc_Func
*
* @description:
* A function used to allocate `size' bytes from `memory'.
*
* @input:
* memory ::
* A handle to the source memory manager.
*
* size ::
* The size in bytes to allocate.
*
* @return:
* Address of new memory block. 0~in case of failure.
*
*/
typedef void*
(*FT_Alloc_Func)( FT_Memory memory,
long size );
/*************************************************************************
*
* @functype:
* FT_Free_Func
*
* @description:
* A function used to release a given block of memory.
*
* @input:
* memory ::
* A handle to the source memory manager.
*
* block ::
* The address of the target memory block.
*
*/
typedef void
(*FT_Free_Func)( FT_Memory memory,
void* block );
/*************************************************************************
*
* @functype:
* FT_Realloc_Func
*
* @description:
* A function used to re-allocate a given block of memory.
*
* @input:
* memory ::
* A handle to the source memory manager.
*
* cur_size ::
* The block's current size in bytes.
*
* new_size ::
* The block's requested new size.
*
* block ::
* The block's current address.
*
* @return:
* New block address. 0~in case of memory shortage.
*
* @note:
* In case of error, the old block must still be available.
*
*/
typedef void*
(*FT_Realloc_Func)( FT_Memory memory,
long cur_size,
long new_size,
void* block );
/*************************************************************************
*
* @struct:
* FT_MemoryRec
*
* @description:
* A structure used to describe a given memory manager to FreeType~2.
*
* @fields:
* user ::
* A generic typeless pointer for user data.
*
* alloc ::
* A pointer type to an allocation function.
*
* free ::
* A pointer type to an memory freeing function.
*
* realloc ::
* A pointer type to a reallocation function.
*
*/
struct FT_MemoryRec_
{
void* user;
FT_Alloc_Func alloc;
FT_Free_Func free;
FT_Realloc_Func realloc;
};
/*************************************************************************/
/* */
/* I / O M A N A G E M E N T */
/* */
/*************************************************************************/
/*************************************************************************
*
* @type:
* FT_Stream
*
* @description:
* A handle to an input stream.
*
* @also:
* See @FT_StreamRec for the publicly accessible fields of a given
* stream object.
*
*/
typedef struct FT_StreamRec_* FT_Stream;
/*************************************************************************
*
* @struct:
* FT_StreamDesc
*
* @description:
* A union type used to store either a long or a pointer. This is used
* to store a file descriptor or a `FILE*' in an input stream.
*
*/
typedef union FT_StreamDesc_
{
long value;
void* pointer;
} FT_StreamDesc;
/*************************************************************************
*
* @functype:
* FT_Stream_IoFunc
*
* @description:
* A function used to seek and read data from a given input stream.
*
* @input:
* stream ::
* A handle to the source stream.
*
* offset ::
* The offset of read in stream (always from start).
*
* buffer ::
* The address of the read buffer.
*
* count ::
* The number of bytes to read from the stream.
*
* @return:
* The number of bytes effectively read by the stream.
*
* @note:
* This function might be called to perform a seek or skip operation
* with a `count' of~0. A non-zero return value then indicates an
* error.
*
*/
typedef unsigned long
(*FT_Stream_IoFunc)( FT_Stream stream,
unsigned long offset,
unsigned char* buffer,
unsigned long count );
/*************************************************************************
*
* @functype:
* FT_Stream_CloseFunc
*
* @description:
* A function used to close a given input stream.
*
* @input:
* stream ::
* A handle to the target stream.
*
*/
typedef void
(*FT_Stream_CloseFunc)( FT_Stream stream );
/*************************************************************************
*
* @struct:
* FT_StreamRec
*
* @description:
* A structure used to describe an input stream.
*
* @input:
* base ::
* For memory-based streams, this is the address of the first stream
* byte in memory. This field should always be set to NULL for
* disk-based streams.
*
* size ::
* The stream size in bytes.
*
* In case of compressed streams where the size is unknown before
* actually doing the decompression, the value is set to 0x7FFFFFFF.
* (Note that this size value can occur for normal streams also; it is
* thus just a hint.)
*
* pos ::
* The current position within the stream.
*
* descriptor ::
* This field is a union that can hold an integer or a pointer. It is
* used by stream implementations to store file descriptors or `FILE*'
* pointers.
*
* pathname ::
* This field is completely ignored by FreeType. However, it is often
* useful during debugging to use it to store the stream's filename
* (where available).
*
* read ::
* The stream's input function.
*
* close ::
* The stream's close function.
*
* memory ::
* The memory manager to use to preload frames. This is set
* internally by FreeType and shouldn't be touched by stream
* implementations.
*
* cursor ::
* This field is set and used internally by FreeType when parsing
* frames.
*
* limit ::
* This field is set and used internally by FreeType when parsing
* frames.
*
*/
typedef struct FT_StreamRec_
{
unsigned char* base;
unsigned long size;
unsigned long pos;
FT_StreamDesc descriptor;
FT_StreamDesc pathname;
FT_Stream_IoFunc read;
FT_Stream_CloseFunc close;
FT_Memory memory;
unsigned char* cursor;
unsigned char* limit;
} FT_StreamRec;
/* */
FT_END_HEADER
#endif /* FTSYSTEM_H_ */
/* END */
/***************************************************************************/
/* */
/* ftfntfmt.h */
/* */
/* Support functions for font formats. */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTFNTFMT_H_
#define FTFNTFMT_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* font_formats */
/* */
/* <Title> */
/* Font Formats */
/* */
/* <Abstract> */
/* Getting the font format. */
/* */
/* <Description> */
/* The single function in this section can be used to get the font */
/* format. Note that this information is not needed normally; */
/* however, there are special cases (like in PDF devices) where it is */
/* important to differentiate, in spite of FreeType's uniform API. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Font_Format */
/* */
/* <Description> */
/* Return a string describing the format of a given face. Possible */
/* values are `TrueType', `Type~1', `BDF', `PCF', `Type~42', */
/* `CID~Type~1', `CFF', `PFR', and `Windows~FNT'. */
/* */
/* The return value is suitable to be used as an X11 FONT_PROPERTY. */
/* */
/* <Input> */
/* face :: */
/* Input face handle. */
/* */
/* <Return> */
/* Font format string. NULL in case of error. */
/* */
/* <Note> */
/* A deprecated name for the same function is */
/* `FT_Get_X11_Font_Format'. */
/* */
FT_EXPORT( const char* )
FT_Get_Font_Format( FT_Face face );
/* deprecated */
FT_EXPORT( const char* )
FT_Get_X11_Font_Format( FT_Face face );
/* */
FT_END_HEADER
#endif /* FTFNTFMT_H_ */
/* END */
/***************************************************************************/
/* */
/* ftmoderr.h */
/* */
/* FreeType module error offsets (specification). */
/* */
/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to define the FreeType module error codes. */
/* */
/* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */
/* set, the lower byte of an error value identifies the error code as */
/* usual. In addition, the higher byte identifies the module. For */
/* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */
/* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */
/* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */
/* */
/* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */
/* including the high byte. */
/* */
/* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */
/* an error value is set to zero. */
/* */
/* To hide the various `XXX_Err_' prefixes in the source code, FreeType */
/* provides some macros in `fttypes.h'. */
/* */
/* FT_ERR( err ) */
/* Add current error module prefix (as defined with the */
/* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */
/* the line */
/* */
/* error = FT_ERR( Invalid_Outline ); */
/* */
/* expands to */
/* */
/* error = BDF_Err_Invalid_Outline; */
/* */
/* For simplicity, you can always use `FT_Err_Ok' directly instead */
/* of `FT_ERR( Ok )'. */
/* */
/* FT_ERR_EQ( errcode, err ) */
/* FT_ERR_NEQ( errcode, err ) */
/* Compare error code `errcode' with the error `err' for equality */
/* and inequality, respectively. Example: */
/* */
/* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */
/* ... */
/* */
/* Using this macro you don't have to think about error prefixes. */
/* Of course, if module errors are not active, the above example is */
/* the same as */
/* */
/* if ( error == FT_Err_Invalid_Outline ) */
/* ... */
/* */
/* FT_ERROR_BASE( errcode ) */
/* FT_ERROR_MODULE( errcode ) */
/* Get base error and module error code, respectively. */
/* */
/* */
/* It can also be used to create a module error message table easily */
/* with something like */
/* */
/* { */
/* #undef FTMODERR_H_ */
/* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */
/* #define FT_MODERR_START_LIST { */
/* #define FT_MODERR_END_LIST { 0, 0 } }; */
/* */
/* const struct */
/* { */
/* int mod_err_offset; */
/* const char* mod_err_msg */
/* } ft_mod_errors[] = */
/* */
/* #include FT_MODULE_ERRORS_H */
/* } */
/* */
/*************************************************************************/
#ifndef FTMODERR_H_
#define FTMODERR_H_
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SETUP MACROS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#undef FT_NEED_EXTERN_C
#ifndef FT_MODERRDEF
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
#else
#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
#endif
#define FT_MODERR_START_LIST enum {
#define FT_MODERR_END_LIST FT_Mod_Err_Max };
#ifdef __cplusplus
#define FT_NEED_EXTERN_C
extern "C" {
#endif
#endif /* !FT_MODERRDEF */
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST MODULE ERROR BASES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_MODERR_START_LIST
FT_MODERR_START_LIST
#endif
FT_MODERRDEF( Base, 0x000, "base module" )
FT_MODERRDEF( Autofit, 0x100, "autofitter module" )
FT_MODERRDEF( BDF, 0x200, "BDF module" )
FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" )
FT_MODERRDEF( Cache, 0x400, "cache module" )
FT_MODERRDEF( CFF, 0x500, "CFF module" )
FT_MODERRDEF( CID, 0x600, "CID module" )
FT_MODERRDEF( Gzip, 0x700, "Gzip module" )
FT_MODERRDEF( LZW, 0x800, "LZW module" )
FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" )
FT_MODERRDEF( PCF, 0xA00, "PCF module" )
FT_MODERRDEF( PFR, 0xB00, "PFR module" )
FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" )
FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" )
FT_MODERRDEF( PSnames, 0xE00, "PS names module" )
FT_MODERRDEF( Raster, 0xF00, "raster module" )
FT_MODERRDEF( SFNT, 0x1000, "SFNT module" )
FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" )
FT_MODERRDEF( TrueType, 0x1200, "TrueType module" )
FT_MODERRDEF( Type1, 0x1300, "Type 1 module" )
FT_MODERRDEF( Type42, 0x1400, "Type 42 module" )
FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
#ifdef FT_MODERR_END_LIST
FT_MODERR_END_LIST
#endif
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** CLEANUP *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_NEED_EXTERN_C
}
#endif
#undef FT_MODERR_START_LIST
#undef FT_MODERR_END_LIST
#undef FT_MODERRDEF
#undef FT_NEED_EXTERN_C
#endif /* FTMODERR_H_ */
/* END */
/***************************************************************************/
/* */
/* ftglyph.h */
/* */
/* FreeType convenience functions to handle glyphs (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file contains the definition of several convenience functions */
/* that can be used by client applications to easily retrieve glyph */
/* bitmaps and outlines from a given face. */
/* */
/* These functions should be optional if you are writing a font server */
/* or text layout engine on top of FreeType. However, they are pretty */
/* handy for many other simple uses of the library. */
/* */
/*************************************************************************/
#ifndef FTGLYPH_H_
#define FTGLYPH_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* glyph_management */
/* */
/* <Title> */
/* Glyph Management */
/* */
/* <Abstract> */
/* Generic interface to manage individual glyph data. */
/* */
/* <Description> */
/* This section contains definitions used to manage glyph data */
/* through generic FT_Glyph objects. Each of them can contain a */
/* bitmap, a vector outline, or even images in other formats. */
/* */
/*************************************************************************/
/* forward declaration to a private type */
typedef struct FT_Glyph_Class_ FT_Glyph_Class;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Glyph */
/* */
/* <Description> */
/* Handle to an object used to model generic glyph images. It is a */
/* pointer to the @FT_GlyphRec structure and can contain a glyph */
/* bitmap or pointer. */
/* */
/* <Note> */
/* Glyph objects are not owned by the library. You must thus release */
/* them manually (through @FT_Done_Glyph) _before_ calling */
/* @FT_Done_FreeType. */
/* */
typedef struct FT_GlyphRec_* FT_Glyph;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_GlyphRec */
/* */
/* <Description> */
/* The root glyph structure contains a given glyph image plus its */
/* advance width in 16.16 fixed-point format. */
/* */
/* <Fields> */
/* library :: A handle to the FreeType library object. */
/* */
/* clazz :: A pointer to the glyph's class. Private. */
/* */
/* format :: The format of the glyph's image. */
/* */
/* advance :: A 16.16 vector that gives the glyph's advance width. */
/* */
typedef struct FT_GlyphRec_
{
FT_Library library;
const FT_Glyph_Class* clazz;
FT_Glyph_Format format;
FT_Vector advance;
} FT_GlyphRec;
/*************************************************************************/
/* */
/* <Type> */
/* FT_BitmapGlyph */
/* */
/* <Description> */
/* A handle to an object used to model a bitmap glyph image. This is */
/* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */
/* */
typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_BitmapGlyphRec */
/* */
/* <Description> */
/* A structure used for bitmap glyph images. This really is a */
/* `sub-class' of @FT_GlyphRec. */
/* */
/* <Fields> */
/* root :: The root @FT_Glyph fields. */
/* */
/* left :: The left-side bearing, i.e., the horizontal distance */
/* from the current pen position to the left border of the */
/* glyph bitmap. */
/* */
/* top :: The top-side bearing, i.e., the vertical distance from */
/* the current pen position to the top border of the glyph */
/* bitmap. This distance is positive for upwards~y! */
/* */
/* bitmap :: A descriptor for the bitmap. */
/* */
/* <Note> */
/* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */
/* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */
/* the bitmap's contents easily. */
/* */
/* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */
/* and is thus created and destroyed with it. */
/* */
typedef struct FT_BitmapGlyphRec_
{
FT_GlyphRec root;
FT_Int left;
FT_Int top;
FT_Bitmap bitmap;
} FT_BitmapGlyphRec;
/*************************************************************************/
/* */
/* <Type> */
/* FT_OutlineGlyph */
/* */
/* <Description> */
/* A handle to an object used to model an outline glyph image. This */
/* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */
/* */
typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_OutlineGlyphRec */
/* */
/* <Description> */
/* A structure used for outline (vectorial) glyph images. This */
/* really is a `sub-class' of @FT_GlyphRec. */
/* */
/* <Fields> */
/* root :: The root @FT_Glyph fields. */
/* */
/* outline :: A descriptor for the outline. */
/* */
/* <Note> */
/* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */
/* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */
/* the outline's content easily. */
/* */
/* As the outline is extracted from a glyph slot, its coordinates are */
/* expressed normally in 26.6 pixels, unless the flag */
/* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */
/* */
/* The outline's tables are always owned by the object and are */
/* destroyed with it. */
/* */
typedef struct FT_OutlineGlyphRec_
{
FT_GlyphRec root;
FT_Outline outline;
} FT_OutlineGlyphRec;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Glyph */
/* */
/* <Description> */
/* A function used to extract a glyph image from a slot. Note that */
/* the created @FT_Glyph object must be released with @FT_Done_Glyph. */
/* */
/* <Input> */
/* slot :: A handle to the source glyph slot. */
/* */
/* <Output> */
/* aglyph :: A handle to the glyph object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Because `*aglyph->advance.x' and '*aglyph->advance.y' are 16.16 */
/* fixed-point numbers, `slot->advance.x' and `slot->advance.y' */
/* (which are in 26.6 fixed-point format) must be in the range */
/* ]-32768;32768[. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Glyph( FT_GlyphSlot slot,
FT_Glyph *aglyph );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Glyph_Copy */
/* */
/* <Description> */
/* A function used to copy a glyph image. Note that the created */
/* @FT_Glyph object must be released with @FT_Done_Glyph. */
/* */
/* <Input> */
/* source :: A handle to the source glyph object. */
/* */
/* <Output> */
/* target :: A handle to the target glyph object. 0~in case of */
/* error. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_Copy( FT_Glyph source,
FT_Glyph *target );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Glyph_Transform */
/* */
/* <Description> */
/* Transform a glyph image if its format is scalable. */
/* */
/* <InOut> */
/* glyph :: A handle to the target glyph object. */
/* */
/* <Input> */
/* matrix :: A pointer to a 2x2 matrix to apply. */
/* */
/* delta :: A pointer to a 2d vector to apply. Coordinates are */
/* expressed in 1/64th of a pixel. */
/* */
/* <Return> */
/* FreeType error code (if not 0, the glyph format is not scalable). */
/* */
/* <Note> */
/* The 2x2 transformation matrix is also applied to the glyph's */
/* advance vector. */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_Transform( FT_Glyph glyph,
FT_Matrix* matrix,
FT_Vector* delta );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Glyph_BBox_Mode */
/* */
/* <Description> */
/* The mode how the values of @FT_Glyph_Get_CBox are returned. */
/* */
/* <Values> */
/* FT_GLYPH_BBOX_UNSCALED :: */
/* Return unscaled font units. */
/* */
/* FT_GLYPH_BBOX_SUBPIXELS :: */
/* Return unfitted 26.6 coordinates. */
/* */
/* FT_GLYPH_BBOX_GRIDFIT :: */
/* Return grid-fitted 26.6 coordinates. */
/* */
/* FT_GLYPH_BBOX_TRUNCATE :: */
/* Return coordinates in integer pixels. */
/* */
/* FT_GLYPH_BBOX_PIXELS :: */
/* Return grid-fitted pixel coordinates. */
/* */
typedef enum FT_Glyph_BBox_Mode_
{
FT_GLYPH_BBOX_UNSCALED = 0,
FT_GLYPH_BBOX_SUBPIXELS = 0,
FT_GLYPH_BBOX_GRIDFIT = 1,
FT_GLYPH_BBOX_TRUNCATE = 2,
FT_GLYPH_BBOX_PIXELS = 3
} FT_Glyph_BBox_Mode;
/* these constants are deprecated; use the corresponding */
/* `FT_Glyph_BBox_Mode' values instead */
#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED
#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS
#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT
#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE
#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS
/*************************************************************************/
/* */
/* <Function> */
/* FT_Glyph_Get_CBox */
/* */
/* <Description> */
/* Return a glyph's `control box'. The control box encloses all the */
/* outline's points, including Bezier control points. Though it */
/* coincides with the exact bounding box for most glyphs, it can be */
/* slightly larger in some situations (like when rotating an outline */
/* that contains Bezier outside arcs). */
/* */
/* Computing the control box is very fast, while getting the bounding */
/* box can take much more time as it needs to walk over all segments */
/* and arcs in the outline. To get the latter, you can use the */
/* `ftbbox' component, which is dedicated to this single task. */
/* */
/* <Input> */
/* glyph :: A handle to the source glyph object. */
/* */
/* mode :: The mode that indicates how to interpret the returned */
/* bounding box values. */
/* */
/* <Output> */
/* acbox :: The glyph coordinate bounding box. Coordinates are */
/* expressed in 1/64th of pixels if it is grid-fitted. */
/* */
/* <Note> */
/* Coordinates are relative to the glyph origin, using the y~upwards */
/* convention. */
/* */
/* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */
/* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */
/* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */
/* is another name for this constant. */
/* */
/* If the font is tricky and the glyph has been loaded with */
/* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */
/* reasonable values for the CBox it is necessary to load the glyph */
/* at a large ppem value (so that the hinting instructions can */
/* properly shift and scale the subglyphs), then extracting the CBox, */
/* which can be eventually converted back to font units. */
/* */
/* Note that the maximum coordinates are exclusive, which means that */
/* one can compute the width and height of the glyph image (be it in */
/* integer or 26.6 pixels) as: */
/* */
/* { */
/* width = bbox.xMax - bbox.xMin; */
/* height = bbox.yMax - bbox.yMin; */
/* } */
/* */
/* Note also that for 26.6 coordinates, if `bbox_mode' is set to */
/* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */
/* which corresponds to: */
/* */
/* { */
/* bbox.xMin = FLOOR(bbox.xMin); */
/* bbox.yMin = FLOOR(bbox.yMin); */
/* bbox.xMax = CEILING(bbox.xMax); */
/* bbox.yMax = CEILING(bbox.yMax); */
/* } */
/* */
/* To get the bbox in pixel coordinates, set `bbox_mode' to */
/* @FT_GLYPH_BBOX_TRUNCATE. */
/* */
/* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */
/* to @FT_GLYPH_BBOX_PIXELS. */
/* */
FT_EXPORT( void )
FT_Glyph_Get_CBox( FT_Glyph glyph,
FT_UInt bbox_mode,
FT_BBox *acbox );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Glyph_To_Bitmap */
/* */
/* <Description> */
/* Convert a given glyph object to a bitmap glyph object. */
/* */
/* <InOut> */
/* the_glyph :: A pointer to a handle to the target glyph. */
/* */
/* <Input> */
/* render_mode :: An enumeration that describes how the data is */
/* rendered. */
/* */
/* origin :: A pointer to a vector used to translate the glyph */
/* image before rendering. Can be~0 (if no */
/* translation). The origin is expressed in */
/* 26.6 pixels. */
/* */
/* destroy :: A boolean that indicates that the original glyph */
/* image should be destroyed by this function. It is */
/* never destroyed in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function does nothing if the glyph format isn't scalable. */
/* */
/* The glyph image is translated with the `origin' vector before */
/* rendering. */
/* */
/* The first parameter is a pointer to an @FT_Glyph handle, that will */
/* be _replaced_ by this function (with newly allocated data). */
/* Typically, you would use (omitting error handling): */
/* */
/* */
/* { */
/* FT_Glyph glyph; */
/* FT_BitmapGlyph glyph_bitmap; */
/* */
/* */
/* // load glyph */
/* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT ); */
/* */
/* // extract glyph image */
/* error = FT_Get_Glyph( face->glyph, &glyph ); */
/* */
/* // convert to a bitmap (default render mode + destroying old) */
/* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
/* { */
/* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */
/* 0, 1 ); */
/* if ( error ) // `glyph' unchanged */
/* ... */
/* } */
/* */
/* // access bitmap content by typecasting */
/* glyph_bitmap = (FT_BitmapGlyph)glyph; */
/* */
/* // do funny stuff with it, like blitting/drawing */
/* ... */
/* */
/* // discard glyph image (bitmap or not) */
/* FT_Done_Glyph( glyph ); */
/* } */
/* */
/* */
/* Here another example, again without error handling: */
/* */
/* */
/* { */
/* FT_Glyph glyphs[MAX_GLYPHS] */
/* */
/* */
/* ... */
/* */
/* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
/* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */
/* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */
/* */
/* ... */
/* */
/* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
/* { */
/* FT_Glyph bitmap = glyphs[idx]; */
/* */
/* */
/* ... */
/* */
/* // after this call, `bitmap' no longer points into */
/* // the `glyphs' array (and the old value isn't destroyed) */
/* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */
/* */
/* ... */
/* */
/* FT_Done_Glyph( bitmap ); */
/* } */
/* */
/* ... */
/* */
/* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
/* FT_Done_Glyph( glyphs[idx] ); */
/* } */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
FT_Render_Mode render_mode,
FT_Vector* origin,
FT_Bool destroy );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Glyph */
/* */
/* <Description> */
/* Destroy a given glyph. */
/* */
/* <Input> */
/* glyph :: A handle to the target glyph object. */
/* */
FT_EXPORT( void )
FT_Done_Glyph( FT_Glyph glyph );
/* */
/* other helpful functions */
/*************************************************************************/
/* */
/* <Section> */
/* computations */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Matrix_Multiply */
/* */
/* <Description> */
/* Perform the matrix operation `b = a*b'. */
/* */
/* <Input> */
/* a :: A pointer to matrix `a'. */
/* */
/* <InOut> */
/* b :: A pointer to matrix `b'. */
/* */
/* <Note> */
/* The result is undefined if either `a' or `b' is zero. */
/* */
/* Since the function uses wrap-around arithmetic, results become */
/* meaningless if the arguments are very large. */
/* */
FT_EXPORT( void )
FT_Matrix_Multiply( const FT_Matrix* a,
FT_Matrix* b );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Matrix_Invert */
/* */
/* <Description> */
/* Invert a 2x2 matrix. Return an error if it can't be inverted. */
/* */
/* <InOut> */
/* matrix :: A pointer to the target matrix. Remains untouched in */
/* case of error. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Matrix_Invert( FT_Matrix* matrix );
/* */
FT_END_HEADER
#endif /* FTGLYPH_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/***************************************************************************/
/* */
/* ftparams.h */
/* */
/* FreeType API for possible FT_Parameter tags (specification only). */
/* */
/* Copyright 2017-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTPARAMS_H_
#define FTPARAMS_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* parameter_tags
*
* @title:
* Parameter Tags
*
* @abstract:
* Macros for driver property and font loading parameter tags.
*
* @description:
* This section contains macros for the @FT_Parameter structure that are
* used with various functions to activate some special functionality or
* different behaviour of various components of FreeType.
*
*/
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
*
* @description:
* A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
* family names in the `name' table (introduced in OpenType version
* 1.4). Use this for backward compatibility with legacy systems that
* have a four-faces-per-family restriction.
*
* @since:
* 2.8
*
*/
#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \
FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
/* this constant is deprecated */
#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \
FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
*
* @description:
* A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
* subfamily names in the `name' table (introduced in OpenType version
* 1.4). Use this for backward compatibility with legacy systems that
* have a four-faces-per-family restriction.
*
* @since:
* 2.8
*
*/
#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \
FT_MAKE_TAG( 'i', 'g', 'p', 's' )
/* this constant is deprecated */
#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \
FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_INCREMENTAL
*
* @description:
* An @FT_Parameter tag to be used with @FT_Open_Face to indicate
* incremental glyph loading.
*
*/
#define FT_PARAM_TAG_INCREMENTAL \
FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
/**************************************************************************
*
* @constant:
* FT_PARAM_TAG_LCD_FILTER_WEIGHTS
*
* @description:
* An @FT_Parameter tag to be used with @FT_Face_Properties. The
* corresponding argument specifies the five LCD filter weights for a
* given face (if using @FT_LOAD_TARGET_LCD, for example), overriding
* the global default values or the values set up with
* @FT_Library_SetLcdFilterWeights.
*
* @since:
* 2.8
*
*/
#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \
FT_MAKE_TAG( 'l', 'c', 'd', 'f' )
/**************************************************************************
*
* @constant:
* FT_PARAM_TAG_RANDOM_SEED
*
* @description:
* An @FT_Parameter tag to be used with @FT_Face_Properties. The
* corresponding 32bit signed integer argument overrides the font
* driver's random seed value with a face-specific one; see
* @random-seed.
*
* @since:
* 2.8
*
*/
#define FT_PARAM_TAG_RANDOM_SEED \
FT_MAKE_TAG( 's', 'e', 'e', 'd' )
/**************************************************************************
*
* @constant:
* FT_PARAM_TAG_STEM_DARKENING
*
* @description:
* An @FT_Parameter tag to be used with @FT_Face_Properties. The
* corresponding Boolean argument specifies whether to apply stem
* darkening, overriding the global default values or the values set up
* with @FT_Property_Set (see @no-stem-darkening).
*
* This is a passive setting that only takes effect if the font driver
* or autohinter honors it, which the CFF, Type~1, and CID drivers
* always do, but the autohinter only in `light' hinting mode (as of
* version 2.9).
*
* @since:
* 2.8
*
*/
#define FT_PARAM_TAG_STEM_DARKENING \
FT_MAKE_TAG( 'd', 'a', 'r', 'k' )
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_UNPATENTED_HINTING
*
* @description:
* Deprecated, no effect.
*
* Previously: A constant used as the tag of an @FT_Parameter structure to
* indicate that unpatented methods only should be used by the TrueType
* bytecode interpreter for a typeface opened by @FT_Open_Face.
*
*/
#define FT_PARAM_TAG_UNPATENTED_HINTING \
FT_MAKE_TAG( 'u', 'n', 'p', 'a' )
/* */
FT_END_HEADER
#endif /* FTPARAMS_H_ */
/* END */
/***************************************************************************/
/* */
/* tttags.h */
/* */
/* Tags for TrueType and OpenType tables (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef TTAGS_H_
#define TTAGS_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' )
#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' )
#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' )
#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' )
#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' )
#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' )
#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' )
#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' )
#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' )
#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' )
#define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' )
#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' )
#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' )
#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' )
#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' )
#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' )
#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' )
#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' )
#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' )
#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' )
#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' )
#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' )
#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' )
#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' )
#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' )
#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' )
#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' )
#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' )
#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' )
#define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' )
#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' )
#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' )
#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' )
#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' )
#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' )
#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' )
#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' )
#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' )
#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' )
#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' )
#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' )
#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' )
#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' )
#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' )
#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' )
#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' )
#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' )
#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' )
#define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' )
#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' )
#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' )
#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' )
#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' )
#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' )
#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' )
#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' )
#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' )
#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' )
#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' )
#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' )
#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' )
#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' )
#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' )
#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' )
#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' )
#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' )
#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' )
#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' )
#define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' )
#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' )
/* used by "Keyboard.dfont" on legacy Mac OS X */
#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )
/* used by "LastResort.dfont" on legacy Mac OS X */
#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' )
FT_END_HEADER
#endif /* TTAGS_H_ */
/* END */
/***************************************************************************/
/* */
/* ftstroke.h */
/* */
/* FreeType path stroker (specification). */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTSTROKE_H_
#define FTSTROKE_H_
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_GLYPH_H
FT_BEGIN_HEADER
/************************************************************************
*
* @section:
* glyph_stroker
*
* @title:
* Glyph Stroker
*
* @abstract:
* Generating bordered and stroked glyphs.
*
* @description:
* This component generates stroked outlines of a given vectorial
* glyph. It also allows you to retrieve the `outside' and/or the
* `inside' borders of the stroke.
*
* This can be useful to generate `bordered' glyph, i.e., glyphs
* displayed with a coloured (and anti-aliased) border around their
* shape.
*
* @order:
* FT_Stroker
*
* FT_Stroker_LineJoin
* FT_Stroker_LineCap
* FT_StrokerBorder
*
* FT_Outline_GetInsideBorder
* FT_Outline_GetOutsideBorder
*
* FT_Glyph_Stroke
* FT_Glyph_StrokeBorder
*
* FT_Stroker_New
* FT_Stroker_Set
* FT_Stroker_Rewind
* FT_Stroker_ParseOutline
* FT_Stroker_Done
*
* FT_Stroker_BeginSubPath
* FT_Stroker_EndSubPath
*
* FT_Stroker_LineTo
* FT_Stroker_ConicTo
* FT_Stroker_CubicTo
*
* FT_Stroker_GetBorderCounts
* FT_Stroker_ExportBorder
* FT_Stroker_GetCounts
* FT_Stroker_Export
*
*/
/**************************************************************
*
* @type:
* FT_Stroker
*
* @description:
* Opaque handle to a path stroker object.
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/**************************************************************
*
* @enum:
* FT_Stroker_LineJoin
*
* @description:
* These values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* Used to render rounded line joins. Circular arcs are used
* to join two lines smoothly.
*
* FT_STROKER_LINEJOIN_BEVEL ::
* Used to render beveled line joins. The outer corner of
* the joined lines is filled by enclosing the triangular
* region of the corner with a straight line between the
* outer corners of each stroke.
*
* FT_STROKER_LINEJOIN_MITER_FIXED ::
* Used to render mitered line joins, with fixed bevels if the
* miter limit is exceeded. The outer edges of the strokes
* for the two segments are extended until they meet at an
* angle. If the segments meet at too sharp an angle (such
* that the miter would extend from the intersection of the
* segments a distance greater than the product of the miter
* limit value and the border radius), then a bevel join (see
* above) is used instead. This prevents long spikes being
* created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter
* line join as used in PostScript and PDF.
*
* FT_STROKER_LINEJOIN_MITER_VARIABLE ::
* FT_STROKER_LINEJOIN_MITER ::
* Used to render mitered line joins, with variable bevels if
* the miter limit is exceeded. The intersection of the
* strokes is clipped at a line perpendicular to the bisector
* of the angle between the strokes, at the distance from the
* intersection of the segments equal to the product of the
* miter limit value and the border radius. This prevents
* long spikes being created.
* FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line
* join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias
* for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for
* backward compatibility.
*/
typedef enum FT_Stroker_LineJoin_
{
FT_STROKER_LINEJOIN_ROUND = 0,
FT_STROKER_LINEJOIN_BEVEL = 1,
FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,
FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,
FT_STROKER_LINEJOIN_MITER_FIXED = 3
} FT_Stroker_LineJoin;
/**************************************************************
*
* @enum:
* FT_Stroker_LineCap
*
* @description:
* These values determine how the end of opened sub-paths are
* rendered in a stroke.
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* The end of lines is rendered as a full stop on the last
* point itself.
*
* FT_STROKER_LINECAP_ROUND ::
* The end of lines is rendered as a half-circle around the
* last point.
*
* FT_STROKER_LINECAP_SQUARE ::
* The end of lines is rendered as a square around the
* last point.
*/
typedef enum FT_Stroker_LineCap_
{
FT_STROKER_LINECAP_BUTT = 0,
FT_STROKER_LINECAP_ROUND,
FT_STROKER_LINECAP_SQUARE
} FT_Stroker_LineCap;
/**************************************************************
*
* @enum:
* FT_StrokerBorder
*
* @description:
* These values are used to select a given stroke border
* in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
*
* @values:
* FT_STROKER_BORDER_LEFT ::
* Select the left border, relative to the drawing direction.
*
* FT_STROKER_BORDER_RIGHT ::
* Select the right border, relative to the drawing direction.
*
* @note:
* Applications are generally interested in the `inside' and `outside'
* borders. However, there is no direct mapping between these and the
* `left' and `right' ones, since this really depends on the glyph's
* drawing orientation, which varies between font formats.
*
* You can however use @FT_Outline_GetInsideBorder and
* @FT_Outline_GetOutsideBorder to get these.
*/
typedef enum FT_StrokerBorder_
{
FT_STROKER_BORDER_LEFT = 0,
FT_STROKER_BORDER_RIGHT
} FT_StrokerBorder;
/**************************************************************
*
* @function:
* FT_Outline_GetInsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `inside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetInsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Outline_GetOutsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `outside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetOutsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_New
*
* @description:
* Create a new stroker object.
*
* @input:
* library ::
* FreeType library handle.
*
* @output:
* astroker ::
* A new stroker object handle. NULL in case of error.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Library library,
FT_Stroker *astroker );
/**************************************************************
*
* @function:
* FT_Stroker_Set
*
* @description:
* Reset a stroker object's attributes.
*
* @input:
* stroker ::
* The target stroker handle.
*
* radius ::
* The border radius.
*
* line_cap ::
* The line cap style.
*
* line_join ::
* The line join style.
*
* miter_limit ::
* The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and
* FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles,
* expressed as 16.16 fixed-point value.
*
* @note:
* The radius is expressed in the same units as the outline
* coordinates.
*
* This function calls @FT_Stroker_Rewind automatically.
*/
FT_EXPORT( void )
FT_Stroker_Set( FT_Stroker stroker,
FT_Fixed radius,
FT_Stroker_LineCap line_cap,
FT_Stroker_LineJoin line_join,
FT_Fixed miter_limit );
/**************************************************************
*
* @function:
* FT_Stroker_Rewind
*
* @description:
* Reset a stroker object without changing its attributes.
* You should call this function before beginning a new
* series of calls to @FT_Stroker_BeginSubPath or
* @FT_Stroker_EndSubPath.
*
* @input:
* stroker ::
* The target stroker handle.
*/
FT_EXPORT( void )
FT_Stroker_Rewind( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Stroker_ParseOutline
*
* @description:
* A convenience function used to parse a whole outline with
* the stroker. The resulting outline(s) can be retrieved
* later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The source outline.
*
* opened ::
* A boolean. If~1, the outline is treated as an open path instead
* of a closed one.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If `opened' is~0 (the default), the outline is treated as a closed
* path, and the stroker generates two distinct `border' outlines.
*
* If `opened' is~1, the outline is processed as an open path, and the
* stroker generates a single `stroke' outline.
*
* This function calls @FT_Stroker_Rewind automatically.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
FT_Outline* outline,
FT_Bool opened );
/**************************************************************
*
* @function:
* FT_Stroker_BeginSubPath
*
* @description:
* Start a new sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the start vector.
*
* open ::
* A boolean. If~1, the sub-path is treated as an open one.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function is useful when you need to stroke a path that is
* not stored as an @FT_Outline object.
*/
FT_EXPORT( FT_Error )
FT_Stroker_BeginSubPath( FT_Stroker stroker,
FT_Vector* to,
FT_Bool open );
/**************************************************************
*
* @function:
* FT_Stroker_EndSubPath
*
* @description:
* Close the current sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You should call this function after @FT_Stroker_BeginSubPath.
* If the subpath was not `opened', this function `draws' a
* single line segment to the start position when needed.
*/
FT_EXPORT( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Stroker_LineTo
*
* @description:
* `Draw' a single line segment in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_ConicTo
*
* @description:
* `Draw' a single quadratic Bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control ::
* A pointer to a Bezier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ConicTo( FT_Stroker stroker,
FT_Vector* control,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_CubicTo
*
* @description:
* `Draw' a single cubic Bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control1 ::
* A pointer to the first Bezier control point.
*
* control2 ::
* A pointer to second Bezier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_CubicTo( FT_Stroker stroker,
FT_Vector* control1,
FT_Vector* control2,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_GetBorderCounts
*
* @description:
* Call this function once you have finished parsing your paths
* with the stroker. It returns the number of points and
* contours necessary to export one of the `border' or `stroke'
* outlines generated by the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'.
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_GetCounts instead if you want to
* retrieve the counts associated to both borders.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetBorderCounts( FT_Stroker stroker,
FT_StrokerBorder border,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function:
* FT_Stroker_ExportBorder
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the corresponding border to your own @FT_Outline
* structure.
*
* Note that this function appends the border points and
* contours to your outline, but does not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* outline ::
* The target outline handle.
*
* @note:
* Always call this function after @FT_Stroker_GetBorderCounts to
* get sure that there is enough room in your @FT_Outline object to
* receive all new data.
*
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'.
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_Export instead if you want to
* retrieve all borders at once.
*/
FT_EXPORT( void )
FT_Stroker_ExportBorder( FT_Stroker stroker,
FT_StrokerBorder border,
FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_GetCounts
*
* @description:
* Call this function once you have finished parsing your paths
* with the stroker. It returns the number of points and
* contours necessary to export all points/borders from the stroked
* outline/path.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function:
* FT_Stroker_Export
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export all borders to your own @FT_Outline structure.
*
* Note that this function appends the border points and
* contours to your outline, but does not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The target outline handle.
*/
FT_EXPORT( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_Done
*
* @description:
* Destroy a stroker object.
*
* @input:
* stroker ::
* A stroker handle. Can be NULL.
*/
FT_EXPORT( void )
FT_Stroker_Done( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Glyph_Stroke
*
* @description:
* Stroke a given outline glyph object with a given stroker.
*
* @inout:
* pglyph ::
* Source glyph handle on input, new glyph handle on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* destroy ::
* A Boolean. If~1, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The source glyph is untouched in case of error.
*
* Adding stroke may yield a significantly wider and taller glyph
* depending on how large of a radius was used to stroke the glyph. You
* may need to manually adjust horizontal and vertical advance amounts
* to account for this added size.
*/
FT_EXPORT( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool destroy );
/**************************************************************
*
* @function:
* FT_Glyph_StrokeBorder
*
* @description:
* Stroke a given outline glyph object with a given stroker, but
* only return either its inside or outside border.
*
* @inout:
* pglyph ::
* Source glyph handle on input, new glyph handle on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* inside ::
* A Boolean. If~1, return the inside border, otherwise
* the outside border.
*
* destroy ::
* A Boolean. If~1, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The source glyph is untouched in case of error.
*
* Adding stroke may yield a significantly wider and taller glyph
* depending on how large of a radius was used to stroke the glyph. You
* may need to manually adjust horizontal and vertical advance amounts
* to account for this added size.
*/
FT_EXPORT( FT_Error )
FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool inside,
FT_Bool destroy );
/* */
FT_END_HEADER
#endif /* FTSTROKE_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/***************************************************************************/
/* */
/* t1tables.h */
/* */
/* Basic Type 1/Type 2 tables definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef T1TABLES_H_
#define T1TABLES_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* type1_tables */
/* */
/* <Title> */
/* Type 1 Tables */
/* */
/* <Abstract> */
/* Type~1 (PostScript) specific font tables. */
/* */
/* <Description> */
/* This section contains the definition of Type 1-specific tables, */
/* including structures related to other PostScript font formats. */
/* */
/* <Order> */
/* PS_FontInfoRec */
/* PS_FontInfo */
/* PS_PrivateRec */
/* PS_Private */
/* */
/* CID_FaceDictRec */
/* CID_FaceDict */
/* CID_FaceInfoRec */
/* CID_FaceInfo */
/* */
/* FT_Has_PS_Glyph_Names */
/* FT_Get_PS_Font_Info */
/* FT_Get_PS_Font_Private */
/* FT_Get_PS_Font_Value */
/* */
/* T1_Blend_Flags */
/* T1_EncodingType */
/* PS_Dict_Keys */
/* */
/*************************************************************************/
/* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */
/* structures in order to support Multiple Master fonts. */
/*************************************************************************/
/* */
/* <Struct> */
/* PS_FontInfoRec */
/* */
/* <Description> */
/* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */
/* Note that for Multiple Master fonts, each instance has its own */
/* FontInfo dictionary. */
/* */
typedef struct PS_FontInfoRec_
{
FT_String* version;
FT_String* notice;
FT_String* full_name;
FT_String* family_name;
FT_String* weight;
FT_Long italic_angle;
FT_Bool is_fixed_pitch;
FT_Short underline_position;
FT_UShort underline_thickness;
} PS_FontInfoRec;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_FontInfo */
/* */
/* <Description> */
/* A handle to a @PS_FontInfoRec structure. */
/* */
typedef struct PS_FontInfoRec_* PS_FontInfo;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_FontInfo */
/* */
/* <Description> */
/* This type is equivalent to @PS_FontInfoRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef PS_FontInfoRec T1_FontInfo;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_PrivateRec */
/* */
/* <Description> */
/* A structure used to model a Type~1 or Type~2 private dictionary. */
/* Note that for Multiple Master fonts, each instance has its own */
/* Private dictionary. */
/* */
typedef struct PS_PrivateRec_
{
FT_Int unique_id;
FT_Int lenIV;
FT_Byte num_blue_values;
FT_Byte num_other_blues;
FT_Byte num_family_blues;
FT_Byte num_family_other_blues;
FT_Short blue_values[14];
FT_Short other_blues[10];
FT_Short family_blues [14];
FT_Short family_other_blues[10];
FT_Fixed blue_scale;
FT_Int blue_shift;
FT_Int blue_fuzz;
FT_UShort standard_width[1];
FT_UShort standard_height[1];
FT_Byte num_snap_widths;
FT_Byte num_snap_heights;
FT_Bool force_bold;
FT_Bool round_stem_up;
FT_Short snap_widths [13]; /* including std width */
FT_Short snap_heights[13]; /* including std height */
FT_Fixed expansion_factor;
FT_Long language_group;
FT_Long password;
FT_Short min_feature[2];
} PS_PrivateRec;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_Private */
/* */
/* <Description> */
/* A handle to a @PS_PrivateRec structure. */
/* */
typedef struct PS_PrivateRec_* PS_Private;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Private */
/* */
/* <Description> */
/* This type is equivalent to @PS_PrivateRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef PS_PrivateRec T1_Private;
/*************************************************************************/
/* */
/* <Enum> */
/* T1_Blend_Flags */
/* */
/* <Description> */
/* A set of flags used to indicate which fields are present in a */
/* given blend dictionary (font info or private). Used to support */
/* Multiple Masters fonts. */
/* */
/* <Values> */
/* T1_BLEND_UNDERLINE_POSITION :: */
/* T1_BLEND_UNDERLINE_THICKNESS :: */
/* T1_BLEND_ITALIC_ANGLE :: */
/* T1_BLEND_BLUE_VALUES :: */
/* T1_BLEND_OTHER_BLUES :: */
/* T1_BLEND_STANDARD_WIDTH :: */
/* T1_BLEND_STANDARD_HEIGHT :: */
/* T1_BLEND_STEM_SNAP_WIDTHS :: */
/* T1_BLEND_STEM_SNAP_HEIGHTS :: */
/* T1_BLEND_BLUE_SCALE :: */
/* T1_BLEND_BLUE_SHIFT :: */
/* T1_BLEND_FAMILY_BLUES :: */
/* T1_BLEND_FAMILY_OTHER_BLUES :: */
/* T1_BLEND_FORCE_BOLD :: */
/* */
typedef enum T1_Blend_Flags_
{
/* required fields in a FontInfo blend dictionary */
T1_BLEND_UNDERLINE_POSITION = 0,
T1_BLEND_UNDERLINE_THICKNESS,
T1_BLEND_ITALIC_ANGLE,
/* required fields in a Private blend dictionary */
T1_BLEND_BLUE_VALUES,
T1_BLEND_OTHER_BLUES,
T1_BLEND_STANDARD_WIDTH,
T1_BLEND_STANDARD_HEIGHT,
T1_BLEND_STEM_SNAP_WIDTHS,
T1_BLEND_STEM_SNAP_HEIGHTS,
T1_BLEND_BLUE_SCALE,
T1_BLEND_BLUE_SHIFT,
T1_BLEND_FAMILY_BLUES,
T1_BLEND_FAMILY_OTHER_BLUES,
T1_BLEND_FORCE_BOLD,
T1_BLEND_MAX /* do not remove */
} T1_Blend_Flags;
/* these constants are deprecated; use the corresponding */
/* `T1_Blend_Flags' values instead */
#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION
#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS
#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE
#define t1_blend_blue_values T1_BLEND_BLUE_VALUES
#define t1_blend_other_blues T1_BLEND_OTHER_BLUES
#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH
#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT
#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS
#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS
#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE
#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT
#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES
#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES
#define t1_blend_force_bold T1_BLEND_FORCE_BOLD
#define t1_blend_max T1_BLEND_MAX
/* */
/* maximum number of Multiple Masters designs, as defined in the spec */
#define T1_MAX_MM_DESIGNS 16
/* maximum number of Multiple Masters axes, as defined in the spec */
#define T1_MAX_MM_AXIS 4
/* maximum number of elements in a design map */
#define T1_MAX_MM_MAP_POINTS 20
/* this structure is used to store the BlendDesignMap entry for an axis */
typedef struct PS_DesignMap_
{
FT_Byte num_points;
FT_Long* design_points;
FT_Fixed* blend_points;
} PS_DesignMapRec, *PS_DesignMap;
/* backward compatible definition */
typedef PS_DesignMapRec T1_DesignMap;
typedef struct PS_BlendRec_
{
FT_UInt num_designs;
FT_UInt num_axis;
FT_String* axis_names[T1_MAX_MM_AXIS];
FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
PS_DesignMapRec design_map[T1_MAX_MM_AXIS];
FT_Fixed* weight_vector;
FT_Fixed* default_weight_vector;
PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];
PS_Private privates [T1_MAX_MM_DESIGNS + 1];
FT_ULong blend_bitflags;
FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];
/* since 2.3.0 */
/* undocumented, optional: the default design instance; */
/* corresponds to default_weight_vector -- */
/* num_default_design_vector == 0 means it is not present */
/* in the font and associated metrics files */
FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];
FT_UInt num_default_design_vector;
} PS_BlendRec, *PS_Blend;
/* backward compatible definition */
typedef PS_BlendRec T1_Blend;
/*************************************************************************/
/* */
/* <Struct> */
/* CID_FaceDictRec */
/* */
/* <Description> */
/* A structure used to represent data in a CID top-level dictionary. */
/* */
typedef struct CID_FaceDictRec_
{
PS_PrivateRec private_dict;
FT_UInt len_buildchar;
FT_Fixed forcebold_threshold;
FT_Pos stroke_width;
FT_Fixed expansion_factor;
FT_Byte paint_type;
FT_Byte font_type;
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_UInt num_subrs;
FT_ULong subrmap_offset;
FT_Int sd_bytes;
} CID_FaceDictRec;
/*************************************************************************/
/* */
/* <Struct> */
/* CID_FaceDict */
/* */
/* <Description> */
/* A handle to a @CID_FaceDictRec structure. */
/* */
typedef struct CID_FaceDictRec_* CID_FaceDict;
/*************************************************************************/
/* */
/* <Struct> */
/* CID_FontDict */
/* */
/* <Description> */
/* This type is equivalent to @CID_FaceDictRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef CID_FaceDictRec CID_FontDict;
/*************************************************************************/
/* */
/* <Struct> */
/* CID_FaceInfoRec */
/* */
/* <Description> */
/* A structure used to represent CID Face information. */
/* */
typedef struct CID_FaceInfoRec_
{
FT_String* cid_font_name;
FT_Fixed cid_version;
FT_Int cid_font_type;
FT_String* registry;
FT_String* ordering;
FT_Int supplement;
PS_FontInfoRec font_info;
FT_BBox font_bbox;
FT_ULong uid_base;
FT_Int num_xuid;
FT_ULong xuid[16];
FT_ULong cidmap_offset;
FT_Int fd_bytes;
FT_Int gd_bytes;
FT_ULong cid_count;
FT_Int num_dicts;
CID_FaceDict font_dicts;
FT_ULong data_offset;
} CID_FaceInfoRec;
/*************************************************************************/
/* */
/* <Struct> */
/* CID_FaceInfo */
/* */
/* <Description> */
/* A handle to a @CID_FaceInfoRec structure. */
/* */
typedef struct CID_FaceInfoRec_* CID_FaceInfo;
/*************************************************************************/
/* */
/* <Struct> */
/* CID_Info */
/* */
/* <Description> */
/* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef CID_FaceInfoRec CID_Info;
/************************************************************************
*
* @function:
* FT_Has_PS_Glyph_Names
*
* @description:
* Return true if a given face provides reliable PostScript glyph
* names. This is similar to using the @FT_HAS_GLYPH_NAMES macro,
* except that certain fonts (mostly TrueType) contain incorrect
* glyph name tables.
*
* When this function returns true, the caller is sure that the glyph
* names returned by @FT_Get_Glyph_Name are reliable.
*
* @input:
* face ::
* face handle
*
* @return:
* Boolean. True if glyph names are reliable.
*
*/
FT_EXPORT( FT_Int )
FT_Has_PS_Glyph_Names( FT_Face face );
/************************************************************************
*
* @function:
* FT_Get_PS_Font_Info
*
* @description:
* Retrieve the @PS_FontInfoRec structure corresponding to a given
* PostScript font.
*
* @input:
* face ::
* PostScript face handle.
*
* @output:
* afont_info ::
* Output font info structure pointer.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* String pointers within the @PS_FontInfoRec structure are owned by
* the face and don't need to be freed by the caller. Missing entries
* in the font's FontInfo dictionary are represented by NULL pointers.
*
* If the font's format is not PostScript-based, this function will
* return the `FT_Err_Invalid_Argument' error code.
*
*/
FT_EXPORT( FT_Error )
FT_Get_PS_Font_Info( FT_Face face,
PS_FontInfo afont_info );
/************************************************************************
*
* @function:
* FT_Get_PS_Font_Private
*
* @description:
* Retrieve the @PS_PrivateRec structure corresponding to a given
* PostScript font.
*
* @input:
* face ::
* PostScript face handle.
*
* @output:
* afont_private ::
* Output private dictionary structure pointer.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The string pointers within the @PS_PrivateRec structure are owned by
* the face and don't need to be freed by the caller.
*
* If the font's format is not PostScript-based, this function returns
* the `FT_Err_Invalid_Argument' error code.
*
*/
FT_EXPORT( FT_Error )
FT_Get_PS_Font_Private( FT_Face face,
PS_Private afont_private );
/*************************************************************************/
/* */
/* <Enum> */
/* T1_EncodingType */
/* */
/* <Description> */
/* An enumeration describing the `Encoding' entry in a Type 1 */
/* dictionary. */
/* */
/* <Values> */
/* T1_ENCODING_TYPE_NONE :: */
/* T1_ENCODING_TYPE_ARRAY :: */
/* T1_ENCODING_TYPE_STANDARD :: */
/* T1_ENCODING_TYPE_ISOLATIN1 :: */
/* T1_ENCODING_TYPE_EXPERT :: */
/* */
/* <Since> */
/* 2.4.8 */
/* */
typedef enum T1_EncodingType_
{
T1_ENCODING_TYPE_NONE = 0,
T1_ENCODING_TYPE_ARRAY,
T1_ENCODING_TYPE_STANDARD,
T1_ENCODING_TYPE_ISOLATIN1,
T1_ENCODING_TYPE_EXPERT
} T1_EncodingType;
/*************************************************************************/
/* */
/* <Enum> */
/* PS_Dict_Keys */
/* */
/* <Description> */
/* An enumeration used in calls to @FT_Get_PS_Font_Value to identify */
/* the Type~1 dictionary entry to retrieve. */
/* */
/* <Values> */
/* PS_DICT_FONT_TYPE :: */
/* PS_DICT_FONT_MATRIX :: */
/* PS_DICT_FONT_BBOX :: */
/* PS_DICT_PAINT_TYPE :: */
/* PS_DICT_FONT_NAME :: */
/* PS_DICT_UNIQUE_ID :: */
/* PS_DICT_NUM_CHAR_STRINGS :: */
/* PS_DICT_CHAR_STRING_KEY :: */
/* PS_DICT_CHAR_STRING :: */
/* PS_DICT_ENCODING_TYPE :: */
/* PS_DICT_ENCODING_ENTRY :: */
/* PS_DICT_NUM_SUBRS :: */
/* PS_DICT_SUBR :: */
/* PS_DICT_STD_HW :: */
/* PS_DICT_STD_VW :: */
/* PS_DICT_NUM_BLUE_VALUES :: */
/* PS_DICT_BLUE_VALUE :: */
/* PS_DICT_BLUE_FUZZ :: */
/* PS_DICT_NUM_OTHER_BLUES :: */
/* PS_DICT_OTHER_BLUE :: */
/* PS_DICT_NUM_FAMILY_BLUES :: */
/* PS_DICT_FAMILY_BLUE :: */
/* PS_DICT_NUM_FAMILY_OTHER_BLUES :: */
/* PS_DICT_FAMILY_OTHER_BLUE :: */
/* PS_DICT_BLUE_SCALE :: */
/* PS_DICT_BLUE_SHIFT :: */
/* PS_DICT_NUM_STEM_SNAP_H :: */
/* PS_DICT_STEM_SNAP_H :: */
/* PS_DICT_NUM_STEM_SNAP_V :: */
/* PS_DICT_STEM_SNAP_V :: */
/* PS_DICT_FORCE_BOLD :: */
/* PS_DICT_RND_STEM_UP :: */
/* PS_DICT_MIN_FEATURE :: */
/* PS_DICT_LEN_IV :: */
/* PS_DICT_PASSWORD :: */
/* PS_DICT_LANGUAGE_GROUP :: */
/* PS_DICT_VERSION :: */
/* PS_DICT_NOTICE :: */
/* PS_DICT_FULL_NAME :: */
/* PS_DICT_FAMILY_NAME :: */
/* PS_DICT_WEIGHT :: */
/* PS_DICT_IS_FIXED_PITCH :: */
/* PS_DICT_UNDERLINE_POSITION :: */
/* PS_DICT_UNDERLINE_THICKNESS :: */
/* PS_DICT_FS_TYPE :: */
/* PS_DICT_ITALIC_ANGLE :: */
/* */
/* <Since> */
/* 2.4.8 */
/* */
typedef enum PS_Dict_Keys_
{
/* conventionally in the font dictionary */
PS_DICT_FONT_TYPE, /* FT_Byte */
PS_DICT_FONT_MATRIX, /* FT_Fixed */
PS_DICT_FONT_BBOX, /* FT_Fixed */
PS_DICT_PAINT_TYPE, /* FT_Byte */
PS_DICT_FONT_NAME, /* FT_String* */
PS_DICT_UNIQUE_ID, /* FT_Int */
PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */
PS_DICT_CHAR_STRING_KEY, /* FT_String* */
PS_DICT_CHAR_STRING, /* FT_String* */
PS_DICT_ENCODING_TYPE, /* T1_EncodingType */
PS_DICT_ENCODING_ENTRY, /* FT_String* */
/* conventionally in the font Private dictionary */
PS_DICT_NUM_SUBRS, /* FT_Int */
PS_DICT_SUBR, /* FT_String* */
PS_DICT_STD_HW, /* FT_UShort */
PS_DICT_STD_VW, /* FT_UShort */
PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */
PS_DICT_BLUE_VALUE, /* FT_Short */
PS_DICT_BLUE_FUZZ, /* FT_Int */
PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */
PS_DICT_OTHER_BLUE, /* FT_Short */
PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */
PS_DICT_FAMILY_BLUE, /* FT_Short */
PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */
PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */
PS_DICT_BLUE_SCALE, /* FT_Fixed */
PS_DICT_BLUE_SHIFT, /* FT_Int */
PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */
PS_DICT_STEM_SNAP_H, /* FT_Short */
PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */
PS_DICT_STEM_SNAP_V, /* FT_Short */
PS_DICT_FORCE_BOLD, /* FT_Bool */
PS_DICT_RND_STEM_UP, /* FT_Bool */
PS_DICT_MIN_FEATURE, /* FT_Short */
PS_DICT_LEN_IV, /* FT_Int */
PS_DICT_PASSWORD, /* FT_Long */
PS_DICT_LANGUAGE_GROUP, /* FT_Long */
/* conventionally in the font FontInfo dictionary */
PS_DICT_VERSION, /* FT_String* */
PS_DICT_NOTICE, /* FT_String* */
PS_DICT_FULL_NAME, /* FT_String* */
PS_DICT_FAMILY_NAME, /* FT_String* */
PS_DICT_WEIGHT, /* FT_String* */
PS_DICT_IS_FIXED_PITCH, /* FT_Bool */
PS_DICT_UNDERLINE_POSITION, /* FT_Short */
PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */
PS_DICT_FS_TYPE, /* FT_UShort */
PS_DICT_ITALIC_ANGLE, /* FT_Long */
PS_DICT_MAX = PS_DICT_ITALIC_ANGLE
} PS_Dict_Keys;
/************************************************************************
*
* @function:
* FT_Get_PS_Font_Value
*
* @description:
* Retrieve the value for the supplied key from a PostScript font.
*
* @input:
* face ::
* PostScript face handle.
*
* key ::
* An enumeration value representing the dictionary key to retrieve.
*
* idx ::
* For array values, this specifies the index to be returned.
*
* value ::
* A pointer to memory into which to write the value.
*
* valen_len ::
* The size, in bytes, of the memory supplied for the value.
*
* @output:
* value ::
* The value matching the above key, if it exists.
*
* @return:
* The amount of memory (in bytes) required to hold the requested
* value (if it exists, -1 otherwise).
*
* @note:
* The values returned are not pointers into the internal structures of
* the face, but are `fresh' copies, so that the memory containing them
* belongs to the calling application. This also enforces the
* `read-only' nature of these values, i.e., this function cannot be
* used to manipulate the face.
*
* `value' is a void pointer because the values returned can be of
* various types.
*
* If either `value' is NULL or `value_len' is too small, just the
* required memory size for the requested entry is returned.
*
* The `idx' parameter is used, not only to retrieve elements of, for
* example, the FontMatrix or FontBBox, but also to retrieve name keys
* from the CharStrings dictionary, and the charstrings themselves. It
* is ignored for atomic values.
*
* PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000. To
* get the value as in the font stream, you need to divide by
* 65536000.0 (to remove the FT_Fixed scale, and the x1000 scale).
*
* IMPORTANT: Only key/value pairs read by the FreeType interpreter can
* be retrieved. So, for example, PostScript procedures such as NP,
* ND, and RD are not available. Arbitrary keys are, obviously, not be
* available either.
*
* If the font's format is not PostScript-based, this function returns
* the `FT_Err_Invalid_Argument' error code.
*
* @since:
* 2.4.8
*
*/
FT_EXPORT( FT_Long )
FT_Get_PS_Font_Value( FT_Face face,
PS_Dict_Keys key,
FT_UInt idx,
void *value,
FT_Long value_len );
/* */
FT_END_HEADER
#endif /* T1TABLES_H_ */
/* END */
/***************************************************************************/
/* */
/* ftsynth.h */
/* */
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/********* *********/
/********* WARNING, THIS IS ALPHA CODE! THIS API *********/
/********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/
/********* FREETYPE DEVELOPMENT TEAM *********/
/********* *********/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* Main reason for not lifting the functions in this module to a */
/* `standard' API is that the used parameters for emboldening and */
/* slanting are not configurable. Consider the functions as a */
/* code resource that should be copied into the application and */
/* adapted to the particular needs. */
#ifndef FTSYNTH_H_
#define FTSYNTH_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/* Embolden a glyph by a `reasonable' value (which is highly a matter of */
/* taste). This function is actually a convenience function, providing */
/* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */
/* */
/* For emboldened outlines the height, width, and advance metrics are */
/* increased by the strength of the emboldening -- this even affects */
/* mono-width fonts! */
/* */
/* You can also call @FT_Outline_Get_CBox to get precise values. */
FT_EXPORT( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot );
/* Slant an outline glyph to the right by about 12 degrees. */
FT_EXPORT( void )
FT_GlyphSlot_Oblique( FT_GlyphSlot slot );
/* */
FT_END_HEADER
#endif /* FTSYNTH_H_ */
/* END */
/***************************************************************************/
/* */
/* ftmm.h */
/* */
/* FreeType Multiple Master font interface (specification). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTMM_H_
#define FTMM_H_
#include <ft2build.h>
#include FT_TYPE1_TABLES_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* multiple_masters */
/* */
/* <Title> */
/* Multiple Masters */
/* */
/* <Abstract> */
/* How to manage Multiple Masters fonts. */
/* */
/* <Description> */
/* The following types and functions are used to manage Multiple */
/* Master fonts, i.e., the selection of specific design instances by */
/* setting design axis coordinates. */
/* */
/* Besides Adobe MM fonts, the interface supports Apple's TrueType GX */
/* and OpenType variation fonts. Some of the routines only work with */
/* Adobe MM fonts, others will work with all three types. They are */
/* similar enough that a consistent interface makes sense. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_MM_Axis */
/* */
/* <Description> */
/* A structure to model a given axis in design space for Multiple */
/* Masters fonts. */
/* */
/* This structure can't be used for TrueType GX or OpenType variation */
/* fonts. */
/* */
/* <Fields> */
/* name :: The axis's name. */
/* */
/* minimum :: The axis's minimum design coordinate. */
/* */
/* maximum :: The axis's maximum design coordinate. */
/* */
typedef struct FT_MM_Axis_
{
FT_String* name;
FT_Long minimum;
FT_Long maximum;
} FT_MM_Axis;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Multi_Master */
/* */
/* <Description> */
/* A structure to model the axes and space of a Multiple Masters */
/* font. */
/* */
/* This structure can't be used for TrueType GX or OpenType variation */
/* fonts. */
/* */
/* <Fields> */
/* num_axis :: Number of axes. Cannot exceed~4. */
/* */
/* num_designs :: Number of designs; should be normally 2^num_axis */
/* even though the Type~1 specification strangely */
/* allows for intermediate designs to be present. */
/* This number cannot exceed~16. */
/* */
/* axis :: A table of axis descriptors. */
/* */
typedef struct FT_Multi_Master_
{
FT_UInt num_axis;
FT_UInt num_designs;
FT_MM_Axis axis[T1_MAX_MM_AXIS];
} FT_Multi_Master;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Var_Axis */
/* */
/* <Description> */
/* A structure to model a given axis in design space for Multiple */
/* Masters, TrueType GX, and OpenType variation fonts. */
/* */
/* <Fields> */
/* name :: The axis's name. */
/* Not always meaningful for TrueType GX or OpenType */
/* variation fonts. */
/* */
/* minimum :: The axis's minimum design coordinate. */
/* */
/* def :: The axis's default design coordinate. */
/* FreeType computes meaningful default values for Adobe */
/* MM fonts. */
/* */
/* maximum :: The axis's maximum design coordinate. */
/* */
/* tag :: The axis's tag (the equivalent to `name' for TrueType */
/* GX and OpenType variation fonts). FreeType provides */
/* default values for Adobe MM fonts if possible. */
/* */
/* strid :: The axis name entry in the font's `name' table. This */
/* is another (and often better) version of the `name' */
/* field for TrueType GX or OpenType variation fonts. Not */
/* meaningful for Adobe MM fonts. */
/* */
/* <Note> */
/* The fields `minimum', `def', and `maximum' are 16.16 fractional */
/* values for TrueType GX and OpenType variation fonts. For Adobe MM */
/* fonts, the values are integers. */
/* */
typedef struct FT_Var_Axis_
{
FT_String* name;
FT_Fixed minimum;
FT_Fixed def;
FT_Fixed maximum;
FT_ULong tag;
FT_UInt strid;
} FT_Var_Axis;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Var_Named_Style */
/* */
/* <Description> */
/* A structure to model a named instance in a TrueType GX or OpenType */
/* variation font. */
/* */
/* This structure can't be used for Adobe MM fonts. */
/* */
/* <Fields> */
/* coords :: The design coordinates for this instance. */
/* This is an array with one entry for each axis. */
/* */
/* strid :: The entry in `name' table identifying this instance. */
/* */
/* psid :: The entry in `name' table identifying a PostScript name */
/* for this instance. Value 0xFFFF indicates a missing */
/* entry. */
/* */
typedef struct FT_Var_Named_Style_
{
FT_Fixed* coords;
FT_UInt strid;
FT_UInt psid; /* since 2.7.1 */
} FT_Var_Named_Style;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_MM_Var */
/* */
/* <Description> */
/* A structure to model the axes and space of an Adobe MM, TrueType */
/* GX, or OpenType variation font. */
/* */
/* Some fields are specific to one format and not to the others. */
/* */
/* <Fields> */
/* num_axis :: The number of axes. The maximum value is~4 for */
/* Adobe MM fonts; no limit in TrueType GX or */
/* OpenType variation fonts. */
/* */
/* num_designs :: The number of designs; should be normally */
/* 2^num_axis for Adobe MM fonts. Not meaningful */
/* for TrueType GX or OpenType variation fonts */
/* (where every glyph could have a different */
/* number of designs). */
/* */
/* num_namedstyles :: The number of named styles; a `named style' is */
/* a tuple of design coordinates that has a string */
/* ID (in the `name' table) associated with it. */
/* The font can tell the user that, for example, */
/* [Weight=1.5,Width=1.1] is `Bold'. Another name */
/* for `named style' is `named instance'. */
/* */
/* For Adobe Multiple Masters fonts, this value is */
/* always zero because the format does not support */
/* named styles. */
/* */
/* axis :: An axis descriptor table. */
/* TrueType GX and OpenType variation fonts */
/* contain slightly more data than Adobe MM fonts. */
/* Memory management of this pointer is done */
/* internally by FreeType. */
/* */
/* namedstyle :: A named style (instance) table. */
/* Only meaningful for TrueType GX and OpenType */
/* variation fonts. Memory management of this */
/* pointer is done internally by FreeType. */
/* */
typedef struct FT_MM_Var_
{
FT_UInt num_axis;
FT_UInt num_designs;
FT_UInt num_namedstyles;
FT_Var_Axis* axis;
FT_Var_Named_Style* namedstyle;
} FT_MM_Var;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Multi_Master */
/* */
/* <Description> */
/* Retrieve a variation descriptor of a given Adobe MM font. */
/* */
/* This function can't be used with TrueType GX or OpenType variation */
/* fonts. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* <Output> */
/* amaster :: The Multiple Masters descriptor. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Multi_Master( FT_Face face,
FT_Multi_Master *amaster );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_MM_Var */
/* */
/* <Description> */
/* Retrieve a variation descriptor for a given font. */
/* */
/* This function works with all supported variation formats. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* <Output> */
/* amaster :: The variation descriptor. */
/* Allocates a data structure, which the user must */
/* deallocate with a call to @FT_Done_MM_Var after use. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_MM_Var( FT_Face face,
FT_MM_Var* *amaster );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_MM_Var */
/* */
/* <Description> */
/* Free the memory allocated by @FT_Get_MM_Var. */
/* */
/* <Input> */
/* library :: A handle of the face's parent library object that was */
/* used in the call to @FT_Get_MM_Var to create `amaster'. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_MM_Var( FT_Library library,
FT_MM_Var *amaster );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_MM_Design_Coordinates */
/* */
/* <Description> */
/* For Adobe MM fonts, choose an interpolated font design through */
/* design coordinates. */
/* */
/* This function can't be used with TrueType GX or OpenType variation */
/* fonts. */
/* */
/* <InOut> */
/* face :: A handle to the source face. */
/* */
/* <Input> */
/* num_coords :: The number of available design coordinates. If it */
/* is larger than the number of axes, ignore the excess */
/* values. If it is smaller than the number of axes, */
/* use default values for the remaining axes. */
/* */
/* coords :: An array of design coordinates. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* [Since 2.8.1] To reset all axes to the default values, call the */
/* function with `num_coords' set to zero and `coords' set to NULL. */
/* */
/* [Since 2.9] If `num_coords' is larger than zero, this function */
/* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */
/* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */
/* is zero, this bit flag gets unset. */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Var_Design_Coordinates */
/* */
/* <Description> */
/* Choose an interpolated font design through design coordinates. */
/* */
/* This function works with all supported variation formats. */
/* */
/* <InOut> */
/* face :: A handle to the source face. */
/* */
/* <Input> */
/* num_coords :: The number of available design coordinates. If it */
/* is larger than the number of axes, ignore the excess */
/* values. If it is smaller than the number of axes, */
/* use default values for the remaining axes. */
/* */
/* coords :: An array of design coordinates. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* [Since 2.8.1] To reset all axes to the default values, call the */
/* function with `num_coords' set to zero and `coords' set to NULL. */
/* [Since 2.9] `Default values' means the currently selected named */
/* instance (or the base font if no named instance is selected). */
/* */
/* [Since 2.9] If `num_coords' is larger than zero, this function */
/* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */
/* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */
/* is zero, this bit flag gets unset. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Var_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Var_Design_Coordinates */
/* */
/* <Description> */
/* Get the design coordinates of the currently selected interpolated */
/* font. */
/* */
/* This function works with all supported variation formats. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* num_coords :: The number of design coordinates to retrieve. If it */
/* is larger than the number of axes, set the excess */
/* values to~0. */
/* */
/* <Output> */
/* coords :: The design coordinates array. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.7.1 */
/* */
FT_EXPORT( FT_Error )
FT_Get_Var_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_MM_Blend_Coordinates */
/* */
/* <Description> */
/* Choose an interpolated font design through normalized blend */
/* coordinates. */
/* */
/* This function works with all supported variation formats. */
/* */
/* <InOut> */
/* face :: A handle to the source face. */
/* */
/* <Input> */
/* num_coords :: The number of available design coordinates. If it */
/* is larger than the number of axes, ignore the excess */
/* values. If it is smaller than the number of axes, */
/* use default values for the remaining axes. */
/* */
/* coords :: The design coordinates array (each element must be */
/* between 0 and 1.0 for Adobe MM fonts, and between */
/* -1.0 and 1.0 for TrueType GX and OpenType variation */
/* fonts). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* [Since 2.8.1] To reset all axes to the default values, call the */
/* function with `num_coords' set to zero and `coords' set to NULL. */
/* [Since 2.9] `Default values' means the currently selected named */
/* instance (or the base font if no named instance is selected). */
/* */
/* [Since 2.9] If `num_coords' is larger than zero, this function */
/* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */
/* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */
/* is zero, this bit flag gets unset. */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_MM_Blend_Coordinates */
/* */
/* <Description> */
/* Get the normalized blend coordinates of the currently selected */
/* interpolated font. */
/* */
/* This function works with all supported variation formats. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* num_coords :: The number of normalized blend coordinates to */
/* retrieve. If it is larger than the number of axes, */
/* set the excess values to~0.5 for Adobe MM fonts, and */
/* to~0 for TrueType GX and OpenType variation fonts. */
/* */
/* <Output> */
/* coords :: The normalized blend coordinates array. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.7.1 */
/* */
FT_EXPORT( FT_Error )
FT_Get_MM_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Var_Blend_Coordinates */
/* */
/* <Description> */
/* This is another name of @FT_Set_MM_Blend_Coordinates. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Var_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Var_Blend_Coordinates */
/* */
/* <Description> */
/* This is another name of @FT_Get_MM_Blend_Coordinates. */
/* */
/* <Since> */
/* 2.7.1 */
/* */
FT_EXPORT( FT_Error )
FT_Get_Var_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_VAR_AXIS_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flags used in the return value of */
/* @FT_Get_Var_Axis_Flags. */
/* */
/* <Values> */
/* FT_VAR_AXIS_FLAG_HIDDEN :: */
/* The variation axis should not be exposed to user interfaces. */
/* */
/* <Since> */
/* 2.8.1 */
/* */
#define FT_VAR_AXIS_FLAG_HIDDEN 1
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Var_Axis_Flags */
/* */
/* <Description> */
/* Get the `flags' field of an OpenType Variation Axis Record. */
/* */
/* Not meaningful for Adobe MM fonts (`*flags' is always zero). */
/* */
/* <Input> */
/* master :: The variation descriptor. */
/* */
/* axis_index :: The index of the requested variation axis. */
/* */
/* <Output> */
/* flags :: The `flags' field. See @FT_VAR_AXIS_FLAG_XXX for */
/* possible values. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.8.1 */
/* */
FT_EXPORT( FT_Error )
FT_Get_Var_Axis_Flags( FT_MM_Var* master,
FT_UInt axis_index,
FT_UInt* flags );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Named_Instance */
/* */
/* <Description> */
/* Set or change the current named instance. */
/* */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* instance_index :: The index of the requested instance, starting */
/* with value 1. If set to value 0, FreeType */
/* switches to font access without a named */
/* instance. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The function uses the value of `instance_index' to set bits 16-30 */
/* of the face's `face_index' field. It also resets any variation */
/* applied to the font, and the @FT_FACE_FLAG_VARIATION bit of the */
/* face's `face_flags' field gets reset to zero (i.e., */
/* @FT_IS_VARIATION will return false). */
/* */
/* For Adobe MM fonts (which don't have named instances) this */
/* function simply resets the current face to the default instance. */
/* */
/* <Since> */
/* 2.9 */
/* */
FT_EXPORT( FT_Error )
FT_Set_Named_Instance( FT_Face face,
FT_UInt instance_index );
/* */
FT_END_HEADER
#endif /* FTMM_H_ */
/* END */
/***************************************************************************/
/* */
/* fttrigon.h */
/* */
/* FreeType trigonometric functions (specification). */
/* */
/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTTRIGON_H_
#define FTTRIGON_H_
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* computations */
/* */
/*************************************************************************/
/*************************************************************************
*
* @type:
* FT_Angle
*
* @description:
* This type is used to model angle values in FreeType. Note that the
* angle is a 16.16 fixed-point value expressed in degrees.
*
*/
typedef FT_Fixed FT_Angle;
/*************************************************************************
*
* @macro:
* FT_ANGLE_PI
*
* @description:
* The angle pi expressed in @FT_Angle units.
*
*/
#define FT_ANGLE_PI ( 180L << 16 )
/*************************************************************************
*
* @macro:
* FT_ANGLE_2PI
*
* @description:
* The angle 2*pi expressed in @FT_Angle units.
*
*/
#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 )
/*************************************************************************
*
* @macro:
* FT_ANGLE_PI2
*
* @description:
* The angle pi/2 expressed in @FT_Angle units.
*
*/
#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 )
/*************************************************************************
*
* @macro:
* FT_ANGLE_PI4
*
* @description:
* The angle pi/4 expressed in @FT_Angle units.
*
*/
#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 )
/*************************************************************************
*
* @function:
* FT_Sin
*
* @description:
* Return the sinus of a given angle in fixed-point format.
*
* @input:
* angle ::
* The input angle.
*
* @return:
* The sinus value.
*
* @note:
* If you need both the sinus and cosinus for a given angle, use the
* function @FT_Vector_Unit.
*
*/
FT_EXPORT( FT_Fixed )
FT_Sin( FT_Angle angle );
/*************************************************************************
*
* @function:
* FT_Cos
*
* @description:
* Return the cosinus of a given angle in fixed-point format.
*
* @input:
* angle ::
* The input angle.
*
* @return:
* The cosinus value.
*
* @note:
* If you need both the sinus and cosinus for a given angle, use the
* function @FT_Vector_Unit.
*
*/
FT_EXPORT( FT_Fixed )
FT_Cos( FT_Angle angle );
/*************************************************************************
*
* @function:
* FT_Tan
*
* @description:
* Return the tangent of a given angle in fixed-point format.
*
* @input:
* angle ::
* The input angle.
*
* @return:
* The tangent value.
*
*/
FT_EXPORT( FT_Fixed )
FT_Tan( FT_Angle angle );
/*************************************************************************
*
* @function:
* FT_Atan2
*
* @description:
* Return the arc-tangent corresponding to a given vector (x,y) in
* the 2d plane.
*
* @input:
* x ::
* The horizontal vector coordinate.
*
* y ::
* The vertical vector coordinate.
*
* @return:
* The arc-tangent value (i.e. angle).
*
*/
FT_EXPORT( FT_Angle )
FT_Atan2( FT_Fixed x,
FT_Fixed y );
/*************************************************************************
*
* @function:
* FT_Angle_Diff
*
* @description:
* Return the difference between two angles. The result is always
* constrained to the ]-PI..PI] interval.
*
* @input:
* angle1 ::
* First angle.
*
* angle2 ::
* Second angle.
*
* @return:
* Constrained value of `value2-value1'.
*
*/
FT_EXPORT( FT_Angle )
FT_Angle_Diff( FT_Angle angle1,
FT_Angle angle2 );
/*************************************************************************
*
* @function:
* FT_Vector_Unit
*
* @description:
* Return the unit vector corresponding to a given angle. After the
* call, the value of `vec.x' will be `cos(angle)', and the value of
* `vec.y' will be `sin(angle)'.
*
* This function is useful to retrieve both the sinus and cosinus of a
* given angle quickly.
*
* @output:
* vec ::
* The address of target vector.
*
* @input:
* angle ::
* The input angle.
*
*/
FT_EXPORT( void )
FT_Vector_Unit( FT_Vector* vec,
FT_Angle angle );
/*************************************************************************
*
* @function:
* FT_Vector_Rotate
*
* @description:
* Rotate a vector by a given angle.
*
* @inout:
* vec ::
* The address of target vector.
*
* @input:
* angle ::
* The input angle.
*
*/
FT_EXPORT( void )
FT_Vector_Rotate( FT_Vector* vec,
FT_Angle angle );
/*************************************************************************
*
* @function:
* FT_Vector_Length
*
* @description:
* Return the length of a given vector.
*
* @input:
* vec ::
* The address of target vector.
*
* @return:
* The vector length, expressed in the same units that the original
* vector coordinates.
*
*/
FT_EXPORT( FT_Fixed )
FT_Vector_Length( FT_Vector* vec );
/*************************************************************************
*
* @function:
* FT_Vector_Polarize
*
* @description:
* Compute both the length and angle of a given vector.
*
* @input:
* vec ::
* The address of source vector.
*
* @output:
* length ::
* The vector length.
*
* angle ::
* The vector angle.
*
*/
FT_EXPORT( void )
FT_Vector_Polarize( FT_Vector* vec,
FT_Fixed *length,
FT_Angle *angle );
/*************************************************************************
*
* @function:
* FT_Vector_From_Polar
*
* @description:
* Compute vector coordinates from a length and angle.
*
* @output:
* vec ::
* The address of source vector.
*
* @input:
* length ::
* The vector length.
*
* angle ::
* The vector angle.
*
*/
FT_EXPORT( void )
FT_Vector_From_Polar( FT_Vector* vec,
FT_Fixed length,
FT_Angle angle );
/* */
FT_END_HEADER
#endif /* FTTRIGON_H_ */
/* END */
/***************************************************************************/
/* */
/* fterrdef.h */
/* */
/* FreeType error codes (specification). */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* error_code_values */
/* */
/* <Title> */
/* Error Code Values */
/* */
/* <Abstract> */
/* All possible error codes returned by FreeType functions. */
/* */
/* <Description> */
/* The list below is taken verbatim from the file `fterrdef.h' */
/* (loaded automatically by including `FT_FREETYPE_H'). The first */
/* argument of the `FT_ERROR_DEF_' macro is the error label; by */
/* default, the prefix `FT_Err_' gets added so that you get error */
/* names like `FT_Err_Cannot_Open_Resource'. The second argument is */
/* the error code, and the last argument an error string, which is not */
/* used by FreeType. */
/* */
/* Within your application you should *only* use error names and */
/* *never* its numeric values! The latter might (and actually do) */
/* change in forthcoming FreeType versions. */
/* */
/* Macro `FT_NOERRORDEF_' defines `FT_Err_Ok', which is always zero. */
/* See the `Error Enumerations' subsection how to automatically */
/* generate a list of error strings. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Err_XXX */
/* */
/*************************************************************************/
/* generic errors */
FT_NOERRORDEF_( Ok, 0x00,
"no error" )
FT_ERRORDEF_( Cannot_Open_Resource, 0x01,
"cannot open resource" )
FT_ERRORDEF_( Unknown_File_Format, 0x02,
"unknown file format" )
FT_ERRORDEF_( Invalid_File_Format, 0x03,
"broken file" )
FT_ERRORDEF_( Invalid_Version, 0x04,
"invalid FreeType version" )
FT_ERRORDEF_( Lower_Module_Version, 0x05,
"module version is too low" )
FT_ERRORDEF_( Invalid_Argument, 0x06,
"invalid argument" )
FT_ERRORDEF_( Unimplemented_Feature, 0x07,
"unimplemented feature" )
FT_ERRORDEF_( Invalid_Table, 0x08,
"broken table" )
FT_ERRORDEF_( Invalid_Offset, 0x09,
"broken offset within table" )
FT_ERRORDEF_( Array_Too_Large, 0x0A,
"array allocation size too large" )
FT_ERRORDEF_( Missing_Module, 0x0B,
"missing module" )
FT_ERRORDEF_( Missing_Property, 0x0C,
"missing property" )
/* glyph/character errors */
FT_ERRORDEF_( Invalid_Glyph_Index, 0x10,
"invalid glyph index" )
FT_ERRORDEF_( Invalid_Character_Code, 0x11,
"invalid character code" )
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12,
"unsupported glyph image format" )
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13,
"cannot render this glyph format" )
FT_ERRORDEF_( Invalid_Outline, 0x14,
"invalid outline" )
FT_ERRORDEF_( Invalid_Composite, 0x15,
"invalid composite glyph" )
FT_ERRORDEF_( Too_Many_Hints, 0x16,
"too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17,
"invalid pixel size" )
/* handle errors */
FT_ERRORDEF_( Invalid_Handle, 0x20,
"invalid object handle" )
FT_ERRORDEF_( Invalid_Library_Handle, 0x21,
"invalid library handle" )
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22,
"invalid module handle" )
FT_ERRORDEF_( Invalid_Face_Handle, 0x23,
"invalid face handle" )
FT_ERRORDEF_( Invalid_Size_Handle, 0x24,
"invalid size handle" )
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25,
"invalid glyph slot handle" )
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26,
"invalid charmap handle" )
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27,
"invalid cache manager handle" )
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28,
"invalid stream handle" )
/* driver errors */
FT_ERRORDEF_( Too_Many_Drivers, 0x30,
"too many modules" )
FT_ERRORDEF_( Too_Many_Extensions, 0x31,
"too many extensions" )
/* memory errors */
FT_ERRORDEF_( Out_Of_Memory, 0x40,
"out of memory" )
FT_ERRORDEF_( Unlisted_Object, 0x41,
"unlisted object" )
/* stream errors */
FT_ERRORDEF_( Cannot_Open_Stream, 0x51,
"cannot open stream" )
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52,
"invalid stream seek" )
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53,
"invalid stream skip" )
FT_ERRORDEF_( Invalid_Stream_Read, 0x54,
"invalid stream read" )
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55,
"invalid stream operation" )
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56,
"invalid frame operation" )
FT_ERRORDEF_( Nested_Frame_Access, 0x57,
"nested frame access" )
FT_ERRORDEF_( Invalid_Frame_Read, 0x58,
"invalid frame read" )
/* raster errors */
FT_ERRORDEF_( Raster_Uninitialized, 0x60,
"raster uninitialized" )
FT_ERRORDEF_( Raster_Corrupted, 0x61,
"raster corrupted" )
FT_ERRORDEF_( Raster_Overflow, 0x62,
"raster overflow" )
FT_ERRORDEF_( Raster_Negative_Height, 0x63,
"negative height while rastering" )
/* cache errors */
FT_ERRORDEF_( Too_Many_Caches, 0x70,
"too many registered caches" )
/* TrueType and SFNT errors */
FT_ERRORDEF_( Invalid_Opcode, 0x80,
"invalid opcode" )
FT_ERRORDEF_( Too_Few_Arguments, 0x81,
"too few arguments" )
FT_ERRORDEF_( Stack_Overflow, 0x82,
"stack overflow" )
FT_ERRORDEF_( Code_Overflow, 0x83,
"code overflow" )
FT_ERRORDEF_( Bad_Argument, 0x84,
"bad argument" )
FT_ERRORDEF_( Divide_By_Zero, 0x85,
"division by zero" )
FT_ERRORDEF_( Invalid_Reference, 0x86,
"invalid reference" )
FT_ERRORDEF_( Debug_OpCode, 0x87,
"found debug opcode" )
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88,
"found ENDF opcode in execution stream" )
FT_ERRORDEF_( Nested_DEFS, 0x89,
"nested DEFS" )
FT_ERRORDEF_( Invalid_CodeRange, 0x8A,
"invalid code range" )
FT_ERRORDEF_( Execution_Too_Long, 0x8B,
"execution context too long" )
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C,
"too many function definitions" )
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D,
"too many instruction definitions" )
FT_ERRORDEF_( Table_Missing, 0x8E,
"SFNT font table missing" )
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F,
"horizontal header (hhea) table missing" )
FT_ERRORDEF_( Locations_Missing, 0x90,
"locations (loca) table missing" )
FT_ERRORDEF_( Name_Table_Missing, 0x91,
"name table missing" )
FT_ERRORDEF_( CMap_Table_Missing, 0x92,
"character map (cmap) table missing" )
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93,
"horizontal metrics (hmtx) table missing" )
FT_ERRORDEF_( Post_Table_Missing, 0x94,
"PostScript (post) table missing" )
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95,
"invalid horizontal metrics" )
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96,
"invalid character map (cmap) format" )
FT_ERRORDEF_( Invalid_PPem, 0x97,
"invalid ppem value" )
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98,
"invalid vertical metrics" )
FT_ERRORDEF_( Could_Not_Find_Context, 0x99,
"could not find context" )
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A,
"invalid PostScript (post) table format" )
FT_ERRORDEF_( Invalid_Post_Table, 0x9B,
"invalid PostScript (post) table" )
FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C,
"found FDEF or IDEF opcode in glyf bytecode" )
FT_ERRORDEF_( Missing_Bitmap, 0x9D,
"missing bitmap in strike" )
/* CFF, CID, and Type 1 errors */
FT_ERRORDEF_( Syntax_Error, 0xA0,
"opcode syntax error" )
FT_ERRORDEF_( Stack_Underflow, 0xA1,
"argument stack underflow" )
FT_ERRORDEF_( Ignore, 0xA2,
"ignore" )
FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3,
"no Unicode glyph name found" )
FT_ERRORDEF_( Glyph_Too_Big, 0xA4,
"glyph too big for hinting" )
/* BDF errors */
FT_ERRORDEF_( Missing_Startfont_Field, 0xB0,
"`STARTFONT' field missing" )
FT_ERRORDEF_( Missing_Font_Field, 0xB1,
"`FONT' field missing" )
FT_ERRORDEF_( Missing_Size_Field, 0xB2,
"`SIZE' field missing" )
FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3,
"`FONTBOUNDINGBOX' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB4,
"`CHARS' field missing" )
FT_ERRORDEF_( Missing_Startchar_Field, 0xB5,
"`STARTCHAR' field missing" )
FT_ERRORDEF_( Missing_Encoding_Field, 0xB6,
"`ENCODING' field missing" )
FT_ERRORDEF_( Missing_Bbx_Field, 0xB7,
"`BBX' field missing" )
FT_ERRORDEF_( Bbx_Too_Big, 0xB8,
"`BBX' too big" )
FT_ERRORDEF_( Corrupted_Font_Header, 0xB9,
"Font header corrupted or missing fields" )
FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA,
"Font glyphs corrupted or missing fields" )
/* */
/* END */
/***************************************************************************/
/* */
/* ftheader.h */
/* */
/* Build macros of the FreeType 2 library. */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTHEADER_H_
#define FTHEADER_H_
/*@***********************************************************************/
/* */
/* <Macro> */
/* FT_BEGIN_HEADER */
/* */
/* <Description> */
/* This macro is used in association with @FT_END_HEADER in header */
/* files to ensure that the declarations within are properly */
/* encapsulated in an `extern "C" { .. }' block when included from a */
/* C++ compiler. */
/* */
#ifdef __cplusplus
#define FT_BEGIN_HEADER extern "C" {
#else
#define FT_BEGIN_HEADER /* nothing */
#endif
/*@***********************************************************************/
/* */
/* <Macro> */
/* FT_END_HEADER */
/* */
/* <Description> */
/* This macro is used in association with @FT_BEGIN_HEADER in header */
/* files to ensure that the declarations within are properly */
/* encapsulated in an `extern "C" { .. }' block when included from a */
/* C++ compiler. */
/* */
#ifdef __cplusplus
#define FT_END_HEADER }
#else
#define FT_END_HEADER /* nothing */
#endif
/*************************************************************************/
/* */
/* Aliases for the FreeType 2 public and configuration files. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* header_file_macros */
/* */
/* <Title> */
/* Header File Macros */
/* */
/* <Abstract> */
/* Macro definitions used to #include specific header files. */
/* */
/* <Description> */
/* The following macros are defined to the name of specific */
/* FreeType~2 header files. They can be used directly in #include */
/* statements as in: */
/* */
/* { */
/* #include FT_FREETYPE_H */
/* #include FT_MULTIPLE_MASTERS_H */
/* #include FT_GLYPH_H */
/* } */
/* */
/* There are several reasons why we are now using macros to name */
/* public header files. The first one is that such macros are not */
/* limited to the infamous 8.3~naming rule required by DOS (and */
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
/* */
/* The second reason is that it allows for more flexibility in the */
/* way FreeType~2 is installed on a given system. */
/* */
/*************************************************************************/
/* configuration files */
/*************************************************************************
*
* @macro:
* FT_CONFIG_CONFIG_H
*
* @description:
* A macro used in #include statements to name the file containing
* FreeType~2 configuration data.
*
*/
#ifndef FT_CONFIG_CONFIG_H
#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h>
#endif
/*************************************************************************
*
* @macro:
* FT_CONFIG_STANDARD_LIBRARY_H
*
* @description:
* A macro used in #include statements to name the file containing
* FreeType~2 interface to the standard C library functions.
*
*/
#ifndef FT_CONFIG_STANDARD_LIBRARY_H
#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
#endif
/*************************************************************************
*
* @macro:
* FT_CONFIG_OPTIONS_H
*
* @description:
* A macro used in #include statements to name the file containing
* FreeType~2 project-specific configuration options.
*
*/
#ifndef FT_CONFIG_OPTIONS_H
#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
#endif
/*************************************************************************
*
* @macro:
* FT_CONFIG_MODULES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list of FreeType~2 modules that are statically linked to new library
* instances in @FT_Init_FreeType.
*
*/
#ifndef FT_CONFIG_MODULES_H
#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
#endif
/* */
/* public headers */
/*************************************************************************
*
* @macro:
* FT_FREETYPE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* base FreeType~2 API.
*
*/
#define FT_FREETYPE_H <freetype/freetype.h>
/*************************************************************************
*
* @macro:
* FT_ERRORS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list of FreeType~2 error codes (and messages).
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_ERRORS_H <freetype/fterrors.h>
/*************************************************************************
*
* @macro:
* FT_MODULE_ERRORS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list of FreeType~2 module error offsets (and messages).
*
*/
#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
/*************************************************************************
*
* @macro:
* FT_SYSTEM_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 interface to low-level operations (i.e., memory management
* and stream i/o).
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_SYSTEM_H <freetype/ftsystem.h>
/*************************************************************************
*
* @macro:
* FT_IMAGE_H
*
* @description:
* A macro used in #include statements to name the file containing type
* definitions related to glyph images (i.e., bitmaps, outlines,
* scan-converter parameters).
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_IMAGE_H <freetype/ftimage.h>
/*************************************************************************
*
* @macro:
* FT_TYPES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* basic data types defined by FreeType~2.
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_TYPES_H <freetype/fttypes.h>
/*************************************************************************
*
* @macro:
* FT_LIST_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list management API of FreeType~2.
*
* (Most applications will never need to include this file.)
*
*/
#define FT_LIST_H <freetype/ftlist.h>
/*************************************************************************
*
* @macro:
* FT_OUTLINE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* scalable outline management API of FreeType~2.
*
*/
#define FT_OUTLINE_H <freetype/ftoutln.h>
/*************************************************************************
*
* @macro:
* FT_SIZES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API which manages multiple @FT_Size objects per face.
*
*/
#define FT_SIZES_H <freetype/ftsizes.h>
/*************************************************************************
*
* @macro:
* FT_MODULE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* module management API of FreeType~2.
*
*/
#define FT_MODULE_H <freetype/ftmodapi.h>
/*************************************************************************
*
* @macro:
* FT_RENDER_H
*
* @description:
* A macro used in #include statements to name the file containing the
* renderer module management API of FreeType~2.
*
*/
#define FT_RENDER_H <freetype/ftrender.h>
/*************************************************************************
*
* @macro:
* FT_DRIVER_H
*
* @description:
* A macro used in #include statements to name the file containing
* structures and macros related to the driver modules.
*
*/
#define FT_DRIVER_H <freetype/ftdriver.h>
/*************************************************************************
*
* @macro:
* FT_AUTOHINTER_H
*
* @description:
* A macro used in #include statements to name the file containing
* structures and macros related to the auto-hinting module.
*
* Deprecated since version 2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_AUTOHINTER_H FT_DRIVER_H
/*************************************************************************
*
* @macro:
* FT_CFF_DRIVER_H
*
* @description:
* A macro used in #include statements to name the file containing
* structures and macros related to the CFF driver module.
*
* Deprecated since version 2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_CFF_DRIVER_H FT_DRIVER_H
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_DRIVER_H
*
* @description:
* A macro used in #include statements to name the file containing
* structures and macros related to the TrueType driver module.
*
* Deprecated since version 2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H
/*************************************************************************
*
* @macro:
* FT_PCF_DRIVER_H
*
* @description:
* A macro used in #include statements to name the file containing
* structures and macros related to the PCF driver module.
*
* Deprecated since version 2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_PCF_DRIVER_H FT_DRIVER_H
/*************************************************************************
*
* @macro:
* FT_TYPE1_TABLES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* types and API specific to the Type~1 format.
*
*/
#define FT_TYPE1_TABLES_H <freetype/t1tables.h>
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_IDS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* enumeration values which identify name strings, languages, encodings,
* etc. This file really contains a _large_ set of constant macro
* definitions, taken from the TrueType and OpenType specifications.
*
*/
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_TABLES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* types and API specific to the TrueType (as well as OpenType) format.
*
*/
#define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_TAGS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of TrueType four-byte `tags' which identify blocks in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
#define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
/*************************************************************************
*
* @macro:
* FT_BDF_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which accesses BDF-specific strings from a
* face.
*
*/
#define FT_BDF_H <freetype/ftbdf.h>
/*************************************************************************
*
* @macro:
* FT_CID_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which access CID font information from a
* face.
*
*/
#define FT_CID_H <freetype/ftcid.h>
/*************************************************************************
*
* @macro:
* FT_GZIP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports gzip-compressed files.
*
*/
#define FT_GZIP_H <freetype/ftgzip.h>
/*************************************************************************
*
* @macro:
* FT_LZW_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports LZW-compressed files.
*
*/
#define FT_LZW_H <freetype/ftlzw.h>
/*************************************************************************
*
* @macro:
* FT_BZIP2_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports bzip2-compressed files.
*
*/
#define FT_BZIP2_H <freetype/ftbzip2.h>
/*************************************************************************
*
* @macro:
* FT_WINFONTS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports Windows FNT files.
*
*/
#define FT_WINFONTS_H <freetype/ftwinfnt.h>
/*************************************************************************
*
* @macro:
* FT_GLYPH_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional glyph management component.
*
*/
#define FT_GLYPH_H <freetype/ftglyph.h>
/*************************************************************************
*
* @macro:
* FT_BITMAP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional bitmap conversion component.
*
*/
#define FT_BITMAP_H <freetype/ftbitmap.h>
/*************************************************************************
*
* @macro:
* FT_BBOX_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional exact bounding box computation routines.
*
*/
#define FT_BBOX_H <freetype/ftbbox.h>
/*************************************************************************
*
* @macro:
* FT_CACHE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional FreeType~2 cache sub-system.
*
*/
#define FT_CACHE_H <freetype/ftcache.h>
/*************************************************************************
*
* @macro:
* FT_MAC_H
*
* @description:
* A macro used in #include statements to name the file containing the
* Macintosh-specific FreeType~2 API. The latter is used to access
* fonts embedded in resource forks.
*
* This header file must be explicitly included by client applications
* compiled on the Mac (note that the base API still works though).
*
*/
#define FT_MAC_H <freetype/ftmac.h>
/*************************************************************************
*
* @macro:
* FT_MULTIPLE_MASTERS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional multiple-masters management API of FreeType~2.
*
*/
#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
/*************************************************************************
*
* @macro:
* FT_SFNT_NAMES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional FreeType~2 API which accesses embedded `name' strings in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
#define FT_SFNT_NAMES_H <freetype/ftsnames.h>
/*************************************************************************
*
* @macro:
* FT_OPENTYPE_VALIDATE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional FreeType~2 API which validates OpenType tables (BASE, GDEF,
* GPOS, GSUB, JSTF).
*
*/
#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
/*************************************************************************
*
* @macro:
* FT_GX_VALIDATE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,
* mort, morx, bsln, just, kern, opbd, trak, prop).
*
*/
#define FT_GX_VALIDATE_H <freetype/ftgxval.h>
/*************************************************************************
*
* @macro:
* FT_PFR_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which accesses PFR-specific data.
*
*/
#define FT_PFR_H <freetype/ftpfr.h>
/*************************************************************************
*
* @macro:
* FT_STROKER_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which provides functions to stroke outline paths.
*/
#define FT_STROKER_H <freetype/ftstroke.h>
/*************************************************************************
*
* @macro:
* FT_SYNTHESIS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs artificial obliquing and emboldening.
*/
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
/*************************************************************************
*
* @macro:
* FT_FONT_FORMATS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which provides functions specific to font formats.
*/
#define FT_FONT_FORMATS_H <freetype/ftfntfmt.h>
/* deprecated */
#define FT_XFREE86_H FT_FONT_FORMATS_H
/*************************************************************************
*
* @macro:
* FT_TRIGONOMETRY_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs trigonometric computations (e.g.,
* cosines and arc tangents).
*/
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
/*************************************************************************
*
* @macro:
* FT_LCD_FILTER_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
/*************************************************************************
*
* @macro:
* FT_INCREMENTAL_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs incremental glyph loading.
*/
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
/*************************************************************************
*
* @macro:
* FT_GASP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which returns entries from the TrueType GASP table.
*/
#define FT_GASP_H <freetype/ftgasp.h>
/*************************************************************************
*
* @macro:
* FT_ADVANCES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which returns individual and ranged glyph advances.
*/
#define FT_ADVANCES_H <freetype/ftadvanc.h>
/* */
/* These header files don't need to be included by the user. */
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_PARAMETER_TAGS_H <freetype/ftparams.h>
/* Deprecated macros. */
#define FT_UNPATENTED_HINTING_H <freetype/ftparams.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ftparams.h>
/* FT_CACHE_H is the only header file needed for the cache subsystem. */
#define FT_CACHE_IMAGE_H FT_CACHE_H
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
#define FT_CACHE_CHARMAP_H FT_CACHE_H
/* The internals of the cache sub-system are no longer exposed. We */
/* default to FT_CACHE_H at the moment just in case, but we know of */
/* no rogue client that uses them. */
/* */
#define FT_CACHE_MANAGER_H FT_CACHE_H
#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H
#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H
#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H
#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H
#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H
#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H
/*
* Include internal headers definitions from <internal/...>
* only when building the library.
*/
#ifdef FT2_BUILD_LIBRARY
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#include FT_INTERNAL_INTERNAL_H
#endif /* FT2_BUILD_LIBRARY */
#endif /* FTHEADER_H_ */
/* END */
#ifndef __FTCONFIG_H__MULTILIB
#define __FTCONFIG_H__MULTILIB
#include <bits/wordsize.h>
#if __WORDSIZE == 32
# include "ftconfig-32.h"
#elif __WORDSIZE == 64
# include "ftconfig-64.h"
#else
# error "unexpected value for __WORDSIZE macro"
#endif
#endif
/* This is a generated file. */
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
FT_USE_MODULE( FT_Module_Class, gxv_module_class )
FT_USE_MODULE( FT_Module_Class, otv_module_class )
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
/* EOF */
/***************************************************************************/
/* */
/* ftoption.h */
/* */
/* User-selectable configuration macros (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTOPTION_H_
#define FTOPTION_H_
#include <ft2build.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* This file contains the default configuration macro definitions for */
/* a standard build of the FreeType library. There are three ways to */
/* use this file to build project-specific versions of the library: */
/* */
/* - You can modify this file by hand, but this is not recommended in */
/* cases where you would like to build several versions of the */
/* library from a single source directory. */
/* */
/* - You can put a copy of this file in your build directory, more */
/* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */
/* is the name of a directory that is included _before_ the FreeType */
/* include path during compilation. */
/* */
/* The default FreeType Makefiles and Jamfiles use the build */
/* directory `builds/<system>' by default, but you can easily change */
/* that for your own projects. */
/* */
/* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */
/* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */
/* locate this file during the build. For example, */
/* */
/* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
/* #include <freetype/config/ftheader.h> */
/* */
/* will use `$BUILD/myftoptions.h' instead of this file for macro */
/* definitions. */
/* */
/* Note also that you can similarly pre-define the macro */
/* FT_CONFIG_MODULES_H used to locate the file listing of the modules */
/* that are statically linked to the library at compile time. By */
/* default, this file is <freetype/config/ftmodule.h>. */
/* */
/* We highly recommend using the third method whenever possible. */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*#***********************************************************************/
/* */
/* If you enable this configuration option, FreeType recognizes an */
/* environment variable called `FREETYPE_PROPERTIES', which can be used */
/* to control the various font drivers and modules. The controllable */
/* properties are listed in the section @properties. */
/* */
/* You have to undefine this configuration option on platforms that lack */
/* the concept of environment variables (and thus don't have the */
/* `getenv' function), for example Windows CE. */
/* */
/* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */
/* multiple lines for better readability). */
/* */
/* { */
/* <optional whitespace> */
/* <module-name1> ':' */
/* <property-name1> '=' <property-value1> */
/* <whitespace> */
/* <module-name2> ':' */
/* <property-name2> '=' <property-value2> */
/* ... */
/* } */
/* */
/* Example: */
/* */
/* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ */
/* cff:no-stem-darkening=1 \ */
/* autofitter:warping=1 */
/* */
#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
/*************************************************************************/
/* */
/* Uncomment the line below if you want to activate LCD rendering */
/* technology similar to ClearType in this build of the library. This */
/* technology triples the resolution in the direction color subpixels. */
/* To mitigate color fringes inherent to this technology, you also need */
/* to explicitly set up LCD filtering. */
/* */
/* Note that this feature is covered by several Microsoft patents */
/* and should not be activated in any default build of the library. */
/* When this macro is not defined, FreeType offers alternative LCD */
/* rendering technology that produces excellent output without LCD */
/* filtering. */
/* */
#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
/*************************************************************************/
/* */
/* Many compilers provide a non-ANSI 64-bit data type that can be used */
/* by FreeType to speed up some computations. However, this will create */
/* some problems when compiling the library in strict ANSI mode. */
/* */
/* For this reason, the use of 64-bit integers is normally disabled when */
/* the __STDC__ macro is defined. You can however disable this by */
/* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */
/* */
/* For most compilers, this will only create compilation warnings when */
/* building the library. */
/* */
/* ObNote: The compiler-specific 64-bit integers are detected in the */
/* file `ftconfig.h' either statically or through the */
/* `configure' script on supported platforms. */
/* */
#undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/
/* */
/* If this macro is defined, do not try to use an assembler version of */
/* performance-critical functions (e.g. FT_MulFix). You should only do */
/* that to verify that the assembler function works properly, or to */
/* execute benchmark tests of the various implementations. */
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
/*************************************************************************/
/* */
/* If this macro is defined, try to use an inlined assembler version of */
/* the `FT_MulFix' function, which is a `hotspot' when loading and */
/* hinting glyphs, and which should be executed as fast as possible. */
/* */
/* Note that if your compiler or CPU is not supported, this will default */
/* to the standard and portable implementation found in `ftcalc.c'. */
/* */
#define FT_CONFIG_OPTION_INLINE_MULFIX
/*************************************************************************/
/* */
/* LZW-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* `compress' program. This is mostly used to parse many of the PCF */
/* files that come with various X11 distributions. The implementation */
/* uses NetBSD's `zopen' to partially uncompress the file on the fly */
/* (see src/lzw/ftgzip.c). */
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
#define FT_CONFIG_OPTION_USE_LZW
/*************************************************************************/
/* */
/* Gzip-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* `gzip' program. This is mostly used to parse many of the PCF files */
/* that come with XFree86. The implementation uses `zlib' to */
/* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */
/* */
/* Define this macro if you want to enable this `feature'. See also */
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
/* */
#define FT_CONFIG_OPTION_USE_ZLIB
/*************************************************************************/
/* */
/* ZLib library selection */
/* */
/* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */
/* It allows FreeType's `ftgzip' component to link to the system's */
/* installation of the ZLib library. This is useful on systems like */
/* Unix or VMS where it generally is already available. */
/* */
/* If you let it undefined, the component will use its own copy */
/* of the zlib sources instead. These have been modified to be */
/* included directly within the component and *not* export external */
/* function names. This allows you to link any program with FreeType */
/* _and_ ZLib without linking conflicts. */
/* */
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* If you use a build system like cmake or the `configure' script, */
/* options set by those programs have precendence, overwriting the */
/* value here with the configured one. */
/* */
#define FT_CONFIG_OPTION_SYSTEM_ZLIB
/*************************************************************************/
/* */
/* Bzip2-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* `bzip2' program. This is mostly used to parse many of the PCF */
/* files that come with XFree86. The implementation uses `libbz2' to */
/* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */
/* Contrary to gzip, bzip2 currently is not included and need to use */
/* the system available bzip2 implementation. */
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
/* If you use a build system like cmake or the `configure' script, */
/* options set by those programs have precendence, overwriting the */
/* value here with the configured one. */
/* */
#define FT_CONFIG_OPTION_USE_BZIP2
/*************************************************************************/
/* */
/* Define to disable the use of file stream functions and types, FILE, */
/* fopen() etc. Enables the use of smaller system libraries on embedded */
/* systems that have multiple system libraries, some with or without */
/* file stream support, in the cases where file stream support is not */
/* necessary such as memory loading of font files. */
/* */
/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
/*************************************************************************/
/* */
/* PNG bitmap support. */
/* */
/* FreeType now handles loading color bitmap glyphs in the PNG format. */
/* This requires help from the external libpng library. Uncompressed */
/* color bitmaps do not need any external libraries and will be */
/* supported regardless of this configuration. */
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
/* If you use a build system like cmake or the `configure' script, */
/* options set by those programs have precendence, overwriting the */
/* value here with the configured one. */
/* */
#define FT_CONFIG_OPTION_USE_PNG
/*************************************************************************/
/* */
/* HarfBuzz support. */
/* */
/* FreeType uses the HarfBuzz library to improve auto-hinting of */
/* OpenType fonts. If available, many glyphs not directly addressable */
/* by a font's character map will be hinted also. */
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
/* If you use a build system like cmake or the `configure' script, */
/* options set by those programs have precendence, overwriting the */
/* value here with the configured one. */
/* */
/* #undef FT_CONFIG_OPTION_USE_HARFBUZZ */
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
/* By default, FreeType 2 is compiled with the `psnames' module. This */
/* module is in charge of converting a glyph name string into a */
/* Unicode value, or return a Macintosh standard glyph name for the */
/* use with the TrueType `post' table. */
/* */
/* Undefine this macro if you do not want `psnames' compiled in your */
/* build of FreeType. This has the following effects: */
/* */
/* - The TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* `post' table, but will not synthesize a missing Unicode charmap. */
/* */
/* - The Type 1 driver will not be able to synthesize a Unicode */
/* charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when building */
/* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
/* */
/* By default, FreeType 2 is built with the `PSNames' module compiled */
/* in. Among other things, the module is used to convert a glyph name */
/* into a Unicode value. This is especially useful in order to */
/* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */
/* through a big table named the `Adobe Glyph List' (AGL). */
/* */
/* Undefine this macro if you do not want the Adobe Glyph List */
/* compiled in your `PSNames' module. The Type 1 driver will not be */
/* able to synthesize a Unicode charmap out of the glyphs found in the */
/* fonts. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* Support for Mac fonts */
/* */
/* Define this macro if you want support for outline fonts in Mac */
/* format (mac dfont, mac resource, macbinary containing a mac */
/* resource) on non-Mac platforms. */
/* */
/* Note that the `FOND' resource isn't checked. */
/* */
#define FT_CONFIG_OPTION_MAC_FONTS
/*************************************************************************/
/* */
/* Guessing methods to access embedded resource forks */
/* */
/* Enable extra Mac fonts support on non-Mac platforms (e.g. */
/* GNU/Linux). */
/* */
/* Resource forks which include fonts data are stored sometimes in */
/* locations which users or developers don't expected. In some cases, */
/* resource forks start with some offset from the head of a file. In */
/* other cases, the actual resource fork is stored in file different */
/* from what the user specifies. If this option is activated, */
/* FreeType tries to guess whether such offsets or different file */
/* names must be used. */
/* */
/* Note that normal, direct access of resource forks is controlled via */
/* the FT_CONFIG_OPTION_MAC_FONTS option. */
/* */
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#endif
/*************************************************************************/
/* */
/* Allow the use of FT_Incremental_Interface to load typefaces that */
/* contain no glyph data, but supply it via a callback function. */
/* This is required by clients supporting document formats which */
/* supply font data incrementally as the document is parsed, such */
/* as the Ghostscript interpreter for the PostScript language. */
/* */
#define FT_CONFIG_OPTION_INCREMENTAL
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line converter */
/* to do all of its work. */
/* */
#define FT_RENDER_POOL_SIZE 16384L
/*************************************************************************/
/* */
/* FT_MAX_MODULES */
/* */
/* The maximum number of modules that can be registered in a single */
/* FreeType library object. 32 is the default. */
/* */
#define FT_MAX_MODULES 32
/*************************************************************************/
/* */
/* Debug level */
/* */
/* FreeType can be compiled in debug or trace mode. In debug mode, */
/* errors are reported through the `ftdebug' component. In trace */
/* mode, additional messages are sent to the standard output during */
/* execution. */
/* */
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
/* */
/* Don't define any of these macros to compile in `release' mode! */
/* */
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
/* #define FT_DEBUG_LEVEL_ERROR */
/* #define FT_DEBUG_LEVEL_TRACE */
/*************************************************************************/
/* */
/* Autofitter debugging */
/* */
/* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */
/* control the autofitter behaviour for debugging purposes with global */
/* boolean variables (consequently, you should *never* enable this */
/* while compiling in `release' mode): */
/* */
/* _af_debug_disable_horz_hints */
/* _af_debug_disable_vert_hints */
/* _af_debug_disable_blue_hints */
/* */
/* Additionally, the following functions provide dumps of various */
/* internal autofit structures to stdout (using `printf'): */
/* */
/* af_glyph_hints_dump_points */
/* af_glyph_hints_dump_segments */
/* af_glyph_hints_dump_edges */
/* af_glyph_hints_get_num_segments */
/* af_glyph_hints_get_segment_offset */
/* */
/* As an argument, they use another global variable: */
/* */
/* _af_debug_hints */
/* */
/* Please have a look at the `ftgrid' demo program to see how those */
/* variables and macros should be used. */
/* */
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
/* #define FT_DEBUG_AUTOFIT */
/*************************************************************************/
/* */
/* Memory Debugging */
/* */
/* FreeType now comes with an integrated memory debugger that is */
/* capable of detecting simple errors like memory leaks or double */
/* deletes. To compile it within your build of the library, you */
/* should define FT_DEBUG_MEMORY here. */
/* */
/* Note that the memory debugger is only activated at runtime when */
/* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */
/* */
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* #define FT_DEBUG_MEMORY */
/*************************************************************************/
/* */
/* Module errors */
/* */
/* If this macro is set (which is _not_ the default), the higher byte */
/* of an error code gives the module in which the error has occurred, */
/* while the lower byte is the real error code. */
/* */
/* Setting this macro makes sense for debugging purposes only, since */
/* it would break source compatibility of certain programs that use */
/* FreeType 2. */
/* */
/* More details can be found in the files ftmoderr.h and fterrors.h. */
/* */
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
/*************************************************************************/
/* */
/* Position Independent Code */
/* */
/* If this macro is set (which is _not_ the default), FreeType2 will */
/* avoid creating constants that require address fixups. Instead the */
/* constants will be moved into a struct and additional intialization */
/* code will be used. */
/* */
/* Setting this macro is needed for systems that prohibit address */
/* fixups, such as BREW. [Note that standard compilers like gcc or */
/* clang handle PIC generation automatically; you don't have to set */
/* FT_CONFIG_OPTION_PIC, which is only necessary for very special */
/* compilers.] */
/* */
/* Note that FT_CONFIG_OPTION_PIC support is not available for all */
/* modules (see `modules.cfg' for a complete list). For building with */
/* FT_CONFIG_OPTION_PIC support, do the following. */
/* */
/* 0. Clone the repository. */
/* 1. Define FT_CONFIG_OPTION_PIC. */
/* 2. Remove all subdirectories in `src' that don't have */
/* FT_CONFIG_OPTION_PIC support. */
/* 3. Comment out the corresponding modules in `modules.cfg'. */
/* 4. Compile. */
/* */
/* #define FT_CONFIG_OPTION_PIC */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** S F N T D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
/* embedded bitmaps in all formats using the SFNT module (namely */
/* TrueType & OpenType). */
/* */
#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
/* load and enumerate the glyph Postscript names in a TrueType or */
/* OpenType file. */
/* */
/* Note that when you do not compile the `PSNames' module by undefining */
/* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
/* contain additional code used to read the PS Names table from a font. */
/* */
/* (By default, the module uses `PSNames' to extract glyph names.) */
/* */
#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
/* access the internal name table in a SFNT-based format like TrueType */
/* or OpenType. The name table contains various strings used to */
/* describe the font, like family name, copyright, version, etc. It */
/* does not contain any glyph name though. */
/* */
/* Accessing SFNT names is done through the functions declared in */
/* `ftsnames.h'. */
/* */
#define TT_CONFIG_OPTION_SFNT_NAMES
/*************************************************************************/
/* */
/* TrueType CMap support */
/* */
/* Here you can fine-tune which TrueType CMap table format shall be */
/* supported. */
#define TT_CONFIG_CMAP_FORMAT_0
#define TT_CONFIG_CMAP_FORMAT_2
#define TT_CONFIG_CMAP_FORMAT_4
#define TT_CONFIG_CMAP_FORMAT_6
#define TT_CONFIG_CMAP_FORMAT_8
#define TT_CONFIG_CMAP_FORMAT_10
#define TT_CONFIG_CMAP_FORMAT_12
#define TT_CONFIG_CMAP_FORMAT_13
#define TT_CONFIG_CMAP_FORMAT_14
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
/* a bytecode interpreter in the TrueType driver. */
/* */
/* By undefining this, you will only compile the code necessary to load */
/* TrueType glyphs without hinting. */
/* */
/* Do not #undef this macro here, since the build system might */
/* define it for certain configurations only. */
/* */
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */
/* subpixel hinting support into the TrueType driver. This modifies the */
/* TrueType hinting mechanism when anything but FT_RENDER_MODE_MONO is */
/* requested. */
/* */
/* In particular, it modifies the bytecode interpreter to interpret (or */
/* not) instructions in a certain way so that all TrueType fonts look */
/* like they do in a Windows ClearType (DirectWrite) environment. See */
/* [1] for a technical overview on what this means. See `ttinterp.h' */
/* for more details on the LEAN option. */
/* */
/* There are three possible values. */
/* */
/* Value 1: */
/* This value is associated with the `Infinality' moniker, */
/* contributed by an individual nicknamed Infinality with the goal of */
/* making TrueType fonts render better than on Windows. A high */
/* amount of configurability and flexibility, down to rules for */
/* single glyphs in fonts, but also very slow. Its experimental and */
/* slow nature and the original developer losing interest meant that */
/* this option was never enabled in default builds. */
/* */
/* The corresponding interpreter version is v38. */
/* */
/* Value 2: */
/* The new default mode for the TrueType driver. The Infinality code */
/* base was stripped to the bare minimum and all configurability */
/* removed in the name of speed and simplicity. The configurability */
/* was mainly aimed at legacy fonts like Arial, Times New Roman, or */
/* Courier. Legacy fonts are fonts that modify vertical stems to */
/* achieve clean black-and-white bitmaps. The new mode focuses on */
/* applying a minimal set of rules to all fonts indiscriminately so */
/* that modern and web fonts render well while legacy fonts render */
/* okay. */
/* */
/* The corresponding interpreter version is v40. */
/* */
/* Value 3: */
/* Compile both, making both v38 and v40 available (the latter is the */
/* default). */
/* */
/* By undefining these, you get rendering behavior like on Windows */
/* without ClearType, i.e., Windows XP without ClearType enabled and */
/* Win9x (interpreter version v35). Or not, depending on how much */
/* hinting blood and testing tears the font designer put into a given */
/* font. If you define one or both subpixel hinting options, you can */
/* switch between between v35 and the ones you define (using */
/* `FT_Property_Set'). */
/* */
/* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */
/* defined. */
/* */
/* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
/* */
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */
/* TrueType glyph loader to use Apple's definition of how to handle */
/* component offsets in composite glyphs. */
/* */
/* Apple and MS disagree on the default behavior of component offsets */
/* in composites. Apple says that they should be scaled by the scaling */
/* factors in the transformation matrix (roughly, it's more complex) */
/* while MS says they should not. OpenType defines two bits in the */
/* composite flags array which can be used to disambiguate, but old */
/* fonts will not have them. */
/* */
/* https://www.microsoft.com/typography/otspec/glyf.htm */
/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */
/* */
#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */
/* support for Apple's distortable font technology (fvar, gvar, cvar, */
/* and avar tables). This has many similarities to Type 1 Multiple */
/* Masters support. */
/* */
#define TT_CONFIG_OPTION_GX_VAR_SUPPORT
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_BDF if you want to include support for */
/* an embedded `BDF ' table within SFNT-based bitmap formats. */
/* */
#define TT_CONFIG_OPTION_BDF
/*************************************************************************/
/* */
/* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum */
/* number of bytecode instructions executed for a single run of the */
/* bytecode interpreter, needed to prevent infinite loops. You don't */
/* want to change this except for very special situations (e.g., making */
/* a library fuzzer spend less time to handle broken fonts). */
/* */
/* It is not expected that this value is ever modified by a configuring */
/* script; instead, it gets surrounded with #ifndef ... #endif so that */
/* the value can be set as a preprocessor option on the compiler's */
/* command line. */
/* */
#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
#endif
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */
/* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
/* required. */
/* */
#define T1_MAX_DICT_DEPTH 5
/*************************************************************************/
/* */
/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
/* calls during glyph loading. */
/* */
#define T1_MAX_SUBRS_CALLS 16
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
/* minimum of 16 is required. */
/* */
/* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 256
/*************************************************************************/
/* */
/* Define this configuration macro if you want to prevent the */
/* compilation of `t1afm', which is in charge of reading Type 1 AFM */
/* files into an existing face. Note that if set, the T1 driver will be */
/* unable to produce kerning distances. */
/* */
#undef T1_CONFIG_OPTION_NO_AFM
/*************************************************************************/
/* */
/* Define this configuration macro if you want to prevent the */
/* compilation of the Multiple Masters font support in the Type 1 */
/* driver. */
/* */
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
/*************************************************************************/
/* */
/* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */
/* engine gets compiled into FreeType. If defined, it is possible to */
/* switch between the two engines using the `hinting-engine' property of */
/* the type1 driver module. */
/* */
/* #define T1_CONFIG_OPTION_OLD_ENGINE */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** C F F D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Using CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4} it is */
/* possible to set up the default values of the four control points that */
/* define the stem darkening behaviour of the (new) CFF engine. For */
/* more details please read the documentation of the */
/* `darkening-parameters' property (file `ftdriver.h'), which allows the */
/* control at run-time. */
/* */
/* Do *not* undefine these macros! */
/* */
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0
/*************************************************************************/
/* */
/* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */
/* engine gets compiled into FreeType. If defined, it is possible to */
/* switch between the two engines using the `hinting-engine' property of */
/* the cff driver module. */
/* */
/* #define CFF_CONFIG_OPTION_OLD_ENGINE */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** P C F D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* There are many PCF fonts just called `Fixed' which look completely */
/* different, and which have nothing to do with each other. When */
/* selecting `Fixed' in KDE or Gnome one gets results that appear rather */
/* random, the style changes often if one changes the size and one */
/* cannot select some fonts at all. This option makes the PCF module */
/* prepend the foundry name (plus a space) to the family name. */
/* */
/* We also check whether we have `wide' characters; all put together, we */
/* get family names like `Sony Fixed' or `Misc Fixed Wide'. */
/* */
/* If this option is activated, it can be controlled with the */
/* `no-long-family-names' property of the pcf driver module. */
/* */
/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Compile autofit module with CJK (Chinese, Japanese, Korean) script */
/* support. */
/* */
#define AF_CONFIG_OPTION_CJK
/*************************************************************************/
/* */
/* Compile autofit module with fallback Indic script support, covering */
/* some scripts that the `latin' submodule of the autofit module doesn't */
/* (yet) handle. */
/* */
#define AF_CONFIG_OPTION_INDIC
/*************************************************************************/
/* */
/* Compile autofit module with warp hinting. The idea of the warping */
/* code is to slightly scale and shift a glyph within a single dimension */
/* so that as much of its segments are aligned (more or less) on the */
/* grid. To find out the optimal scaling and shifting value, various */
/* parameter combinations are tried and scored. */
/* */
/* This experimental option is active only if the rendering mode is */
/* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */
/* `warping' property of the auto-hinter (see file `ftdriver.h' for more */
/* information; by default it is switched off). */
/* */
#define AF_CONFIG_OPTION_USE_WARPER
/*************************************************************************/
/* */
/* Use TrueType-like size metrics for `light' auto-hinting. */
/* */
/* It is strongly recommended to avoid this option, which exists only to */
/* help some legacy applications retain its appearance and behaviour */
/* with respect to auto-hinted TrueType fonts. */
/* */
/* The very reason this option exists at all are GNU/Linux distributions */
/* like Fedora that did not un-patch the following change (which was */
/* present in FreeType between versions 2.4.6 and 2.7.1, inclusive). */
/* */
/* 2011-07-16 Steven Chu <steven.f.chu@gmail.com> */
/* */
/* [truetype] Fix metrics on size request for scalable fonts. */
/* */
/* This problematic commit is now reverted (more or less). */
/* */
/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */
/* */
/*
* This macro is obsolete. Support has been removed in FreeType
* version 2.5.
*/
/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
/*
* This macro is defined if native TrueType hinting is requested by the
* definitions above.
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_USE_BYTECODE_INTERPRETER
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1
#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
#endif
#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2
#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
#endif
#endif
#endif
/*
* Check CFF darkening parameters. The checks are the same as in function
* `cff_property_set' in file `cffdrivr.c'.
*/
#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \
\
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \
\
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \
\
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500
#error "Invalid CFF darkening parameters!"
#endif
FT_END_HEADER
#endif /* FTOPTION_H_ */
/* END */
/***************************************************************************/
/* */
/* ftstdlib.h */
/* */
/* ANSI-specific library and header configuration file (specification */
/* only). */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to group all #includes to the ANSI C library that */
/* FreeType normally requires. It also defines macros to rename the */
/* standard functions within the FreeType source code. */
/* */
/* Load a file which defines FTSTDLIB_H_ before this one to override it. */
/* */
/*************************************************************************/
#ifndef FTSTDLIB_H_
#define FTSTDLIB_H_
#include <stddef.h>
#define ft_ptrdiff_t ptrdiff_t
/**********************************************************************/
/* */
/* integer limits */
/* */
/* UINT_MAX and ULONG_MAX are used to automatically compute the size */
/* of `int' and `long' in bytes at compile-time. So far, this works */
/* for all platforms the library has been tested on. */
/* */
/* Note that on the extremely rare platforms that do not provide */
/* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */
/* old Crays where `int' is 36 bits), we do not make any guarantee */
/* about the correct behaviour of FT2 with all fonts. */
/* */
/* In these case, `ftconfig.h' will refuse to compile anyway with a */
/* message like `couldn't find 32-bit type' or something similar. */
/* */
/**********************************************************************/
#include <limits.h>
#define FT_CHAR_BIT CHAR_BIT
#define FT_USHORT_MAX USHRT_MAX
#define FT_INT_MAX INT_MAX
#define FT_INT_MIN INT_MIN
#define FT_UINT_MAX UINT_MAX
#define FT_LONG_MIN LONG_MIN
#define FT_LONG_MAX LONG_MAX
#define FT_ULONG_MAX ULONG_MAX
/**********************************************************************/
/* */
/* character and string processing */
/* */
/**********************************************************************/
#include <string.h>
#define ft_memchr memchr
#define ft_memcmp memcmp
#define ft_memcpy memcpy
#define ft_memmove memmove
#define ft_memset memset
#define ft_strcat strcat
#define ft_strcmp strcmp
#define ft_strcpy strcpy
#define ft_strlen strlen
#define ft_strncmp strncmp
#define ft_strncpy strncpy
#define ft_strrchr strrchr
#define ft_strstr strstr
/**********************************************************************/
/* */
/* file handling */
/* */
/**********************************************************************/
#include <stdio.h>
#define FT_FILE FILE
#define ft_fclose fclose
#define ft_fopen fopen
#define ft_fread fread
#define ft_fseek fseek
#define ft_ftell ftell
#define ft_sprintf sprintf
/**********************************************************************/
/* */
/* sorting */
/* */
/**********************************************************************/
#include <stdlib.h>
#define ft_qsort qsort
/**********************************************************************/
/* */
/* memory allocation */
/* */
/**********************************************************************/
#define ft_scalloc calloc
#define ft_sfree free
#define ft_smalloc malloc
#define ft_srealloc realloc
/**********************************************************************/
/* */
/* miscellaneous */
/* */
/**********************************************************************/
#define ft_strtol strtol
#define ft_getenv getenv
/**********************************************************************/
/* */
/* execution control */
/* */
/**********************************************************************/
#include <setjmp.h>
#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
/* jmp_buf is defined as a macro */
/* on certain platforms */
#define ft_longjmp longjmp
#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
/* the following is only used for debugging purposes, i.e., if */
/* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
#include <stdarg.h>
#endif /* FTSTDLIB_H_ */
/* END */
/* ftconfig.h. Generated from ftconfig.in by configure. */
/***************************************************************************/
/* */
/* ftconfig.in */
/* */
/* UNIX-specific configuration file (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This header file contains a number of macro definitions that are used */
/* by the rest of the engine. Most of the macros here are automatically */
/* determined at compile time, and you should not need to change it to */
/* port FreeType, except to compile the library with a non-ANSI */
/* compiler. */
/* */
/* Note however that if some specific modifications are needed, we */
/* advise you to place a modified copy in your build directory. */
/* */
/* The build directory is usually `builds/<system>', and contains */
/* system-specific files that are always included first when building */
/* the library. */
/* */
/*************************************************************************/
#ifndef FTCONFIG_H_
#define FTCONFIG_H_
#include <ft2build.h>
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in an ANSI C environment */
/* (16bit compilers are also supported). Copy this file to your own */
/* `builds/<system>' directory, and edit it to port the engine. */
/* */
/*************************************************************************/
#define HAVE_UNISTD_H 1
#define HAVE_FCNTL_H 1
#define HAVE_STDINT_H 1
/* There are systems (like the Texas Instruments 'C54x) where a `char' */
/* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
/* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
/* is probably unexpected. */
/* */
/* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
/* `char' type. */
#ifndef FT_CHAR_BIT
#define FT_CHAR_BIT CHAR_BIT
#endif
/* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */
#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define FT_SIZEOF_INT SIZEOF_INT
#define FT_SIZEOF_LONG SIZEOF_LONG
#else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
/* Following cpp computation of the bit length of int and long */
/* is copied from default include/freetype/config/ftconfig.h. */
/* If any improvement is required for this file, it should be */
/* applied to the original header file for the builders that */
/* do not use configure script. */
/* The size of an `int' type. */
#if FT_UINT_MAX == 0xFFFFUL
#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
#elif FT_UINT_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `int' type!"
#endif
/* The size of a `long' type. A five-byte `long' (as used e.g. on the */
/* DM642) is recognized but avoided. */
#if FT_ULONG_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `long' type!"
#endif
#endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
/* FT_UNUSED is a macro used to indicate that a given parameter is not */
/* used -- this is only used to get rid of unpleasant compiler warnings */
#ifndef FT_UNUSED
#define FT_UNUSED( arg ) ( (arg) = (arg) )
#endif
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you are doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Mac support */
/* */
/* This is the only necessary change, so it is defined here instead */
/* providing a new configuration file. */
/* */
#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
/* no Carbon frameworks for 64bit 10.4.x */
/* AvailabilityMacros.h is available since Mac OS X 10.2, */
/* so guess the system version by maximum errno before inclusion */
#include <errno.h>
#ifdef ECANCELED /* defined since 10.2 */
#include "AvailabilityMacros.h"
#endif
#if defined( __LP64__ ) && \
( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
#undef FT_MACINTOSH
#endif
#elif defined( __SC__ ) || defined( __MRC__ )
/* Classic MacOS compilers */
#include "ConditionalMacros.h"
#if TARGET_OS_MAC
#define FT_MACINTOSH 1
#endif
#endif
/* Fix compiler warning with sgi compiler */
#if defined( __sgi ) && !defined( __GNUC__ )
#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
#pragma set woff 3505
#endif
#endif
/*************************************************************************/
/* */
/* <Section> */
/* basic_types */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int16 */
/* */
/* <Description> */
/* A typedef for a 16bit signed integer type. */
/* */
typedef signed short FT_Int16;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt16 */
/* */
/* <Description> */
/* A typedef for a 16bit unsigned integer type. */
/* */
typedef unsigned short FT_UInt16;
/* */
/* this #if 0 ... #endif clause is for documentation purposes */
#if 0
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int32 */
/* */
/* <Description> */
/* A typedef for a 32bit signed integer type. The size depends on */
/* the configuration. */
/* */
typedef signed XXX FT_Int32;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt32 */
/* */
/* A typedef for a 32bit unsigned integer type. The size depends on */
/* the configuration. */
/* */
typedef unsigned XXX FT_UInt32;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int64 */
/* */
/* A typedef for a 64bit signed integer type. The size depends on */
/* the configuration. Only defined if there is real 64bit support; */
/* otherwise, it gets emulated with a structure (if necessary). */
/* */
typedef signed XXX FT_Int64;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt64 */
/* */
/* A typedef for a 64bit unsigned integer type. The size depends on */
/* the configuration. Only defined if there is real 64bit support; */
/* otherwise, it gets emulated with a structure (if necessary). */
/* */
typedef unsigned XXX FT_UInt64;
/* */
#endif
#if FT_SIZEOF_INT == 4
typedef signed int FT_Int32;
typedef unsigned int FT_UInt32;
#elif FT_SIZEOF_LONG == 4
typedef signed long FT_Int32;
typedef unsigned long FT_UInt32;
#else
#error "no 32bit type found -- please check your configuration files"
#endif
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= 4
typedef int FT_Fast;
typedef unsigned int FT_UFast;
#elif FT_SIZEOF_LONG >= 4
typedef long FT_Fast;
typedef unsigned long FT_UFast;
#endif
/* determine whether we have a 64-bit int type */
/* (mostly for environments without `autoconf') */
#if FT_SIZEOF_LONG == 8
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
#define FT_INT64 long
#define FT_UINT64 unsigned long
/* we handle the LLP64 scheme separately for GCC and clang, */
/* suppressing the `long long' warning */
#elif ( FT_SIZEOF_LONG == 4 ) && \
defined( HAVE_LONG_LONG_INT ) && \
defined( __GNUC__ )
#pragma GCC diagnostic ignored "-Wlong-long"
#define FT_LONG64
#define FT_INT64 long long int
#define FT_UINT64 unsigned long long int
/*************************************************************************/
/* */
/* A 64-bit data type may create compilation problems if you compile */
/* in strict ANSI mode. To avoid them, we disable other 64-bit data */
/* types if __STDC__ is defined. You can however ignore this rule */
/* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
#define FT_LONG64
#define FT_INT64 long long int
#define FT_UINT64 unsigned long long int
#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#define FT_UINT64 unsigned __int64
#elif defined( __BORLANDC__ ) /* Borland C++ */
/* XXXX: We should probably check the value of __BORLANDC__ in order */
/* to test the compiler version. */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#define FT_UINT64 unsigned __int64
#elif defined( __WATCOMC__ ) /* Watcom C++ */
/* Watcom doesn't provide 64-bit data types */
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
#define FT_LONG64
#define FT_INT64 long long int
#define FT_UINT64 unsigned long long int
#elif defined( __GNUC__ )
/* GCC provides the `long long' type */
#define FT_LONG64
#define FT_INT64 long long int
#define FT_UINT64 unsigned long long int
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* FT_SIZEOF_LONG == 8 */
#ifdef FT_LONG64
typedef FT_INT64 FT_Int64;
typedef FT_UINT64 FT_UInt64;
#endif
#ifdef _WIN64
/* only 64bit Windows uses the LLP64 data model, i.e., */
/* 32bit integers, 64bit pointers */
#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
#else
#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
#endif
/*************************************************************************/
/* */
/* miscellaneous */
/* */
/*************************************************************************/
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
/* typeof condition taken from gnulib's `intprops.h' header file */
#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \
( defined( __IBMC__ ) && __IBMC__ >= 1210 && \
defined( __IBM__TYPEOF__ ) ) || \
( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
#define FT_TYPEOF( type ) ( __typeof__ ( type ) )
#else
#define FT_TYPEOF( type ) /* empty */
#endif
/* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */
/* a function that gets used only within the scope of a module. */
/* Normally, both the header and source code files for such a */
/* function are within a single module directory. */
/* */
/* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */
/* FT_LOCAL_ARRAY_DEF. */
/* */
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL( x ) static x
#define FT_LOCAL_DEF( x ) static x
#else
#ifdef __cplusplus
#define FT_LOCAL( x ) extern "C" x
#define FT_LOCAL_DEF( x ) extern "C" x
#else
#define FT_LOCAL( x ) extern x
#define FT_LOCAL_DEF( x ) x
#endif
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
#define FT_LOCAL_ARRAY( x ) extern const x
#define FT_LOCAL_ARRAY_DEF( x ) const x
/* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */
/* functions that are used in more than a single module. In the */
/* current setup this implies that the declaration is in a header */
/* file in the `include/freetype/internal' directory, and the */
/* function body is in a file in `src/base'. */
/* */
#ifndef FT_BASE
#ifdef __cplusplus
#define FT_BASE( x ) extern "C" x
#else
#define FT_BASE( x ) extern x
#endif
#endif /* !FT_BASE */
#ifndef FT_BASE_DEF
#ifdef __cplusplus
#define FT_BASE_DEF( x ) x
#else
#define FT_BASE_DEF( x ) x
#endif
#endif /* !FT_BASE_DEF */
/* When compiling FreeType as a DLL or DSO with hidden visibility */
/* some systems/compilers need a special attribute in front OR after */
/* the return type of function declarations. */
/* */
/* Two macros are used within the FreeType source code to define */
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
/* */
/* FT_EXPORT( return_type ) */
/* */
/* is used in a function declaration, as in */
/* */
/* FT_EXPORT( FT_Error ) */
/* FT_Init_FreeType( FT_Library* alibrary ); */
/* */
/* */
/* FT_EXPORT_DEF( return_type ) */
/* */
/* is used in a function definition, as in */
/* */
/* FT_EXPORT_DEF( FT_Error ) */
/* FT_Init_FreeType( FT_Library* alibrary ) */
/* { */
/* ... some code ... */
/* return FT_Err_Ok; */
/* } */
/* */
/* You can provide your own implementation of FT_EXPORT and */
/* FT_EXPORT_DEF here if you want. */
/* */
/* To export a variable, use FT_EXPORT_VAR. */
/* */
#ifndef FT_EXPORT
#ifdef FT2_BUILD_LIBRARY
#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
#define FT_EXPORT( x ) __declspec( dllexport ) x
#elif defined( __GNUC__ ) && __GNUC__ >= 4
#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
#elif defined( __cplusplus )
#define FT_EXPORT( x ) extern "C" x
#else
#define FT_EXPORT( x ) extern x
#endif
#else
#if defined( FT2_DLLIMPORT )
#define FT_EXPORT( x ) __declspec( dllimport ) x
#elif defined( __cplusplus )
#define FT_EXPORT( x ) extern "C" x
#else
#define FT_EXPORT( x ) extern x
#endif
#endif
#endif /* !FT_EXPORT */
#ifndef FT_EXPORT_DEF
#ifdef __cplusplus
#define FT_EXPORT_DEF( x ) extern "C" x
#else
#define FT_EXPORT_DEF( x ) extern x
#endif
#endif /* !FT_EXPORT_DEF */
#ifndef FT_EXPORT_VAR
#ifdef __cplusplus
#define FT_EXPORT_VAR( x ) extern "C" x
#else
#define FT_EXPORT_VAR( x ) extern x
#endif
#endif /* !FT_EXPORT_VAR */
/* The following macros are needed to compile the library with a */
/* C++ compiler and with 16bit compilers. */
/* */
/* This is special. Within C++, you must specify `extern "C"' for */
/* functions which are used via function pointers, and you also */
/* must do that for structures which contain function pointers to */
/* assure C linkage -- it's not possible to have (local) anonymous */
/* functions which are accessed by (global) function pointers. */
/* */
/* */
/* FT_CALLBACK_DEF is used to _define_ a callback function, */
/* located in the same source code file as the structure that uses */
/* it. */
/* */
/* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */
/* and define a callback function, respectively, in a similar way */
/* as FT_BASE and FT_BASE_DEF work. */
/* */
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
/* contains pointers to callback functions. */
/* */
/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
/* that contains pointers to callback functions. */
/* */
/* */
/* Some 16bit compilers have to redefine these macros to insert */
/* the infamous `_cdecl' or `__fastcall' declarations. */
/* */
#ifndef FT_CALLBACK_DEF
#ifdef __cplusplus
#define FT_CALLBACK_DEF( x ) extern "C" x
#else
#define FT_CALLBACK_DEF( x ) static x
#endif
#endif /* FT_CALLBACK_DEF */
#ifndef FT_BASE_CALLBACK
#ifdef __cplusplus
#define FT_BASE_CALLBACK( x ) extern "C" x
#define FT_BASE_CALLBACK_DEF( x ) extern "C" x
#else
#define FT_BASE_CALLBACK( x ) extern x
#define FT_BASE_CALLBACK_DEF( x ) x
#endif
#endif /* FT_BASE_CALLBACK */
#ifndef FT_CALLBACK_TABLE
#ifdef __cplusplus
#define FT_CALLBACK_TABLE extern "C"
#define FT_CALLBACK_TABLE_DEF extern "C"
#else
#define FT_CALLBACK_TABLE extern
#define FT_CALLBACK_TABLE_DEF /* nothing */
#endif
#endif /* FT_CALLBACK_TABLE */
FT_END_HEADER
#endif /* FTCONFIG_H_ */
/* END */
/***************************************************************************/
/* */
/* ftbitmap.h */
/* */
/* FreeType utility functions for bitmaps (specification). */
/* */
/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTBITMAP_H_
#define FTBITMAP_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* bitmap_handling */
/* */
/* <Title> */
/* Bitmap Handling */
/* */
/* <Abstract> */
/* Handling FT_Bitmap objects. */
/* */
/* <Description> */
/* This section contains functions for handling @FT_Bitmap objects. */
/* Note that none of the functions changes the bitmap's `flow' (as */
/* indicated by the sign of the `pitch' field in `FT_Bitmap'). */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Bitmap_Init */
/* */
/* <Description> */
/* Initialize a pointer to an @FT_Bitmap structure. */
/* */
/* <InOut> */
/* abitmap :: A pointer to the bitmap structure. */
/* */
/* <Note> */
/* A deprecated name for the same function is `FT_Bitmap_New'. */
/* */
FT_EXPORT( void )
FT_Bitmap_Init( FT_Bitmap *abitmap );
/* deprecated */
FT_EXPORT( void )
FT_Bitmap_New( FT_Bitmap *abitmap );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Bitmap_Copy */
/* */
/* <Description> */
/* Copy a bitmap into another one. */
/* */
/* <Input> */
/* library :: A handle to a library object. */
/* */
/* source :: A handle to the source bitmap. */
/* */
/* <Output> */
/* target :: A handle to the target bitmap. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Copy( FT_Library library,
const FT_Bitmap *source,
FT_Bitmap *target );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Bitmap_Embolden */
/* */
/* <Description> */
/* Embolden a bitmap. The new bitmap will be about `xStrength' */
/* pixels wider and `yStrength' pixels higher. The left and bottom */
/* borders are kept unchanged. */
/* */
/* <Input> */
/* library :: A handle to a library object. */
/* */
/* xStrength :: How strong the glyph is emboldened horizontally. */
/* Expressed in 26.6 pixel format. */
/* */
/* yStrength :: How strong the glyph is emboldened vertically. */
/* Expressed in 26.6 pixel format. */
/* */
/* <InOut> */
/* bitmap :: A handle to the target bitmap. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The current implementation restricts `xStrength' to be less than */
/* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
/* */
/* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
/* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
/* */
/* Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format */
/* are converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp). */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Embolden( FT_Library library,
FT_Bitmap* bitmap,
FT_Pos xStrength,
FT_Pos yStrength );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Bitmap_Convert */
/* */
/* <Description> */
/* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */
/* to a bitmap object with depth 8bpp, making the number of used */
/* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */
/* */
/* <Input> */
/* library :: A handle to a library object. */
/* */
/* source :: The source bitmap. */
/* */
/* alignment :: The pitch of the bitmap is a multiple of this */
/* parameter. Common values are 1, 2, or 4. */
/* */
/* <Output> */
/* target :: The target bitmap. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* It is possible to call @FT_Bitmap_Convert multiple times without */
/* calling @FT_Bitmap_Done (the memory is simply reallocated). */
/* */
/* Use @FT_Bitmap_Done to finally remove the bitmap object. */
/* */
/* The `library' argument is taken to have access to FreeType's */
/* memory handling functions. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Convert( FT_Library library,
const FT_Bitmap *source,
FT_Bitmap *target,
FT_Int alignment );
/*************************************************************************/
/* */
/* <Function> */
/* FT_GlyphSlot_Own_Bitmap */
/* */
/* <Description> */
/* Make sure that a glyph slot owns `slot->bitmap'. */
/* */
/* <Input> */
/* slot :: The glyph slot. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function is to be used in combination with */
/* @FT_Bitmap_Embolden. */
/* */
FT_EXPORT( FT_Error )
FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Bitmap_Done */
/* */
/* <Description> */
/* Destroy a bitmap object initialized with @FT_Bitmap_Init. */
/* */
/* <Input> */
/* library :: A handle to a library object. */
/* */
/* bitmap :: The bitmap object to be freed. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The `library' argument is taken to have access to FreeType's */
/* memory handling functions. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Done( FT_Library library,
FT_Bitmap *bitmap );
/* */
FT_END_HEADER
#endif /* FTBITMAP_H_ */
/* END */
/***************************************************************************/
/* */
/* ftpfr.h */
/* */
/* FreeType API for accessing PFR-specific data (specification only). */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTPFR_H_
#define FTPFR_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* pfr_fonts */
/* */
/* <Title> */
/* PFR Fonts */
/* */
/* <Abstract> */
/* PFR/TrueDoc specific API. */
/* */
/* <Description> */
/* This section contains the declaration of PFR-specific functions. */
/* */
/*************************************************************************/
/**********************************************************************
*
* @function:
* FT_Get_PFR_Metrics
*
* @description:
* Return the outline and metrics resolutions of a given PFR face.
*
* @input:
* face :: Handle to the input face. It can be a non-PFR face.
*
* @output:
* aoutline_resolution ::
* Outline resolution. This is equivalent to `face->units_per_EM'
* for non-PFR fonts. Optional (parameter can be NULL).
*
* ametrics_resolution ::
* Metrics resolution. This is equivalent to `outline_resolution'
* for non-PFR fonts. Optional (parameter can be NULL).
*
* ametrics_x_scale ::
* A 16.16 fixed-point number used to scale distance expressed
* in metrics units to device subpixels. This is equivalent to
* `face->size->x_scale', but for metrics only. Optional (parameter
* can be NULL).
*
* ametrics_y_scale ::
* Same as `ametrics_x_scale' but for the vertical direction.
* optional (parameter can be NULL).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If the input face is not a PFR, this function will return an error.
* However, in all cases, it will return valid values.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Metrics( FT_Face face,
FT_UInt *aoutline_resolution,
FT_UInt *ametrics_resolution,
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Kerning
*
* @description:
* Return the kerning pair corresponding to two glyphs in a PFR face.
* The distance is expressed in metrics units, unlike the result of
* @FT_Get_Kerning.
*
* @input:
* face :: A handle to the input face.
*
* left :: Index of the left glyph.
*
* right :: Index of the right glyph.
*
* @output:
* avector :: A kerning vector.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function always return distances in original PFR metrics
* units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED
* mode, which always returns distances converted to outline units.
*
* You can use the value of the `x_scale' and `y_scale' parameters
* returned by @FT_Get_PFR_Metrics to scale these to device subpixels.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Kerning( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Advance
*
* @description:
* Return a given glyph advance, expressed in original metrics units,
* from a PFR font.
*
* @input:
* face :: A handle to the input face.
*
* gindex :: The glyph index.
*
* @output:
* aadvance :: The glyph advance in metrics units.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
* to convert the advance to device subpixels (i.e., 1/64th of pixels).
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Advance( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
/* */
FT_END_HEADER
#endif /* FTPFR_H_ */
/* END */
/***************************************************************************/
/* */
/* ftincrem.h */
/* */
/* FreeType incremental loading (specification). */
/* */
/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTINCREM_H_
#define FTINCREM_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/***************************************************************************
*
* @section:
* incremental
*
* @title:
* Incremental Loading
*
* @abstract:
* Custom Glyph Loading.
*
* @description:
* This section contains various functions used to perform so-called
* `incremental' glyph loading. This is a mode where all glyphs loaded
* from a given @FT_Face are provided by the client application.
*
* Apart from that, all other tables are loaded normally from the font
* file. This mode is useful when FreeType is used within another
* engine, e.g., a PostScript Imaging Processor.
*
* To enable this mode, you must use @FT_Open_Face, passing an
* @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an
* @FT_Incremental_Interface value. See the comments for
* @FT_Incremental_InterfaceRec for an example.
*
*/
/***************************************************************************
*
* @type:
* FT_Incremental
*
* @description:
* An opaque type describing a user-provided object used to implement
* `incremental' glyph loading within FreeType. This is used to support
* embedded fonts in certain environments (e.g., PostScript interpreters),
* where the glyph data isn't in the font file, or must be overridden by
* different values.
*
* @note:
* It is up to client applications to create and implement @FT_Incremental
* objects, as long as they provide implementations for the methods
* @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc
* and @FT_Incremental_GetGlyphMetricsFunc.
*
* See the description of @FT_Incremental_InterfaceRec to understand how
* to use incremental objects with FreeType.
*
*/
typedef struct FT_IncrementalRec_* FT_Incremental;
/***************************************************************************
*
* @struct:
* FT_Incremental_MetricsRec
*
* @description:
* A small structure used to contain the basic glyph metrics returned
* by the @FT_Incremental_GetGlyphMetricsFunc method.
*
* @fields:
* bearing_x ::
* Left bearing, in font units.
*
* bearing_y ::
* Top bearing, in font units.
*
* advance ::
* Horizontal component of glyph advance, in font units.
*
* advance_v ::
* Vertical component of glyph advance, in font units.
*
* @note:
* These correspond to horizontal or vertical metrics depending on the
* value of the `vertical' argument to the function
* @FT_Incremental_GetGlyphMetricsFunc.
*
*/
typedef struct FT_Incremental_MetricsRec_
{
FT_Long bearing_x;
FT_Long bearing_y;
FT_Long advance;
FT_Long advance_v; /* since 2.3.12 */
} FT_Incremental_MetricsRec;
/***************************************************************************
*
* @struct:
* FT_Incremental_Metrics
*
* @description:
* A handle to an @FT_Incremental_MetricsRec structure.
*
*/
typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics;
/***************************************************************************
*
* @type:
* FT_Incremental_GetGlyphDataFunc
*
* @description:
* A function called by FreeType to access a given glyph's data bytes
* during @FT_Load_Glyph or @FT_Load_Char if incremental loading is
* enabled.
*
* Note that the format of the glyph's data bytes depends on the font
* file format. For TrueType, it must correspond to the raw bytes within
* the `glyf' table. For PostScript formats, it must correspond to the
* *unencrypted* charstring bytes, without any `lenIV' header. It is
* undefined for any other format.
*
* @input:
* incremental ::
* Handle to an opaque @FT_Incremental handle provided by the client
* application.
*
* glyph_index ::
* Index of relevant glyph.
*
* @output:
* adata ::
* A structure describing the returned glyph data bytes (which will be
* accessed as a read-only byte block).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If this function returns successfully the method
* @FT_Incremental_FreeGlyphDataFunc will be called later to release
* the data bytes.
*
* Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for
* compound glyphs.
*
*/
typedef FT_Error
(*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental,
FT_UInt glyph_index,
FT_Data* adata );
/***************************************************************************
*
* @type:
* FT_Incremental_FreeGlyphDataFunc
*
* @description:
* A function used to release the glyph data bytes returned by a
* successful call to @FT_Incremental_GetGlyphDataFunc.
*
* @input:
* incremental ::
* A handle to an opaque @FT_Incremental handle provided by the client
* application.
*
* data ::
* A structure describing the glyph data bytes (which will be accessed
* as a read-only byte block).
*
*/
typedef void
(*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental,
FT_Data* data );
/***************************************************************************
*
* @type:
* FT_Incremental_GetGlyphMetricsFunc
*
* @description:
* A function used to retrieve the basic metrics of a given glyph index
* before accessing its data. This is necessary because, in certain
* formats like TrueType, the metrics are stored in a different place from
* the glyph images proper.
*
* @input:
* incremental ::
* A handle to an opaque @FT_Incremental handle provided by the client
* application.
*
* glyph_index ::
* Index of relevant glyph.
*
* vertical ::
* If true, return vertical metrics.
*
* ametrics ::
* This parameter is used for both input and output.
* The original glyph metrics, if any, in font units. If metrics are
* not available all the values must be set to zero.
*
* @output:
* ametrics ::
* The replacement glyph metrics in font units.
*
*/
typedef FT_Error
(*FT_Incremental_GetGlyphMetricsFunc)
( FT_Incremental incremental,
FT_UInt glyph_index,
FT_Bool vertical,
FT_Incremental_MetricsRec *ametrics );
/**************************************************************************
*
* @struct:
* FT_Incremental_FuncsRec
*
* @description:
* A table of functions for accessing fonts that load data
* incrementally. Used in @FT_Incremental_InterfaceRec.
*
* @fields:
* get_glyph_data ::
* The function to get glyph data. Must not be null.
*
* free_glyph_data ::
* The function to release glyph data. Must not be null.
*
* get_glyph_metrics ::
* The function to get glyph metrics. May be null if the font does
* not provide overriding glyph metrics.
*
*/
typedef struct FT_Incremental_FuncsRec_
{
FT_Incremental_GetGlyphDataFunc get_glyph_data;
FT_Incremental_FreeGlyphDataFunc free_glyph_data;
FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics;
} FT_Incremental_FuncsRec;
/***************************************************************************
*
* @struct:
* FT_Incremental_InterfaceRec
*
* @description:
* A structure to be used with @FT_Open_Face to indicate that the user
* wants to support incremental glyph loading. You should use it with
* @FT_PARAM_TAG_INCREMENTAL as in the following example:
*
* {
* FT_Incremental_InterfaceRec inc_int;
* FT_Parameter parameter;
* FT_Open_Args open_args;
*
*
* // set up incremental descriptor
* inc_int.funcs = my_funcs;
* inc_int.object = my_object;
*
* // set up optional parameter
* parameter.tag = FT_PARAM_TAG_INCREMENTAL;
* parameter.data = &inc_int;
*
* // set up FT_Open_Args structure
* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;
* open_args.pathname = my_font_pathname;
* open_args.num_params = 1;
* open_args.params = ¶meter; // we use one optional argument
*
* // open the font
* error = FT_Open_Face( library, &open_args, index, &face );
* ...
* }
*
*/
typedef struct FT_Incremental_InterfaceRec_
{
const FT_Incremental_FuncsRec* funcs;
FT_Incremental object;
} FT_Incremental_InterfaceRec;
/***************************************************************************
*
* @type:
* FT_Incremental_Interface
*
* @description:
* A pointer to an @FT_Incremental_InterfaceRec structure.
*
*/
typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface;
/* */
FT_END_HEADER
#endif /* FTINCREM_H_ */
/* END */
/***************************************************************************/
/* */
/* freetype.h */
/* */
/* FreeType high-level API and common types (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FREETYPE_H_
#define FREETYPE_H_
#ifndef FT_FREETYPE_H
#error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files."
#error "Example:"
#error " #include <ft2build.h>"
#error " #include FT_FREETYPE_H"
#endif
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_TYPES_H
#include FT_ERRORS_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* header_inclusion */
/* */
/* <Title> */
/* FreeType's header inclusion scheme */
/* */
/* <Abstract> */
/* How client applications should include FreeType header files. */
/* */
/* <Description> */
/* To be as flexible as possible (and for historical reasons), */
/* FreeType uses a very special inclusion scheme to load header */
/* files, for example */
/* */
/* { */
/* #include <ft2build.h> */
/* */
/* #include FT_FREETYPE_H */
/* #include FT_OUTLINE_H */
/* } */
/* */
/* A compiler and its preprocessor only needs an include path to find */
/* the file `ft2build.h'; the exact locations and names of the other */
/* FreeType header files are hidden by preprocessor macro names, */
/* loaded by `ft2build.h'. The API documentation always gives the */
/* header macro name needed for a particular function. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* user_allocation */
/* */
/* <Title> */
/* User allocation */
/* */
/* <Abstract> */
/* How client applications should allocate FreeType data structures. */
/* */
/* <Description> */
/* FreeType assumes that structures allocated by the user and passed */
/* as arguments are zeroed out except for the actual data. In other */
/* words, it is recommended to use `calloc' (or variants of it) */
/* instead of `malloc' for allocation. */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* B A S I C T Y P E S */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* base_interface */
/* */
/* <Title> */
/* Base Interface */
/* */
/* <Abstract> */
/* The FreeType~2 base font interface. */
/* */
/* <Description> */
/* This section describes the most important public high-level API */
/* functions of FreeType~2. */
/* */
/* <Order> */
/* FT_Library */
/* FT_Face */
/* FT_Size */
/* FT_GlyphSlot */
/* FT_CharMap */
/* FT_Encoding */
/* FT_ENC_TAG */
/* */
/* FT_FaceRec */
/* */
/* FT_FACE_FLAG_SCALABLE */
/* FT_FACE_FLAG_FIXED_SIZES */
/* FT_FACE_FLAG_FIXED_WIDTH */
/* FT_FACE_FLAG_HORIZONTAL */
/* FT_FACE_FLAG_VERTICAL */
/* FT_FACE_FLAG_COLOR */
/* FT_FACE_FLAG_SFNT */
/* FT_FACE_FLAG_CID_KEYED */
/* FT_FACE_FLAG_TRICKY */
/* FT_FACE_FLAG_KERNING */
/* FT_FACE_FLAG_MULTIPLE_MASTERS */
/* FT_FACE_FLAG_VARIATION */
/* FT_FACE_FLAG_GLYPH_NAMES */
/* FT_FACE_FLAG_EXTERNAL_STREAM */
/* FT_FACE_FLAG_HINTER */
/* */
/* FT_HAS_HORIZONTAL */
/* FT_HAS_VERTICAL */
/* FT_HAS_KERNING */
/* FT_HAS_FIXED_SIZES */
/* FT_HAS_GLYPH_NAMES */
/* FT_HAS_COLOR */
/* FT_HAS_MULTIPLE_MASTERS */
/* */
/* FT_IS_SFNT */
/* FT_IS_SCALABLE */
/* FT_IS_FIXED_WIDTH */
/* FT_IS_CID_KEYED */
/* FT_IS_TRICKY */
/* FT_IS_NAMED_INSTANCE */
/* FT_IS_VARIATION */
/* */
/* FT_STYLE_FLAG_BOLD */
/* FT_STYLE_FLAG_ITALIC */
/* */
/* FT_SizeRec */
/* FT_Size_Metrics */
/* */
/* FT_GlyphSlotRec */
/* FT_Glyph_Metrics */
/* FT_SubGlyph */
/* */
/* FT_Bitmap_Size */
/* */
/* FT_Init_FreeType */
/* FT_Done_FreeType */
/* */
/* FT_New_Face */
/* FT_Done_Face */
/* FT_Reference_Face */
/* FT_New_Memory_Face */
/* FT_Face_Properties */
/* FT_Open_Face */
/* FT_Open_Args */
/* FT_Parameter */
/* FT_Attach_File */
/* FT_Attach_Stream */
/* */
/* FT_Set_Char_Size */
/* FT_Set_Pixel_Sizes */
/* FT_Request_Size */
/* FT_Select_Size */
/* FT_Size_Request_Type */
/* FT_Size_RequestRec */
/* FT_Size_Request */
/* FT_Set_Transform */
/* FT_Load_Glyph */
/* FT_Get_Char_Index */
/* FT_Get_First_Char */
/* FT_Get_Next_Char */
/* FT_Get_Name_Index */
/* FT_Load_Char */
/* */
/* FT_OPEN_MEMORY */
/* FT_OPEN_STREAM */
/* FT_OPEN_PATHNAME */
/* FT_OPEN_DRIVER */
/* FT_OPEN_PARAMS */
/* */
/* FT_LOAD_DEFAULT */
/* FT_LOAD_RENDER */
/* FT_LOAD_MONOCHROME */
/* FT_LOAD_LINEAR_DESIGN */
/* FT_LOAD_NO_SCALE */
/* FT_LOAD_NO_HINTING */
/* FT_LOAD_NO_BITMAP */
/* FT_LOAD_NO_AUTOHINT */
/* FT_LOAD_COLOR */
/* */
/* FT_LOAD_VERTICAL_LAYOUT */
/* FT_LOAD_IGNORE_TRANSFORM */
/* FT_LOAD_FORCE_AUTOHINT */
/* FT_LOAD_NO_RECURSE */
/* FT_LOAD_PEDANTIC */
/* */
/* FT_LOAD_TARGET_NORMAL */
/* FT_LOAD_TARGET_LIGHT */
/* FT_LOAD_TARGET_MONO */
/* FT_LOAD_TARGET_LCD */
/* FT_LOAD_TARGET_LCD_V */
/* */
/* FT_LOAD_TARGET_MODE */
/* */
/* FT_Render_Glyph */
/* FT_Render_Mode */
/* FT_Get_Kerning */
/* FT_Kerning_Mode */
/* FT_Get_Track_Kerning */
/* FT_Get_Glyph_Name */
/* FT_Get_Postscript_Name */
/* */
/* FT_CharMapRec */
/* FT_Select_Charmap */
/* FT_Set_Charmap */
/* FT_Get_Charmap_Index */
/* */
/* FT_Get_FSType_Flags */
/* FT_Get_SubGlyph_Info */
/* */
/* FT_Face_Internal */
/* FT_Size_Internal */
/* FT_Slot_Internal */
/* */
/* FT_FACE_FLAG_XXX */
/* FT_STYLE_FLAG_XXX */
/* FT_OPEN_XXX */
/* FT_LOAD_XXX */
/* FT_LOAD_TARGET_XXX */
/* FT_SUBGLYPH_FLAG_XXX */
/* FT_FSTYPE_XXX */
/* */
/* FT_HAS_FAST_GLYPHS */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Glyph_Metrics */
/* */
/* <Description> */
/* A structure to model the metrics of a single glyph. The values */
/* are expressed in 26.6 fractional pixel format; if the flag */
/* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
/* are expressed in font units instead. */
/* */
/* <Fields> */
/* width :: */
/* The glyph's width. */
/* */
/* height :: */
/* The glyph's height. */
/* */
/* horiBearingX :: */
/* Left side bearing for horizontal layout. */
/* */
/* horiBearingY :: */
/* Top side bearing for horizontal layout. */
/* */
/* horiAdvance :: */
/* Advance width for horizontal layout. */
/* */
/* vertBearingX :: */
/* Left side bearing for vertical layout. */
/* */
/* vertBearingY :: */
/* Top side bearing for vertical layout. Larger positive values */
/* mean further below the vertical glyph origin. */
/* */
/* vertAdvance :: */
/* Advance height for vertical layout. Positive values mean the */
/* glyph has a positive advance downward. */
/* */
/* <Note> */
/* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
/* dimensions of the hinted glyph (in case hinting is applicable). */
/* */
/* Stroking a glyph with an outside border does not increase */
/* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
/* values to account for the added width and height. */
/* */
/* FreeType doesn't use the `VORG' table data for CFF fonts because */
/* it doesn't have an interface to quickly retrieve the glyph height. */
/* The y~coordinate of the vertical origin can be simply computed as */
/* `vertBearingY + height' after loading a glyph. */
/* */
typedef struct FT_Glyph_Metrics_
{
FT_Pos width;
FT_Pos height;
FT_Pos horiBearingX;
FT_Pos horiBearingY;
FT_Pos horiAdvance;
FT_Pos vertBearingX;
FT_Pos vertBearingY;
FT_Pos vertAdvance;
} FT_Glyph_Metrics;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Bitmap_Size */
/* */
/* <Description> */
/* This structure models the metrics of a bitmap strike (i.e., a set */
/* of glyphs for a given point size and resolution) in a bitmap font. */
/* It is used for the `available_sizes' field of @FT_Face. */
/* */
/* <Fields> */
/* height :: The vertical distance, in pixels, between two */
/* consecutive baselines. It is always positive. */
/* */
/* width :: The average width, in pixels, of all glyphs in the */
/* strike. */
/* */
/* size :: The nominal size of the strike in 26.6 fractional */
/* points. This field is not very useful. */
/* */
/* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
/* pixels. */
/* */
/* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
/* pixels. */
/* */
/* <Note> */
/* Windows FNT: */
/* The nominal size given in a FNT font is not reliable. If the */
/* driver finds it incorrect, it sets `size' to some calculated */
/* values, and `x_ppem' and `y_ppem' to the pixel width and height */
/* given in the font, respectively. */
/* */
/* TrueType embedded bitmaps: */
/* `size', `width', and `height' values are not contained in the */
/* bitmap strike itself. They are computed from the global font */
/* parameters. */
/* */
typedef struct FT_Bitmap_Size_
{
FT_Short height;
FT_Short width;
FT_Pos size;
FT_Pos x_ppem;
FT_Pos y_ppem;
} FT_Bitmap_Size;
/*************************************************************************/
/*************************************************************************/
/* */
/* O B J E C T C L A S S E S */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Library */
/* */
/* <Description> */
/* A handle to a FreeType library instance. Each `library' is */
/* completely independent from the others; it is the `root' of a set */
/* of objects like fonts, faces, sizes, etc. */
/* */
/* It also embeds a memory manager (see @FT_Memory), as well as a */
/* scan-line converter object (see @FT_Raster). */
/* */
/* In multi-threaded applications it is easiest to use one */
/* `FT_Library' object per thread. In case this is too cumbersome, */
/* a single `FT_Library' object across threads is possible also */
/* (since FreeType version 2.5.6), as long as a mutex lock is used */
/* around @FT_New_Face and @FT_Done_Face. */
/* */
/* <Note> */
/* Library objects are normally created by @FT_Init_FreeType, and */
/* destroyed with @FT_Done_FreeType. If you need reference-counting */
/* (cf. @FT_Reference_Library), use @FT_New_Library and */
/* @FT_Done_Library. */
/* */
typedef struct FT_LibraryRec_ *FT_Library;
/*************************************************************************/
/* */
/* <Section> */
/* module_management */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Module */
/* */
/* <Description> */
/* A handle to a given FreeType module object. A module can be a */
/* font driver, a renderer, or anything else that provides services */
/* to the former. */
/* */
typedef struct FT_ModuleRec_* FT_Module;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Driver */
/* */
/* <Description> */
/* A handle to a given FreeType font driver object. A font driver */
/* is a module capable of creating faces from font files. */
/* */
typedef struct FT_DriverRec_* FT_Driver;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Renderer */
/* */
/* <Description> */
/* A handle to a given FreeType renderer. A renderer is a module in */
/* charge of converting a glyph's outline image to a bitmap. It */
/* supports a single glyph image format, and one or more target */
/* surface depths. */
/* */
typedef struct FT_RendererRec_* FT_Renderer;
/*************************************************************************/
/* */
/* <Section> */
/* base_interface */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Face */
/* */
/* <Description> */
/* A handle to a typographic face object. A face object models a */
/* given typeface, in a given style. */
/* */
/* <Note> */
/* A face object also owns a single @FT_GlyphSlot object, as well */
/* as one or more @FT_Size objects. */
/* */
/* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
/* a given filepath or a custom input stream. */
/* */
/* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
/* */
/* An `FT_Face' object can only be safely used from one thread at a */
/* time. Similarly, creation and destruction of `FT_Face' with the */
/* same @FT_Library object can only be done from one thread at a */
/* time. On the other hand, functions like @FT_Load_Glyph and its */
/* siblings are thread-safe and do not need the lock to be held as */
/* long as the same `FT_Face' object is not used from multiple */
/* threads at the same time. */
/* */
/* <Also> */
/* See @FT_FaceRec for the publicly accessible fields of a given face */
/* object. */
/* */
typedef struct FT_FaceRec_* FT_Face;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Size */
/* */
/* <Description> */
/* A handle to an object that models a face scaled to a given */
/* character size. */
/* */
/* <Note> */
/* An @FT_Face has one _active_ @FT_Size object that is used by */
/* functions like @FT_Load_Glyph to determine the scaling */
/* transformation that in turn is used to load and hint glyphs and */
/* metrics. */
/* */
/* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
/* @FT_Request_Size or even @FT_Select_Size to change the content */
/* (i.e., the scaling values) of the active @FT_Size. */
/* */
/* You can use @FT_New_Size to create additional size objects for a */
/* given @FT_Face, but they won't be used by other functions until */
/* you activate it through @FT_Activate_Size. Only one size can be */
/* activated at any given time per face. */
/* */
/* <Also> */
/* See @FT_SizeRec for the publicly accessible fields of a given size */
/* object. */
/* */
typedef struct FT_SizeRec_* FT_Size;
/*************************************************************************/
/* */
/* <Type> */
/* FT_GlyphSlot */
/* */
/* <Description> */
/* A handle to a given `glyph slot'. A slot is a container that can */
/* hold any of the glyphs contained in its parent face. */
/* */
/* In other words, each time you call @FT_Load_Glyph or */
/* @FT_Load_Char, the slot's content is erased by the new glyph data, */
/* i.e., the glyph's metrics, its image (bitmap or outline), and */
/* other control information. */
/* */
/* <Also> */
/* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
/* */
typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
/*************************************************************************/
/* */
/* <Type> */
/* FT_CharMap */
/* */
/* <Description> */
/* A handle to a character map (usually abbreviated to `charmap'). A */
/* charmap is used to translate character codes in a given encoding */
/* into glyph indexes for its parent's face. Some font formats may */
/* provide several charmaps per font. */
/* */
/* Each face object owns zero or more charmaps, but only one of them */
/* can be `active', providing the data used by @FT_Get_Char_Index or */
/* @FT_Load_Char. */
/* */
/* The list of available charmaps in a face is available through the */
/* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
/* */
/* The currently active charmap is available as `face->charmap'. */
/* You should call @FT_Set_Charmap to change it. */
/* */
/* <Note> */
/* When a new face is created (either through @FT_New_Face or */
/* @FT_Open_Face), the library looks for a Unicode charmap within */
/* the list and automatically activates it. If there is no Unicode */
/* charmap, FreeType doesn't set an `active' charmap. */
/* */
/* <Also> */
/* See @FT_CharMapRec for the publicly accessible fields of a given */
/* character map. */
/* */
typedef struct FT_CharMapRec_* FT_CharMap;
/*************************************************************************/
/* */
/* <Macro> */
/* FT_ENC_TAG */
/* */
/* <Description> */
/* This macro converts four-letter tags into an unsigned long. It is */
/* used to define `encoding' identifiers (see @FT_Encoding). */
/* */
/* <Note> */
/* Since many 16-bit compilers don't like 32-bit enumerations, you */
/* should redefine this macro in case of problems to something like */
/* this: */
/* */
/* { */
/* #define FT_ENC_TAG( value, a, b, c, d ) value */
/* } */
/* */
/* to get a simple enumeration without assigning special numbers. */
/* */
#ifndef FT_ENC_TAG
#define FT_ENC_TAG( value, a, b, c, d ) \
value = ( ( (FT_UInt32)(a) << 24 ) | \
( (FT_UInt32)(b) << 16 ) | \
( (FT_UInt32)(c) << 8 ) | \
(FT_UInt32)(d) )
#endif /* FT_ENC_TAG */
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Encoding */
/* */
/* <Description> */
/* An enumeration to specify character sets supported by charmaps. */
/* Used in the @FT_Select_Charmap API function. */
/* */
/* <Note> */
/* Despite the name, this enumeration lists specific character */
/* repertories (i.e., charsets), and not text encoding methods (e.g., */
/* UTF-8, UTF-16, etc.). */
/* */
/* Other encodings might be defined in the future. */
/* */
/* <Values> */
/* FT_ENCODING_NONE :: */
/* The encoding value~0 is reserved. */
/* */
/* FT_ENCODING_UNICODE :: */
/* The Unicode character set. This value covers all versions of */
/* the Unicode repertoire, including ASCII and Latin-1. Most fonts */
/* include a Unicode charmap, but not all of them. */
/* */
/* For example, if you want to access Unicode value U+1F028 (and */
/* the font contains it), use value 0x1F028 as the input value for */
/* @FT_Get_Char_Index. */
/* */
/* FT_ENCODING_MS_SYMBOL :: */
/* Microsoft Symbol encoding, used to encode mathematical symbols */
/* and wingdings. For more information, see */
/* `https://www.microsoft.com/typography/otspec/recom.htm', */
/* `http://www.kostis.net/charsets/symbol.htm', and */
/* `http://www.kostis.net/charsets/wingding.htm'. */
/* */
/* This encoding uses character codes from the PUA (Private Unicode */
/* Area) in the range U+F020-U+F0FF. */
/* */
/* FT_ENCODING_SJIS :: */
/* Shift JIS encoding for Japanese. More info at */
/* `https://en.wikipedia.org/wiki/Shift_JIS'. See note on */
/* multi-byte encodings below. */
/* */
/* FT_ENCODING_PRC :: */
/* Corresponds to encoding systems mainly for Simplified Chinese as */
/* used in People's Republic of China (PRC). The encoding layout */
/* is based on GB~2312 and its supersets GBK and GB~18030. */
/* */
/* FT_ENCODING_BIG5 :: */
/* Corresponds to an encoding system for Traditional Chinese as */
/* used in Taiwan and Hong Kong. */
/* */
/* FT_ENCODING_WANSUNG :: */
/* Corresponds to the Korean encoding system known as Extended */
/* Wansung (MS Windows code page 949). */
/* For more information see */
/* `https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */
/* */
/* FT_ENCODING_JOHAB :: */
/* The Korean standard character set (KS~C 5601-1992), which */
/* corresponds to MS Windows code page 1361. This character set */
/* includes all possible Hangul character combinations. */
/* */
/* FT_ENCODING_ADOBE_LATIN_1 :: */
/* Corresponds to a Latin-1 encoding as defined in a Type~1 */
/* PostScript font. It is limited to 256 character codes. */
/* */
/* FT_ENCODING_ADOBE_STANDARD :: */
/* Adobe Standard encoding, as found in Type~1, CFF, and */
/* OpenType/CFF fonts. It is limited to 256 character codes. */
/* */
/* FT_ENCODING_ADOBE_EXPERT :: */
/* Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF */
/* fonts. It is limited to 256 character codes. */
/* */
/* FT_ENCODING_ADOBE_CUSTOM :: */
/* Corresponds to a custom encoding, as found in Type~1, CFF, and */
/* OpenType/CFF fonts. It is limited to 256 character codes. */
/* */
/* FT_ENCODING_APPLE_ROMAN :: */
/* Apple roman encoding. Many TrueType and OpenType fonts contain */
/* a charmap for this 8-bit encoding, since older versions of Mac */
/* OS are able to use it. */
/* */
/* FT_ENCODING_OLD_LATIN_2 :: */
/* This value is deprecated and was neither used nor reported by */
/* FreeType. Don't use or test for it. */
/* */
/* FT_ENCODING_MS_SJIS :: */
/* Same as FT_ENCODING_SJIS. Deprecated. */
/* */
/* FT_ENCODING_MS_GB2312 :: */
/* Same as FT_ENCODING_PRC. Deprecated. */
/* */
/* FT_ENCODING_MS_BIG5 :: */
/* Same as FT_ENCODING_BIG5. Deprecated. */
/* */
/* FT_ENCODING_MS_WANSUNG :: */
/* Same as FT_ENCODING_WANSUNG. Deprecated. */
/* */
/* FT_ENCODING_MS_JOHAB :: */
/* Same as FT_ENCODING_JOHAB. Deprecated. */
/* */
/* <Note> */
/* By default, FreeType enables a Unicode charmap and tags it with */
/* FT_ENCODING_UNICODE when it is either provided or can be generated */
/* from PostScript glyph name dictionaries in the font file. */
/* All other encodings are considered legacy and tagged only if */
/* explicitly defined in the font file. Otherwise, FT_ENCODING_NONE */
/* is used. */
/* */
/* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
/* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
/* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
/* which encoding is really present. If, for example, the */
/* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
/* the font is encoded in KOI8-R. */
/* */
/* FT_ENCODING_NONE is always set (with a single exception) by the */
/* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
/* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
/* which encoding is really present. For example, */
/* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
/* Russian). */
/* */
/* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
/* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
/* FT_ENCODING_APPLE_ROMAN). */
/* */
/* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
/* @FT_Get_CMap_Language_ID to query the Mac language ID that may */
/* be needed to be able to distinguish Apple encoding variants. See */
/* */
/* https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
/* */
/* to get an idea how to do that. Basically, if the language ID */
/* is~0, don't use it, otherwise subtract 1 from the language ID. */
/* Then examine `encoding_id'. If, for example, `encoding_id' is */
/* `TT_MAC_ID_ROMAN' and the language ID (minus~1) is */
/* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
/* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */
/* variant the Arabic encoding. */
/* */
typedef enum FT_Encoding_
{
FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
FT_ENC_TAG( FT_ENCODING_PRC, 'g', 'b', ' ', ' ' ),
FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
/* for backward compatibility */
FT_ENCODING_GB2312 = FT_ENCODING_PRC,
FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,
FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
} FT_Encoding;
/* these constants are deprecated; use the corresponding `FT_Encoding' */
/* values instead */
#define ft_encoding_none FT_ENCODING_NONE
#define ft_encoding_unicode FT_ENCODING_UNICODE
#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
#define ft_encoding_sjis FT_ENCODING_SJIS
#define ft_encoding_gb2312 FT_ENCODING_PRC
#define ft_encoding_big5 FT_ENCODING_BIG5
#define ft_encoding_wansung FT_ENCODING_WANSUNG
#define ft_encoding_johab FT_ENCODING_JOHAB
#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
/*************************************************************************/
/* */
/* <Struct> */
/* FT_CharMapRec */
/* */
/* <Description> */
/* The base charmap structure. */
/* */
/* <Fields> */
/* face :: A handle to the parent face object. */
/* */
/* encoding :: An @FT_Encoding tag identifying the charmap. Use */
/* this with @FT_Select_Charmap. */
/* */
/* platform_id :: An ID number describing the platform for the */
/* following encoding ID. This comes directly from */
/* the TrueType specification and gets emulated for */
/* other formats. */
/* */
/* encoding_id :: A platform specific encoding number. This also */
/* comes from the TrueType specification and gets */
/* emulated similarly. */
/* */
typedef struct FT_CharMapRec_
{
FT_Face face;
FT_Encoding encoding;
FT_UShort platform_id;
FT_UShort encoding_id;
} FT_CharMapRec;
/*************************************************************************/
/*************************************************************************/
/* */
/* B A S E O B J E C T C L A S S E S */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Face_Internal */
/* */
/* <Description> */
/* An opaque handle to an `FT_Face_InternalRec' structure that models */
/* the private data of a given @FT_Face object. */
/* */
/* This structure might change between releases of FreeType~2 and is */
/* not generally available to client applications. */
/* */
typedef struct FT_Face_InternalRec_* FT_Face_Internal;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_FaceRec */
/* */
/* <Description> */
/* FreeType root face class structure. A face object models a */
/* typeface in a font file. */
/* */
/* <Fields> */
/* num_faces :: The number of faces in the font file. Some */
/* font formats can have multiple faces in */
/* a single font file. */
/* */
/* face_index :: This field holds two different values. */
/* Bits 0-15 are the index of the face in the */
/* font file (starting with value~0). They */
/* are set to~0 if there is only one face in */
/* the font file. */
/* */
/* [Since 2.6.1] Bits 16-30 are relevant to GX */
/* and OpenType variation fonts only, holding */
/* the named instance index for the current */
/* face index (starting with value~1; value~0 */
/* indicates font access without a named */
/* instance). For non-variation fonts, bits */
/* 16-30 are ignored. If we have the third */
/* named instance of face~4, say, `face_index' */
/* is set to 0x00030004. */
/* */
/* Bit 31 is always zero (this is, */
/* `face_index' is always a positive value). */
/* */
/* [Since 2.9] Changing the design coordinates */
/* with @FT_Set_Var_Design_Coordinates or */
/* @FT_Set_Var_Blend_Coordinates does not */
/* influence the named instance index value */
/* (only @FT_Set_Named_Instance does that). */
/* */
/* face_flags :: A set of bit flags that give important */
/* information about the face; see */
/* @FT_FACE_FLAG_XXX for the details. */
/* */
/* style_flags :: The lower 16~bits contain a set of bit */
/* flags indicating the style of the face; see */
/* @FT_STYLE_FLAG_XXX for the details. */
/* */
/* [Since 2.6.1] Bits 16-30 hold the number */
/* of named instances available for the */
/* current face if we have a GX or OpenType */
/* variation (sub)font. Bit 31 is always zero */
/* (this is, `style_flags' is always a */
/* positive value). Note that a variation */
/* font has always at least one named */
/* instance, namely the default instance. */
/* */
/* num_glyphs :: The number of glyphs in the face. If the */
/* face is scalable and has sbits (see */
/* `num_fixed_sizes'), it is set to the number */
/* of outline glyphs. */
/* */
/* For CID-keyed fonts (not in an SFNT */
/* wrapper) this value gives the highest CID */
/* used in the font. */
/* */
/* family_name :: The face's family name. This is an ASCII */
/* string, usually in English, that describes */
/* the typeface's family (like `Times New */
/* Roman', `Bodoni', `Garamond', etc). This */
/* is a least common denominator used to list */
/* fonts. Some formats (TrueType & OpenType) */
/* provide localized and Unicode versions of */
/* this string. Applications should use the */
/* format specific interface to access them. */
/* Can be NULL (e.g., in fonts embedded in a */
/* PDF file). */
/* */
/* In case the font doesn't provide a specific */
/* family name entry, FreeType tries to */
/* synthesize one, deriving it from other name */
/* entries. */
/* */
/* style_name :: The face's style name. This is an ASCII */
/* string, usually in English, that describes */
/* the typeface's style (like `Italic', */
/* `Bold', `Condensed', etc). Not all font */
/* formats provide a style name, so this field */
/* is optional, and can be set to NULL. As */
/* for `family_name', some formats provide */
/* localized and Unicode versions of this */
/* string. Applications should use the format */
/* specific interface to access them. */
/* */
/* num_fixed_sizes :: The number of bitmap strikes in the face. */
/* Even if the face is scalable, there might */
/* still be bitmap strikes, which are called */
/* `sbits' in that case. */
/* */
/* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
/* strikes in the face. It is set to NULL if */
/* there is no bitmap strike. */
/* */
/* Note that FreeType tries to sanitize the */
/* strike data since they are sometimes sloppy */
/* or incorrect, but this can easily fail. */
/* */
/* num_charmaps :: The number of charmaps in the face. */
/* */
/* charmaps :: An array of the charmaps of the face. */
/* */
/* generic :: A field reserved for client uses. See the */
/* @FT_Generic type description. */
/* */
/* bbox :: The font bounding box. Coordinates are */
/* expressed in font units (see */
/* `units_per_EM'). The box is large enough */
/* to contain any glyph from the font. Thus, */
/* `bbox.yMax' can be seen as the `maximum */
/* ascender', and `bbox.yMin' as the `minimum */
/* descender'. Only relevant for scalable */
/* formats. */
/* */
/* Note that the bounding box might be off by */
/* (at least) one pixel for hinted fonts. See */
/* @FT_Size_Metrics for further discussion. */
/* */
/* units_per_EM :: The number of font units per EM square for */
/* this face. This is typically 2048 for */
/* TrueType fonts, and 1000 for Type~1 fonts. */
/* Only relevant for scalable formats. */
/* */
/* ascender :: The typographic ascender of the face, */
/* expressed in font units. For font formats */
/* not having this information, it is set to */
/* `bbox.yMax'. Only relevant for scalable */
/* formats. */
/* */
/* descender :: The typographic descender of the face, */
/* expressed in font units. For font formats */
/* not having this information, it is set to */
/* `bbox.yMin'. Note that this field is */
/* negative for values below the baseline. */
/* Only relevant for scalable formats. */
/* */
/* height :: This value is the vertical distance */
/* between two consecutive baselines, */
/* expressed in font units. It is always */
/* positive. Only relevant for scalable */
/* formats. */
/* */
/* If you want the global glyph height, use */
/* `ascender - descender'. */
/* */
/* max_advance_width :: The maximum advance width, in font units, */
/* for all glyphs in this face. This can be */
/* used to make word wrapping computations */
/* faster. Only relevant for scalable */
/* formats. */
/* */
/* max_advance_height :: The maximum advance height, in font units, */
/* for all glyphs in this face. This is only */
/* relevant for vertical layouts, and is set */
/* to `height' for fonts that do not provide */
/* vertical metrics. Only relevant for */
/* scalable formats. */
/* */
/* underline_position :: The position, in font units, of the */
/* underline line for this face. It is the */
/* center of the underlining stem. Only */
/* relevant for scalable formats. */
/* */
/* underline_thickness :: The thickness, in font units, of the */
/* underline for this face. Only relevant for */
/* scalable formats. */
/* */
/* glyph :: The face's associated glyph slot(s). */
/* */
/* size :: The current active size for this face. */
/* */
/* charmap :: The current active charmap for this face. */
/* */
/* <Note> */
/* Fields may be changed after a call to @FT_Attach_File or */
/* @FT_Attach_Stream. */
/* */
/* For an OpenType variation font, the values of the following fields */
/* can change after a call to @FT_Set_Var_Design_Coordinates (and */
/* friends) if the font contains an `MVAR' table: `ascender', */
/* `descender', `height', `underline_position', and */
/* `underline_thickness'. */
/* */
/* Especially for TrueType fonts see also the documentation for */
/* @FT_Size_Metrics. */
/* */
typedef struct FT_FaceRec_
{
FT_Long num_faces;
FT_Long face_index;
FT_Long face_flags;
FT_Long style_flags;
FT_Long num_glyphs;
FT_String* family_name;
FT_String* style_name;
FT_Int num_fixed_sizes;
FT_Bitmap_Size* available_sizes;
FT_Int num_charmaps;
FT_CharMap* charmaps;
FT_Generic generic;
/*# The following member variables (down to `underline_thickness') */
/*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
/*# for bitmap fonts. */
FT_BBox bbox;
FT_UShort units_per_EM;
FT_Short ascender;
FT_Short descender;
FT_Short height;
FT_Short max_advance_width;
FT_Short max_advance_height;
FT_Short underline_position;
FT_Short underline_thickness;
FT_GlyphSlot glyph;
FT_Size size;
FT_CharMap charmap;
/*@private begin */
FT_Driver driver;
FT_Memory memory;
FT_Stream stream;
FT_ListRec sizes_list;
FT_Generic autohint; /* face-specific auto-hinter data */
void* extensions; /* unused */
FT_Face_Internal internal;
/*@private end */
} FT_FaceRec;
/*************************************************************************/
/* */
/* <Enum> */
/* FT_FACE_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flags used in the `face_flags' field of the */
/* @FT_FaceRec structure. They inform client applications of */
/* properties of the corresponding face. */
/* */
/* <Values> */
/* FT_FACE_FLAG_SCALABLE :: */
/* The face contains outline glyphs. Note that a face can contain */
/* bitmap strikes also, i.e., a face can have both this flag and */
/* @FT_FACE_FLAG_FIXED_SIZES set. */
/* */
/* FT_FACE_FLAG_FIXED_SIZES :: */
/* The face contains bitmap strikes. See also the */
/* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
/* */
/* FT_FACE_FLAG_FIXED_WIDTH :: */
/* The face contains fixed-width characters (like Courier, Lucida, */
/* MonoType, etc.). */
/* */
/* FT_FACE_FLAG_SFNT :: */
/* The face uses the SFNT storage scheme. For now, this means */
/* TrueType and OpenType. */
/* */
/* FT_FACE_FLAG_HORIZONTAL :: */
/* The face contains horizontal glyph metrics. This should be set */
/* for all common formats. */
/* */
/* FT_FACE_FLAG_VERTICAL :: */
/* The face contains vertical glyph metrics. This is only */
/* available in some formats, not all of them. */
/* */
/* FT_FACE_FLAG_KERNING :: */
/* The face contains kerning information. If set, the kerning */
/* distance can be retrieved using the function @FT_Get_Kerning. */
/* Otherwise the function always return the vector (0,0). Note */
/* that FreeType doesn't handle kerning data from the SFNT `GPOS' */
/* table (as present in many OpenType fonts). */
/* */
/* FT_FACE_FLAG_FAST_GLYPHS :: */
/* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
/* */
/* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
/* The face contains multiple masters and is capable of */
/* interpolating between them. Supported formats are Adobe MM, */
/* TrueType GX, and OpenType variation fonts. */
/* */
/* See section @multiple_masters for API details. */
/* */
/* FT_FACE_FLAG_GLYPH_NAMES :: */
/* The face contains glyph names, which can be retrieved using */
/* @FT_Get_Glyph_Name. Note that some TrueType fonts contain */
/* broken glyph name tables. Use the function */
/* @FT_Has_PS_Glyph_Names when needed. */
/* */
/* FT_FACE_FLAG_EXTERNAL_STREAM :: */
/* Used internally by FreeType to indicate that a face's stream was */
/* provided by the client application and should not be destroyed */
/* when @FT_Done_Face is called. Don't read or test this flag. */
/* */
/* FT_FACE_FLAG_HINTER :: */
/* The font driver has a hinting machine of its own. For example, */
/* with TrueType fonts, it makes sense to use data from the SFNT */
/* `gasp' table only if the native TrueType hinting engine (with */
/* the bytecode interpreter) is available and active. */
/* */
/* FT_FACE_FLAG_CID_KEYED :: */
/* The face is CID-keyed. In that case, the face is not accessed */
/* by glyph indices but by CID values. For subsetted CID-keyed */
/* fonts this has the consequence that not all index values are a */
/* valid argument to @FT_Load_Glyph. Only the CID values for which */
/* corresponding glyphs in the subsetted font exist make */
/* `FT_Load_Glyph' return successfully; in all other cases you get */
/* an `FT_Err_Invalid_Argument' error. */
/* */
/* Note that CID-keyed fonts that are in an SFNT wrapper (this is, */
/* all OpenType/CFF fonts) don't have this flag set since the */
/* glyphs are accessed in the normal way (using contiguous */
/* indices); the `CID-ness' isn't visible to the application. */
/* */
/* FT_FACE_FLAG_TRICKY :: */
/* The face is `tricky', this is, it always needs the font format's */
/* native hinting engine to get a reasonable result. A typical */
/* example is the old Chinese font `mingli.ttf' (but not */
/* `mingliu.ttc') that uses TrueType bytecode instructions to move */
/* and scale all of its subglyphs. */
/* */
/* It is not possible to auto-hint such fonts using */
/* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
/* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
/* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
/* probably never want this except for demonstration purposes. */
/* */
/* Currently, there are about a dozen TrueType fonts in the list of */
/* tricky fonts; they are hard-coded in file `ttobjs.c'. */
/* */
/* FT_FACE_FLAG_COLOR :: */
/* [Since 2.5.1] The face has color glyph tables. To access color */
/* glyphs use @FT_LOAD_COLOR. */
/* */
/* FT_FACE_FLAG_VARIATION :: */
/* [Since 2.9] Set if the current face (or named instance) has been */
/* altered with @FT_Set_MM_Design_Coordinates, */
/* @FT_Set_Var_Design_Coordinates, or */
/* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */
/* @FT_Set_Named_Instance. */
/* */
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
#define FT_FACE_FLAG_SFNT ( 1L << 3 )
#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
#define FT_FACE_FLAG_KERNING ( 1L << 6 )
#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
#define FT_FACE_FLAG_HINTER ( 1L << 11 )
#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
#define FT_FACE_FLAG_COLOR ( 1L << 14 )
#define FT_FACE_FLAG_VARIATION ( 1L << 15 )
/*************************************************************************
*
* @macro:
* FT_HAS_HORIZONTAL( face )
*
* @description:
* A macro that returns true whenever a face object contains
* horizontal metrics (this is true for all font formats though).
*
* @also:
* @FT_HAS_VERTICAL can be used to check for vertical metrics.
*
*/
#define FT_HAS_HORIZONTAL( face ) \
( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
/*************************************************************************
*
* @macro:
* FT_HAS_VERTICAL( face )
*
* @description:
* A macro that returns true whenever a face object contains real
* vertical metrics (and not only synthesized ones).
*
*/
#define FT_HAS_VERTICAL( face ) \
( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
/*************************************************************************
*
* @macro:
* FT_HAS_KERNING( face )
*
* @description:
* A macro that returns true whenever a face object contains kerning
* data that can be accessed with @FT_Get_Kerning.
*
*/
#define FT_HAS_KERNING( face ) \
( (face)->face_flags & FT_FACE_FLAG_KERNING )
/*************************************************************************
*
* @macro:
* FT_IS_SCALABLE( face )
*
* @description:
* A macro that returns true whenever a face object contains a scalable
* font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
* and PFR font formats).
*
*/
#define FT_IS_SCALABLE( face ) \
( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
/*************************************************************************
*
* @macro:
* FT_IS_SFNT( face )
*
* @description:
* A macro that returns true whenever a face object contains a font
* whose format is based on the SFNT storage scheme. This usually
* means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
* bitmap fonts.
*
* If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
* @FT_TRUETYPE_TABLES_H are available.
*
*/
#define FT_IS_SFNT( face ) \
( (face)->face_flags & FT_FACE_FLAG_SFNT )
/*************************************************************************
*
* @macro:
* FT_IS_FIXED_WIDTH( face )
*
* @description:
* A macro that returns true whenever a face object contains a font face
* that contains fixed-width (or `monospace', `fixed-pitch', etc.)
* glyphs.
*
*/
#define FT_IS_FIXED_WIDTH( face ) \
( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
/*************************************************************************
*
* @macro:
* FT_HAS_FIXED_SIZES( face )
*
* @description:
* A macro that returns true whenever a face object contains some
* embedded bitmaps. See the `available_sizes' field of the
* @FT_FaceRec structure.
*
*/
#define FT_HAS_FIXED_SIZES( face ) \
( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
/*************************************************************************
*
* @macro:
* FT_HAS_FAST_GLYPHS( face )
*
* @description:
* Deprecated.
*
*/
#define FT_HAS_FAST_GLYPHS( face ) 0
/*************************************************************************
*
* @macro:
* FT_HAS_GLYPH_NAMES( face )
*
* @description:
* A macro that returns true whenever a face object contains some glyph
* names that can be accessed through @FT_Get_Glyph_Name.
*
*/
#define FT_HAS_GLYPH_NAMES( face ) \
( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
/*************************************************************************
*
* @macro:
* FT_HAS_MULTIPLE_MASTERS( face )
*
* @description:
* A macro that returns true whenever a face object contains some
* multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
* are then available to choose the exact design you want.
*
*/
#define FT_HAS_MULTIPLE_MASTERS( face ) \
( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
/*************************************************************************
*
* @macro:
* FT_IS_NAMED_INSTANCE( face )
*
* @description:
* A macro that returns true whenever a face object is a named instance
* of a GX or OpenType variation font.
*
* [Since 2.9] Changing the design coordinates with
* @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
* not influence the return value of this macro (only
* @FT_Set_Named_Instance does that).
*
* @since:
* 2.7
*
*/
#define FT_IS_NAMED_INSTANCE( face ) \
( (face)->face_index & 0x7FFF0000L )
/*************************************************************************
*
* @macro:
* FT_IS_VARIATION( face )
*
* @description:
* A macro that returns true whenever a face object has been altered
* by @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or
* @FT_Set_Var_Blend_Coordinates.
*
* @since:
* 2.9
*
*/
#define FT_IS_VARIATION( face ) \
( (face)->face_flags & FT_FACE_FLAG_VARIATION )
/*************************************************************************
*
* @macro:
* FT_IS_CID_KEYED( face )
*
* @description:
* A macro that returns true whenever a face object contains a CID-keyed
* font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
* details.
*
* If this macro is true, all functions defined in @FT_CID_H are
* available.
*
*/
#define FT_IS_CID_KEYED( face ) \
( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
/*************************************************************************
*
* @macro:
* FT_IS_TRICKY( face )
*
* @description:
* A macro that returns true whenever a face represents a `tricky' font.
* See the discussion of @FT_FACE_FLAG_TRICKY for more details.
*
*/
#define FT_IS_TRICKY( face ) \
( (face)->face_flags & FT_FACE_FLAG_TRICKY )
/*************************************************************************
*
* @macro:
* FT_HAS_COLOR( face )
*
* @description:
* A macro that returns true whenever a face object contains
* tables for color glyphs.
*
* @since:
* 2.5.1
*
*/
#define FT_HAS_COLOR( face ) \
( (face)->face_flags & FT_FACE_FLAG_COLOR )
/*************************************************************************/
/* */
/* <Const> */
/* FT_STYLE_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flags to indicate the style of a given face. These */
/* are used in the `style_flags' field of @FT_FaceRec. */
/* */
/* <Values> */
/* FT_STYLE_FLAG_ITALIC :: */
/* The face style is italic or oblique. */
/* */
/* FT_STYLE_FLAG_BOLD :: */
/* The face is bold. */
/* */
/* <Note> */
/* The style information as provided by FreeType is very basic. More */
/* details are beyond the scope and should be done on a higher level */
/* (for example, by analyzing various fields of the `OS/2' table in */
/* SFNT based fonts). */
/* */
#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
#define FT_STYLE_FLAG_BOLD ( 1 << 1 )
/*************************************************************************/
/* */
/* <Type> */
/* FT_Size_Internal */
/* */
/* <Description> */
/* An opaque handle to an `FT_Size_InternalRec' structure, used to */
/* model private data of a given @FT_Size object. */
/* */
typedef struct FT_Size_InternalRec_* FT_Size_Internal;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Size_Metrics */
/* */
/* <Description> */
/* The size metrics structure gives the metrics of a size object. */
/* */
/* <Fields> */
/* x_ppem :: The width of the scaled EM square in pixels, hence */
/* the term `ppem' (pixels per EM). It is also */
/* referred to as `nominal width'. */
/* */
/* y_ppem :: The height of the scaled EM square in pixels, */
/* hence the term `ppem' (pixels per EM). It is also */
/* referred to as `nominal height'. */
/* */
/* x_scale :: A 16.16 fractional scaling value to convert */
/* horizontal metrics from font units to 26.6 */
/* fractional pixels. Only relevant for scalable */
/* font formats. */
/* */
/* y_scale :: A 16.16 fractional scaling value to convert */
/* vertical metrics from font units to 26.6 */
/* fractional pixels. Only relevant for scalable */
/* font formats. */
/* */
/* ascender :: The ascender in 26.6 fractional pixels, rounded up */
/* to an integer value. See @FT_FaceRec for the */
/* details. */
/* */
/* descender :: The descender in 26.6 fractional pixels, rounded */
/* down to an integer value. See @FT_FaceRec for the */
/* details. */
/* */
/* height :: The height in 26.6 fractional pixels, rounded to */
/* an integer value. See @FT_FaceRec for the */
/* details. */
/* */
/* max_advance :: The maximum advance width in 26.6 fractional */
/* pixels, rounded to an integer value. See */
/* @FT_FaceRec for the details. */
/* */
/* <Note> */
/* The scaling values, if relevant, are determined first during a */
/* size changing operation. The remaining fields are then set by the */
/* driver. For scalable formats, they are usually set to scaled */
/* values of the corresponding fields in @FT_FaceRec. Some values */
/* like ascender or descender are rounded for historical reasons; */
/* more precise values (for outline fonts) can be derived by scaling */
/* the corresponding @FT_FaceRec values manually, with code similar */
/* to the following. */
/* */
/* { */
/* scaled_ascender = FT_MulFix( face->ascender, */
/* size_metrics->y_scale ); */
/* } */
/* */
/* Note that due to glyph hinting and the selected rendering mode */
/* these values are usually not exact; consequently, they must be */
/* treated as unreliable with an error margin of at least one pixel! */
/* */
/* Indeed, the only way to get the exact metrics is to render _all_ */
/* glyphs. As this would be a definite performance hit, it is up to */
/* client applications to perform such computations. */
/* */
/* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */
/* */
/* */
/* *TrueType* *fonts* *with* *native* *bytecode* *hinting* */
/* */
/* All applications that handle TrueType fonts with native hinting */
/* must be aware that TTFs expect different rounding of vertical font */
/* dimensions. The application has to cater for this, especially if */
/* it wants to rely on a TTF's vertical data (for example, to */
/* properly align box characters vertically). */
/* */
/* Only the application knows _in_ _advance_ that it is going to use */
/* native hinting for TTFs! FreeType, on the other hand, selects the */
/* hinting mode not at the time of creating an @FT_Size object but */
/* much later, namely while calling @FT_Load_Glyph. */
/* */
/* Here is some pseudo code that illustrates a possible solution. */
/* */
/* { */
/* font_format = FT_Get_Font_Format( face ); */
/* */
/* if ( !strcmp( font_format, "TrueType" ) && */
/* do_native_bytecode_hinting ) */
/* { */
/* ascender = ROUND( FT_MulFix( face->ascender, */
/* size_metrics->y_scale ) ); */
/* descender = ROUND( FT_MulFix( face->descender, */
/* size_metrics->y_scale ) ); */
/* } */
/* else */
/* { */
/* ascender = size_metrics->ascender; */
/* descender = size_metrics->descender; */
/* } */
/* */
/* height = size_metrics->height; */
/* max_advance = size_metrics->max_advance; */
/* } */
/* */
typedef struct FT_Size_Metrics_
{
FT_UShort x_ppem; /* horizontal pixels per EM */
FT_UShort y_ppem; /* vertical pixels per EM */
FT_Fixed x_scale; /* scaling values used to convert font */
FT_Fixed y_scale; /* units to 26.6 fractional pixels */
FT_Pos ascender; /* ascender in 26.6 frac. pixels */
FT_Pos descender; /* descender in 26.6 frac. pixels */
FT_Pos height; /* text height in 26.6 frac. pixels */
FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
} FT_Size_Metrics;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_SizeRec */
/* */
/* <Description> */
/* FreeType root size class structure. A size object models a face */
/* object at a given size. */
/* */
/* <Fields> */
/* face :: Handle to the parent face object. */
/* */
/* generic :: A typeless pointer, unused by the FreeType library or */
/* any of its drivers. It can be used by client */
/* applications to link their own data to each size */
/* object. */
/* */
/* metrics :: Metrics for this size object. This field is read-only. */
/* */
typedef struct FT_SizeRec_
{
FT_Face face; /* parent face object */
FT_Generic generic; /* generic pointer for client uses */
FT_Size_Metrics metrics; /* size metrics */
FT_Size_Internal internal;
} FT_SizeRec;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_SubGlyph */
/* */
/* <Description> */
/* The subglyph structure is an internal object used to describe */
/* subglyphs (for example, in the case of composites). */
/* */
/* <Note> */
/* The subglyph implementation is not part of the high-level API, */
/* hence the forward structure declaration. */
/* */
/* You can however retrieve subglyph information with */
/* @FT_Get_SubGlyph_Info. */
/* */
typedef struct FT_SubGlyphRec_* FT_SubGlyph;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Slot_Internal */
/* */
/* <Description> */
/* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
/* model private data of a given @FT_GlyphSlot object. */
/* */
typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_GlyphSlotRec */
/* */
/* <Description> */
/* FreeType root glyph slot class structure. A glyph slot is a */
/* container where individual glyphs can be loaded, be they in */
/* outline or bitmap format. */
/* */
/* <Fields> */
/* library :: A handle to the FreeType library instance */
/* this slot belongs to. */
/* */
/* face :: A handle to the parent face object. */
/* */
/* next :: In some cases (like some font tools), several */
/* glyph slots per face object can be a good */
/* thing. As this is rare, the glyph slots are */
/* listed through a direct, single-linked list */
/* using its `next' field. */
/* */
/* generic :: A typeless pointer unused by the FreeType */
/* library or any of its drivers. It can be */
/* used by client applications to link their own */
/* data to each glyph slot object. */
/* */
/* metrics :: The metrics of the last loaded glyph in the */
/* slot. The returned values depend on the last */
/* load flags (see the @FT_Load_Glyph API */
/* function) and can be expressed either in 26.6 */
/* fractional pixels or font units. */
/* */
/* Note that even when the glyph image is */
/* transformed, the metrics are not. */
/* */
/* linearHoriAdvance :: The advance width of the unhinted glyph. */
/* Its value is expressed in 16.16 fractional */
/* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
/* when loading the glyph. This field can be */
/* important to perform correct WYSIWYG layout. */
/* Only relevant for outline glyphs. */
/* */
/* linearVertAdvance :: The advance height of the unhinted glyph. */
/* Its value is expressed in 16.16 fractional */
/* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
/* when loading the glyph. This field can be */
/* important to perform correct WYSIWYG layout. */
/* Only relevant for outline glyphs. */
/* */
/* advance :: This shorthand is, depending on */
/* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
/* (hinted) advance width for the glyph, in 26.6 */
/* fractional pixel format. As specified with */
/* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
/* `horiAdvance' or the `vertAdvance' value of */
/* `metrics' field. */
/* */
/* format :: This field indicates the format of the image */
/* contained in the glyph slot. Typically */
/* @FT_GLYPH_FORMAT_BITMAP, */
/* @FT_GLYPH_FORMAT_OUTLINE, or */
/* @FT_GLYPH_FORMAT_COMPOSITE, but other values */
/* are possible. */
/* */
/* bitmap :: This field is used as a bitmap descriptor. */
/* Note that the address and content of the */
/* bitmap buffer can change between calls of */
/* @FT_Load_Glyph and a few other functions. */
/* */
/* bitmap_left :: The bitmap's left bearing expressed in */
/* integer pixels. */
/* */
/* bitmap_top :: The bitmap's top bearing expressed in integer */
/* pixels. This is the distance from the */
/* baseline to the top-most glyph scanline, */
/* upwards y~coordinates being *positive*. */
/* */
/* outline :: The outline descriptor for the current glyph */
/* image if its format is */
/* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
/* loaded, `outline' can be transformed, */
/* distorted, emboldened, etc. However, it must */
/* not be freed. */
/* */
/* num_subglyphs :: The number of subglyphs in a composite glyph. */
/* This field is only valid for the composite */
/* glyph format that should normally only be */
/* loaded with the @FT_LOAD_NO_RECURSE flag. */
/* */
/* subglyphs :: An array of subglyph descriptors for */
/* composite glyphs. There are `num_subglyphs' */
/* elements in there. Currently internal to */
/* FreeType. */
/* */
/* control_data :: Certain font drivers can also return the */
/* control data for a given glyph image (e.g. */
/* TrueType bytecode, Type~1 charstrings, etc.). */
/* This field is a pointer to such data; it is */
/* currently internal to FreeType. */
/* */
/* control_len :: This is the length in bytes of the control */
/* data. Currently internal to FreeType. */
/* */
/* other :: Reserved. */
/* */
/* lsb_delta :: The difference between hinted and unhinted */
/* left side bearing while auto-hinting is */
/* active. Zero otherwise. */
/* */
/* rsb_delta :: The difference between hinted and unhinted */
/* right side bearing while auto-hinting is */
/* active. Zero otherwise. */
/* */
/* <Note> */
/* If @FT_Load_Glyph is called with default flags (see */
/* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
/* its native format (e.g., an outline glyph for TrueType and Type~1 */
/* formats). [Since 2.9] The prospective bitmap metrics are */
/* calculated according to @FT_LOAD_TARGET_XXX and other flags even */
/* for the outline glyph, even if @FT_LOAD_RENDER is not set. */
/* */
/* This image can later be converted into a bitmap by calling */
/* @FT_Render_Glyph. This function searches the current renderer for */
/* the native image's format, then invokes it. */
/* */
/* The renderer is in charge of transforming the native image through */
/* the slot's face transformation fields, then converting it into a */
/* bitmap that is returned in `slot->bitmap'. */
/* */
/* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
/* to specify the position of the bitmap relative to the current pen */
/* position (e.g., coordinates (0,0) on the baseline). Of course, */
/* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
/* */
/* Here is a small pseudo code fragment that shows how to use */
/* `lsb_delta' and `rsb_delta' to do fractional positioning of */
/* glyphs: */
/* */
/* { */
/* FT_GlyphSlot slot = face->glyph; */
/* FT_Pos origin_x = 0; */
/* */
/* */
/* for all glyphs do */
/* <load glyph with `FT_Load_Glyph'> */
/* */
/* FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); */
/* */
/* <save glyph image, or render glyph, or ...> */
/* */
/* <compute kern between current and next glyph */
/* and add it to `origin_x'> */
/* */
/* origin_x += slot->advance.x; */
/* origin_x += slot->rsb_delta - slot->lsb_delta; */
/* endfor */
/* } */
/* */
/* Here is another small pseudo code fragment that shows how to use */
/* `lsb_delta' and `rsb_delta' to improve integer positioning of */
/* glyphs: */
/* */
/* { */
/* FT_GlyphSlot slot = face->glyph; */
/* FT_Pos origin_x = 0; */
/* FT_Pos prev_rsb_delta = 0; */
/* */
/* */
/* for all glyphs do */
/* <compute kern between current and previous glyph */
/* and add it to `origin_x'> */
/* */
/* <load glyph with `FT_Load_Glyph'> */
/* */
/* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */
/* origin_x -= 64; */
/* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */
/* origin_x += 64; */
/* */
/* prev_rsb_delta = slot->rsb_delta; */
/* */
/* <save glyph image, or render glyph, or ...> */
/* */
/* origin_x += slot->advance.x; */
/* endfor */
/* } */
/* */
/* If you use strong auto-hinting, you *must* apply these delta */
/* values! Otherwise you will experience far too large inter-glyph */
/* spacing at small rendering sizes in most cases. Note that it */
/* doesn't harm to use the above code for other hinting modes also, */
/* since the delta values are zero then. */
/* */
typedef struct FT_GlyphSlotRec_
{
FT_Library library;
FT_Face face;
FT_GlyphSlot next;
FT_UInt reserved; /* retained for binary compatibility */
FT_Generic generic;
FT_Glyph_Metrics metrics;
FT_Fixed linearHoriAdvance;
FT_Fixed linearVertAdvance;
FT_Vector advance;
FT_Glyph_Format format;
FT_Bitmap bitmap;
FT_Int bitmap_left;
FT_Int bitmap_top;
FT_Outline outline;
FT_UInt num_subglyphs;
FT_SubGlyph subglyphs;
void* control_data;
long control_len;
FT_Pos lsb_delta;
FT_Pos rsb_delta;
void* other;
FT_Slot_Internal internal;
} FT_GlyphSlotRec;
/*************************************************************************/
/*************************************************************************/
/* */
/* F U N C T I O N S */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Init_FreeType */
/* */
/* <Description> */
/* Initialize a new FreeType library object. The set of modules */
/* that are registered by this function is determined at build time. */
/* */
/* <Output> */
/* alibrary :: A handle to a new library object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* In case you want to provide your own memory allocating routines, */
/* use @FT_New_Library instead, followed by a call to */
/* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module) */
/* and @FT_Set_Default_Properties. */
/* */
/* See the documentation of @FT_Library and @FT_Face for */
/* multi-threading issues. */
/* */
/* If you need reference-counting (cf. @FT_Reference_Library), use */
/* @FT_New_Library and @FT_Done_Library. */
/* */
/* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */
/* set, this function reads the `FREETYPE_PROPERTIES' environment */
/* variable to control driver properties. See section @properties */
/* for more. */
/* */
FT_EXPORT( FT_Error )
FT_Init_FreeType( FT_Library *alibrary );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_FreeType */
/* */
/* <Description> */
/* Destroy a given FreeType library object and all of its children, */
/* including resources, drivers, faces, sizes, etc. */
/* */
/* <Input> */
/* library :: A handle to the target library object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Done_FreeType( FT_Library library );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_OPEN_XXX */
/* */
/* <Description> */
/* A list of bit field constants used within the `flags' field of the */
/* @FT_Open_Args structure. */
/* */
/* <Values> */
/* FT_OPEN_MEMORY :: This is a memory-based stream. */
/* */
/* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
/* */
/* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
/* name. */
/* */
/* FT_OPEN_DRIVER :: Use the `driver' field. */
/* */
/* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
/* */
/* <Note> */
/* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
/* flags are mutually exclusive. */
/* */
#define FT_OPEN_MEMORY 0x1
#define FT_OPEN_STREAM 0x2
#define FT_OPEN_PATHNAME 0x4
#define FT_OPEN_DRIVER 0x8
#define FT_OPEN_PARAMS 0x10
/* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */
/* values instead */
#define ft_open_memory FT_OPEN_MEMORY
#define ft_open_stream FT_OPEN_STREAM
#define ft_open_pathname FT_OPEN_PATHNAME
#define ft_open_driver FT_OPEN_DRIVER
#define ft_open_params FT_OPEN_PARAMS
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Parameter */
/* */
/* <Description> */
/* A simple structure to pass more or less generic parameters to */
/* @FT_Open_Face and @FT_Face_Properties. */
/* */
/* <Fields> */
/* tag :: A four-byte identification tag. */
/* */
/* data :: A pointer to the parameter data. */
/* */
/* <Note> */
/* The ID and function of parameters are driver-specific. See */
/* section @parameter_tags for more information. */
/* */
typedef struct FT_Parameter_
{
FT_ULong tag;
FT_Pointer data;
} FT_Parameter;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Open_Args */
/* */
/* <Description> */
/* A structure to indicate how to open a new font file or stream. A */
/* pointer to such a structure can be used as a parameter for the */
/* functions @FT_Open_Face and @FT_Attach_Stream. */
/* */
/* <Fields> */
/* flags :: A set of bit flags indicating how to use the */
/* structure. */
/* */
/* memory_base :: The first byte of the file in memory. */
/* */
/* memory_size :: The size in bytes of the file in memory. */
/* */
/* pathname :: A pointer to an 8-bit file pathname. */
/* */
/* stream :: A handle to a source stream object. */
/* */
/* driver :: This field is exclusively used by @FT_Open_Face; */
/* it simply specifies the font driver to use for */
/* opening the face. If set to NULL, FreeType tries */
/* to load the face with each one of the drivers in */
/* its list. */
/* */
/* num_params :: The number of extra parameters. */
/* */
/* params :: Extra parameters passed to the font driver when */
/* opening a new face. */
/* */
/* <Note> */
/* The stream type is determined by the contents of `flags' that */
/* are tested in the following order by @FT_Open_Face: */
/* */
/* If the @FT_OPEN_MEMORY bit is set, assume that this is a */
/* memory file of `memory_size' bytes, located at `memory_address'. */
/* The data are not copied, and the client is responsible for */
/* releasing and destroying them _after_ the corresponding call to */
/* @FT_Done_Face. */
/* */
/* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a */
/* custom input stream `stream' is used. */
/* */
/* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this */
/* is a normal file and use `pathname' to open it. */
/* */
/* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to */
/* open the file with the driver whose handler is in `driver'. */
/* */
/* If the @FT_OPEN_PARAMS bit is set, the parameters given by */
/* `num_params' and `params' is used. They are ignored otherwise. */
/* */
/* Ideally, both the `pathname' and `params' fields should be tagged */
/* as `const'; this is missing for API backward compatibility. In */
/* other words, applications should treat them as read-only. */
/* */
typedef struct FT_Open_Args_
{
FT_UInt flags;
const FT_Byte* memory_base;
FT_Long memory_size;
FT_String* pathname;
FT_Stream stream;
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
} FT_Open_Args;
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Face */
/* */
/* <Description> */
/* Call @FT_Open_Face to open a font by its pathname. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* pathname :: A path to the font file. */
/* */
/* face_index :: See @FT_Open_Face for a detailed description of this */
/* parameter. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. If `face_index' is */
/* greater than or equal to zero, it must be non-NULL. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Use @FT_Done_Face to destroy the created @FT_Face object (along */
/* with its slot and sizes). */
/* */
FT_EXPORT( FT_Error )
FT_New_Face( FT_Library library,
const char* filepathname,
FT_Long face_index,
FT_Face *aface );
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Memory_Face */
/* */
/* <Description> */
/* Call @FT_Open_Face to open a font that has been loaded into */
/* memory. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* file_base :: A pointer to the beginning of the font data. */
/* */
/* file_size :: The size of the memory chunk used by the font data. */
/* */
/* face_index :: See @FT_Open_Face for a detailed description of this */
/* parameter. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. If `face_index' is */
/* greater than or equal to zero, it must be non-NULL. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You must not deallocate the memory before calling @FT_Done_Face. */
/* */
FT_EXPORT( FT_Error )
FT_New_Memory_Face( FT_Library library,
const FT_Byte* file_base,
FT_Long file_size,
FT_Long face_index,
FT_Face *aface );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Open_Face */
/* */
/* <Description> */
/* Create a face object from a given resource described by */
/* @FT_Open_Args. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* args :: A pointer to an `FT_Open_Args' structure that must */
/* be filled by the caller. */
/* */
/* face_index :: This field holds two different values. Bits 0-15 */
/* are the index of the face in the font file (starting */
/* with value~0). Set it to~0 if there is only one */
/* face in the font file. */
/* */
/* [Since 2.6.1] Bits 16-30 are relevant to GX and */
/* OpenType variation fonts only, specifying the named */
/* instance index for the current face index (starting */
/* with value~1; value~0 makes FreeType ignore named */
/* instances). For non-variation fonts, bits 16-30 are */
/* ignored. Assuming that you want to access the third */
/* named instance in face~4, `face_index' should be set */
/* to 0x00030004. If you want to access face~4 without */
/* variation handling, simply set `face_index' to */
/* value~4. */
/* */
/* `FT_Open_Face' and its siblings can be used to */
/* quickly check whether the font format of a given */
/* font resource is supported by FreeType. In general, */
/* if the `face_index' argument is negative, the */
/* function's return value is~0 if the font format is */
/* recognized, or non-zero otherwise. The function */
/* allocates a more or less empty face handle in */
/* `*aface' (if `aface' isn't NULL); the only two */
/* useful fields in this special case are */
/* `face->num_faces' and `face->style_flags'. For any */
/* negative value of `face_index', `face->num_faces' */
/* gives the number of faces within the font file. For */
/* the negative value `-(N+1)' (with `N' a non-negative */
/* 16-bit value), bits 16-30 in `face->style_flags' */
/* give the number of named instances in face `N' if we */
/* have a variation font (or zero otherwise). After */
/* examination, the returned @FT_Face structure should */
/* be deallocated with a call to @FT_Done_Face. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. If `face_index' is */
/* greater than or equal to zero, it must be non-NULL. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Unlike FreeType 1.x, this function automatically creates a glyph */
/* slot for the face object that can be accessed directly through */
/* `face->glyph'. */
/* */
/* Each new face object created with this function also owns a */
/* default @FT_Size object, accessible as `face->size'. */
/* */
/* One @FT_Library instance can have multiple face objects, this is, */
/* @FT_Open_Face and its siblings can be called multiple times using */
/* the same `library' argument. */
/* */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Face. */
/* */
/* To loop over all faces, use code similar to the following snippet */
/* (omitting the error handling). */
/* */
/* { */
/* ... */
/* FT_Face face; */
/* FT_Long i, num_faces; */
/* */
/* */
/* error = FT_Open_Face( library, args, -1, &face ); */
/* if ( error ) { ... } */
/* */
/* num_faces = face->num_faces; */
/* FT_Done_Face( face ); */
/* */
/* for ( i = 0; i < num_faces; i++ ) */
/* { */
/* ... */
/* error = FT_Open_Face( library, args, i, &face ); */
/* ... */
/* FT_Done_Face( face ); */
/* ... */
/* } */
/* } */
/* */
/* To loop over all valid values for `face_index', use something */
/* similar to the following snippet, again without error handling. */
/* The code accesses all faces immediately (thus only a single call */
/* of `FT_Open_Face' within the do-loop), with and without named */
/* instances. */
/* */
/* { */
/* ... */
/* FT_Face face; */
/* */
/* FT_Long num_faces = 0; */
/* FT_Long num_instances = 0; */
/* */
/* FT_Long face_idx = 0; */
/* FT_Long instance_idx = 0; */
/* */
/* */
/* do */
/* { */
/* FT_Long id = ( instance_idx << 16 ) + face_idx; */
/* */
/* */
/* error = FT_Open_Face( library, args, id, &face ); */
/* if ( error ) { ... } */
/* */
/* num_faces = face->num_faces; */
/* num_instances = face->style_flags >> 16; */
/* */
/* ... */
/* */
/* FT_Done_Face( face ); */
/* */
/* if ( instance_idx < num_instances ) */
/* instance_idx++; */
/* else */
/* { */
/* face_idx++; */
/* instance_idx = 0; */
/* } */
/* */
/* } while ( face_idx < num_faces ) */
/* } */
/* */
FT_EXPORT( FT_Error )
FT_Open_Face( FT_Library library,
const FT_Open_Args* args,
FT_Long face_index,
FT_Face *aface );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Attach_File */
/* */
/* <Description> */
/* Call @FT_Attach_Stream to attach a file. */
/* */
/* <InOut> */
/* face :: The target face object. */
/* */
/* <Input> */
/* filepathname :: The pathname. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Attach_File( FT_Face face,
const char* filepathname );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Attach_Stream */
/* */
/* <Description> */
/* `Attach' data to a face object. Normally, this is used to read */
/* additional information for the face object. For example, you can */
/* attach an AFM file that comes with a Type~1 font to get the */
/* kerning values and other metrics. */
/* */
/* <InOut> */
/* face :: The target face object. */
/* */
/* <Input> */
/* parameters :: A pointer to @FT_Open_Args that must be filled by */
/* the caller. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The meaning of the `attach' (i.e., what really happens when the */
/* new file is read) is not fixed by FreeType itself. It really */
/* depends on the font format (and thus the font driver). */
/* */
/* Client applications are expected to know what they are doing */
/* when invoking this function. Most drivers simply do not implement */
/* file or stream attachments. */
/* */
FT_EXPORT( FT_Error )
FT_Attach_Stream( FT_Face face,
FT_Open_Args* parameters );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Reference_Face */
/* */
/* <Description> */
/* A counter gets initialized to~1 at the time an @FT_Face structure */
/* is created. This function increments the counter. @FT_Done_Face */
/* then only destroys a face if the counter is~1, otherwise it simply */
/* decrements the counter. */
/* */
/* This function helps in managing life-cycles of structures that */
/* reference @FT_Face objects. */
/* */
/* <Input> */
/* face :: A handle to a target face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Since> */
/* 2.4.2 */
/* */
FT_EXPORT( FT_Error )
FT_Reference_Face( FT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Face */
/* */
/* <Description> */
/* Discard a given face object, as well as all of its child slots and */
/* sizes. */
/* */
/* <Input> */
/* face :: A handle to a target face object. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* See the discussion of reference counters in the description of */
/* @FT_Reference_Face. */
/* */
FT_EXPORT( FT_Error )
FT_Done_Face( FT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Select_Size */
/* */
/* <Description> */
/* Select a bitmap strike. To be more precise, this function sets */
/* the scaling factors of the active @FT_Size object in a face so */
/* that bitmaps from this particular strike are taken by */
/* @FT_Load_Glyph and friends. */
/* */
/* <InOut> */
/* face :: A handle to a target face object. */
/* */
/* <Input> */
/* strike_index :: The index of the bitmap strike in the */
/* `available_sizes' field of @FT_FaceRec structure. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* For bitmaps embedded in outline fonts it is common that only a */
/* subset of the available glyphs at a given ppem value is available. */
/* FreeType silently uses outlines if there is no bitmap for a given */
/* glyph index. */
/* */
/* For GX and OpenType variation fonts, a bitmap strike makes sense */
/* only if the default instance is active (this is, no glyph */
/* variation takes place); otherwise, FreeType simply ignores bitmap */
/* strikes. The same is true for all named instances that are */
/* different from the default instance. */
/* */
/* Don't use this function if you are using the FreeType cache API. */
/* */
FT_EXPORT( FT_Error )
FT_Select_Size( FT_Face face,
FT_Int strike_index );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Size_Request_Type */
/* */
/* <Description> */
/* An enumeration type that lists the supported size request types, */
/* i.e., what input size (in font units) maps to the requested output */
/* size (in pixels, as computed from the arguments of */
/* @FT_Size_Request). */
/* */
/* <Values> */
/* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
/* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
/* used to determine both scaling values. */
/* */
/* This is the standard scaling found in most applications. In */
/* particular, use this size request type for TrueType fonts if */
/* they provide optical scaling or something similar. Note, */
/* however, that `units_per_EM' is a rather abstract value which */
/* bears no relation to the actual size of the glyphs in a font. */
/* */
/* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
/* The real dimension. The sum of the `ascender' and (minus of) */
/* the `descender' fields of @FT_FaceRec is used to determine both */
/* scaling values. */
/* */
/* FT_SIZE_REQUEST_TYPE_BBOX :: */
/* The font bounding box. The width and height of the `bbox' field */
/* of @FT_FaceRec are used to determine the horizontal and vertical */
/* scaling value, respectively. */
/* */
/* FT_SIZE_REQUEST_TYPE_CELL :: */
/* The `max_advance_width' field of @FT_FaceRec is used to */
/* determine the horizontal scaling value; the vertical scaling */
/* value is determined the same way as */
/* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
/* values are set to the smaller one. This type is useful if you */
/* want to specify the font size for, say, a window of a given */
/* dimension and 80x24 cells. */
/* */
/* FT_SIZE_REQUEST_TYPE_SCALES :: */
/* Specify the scaling values directly. */
/* */
/* <Note> */
/* The above descriptions only apply to scalable formats. For bitmap */
/* formats, the behaviour is up to the driver. */
/* */
/* See the note section of @FT_Size_Metrics if you wonder how size */
/* requesting relates to scaling values. */
/* */
typedef enum FT_Size_Request_Type_
{
FT_SIZE_REQUEST_TYPE_NOMINAL,
FT_SIZE_REQUEST_TYPE_REAL_DIM,
FT_SIZE_REQUEST_TYPE_BBOX,
FT_SIZE_REQUEST_TYPE_CELL,
FT_SIZE_REQUEST_TYPE_SCALES,
FT_SIZE_REQUEST_TYPE_MAX
} FT_Size_Request_Type;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Size_RequestRec */
/* */
/* <Description> */
/* A structure to model a size request. */
/* */
/* <Fields> */
/* type :: See @FT_Size_Request_Type. */
/* */
/* width :: The desired width, given as a 26.6 fractional */
/* point value (with 72pt = 1in). */
/* */
/* height :: The desired height, given as a 26.6 fractional */
/* point value (with 72pt = 1in). */
/* */
/* horiResolution :: The horizontal resolution (dpi, i.e., pixels per */
/* inch). If set to zero, `width' is treated as a */
/* 26.6 fractional *pixel* value, which gets */
/* internally rounded to an integer. */
/* */
/* vertResolution :: The vertical resolution (dpi, i.e., pixels per */
/* inch). If set to zero, `height' is treated as a */
/* 26.6 fractional *pixel* value, which gets */
/* internally rounded to an integer. */
/* */
/* <Note> */
/* If `width' is zero, the horizontal scaling value is set equal */
/* to the vertical scaling value, and vice versa. */
/* */
/* If `type' is FT_SIZE_REQUEST_TYPE_SCALES, `width' and `height' are */
/* interpreted directly as 16.16 fractional scaling values, without */
/* any further modification, and both `horiResolution' and */
/* `vertResolution' are ignored. */
/* */
typedef struct FT_Size_RequestRec_
{
FT_Size_Request_Type type;
FT_Long width;
FT_Long height;
FT_UInt horiResolution;
FT_UInt vertResolution;
} FT_Size_RequestRec;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Size_Request */
/* */
/* <Description> */
/* A handle to a size request structure. */
/* */
typedef struct FT_Size_RequestRec_ *FT_Size_Request;
/*************************************************************************/
/* */
/* <Function> */
/* FT_Request_Size */
/* */
/* <Description> */
/* Resize the scale of the active @FT_Size object in a face. */
/* */
/* <InOut> */
/* face :: A handle to a target face object. */
/* */
/* <Input> */
/* req :: A pointer to a @FT_Size_RequestRec. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Although drivers may select the bitmap strike matching the */
/* request, you should not rely on this if you intend to select a */
/* particular bitmap strike. Use @FT_Select_Size instead in that */
/* case. */
/* */
/* The relation between the requested size and the resulting glyph */
/* size is dependent entirely on how the size is defined in the */
/* source face. The font designer chooses the final size of each */
/* glyph relative to this size. For more information refer to */
/* `https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'. */
/* */
/* Contrary to @FT_Set_Char_Size, this function doesn't have special */
/* code to normalize zero-valued widths, heights, or resolutions */
/* (which lead to errors in most cases). */
/* */
/* Don't use this function if you are using the FreeType cache API. */
/* */
FT_EXPORT( FT_Error )
FT_Request_Size( FT_Face face,
FT_Size_Request req );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Char_Size */
/* */
/* <Description> */
/* Call @FT_Request_Size to request the nominal size (in points). */
/* */
/* <InOut> */
/* face :: A handle to a target face object. */
/* */
/* <Input> */
/* char_width :: The nominal width, in 26.6 fractional points. */
/* */
/* char_height :: The nominal height, in 26.6 fractional points. */
/* */
/* horz_resolution :: The horizontal resolution in dpi. */
/* */
/* vert_resolution :: The vertical resolution in dpi. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* While this function allows fractional points as input values, the */
/* resulting ppem value for the given resolution is always rounded to */
/* the nearest integer. */
/* */
/* If either the character width or height is zero, it is set equal */
/* to the other value. */
/* */
/* If either the horizontal or vertical resolution is zero, it is set */
/* equal to the other value. */
/* */
/* A character width or height smaller than 1pt is set to 1pt; if */
/* both resolution values are zero, they are set to 72dpi. */
/* */
/* Don't use this function if you are using the FreeType cache API. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Char_Size( FT_Face face,
FT_F26Dot6 char_width,
FT_F26Dot6 char_height,
FT_UInt horz_resolution,
FT_UInt vert_resolution );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Pixel_Sizes */
/* */
/* <Description> */
/* Call @FT_Request_Size to request the nominal size (in pixels). */
/* */
/* <InOut> */
/* face :: A handle to the target face object. */
/* */
/* <Input> */
/* pixel_width :: The nominal width, in pixels. */
/* */
/* pixel_height :: The nominal height, in pixels. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* You should not rely on the resulting glyphs matching or being */
/* constrained to this pixel size. Refer to @FT_Request_Size to */
/* understand how requested sizes relate to actual sizes. */
/* */
/* Don't use this function if you are using the FreeType cache API. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Pixel_Sizes( FT_Face face,
FT_UInt pixel_width,
FT_UInt pixel_height );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Load_Glyph */
/* */
/* <Description> */
/* Load a glyph into the glyph slot of a face object. */
/* */
/* <InOut> */
/* face :: A handle to the target face object where the glyph */
/* is loaded. */
/* */
/* <Input> */
/* glyph_index :: The index of the glyph in the font file. For */
/* CID-keyed fonts (either in PS or in CFF format) */
/* this argument specifies the CID value. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
/* @FT_LOAD_XXX constants can be used to control the */
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* The loaded glyph may be transformed. See @FT_Set_Transform for */
/* the details. */
/* */
/* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
/* returned for invalid CID values (this is, for CID values that */
/* don't have a corresponding glyph in the font). See the discussion */
/* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
/* */
/* If you receive `FT_Err_Glyph_Too_Big', try getting the glyph */
/* outline at EM size, then scale it manually and fill it as a */
/* graphics operation. */
/* */
FT_EXPORT( FT_Error )
FT_Load_Glyph( FT_Face face,
FT_UInt glyph_index,
FT_Int32 load_flags );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Load_Char */
/* */
/* <Description> */
/* Load a glyph into the glyph slot of a face object, accessed by its */
/* character code. */
/* */
/* <InOut> */
/* face :: A handle to a target face object where the glyph */
/* is loaded. */
/* */
/* <Input> */
/* char_code :: The glyph's character code, according to the */
/* current charmap used in the face. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
/* @FT_LOAD_XXX constants can be used to control the */
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
/* */
/* Many fonts contain glyphs that can't be loaded by this function */
/* since its glyph indices are not listed in any of the font's */
/* charmaps. */
/* */
/* If no active cmap is set up (i.e., `face->charmap' is zero), the */
/* call to @FT_Get_Char_Index is omitted, and the function behaves */
/* identically to @FT_Load_Glyph. */
/* */
FT_EXPORT( FT_Error )
FT_Load_Char( FT_Face face,
FT_ULong char_code,
FT_Int32 load_flags );
/*************************************************************************
*
* @enum:
* FT_LOAD_XXX
*
* @description:
* A list of bit field constants for @FT_Load_Glyph to indicate what
* kind of operations to perform during glyph loading.
*
* @values:
* FT_LOAD_DEFAULT ::
* Corresponding to~0, this value is used as the default glyph load
* operation. In this case, the following happens:
*
* 1. FreeType looks for a bitmap for the glyph corresponding to the
* face's current size. If one is found, the function returns.
* The bitmap data can be accessed from the glyph slot (see note
* below).
*
* 2. If no embedded bitmap is searched for or found, FreeType looks
* for a scalable outline. If one is found, it is loaded from
* the font file, scaled to device pixels, then `hinted' to the
* pixel grid in order to optimize it. The outline data can be
* accessed from the glyph slot (see note below).
*
* Note that by default the glyph loader doesn't render outlines into
* bitmaps. The following flags are used to modify this default
* behaviour to more specific and useful cases.
*
* FT_LOAD_NO_SCALE ::
* Don't scale the loaded outline glyph but keep it in font units.
*
* This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
* unsets @FT_LOAD_RENDER.
*
* If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
* FT_LOAD_NO_SCALE usually yields meaningless outlines because the
* subglyphs must be scaled and positioned with hinting instructions.
* This can be solved by loading the font without FT_LOAD_NO_SCALE and
* setting the character size to `font->units_per_EM'.
*
* FT_LOAD_NO_HINTING ::
* Disable hinting. This generally generates `blurrier' bitmap glyphs
* when the glyph are rendered in any of the anti-aliased modes. See
* also the note below.
*
* This flag is implied by @FT_LOAD_NO_SCALE.
*
* FT_LOAD_RENDER ::
* Call @FT_Render_Glyph after the glyph is loaded. By default, the
* glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
* overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
*
* This flag is unset by @FT_LOAD_NO_SCALE.
*
* FT_LOAD_NO_BITMAP ::
* Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
* flag.
*
* @FT_LOAD_NO_SCALE always sets this flag.
*
* FT_LOAD_VERTICAL_LAYOUT ::
* Load the glyph for vertical text layout. In particular, the
* `advance' value in the @FT_GlyphSlotRec structure is set to the
* `vertAdvance' value of the `metrics' field.
*
* In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
* this flag currently. Reason is that in this case vertical metrics
* get synthesized, and those values are not always consistent across
* various font formats.
*
* FT_LOAD_FORCE_AUTOHINT ::
* Prefer the auto-hinter over the font's native hinter. See also
* the note below.
*
* FT_LOAD_PEDANTIC ::
* Make the font driver perform pedantic verifications during glyph
* loading. This is mostly used to detect broken glyphs in fonts.
* By default, FreeType tries to handle broken fonts also.
*
* In particular, errors from the TrueType bytecode engine are not
* passed to the application if this flag is not set; this might
* result in partially hinted or distorted glyphs in case a glyph's
* bytecode is buggy.
*
* FT_LOAD_NO_RECURSE ::
* Don't load composite glyphs recursively. Instead, the font
* driver should set the `num_subglyph' and `subglyphs' values of
* the glyph slot accordingly, and set `glyph->format' to
* @FT_GLYPH_FORMAT_COMPOSITE. The description of subglyphs can
* then be accessed with @FT_Get_SubGlyph_Info.
*
* This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
*
* FT_LOAD_IGNORE_TRANSFORM ::
* Ignore the transform matrix set by @FT_Set_Transform.
*
* FT_LOAD_MONOCHROME ::
* This flag is used with @FT_LOAD_RENDER to indicate that you want to
* render an outline glyph to a 1-bit monochrome bitmap glyph, with
* 8~pixels packed into each byte of the bitmap data.
*
* Note that this has no effect on the hinting algorithm used. You
* should rather use @FT_LOAD_TARGET_MONO so that the
* monochrome-optimized hinting algorithm is used.
*
* FT_LOAD_LINEAR_DESIGN ::
* Keep `linearHoriAdvance' and `linearVertAdvance' fields of
* @FT_GlyphSlotRec in font units. See @FT_GlyphSlotRec for
* details.
*
* FT_LOAD_NO_AUTOHINT ::
* Disable the auto-hinter. See also the note below.
*
* FT_LOAD_COLOR ::
* [Since 2.5] Load embedded color bitmap images. The resulting color
* bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format.
* If the flag is not set and color bitmaps are found, they are
* converted to 256-level gray bitmaps transparently, using the
* @FT_PIXEL_MODE_GRAY format.
*
* FT_LOAD_COMPUTE_METRICS ::
* [Since 2.6.1] Compute glyph metrics from the glyph data, without
* the use of bundled metrics tables (for example, the `hdmx' table in
* TrueType fonts). This flag is mainly used by font validating or
* font editing applications, which need to ignore, verify, or edit
* those tables.
*
* Currently, this flag is only implemented for TrueType fonts.
*
* FT_LOAD_BITMAP_METRICS_ONLY ::
* [Since 2.7.1] Request loading of the metrics and bitmap image
* information of a (possibly embedded) bitmap glyph without
* allocating or copying the bitmap image data itself. No effect if
* the target glyph is not a bitmap image.
*
* This flag unsets @FT_LOAD_RENDER.
*
* FT_LOAD_CROP_BITMAP ::
* Ignored. Deprecated.
*
* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
* Ignored. Deprecated.
*
* @note:
* By default, hinting is enabled and the font's native hinter (see
* @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
* disable hinting by setting @FT_LOAD_NO_HINTING or change the
* precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
* @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
* used at all.
*
* See the description of @FT_FACE_FLAG_TRICKY for a special exception
* (affecting only a handful of Asian fonts).
*
* Besides deciding which hinter to use, you can also decide which
* hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
*
* Note that the auto-hinter needs a valid Unicode cmap (either a native
* one or synthesized by FreeType) for producing correct results. If a
* font provides an incorrect mapping (for example, assigning the
* character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
* mathematical integral sign), the auto-hinter might produce useless
* results.
*
*/
#define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE ( 1L << 0 )
#define FT_LOAD_NO_HINTING ( 1L << 1 )
#define FT_LOAD_RENDER ( 1L << 2 )
#define FT_LOAD_NO_BITMAP ( 1L << 3 )
#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
#define FT_LOAD_CROP_BITMAP ( 1L << 6 )
#define FT_LOAD_PEDANTIC ( 1L << 7 )
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
#define FT_LOAD_NO_RECURSE ( 1L << 10 )
#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
#define FT_LOAD_MONOCHROME ( 1L << 12 )
#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
#define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
/* Bits 16-19 are used by `FT_LOAD_TARGET_' */
#define FT_LOAD_COLOR ( 1L << 20 )
#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 )
#define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 )
/* */
/* used internally only by certain font drivers */
#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
#define FT_LOAD_SBITS_ONLY ( 1L << 14 )
/**************************************************************************
*
* @enum:
* FT_LOAD_TARGET_XXX
*
* @description:
* A list of values to select a specific hinting algorithm for the
* hinter. You should OR one of these values to your `load_flags'
* when calling @FT_Load_Glyph.
*
* Note that a font's native hinters may ignore the hinting algorithm
* you have specified (e.g., the TrueType bytecode interpreter). You
* can set @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is
* used.
*
* @values:
* FT_LOAD_TARGET_NORMAL ::
* The default hinting algorithm, optimized for standard gray-level
* rendering. For monochrome output, use @FT_LOAD_TARGET_MONO
* instead.
*
* FT_LOAD_TARGET_LIGHT ::
* A lighter hinting algorithm for gray-level modes. Many generated
* glyphs are fuzzier but better resemble their original shape. This
* is achieved by snapping glyphs to the pixel grid only vertically
* (Y-axis), as is done by FreeType's new CFF engine or Microsoft's
* ClearType font renderer. This preserves inter-glyph spacing in
* horizontal text. The snapping is done either by the native font
* driver, if the driver itself and the font support it, or by the
* auto-hinter.
*
* Advance widths are rounded to integer values; however, using the
* `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is
* possible to get fractional advance widths for subpixel positioning
* (which is recommended to use).
*
* If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active,
* TrueType-like metrics are used to make this mode behave similarly
* as in unpatched FreeType versions between 2.4.6 and 2.7.1
* (inclusive).
*
* FT_LOAD_TARGET_MONO ::
* Strong hinting algorithm that should only be used for monochrome
* output. The result is probably unpleasant if the glyph is rendered
* in non-monochrome modes.
*
* FT_LOAD_TARGET_LCD ::
* A variant of @FT_LOAD_TARGET_LIGHT optimized for horizontally
* decimated LCD displays.
*
* FT_LOAD_TARGET_LCD_V ::
* A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
* decimated LCD displays.
*
* @note:
* You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
* `load_flags'. They can't be ORed.
*
* If @FT_LOAD_RENDER is also set, the glyph is rendered in the
* corresponding mode (i.e., the mode that matches the used algorithm
* best). An exception is FT_LOAD_TARGET_MONO since it implies
* @FT_LOAD_MONOCHROME.
*
* You can use a hinting algorithm that doesn't correspond to the same
* rendering mode. As an example, it is possible to use the `light'
* hinting algorithm and have the results rendered in horizontal LCD
* pixel mode, with code like
*
* {
* FT_Load_Glyph( face, glyph_index,
* load_flags | FT_LOAD_TARGET_LIGHT );
*
* FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
* }
*
* In general, you should stick with one rendering mode. For example,
* switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO
* enforces a lot of recomputation for TrueType fonts, which is slow.
* Another reason is caching: Selecting a different mode usually causes
* changes in both the outlines and the rasterized bitmaps; it is thus
* necessary to empty the cache after a mode switch to avoid false hits.
*
*/
#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
/**************************************************************************
*
* @macro:
* FT_LOAD_TARGET_MODE
*
* @description:
* Return the @FT_Render_Mode corresponding to a given
* @FT_LOAD_TARGET_XXX value.
*
*/
#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Transform */
/* */
/* <Description> */
/* Set the transformation that is applied to glyph images when they */
/* are loaded into a glyph slot through @FT_Load_Glyph. */
/* */
/* <InOut> */
/* face :: A handle to the source face object. */
/* */
/* <Input> */
/* matrix :: A pointer to the transformation's 2x2 matrix. Use NULL */
/* for the identity matrix. */
/* delta :: A pointer to the translation vector. Use NULL for the */
/* null vector. */
/* */
/* <Note> */
/* The transformation is only applied to scalable image formats after */
/* the glyph has been loaded. It means that hinting is unaltered by */
/* the transformation and is performed on the character size given in */
/* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
/* */
/* Note that this also transforms the `face.glyph.advance' field, but */
/* *not* the values in `face.glyph.metrics'. */
/* */
FT_EXPORT( void )
FT_Set_Transform( FT_Face face,
FT_Matrix* matrix,
FT_Vector* delta );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Render_Mode */
/* */
/* <Description> */
/* Render modes supported by FreeType~2. Each mode corresponds to a */
/* specific type of scanline conversion performed on the outline. */
/* */
/* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
/* field in the @FT_GlyphSlotRec structure gives the format of the */
/* returned bitmap. */
/* */
/* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity, */
/* indicating pixel coverage. Use linear alpha blending and gamma */
/* correction to correctly render non-monochrome glyph bitmaps onto a */
/* surface; see @FT_Render_Glyph. */
/* */
/* <Values> */
/* FT_RENDER_MODE_NORMAL :: */
/* Default render mode; it corresponds to 8-bit anti-aliased */
/* bitmaps. */
/* */
/* FT_RENDER_MODE_LIGHT :: */
/* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
/* defined as a separate value because render modes are also used */
/* indirectly to define hinting algorithm selectors. See */
/* @FT_LOAD_TARGET_XXX for details. */
/* */
/* FT_RENDER_MODE_MONO :: */
/* This mode corresponds to 1-bit bitmaps (with 2~levels of */
/* opacity). */
/* */
/* FT_RENDER_MODE_LCD :: */
/* This mode corresponds to horizontal RGB and BGR subpixel */
/* displays like LCD screens. It produces 8-bit bitmaps that are */
/* 3~times the width of the original glyph outline in pixels, and */
/* which use the @FT_PIXEL_MODE_LCD mode. */
/* */
/* FT_RENDER_MODE_LCD_V :: */
/* This mode corresponds to vertical RGB and BGR subpixel displays */
/* (like PDA screens, rotated LCD displays, etc.). It produces */
/* 8-bit bitmaps that are 3~times the height of the original */
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
/* */
/* <Note> */
/* Should you define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your */
/* `ftoption.h', which enables patented ClearType-style rendering, */
/* the LCD-optimized glyph bitmaps should be filtered to reduce color */
/* fringes inherent to this technology. You can either set up LCD */
/* filtering with @FT_Library_SetLcdFilter or @FT_Face_Properties, */
/* or do the filtering yourself. The default FreeType LCD rendering */
/* technology does not require filtering. */
/* */
/* The selected render mode only affects vector glyphs of a font. */
/* Embedded bitmaps often have a different pixel mode like */
/* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
/* them into 8-bit pixmaps. */
/* */
typedef enum FT_Render_Mode_
{
FT_RENDER_MODE_NORMAL = 0,
FT_RENDER_MODE_LIGHT,
FT_RENDER_MODE_MONO,
FT_RENDER_MODE_LCD,
FT_RENDER_MODE_LCD_V,
FT_RENDER_MODE_MAX
} FT_Render_Mode;
/* these constants are deprecated; use the corresponding */
/* `FT_Render_Mode' values instead */
#define ft_render_mode_normal FT_RENDER_MODE_NORMAL
#define ft_render_mode_mono FT_RENDER_MODE_MONO
/*************************************************************************/
/* */
/* <Function> */
/* FT_Render_Glyph */
/* */
/* <Description> */
/* Convert a given glyph image to a bitmap. It does so by inspecting */
/* the glyph image format, finding the relevant renderer, and */
/* invoking it. */
/* */
/* <InOut> */
/* slot :: A handle to the glyph slot containing the image to */
/* convert. */
/* */
/* <Input> */
/* render_mode :: The render mode used to render the glyph image into */
/* a bitmap. See @FT_Render_Mode for a list of */
/* possible values. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* To get meaningful results, font scaling values must be set with */
/* functions like @FT_Set_Char_Size before calling `FT_Render_Glyph'. */
/* */
/* When FreeType outputs a bitmap of a glyph, it really outputs an */
/* alpha coverage map. If a pixel is completely covered by a */
/* filled-in outline, the bitmap contains 0xFF at that pixel, meaning */
/* that 0xFF/0xFF fraction of that pixel is covered, meaning the */
/* pixel is 100% black (or 0% bright). If a pixel is only 50% */
/* covered (value 0x80), the pixel is made 50% black (50% bright or a */
/* middle shade of grey). 0% covered means 0% black (100% bright or */
/* white). */
/* */
/* On high-DPI screens like on smartphones and tablets, the pixels */
/* are so small that their chance of being completely covered and */
/* therefore completely black are fairly good. On the low-DPI */
/* screens, however, the situation is different. The pixels are too */
/* large for most of the details of a glyph and shades of gray are */
/* the norm rather than the exception. */
/* */
/* This is relevant because all our screens have a second problem: */
/* they are not linear. 1~+~1 is not~2. Twice the value does not */
/* result in twice the brightness. When a pixel is only 50% covered, */
/* the coverage map says 50% black, and this translates to a pixel */
/* value of 128 when you use 8~bits per channel (0-255). However, */
/* this does not translate to 50% brightness for that pixel on our */
/* sRGB and gamma~2.2 screens. Due to their non-linearity, they */
/* dwell longer in the darks and only a pixel value of about 186 */
/* results in 50% brightness -- 128 ends up too dark on both bright */
/* and dark backgrounds. The net result is that dark text looks */
/* burnt-out, pixely and blotchy on bright background, bright text */
/* too frail on dark backgrounds, and colored text on colored */
/* background (for example, red on green) seems to have dark halos or */
/* `dirt' around it. The situation is especially ugly for diagonal */
/* stems like in `w' glyph shapes where the quality of FreeType's */
/* anti-aliasing depends on the correct display of grays. On */
/* high-DPI screens where smaller, fully black pixels reign supreme, */
/* this doesn't matter, but on our low-DPI screens with all the gray */
/* shades, it does. 0% and 100% brightness are the same things in */
/* linear and non-linear space, just all the shades in-between */
/* aren't. */
/* */
/* The blending function for placing text over a background is */
/* */
/* { */
/* dst = alpha * src + (1 - alpha) * dst , */
/* } */
/* */
/* which is known as the OVER operator. */
/* */
/* To correctly composite an antialiased pixel of a glyph onto a */
/* surface, */
/* */
/* 1. take the foreground and background colors (e.g., in sRGB space) */
/* and apply gamma to get them in a linear space, */
/* */
/* 2. use OVER to blend the two linear colors using the glyph pixel */
/* as the alpha value (remember, the glyph bitmap is an alpha */
/* coverage bitmap), and */
/* */
/* 3. apply inverse gamma to the blended pixel and write it back to */
/* the image. */
/* */
/* Internal testing at Adobe found that a target inverse gamma of~1.8 */
/* for step~3 gives good results across a wide range of displays with */
/* an sRGB gamma curve or a similar one. */
/* */
/* This process can cost performance. There is an approximation that */
/* does not need to know about the background color; see */
/* https://bel.fi/alankila/lcd/ and */
/* https://bel.fi/alankila/lcd/alpcor.html for details. */
/* */
/* *ATTENTION*: Linear blending is even more important when dealing */
/* with subpixel-rendered glyphs to prevent color-fringing! A */
/* subpixel-rendered glyph must first be filtered with a filter that */
/* gives equal weight to the three color primaries and does not */
/* exceed a sum of 0x100, see section @lcd_filtering. Then the */
/* only difference to gray linear blending is that subpixel-rendered */
/* linear blending is done 3~times per pixel: red foreground subpixel */
/* to red background subpixel and so on for green and blue. */
/* */
FT_EXPORT( FT_Error )
FT_Render_Glyph( FT_GlyphSlot slot,
FT_Render_Mode render_mode );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Kerning_Mode */
/* */
/* <Description> */
/* An enumeration to specify the format of kerning values returned by */
/* @FT_Get_Kerning. */
/* */
/* <Values> */
/* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */
/* 26.6 fractional pixels. */
/* */
/* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */
/* 26.6 fractional pixels. */
/* */
/* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
/* units. */
/* */
/* <Note> */
/* FT_KERNING_DEFAULT returns full pixel values; it also makes */
/* FreeType heuristically scale down kerning distances at small ppem */
/* values so that they don't become too big. */
/* */
/* Both FT_KERNING_DEFAULT and FT_KERNING_UNFITTED use the current */
/* horizontal scaling factor (as set e.g. with @FT_Set_Char_Size) to */
/* convert font units to pixels. */
/* */
typedef enum FT_Kerning_Mode_
{
FT_KERNING_DEFAULT = 0,
FT_KERNING_UNFITTED,
FT_KERNING_UNSCALED
} FT_Kerning_Mode;
/* these constants are deprecated; use the corresponding */
/* `FT_Kerning_Mode' values instead */
#define ft_kerning_default FT_KERNING_DEFAULT
#define ft_kerning_unfitted FT_KERNING_UNFITTED
#define ft_kerning_unscaled FT_KERNING_UNSCALED
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Kerning */
/* */
/* <Description> */
/* Return the kerning vector between two glyphs of the same face. */
/* */
/* <Input> */
/* face :: A handle to a source face object. */
/* */
/* left_glyph :: The index of the left glyph in the kern pair. */
/* */
/* right_glyph :: The index of the right glyph in the kern pair. */
/* */
/* kern_mode :: See @FT_Kerning_Mode for more information. */
/* Determines the scale and dimension of the returned */
/* kerning vector. */
/* */
/* <Output> */
/* akerning :: The kerning vector. This is either in font units, */
/* fractional pixels (26.6 format), or pixels for */
/* scalable formats, and in pixels for fixed-sizes */
/* formats. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Only horizontal layouts (left-to-right & right-to-left) are */
/* supported by this method. Other layouts, or more sophisticated */
/* kernings, are out of the scope of this API function -- they can be */
/* implemented through format-specific interfaces. */
/* */
/* Kerning for OpenType fonts implemented in a `GPOS' table is not */
/* supported; use @FT_HAS_KERNING to find out whether a font has data */
/* that can be extracted with `FT_Get_Kerning'. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Kerning( FT_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_UInt kern_mode,
FT_Vector *akerning );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Track_Kerning */
/* */
/* <Description> */
/* Return the track kerning for a given face object at a given size. */
/* */
/* <Input> */
/* face :: A handle to a source face object. */
/* */
/* point_size :: The point size in 16.16 fractional points. */
/* */
/* degree :: The degree of tightness. Increasingly negative */
/* values represent tighter track kerning, while */
/* increasingly positive values represent looser track */
/* kerning. Value zero means no track kerning. */
/* */
/* <Output> */
/* akerning :: The kerning in 16.16 fractional points, to be */
/* uniformly applied between all glyphs. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Currently, only the Type~1 font driver supports track kerning, */
/* using data from AFM files (if attached with @FT_Attach_File or */
/* @FT_Attach_Stream). */
/* */
/* Only very few AFM files come with track kerning data; please refer */
/* to Adobe's AFM specification for more details. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Track_Kerning( FT_Face face,
FT_Fixed point_size,
FT_Int degree,
FT_Fixed* akerning );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Glyph_Name */
/* */
/* <Description> */
/* Retrieve the ASCII name of a given glyph in a face. This only */
/* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
/* */
/* <Input> */
/* face :: A handle to a source face object. */
/* */
/* glyph_index :: The glyph index. */
/* */
/* buffer_max :: The maximum number of bytes available in the */
/* buffer. */
/* */
/* <Output> */
/* buffer :: A pointer to a target buffer where the name is */
/* copied to. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* An error is returned if the face doesn't provide glyph names or if */
/* the glyph index is invalid. In all cases of failure, the first */
/* byte of `buffer' is set to~0 to indicate an empty name. */
/* */
/* The glyph name is truncated to fit within the buffer if it is too */
/* long. The returned string is always zero-terminated. */
/* */
/* Be aware that FreeType reorders glyph indices internally so that */
/* glyph index~0 always corresponds to the `missing glyph' (called */
/* `.notdef'). */
/* */
/* This function always returns an error if the config macro */
/* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoption.h'. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Glyph_Name( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Postscript_Name */
/* */
/* <Description> */
/* Retrieve the ASCII PostScript name of a given face, if available. */
/* This only works with PostScript, TrueType, and OpenType fonts. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* <Return> */
/* A pointer to the face's PostScript name. NULL if unavailable. */
/* */
/* <Note> */
/* The returned pointer is owned by the face and is destroyed with */
/* it. */
/* */
/* For variation fonts, this string changes if you select a different */
/* instance, and you have to call `FT_Get_PostScript_Name' again to */
/* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */
/* PostScript Names for Fonts Using OpenType Font Variations'. */
/* */
/* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */
/* */
/* [Since 2.9] Special PostScript names for named instances are only */
/* returned if the named instance is set with @FT_Set_Named_Instance */
/* (and the font has corresponding entries in its `fvar' table). If */
/* @FT_IS_VARIATION returns true, the algorithmically derived */
/* PostScript name is provided, not looking up special entries for */
/* named instances. */
/* */
FT_EXPORT( const char* )
FT_Get_Postscript_Name( FT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Select_Charmap */
/* */
/* <Description> */
/* Select a given charmap by its encoding tag (as listed in */
/* `freetype.h'). */
/* */
/* <InOut> */
/* face :: A handle to the source face object. */
/* */
/* <Input> */
/* encoding :: A handle to the selected encoding. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function returns an error if no charmap in the face */
/* corresponds to the encoding queried here. */
/* */
/* Because many fonts contain more than a single cmap for Unicode */
/* encoding, this function has some special code to select the one */
/* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */
/* preferred to a UCS-2 cmap). It is thus preferable to */
/* @FT_Set_Charmap in this case. */
/* */
FT_EXPORT( FT_Error )
FT_Select_Charmap( FT_Face face,
FT_Encoding encoding );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Charmap */
/* */
/* <Description> */
/* Select a given charmap for character code to glyph index mapping. */
/* */
/* <InOut> */
/* face :: A handle to the source face object. */
/* */
/* <Input> */
/* charmap :: A handle to the selected charmap. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function returns an error if the charmap is not part of */
/* the face (i.e., if it is not listed in the `face->charmaps' */
/* table). */
/* */
/* It also fails if an OpenType type~14 charmap is selected (which */
/* doesn't map character codes to glyph indices at all). */
/* */
FT_EXPORT( FT_Error )
FT_Set_Charmap( FT_Face face,
FT_CharMap charmap );
/*************************************************************************
*
* @function:
* FT_Get_Charmap_Index
*
* @description:
* Retrieve index of a given charmap.
*
* @input:
* charmap ::
* A handle to a charmap.
*
* @return:
* The index into the array of character maps within the face to which
* `charmap' belongs. If an error occurs, -1 is returned.
*
*/
FT_EXPORT( FT_Int )
FT_Get_Charmap_Index( FT_CharMap charmap );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Char_Index */
/* */
/* <Description> */
/* Return the glyph index of a given character code. This function */
/* uses the currently selected charmap to do the mapping. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* charcode :: The character code. */
/* */
/* <Return> */
/* The glyph index. 0~means `undefined character code'. */
/* */
/* <Note> */
/* If you use FreeType to manipulate the contents of font files */
/* directly, be aware that the glyph index returned by this function */
/* doesn't always correspond to the internal indices used within the */
/* file. This is done to ensure that value~0 always corresponds to */
/* the `missing glyph'. If the first glyph is not named `.notdef', */
/* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
/* the glyph ID~0 position, and whatever was there will be moved to */
/* the position `.notdef' had. For Type~1 fonts, if there is no */
/* `.notdef' glyph at all, then one will be created at index~0 and */
/* whatever was there will be moved to the last index -- Type~42 */
/* fonts are considered invalid under this condition. */
/* */
FT_EXPORT( FT_UInt )
FT_Get_Char_Index( FT_Face face,
FT_ULong charcode );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_First_Char */
/* */
/* <Description> */
/* Return the first character code in the current charmap of a given */
/* face, together with its corresponding glyph index. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* <Output> */
/* agindex :: Glyph index of first character code. 0~if charmap is */
/* empty. */
/* */
/* <Return> */
/* The charmap's first character code. */
/* */
/* <Note> */
/* You should use this function together with @FT_Get_Next_Char to */
/* parse all character codes available in a given charmap. The code */
/* should look like this: */
/* */
/* { */
/* FT_ULong charcode; */
/* FT_UInt gindex; */
/* */
/* */
/* charcode = FT_Get_First_Char( face, &gindex ); */
/* while ( gindex != 0 ) */
/* { */
/* ... do something with (charcode,gindex) pair ... */
/* */
/* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
/* } */
/* } */
/* */
/* Be aware that character codes can have values up to 0xFFFFFFFF; */
/* this might happen for non-Unicode or malformed cmaps. However, */
/* even with regular Unicode encoding, so-called `last resort fonts' */
/* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */
/* normally have entries for all Unicode characters up to 0x1FFFFF, */
/* which can cause *a lot* of iterations. */
/* */
/* Note that `*agindex' is set to~0 if the charmap is empty. The */
/* result itself can be~0 in two cases: if the charmap is empty or */
/* if the value~0 is the first valid character code. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_First_Char( FT_Face face,
FT_UInt *agindex );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Next_Char */
/* */
/* <Description> */
/* Return the next character code in the current charmap of a given */
/* face following the value `char_code', as well as the corresponding */
/* glyph index. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* char_code :: The starting character code. */
/* */
/* <Output> */
/* agindex :: Glyph index of next character code. 0~if charmap */
/* is empty. */
/* */
/* <Return> */
/* The charmap's next character code. */
/* */
/* <Note> */
/* You should use this function with @FT_Get_First_Char to walk */
/* over all character codes available in a given charmap. See the */
/* note for that function for a simple code example. */
/* */
/* Note that `*agindex' is set to~0 when there are no more codes in */
/* the charmap. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_Next_Char( FT_Face face,
FT_ULong char_code,
FT_UInt *agindex );
/*************************************************************************
*
* @function:
* FT_Face_Properties
*
* @description:
* Set or override certain (library or module-wide) properties on a
* face-by-face basis. Useful for finer-grained control and avoiding
* locks on shared structures (threads can modify their own faces as
* they see fit).
*
* Contrary to @FT_Property_Set, this function uses @FT_Parameter so
* that you can pass multiple properties to the target face in one call.
* Note that only a subset of the available properties can be
* controlled.
*
* * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the
* property `no-stem-darkening' provided by the `autofit', `cff',
* `type1', and `t1cid' modules; see @no-stem-darkening).
*
* * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding
* to function @FT_Library_SetLcdFilterWeights).
*
* * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID
* `random' operator, corresponding to the `random-seed' property
* provided by the `cff', `type1', and `t1cid' modules; see
* @random-seed).
*
* Pass NULL as `data' in @FT_Parameter for a given tag to reset the
* option and use the library or module default again.
*
* @input:
* face ::
* A handle to the source face object.
*
* num_properties ::
* The number of properties that follow.
*
* properties ::
* A handle to an @FT_Parameter array with `num_properties' elements.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Here an example that sets three properties. You must define
* FT_CONFIG_OPTION_SUBPIXEL_RENDERING to make the LCD filter examples
* work.
*
* {
* FT_Parameter property1;
* FT_Bool darken_stems = 1;
*
* FT_Parameter property2;
* FT_LcdFiveTapFilter custom_weight =
* { 0x11, 0x44, 0x56, 0x44, 0x11 };
*
* FT_Parameter property3;
* FT_Int32 random_seed = 314159265;
*
* FT_Parameter properties[3] = { property1,
* property2,
* property3 };
*
*
* property1.tag = FT_PARAM_TAG_STEM_DARKENING;
* property1.data = &darken_stems;
*
* property2.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
* property2.data = custom_weight;
*
* property3.tag = FT_PARAM_TAG_RANDOM_SEED;
* property3.data = &random_seed;
*
* FT_Face_Properties( face, 3, properties );
* }
*
* The next example resets a single property to its default value.
*
* {
* FT_Parameter property;
*
*
* property.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
* property.data = NULL;
*
* FT_Face_Properties( face, 1, &property );
* }
*
* @since:
* 2.8
*
*/
FT_EXPORT( FT_Error )
FT_Face_Properties( FT_Face face,
FT_UInt num_properties,
FT_Parameter* properties );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Name_Index */
/* */
/* <Description> */
/* Return the glyph index of a given glyph name. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* glyph_name :: The glyph name. */
/* */
/* <Return> */
/* The glyph index. 0~means `undefined character code'. */
/* */
FT_EXPORT( FT_UInt )
FT_Get_Name_Index( FT_Face face,
FT_String* glyph_name );
/*************************************************************************
*
* @macro:
* FT_SUBGLYPH_FLAG_XXX
*
* @description:
* A list of constants describing subglyphs. Please refer to the
* `glyf' table description in the OpenType specification for the
* meaning of the various flags (which get synthesized for
* non-OpenType subglyphs).
*
* @values:
* FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
* FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
* FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
* FT_SUBGLYPH_FLAG_SCALE ::
* FT_SUBGLYPH_FLAG_XY_SCALE ::
* FT_SUBGLYPH_FLAG_2X2 ::
* FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
*
*/
#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
#define FT_SUBGLYPH_FLAG_SCALE 8
#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
#define FT_SUBGLYPH_FLAG_2X2 0x80
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
/*************************************************************************
*
* @func:
* FT_Get_SubGlyph_Info
*
* @description:
* Retrieve a description of a given subglyph. Only use it if
* `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
* returned otherwise.
*
* @input:
* glyph ::
* The source glyph slot.
*
* sub_index ::
* The index of the subglyph. Must be less than
* `glyph->num_subglyphs'.
*
* @output:
* p_index ::
* The glyph index of the subglyph.
*
* p_flags ::
* The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
*
* p_arg1 ::
* The subglyph's first argument (if any).
*
* p_arg2 ::
* The subglyph's second argument (if any).
*
* p_transform ::
* The subglyph transformation (if any).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
* interpreted depending on the flags returned in `*p_flags'. See the
* OpenType specification for details.
*
*/
FT_EXPORT( FT_Error )
FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
FT_UInt sub_index,
FT_Int *p_index,
FT_UInt *p_flags,
FT_Int *p_arg1,
FT_Int *p_arg2,
FT_Matrix *p_transform );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_FSTYPE_XXX */
/* */
/* <Description> */
/* A list of bit flags used in the `fsType' field of the OS/2 table */
/* in a TrueType or OpenType font and the `FSType' entry in a */
/* PostScript font. These bit flags are returned by */
/* @FT_Get_FSType_Flags; they inform client applications of embedding */
/* and subsetting restrictions associated with a font. */
/* */
/* See */
/* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
/* for more details. */
/* */
/* <Values> */
/* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
/* Fonts with no fsType bit set may be embedded and permanently */
/* installed on the remote system by an application. */
/* */
/* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
/* Fonts that have only this bit set must not be modified, embedded */
/* or exchanged in any manner without first obtaining permission of */
/* the font software copyright owner. */
/* */
/* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
/* The font may be embedded and temporarily loaded on the remote */
/* system. Documents containing Preview & Print fonts must be */
/* opened `read-only'; no edits can be applied to the document. */
/* */
/* FT_FSTYPE_EDITABLE_EMBEDDING :: */
/* The font may be embedded but must only be installed temporarily */
/* on other systems. In contrast to Preview & Print fonts, */
/* documents containing editable fonts may be opened for reading, */
/* editing is permitted, and changes may be saved. */
/* */
/* FT_FSTYPE_NO_SUBSETTING :: */
/* The font may not be subsetted prior to embedding. */
/* */
/* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
/* Only bitmaps contained in the font may be embedded; no outline */
/* data may be embedded. If there are no bitmaps available in the */
/* font, then the font is unembeddable. */
/* */
/* <Note> */
/* The flags are ORed together, thus more than a single value can be */
/* returned. */
/* */
/* While the `fsType' flags can indicate that a font may be embedded, */
/* a license with the font vendor may be separately required to use */
/* the font in this way. */
/* */
#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
#define FT_FSTYPE_NO_SUBSETTING 0x0100
#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_FSType_Flags */
/* */
/* <Description> */
/* Return the `fsType' flags for a font. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* <Return> */
/* The `fsType' flags, see @FT_FSTYPE_XXX. */
/* */
/* <Note> */
/* Use this function rather than directly reading the `fs_type' field */
/* in the @PS_FontInfoRec structure, which is only guaranteed to */
/* return the correct results for Type~1 fonts. */
/* */
/* <Since> */
/* 2.3.8 */
/* */
FT_EXPORT( FT_UShort )
FT_Get_FSType_Flags( FT_Face face );
/*************************************************************************/
/* */
/* <Section> */
/* glyph_variants */
/* */
/* <Title> */
/* Unicode Variation Sequences */
/* */
/* <Abstract> */
/* The FreeType~2 interface to Unicode Variation Sequences (UVS), */
/* using the SFNT cmap format~14. */
/* */
/* <Description> */
/* Many characters, especially for CJK scripts, have variant forms. */
/* They are a sort of grey area somewhere between being totally */
/* irrelevant and semantically distinct; for this reason, the Unicode */
/* consortium decided to introduce Variation Sequences (VS), */
/* consisting of a Unicode base character and a variation selector */
/* instead of further extending the already huge number of */
/* characters. */
/* */
/* Unicode maintains two different sets, namely `Standardized */
/* Variation Sequences' and registered `Ideographic Variation */
/* Sequences' (IVS), collected in the `Ideographic Variation */
/* Database' (IVD). */
/* */
/* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */
/* https://unicode.org/reports/tr37/ */
/* https://unicode.org/ivd/ */
/* */
/* To date (January 2017), the character with the most ideographic */
/* variations is U+9089, having 32 such IVS. */
/* */
/* Three Mongolian Variation Selectors have the values U+180B-U+180D; */
/* 256 generic Variation Selectors are encoded in the ranges */
/* U+FE00-U+FE0F and U+E0100-U+E01EF. IVS currently use Variation */
/* Selectors from the range U+E0100-U+E01EF only. */
/* */
/* A VS consists of the base character value followed by a single */
/* Variation Selector. For example, to get the first variation of */
/* U+9089, you have to write the character sequence `U+9089 U+E0100'. */
/* */
/* Adobe and MS decided to support both standardized and ideographic */
/* VS with a new cmap subtable (format~14). It is an odd subtable */
/* because it is not a mapping of input code points to glyphs, but */
/* contains lists of all variations supported by the font. */
/* */
/* A variation may be either `default' or `non-default' for a given */
/* font. A default variation is the one you will get for that code */
/* point if you look it up in the standard Unicode cmap. A */
/* non-default variation is a different glyph. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_GetCharVariantIndex */
/* */
/* <Description> */
/* Return the glyph index of a given character code as modified by */
/* the variation selector. */
/* */
/* <Input> */
/* face :: */
/* A handle to the source face object. */
/* */
/* charcode :: */
/* The character code point in Unicode. */
/* */
/* variantSelector :: */
/* The Unicode code point of the variation selector. */
/* */
/* <Return> */
/* The glyph index. 0~means either `undefined character code', or */
/* `undefined selector code', or `no variation selector cmap */
/* subtable', or `current CharMap is not Unicode'. */
/* */
/* <Note> */
/* If you use FreeType to manipulate the contents of font files */
/* directly, be aware that the glyph index returned by this function */
/* doesn't always correspond to the internal indices used within */
/* the file. This is done to ensure that value~0 always corresponds */
/* to the `missing glyph'. */
/* */
/* This function is only meaningful if */
/* a) the font has a variation selector cmap sub table, */
/* and */
/* b) the current charmap has a Unicode encoding. */
/* */
/* <Since> */
/* 2.3.6 */
/* */
FT_EXPORT( FT_UInt )
FT_Face_GetCharVariantIndex( FT_Face face,
FT_ULong charcode,
FT_ULong variantSelector );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_GetCharVariantIsDefault */
/* */
/* <Description> */
/* Check whether this variation of this Unicode character is the one */
/* to be found in the `cmap'. */
/* */
/* <Input> */
/* face :: */
/* A handle to the source face object. */
/* */
/* charcode :: */
/* The character codepoint in Unicode. */
/* */
/* variantSelector :: */
/* The Unicode codepoint of the variation selector. */
/* */
/* <Return> */
/* 1~if found in the standard (Unicode) cmap, 0~if found in the */
/* variation selector cmap, or -1 if it is not a variation. */
/* */
/* <Note> */
/* This function is only meaningful if the font has a variation */
/* selector cmap subtable. */
/* */
/* <Since> */
/* 2.3.6 */
/* */
FT_EXPORT( FT_Int )
FT_Face_GetCharVariantIsDefault( FT_Face face,
FT_ULong charcode,
FT_ULong variantSelector );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_GetVariantSelectors */
/* */
/* <Description> */
/* Return a zero-terminated list of Unicode variation selectors found */
/* in the font. */
/* */
/* <Input> */
/* face :: */
/* A handle to the source face object. */
/* */
/* <Return> */
/* A pointer to an array of selector code points, or NULL if there is */
/* no valid variation selector cmap subtable. */
/* */
/* <Note> */
/* The last item in the array is~0; the array is owned by the */
/* @FT_Face object but can be overwritten or released on the next */
/* call to a FreeType function. */
/* */
/* <Since> */
/* 2.3.6 */
/* */
FT_EXPORT( FT_UInt32* )
FT_Face_GetVariantSelectors( FT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_GetVariantsOfChar */
/* */
/* <Description> */
/* Return a zero-terminated list of Unicode variation selectors found */
/* for the specified character code. */
/* */
/* <Input> */
/* face :: */
/* A handle to the source face object. */
/* */
/* charcode :: */
/* The character codepoint in Unicode. */
/* */
/* <Return> */
/* A pointer to an array of variation selector code points that are */
/* active for the given character, or NULL if the corresponding list */
/* is empty. */
/* */
/* <Note> */
/* The last item in the array is~0; the array is owned by the */
/* @FT_Face object but can be overwritten or released on the next */
/* call to a FreeType function. */
/* */
/* <Since> */
/* 2.3.6 */
/* */
FT_EXPORT( FT_UInt32* )
FT_Face_GetVariantsOfChar( FT_Face face,
FT_ULong charcode );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_GetCharsOfVariant */
/* */
/* <Description> */
/* Return a zero-terminated list of Unicode character codes found for */
/* the specified variation selector. */
/* */
/* <Input> */
/* face :: */
/* A handle to the source face object. */
/* */
/* variantSelector :: */
/* The variation selector code point in Unicode. */
/* */
/* <Return> */
/* A list of all the code points that are specified by this selector */
/* (both default and non-default codes are returned) or NULL if there */
/* is no valid cmap or the variation selector is invalid. */
/* */
/* <Note> */
/* The last item in the array is~0; the array is owned by the */
/* @FT_Face object but can be overwritten or released on the next */
/* call to a FreeType function. */
/* */
/* <Since> */
/* 2.3.6 */
/* */
FT_EXPORT( FT_UInt32* )
FT_Face_GetCharsOfVariant( FT_Face face,
FT_ULong variantSelector );
/*************************************************************************/
/* */
/* <Section> */
/* computations */
/* */
/* <Title> */
/* Computations */
/* */
/* <Abstract> */
/* Crunching fixed numbers and vectors. */
/* */
/* <Description> */
/* This section contains various functions used to perform */
/* computations on 16.16 fixed-float numbers or 2d vectors. */
/* */
/* <Order> */
/* FT_MulDiv */
/* FT_MulFix */
/* FT_DivFix */
/* FT_RoundFix */
/* FT_CeilFix */
/* FT_FloorFix */
/* FT_Vector_Transform */
/* FT_Matrix_Multiply */
/* FT_Matrix_Invert */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* FT_MulDiv */
/* */
/* <Description> */
/* Compute `(a*b)/c' with maximum accuracy, using a 64-bit */
/* intermediate integer whenever necessary. */
/* */
/* This function isn't necessarily as fast as some processor specific */
/* operations, but is at least completely portable. */
/* */
/* <Input> */
/* a :: The first multiplier. */
/* */
/* b :: The second multiplier. */
/* */
/* c :: The divisor. */
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
FT_EXPORT( FT_Long )
FT_MulDiv( FT_Long a,
FT_Long b,
FT_Long c );
/*************************************************************************/
/* */
/* <Function> */
/* FT_MulFix */
/* */
/* <Description> */
/* Compute `(a*b)/0x10000' with maximum accuracy. Its main use is to */
/* multiply a given value by a 16.16 fixed-point factor. */
/* */
/* <Input> */
/* a :: The first multiplier. */
/* */
/* b :: The second multiplier. Use a 16.16 factor here whenever */
/* possible (see note below). */
/* */
/* <Return> */
/* The result of `(a*b)/0x10000'. */
/* */
/* <Note> */
/* This function has been optimized for the case where the absolute */
/* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
/* As this happens mainly when scaling from notional units to */
/* fractional pixels in FreeType, it resulted in noticeable speed */
/* improvements between versions 2.x and 1.x. */
/* */
/* As a conclusion, always try to place a 16.16 factor as the */
/* _second_ argument of this function; this can make a great */
/* difference. */
/* */
FT_EXPORT( FT_Long )
FT_MulFix( FT_Long a,
FT_Long b );
/*************************************************************************/
/* */
/* <Function> */
/* FT_DivFix */
/* */
/* <Description> */
/* Compute `(a*0x10000)/b' with maximum accuracy. Its main use is to */
/* divide a given value by a 16.16 fixed-point factor. */
/* */
/* <Input> */
/* a :: The numerator. */
/* */
/* b :: The denominator. Use a 16.16 factor here. */
/* */
/* <Return> */
/* The result of `(a*0x10000)/b'. */
/* */
FT_EXPORT( FT_Long )
FT_DivFix( FT_Long a,
FT_Long b );
/*************************************************************************/
/* */
/* <Function> */
/* FT_RoundFix */
/* */
/* <Description> */
/* Round a 16.16 fixed number. */
/* */
/* <Input> */
/* a :: The number to be rounded. */
/* */
/* <Return> */
/* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */
/* from zero. */
/* */
/* <Note> */
/* The function uses wrap-around arithmetic. */
/* */
FT_EXPORT( FT_Fixed )
FT_RoundFix( FT_Fixed a );
/*************************************************************************/
/* */
/* <Function> */
/* FT_CeilFix */
/* */
/* <Description> */
/* Compute the smallest following integer of a 16.16 fixed number. */
/* */
/* <Input> */
/* a :: The number for which the ceiling function is to be computed. */
/* */
/* <Return> */
/* `a' rounded towards plus infinity. */
/* */
/* <Note> */
/* The function uses wrap-around arithmetic. */
/* */
FT_EXPORT( FT_Fixed )
FT_CeilFix( FT_Fixed a );
/*************************************************************************/
/* */
/* <Function> */
/* FT_FloorFix */
/* */
/* <Description> */
/* Compute the largest previous integer of a 16.16 fixed number. */
/* */
/* <Input> */
/* a :: The number for which the floor function is to be computed. */
/* */
/* <Return> */
/* `a' rounded towards minus infinity. */
/* */
FT_EXPORT( FT_Fixed )
FT_FloorFix( FT_Fixed a );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Vector_Transform */
/* */
/* <Description> */
/* Transform a single vector through a 2x2 matrix. */
/* */
/* <InOut> */
/* vector :: The target vector to transform. */
/* */
/* <Input> */
/* matrix :: A pointer to the source 2x2 matrix. */
/* */
/* <Note> */
/* The result is undefined if either `vector' or `matrix' is invalid. */
/* */
FT_EXPORT( void )
FT_Vector_Transform( FT_Vector* vec,
const FT_Matrix* matrix );
/*************************************************************************/
/* */
/* <Section> */
/* version */
/* */
/* <Title> */
/* FreeType Version */
/* */
/* <Abstract> */
/* Functions and macros related to FreeType versions. */
/* */
/* <Description> */
/* Note that those functions and macros are of limited use because */
/* even a new release of FreeType with only documentation changes */
/* increases the version number. */
/* */
/* <Order> */
/* FT_Library_Version */
/* */
/* FREETYPE_MAJOR */
/* FREETYPE_MINOR */
/* FREETYPE_PATCH */
/* */
/* FT_Face_CheckTrueTypePatents */
/* FT_Face_SetUnpatentedHinting */
/* */
/* FREETYPE_XXX */
/* */
/*************************************************************************/
/*************************************************************************
*
* @enum:
* FREETYPE_XXX
*
* @description:
* These three macros identify the FreeType source code version.
* Use @FT_Library_Version to access them at runtime.
*
* @values:
* FREETYPE_MAJOR :: The major version number.
* FREETYPE_MINOR :: The minor version number.
* FREETYPE_PATCH :: The patch level.
*
* @note:
* The version number of FreeType if built as a dynamic link library
* with the `libtool' package is _not_ controlled by these three
* macros.
*
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 9
#define FREETYPE_PATCH 1
/*************************************************************************/
/* */
/* <Function> */
/* FT_Library_Version */
/* */
/* <Description> */
/* Return the version of the FreeType library being used. This is */
/* useful when dynamically linking to the library, since one cannot */
/* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
/* @FREETYPE_PATCH. */
/* */
/* <Input> */
/* library :: A source library handle. */
/* */
/* <Output> */
/* amajor :: The major version number. */
/* */
/* aminor :: The minor version number. */
/* */
/* apatch :: The patch version number. */
/* */
/* <Note> */
/* The reason why this function takes a `library' argument is because */
/* certain programs implement library initialization in a custom way */
/* that doesn't use @FT_Init_FreeType. */
/* */
/* In such cases, the library version might not be available before */
/* the library object has been created. */
/* */
FT_EXPORT( void )
FT_Library_Version( FT_Library library,
FT_Int *amajor,
FT_Int *aminor,
FT_Int *apatch );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_CheckTrueTypePatents */
/* */
/* <Description> */
/* Deprecated, does nothing. */
/* */
/* <Input> */
/* face :: A face handle. */
/* */
/* <Return> */
/* Always returns false. */
/* */
/* <Note> */
/* Since May 2010, TrueType hinting is no longer patented. */
/* */
/* <Since> */
/* 2.3.5 */
/* */
FT_EXPORT( FT_Bool )
FT_Face_CheckTrueTypePatents( FT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Face_SetUnpatentedHinting */
/* */
/* <Description> */
/* Deprecated, does nothing. */
/* */
/* <Input> */
/* face :: A face handle. */
/* */
/* value :: New boolean setting. */
/* */
/* <Return> */
/* Always returns false. */
/* */
/* <Note> */
/* Since May 2010, TrueType hinting is no longer patented. */
/* */
/* <Since> */
/* 2.3.5 */
/* */
FT_EXPORT( FT_Bool )
FT_Face_SetUnpatentedHinting( FT_Face face,
FT_Bool value );
/* */
FT_END_HEADER
#endif /* FREETYPE_H_ */
/* END */
/***************************************************************************/
/* */
/* fttypes.h */
/* */
/* FreeType simple types definitions (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTTYPES_H_
#define FTTYPES_H_
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_SYSTEM_H
#include FT_IMAGE_H
#include <stddef.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* basic_types */
/* */
/* <Title> */
/* Basic Data Types */
/* */
/* <Abstract> */
/* The basic data types defined by the library. */
/* */
/* <Description> */
/* This section contains the basic data types defined by FreeType~2, */
/* ranging from simple scalar types to bitmap descriptors. More */
/* font-specific structures are defined in a different section. */
/* */
/* <Order> */
/* FT_Byte */
/* FT_Bytes */
/* FT_Char */
/* FT_Int */
/* FT_UInt */
/* FT_Int16 */
/* FT_UInt16 */
/* FT_Int32 */
/* FT_UInt32 */
/* FT_Int64 */
/* FT_UInt64 */
/* FT_Short */
/* FT_UShort */
/* FT_Long */
/* FT_ULong */
/* FT_Bool */
/* FT_Offset */
/* FT_PtrDist */
/* FT_String */
/* FT_Tag */
/* FT_Error */
/* FT_Fixed */
/* FT_Pointer */
/* FT_Pos */
/* FT_Vector */
/* FT_BBox */
/* FT_Matrix */
/* FT_FWord */
/* FT_UFWord */
/* FT_F2Dot14 */
/* FT_UnitVector */
/* FT_F26Dot6 */
/* FT_Data */
/* */
/* FT_MAKE_TAG */
/* */
/* FT_Generic */
/* FT_Generic_Finalizer */
/* */
/* FT_Bitmap */
/* FT_Pixel_Mode */
/* FT_Palette_Mode */
/* FT_Glyph_Format */
/* FT_IMAGE_TAG */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Bool */
/* */
/* <Description> */
/* A typedef of unsigned char, used for simple booleans. As usual, */
/* values 1 and~0 represent true and false, respectively. */
/* */
typedef unsigned char FT_Bool;
/*************************************************************************/
/* */
/* <Type> */
/* FT_FWord */
/* */
/* <Description> */
/* A signed 16-bit integer used to store a distance in original font */
/* units. */
/* */
typedef signed short FT_FWord; /* distance in FUnits */
/*************************************************************************/
/* */
/* <Type> */
/* FT_UFWord */
/* */
/* <Description> */
/* An unsigned 16-bit integer used to store a distance in original */
/* font units. */
/* */
typedef unsigned short FT_UFWord; /* unsigned distance */
/*************************************************************************/
/* */
/* <Type> */
/* FT_Char */
/* */
/* <Description> */
/* A simple typedef for the _signed_ char type. */
/* */
typedef signed char FT_Char;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Byte */
/* */
/* <Description> */
/* A simple typedef for the _unsigned_ char type. */
/* */
typedef unsigned char FT_Byte;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Bytes */
/* */
/* <Description> */
/* A typedef for constant memory areas. */
/* */
typedef const FT_Byte* FT_Bytes;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Tag */
/* */
/* <Description> */
/* A typedef for 32-bit tags (as used in the SFNT format). */
/* */
typedef FT_UInt32 FT_Tag;
/*************************************************************************/
/* */
/* <Type> */
/* FT_String */
/* */
/* <Description> */
/* A simple typedef for the char type, usually used for strings. */
/* */
typedef char FT_String;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Short */
/* */
/* <Description> */
/* A typedef for signed short. */
/* */
typedef signed short FT_Short;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UShort */
/* */
/* <Description> */
/* A typedef for unsigned short. */
/* */
typedef unsigned short FT_UShort;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int */
/* */
/* <Description> */
/* A typedef for the int type. */
/* */
typedef signed int FT_Int;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt */
/* */
/* <Description> */
/* A typedef for the unsigned int type. */
/* */
typedef unsigned int FT_UInt;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Long */
/* */
/* <Description> */
/* A typedef for signed long. */
/* */
typedef signed long FT_Long;
/*************************************************************************/
/* */
/* <Type> */
/* FT_ULong */
/* */
/* <Description> */
/* A typedef for unsigned long. */
/* */
typedef unsigned long FT_ULong;
/*************************************************************************/
/* */
/* <Type> */
/* FT_F2Dot14 */
/* */
/* <Description> */
/* A signed 2.14 fixed-point type used for unit vectors. */
/* */
typedef signed short FT_F2Dot14;
/*************************************************************************/
/* */
/* <Type> */
/* FT_F26Dot6 */
/* */
/* <Description> */
/* A signed 26.6 fixed-point type used for vectorial pixel */
/* coordinates. */
/* */
typedef signed long FT_F26Dot6;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Fixed */
/* */
/* <Description> */
/* This type is used to store 16.16 fixed-point values, like scaling */
/* values or matrix coefficients. */
/* */
typedef signed long FT_Fixed;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Error */
/* */
/* <Description> */
/* The FreeType error code type. A value of~0 is always interpreted */
/* as a successful operation. */
/* */
typedef int FT_Error;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Pointer */
/* */
/* <Description> */
/* A simple typedef for a typeless pointer. */
/* */
typedef void* FT_Pointer;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Offset */
/* */
/* <Description> */
/* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
/* _unsigned_ integer type used to express a file size or position, */
/* or a memory block size. */
/* */
typedef size_t FT_Offset;
/*************************************************************************/
/* */
/* <Type> */
/* FT_PtrDist */
/* */
/* <Description> */
/* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
/* largest _signed_ integer type used to express the distance */
/* between two pointers. */
/* */
typedef ft_ptrdiff_t FT_PtrDist;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_UnitVector */
/* */
/* <Description> */
/* A simple structure used to store a 2D vector unit vector. Uses */
/* FT_F2Dot14 types. */
/* */
/* <Fields> */
/* x :: Horizontal coordinate. */
/* */
/* y :: Vertical coordinate. */
/* */
typedef struct FT_UnitVector_
{
FT_F2Dot14 x;
FT_F2Dot14 y;
} FT_UnitVector;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Matrix */
/* */
/* <Description> */
/* A simple structure used to store a 2x2 matrix. Coefficients are */
/* in 16.16 fixed-point format. The computation performed is: */
/* */
/* { */
/* x' = x*xx + y*xy */
/* y' = x*yx + y*yy */
/* } */
/* */
/* <Fields> */
/* xx :: Matrix coefficient. */
/* */
/* xy :: Matrix coefficient. */
/* */
/* yx :: Matrix coefficient. */
/* */
/* yy :: Matrix coefficient. */
/* */
typedef struct FT_Matrix_
{
FT_Fixed xx, xy;
FT_Fixed yx, yy;
} FT_Matrix;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Data */
/* */
/* <Description> */
/* Read-only binary data represented as a pointer and a length. */
/* */
/* <Fields> */
/* pointer :: The data. */
/* */
/* length :: The length of the data in bytes. */
/* */
typedef struct FT_Data_
{
const FT_Byte* pointer;
FT_Int length;
} FT_Data;
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Generic_Finalizer */
/* */
/* <Description> */
/* Describe a function used to destroy the `client' data of any */
/* FreeType object. See the description of the @FT_Generic type for */
/* details of usage. */
/* */
/* <Input> */
/* The address of the FreeType object that is under finalization. */
/* Its client data is accessed through its `generic' field. */
/* */
typedef void (*FT_Generic_Finalizer)( void* object );
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Generic */
/* */
/* <Description> */
/* Client applications often need to associate their own data to a */
/* variety of FreeType core objects. For example, a text layout API */
/* might want to associate a glyph cache to a given size object. */
/* */
/* Some FreeType object contains a `generic' field, of type */
/* FT_Generic, which usage is left to client applications and font */
/* servers. */
/* */
/* It can be used to store a pointer to client-specific data, as well */
/* as the address of a `finalizer' function, which will be called by */
/* FreeType when the object is destroyed (for example, the previous */
/* client example would put the address of the glyph cache destructor */
/* in the `finalizer' field). */
/* */
/* <Fields> */
/* data :: A typeless pointer to any client-specified data. This */
/* field is completely ignored by the FreeType library. */
/* */
/* finalizer :: A pointer to a `generic finalizer' function, which */
/* will be called when the object is destroyed. If this */
/* field is set to NULL, no code will be called. */
/* */
typedef struct FT_Generic_
{
void* data;
FT_Generic_Finalizer finalizer;
} FT_Generic;
/*************************************************************************/
/* */
/* <Macro> */
/* FT_MAKE_TAG */
/* */
/* <Description> */
/* This macro converts four-letter tags that are used to label */
/* TrueType tables into an unsigned long, to be used within FreeType. */
/* */
/* <Note> */
/* The produced values *must* be 32-bit integers. Don't redefine */
/* this macro. */
/* */
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
(FT_Tag) \
( ( (FT_ULong)_x1 << 24 ) | \
( (FT_ULong)_x2 << 16 ) | \
( (FT_ULong)_x3 << 8 ) | \
(FT_ULong)_x4 )
/*************************************************************************/
/*************************************************************************/
/* */
/* L I S T M A N A G E M E N T */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* list_processing */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_ListNode */
/* */
/* <Description> */
/* Many elements and objects in FreeType are listed through an */
/* @FT_List record (see @FT_ListRec). As its name suggests, an */
/* FT_ListNode is a handle to a single list element. */
/* */
typedef struct FT_ListNodeRec_* FT_ListNode;
/*************************************************************************/
/* */
/* <Type> */
/* FT_List */
/* */
/* <Description> */
/* A handle to a list record (see @FT_ListRec). */
/* */
typedef struct FT_ListRec_* FT_List;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_ListNodeRec */
/* */
/* <Description> */
/* A structure used to hold a single list element. */
/* */
/* <Fields> */
/* prev :: The previous element in the list. NULL if first. */
/* */
/* next :: The next element in the list. NULL if last. */
/* */
/* data :: A typeless pointer to the listed object. */
/* */
typedef struct FT_ListNodeRec_
{
FT_ListNode prev;
FT_ListNode next;
void* data;
} FT_ListNodeRec;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_ListRec */
/* */
/* <Description> */
/* A structure used to hold a simple doubly-linked list. These are */
/* used in many parts of FreeType. */
/* */
/* <Fields> */
/* head :: The head (first element) of doubly-linked list. */
/* */
/* tail :: The tail (last element) of doubly-linked list. */
/* */
typedef struct FT_ListRec_
{
FT_ListNode head;
FT_ListNode tail;
} FT_ListRec;
/* */
#define FT_IS_EMPTY( list ) ( (list).head == 0 )
#define FT_BOOL( x ) ( (FT_Bool)( x ) )
/* concatenate C tokens */
#define FT_ERR_XCAT( x, y ) x ## y
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
/* see `ftmoderr.h' for descriptions of the following macros */
#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
#define FT_ERROR_BASE( x ) ( (x) & 0xFF )
#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
#define FT_ERR_EQ( x, e ) \
( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
#define FT_ERR_NEQ( x, e ) \
( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
FT_END_HEADER
#endif /* FTTYPES_H_ */
/* END */
/***************************************************************************/
/* */
/* ftgxval.h */
/* */
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
/* */
/* Copyright 2004-2018 by */
/* Masatake YAMATO, Redhat K.K, */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout is supported by the Information-technology */
/* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/
#ifndef FTGXVAL_H_
#define FTGXVAL_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* gx_validation */
/* */
/* <Title> */
/* TrueTypeGX/AAT Validation */
/* */
/* <Abstract> */
/* An API to validate TrueTypeGX/AAT tables. */
/* */
/* <Description> */
/* This section contains the declaration of functions to validate */
/* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */
/* trak, prop, lcar). */
/* */
/* <Order> */
/* FT_TrueTypeGX_Validate */
/* FT_TrueTypeGX_Free */
/* */
/* FT_ClassicKern_Validate */
/* FT_ClassicKern_Free */
/* */
/* FT_VALIDATE_GX_LENGTH */
/* FT_VALIDATE_GXXXX */
/* FT_VALIDATE_CKERNXXX */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* */
/* Warning: Use FT_VALIDATE_XXX to validate a table. */
/* Following definitions are for gxvalid developers. */
/* */
/* */
/*************************************************************************/
#define FT_VALIDATE_feat_INDEX 0
#define FT_VALIDATE_mort_INDEX 1
#define FT_VALIDATE_morx_INDEX 2
#define FT_VALIDATE_bsln_INDEX 3
#define FT_VALIDATE_just_INDEX 4
#define FT_VALIDATE_kern_INDEX 5
#define FT_VALIDATE_opbd_INDEX 6
#define FT_VALIDATE_trak_INDEX 7
#define FT_VALIDATE_prop_INDEX 8
#define FT_VALIDATE_lcar_INDEX 9
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX
/*************************************************************************
*
* @macro:
* FT_VALIDATE_GX_LENGTH
*
* @description:
* The number of tables checked in this module. Use it as a parameter
* for the `table-length' argument of function @FT_TrueTypeGX_Validate.
*/
#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 )
/* */
/* Up to 0x1000 is used by otvalid.
Ox2xxx is reserved for feature OT extension. */
#define FT_VALIDATE_GX_START 0x4000
#define FT_VALIDATE_GX_BITFIELD( tag ) \
( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
/**********************************************************************
*
* @enum:
* FT_VALIDATE_GXXXX
*
* @description:
* A list of bit-field constants used with @FT_TrueTypeGX_Validate to
* indicate which TrueTypeGX/AAT Type tables should be validated.
*
* @values:
* FT_VALIDATE_feat ::
* Validate `feat' table.
*
* FT_VALIDATE_mort ::
* Validate `mort' table.
*
* FT_VALIDATE_morx ::
* Validate `morx' table.
*
* FT_VALIDATE_bsln ::
* Validate `bsln' table.
*
* FT_VALIDATE_just ::
* Validate `just' table.
*
* FT_VALIDATE_kern ::
* Validate `kern' table.
*
* FT_VALIDATE_opbd ::
* Validate `opbd' table.
*
* FT_VALIDATE_trak ::
* Validate `trak' table.
*
* FT_VALIDATE_prop ::
* Validate `prop' table.
*
* FT_VALIDATE_lcar ::
* Validate `lcar' table.
*
* FT_VALIDATE_GX ::
* Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
* opbd, trak, prop and lcar).
*
*/
#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
FT_VALIDATE_mort | \
FT_VALIDATE_morx | \
FT_VALIDATE_bsln | \
FT_VALIDATE_just | \
FT_VALIDATE_kern | \
FT_VALIDATE_opbd | \
FT_VALIDATE_trak | \
FT_VALIDATE_prop | \
FT_VALIDATE_lcar )
/**********************************************************************
*
* @function:
* FT_TrueTypeGX_Validate
*
* @description:
* Validate various TrueTypeGX tables to assure that all offsets and
* indices are valid. The idea is that a higher-level library that
* actually does the text layout can access those tables without
* error checking (which can be quite time consuming).
*
* @input:
* face ::
* A handle to the input face.
*
* validation_flags ::
* A bit field that specifies the tables to be validated. See
* @FT_VALIDATE_GXXXX for possible values.
*
* table_length ::
* The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH
* should be passed.
*
* @output:
* tables ::
* The array where all validated sfnt tables are stored.
* The array itself must be allocated by a client.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with TrueTypeGX fonts, returning an error
* otherwise.
*
* After use, the application should deallocate the buffers pointed to by
* each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value
* indicates that the table either doesn't exist in the font, the
* application hasn't asked for validation, or the validator doesn't have
* the ability to validate the sfnt table.
*/
FT_EXPORT( FT_Error )
FT_TrueTypeGX_Validate( FT_Face face,
FT_UInt validation_flags,
FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
FT_UInt table_length );
/**********************************************************************
*
* @function:
* FT_TrueTypeGX_Free
*
* @description:
* Free the buffer allocated by TrueTypeGX validator.
*
* @input:
* face ::
* A handle to the input face.
*
* table ::
* The pointer to the buffer allocated by
* @FT_TrueTypeGX_Validate.
*
* @note:
* This function must be used to free the buffer allocated by
* @FT_TrueTypeGX_Validate only.
*/
FT_EXPORT( void )
FT_TrueTypeGX_Free( FT_Face face,
FT_Bytes table );
/**********************************************************************
*
* @enum:
* FT_VALIDATE_CKERNXXX
*
* @description:
* A list of bit-field constants used with @FT_ClassicKern_Validate
* to indicate the classic kern dialect or dialects. If the selected
* type doesn't fit, @FT_ClassicKern_Validate regards the table as
* invalid.
*
* @values:
* FT_VALIDATE_MS ::
* Handle the `kern' table as a classic Microsoft kern table.
*
* FT_VALIDATE_APPLE ::
* Handle the `kern' table as a classic Apple kern table.
*
* FT_VALIDATE_CKERN ::
* Handle the `kern' as either classic Apple or Microsoft kern table.
*/
#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
/**********************************************************************
*
* @function:
* FT_ClassicKern_Validate
*
* @description:
* Validate classic (16-bit format) kern table to assure that the offsets
* and indices are valid. The idea is that a higher-level library that
* actually does the text layout can access those tables without error
* checking (which can be quite time consuming).
*
* The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
* the new 32-bit format and the classic 16-bit format, while
* FT_ClassicKern_Validate only supports the classic 16-bit format.
*
* @input:
* face ::
* A handle to the input face.
*
* validation_flags ::
* A bit field that specifies the dialect to be validated. See
* @FT_VALIDATE_CKERNXXX for possible values.
*
* @output:
* ckern_table ::
* A pointer to the kern table.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* After use, the application should deallocate the buffers pointed to by
* `ckern_table', by calling @FT_ClassicKern_Free. A NULL value
* indicates that the table doesn't exist in the font.
*/
FT_EXPORT( FT_Error )
FT_ClassicKern_Validate( FT_Face face,
FT_UInt validation_flags,
FT_Bytes *ckern_table );
/**********************************************************************
*
* @function:
* FT_ClassicKern_Free
*
* @description:
* Free the buffer allocated by classic Kern validator.
*
* @input:
* face ::
* A handle to the input face.
*
* table ::
* The pointer to the buffer that is allocated by
* @FT_ClassicKern_Validate.
*
* @note:
* This function must be used to free the buffer allocated by
* @FT_ClassicKern_Validate only.
*/
FT_EXPORT( void )
FT_ClassicKern_Free( FT_Face face,
FT_Bytes table );
/* */
FT_END_HEADER
#endif /* FTGXVAL_H_ */
/* END */
/***************************************************************************/
/* */
/* ftgasp.h */
/* */
/* Access of TrueType's `gasp' table (specification). */
/* */
/* Copyright 2007-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTGASP_H_
#define FTGASP_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/***************************************************************************
*
* @section:
* gasp_table
*
* @title:
* Gasp Table
*
* @abstract:
* Retrieving TrueType `gasp' table entries.
*
* @description:
* The function @FT_Get_Gasp can be used to query a TrueType or OpenType
* font for specific entries in its `gasp' table, if any. This is
* mainly useful when implementing native TrueType hinting with the
* bytecode interpreter to duplicate the Windows text rendering results.
*/
/*************************************************************************
*
* @enum:
* FT_GASP_XXX
*
* @description:
* A list of values and/or bit-flags returned by the @FT_Get_Gasp
* function.
*
* @values:
* FT_GASP_NO_TABLE ::
* This special value means that there is no GASP table in this face.
* It is up to the client to decide what to do.
*
* FT_GASP_DO_GRIDFIT ::
* Grid-fitting and hinting should be performed at the specified ppem.
* This *really* means TrueType bytecode interpretation. If this bit
* is not set, no hinting gets applied.
*
* FT_GASP_DO_GRAY ::
* Anti-aliased rendering should be performed at the specified ppem.
* If not set, do monochrome rendering.
*
* FT_GASP_SYMMETRIC_SMOOTHING ::
* If set, smoothing along multiple axes must be used with ClearType.
*
* FT_GASP_SYMMETRIC_GRIDFIT ::
* Grid-fitting must be used with ClearType's symmetric smoothing.
*
* @note:
* The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be
* used for standard font rasterization only. Independently of that,
* `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to
* be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and
* `FT_GASP_DO_GRAY' are consequently ignored).
*
* `ClearType' is Microsoft's implementation of LCD rendering, partly
* protected by patents.
*
* @since:
* 2.3.0
*/
#define FT_GASP_NO_TABLE -1
#define FT_GASP_DO_GRIDFIT 0x01
#define FT_GASP_DO_GRAY 0x02
#define FT_GASP_SYMMETRIC_GRIDFIT 0x04
#define FT_GASP_SYMMETRIC_SMOOTHING 0x08
/*************************************************************************
*
* @func:
* FT_Get_Gasp
*
* @description:
* For a TrueType or OpenType font file, return the rasterizer behaviour
* flags from the font's `gasp' table corresponding to a given
* character pixel size.
*
* @input:
* face :: The source face handle.
*
* ppem :: The vertical character pixel size.
*
* @return:
* Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
* `gasp' table in the face.
*
* @note:
* If you want to use the MM functionality of OpenType variation fonts
* (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this
* function *after* setting an instance since the return values can
* change.
*
* @since:
* 2.3.0
*/
FT_EXPORT( FT_Int )
FT_Get_Gasp( FT_Face face,
FT_UInt ppem );
/* */
FT_END_HEADER
#endif /* FTGASP_H_ */
/* END */
/***************************************************************************/
/* */
/* ttnameid.h */
/* */
/* TrueType name ID definitions (specification only). */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef TTNAMEID_H_
#define TTNAMEID_H_
#include <ft2build.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* truetype_tables */
/* */
/*************************************************************************/
/* */
/* Possible values for the `platform' identifier code in the name */
/* records of an SFNT `name' table. */
/* */
/*************************************************************************/
/***********************************************************************
*
* @enum:
* TT_PLATFORM_XXX
*
* @description:
* A list of valid values for the `platform_id' identifier code in
* @FT_CharMapRec and @FT_SfntName structures.
*
* @values:
* TT_PLATFORM_APPLE_UNICODE ::
* Used by Apple to indicate a Unicode character map and/or name entry.
* See @TT_APPLE_ID_XXX for corresponding `encoding_id' values. Note
* that name entries in this format are coded as big-endian UCS-2
* character codes _only_.
*
* TT_PLATFORM_MACINTOSH ::
* Used by Apple to indicate a MacOS-specific charmap and/or name entry.
* See @TT_MAC_ID_XXX for corresponding `encoding_id' values. Note that
* most TrueType fonts contain an Apple roman charmap to be usable on
* MacOS systems (even if they contain a Microsoft charmap as well).
*
* TT_PLATFORM_ISO ::
* This value was used to specify ISO/IEC 10646 charmaps. It is however
* now deprecated. See @TT_ISO_ID_XXX for a list of corresponding
* `encoding_id' values.
*
* TT_PLATFORM_MICROSOFT ::
* Used by Microsoft to indicate Windows-specific charmaps. See
* @TT_MS_ID_XXX for a list of corresponding `encoding_id' values.
* Note that most fonts contain a Unicode charmap using
* (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS).
*
* TT_PLATFORM_CUSTOM ::
* Used to indicate application-specific charmaps.
*
* TT_PLATFORM_ADOBE ::
* This value isn't part of any font format specification, but is used
* by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec
* structure. See @TT_ADOBE_ID_XXX.
*/
#define TT_PLATFORM_APPLE_UNICODE 0
#define TT_PLATFORM_MACINTOSH 1
#define TT_PLATFORM_ISO 2 /* deprecated */
#define TT_PLATFORM_MICROSOFT 3
#define TT_PLATFORM_CUSTOM 4
#define TT_PLATFORM_ADOBE 7 /* artificial */
/***********************************************************************
*
* @enum:
* TT_APPLE_ID_XXX
*
* @description:
* A list of valid values for the `encoding_id' for
* @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.
*
* @values:
* TT_APPLE_ID_DEFAULT ::
* Unicode version 1.0.
*
* TT_APPLE_ID_UNICODE_1_1 ::
* Unicode 1.1; specifies Hangul characters starting at U+34xx.
*
* TT_APPLE_ID_ISO_10646 ::
* Deprecated (identical to preceding).
*
* TT_APPLE_ID_UNICODE_2_0 ::
* Unicode 2.0 and beyond (UTF-16 BMP only).
*
* TT_APPLE_ID_UNICODE_32 ::
* Unicode 3.1 and beyond, using UTF-32.
*
* TT_APPLE_ID_VARIANT_SELECTOR ::
* From Adobe, not Apple. Not a normal cmap. Specifies variations
* on a real cmap.
*
* TT_APPLE_ID_FULL_UNICODE ::
* Used for fallback fonts that provide complete Unicode coverage with
* a type~13 cmap.
*/
#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */
#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */
#define TT_APPLE_ID_ISO_10646 2 /* deprecated */
#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */
#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */
#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */
#define TT_APPLE_ID_FULL_UNICODE 6 /* used with type 13 cmaps */
/***********************************************************************
*
* @enum:
* TT_MAC_ID_XXX
*
* @description:
* A list of valid values for the `encoding_id' for
* @TT_PLATFORM_MACINTOSH charmaps and name entries.
*/
#define TT_MAC_ID_ROMAN 0
#define TT_MAC_ID_JAPANESE 1
#define TT_MAC_ID_TRADITIONAL_CHINESE 2
#define TT_MAC_ID_KOREAN 3
#define TT_MAC_ID_ARABIC 4
#define TT_MAC_ID_HEBREW 5
#define TT_MAC_ID_GREEK 6
#define TT_MAC_ID_RUSSIAN 7
#define TT_MAC_ID_RSYMBOL 8
#define TT_MAC_ID_DEVANAGARI 9
#define TT_MAC_ID_GURMUKHI 10
#define TT_MAC_ID_GUJARATI 11
#define TT_MAC_ID_ORIYA 12
#define TT_MAC_ID_BENGALI 13
#define TT_MAC_ID_TAMIL 14
#define TT_MAC_ID_TELUGU 15
#define TT_MAC_ID_KANNADA 16
#define TT_MAC_ID_MALAYALAM 17
#define TT_MAC_ID_SINHALESE 18
#define TT_MAC_ID_BURMESE 19
#define TT_MAC_ID_KHMER 20
#define TT_MAC_ID_THAI 21
#define TT_MAC_ID_LAOTIAN 22
#define TT_MAC_ID_GEORGIAN 23
#define TT_MAC_ID_ARMENIAN 24
#define TT_MAC_ID_MALDIVIAN 25
#define TT_MAC_ID_SIMPLIFIED_CHINESE 25
#define TT_MAC_ID_TIBETAN 26
#define TT_MAC_ID_MONGOLIAN 27
#define TT_MAC_ID_GEEZ 28
#define TT_MAC_ID_SLAVIC 29
#define TT_MAC_ID_VIETNAMESE 30
#define TT_MAC_ID_SINDHI 31
#define TT_MAC_ID_UNINTERP 32
/***********************************************************************
*
* @enum:
* TT_ISO_ID_XXX
*
* @description:
* A list of valid values for the `encoding_id' for
* @TT_PLATFORM_ISO charmaps and name entries.
*
* Their use is now deprecated.
*
* @values:
* TT_ISO_ID_7BIT_ASCII ::
* ASCII.
* TT_ISO_ID_10646 ::
* ISO/10646.
* TT_ISO_ID_8859_1 ::
* Also known as Latin-1.
*/
#define TT_ISO_ID_7BIT_ASCII 0
#define TT_ISO_ID_10646 1
#define TT_ISO_ID_8859_1 2
/***********************************************************************
*
* @enum:
* TT_MS_ID_XXX
*
* @description:
* A list of valid values for the `encoding_id' for
* @TT_PLATFORM_MICROSOFT charmaps and name entries.
*
* @values:
* TT_MS_ID_SYMBOL_CS ::
* Microsoft symbol encoding. See @FT_ENCODING_MS_SYMBOL.
*
* TT_MS_ID_UNICODE_CS ::
* Microsoft WGL4 charmap, matching Unicode. See
* @FT_ENCODING_UNICODE.
*
* TT_MS_ID_SJIS ::
* Shift JIS Japanese encoding. See @FT_ENCODING_SJIS.
*
* TT_MS_ID_PRC ::
* Chinese encodings as used in the People's Republic of China (PRC).
* This means the encodings GB~2312 and its supersets GBK and
* GB~18030. See @FT_ENCODING_PRC.
*
* TT_MS_ID_BIG_5 ::
* Traditional Chinese as used in Taiwan and Hong Kong. See
* @FT_ENCODING_BIG5.
*
* TT_MS_ID_WANSUNG ::
* Korean Extended Wansung encoding. See @FT_ENCODING_WANSUNG.
*
* TT_MS_ID_JOHAB ::
* Korean Johab encoding. See @FT_ENCODING_JOHAB.
*
* TT_MS_ID_UCS_4 ::
* UCS-4 or UTF-32 charmaps. This has been added to the OpenType
* specification version 1.4 (mid-2001).
*/
#define TT_MS_ID_SYMBOL_CS 0
#define TT_MS_ID_UNICODE_CS 1
#define TT_MS_ID_SJIS 2
#define TT_MS_ID_PRC 3
#define TT_MS_ID_BIG_5 4
#define TT_MS_ID_WANSUNG 5
#define TT_MS_ID_JOHAB 6
#define TT_MS_ID_UCS_4 10
/* this value is deprecated */
#define TT_MS_ID_GB2312 TT_MS_ID_PRC
/***********************************************************************
*
* @enum:
* TT_ADOBE_ID_XXX
*
* @description:
* A list of valid values for the `encoding_id' for
* @TT_PLATFORM_ADOBE charmaps. This is a FreeType-specific extension!
*
* @values:
* TT_ADOBE_ID_STANDARD ::
* Adobe standard encoding.
* TT_ADOBE_ID_EXPERT ::
* Adobe expert encoding.
* TT_ADOBE_ID_CUSTOM ::
* Adobe custom encoding.
* TT_ADOBE_ID_LATIN_1 ::
* Adobe Latin~1 encoding.
*/
#define TT_ADOBE_ID_STANDARD 0
#define TT_ADOBE_ID_EXPERT 1
#define TT_ADOBE_ID_CUSTOM 2
#define TT_ADOBE_ID_LATIN_1 3
/***********************************************************************
*
* @enum:
* TT_MAC_LANGID_XXX
*
* @description:
* Possible values of the language identifier field in the name records
* of the SFNT `name' table if the `platform' identifier code is
* @TT_PLATFORM_MACINTOSH. These values are also used as return values
* for function @FT_Get_CMap_Language_ID.
*
* The canonical source for Apple's IDs is
*
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html
*/
#define TT_MAC_LANGID_ENGLISH 0
#define TT_MAC_LANGID_FRENCH 1
#define TT_MAC_LANGID_GERMAN 2
#define TT_MAC_LANGID_ITALIAN 3
#define TT_MAC_LANGID_DUTCH 4
#define TT_MAC_LANGID_SWEDISH 5
#define TT_MAC_LANGID_SPANISH 6
#define TT_MAC_LANGID_DANISH 7
#define TT_MAC_LANGID_PORTUGUESE 8
#define TT_MAC_LANGID_NORWEGIAN 9
#define TT_MAC_LANGID_HEBREW 10
#define TT_MAC_LANGID_JAPANESE 11
#define TT_MAC_LANGID_ARABIC 12
#define TT_MAC_LANGID_FINNISH 13
#define TT_MAC_LANGID_GREEK 14
#define TT_MAC_LANGID_ICELANDIC 15
#define TT_MAC_LANGID_MALTESE 16
#define TT_MAC_LANGID_TURKISH 17
#define TT_MAC_LANGID_CROATIAN 18
#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19
#define TT_MAC_LANGID_URDU 20
#define TT_MAC_LANGID_HINDI 21
#define TT_MAC_LANGID_THAI 22
#define TT_MAC_LANGID_KOREAN 23
#define TT_MAC_LANGID_LITHUANIAN 24
#define TT_MAC_LANGID_POLISH 25
#define TT_MAC_LANGID_HUNGARIAN 26
#define TT_MAC_LANGID_ESTONIAN 27
#define TT_MAC_LANGID_LETTISH 28
#define TT_MAC_LANGID_SAAMISK 29
#define TT_MAC_LANGID_FAEROESE 30
#define TT_MAC_LANGID_FARSI 31
#define TT_MAC_LANGID_RUSSIAN 32
#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33
#define TT_MAC_LANGID_FLEMISH 34
#define TT_MAC_LANGID_IRISH 35
#define TT_MAC_LANGID_ALBANIAN 36
#define TT_MAC_LANGID_ROMANIAN 37
#define TT_MAC_LANGID_CZECH 38
#define TT_MAC_LANGID_SLOVAK 39
#define TT_MAC_LANGID_SLOVENIAN 40
#define TT_MAC_LANGID_YIDDISH 41
#define TT_MAC_LANGID_SERBIAN 42
#define TT_MAC_LANGID_MACEDONIAN 43
#define TT_MAC_LANGID_BULGARIAN 44
#define TT_MAC_LANGID_UKRAINIAN 45
#define TT_MAC_LANGID_BYELORUSSIAN 46
#define TT_MAC_LANGID_UZBEK 47
#define TT_MAC_LANGID_KAZAKH 48
#define TT_MAC_LANGID_AZERBAIJANI 49
#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49
#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50
#define TT_MAC_LANGID_ARMENIAN 51
#define TT_MAC_LANGID_GEORGIAN 52
#define TT_MAC_LANGID_MOLDAVIAN 53
#define TT_MAC_LANGID_KIRGHIZ 54
#define TT_MAC_LANGID_TAJIKI 55
#define TT_MAC_LANGID_TURKMEN 56
#define TT_MAC_LANGID_MONGOLIAN 57
#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57
#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58
#define TT_MAC_LANGID_PASHTO 59
#define TT_MAC_LANGID_KURDISH 60
#define TT_MAC_LANGID_KASHMIRI 61
#define TT_MAC_LANGID_SINDHI 62
#define TT_MAC_LANGID_TIBETAN 63
#define TT_MAC_LANGID_NEPALI 64
#define TT_MAC_LANGID_SANSKRIT 65
#define TT_MAC_LANGID_MARATHI 66
#define TT_MAC_LANGID_BENGALI 67
#define TT_MAC_LANGID_ASSAMESE 68
#define TT_MAC_LANGID_GUJARATI 69
#define TT_MAC_LANGID_PUNJABI 70
#define TT_MAC_LANGID_ORIYA 71
#define TT_MAC_LANGID_MALAYALAM 72
#define TT_MAC_LANGID_KANNADA 73
#define TT_MAC_LANGID_TAMIL 74
#define TT_MAC_LANGID_TELUGU 75
#define TT_MAC_LANGID_SINHALESE 76
#define TT_MAC_LANGID_BURMESE 77
#define TT_MAC_LANGID_KHMER 78
#define TT_MAC_LANGID_LAO 79
#define TT_MAC_LANGID_VIETNAMESE 80
#define TT_MAC_LANGID_INDONESIAN 81
#define TT_MAC_LANGID_TAGALOG 82
#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83
#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84
#define TT_MAC_LANGID_AMHARIC 85
#define TT_MAC_LANGID_TIGRINYA 86
#define TT_MAC_LANGID_GALLA 87
#define TT_MAC_LANGID_SOMALI 88
#define TT_MAC_LANGID_SWAHILI 89
#define TT_MAC_LANGID_RUANDA 90
#define TT_MAC_LANGID_RUNDI 91
#define TT_MAC_LANGID_CHEWA 92
#define TT_MAC_LANGID_MALAGASY 93
#define TT_MAC_LANGID_ESPERANTO 94
#define TT_MAC_LANGID_WELSH 128
#define TT_MAC_LANGID_BASQUE 129
#define TT_MAC_LANGID_CATALAN 130
#define TT_MAC_LANGID_LATIN 131
#define TT_MAC_LANGID_QUECHUA 132
#define TT_MAC_LANGID_GUARANI 133
#define TT_MAC_LANGID_AYMARA 134
#define TT_MAC_LANGID_TATAR 135
#define TT_MAC_LANGID_UIGHUR 136
#define TT_MAC_LANGID_DZONGKHA 137
#define TT_MAC_LANGID_JAVANESE 138
#define TT_MAC_LANGID_SUNDANESE 139
/* The following codes are new as of 2000-03-10 */
#define TT_MAC_LANGID_GALICIAN 140
#define TT_MAC_LANGID_AFRIKAANS 141
#define TT_MAC_LANGID_BRETON 142
#define TT_MAC_LANGID_INUKTITUT 143
#define TT_MAC_LANGID_SCOTTISH_GAELIC 144
#define TT_MAC_LANGID_MANX_GAELIC 145
#define TT_MAC_LANGID_IRISH_GAELIC 146
#define TT_MAC_LANGID_TONGAN 147
#define TT_MAC_LANGID_GREEK_POLYTONIC 148
#define TT_MAC_LANGID_GREELANDIC 149
#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150
/***********************************************************************
*
* @enum:
* TT_MS_LANGID_XXX
*
* @description:
* Possible values of the language identifier field in the name records
* of the SFNT `name' table if the `platform' identifier code is
* @TT_PLATFORM_MICROSOFT. These values are also used as return values
* for function @FT_Get_CMap_Language_ID.
*
* The canonical source for Microsoft's IDs is
*
* https://www.microsoft.com/globaldev/reference/lcid-all.mspx ,
*
* however, we only provide macros for language identifiers present in
* the OpenType specification: Microsoft has abandoned the concept of
* LCIDs (language code identifiers), and format~1 of the `name' table
* provides a better mechanism for languages not covered here.
*
* More legacy values not listed in the reference can be found in the
* @FT_TRUETYPE_IDS_H header file.
*/
#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401
#define TT_MS_LANGID_ARABIC_IRAQ 0x0801
#define TT_MS_LANGID_ARABIC_EGYPT 0x0C01
#define TT_MS_LANGID_ARABIC_LIBYA 0x1001
#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401
#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801
#define TT_MS_LANGID_ARABIC_TUNISIA 0x1C01
#define TT_MS_LANGID_ARABIC_OMAN 0x2001
#define TT_MS_LANGID_ARABIC_YEMEN 0x2401
#define TT_MS_LANGID_ARABIC_SYRIA 0x2801
#define TT_MS_LANGID_ARABIC_JORDAN 0x2C01
#define TT_MS_LANGID_ARABIC_LEBANON 0x3001
#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401
#define TT_MS_LANGID_ARABIC_UAE 0x3801
#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3C01
#define TT_MS_LANGID_ARABIC_QATAR 0x4001
#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402
#define TT_MS_LANGID_CATALAN_CATALAN 0x0403
#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404
#define TT_MS_LANGID_CHINESE_PRC 0x0804
#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0C04
#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004
#define TT_MS_LANGID_CHINESE_MACAO 0x1404
#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405
#define TT_MS_LANGID_DANISH_DENMARK 0x0406
#define TT_MS_LANGID_GERMAN_GERMANY 0x0407
#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807
#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0C07
#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007
#define TT_MS_LANGID_GERMAN_LIECHTENSTEIN 0x1407
#define TT_MS_LANGID_GREEK_GREECE 0x0408
#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409
#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809
#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0C09
#define TT_MS_LANGID_ENGLISH_CANADA 0x1009
#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409
#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809
#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1C09
#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009
#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409
#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809
#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2C09
#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009
#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409
#define TT_MS_LANGID_ENGLISH_INDIA 0x4009
#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409
#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809
#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040A
#define TT_MS_LANGID_SPANISH_MEXICO 0x080A
#define TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT 0x0C0A
#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100A
#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140A
#define TT_MS_LANGID_SPANISH_PANAMA 0x180A
#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1C0A
#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200A
#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240A
#define TT_MS_LANGID_SPANISH_PERU 0x280A
#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2C0A
#define TT_MS_LANGID_SPANISH_ECUADOR 0x300A
#define TT_MS_LANGID_SPANISH_CHILE 0x340A
#define TT_MS_LANGID_SPANISH_URUGUAY 0x380A
#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3C0A
#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400A
#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440A
#define TT_MS_LANGID_SPANISH_HONDURAS 0x480A
#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4C0A
#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500A
#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540A
#define TT_MS_LANGID_FINNISH_FINLAND 0x040B
#define TT_MS_LANGID_FRENCH_FRANCE 0x040C
#define TT_MS_LANGID_FRENCH_BELGIUM 0x080C
#define TT_MS_LANGID_FRENCH_CANADA 0x0C0C
#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100C
#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140C
#define TT_MS_LANGID_FRENCH_MONACO 0x180C
#define TT_MS_LANGID_HEBREW_ISRAEL 0x040D
#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040E
#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040F
#define TT_MS_LANGID_ITALIAN_ITALY 0x0410
#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810
#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411
#define TT_MS_LANGID_KOREAN_KOREA 0x0412
#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413
#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813
#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414
#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814
#define TT_MS_LANGID_POLISH_POLAND 0x0415
#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416
#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816
#define TT_MS_LANGID_ROMANSH_SWITZERLAND 0x0417
#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418
#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419
#define TT_MS_LANGID_CROATIAN_CROATIA 0x041A
#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081A
#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0C1A
#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101A
#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141A
#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181A
#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x1C1A
#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC 0x201A
#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041B
#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041C
#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041D
#define TT_MS_LANGID_SWEDISH_FINLAND 0x081D
#define TT_MS_LANGID_THAI_THAILAND 0x041E
#define TT_MS_LANGID_TURKISH_TURKEY 0x041F
#define TT_MS_LANGID_URDU_PAKISTAN 0x0420
#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421
#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422
#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423
#define TT_MS_LANGID_SLOVENIAN_SLOVENIA 0x0424
#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425
#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426
#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427
#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428
#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042A
#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042B
#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042C
#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082C
#define TT_MS_LANGID_BASQUE_BASQUE 0x042D
#define TT_MS_LANGID_UPPER_SORBIAN_GERMANY 0x042E
#define TT_MS_LANGID_LOWER_SORBIAN_GERMANY 0x082E
#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042F
#define TT_MS_LANGID_SETSWANA_SOUTH_AFRICA 0x0432
#define TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA 0x0434
#define TT_MS_LANGID_ISIZULU_SOUTH_AFRICA 0x0435
#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436
#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437
#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438
#define TT_MS_LANGID_HINDI_INDIA 0x0439
#define TT_MS_LANGID_MALTESE_MALTA 0x043A
#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043B
#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083B
#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3B
#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103B
#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143B
#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183B
#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3B
#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203B
#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243B
#define TT_MS_LANGID_IRISH_IRELAND 0x083C
#define TT_MS_LANGID_MALAY_MALAYSIA 0x043E
#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083E
#define TT_MS_LANGID_KAZAKH_KAZAKHSTAN 0x043F
#define TT_MS_LANGID_KYRGYZ_KYRGYZSTAN /* Cyrillic*/ 0x0440
#define TT_MS_LANGID_KISWAHILI_KENYA 0x0441
#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442
#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443
#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843
#define TT_MS_LANGID_TATAR_RUSSIA 0x0444
#define TT_MS_LANGID_BENGALI_INDIA 0x0445
#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845
#define TT_MS_LANGID_PUNJABI_INDIA 0x0446
#define TT_MS_LANGID_GUJARATI_INDIA 0x0447
#define TT_MS_LANGID_ODIA_INDIA 0x0448
#define TT_MS_LANGID_TAMIL_INDIA 0x0449
#define TT_MS_LANGID_TELUGU_INDIA 0x044A
#define TT_MS_LANGID_KANNADA_INDIA 0x044B
#define TT_MS_LANGID_MALAYALAM_INDIA 0x044C
#define TT_MS_LANGID_ASSAMESE_INDIA 0x044D
#define TT_MS_LANGID_MARATHI_INDIA 0x044E
#define TT_MS_LANGID_SANSKRIT_INDIA 0x044F
#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450
#define TT_MS_LANGID_MONGOLIAN_PRC 0x0850
#define TT_MS_LANGID_TIBETAN_PRC 0x0451
#define TT_MS_LANGID_WELSH_UNITED_KINGDOM 0x0452
#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453
#define TT_MS_LANGID_LAO_LAOS 0x0454
#define TT_MS_LANGID_GALICIAN_GALICIAN 0x0456
#define TT_MS_LANGID_KONKANI_INDIA 0x0457
#define TT_MS_LANGID_SYRIAC_SYRIA 0x045A
#define TT_MS_LANGID_SINHALA_SRI_LANKA 0x045B
#define TT_MS_LANGID_INUKTITUT_CANADA 0x045D
#define TT_MS_LANGID_INUKTITUT_CANADA_LATIN 0x085D
#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045E
#define TT_MS_LANGID_TAMAZIGHT_ALGERIA 0x085F
#define TT_MS_LANGID_NEPALI_NEPAL 0x0461
#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462
#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463
#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464
#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465
#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468
#define TT_MS_LANGID_YORUBA_NIGERIA 0x046A
#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046B
#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086B
#define TT_MS_LANGID_QUECHUA_PERU 0x0C6B
#define TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA 0x046C
#define TT_MS_LANGID_BASHKIR_RUSSIA 0x046D
#define TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG 0x046E
#define TT_MS_LANGID_GREENLANDIC_GREENLAND 0x046F
#define TT_MS_LANGID_IGBO_NIGERIA 0x0470
#define TT_MS_LANGID_YI_PRC 0x0478
#define TT_MS_LANGID_MAPUDUNGUN_CHILE 0x047A
#define TT_MS_LANGID_MOHAWK_MOHAWK 0x047C
#define TT_MS_LANGID_BRETON_FRANCE 0x047E
#define TT_MS_LANGID_UIGHUR_PRC 0x0480
#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481
#define TT_MS_LANGID_OCCITAN_FRANCE 0x0482
#define TT_MS_LANGID_CORSICAN_FRANCE 0x0483
#define TT_MS_LANGID_ALSATIAN_FRANCE 0x0484
#define TT_MS_LANGID_YAKUT_RUSSIA 0x0485
#define TT_MS_LANGID_KICHE_GUATEMALA 0x0486
#define TT_MS_LANGID_KINYARWANDA_RWANDA 0x0487
#define TT_MS_LANGID_WOLOF_SENEGAL 0x0488
#define TT_MS_LANGID_DARI_AFGHANISTAN 0x048C
/* */
/* legacy macro definitions not present in OpenType 1.8.1 */
#define TT_MS_LANGID_ARABIC_GENERAL 0x0001
#define TT_MS_LANGID_CATALAN_SPAIN \
TT_MS_LANGID_CATALAN_CATALAN
#define TT_MS_LANGID_CHINESE_GENERAL 0x0004
#define TT_MS_LANGID_CHINESE_MACAU \
TT_MS_LANGID_CHINESE_MACAO
#define TT_MS_LANGID_GERMAN_LIECHTENSTEI \
TT_MS_LANGID_GERMAN_LIECHTENSTEIN
#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009
#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809
#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3C09
#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT \
TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT
#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40AU
#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1C0C
#define TT_MS_LANGID_FRENCH_REUNION 0x200C
#define TT_MS_LANGID_FRENCH_CONGO 0x240C
/* which was formerly: */
#define TT_MS_LANGID_FRENCH_ZAIRE \
TT_MS_LANGID_FRENCH_CONGO
#define TT_MS_LANGID_FRENCH_SENEGAL 0x280C
#define TT_MS_LANGID_FRENCH_CAMEROON 0x2C0C
#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300C
#define TT_MS_LANGID_FRENCH_MALI 0x340C
#define TT_MS_LANGID_FRENCH_MOROCCO 0x380C
#define TT_MS_LANGID_FRENCH_HAITI 0x3C0C
#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40CU
#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA \
TT_MS_LANGID_KOREAN_KOREA
#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812
#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND \
TT_MS_LANGID_ROMANSH_SWITZERLAND
#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818
#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819
#define TT_MS_LANGID_URDU_INDIA 0x0820
#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827
#define TT_MS_LANGID_SLOVENE_SLOVENIA \
TT_MS_LANGID_SLOVENIAN_SLOVENIA
#define TT_MS_LANGID_FARSI_IRAN 0x0429
#define TT_MS_LANGID_BASQUE_SPAIN \
TT_MS_LANGID_BASQUE_BASQUE
#define TT_MS_LANGID_SORBIAN_GERMANY \
TT_MS_LANGID_UPPER_SORBIAN_GERMANY
#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430
#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431
#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA \
TT_MS_LANGID_SETSWANA_SOUTH_AFRICA
#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433
#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA \
TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA
#define TT_MS_LANGID_ZULU_SOUTH_AFRICA \
TT_MS_LANGID_ISIZULU_SOUTH_AFRICA
#define TT_MS_LANGID_SAAMI_LAPONIA 0x043B
/* the next two values are incorrectly inverted */
#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C
#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C
#define TT_MS_LANGID_YIDDISH_GERMANY 0x043D
#define TT_MS_LANGID_KAZAK_KAZAKSTAN \
TT_MS_LANGID_KAZAKH_KAZAKHSTAN
#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \
TT_MS_LANGID_KYRGYZ_KYRGYZSTAN
#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN \
TT_MS_LANGID_KYRGYZ_KYRGYZSTAN
#define TT_MS_LANGID_SWAHILI_KENYA \
TT_MS_LANGID_KISWAHILI_KENYA
#define TT_MS_LANGID_TATAR_TATARSTAN \
TT_MS_LANGID_TATAR_RUSSIA
#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846
#define TT_MS_LANGID_ORIYA_INDIA \
TT_MS_LANGID_ODIA_INDIA
#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN \
TT_MS_LANGID_MONGOLIAN_PRC
#define TT_MS_LANGID_TIBETAN_CHINA \
TT_MS_LANGID_TIBETAN_PRC
#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851
#define TT_MS_LANGID_TIBETAN_BHUTAN \
TT_MS_LANGID_DZONGHKA_BHUTAN
#define TT_MS_LANGID_WELSH_WALES \
TT_MS_LANGID_WELSH_UNITED_KINGDOM
#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455
#define TT_MS_LANGID_GALICIAN_SPAIN \
TT_MS_LANGID_GALICIAN_GALICIAN
#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458
#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459
#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859
#define TT_MS_LANGID_SINHALESE_SRI_LANKA \
TT_MS_LANGID_SINHALA_SRI_LANKA
#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045C
#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045F
#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN \
TT_MS_LANGID_TAMAZIGHT_ALGERIA
#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460
#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860
#define TT_MS_LANGID_KASHMIRI_INDIA \
TT_MS_LANGID_KASHMIRI_SASIA
#define TT_MS_LANGID_NEPALI_INDIA 0x0861
#define TT_MS_LANGID_DIVEHI_MALDIVES \
TT_MS_LANGID_DHIVEHI_MALDIVES
#define TT_MS_LANGID_EDO_NIGERIA 0x0466
#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467
#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469
#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA \
TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA
#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \
TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA
#define TT_MS_LANGID_KANURI_NIGERIA 0x0471
#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472
#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473
#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873
#define TT_MS_LANGID_TIGRIGNA_ERYTREA \
TT_MS_LANGID_TIGRIGNA_ERYTHREA
#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474
#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475
#define TT_MS_LANGID_LATIN 0x0476
#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477
#define TT_MS_LANGID_YI_CHINA \
TT_MS_LANGID_YI_PRC
#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479
#define TT_MS_LANGID_UIGHUR_CHINA \
TT_MS_LANGID_UIGHUR_PRC
/***********************************************************************
*
* @enum:
* TT_NAME_ID_XXX
*
* @description:
* Possible values of the `name' identifier field in the name records of
* an SFNT `name' table. These values are platform independent.
*/
#define TT_NAME_ID_COPYRIGHT 0
#define TT_NAME_ID_FONT_FAMILY 1
#define TT_NAME_ID_FONT_SUBFAMILY 2
#define TT_NAME_ID_UNIQUE_ID 3
#define TT_NAME_ID_FULL_NAME 4
#define TT_NAME_ID_VERSION_STRING 5
#define TT_NAME_ID_PS_NAME 6
#define TT_NAME_ID_TRADEMARK 7
/* the following values are from the OpenType spec */
#define TT_NAME_ID_MANUFACTURER 8
#define TT_NAME_ID_DESIGNER 9
#define TT_NAME_ID_DESCRIPTION 10
#define TT_NAME_ID_VENDOR_URL 11
#define TT_NAME_ID_DESIGNER_URL 12
#define TT_NAME_ID_LICENSE 13
#define TT_NAME_ID_LICENSE_URL 14
/* number 15 is reserved */
#define TT_NAME_ID_TYPOGRAPHIC_FAMILY 16
#define TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY 17
#define TT_NAME_ID_MAC_FULL_NAME 18
/* The following code is new as of 2000-01-21 */
#define TT_NAME_ID_SAMPLE_TEXT 19
/* This is new in OpenType 1.3 */
#define TT_NAME_ID_CID_FINDFONT_NAME 20
/* This is new in OpenType 1.5 */
#define TT_NAME_ID_WWS_FAMILY 21
#define TT_NAME_ID_WWS_SUBFAMILY 22
/* This is new in OpenType 1.7 */
#define TT_NAME_ID_LIGHT_BACKGROUND 23
#define TT_NAME_ID_DARK_BACKGROUND 24
/* This is new in OpenType 1.8 */
#define TT_NAME_ID_VARIATIONS_PREFIX 25
/* these two values are deprecated */
#define TT_NAME_ID_PREFERRED_FAMILY TT_NAME_ID_TYPOGRAPHIC_FAMILY
#define TT_NAME_ID_PREFERRED_SUBFAMILY TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY
/***********************************************************************
*
* @enum:
* TT_UCR_XXX
*
* @description:
* Possible bit mask values for the `ulUnicodeRangeX' fields in an SFNT
* `OS/2' table.
*/
/* ulUnicodeRange1 */
/* --------------- */
/* Bit 0 Basic Latin */
#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */
/* Bit 1 C1 Controls and Latin-1 Supplement */
#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */
/* Bit 2 Latin Extended-A */
#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */
/* Bit 3 Latin Extended-B */
#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */
/* Bit 4 IPA Extensions */
/* Phonetic Extensions */
/* Phonetic Extensions Supplement */
#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */
/* U+1D00-U+1D7F */
/* U+1D80-U+1DBF */
/* Bit 5 Spacing Modifier Letters */
/* Modifier Tone Letters */
#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */
/* U+A700-U+A71F */
/* Bit 6 Combining Diacritical Marks */
/* Combining Diacritical Marks Supplement */
#define TT_UCR_COMBINING_DIACRITICAL_MARKS (1L << 6) /* U+0300-U+036F */
/* U+1DC0-U+1DFF */
/* Bit 7 Greek and Coptic */
#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */
/* Bit 8 Coptic */
#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */
/* Bit 9 Cyrillic */
/* Cyrillic Supplement */
/* Cyrillic Extended-A */
/* Cyrillic Extended-B */
#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */
/* U+0500-U+052F */
/* U+2DE0-U+2DFF */
/* U+A640-U+A69F */
/* Bit 10 Armenian */
#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */
/* Bit 11 Hebrew */
#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */
/* Bit 12 Vai */
#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */
/* Bit 13 Arabic */
/* Arabic Supplement */
#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */
/* U+0750-U+077F */
/* Bit 14 NKo */
#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */
/* Bit 15 Devanagari */
#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */
/* Bit 16 Bengali */
#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */
/* Bit 17 Gurmukhi */
#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */
/* Bit 18 Gujarati */
#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */
/* Bit 19 Oriya */
#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */
/* Bit 20 Tamil */
#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */
/* Bit 21 Telugu */
#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */
/* Bit 22 Kannada */
#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */
/* Bit 23 Malayalam */
#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */
/* Bit 24 Thai */
#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */
/* Bit 25 Lao */
#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */
/* Bit 26 Georgian */
/* Georgian Supplement */
#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */
/* U+2D00-U+2D2F */
/* Bit 27 Balinese */
#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */
/* Bit 28 Hangul Jamo */
#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */
/* Bit 29 Latin Extended Additional */
/* Latin Extended-C */
/* Latin Extended-D */
#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */
/* U+2C60-U+2C7F */
/* U+A720-U+A7FF */
/* Bit 30 Greek Extended */
#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */
/* Bit 31 General Punctuation */
/* Supplemental Punctuation */
#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */
/* U+2E00-U+2E7F */
/* ulUnicodeRange2 */
/* --------------- */
/* Bit 32 Superscripts And Subscripts */
#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */
/* Bit 33 Currency Symbols */
#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */
/* Bit 34 Combining Diacritical Marks For Symbols */
#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \
(1L << 2) /* U+20D0-U+20FF */
/* Bit 35 Letterlike Symbols */
#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */
/* Bit 36 Number Forms */
#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */
/* Bit 37 Arrows */
/* Supplemental Arrows-A */
/* Supplemental Arrows-B */
/* Miscellaneous Symbols and Arrows */
#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */
/* U+27F0-U+27FF */
/* U+2900-U+297F */
/* U+2B00-U+2BFF */
/* Bit 38 Mathematical Operators */
/* Supplemental Mathematical Operators */
/* Miscellaneous Mathematical Symbols-A */
/* Miscellaneous Mathematical Symbols-B */
#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */
/* U+2A00-U+2AFF */
/* U+27C0-U+27EF */
/* U+2980-U+29FF */
/* Bit 39 Miscellaneous Technical */
#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */
/* Bit 40 Control Pictures */
#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */
/* Bit 41 Optical Character Recognition */
#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */
/* Bit 42 Enclosed Alphanumerics */
#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */
/* Bit 43 Box Drawing */
#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */
/* Bit 44 Block Elements */
#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */
/* Bit 45 Geometric Shapes */
#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */
/* Bit 46 Miscellaneous Symbols */
#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */
/* Bit 47 Dingbats */
#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */
/* Bit 48 CJK Symbols and Punctuation */
#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */
/* Bit 49 Hiragana */
#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */
/* Bit 50 Katakana */
/* Katakana Phonetic Extensions */
#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */
/* U+31F0-U+31FF */
/* Bit 51 Bopomofo */
/* Bopomofo Extended */
#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */
/* U+31A0-U+31BF */
/* Bit 52 Hangul Compatibility Jamo */
#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */
/* Bit 53 Phags-Pa */
#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */
#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */
#define TT_UCR_PHAGSPA
/* Bit 54 Enclosed CJK Letters and Months */
#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */
/* Bit 55 CJK Compatibility */
#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */
/* Bit 56 Hangul Syllables */
#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */
/* Bit 57 High Surrogates */
/* High Private Use Surrogates */
/* Low Surrogates */
/* According to OpenType specs v.1.3+, */
/* setting bit 57 implies that there is */
/* at least one codepoint beyond the */
/* Basic Multilingual Plane that is */
/* supported by this font. So it really */
/* means >= U+10000. */
#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */
/* U+DB80-U+DBFF */
/* U+DC00-U+DFFF */
#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES
/* Bit 58 Phoenician */
#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/
/* Bit 59 CJK Unified Ideographs */
/* CJK Radicals Supplement */
/* Kangxi Radicals */
/* Ideographic Description Characters */
/* CJK Unified Ideographs Extension A */
/* CJK Unified Ideographs Extension B */
/* Kanbun */
#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */
/* U+2E80-U+2EFF */
/* U+2F00-U+2FDF */
/* U+2FF0-U+2FFF */
/* U+3400-U+4DB5 */
/*U+20000-U+2A6DF*/
/* U+3190-U+319F */
/* Bit 60 Private Use */
#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */
/* Bit 61 CJK Strokes */
/* CJK Compatibility Ideographs */
/* CJK Compatibility Ideographs Supplement */
#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */
/* U+F900-U+FAFF */
/*U+2F800-U+2FA1F*/
/* Bit 62 Alphabetic Presentation Forms */
#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */
/* Bit 63 Arabic Presentation Forms-A */
#define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1L << 31) /* U+FB50-U+FDFF */
/* ulUnicodeRange3 */
/* --------------- */
/* Bit 64 Combining Half Marks */
#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */
/* Bit 65 Vertical forms */
/* CJK Compatibility Forms */
#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */
/* U+FE30-U+FE4F */
/* Bit 66 Small Form Variants */
#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */
/* Bit 67 Arabic Presentation Forms-B */
#define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1L << 3) /* U+FE70-U+FEFE */
/* Bit 68 Halfwidth and Fullwidth Forms */
#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */
/* Bit 69 Specials */
#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */
/* Bit 70 Tibetan */
#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */
/* Bit 71 Syriac */
#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */
/* Bit 72 Thaana */
#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */
/* Bit 73 Sinhala */
#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */
/* Bit 74 Myanmar */
#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */
/* Bit 75 Ethiopic */
/* Ethiopic Supplement */
/* Ethiopic Extended */
#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */
/* U+1380-U+139F */
/* U+2D80-U+2DDF */
/* Bit 76 Cherokee */
#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */
/* Bit 77 Unified Canadian Aboriginal Syllabics */
#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */
/* Bit 78 Ogham */
#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */
/* Bit 79 Runic */
#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */
/* Bit 80 Khmer */
/* Khmer Symbols */
#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */
/* U+19E0-U+19FF */
/* Bit 81 Mongolian */
#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */
/* Bit 82 Braille Patterns */
#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */
/* Bit 83 Yi Syllables */
/* Yi Radicals */
#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */
/* U+A490-U+A4CF */
/* Bit 84 Tagalog */
/* Hanunoo */
/* Buhid */
/* Tagbanwa */
#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */
/* U+1720-U+173F */
/* U+1740-U+175F */
/* U+1760-U+177F */
/* Bit 85 Old Italic */
#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/
/* Bit 86 Gothic */
#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/
/* Bit 87 Deseret */
#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/
/* Bit 88 Byzantine Musical Symbols */
/* Musical Symbols */
/* Ancient Greek Musical Notation */
#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/
/*U+1D100-U+1D1FF*/
/*U+1D200-U+1D24F*/
/* Bit 89 Mathematical Alphanumeric Symbols */
#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/
/* Bit 90 Private Use (plane 15) */
/* Private Use (plane 16) */
#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/
/*U+100000-U+10FFFD*/
/* Bit 91 Variation Selectors */
/* Variation Selectors Supplement */
#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */
/*U+E0100-U+E01EF*/
/* Bit 92 Tags */
#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/
/* Bit 93 Limbu */
#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */
/* Bit 94 Tai Le */
#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */
/* Bit 95 New Tai Lue */
#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */
/* ulUnicodeRange4 */
/* --------------- */
/* Bit 96 Buginese */
#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */
/* Bit 97 Glagolitic */
#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */
/* Bit 98 Tifinagh */
#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */
/* Bit 99 Yijing Hexagram Symbols */
#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */
/* Bit 100 Syloti Nagri */
#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */
/* Bit 101 Linear B Syllabary */
/* Linear B Ideograms */
/* Aegean Numbers */
#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/
/*U+10080-U+100FF*/
/*U+10100-U+1013F*/
/* Bit 102 Ancient Greek Numbers */
#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/
/* Bit 103 Ugaritic */
#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/
/* Bit 104 Old Persian */
#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/
/* Bit 105 Shavian */
#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/
/* Bit 106 Osmanya */
#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/
/* Bit 107 Cypriot Syllabary */
#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/
/* Bit 108 Kharoshthi */
#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/
/* Bit 109 Tai Xuan Jing Symbols */
#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/
/* Bit 110 Cuneiform */
/* Cuneiform Numbers and Punctuation */
#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/
/*U+12400-U+1247F*/
/* Bit 111 Counting Rod Numerals */
#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/
/* Bit 112 Sundanese */
#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */
/* Bit 113 Lepcha */
#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */
/* Bit 114 Ol Chiki */
#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */
/* Bit 115 Saurashtra */
#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */
/* Bit 116 Kayah Li */
#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */
/* Bit 117 Rejang */
#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */
/* Bit 118 Cham */
#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */
/* Bit 119 Ancient Symbols */
#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/
/* Bit 120 Phaistos Disc */
#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/
/* Bit 121 Carian */
/* Lycian */
/* Lydian */
#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/
/*U+10280-U+1029F*/
/*U+10920-U+1093F*/
/* Bit 122 Domino Tiles */
/* Mahjong Tiles */
#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/
/*U+1F000-U+1F02F*/
/* Bit 123-127 Reserved for process-internal usage */
/* */
/* for backward compatibility with older FreeType versions */
#define TT_UCR_ARABIC_PRESENTATION_A \
TT_UCR_ARABIC_PRESENTATION_FORMS_A
#define TT_UCR_ARABIC_PRESENTATION_B \
TT_UCR_ARABIC_PRESENTATION_FORMS_B
#define TT_UCR_COMBINING_DIACRITICS \
TT_UCR_COMBINING_DIACRITICAL_MARKS
#define TT_UCR_COMBINING_DIACRITICS_SYMB \
TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB
FT_END_HEADER
#endif /* TTNAMEID_H_ */
/* END */
/***************************************************************************/
/* */
/* ftwinfnt.h */
/* */
/* FreeType API for accessing Windows fnt-specific data. */
/* */
/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTWINFNT_H_
#define FTWINFNT_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* winfnt_fonts */
/* */
/* <Title> */
/* Window FNT Files */
/* */
/* <Abstract> */
/* Windows FNT specific API. */
/* */
/* <Description> */
/* This section contains the declaration of Windows FNT specific */
/* functions. */
/* */
/*************************************************************************/
/*************************************************************************
*
* @enum:
* FT_WinFNT_ID_XXX
*
* @description:
* A list of valid values for the `charset' byte in
* @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX
* encodings (except for cp1361) can be found at
* ftp://ftp.unicode.org/Public in the MAPPINGS/VENDORS/MICSFT/WINDOWS
* subdirectory. cp1361 is roughly a superset of
* MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.
*
* @values:
* FT_WinFNT_ID_DEFAULT ::
* This is used for font enumeration and font creation as a
* `don't care' value. Valid font files don't contain this value.
* When querying for information about the character set of the font
* that is currently selected into a specified device context, this
* return value (of the related Windows API) simply denotes failure.
*
* FT_WinFNT_ID_SYMBOL ::
* There is no known mapping table available.
*
* FT_WinFNT_ID_MAC ::
* Mac Roman encoding.
*
* FT_WinFNT_ID_OEM ::
* From Michael Poettgen <michael@poettgen.de>:
*
* The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM
* is used for the charset of vector fonts, like `modern.fon',
* `roman.fon', and `script.fon' on Windows.
*
* The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value
* specifies a character set that is operating-system dependent.
*
* The `IFIMETRICS' documentation from the `Windows Driver
* Development Kit' says: This font supports an OEM-specific
* character set. The OEM character set is system dependent.
*
* In general OEM, as opposed to ANSI (i.e., cp1252), denotes the
* second default codepage that most international versions of
* Windows have. It is one of the OEM codepages from
*
* https://msdn.microsoft.com/en-us/goglobal/bb964655,
*
* and is used for the `DOS boxes', to support legacy applications.
* A German Windows version for example usually uses ANSI codepage
* 1252 and OEM codepage 850.
*
* FT_WinFNT_ID_CP874 ::
* A superset of Thai TIS 620 and ISO 8859-11.
*
* FT_WinFNT_ID_CP932 ::
* A superset of Japanese Shift-JIS (with minor deviations).
*
* FT_WinFNT_ID_CP936 ::
* A superset of simplified Chinese GB 2312-1980 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP949 ::
* A superset of Korean Hangul KS~C 5601-1987 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP950 ::
* A superset of traditional Chinese Big~5 ETen (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP1250 ::
* A superset of East European ISO 8859-2 (with slightly different
* ordering).
*
* FT_WinFNT_ID_CP1251 ::
* A superset of Russian ISO 8859-5 (with different ordering).
*
* FT_WinFNT_ID_CP1252 ::
* ANSI encoding. A superset of ISO 8859-1.
*
* FT_WinFNT_ID_CP1253 ::
* A superset of Greek ISO 8859-7 (with minor modifications).
*
* FT_WinFNT_ID_CP1254 ::
* A superset of Turkish ISO 8859-9.
*
* FT_WinFNT_ID_CP1255 ::
* A superset of Hebrew ISO 8859-8 (with some modifications).
*
* FT_WinFNT_ID_CP1256 ::
* A superset of Arabic ISO 8859-6 (with different ordering).
*
* FT_WinFNT_ID_CP1257 ::
* A superset of Baltic ISO 8859-13 (with some deviations).
*
* FT_WinFNT_ID_CP1258 ::
* For Vietnamese. This encoding doesn't cover all necessary
* characters.
*
* FT_WinFNT_ID_CP1361 ::
* Korean (Johab).
*/
#define FT_WinFNT_ID_CP1252 0
#define FT_WinFNT_ID_DEFAULT 1
#define FT_WinFNT_ID_SYMBOL 2
#define FT_WinFNT_ID_MAC 77
#define FT_WinFNT_ID_CP932 128
#define FT_WinFNT_ID_CP949 129
#define FT_WinFNT_ID_CP1361 130
#define FT_WinFNT_ID_CP936 134
#define FT_WinFNT_ID_CP950 136
#define FT_WinFNT_ID_CP1253 161
#define FT_WinFNT_ID_CP1254 162
#define FT_WinFNT_ID_CP1258 163
#define FT_WinFNT_ID_CP1255 177
#define FT_WinFNT_ID_CP1256 178
#define FT_WinFNT_ID_CP1257 186
#define FT_WinFNT_ID_CP1251 204
#define FT_WinFNT_ID_CP874 222
#define FT_WinFNT_ID_CP1250 238
#define FT_WinFNT_ID_OEM 255
/*************************************************************************/
/* */
/* <Struct> */
/* FT_WinFNT_HeaderRec */
/* */
/* <Description> */
/* Windows FNT Header info. */
/* */
typedef struct FT_WinFNT_HeaderRec_
{
FT_UShort version;
FT_ULong file_size;
FT_Byte copyright[60];
FT_UShort file_type;
FT_UShort nominal_point_size;
FT_UShort vertical_resolution;
FT_UShort horizontal_resolution;
FT_UShort ascent;
FT_UShort internal_leading;
FT_UShort external_leading;
FT_Byte italic;
FT_Byte underline;
FT_Byte strike_out;
FT_UShort weight;
FT_Byte charset;
FT_UShort pixel_width;
FT_UShort pixel_height;
FT_Byte pitch_and_family;
FT_UShort avg_width;
FT_UShort max_width;
FT_Byte first_char;
FT_Byte last_char;
FT_Byte default_char;
FT_Byte break_char;
FT_UShort bytes_per_row;
FT_ULong device_offset;
FT_ULong face_name_offset;
FT_ULong bits_pointer;
FT_ULong bits_offset;
FT_Byte reserved;
FT_ULong flags;
FT_UShort A_space;
FT_UShort B_space;
FT_UShort C_space;
FT_UShort color_table_offset;
FT_ULong reserved1[4];
} FT_WinFNT_HeaderRec;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_WinFNT_Header */
/* */
/* <Description> */
/* A handle to an @FT_WinFNT_HeaderRec structure. */
/* */
typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header;
/**********************************************************************
*
* @function:
* FT_Get_WinFNT_Header
*
* @description:
* Retrieve a Windows FNT font info header.
*
* @input:
* face :: A handle to the input face.
*
* @output:
* aheader :: The WinFNT header.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with Windows FNT faces, returning an error
* otherwise.
*/
FT_EXPORT( FT_Error )
FT_Get_WinFNT_Header( FT_Face face,
FT_WinFNT_HeaderRec *aheader );
/* */
FT_END_HEADER
#endif /* FTWINFNT_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/***************************************************************************/
/* */
/* This file defines the structure of the FreeType reference. */
/* It is used by the python script that generates the HTML files. */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* general_remarks */
/* */
/* <Title> */
/* General Remarks */
/* */
/* <Sections> */
/* header_inclusion */
/* user_allocation */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* core_api */
/* */
/* <Title> */
/* Core API */
/* */
/* <Sections> */
/* version */
/* basic_types */
/* base_interface */
/* glyph_variants */
/* glyph_management */
/* mac_specific */
/* sizes_management */
/* header_file_macros */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* format_specific */
/* */
/* <Title> */
/* Format-Specific API */
/* */
/* <Sections> */
/* multiple_masters */
/* truetype_tables */
/* type1_tables */
/* sfnt_names */
/* bdf_fonts */
/* cid_fonts */
/* pfr_fonts */
/* winfnt_fonts */
/* font_formats */
/* gasp_table */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* module_specific */
/* */
/* <Title> */
/* Controlling FreeType Modules */
/* */
/* <Sections> */
/* auto_hinter */
/* cff_driver */
/* t1_cid_driver */
/* tt_driver */
/* pcf_driver */
/* properties */
/* parameter_tags */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* cache_subsystem */
/* */
/* <Title> */
/* Cache Sub-System */
/* */
/* <Sections> */
/* cache_subsystem */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* support_api */
/* */
/* <Title> */
/* Support API */
/* */
/* <Sections> */
/* computations */
/* list_processing */
/* outline_processing */
/* quick_advance */
/* bitmap_handling */
/* raster */
/* glyph_stroker */
/* system_interface */
/* module_management */
/* gzip */
/* lzw */
/* bzip2 */
/* lcd_filtering */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* <Chapter> */
/* error_codes */
/* */
/* <Title> */
/* Error Codes */
/* */
/* <Sections> */
/* error_enumerations */
/* error_code_values */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* ftlzw.h */
/* */
/* LZW-compressed stream support. */
/* */
/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef FTLZW_H_
#define FTLZW_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* lzw */
/* */
/* <Title> */
/* LZW Streams */
/* */
/* <Abstract> */
/* Using LZW-compressed font files. */
/* */
/* <Description> */
/* This section contains the declaration of LZW-specific functions. */
/* */
/*************************************************************************/
/************************************************************************
*
* @function:
* FT_Stream_OpenLZW
*
* @description:
* Open a new stream to parse LZW-compressed font files. This is
* mainly used to support the compressed `*.pcf.Z' fonts that come
* with XFree86.
*
* @input:
* stream :: The target embedding stream.
*
* source :: The source stream.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
*
* Calling the internal function `FT_Stream_Close' on the new stream will
* *not* call `FT_Stream_Close' on the source stream. None of the stream
* objects will be released to the heap.
*
* The stream implementation is very basic and resets the decompression
* process each time seeking backwards is needed within the stream
*
* In certain builds of the library, LZW compression recognition is
* automatically handled when calling @FT_New_Face or @FT_Open_Face.
* This means that if no font driver is capable of handling the raw
* compressed file, the library will try to open a LZW stream from it
* and re-open the face with it.
*
* This function may return `FT_Err_Unimplemented_Feature' if your build
* of FreeType was not compiled with LZW support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenLZW( FT_Stream stream,
FT_Stream source );
/* */
FT_END_HEADER
#endif /* FTLZW_H_ */
/* END */
/***************************************************************************/
/* */
/* ft2build.h */
/* */
/* FreeType 2 build and setup macros. */
/* */
/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This is the `entry point' for FreeType header file inclusions. It is */
/* the only header file which should be included directly; all other */
/* FreeType header files should be accessed with macro names (after */
/* including `ft2build.h'). */
/* */
/* A typical example is */
/* */
/* #include <ft2build.h> */
/* #include FT_FREETYPE_H */
/* */
/*************************************************************************/
#ifndef FT2BUILD_H_
#define FT2BUILD_H_
#include <freetype/config/ftheader.h>
#endif /* FT2BUILD_H_ */
/* END */
/**
* Summary: interfaces to the Catalog handling system
* Description: the catalog module implements the support for
* XML Catalogs and SGML catalogs
*
* SGML Open Technical Resolution TR9401:1997.
* http://www.jclark.com/sp/catalog.htm
*
* XML Catalogs Working Draft 06 August 2001
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_CATALOG_H__
#define __XML_CATALOG_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#include <libxml/tree.h>
#ifdef LIBXML_CATALOG_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* XML_CATALOGS_NAMESPACE:
*
* The namespace for the XML Catalogs elements.
*/
#define XML_CATALOGS_NAMESPACE \
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
/**
* XML_CATALOG_PI:
*
* The specific XML Catalog Processing Instuction name.
*/
#define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog"
/*
* The API is voluntarily limited to general cataloging.
*/
typedef enum {
XML_CATA_PREFER_NONE = 0,
XML_CATA_PREFER_PUBLIC = 1,
XML_CATA_PREFER_SYSTEM
} xmlCatalogPrefer;
typedef enum {
XML_CATA_ALLOW_NONE = 0,
XML_CATA_ALLOW_GLOBAL = 1,
XML_CATA_ALLOW_DOCUMENT = 2,
XML_CATA_ALLOW_ALL = 3
} xmlCatalogAllow;
typedef struct _xmlCatalog xmlCatalog;
typedef xmlCatalog *xmlCatalogPtr;
/*
* Operations on a given catalog.
*/
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlNewCatalog (int sgml);
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadACatalog (const char *filename);
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadSGMLSuperCatalog (const char *filename);
XMLPUBFUN int XMLCALL
xmlConvertSGMLCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveSystem(xmlCatalogPtr catal,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolvePublic(xmlCatalogPtr catal,
const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar *URI);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlACatalogDump (xmlCatalogPtr catal,
FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
xmlCatalogIsEmpty (xmlCatalogPtr catal);
/*
* Global operations.
*/
XMLPUBFUN void XMLCALL
xmlInitializeCatalog (void);
XMLPUBFUN int XMLCALL
xmlLoadCatalog (const char *filename);
XMLPUBFUN void XMLCALL
xmlLoadCatalogs (const char *paths);
XMLPUBFUN void XMLCALL
xmlCatalogCleanup (void);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlCatalogDump (FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveSystem (const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolvePublic (const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveURI (const xmlChar *URI);
XMLPUBFUN int XMLCALL
xmlCatalogAdd (const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
xmlCatalogRemove (const xmlChar *value);
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseCatalogFile (const char *filename);
XMLPUBFUN int XMLCALL
xmlCatalogConvert (void);
/*
* Strictly minimal interfaces for per-document catalogs used
* by the parser.
*/
XMLPUBFUN void XMLCALL
xmlCatalogFreeLocal (void *catalogs);
XMLPUBFUN void * XMLCALL
xmlCatalogAddLocal (void *catalogs,
const xmlChar *URL);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolve (void *catalogs,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolveURI(void *catalogs,
const xmlChar *URI);
/*
* Preference settings.
*/
XMLPUBFUN int XMLCALL
xmlCatalogSetDebug (int level);
XMLPUBFUN xmlCatalogPrefer XMLCALL
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
XMLPUBFUN void XMLCALL
xmlCatalogSetDefaults (xmlCatalogAllow allow);
XMLPUBFUN xmlCatalogAllow XMLCALL
xmlCatalogGetDefaults (void);
/* DEPRECATED interfaces */
XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetSystem (const xmlChar *sysID);
XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetPublic (const xmlChar *pubID);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_CATALOG_ENABLED */
#endif /* __XML_CATALOG_H__ */
/*
* Summary: interface for the I/O interfaces used by the parser
* Description: interface for the I/O interfaces used by the parser
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_IO_H__
#define __XML_IO_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Those are the functions and datatypes for the parser input
* I/O structures.
*/
/**
* xmlInputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to detect if the current handler
* can provide input fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Input module should be used
*/
typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
/**
* xmlInputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to open the resource
*
* Returns an Input context or NULL in case or error
*/
typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
/**
* xmlInputReadCallback:
* @context: an Input context
* @buffer: the buffer to store data read
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Input API to read the resource
*
* Returns the number of bytes read or -1 in case of error
*/
typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
/**
* xmlInputCloseCallback:
* @context: an Input context
*
* Callback used in the I/O Input API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Those are the functions and datatypes for the library output
* I/O structures.
*/
/**
* xmlOutputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to detect if the current handler
* can provide output fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Output module should be used
*/
typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
/**
* xmlOutputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to open the resource
*
* Returns an Output context or NULL in case or error
*/
typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
/**
* xmlOutputWriteCallback:
* @context: an Output context
* @buffer: the buffer of data to write
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Output API to write to the resource
*
* Returns the number of bytes written or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
int len);
/**
* xmlOutputCloseCallback:
* @context: an Output context
*
* Callback used in the I/O Output API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef __cplusplus
}
#endif
#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/encoding.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _xmlParserInputBuffer {
void* context;
xmlInputReadCallback readcallback;
xmlInputCloseCallback closecallback;
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */
xmlBufPtr raw; /* if encoder != NULL buffer for raw input */
int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
int error;
unsigned long rawconsumed;/* amount consumed from raw */
};
#ifdef LIBXML_OUTPUT_ENABLED
struct _xmlOutputBuffer {
void* context;
xmlOutputWriteCallback writecallback;
xmlOutputCloseCallback closecallback;
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
xmlBufPtr conv; /* if encoder != NULL buffer for output */
int written; /* total number of byte written */
int error;
};
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for input
*/
XMLPUBFUN void XMLCALL
xmlCleanupInputCallbacks (void);
XMLPUBFUN int XMLCALL
xmlPopInputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultInputCallbacks (void);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlAllocParserInputBuffer (xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFilename (const char *URI,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFile (FILE *file,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateMem (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateStatic (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
xmlParserInputBufferRead (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputBufferPush (xmlParserInputBufferPtr in,
int len,
const char *buf);
XMLPUBFUN void XMLCALL
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
XMLPUBFUN char * XMLCALL
xmlParserGetDirectory (const char *filename);
XMLPUBFUN int XMLCALL
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI,
xmlCharEncoding enc);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
*/
XMLPUBFUN void XMLCALL
xmlCleanupOutputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFilename (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFile (FILE *file,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
xmlCharEncodingHandlerPtr encoder);
/* Couple of APIs to get the output without digging into the buffers */
XMLPUBFUN const xmlChar * XMLCALL
xmlOutputBufferGetContent (xmlOutputBufferPtr out);
XMLPUBFUN size_t XMLCALL
xmlOutputBufferGetSize (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlOutputBufferWrite (xmlOutputBufferPtr out,
int len,
const char *buf);
XMLPUBFUN int XMLCALL
xmlOutputBufferWriteString (xmlOutputBufferPtr out,
const char *str);
XMLPUBFUN int XMLCALL
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
const xmlChar *str,
xmlCharEncodingOutputFunc escaping);
XMLPUBFUN int XMLCALL
xmlOutputBufferFlush (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlOutputBufferClose (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
#ifdef LIBXML_HTTP_ENABLED
/* This function only exists if HTTP support built into the library */
XMLPUBFUN void XMLCALL
xmlRegisterHTTPPostCallbacks (void );
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret);
/*
* A predefined entity loader disabling network accesses
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNoNetExternalEntityLoader (const char *URL,
const char *ID,
xmlParserCtxtPtr ctxt);
/*
* xmlNormalizeWindowsPath is obsolete, don't use it.
* Check xmlCanonicPath in uri.h for a better alternative.
*/
XMLPUBFUN xmlChar * XMLCALL
xmlNormalizeWindowsPath (const xmlChar *path);
XMLPUBFUN int XMLCALL
xmlCheckFilename (const char *path);
/**
* Default 'file://' protocol callbacks
*/
XMLPUBFUN int XMLCALL
xmlFileMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlFileOpen (const char *filename);
XMLPUBFUN int XMLCALL
xmlFileRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlFileClose (void * context);
/**
* Default 'http://' protocol callbacks
*/
#ifdef LIBXML_HTTP_ENABLED
XMLPUBFUN int XMLCALL
xmlIOHTTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlIOHTTPOpen (const char *filename);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void * XMLCALL
xmlIOHTTPOpenW (const char * post_uri,
int compression );
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
xmlIOHTTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlIOHTTPClose (void * context);
#endif /* LIBXML_HTTP_ENABLED */
/**
* Default 'ftp://' protocol callbacks
*/
#ifdef LIBXML_FTP_ENABLED
XMLPUBFUN int XMLCALL
xmlIOFTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlIOFTPOpen (const char *filename);
XMLPUBFUN int XMLCALL
xmlIOFTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlIOFTPClose (void * context);
#endif /* LIBXML_FTP_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_IO_H__ */
/*
* Summary: pattern expression handling
* Description: allows to compile and test pattern expressions for nodes
* either in a tree or based on a parser state.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PATTERN_H__
#define __XML_PATTERN_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef LIBXML_PATTERN_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlPattern:
*
* A compiled (XPath based) pattern to select nodes
*/
typedef struct _xmlPattern xmlPattern;
typedef xmlPattern *xmlPatternPtr;
/**
* xmlPatternFlags:
*
* This is the set of options affecting the behaviour of pattern
* matching with this module
*
*/
typedef enum {
XML_PATTERN_DEFAULT = 0, /* simple pattern match */
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
} xmlPatternFlags;
XMLPUBFUN void XMLCALL
xmlFreePattern (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
xmlFreePatternList (xmlPatternPtr comp);
XMLPUBFUN xmlPatternPtr XMLCALL
xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict,
int flags,
const xmlChar **namespaces);
XMLPUBFUN int XMLCALL
xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node);
/* streaming interfaces */
typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt *xmlStreamCtxtPtr;
XMLPUBFUN int XMLCALL
xmlPatternStreamable (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternMaxDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternMinDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternFromRoot (xmlPatternPtr comp);
XMLPUBFUN xmlStreamCtxtPtr XMLCALL
xmlPatternGetStreamCtxt (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns,
int nodeType);
XMLPUBFUN int XMLCALL
xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlStreamPop (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_PATTERN_ENABLED */
#endif /* __XML_PATTERN_H__ */
/*
* Summary: old DocBook SGML parser
* Description: interface for a DocBook SGML non-verifying parser
* This code is DEPRECATED, and should not be used anymore.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DOCB_PARSER_H__
#define __DOCB_PARSER_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_DOCB_ENABLED
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#ifndef IN_LIBXML
#ifdef __GNUC__
#warning "The DOCBparser module has been deprecated in libxml2-2.6.0"
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most of the back-end structures from XML and SGML are shared.
*/
typedef xmlParserCtxt docbParserCtxt;
typedef xmlParserCtxtPtr docbParserCtxtPtr;
typedef xmlSAXHandler docbSAXHandler;
typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
typedef xmlParserInput docbParserInput;
typedef xmlParserInputPtr docbParserInputPtr;
typedef xmlDocPtr docbDocPtr;
/*
* There is only few public functions.
*/
XMLPUBFUN int XMLCALL
docbEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseDoc (xmlChar *cur,
const char *encoding,
docbSAXHandlerPtr sax,
void *userData);
XMLPUBFUN docbDocPtr XMLCALL
docbParseDoc (xmlChar *cur,
const char *encoding);
XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseFile (const char *filename,
const char *encoding,
docbSAXHandlerPtr sax,
void *userData);
XMLPUBFUN docbDocPtr XMLCALL
docbParseFile (const char *filename,
const char *encoding);
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN void XMLCALL
docbFreeParserCtxt (docbParserCtxtPtr ctxt);
XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
docbParseChunk (docbParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreateFileParserCtxt(const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
docbParseDocument (docbParserCtxtPtr ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DOCB_ENABLED */
#endif /* __DOCB_PARSER_H__ */
/*
* Summary: incomplete XML Schemas structure implementation
* Description: interface to the XML Schemas handling and schema validity
* checking, it is incomplete right now.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_H__
#define __XML_SCHEMA_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* This error codes are obsolete; not used any more.
*/
typedef enum {
XML_SCHEMAS_ERR_OK = 0,
XML_SCHEMAS_ERR_NOROOT = 1,
XML_SCHEMAS_ERR_UNDECLAREDELEM,
XML_SCHEMAS_ERR_NOTTOPLEVEL,
XML_SCHEMAS_ERR_MISSING,
XML_SCHEMAS_ERR_WRONGELEM,
XML_SCHEMAS_ERR_NOTYPE,
XML_SCHEMAS_ERR_NOROLLBACK,
XML_SCHEMAS_ERR_ISABSTRACT,
XML_SCHEMAS_ERR_NOTEMPTY,
XML_SCHEMAS_ERR_ELEMCONT,
XML_SCHEMAS_ERR_HAVEDEFAULT,
XML_SCHEMAS_ERR_NOTNILLABLE,
XML_SCHEMAS_ERR_EXTRACONTENT,
XML_SCHEMAS_ERR_INVALIDATTR,
XML_SCHEMAS_ERR_INVALIDELEM,
XML_SCHEMAS_ERR_NOTDETERMINIST,
XML_SCHEMAS_ERR_CONSTRUCT,
XML_SCHEMAS_ERR_INTERNAL,
XML_SCHEMAS_ERR_NOTSIMPLE,
XML_SCHEMAS_ERR_ATTRUNKNOWN,
XML_SCHEMAS_ERR_ATTRINVALID,
XML_SCHEMAS_ERR_VALUE,
XML_SCHEMAS_ERR_FACET,
XML_SCHEMAS_ERR_,
XML_SCHEMAS_ERR_XXX
} xmlSchemaValidError;
/*
* ATTENTION: Change xmlSchemaSetValidOptions's check
* for invalid values, if adding to the validation
* options below.
*/
/**
* xmlSchemaValidOption:
*
* This is the set of XML Schema validation options.
*/
typedef enum {
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
/* Default/fixed: create an attribute node
* or an element's text node on the instance.
*/
} xmlSchemaValidOption;
/*
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
* assemble schemata using
* xsi:schemaLocation and
* xsi:noNamespaceSchemaLocation
*/
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchema xmlSchema;
typedef xmlSchema *xmlSchemaPtr;
/**
* xmlSchemaValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc)
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlSchemaValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc)
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context
*/
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
/**
* xmlSchemaValidityLocatorFunc:
* @ctx: user provided context
* @file: returned file information
* @line: returned line information
*
* A schemas validation locator, a callback called by the validator.
* This is used when file or node informations are not available
* to find out what file and line number are affected
*
* Returns: 0 in case of success and -1 in case of error
*/
typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx,
const char **file, unsigned long *line);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaPtr XMLCALL
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaFree (xmlSchemaPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlSchemaDump (FILE *output,
xmlSchemaPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc *err,
xmlSchemaValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN void XMLCALL
xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,
const char *filename);
XMLPUBFUN int XMLCALL
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
XMLPUBFUN void XMLCALL
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr instance);
XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void *user_data);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
/*
* Interface to insert Schemas SAX validation in a SAX stream
*/
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr *sax,
void **user_data);
XMLPUBFUN int XMLCALL
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
XMLPUBFUN void XMLCALL
xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
xmlSchemaValidityLocatorFunc f,
void *ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_H__ */
/*
* Summary: API to build regexp automata
* Description: the API to build regexp automata
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_AUTOMATA_H__
#define __XML_AUTOMATA_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef LIBXML_AUTOMATA_ENABLED
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlAutomataPtr:
*
* A libxml automata description, It can be compiled into a regexp
*/
typedef struct _xmlAutomata xmlAutomata;
typedef xmlAutomata *xmlAutomataPtr;
/**
* xmlAutomataStatePtr:
*
* A state int the automata description,
*/
typedef struct _xmlAutomataState xmlAutomataState;
typedef xmlAutomataState *xmlAutomataStatePtr;
/*
* Building API
*/
XMLPUBFUN xmlAutomataPtr XMLCALL
xmlNewAutomata (void);
XMLPUBFUN void XMLCALL
xmlFreeAutomata (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataGetInitState (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewState (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int lax);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN int XMLCALL
xmlAutomataNewCounter (xmlAutomataPtr am,
int min,
int max);
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlAutomataCompile (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataIsDeterminist (xmlAutomataPtr am);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_AUTOMATA_ENABLED */
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* __XML_AUTOMATA_H__ */
/*
* Summary: specific APIs to process HTML tree, especially serialization
* Description: this module implements a few function needed to process
* tree in an HTML specific way.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __HTML_TREE_H__
#define __HTML_TREE_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/HTMLparser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* HTML_TEXT_NODE:
*
* Macro. A text node in a HTML document is really implemented
* the same way as a text node in an XML document.
*/
#define HTML_TEXT_NODE XML_TEXT_NODE
/**
* HTML_ENTITY_REF_NODE:
*
* Macro. An entity reference in a HTML document is really implemented
* the same way as an entity reference in an XML document.
*/
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
/**
* HTML_COMMENT_NODE:
*
* Macro. A comment in a HTML document is really implemented
* the same way as a comment in an XML document.
*/
#define HTML_COMMENT_NODE XML_COMMENT_NODE
/**
* HTML_PRESERVE_NODE:
*
* Macro. A preserved node in a HTML document is really implemented
* the same way as a CDATA section in an XML document.
*/
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
/**
* HTML_PI_NODE:
*
* Macro. A processing instruction in a HTML document is really implemented
* the same way as a processing instruction in an XML document.
*/
#define HTML_PI_NODE XML_PI_NODE
XMLPUBFUN htmlDocPtr XMLCALL
htmlNewDoc (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN htmlDocPtr XMLCALL
htmlNewDocNoDtD (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN const xmlChar * XMLCALL
htmlGetMetaEncoding (htmlDocPtr doc);
XMLPUBFUN int XMLCALL
htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar *encoding);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
htmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN int XMLCALL
htmlDocDump (FILE *f,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
htmlSaveFile (const char *filename,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN void XMLCALL
htmlNodeDumpFile (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN int XMLCALL
htmlNodeDumpFileFormat (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN int XMLCALL
htmlSaveFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN int XMLCALL
htmlSaveFileFormat (const char *filename,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN void XMLCALL
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
htmlIsBooleanAttr (const xmlChar *name);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_TREE_H__ */
/*
* Summary: SAX2 parser interface used to build the DOM tree
* Description: those are the default SAX2 interfaces used by
* the library when building DOM tree.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SAX2_H__
#define __XML_SAX2_H__
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
xmlSAX2GetPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
xmlSAX2GetSystemId (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2SetDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
xmlSAX2GetLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2GetColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2IsStandalone (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2HasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2HasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2InternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
xmlSAX2ExternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlSAX2GetEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlSAX2GetParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlSAX2ResolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
xmlSAX2EntityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
xmlSAX2AttributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
xmlSAX2ElementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlSAX2NotationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
xmlSAX2UnparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
xmlSAX2StartDocument (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2EndDocument (void *ctx);
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \
defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN void XMLCALL
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
xmlSAX2EndElement (void *ctx,
const xmlChar *name);
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */
XMLPUBFUN void XMLCALL
xmlSAX2StartElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes);
XMLPUBFUN void XMLCALL
xmlSAX2EndElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI);
XMLPUBFUN void XMLCALL
xmlSAX2Reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlSAX2Characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
xmlSAX2IgnorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
xmlSAX2ProcessingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
xmlSAX2Comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlSAX2CDataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
xmlSAXVersion (xmlSAXHandler *hdlr,
int version);
XMLPUBFUN void XMLCALL
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
XMLPUBFUN void XMLCALL
htmlDefaultSAXHandlerInit (void);
#endif
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr);
XMLPUBFUN void XMLCALL
docbDefaultSAXHandlerInit (void);
#endif
XMLPUBFUN void XMLCALL
xmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
}
#endif
#endif /* __XML_SAX2_H__ */
/*
* Summary: lists interfaces
* Description: this module implement the list support used in
* various place in the library.
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>
*/
#ifndef __XML_LINK_INCLUDE__
#define __XML_LINK_INCLUDE__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlLink xmlLink;
typedef xmlLink *xmlLinkPtr;
typedef struct _xmlList xmlList;
typedef xmlList *xmlListPtr;
/**
* xmlListDeallocator:
* @lk: the data to deallocate
*
* Callback function used to free data from a list.
*/
typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
/**
* xmlListDataCompare:
* @data0: the first data
* @data1: the second data
*
* Callback function used to compare 2 data.
*
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
*/
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
/**
* xmlListWalker:
* @data: the data found in the list
* @user: extra user provided data to the walker
*
* Callback function used when walking a list with xmlListWalk().
*
* Returns 0 to stop walking the list, 1 otherwise.
*/
typedef int (*xmlListWalker) (const void *data, const void *user);
/* Creation/Deletion */
XMLPUBFUN xmlListPtr XMLCALL
xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare);
XMLPUBFUN void XMLCALL
xmlListDelete (xmlListPtr l);
/* Basic Operators */
XMLPUBFUN void * XMLCALL
xmlListSearch (xmlListPtr l,
void *data);
XMLPUBFUN void * XMLCALL
xmlListReverseSearch (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListInsert (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
xmlListAppend (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
xmlListRemoveFirst (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListRemoveLast (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListRemoveAll (xmlListPtr l,
void *data);
XMLPUBFUN void XMLCALL
xmlListClear (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListEmpty (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
xmlListFront (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
xmlListEnd (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListSize (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListPopFront (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListPopBack (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListPushFront (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListPushBack (xmlListPtr l,
void *data);
/* Advanced Operators */
XMLPUBFUN void XMLCALL
xmlListReverse (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListSort (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListWalk (xmlListPtr l,
xmlListWalker walker,
const void *user);
XMLPUBFUN void XMLCALL
xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
const void *user);
XMLPUBFUN void XMLCALL
xmlListMerge (xmlListPtr l1,
xmlListPtr l2);
XMLPUBFUN xmlListPtr XMLCALL
xmlListDup (const xmlListPtr old);
XMLPUBFUN int XMLCALL
xmlListCopy (xmlListPtr cur,
const xmlListPtr old);
/* Link operators */
XMLPUBFUN void * XMLCALL
xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */
/* xmlListSwap */
#ifdef __cplusplus
}
#endif
#endif /* __XML_LINK_INCLUDE__ */
/*
* Summary: interface for the XML entities handling
* Description: this module provides some of the entity API needed
* for the parser and applications.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_ENTITIES_H__
#define __XML_ENTITIES_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The different valid entity types.
*/
typedef enum {
XML_INTERNAL_GENERAL_ENTITY = 1,
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
XML_INTERNAL_PARAMETER_ENTITY = 4,
XML_EXTERNAL_PARAMETER_ENTITY = 5,
XML_INTERNAL_PREDEFINED_ENTITY = 6
} xmlEntityType;
typedef enum {
XML_ENTITY_NOT_BEING_CHECKED,
XML_ENTITY_BEING_CHECKED /* entity check is in progress */
} xmlEntityRecursionGuard;
/*
* An unit of storage for an entity, contains the string, the value
* and the linkind data needed for the linking in the hash table.
*/
struct _xmlEntity {
void *_private; /* application data */
xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
const xmlChar *name; /* Entity name */
struct _xmlNode *children; /* First child link */
struct _xmlNode *last; /* Last child link */
struct _xmlDtd *parent; /* -> DTD */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
xmlChar *orig; /* content without ref substitution */
xmlChar *content; /* content or ndata if unparsed */
int length; /* the content length */
xmlEntityType etype; /* The entity type */
const xmlChar *ExternalID; /* External identifier for PUBLIC */
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
struct _xmlEntity *nexte; /* unused */
const xmlChar *URI; /* the full URI as computed */
int owner; /* does the entity own the childrens */
int checked; /* was the entity content checked */
/* this is also used to count entities
* references done from that entity
* and if it contains '<' */
xmlEntityRecursionGuard guard;
};
/*
* All entities are stored in an hash table.
* There is 2 separate hash tables for global and parameter entities.
*/
typedef struct _xmlHashTable xmlEntitiesTable;
typedef xmlEntitiesTable *xmlEntitiesTablePtr;
/*
* External functions:
*/
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
xmlInitializePredefinedEntities (void);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlEntityPtr XMLCALL
xmlNewEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlAddDocEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlAddDtdEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetPredefinedEntity (const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDocEntity (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDtdEntity (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetParameterEntity (xmlDocPtr doc,
const xmlChar *name);
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
xmlEncodeEntities (xmlDocPtr doc,
const xmlChar *input);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
const xmlChar *input);
XMLPUBFUN xmlChar * XMLCALL
xmlEncodeSpecialChars (const xmlDoc *doc,
const xmlChar *input);
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCreateEntitiesTable (void);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpEntitiesTable (xmlBufferPtr buf,
xmlEntitiesTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpEntityDecl (xmlBufferPtr buf,
xmlEntityPtr ent);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
xmlCleanupPredefinedEntities(void);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef __cplusplus
}
#endif
# endif /* __XML_ENTITIES_H__ */
/*
* Summary: The DTD validation
* Description: API for the DTD handling and the validity checking
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VALID_H__
#define __XML_VALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/list.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Validation state added for non-determinist content model.
*/
typedef struct _xmlValidState xmlValidState;
typedef xmlValidState *xmlValidStatePtr;
/**
* xmlValidityErrorFunc:
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
* but comes from ctxt->userData (which normally contains such
* a pointer); ctxt->userData can be changed by the user.
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity error is found. This is a message
* oriented function similar to an *printf function.
*/
typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlValidityWarningFunc:
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
* but comes from ctxt->userData (which normally contains such
* a pointer); ctxt->userData can be changed by the user.
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity warning is found. This is a message
* oriented function similar to an *printf function.
*/
typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
#ifdef IN_LIBXML
/**
* XML_CTXT_FINISH_DTD_0:
*
* Special value for finishDtd field when embedded in an xmlParserCtxt
*/
#define XML_CTXT_FINISH_DTD_0 0xabcd1234
/**
* XML_CTXT_FINISH_DTD_1:
*
* Special value for finishDtd field when embedded in an xmlParserCtxt
*/
#define XML_CTXT_FINISH_DTD_1 0xabcd1235
#endif
/*
* xmlValidCtxt:
* An xmlValidCtxt is used for error reporting when validating.
*/
typedef struct _xmlValidCtxt xmlValidCtxt;
typedef xmlValidCtxt *xmlValidCtxtPtr;
struct _xmlValidCtxt {
void *userData; /* user specific data block */
xmlValidityErrorFunc error; /* the callback in case of errors */
xmlValidityWarningFunc warning; /* the callback in case of warning */
/* Node analysis stack used when validating within entities */
xmlNodePtr node; /* Current parsed Node */
int nodeNr; /* Depth of the parsing stack */
int nodeMax; /* Max depth of the parsing stack */
xmlNodePtr *nodeTab; /* array of nodes */
unsigned int finishDtd; /* finished validating the Dtd ? */
xmlDocPtr doc; /* the document */
int valid; /* temporary validity check result */
/* state state used for non-determinist content validation */
xmlValidState *vstate; /* current state */
int vstateNr; /* Depth of the validation stack */
int vstateMax; /* Max depth of the validation stack */
xmlValidState *vstateTab; /* array of validation states */
#ifdef LIBXML_REGEXP_ENABLED
xmlAutomataPtr am; /* the automata */
xmlAutomataStatePtr state; /* used to build the automata */
#else
void *am;
void *state;
#endif
};
/*
* ALL notation declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlNotationTable;
typedef xmlNotationTable *xmlNotationTablePtr;
/*
* ALL element declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlElementTable;
typedef xmlElementTable *xmlElementTablePtr;
/*
* ALL attribute declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlAttributeTable;
typedef xmlAttributeTable *xmlAttributeTablePtr;
/*
* ALL IDs attributes are stored in a table.
* There is one table per document.
*/
typedef struct _xmlHashTable xmlIDTable;
typedef xmlIDTable *xmlIDTablePtr;
/*
* ALL Refs attributes are stored in a table.
* There is one table per document.
*/
typedef struct _xmlHashTable xmlRefTable;
typedef xmlRefTable *xmlRefTablePtr;
/* Notation */
XMLPUBFUN xmlNotationPtr XMLCALL
xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *PublicID,
const xmlChar *SystemID);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNotationTablePtr XMLCALL
xmlCopyNotationTable (xmlNotationTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeNotationTable (xmlNotationTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota);
XMLPUBFUN void XMLCALL
xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Element Content */
/* the non Doc version are being deprecated */
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlNewElementContent (const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlCopyElementContent (xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlFreeElementContent (xmlElementContentPtr cur);
/* the new versions with doc argument */
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlNewDocElementContent (xmlDocPtr doc,
const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlCopyDocElementContent(xmlDocPtr doc,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlFreeDocElementContent(xmlDocPtr doc,
xmlElementContentPtr cur);
XMLPUBFUN void XMLCALL
xmlSnprintfElementContent(char *buf,
int size,
xmlElementContentPtr content,
int englob);
#ifdef LIBXML_OUTPUT_ENABLED
/* DEPRECATED */
XMLPUBFUN void XMLCALL
xmlSprintfElementContent(char *buf,
xmlElementContentPtr content,
int englob);
#endif /* LIBXML_OUTPUT_ENABLED */
/* DEPRECATED */
/* Element */
XMLPUBFUN xmlElementPtr XMLCALL
xmlAddElementDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
xmlElementTypeVal type,
xmlElementContentPtr content);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlElementTablePtr XMLCALL
xmlCopyElementTable (xmlElementTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeElementTable (xmlElementTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Enumeration */
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlCreateEnumeration (const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlFreeEnumeration (xmlEnumerationPtr cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlCopyEnumeration (xmlEnumerationPtr cur);
#endif /* LIBXML_TREE_ENABLED */
/* Attribute */
XMLPUBFUN xmlAttributePtr XMLCALL
xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *ns,
xmlAttributeType type,
xmlAttributeDefault def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlAttributeTablePtr XMLCALL
xmlCopyAttributeTable (xmlAttributeTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeAttributeTable (xmlAttributeTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr);
#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN xmlIDPtr XMLCALL
xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
xmlFreeIDTable (xmlIDTablePtr table);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlGetID (xmlDocPtr doc,
const xmlChar *ID);
XMLPUBFUN int XMLCALL
xmlIsID (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr);
/* IDREFs */
XMLPUBFUN xmlRefPtr XMLCALL
xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
xmlFreeRefTable (xmlRefTablePtr table);
XMLPUBFUN int XMLCALL
xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr);
XMLPUBFUN xmlListPtr XMLCALL
xmlGetRefs (xmlDocPtr doc,
const xmlChar *ID);
/**
* The public function calls related to validity checking.
*/
#ifdef LIBXML_VALID_ENABLED
/* Allocate/Release Validation Contexts */
XMLPUBFUN xmlValidCtxtPtr XMLCALL
xmlNewValidCtxt(void);
XMLPUBFUN void XMLCALL
xmlFreeValidCtxt(xmlValidCtxtPtr);
XMLPUBFUN int XMLCALL
xmlValidateRoot (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlElementPtr elem);
XMLPUBFUN xmlChar * XMLCALL
xmlValidNormalizeAttributeValue(xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlAttributePtr attr);
XMLPUBFUN int XMLCALL
xmlValidateAttributeValue(xmlAttributeType type,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNotationPtr nota);
XMLPUBFUN int XMLCALL
xmlValidateDtd (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd);
XMLPUBFUN int XMLCALL
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateDocument (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlValidateOneElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *prefix,
xmlNsPtr ns,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
#endif /* LIBXML_VALID_ENABLED */
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *notationName);
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
XMLPUBFUN int XMLCALL
xmlIsMixedElement (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
xmlGetDtdAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlNotationPtr XMLCALL
xmlGetDtdNotationDesc (xmlDtdPtr dtd,
const xmlChar *name);
XMLPUBFUN xmlElementPtr XMLCALL
xmlGetDtdQElementDesc (xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlElementPtr XMLCALL
xmlGetDtdElementDesc (xmlDtdPtr dtd,
const xmlChar *name);
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
xmlValidGetPotentialChildren(xmlElementContent *ctree,
const xmlChar **names,
int *len,
int max);
XMLPUBFUN int XMLCALL
xmlValidGetValidElements(xmlNode *prev,
xmlNode *next,
const xmlChar **names,
int max);
XMLPUBFUN int XMLCALL
xmlValidateNameValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNamesValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNmtokenValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNmtokensValue(const xmlChar *value);
#ifdef LIBXML_REGEXP_ENABLED
/*
* Validation based on the regexp support
*/
XMLPUBFUN int XMLCALL
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
xmlElementPtr elem);
XMLPUBFUN int XMLCALL
xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
XMLPUBFUN int XMLCALL
xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_VALID_H__ */
/*
* Summary: macros for marking symbols as exportable/importable.
* Description: macros for marking symbols as exportable/importable.
*
* Copy: See Copyright for the status of this software.
*
* Author: Igor Zlatovic <igor@zlatkovic.com>
*/
#ifndef __XML_EXPORTS_H__
#define __XML_EXPORTS_H__
/**
* XMLPUBFUN, XMLPUBVAR, XMLCALL
*
* Macros which declare an exportable function, an exportable variable and
* the calling convention used for functions.
*
* Please use an extra block for every platform/compiler combination when
* modifying this, rather than overlong #ifdef lines. This helps
* readability as well as the fact that different compilers on the same
* platform might need different definitions.
*/
/**
* XMLPUBFUN:
*
* Macros which declare an exportable function
*/
#define XMLPUBFUN
/**
* XMLPUBVAR:
*
* Macros which declare an exportable variable
*/
#define XMLPUBVAR extern
/**
* XMLCALL:
*
* Macros which declare the called convention for exported functions
*/
#define XMLCALL
/**
* XMLCDECL:
*
* Macro which declares the calling convention for exported functions that
* use '...'.
*/
#define XMLCDECL
/** DOC_DISABLE */
/* Windows platform with MS compiler */
#if defined(_WIN32) && defined(_MSC_VER)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#if defined(LIBXML_FASTCALL)
#define XMLCALL __fastcall
#else
#define XMLCALL __cdecl
#endif
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with Borland compiler */
#if defined(_WIN32) && defined(__BORLANDC__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
/*
* if defined(IN_LIBXML) this raises problems on mingw with msys
* _imp__xmlFree listed as missing. Try to workaround the problem
* by also making that declaration when compiling client code.
*/
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Cygwin platform, GNU compiler */
#if defined(_WIN32) && defined(__CYGWIN__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#endif
/* Compatibility */
#if !defined(LIBXML_DLL_IMPORT)
#define LIBXML_DLL_IMPORT XMLPUBVAR
#endif
#endif /* __XML_EXPORTS_H__ */
/*
* Summary: the core parser module
* Description: Interfaces, constants and types related to the XML parser
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PARSER_H__
#define __XML_PARSER_H__
#include <stdarg.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
#include <libxml/hash.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* XML_DEFAULT_VERSION:
*
* The default version of XML used: 1.0
*/
#define XML_DEFAULT_VERSION "1.0"
/**
* xmlParserInput:
*
* An xmlParserInput is an input flow for the XML processor.
* Each entity parsed is associated an xmlParserInput (except the
* few predefined ones). This is the case both for internal entities
* - in which case the flow is already completely in memory - or
* external entities - in which case we use the buf structure for
* progressive reading and I18N conversions to the internal UTF-8 format.
*/
/**
* xmlParserInputDeallocate:
* @str: the string to deallocate
*
* Callback for freeing some parser input allocations.
*/
typedef void (* xmlParserInputDeallocate)(xmlChar *str);
struct _xmlParserInput {
/* Input buffer */
xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
const char *filename; /* The file analyzed, if any */
const char *directory; /* the directory/base of the file */
const xmlChar *base; /* Base of the array to parse */
const xmlChar *cur; /* Current char being parsed */
const xmlChar *end; /* end of the array to parse */
int length; /* length if known */
int line; /* Current line */
int col; /* Current column */
/*
* NOTE: consumed is only tested for equality in the parser code,
* so even if there is an overflow this should not give troubles
* for parsing very large instances.
*/
unsigned long consumed; /* How many xmlChars already consumed */
xmlParserInputDeallocate free; /* function to deallocate the base */
const xmlChar *encoding; /* the encoding string for entity */
const xmlChar *version; /* the version string for entity */
int standalone; /* Was that entity marked standalone */
int id; /* an unique identifier for the entity */
};
/**
* xmlParserNodeInfo:
*
* The parser can be asked to collect Node informations, i.e. at what
* place in the file they were detected.
* NOTE: This is off by default and not very well tested.
*/
typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
struct _xmlParserNodeInfo {
const struct _xmlNode* node;
/* Position & line # that text that created the node begins & ends on */
unsigned long begin_pos;
unsigned long begin_line;
unsigned long end_pos;
unsigned long end_line;
};
typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
struct _xmlParserNodeInfoSeq {
unsigned long maximum;
unsigned long length;
xmlParserNodeInfo* buffer;
};
/**
* xmlParserInputState:
*
* The parser is now working also as a state based parser.
* The recursive one use the state info for entities processing.
*/
typedef enum {
XML_PARSER_EOF = -1, /* nothing is to be parsed */
XML_PARSER_START = 0, /* nothing has been parsed */
XML_PARSER_MISC, /* Misc* before int subset */
XML_PARSER_PI, /* Within a processing instruction */
XML_PARSER_DTD, /* within some DTD content */
XML_PARSER_PROLOG, /* Misc* after internal subset */
XML_PARSER_COMMENT, /* within a comment */
XML_PARSER_START_TAG, /* within a start tag */
XML_PARSER_CONTENT, /* within the content */
XML_PARSER_CDATA_SECTION, /* within a CDATA section */
XML_PARSER_END_TAG, /* within a closing tag */
XML_PARSER_ENTITY_DECL, /* within an entity declaration */
XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
XML_PARSER_EPILOG, /* the Misc* after the last end tag */
XML_PARSER_IGNORE, /* within an IGNORED section */
XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
} xmlParserInputState;
/**
* XML_DETECT_IDS:
*
* Bit in the loadsubset context field to tell to do ID/REFs lookups.
* Use it to initialize xmlLoadExtDtdDefaultValue.
*/
#define XML_DETECT_IDS 2
/**
* XML_COMPLETE_ATTRS:
*
* Bit in the loadsubset context field to tell to do complete the
* elements attributes lists with the ones defaulted from the DTDs.
* Use it to initialize xmlLoadExtDtdDefaultValue.
*/
#define XML_COMPLETE_ATTRS 4
/**
* XML_SKIP_IDS:
*
* Bit in the loadsubset context field to tell to not do ID/REFs registration.
* Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
*/
#define XML_SKIP_IDS 8
/**
* xmlParserMode:
*
* A parser can operate in various modes
*/
typedef enum {
XML_PARSE_UNKNOWN = 0,
XML_PARSE_DOM = 1,
XML_PARSE_SAX = 2,
XML_PARSE_PUSH_DOM = 3,
XML_PARSE_PUSH_SAX = 4,
XML_PARSE_READER = 5
} xmlParserMode;
/**
* xmlParserCtxt:
*
* The parser context.
* NOTE This doesn't completely define the parser state, the (current ?)
* design of the parser uses recursive function calls since this allow
* and easy mapping from the production rules of the specification
* to the actual code. The drawback is that the actual function call
* also reflect the parser state. However most of the parsing routines
* takes as the only argument the parser context pointer, so migrating
* to a state based parser for progressive parsing shouldn't be too hard.
*/
struct _xmlParserCtxt {
struct _xmlSAXHandler *sax; /* The SAX handler */
void *userData; /* For SAX interface only, used by DOM build */
xmlDocPtr myDoc; /* the document being built */
int wellFormed; /* is the document well formed */
int replaceEntities; /* shall we replace entities ? */
const xmlChar *version; /* the XML version string */
const xmlChar *encoding; /* the declared encoding, if any */
int standalone; /* standalone document */
int html; /* an HTML(1)/Docbook(2) document
* 3 is HTML after <head>
* 10 is HTML after <body>
*/
/* Input stream stack */
xmlParserInputPtr input; /* Current input stream */
int inputNr; /* Number of current input streams */
int inputMax; /* Max number of input streams */
xmlParserInputPtr *inputTab; /* stack of inputs */
/* Node analysis stack only used for DOM building */
xmlNodePtr node; /* Current parsed Node */
int nodeNr; /* Depth of the parsing stack */
int nodeMax; /* Max depth of the parsing stack */
xmlNodePtr *nodeTab; /* array of nodes */
int record_info; /* Whether node info should be kept */
xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
int errNo; /* error code */
int hasExternalSubset; /* reference and external subset */
int hasPErefs; /* the internal subset has PE refs */
int external; /* are we parsing an external entity */
int valid; /* is the document valid */
int validate; /* shall we try to validate ? */
xmlValidCtxt vctxt; /* The validity context */
xmlParserInputState instate; /* current type of input */
int token; /* next char look-ahead */
char *directory; /* the data directory */
/* Node name stack */
const xmlChar *name; /* Current parsed Node */
int nameNr; /* Depth of the parsing stack */
int nameMax; /* Max depth of the parsing stack */
const xmlChar * *nameTab; /* array of nodes */
long nbChars; /* number of xmlChar processed */
long checkIndex; /* used by progressive parsing lookup */
int keepBlanks; /* ugly but ... */
int disableSAX; /* SAX callbacks are disabled */
int inSubset; /* Parsing is in int 1/ext 2 subset */
const xmlChar * intSubName; /* name of subset */
xmlChar * extSubURI; /* URI of external subset */
xmlChar * extSubSystem; /* SYSTEM ID of external subset */
/* xml:space values */
int * space; /* Should the parser preserve spaces */
int spaceNr; /* Depth of the parsing stack */
int spaceMax; /* Max depth of the parsing stack */
int * spaceTab; /* array of space infos */
int depth; /* to prevent entity substitution loops */
xmlParserInputPtr entity; /* used to check entities boundaries */
int charset; /* encoding of the in-memory content
actually an xmlCharEncoding */
int nodelen; /* Those two fields are there to */
int nodemem; /* Speed up large node parsing */
int pedantic; /* signal pedantic warnings */
void *_private; /* For user data, libxml won't touch it */
int loadsubset; /* should the external subset be loaded */
int linenumbers; /* set line number in element content */
void *catalogs; /* document's own catalog */
int recovery; /* run in recovery mode */
int progressive; /* is this a progressive parsing */
xmlDictPtr dict; /* dictionary for the parser */
const xmlChar * *atts; /* array for the attributes callbacks */
int maxatts; /* the size of the array */
int docdict; /* use strings from dict to build tree */
/*
* pre-interned strings
*/
const xmlChar *str_xml;
const xmlChar *str_xmlns;
const xmlChar *str_xml_ns;
/*
* Everything below is used only by the new SAX mode
*/
int sax2; /* operating in the new SAX mode */
int nsNr; /* the number of inherited namespaces */
int nsMax; /* the size of the arrays */
const xmlChar * *nsTab; /* the array of prefix/namespace name */
int *attallocs; /* which attribute were allocated */
void * *pushTab; /* array of data for push */
xmlHashTablePtr attsDefault; /* defaulted attributes if any */
xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
int nsWellFormed; /* is the document XML Nanespace okay */
int options; /* Extra options */
/*
* Those fields are needed only for treaming parsing so far
*/
int dictNames; /* Use dictionary names for the tree */
int freeElemsNr; /* number of freed element nodes */
xmlNodePtr freeElems; /* List of freed element nodes */
int freeAttrsNr; /* number of freed attributes nodes */
xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
/*
* the complete error informations for the last error.
*/
xmlError lastError;
xmlParserMode parseMode; /* the parser mode */
unsigned long nbentities; /* number of entities references */
unsigned long sizeentities; /* size of parsed entities */
/* for use by HTML non-recursive parser */
xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */
int nodeInfoNr; /* Depth of the parsing stack */
int nodeInfoMax; /* Max depth of the parsing stack */
xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */
int input_id; /* we need to label inputs */
unsigned long sizeentcopy; /* volume of entity copy */
};
/**
* xmlSAXLocator:
*
* A SAX Locator.
*/
struct _xmlSAXLocator {
const xmlChar *(*getPublicId)(void *ctx);
const xmlChar *(*getSystemId)(void *ctx);
int (*getLineNumber)(void *ctx);
int (*getColumnNumber)(void *ctx);
};
/**
* xmlSAXHandler:
*
* A SAX handler is bunch of callbacks called by the parser when processing
* of the input generate data or structure informations.
*/
/**
* resolveEntitySAXFunc:
* @ctx: the user data (XML parser context)
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* Callback:
* The entity loader, to control the loading of external entities,
* the application can either:
* - override this resolveEntity() callback in the SAX block
* - or better use the xmlSetExternalEntityLoader() function to
* set up it's own entity resolution routine
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
/**
* internalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the root element name
* @ExternalID: the external ID
* @SystemID: the SYSTEM ID (e.g. filename or URL)
*
* Callback on internal subset declaration.
*/
typedef void (*internalSubsetSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* externalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the root element name
* @ExternalID: the external ID
* @SystemID: the SYSTEM ID (e.g. filename or URL)
*
* Callback on external subset declaration.
*/
typedef void (*externalSubsetSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* getEntitySAXFunc:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Get an entity by name.
*
* Returns the xmlEntityPtr if found.
*/
typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
const xmlChar *name);
/**
* getParameterEntitySAXFunc:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Get a parameter entity by name.
*
* Returns the xmlEntityPtr if found.
*/
typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
const xmlChar *name);
/**
* entityDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the entity name
* @type: the entity type
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @content: the entity value (without processing).
*
* An entity definition has been parsed.
*/
typedef void (*entityDeclSAXFunc) (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
/**
* notationDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The name of the notation
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* What to do when a notation declaration has been parsed.
*/
typedef void (*notationDeclSAXFunc)(void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
/**
* attributeDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @elem: the name of the element
* @fullname: the attribute name
* @type: the attribute type
* @def: the type of default value
* @defaultValue: the attribute default value
* @tree: the tree of enumerated value set
*
* An attribute definition has been parsed.
*/
typedef void (*attributeDeclSAXFunc)(void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
/**
* elementDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: the element name
* @type: the element type
* @content: the element value tree
*
* An element definition has been parsed.
*/
typedef void (*elementDeclSAXFunc)(void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
/**
* unparsedEntityDeclSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The name of the entity
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @notationName: the name of the notation
*
* What to do when an unparsed entity declaration is parsed.
*/
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
/**
* setDocumentLocatorSAXFunc:
* @ctx: the user data (XML parser context)
* @loc: A SAX Locator
*
* Receive the document locator at startup, actually xmlDefaultSAXLocator.
* Everything is available on the context, so this is useless in our case.
*/
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
xmlSAXLocatorPtr loc);
/**
* startDocumentSAXFunc:
* @ctx: the user data (XML parser context)
*
* Called when the document start being processed.
*/
typedef void (*startDocumentSAXFunc) (void *ctx);
/**
* endDocumentSAXFunc:
* @ctx: the user data (XML parser context)
*
* Called when the document end has been detected.
*/
typedef void (*endDocumentSAXFunc) (void *ctx);
/**
* startElementSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The element name, including namespace prefix
* @atts: An array of name/value attributes pairs, NULL terminated
*
* Called when an opening tag has been processed.
*/
typedef void (*startElementSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar **atts);
/**
* endElementSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The element name
*
* Called when the end of an element has been detected.
*/
typedef void (*endElementSAXFunc) (void *ctx,
const xmlChar *name);
/**
* attributeSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The attribute name, including namespace prefix
* @value: The attribute value
*
* Handle an attribute that has been read by the parser.
* The default handling is to convert the attribute into an
* DOM subtree and past it in a new xmlAttr element added to
* the element.
*/
typedef void (*attributeSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar *value);
/**
* referenceSAXFunc:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Called when an entity reference is detected.
*/
typedef void (*referenceSAXFunc) (void *ctx,
const xmlChar *name);
/**
* charactersSAXFunc:
* @ctx: the user data (XML parser context)
* @ch: a xmlChar string
* @len: the number of xmlChar
*
* Receiving some chars from the parser.
*/
typedef void (*charactersSAXFunc) (void *ctx,
const xmlChar *ch,
int len);
/**
* ignorableWhitespaceSAXFunc:
* @ctx: the user data (XML parser context)
* @ch: a xmlChar string
* @len: the number of xmlChar
*
* Receiving some ignorable whitespaces from the parser.
* UNUSED: by default the DOM building will use characters.
*/
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
const xmlChar *ch,
int len);
/**
* processingInstructionSAXFunc:
* @ctx: the user data (XML parser context)
* @target: the target name
* @data: the PI data's
*
* A processing instruction has been parsed.
*/
typedef void (*processingInstructionSAXFunc) (void *ctx,
const xmlChar *target,
const xmlChar *data);
/**
* commentSAXFunc:
* @ctx: the user data (XML parser context)
* @value: the comment content
*
* A comment has been parsed.
*/
typedef void (*commentSAXFunc) (void *ctx,
const xmlChar *value);
/**
* cdataBlockSAXFunc:
* @ctx: the user data (XML parser context)
* @value: The pcdata content
* @len: the block length
*
* Called when a pcdata block has been parsed.
*/
typedef void (*cdataBlockSAXFunc) (
void *ctx,
const xmlChar *value,
int len);
/**
* warningSAXFunc:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format a warning messages, callback.
*/
typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* errorSAXFunc:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format an error messages, callback.
*/
typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* fatalErrorSAXFunc:
* @ctx: an XML parser context
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
* Display and format fatal error messages, callback.
* Note: so far fatalError() SAX callbacks are not used, error()
* get all the callbacks for errors.
*/
typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* isStandaloneSAXFunc:
* @ctx: the user data (XML parser context)
*
* Is this document tagged standalone?
*
* Returns 1 if true
*/
typedef int (*isStandaloneSAXFunc) (void *ctx);
/**
* hasInternalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
*
* Does this document has an internal subset.
*
* Returns 1 if true
*/
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
/**
* hasExternalSubsetSAXFunc:
* @ctx: the user data (XML parser context)
*
* Does this document has an external subset?
*
* Returns 1 if true
*/
typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
/************************************************************************
* *
* The SAX version 2 API extensions *
* *
************************************************************************/
/**
* XML_SAX2_MAGIC:
*
* Special constant found in SAX2 blocks initialized fields
*/
#define XML_SAX2_MAGIC 0xDEEDBEAF
/**
* startElementNsSAX2Func:
* @ctx: the user data (XML parser context)
* @localname: the local name of the element
* @prefix: the element namespace prefix if available
* @URI: the element namespace name if available
* @nb_namespaces: number of namespace definitions on that node
* @namespaces: pointer to the array of prefix/URI pairs namespace definitions
* @nb_attributes: the number of attributes on that node
* @nb_defaulted: the number of defaulted attributes. The defaulted
* ones are at the end of the array
* @attributes: pointer to the array of (localname/prefix/URI/value/end)
* attribute values.
*
* SAX2 callback when an element start has been detected by the parser.
* It provides the namespace informations for the element, as well as
* the new namespace declarations on the element.
*/
typedef void (*startElementNsSAX2Func) (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes);
/**
* endElementNsSAX2Func:
* @ctx: the user data (XML parser context)
* @localname: the local name of the element
* @prefix: the element namespace prefix if available
* @URI: the element namespace name if available
*
* SAX2 callback when an element end has been detected by the parser.
* It provides the namespace informations for the element.
*/
typedef void (*endElementNsSAX2Func) (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI);
struct _xmlSAXHandler {
internalSubsetSAXFunc internalSubset;
isStandaloneSAXFunc isStandalone;
hasInternalSubsetSAXFunc hasInternalSubset;
hasExternalSubsetSAXFunc hasExternalSubset;
resolveEntitySAXFunc resolveEntity;
getEntitySAXFunc getEntity;
entityDeclSAXFunc entityDecl;
notationDeclSAXFunc notationDecl;
attributeDeclSAXFunc attributeDecl;
elementDeclSAXFunc elementDecl;
unparsedEntityDeclSAXFunc unparsedEntityDecl;
setDocumentLocatorSAXFunc setDocumentLocator;
startDocumentSAXFunc startDocument;
endDocumentSAXFunc endDocument;
startElementSAXFunc startElement;
endElementSAXFunc endElement;
referenceSAXFunc reference;
charactersSAXFunc characters;
ignorableWhitespaceSAXFunc ignorableWhitespace;
processingInstructionSAXFunc processingInstruction;
commentSAXFunc comment;
warningSAXFunc warning;
errorSAXFunc error;
fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
getParameterEntitySAXFunc getParameterEntity;
cdataBlockSAXFunc cdataBlock;
externalSubsetSAXFunc externalSubset;
unsigned int initialized;
/* The following fields are extensions available only on version 2 */
void *_private;
startElementNsSAX2Func startElementNs;
endElementNsSAX2Func endElementNs;
xmlStructuredErrorFunc serror;
};
/*
* SAX Version 1
*/
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
struct _xmlSAXHandlerV1 {
internalSubsetSAXFunc internalSubset;
isStandaloneSAXFunc isStandalone;
hasInternalSubsetSAXFunc hasInternalSubset;
hasExternalSubsetSAXFunc hasExternalSubset;
resolveEntitySAXFunc resolveEntity;
getEntitySAXFunc getEntity;
entityDeclSAXFunc entityDecl;
notationDeclSAXFunc notationDecl;
attributeDeclSAXFunc attributeDecl;
elementDeclSAXFunc elementDecl;
unparsedEntityDeclSAXFunc unparsedEntityDecl;
setDocumentLocatorSAXFunc setDocumentLocator;
startDocumentSAXFunc startDocument;
endDocumentSAXFunc endDocument;
startElementSAXFunc startElement;
endElementSAXFunc endElement;
referenceSAXFunc reference;
charactersSAXFunc characters;
ignorableWhitespaceSAXFunc ignorableWhitespace;
processingInstructionSAXFunc processingInstruction;
commentSAXFunc comment;
warningSAXFunc warning;
errorSAXFunc error;
fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
getParameterEntitySAXFunc getParameterEntity;
cdataBlockSAXFunc cdataBlock;
externalSubsetSAXFunc externalSubset;
unsigned int initialized;
};
/**
* xmlExternalEntityLoader:
* @URL: The System ID of the resource requested
* @ID: The Public ID of the resource requested
* @context: the XML parser context
*
* External entity loaders types.
*
* Returns the entity input parser.
*/
typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
const char *ID,
xmlParserCtxtPtr context);
#ifdef __cplusplus
}
#endif
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#include <libxml/globals.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Init/Cleanup
*/
XMLPUBFUN void XMLCALL
xmlInitParser (void);
XMLPUBFUN void XMLCALL
xmlCleanupParser (void);
/*
* Input functions
*/
XMLPUBFUN int XMLCALL
xmlParserInputRead (xmlParserInputPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputGrow (xmlParserInputPtr in,
int len);
/*
* Basic parsing Interfaces
*/
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseDoc (const xmlChar *cur);
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseFile (const char *filename);
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseMemory (const char *buffer,
int size);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
xmlSubstituteEntitiesDefault(int val);
XMLPUBFUN int XMLCALL
xmlKeepBlanksDefault (int val);
XMLPUBFUN void XMLCALL
xmlStopParser (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlPedanticParserDefault(int val);
XMLPUBFUN int XMLCALL
xmlLineNumbersDefault (int val);
#ifdef LIBXML_SAX1_ENABLED
/*
* Recovery mode
*/
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverDoc (const xmlChar *cur);
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverMemory (const char *buffer,
int size);
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverFile (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
/*
* Less common routines and SAX interfaces
*/
XMLPUBFUN int XMLCALL
xmlParseDocument (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
void *user_data,
const char *filename);
XMLPUBFUN int XMLCALL
xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
void *user_data,
const char *buffer,
int size);
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseDoc (xmlSAXHandlerPtr sax,
const xmlChar *cur,
int recovery);
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseMemory (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery);
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery,
void *data);
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
const char *filename,
int recovery,
void *data);
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseEntity (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN xmlDtdPtr XMLCALL
xmlSAXParseDTD (xmlSAXHandlerPtr sax,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
xmlParseDTD (const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
xmlIOParseDTD (xmlSAXHandlerPtr sax,
xmlParserInputBufferPtr input,
xmlCharEncoding enc);
#endif /* LIBXML_VALID_ENABLE */
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
xmlParseBalancedChunkMemory(xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void *user_data,
int depth,
const xmlChar *string,
xmlNodePtr *lst);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN xmlParserErrors XMLCALL
xmlParseInNodeContext (xmlNodePtr node,
const char *data,
int datalen,
int options,
xmlNodePtr *lst);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void *user_data,
int depth,
const xmlChar *string,
xmlNodePtr *lst,
int recover);
XMLPUBFUN int XMLCALL
xmlParseExternalEntity (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void *user_data,
int depth,
const xmlChar *URL,
const xmlChar *ID,
xmlNodePtr *lst);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
const xmlChar *URL,
const xmlChar *ID,
xmlNodePtr *lst);
/*
* Parser contexts handling.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlNewParserCtxt (void);
XMLPUBFUN int XMLCALL
xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN void XMLCALL
xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
const xmlChar* buffer,
const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateDocParserCtxt (const xmlChar *cur);
#ifdef LIBXML_LEGACY_ENABLED
/*
* Reading/setting optional parsing features.
*/
XMLPUBFUN int XMLCALL
xmlGetFeaturesList (int *len,
const char **result);
XMLPUBFUN int XMLCALL
xmlGetFeature (xmlParserCtxtPtr ctxt,
const char *name,
void *result);
XMLPUBFUN int XMLCALL
xmlSetFeature (xmlParserCtxtPtr ctxt,
const char *name,
void *value);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef LIBXML_PUSH_ENABLED
/*
* Interfaces for the Push mode.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename);
XMLPUBFUN int XMLCALL
xmlParseChunk (xmlParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
#endif /* LIBXML_PUSH_ENABLED */
/*
* Special I/O mode.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
void *user_data,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc);
/*
* Node infos.
*/
XMLPUBFUN const xmlParserNodeInfo* XMLCALL
xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
const xmlNodePtr node);
XMLPUBFUN void XMLCALL
xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
XMLPUBFUN void XMLCALL
xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
XMLPUBFUN unsigned long XMLCALL
xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
const xmlNodePtr node);
XMLPUBFUN void XMLCALL
xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
const xmlParserNodeInfoPtr info);
/*
* External entities handling actually implemented in xmlIO.
*/
XMLPUBFUN void XMLCALL
xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
XMLPUBFUN xmlExternalEntityLoader XMLCALL
xmlGetExternalEntityLoader(void);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlLoadExternalEntity (const char *URL,
const char *ID,
xmlParserCtxtPtr ctxt);
/*
* Index lookup, actually implemented in the encoding module
*/
XMLPUBFUN long XMLCALL
xmlByteConsumed (xmlParserCtxtPtr ctxt);
/*
* New set of simpler/more flexible APIs
*/
/**
* xmlParserOption:
*
* This is the set of XML parser options that can be passed down
* to the xmlReadDoc() and similar calls.
*/
typedef enum {
XML_PARSE_RECOVER = 1<<0, /* recover on errors */
XML_PARSE_NOENT = 1<<1, /* substitute entities */
XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */
XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */
XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */
XML_PARSE_NOERROR = 1<<5, /* suppress error reports */
XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */
XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */
XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */
XML_PARSE_NONET = 1<<11,/* Forbid network access */
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of
the tree allowed afterwards (will possibly
crash if you try to modify the tree) */
XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */
XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */
XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
} xmlParserOption;
XMLPUBFUN void XMLCALL
xmlCtxtReset (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlCtxtResetPush (xmlParserCtxtPtr ctxt,
const char *chunk,
int size,
const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/*
* Library wide options
*/
/**
* xmlFeature:
*
* Used to examine the existance of features that can be enabled
* or disabled at compile-time.
* They used to be called XML_FEATURE_xxx but this clashed with Expat
*/
typedef enum {
XML_WITH_THREAD = 1,
XML_WITH_TREE = 2,
XML_WITH_OUTPUT = 3,
XML_WITH_PUSH = 4,
XML_WITH_READER = 5,
XML_WITH_PATTERN = 6,
XML_WITH_WRITER = 7,
XML_WITH_SAX1 = 8,
XML_WITH_FTP = 9,
XML_WITH_HTTP = 10,
XML_WITH_VALID = 11,
XML_WITH_HTML = 12,
XML_WITH_LEGACY = 13,
XML_WITH_C14N = 14,
XML_WITH_CATALOG = 15,
XML_WITH_XPATH = 16,
XML_WITH_XPTR = 17,
XML_WITH_XINCLUDE = 18,
XML_WITH_ICONV = 19,
XML_WITH_ISO8859X = 20,
XML_WITH_UNICODE = 21,
XML_WITH_REGEXP = 22,
XML_WITH_AUTOMATA = 23,
XML_WITH_EXPR = 24,
XML_WITH_SCHEMAS = 25,
XML_WITH_SCHEMATRON = 26,
XML_WITH_MODULES = 27,
XML_WITH_DEBUG = 28,
XML_WITH_DEBUG_MEM = 29,
XML_WITH_DEBUG_RUN = 30,
XML_WITH_ZLIB = 31,
XML_WITH_ICU = 32,
XML_WITH_LZMA = 33,
XML_WITH_NONE = 99999 /* just to be sure of allocation size */
} xmlFeature;
XMLPUBFUN int XMLCALL
xmlHasFeature (xmlFeature feature);
#ifdef __cplusplus
}
#endif
#endif /* __XML_PARSER_H__ */
/*
* Summary: Old SAX version 1 handler, deprecated
* Description: DEPRECATED set of SAX version 1 interfaces used to
* build the DOM tree.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SAX_H__
#define __XML_SAX_H__
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
#ifdef LIBXML_LEGACY_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
getPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
getSystemId (void *ctx);
XMLPUBFUN void XMLCALL
setDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
getLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
getColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
isStandalone (void *ctx);
XMLPUBFUN int XMLCALL
hasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
hasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
internalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
externalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
getEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
getParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
resolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
entityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
attributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
elementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
notationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
unparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
startDocument (void *ctx);
XMLPUBFUN void XMLCALL
endDocument (void *ctx);
XMLPUBFUN void XMLCALL
attribute (void *ctx,
const xmlChar *fullname,
const xmlChar *value);
XMLPUBFUN void XMLCALL
startElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
endElement (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
ignorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
processingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
globalNamespace (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
setNamespace (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlNsPtr XMLCALL
getNamespace (void *ctx);
XMLPUBFUN int XMLCALL
checkNamespace (void *ctx,
xmlChar *nameSpace);
XMLPUBFUN void XMLCALL
namespaceDecl (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
cdataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN void XMLCALL
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL
initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#endif /* LIBXML_SAX1_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_LEGACY_ENABLED */
#endif /* __XML_SAX_H__ */
/*
* Summary: error handling
* Description: the API used to report errors
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#include <libxml/parser.h>
#ifndef __XML_ERROR_H__
#define __XML_ERROR_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlErrorLevel:
*
* Indicates the level of an error
*/
typedef enum {
XML_ERR_NONE = 0,
XML_ERR_WARNING = 1, /* A simple warning */
XML_ERR_ERROR = 2, /* A recoverable error */
XML_ERR_FATAL = 3 /* A fatal error */
} xmlErrorLevel;
/**
* xmlErrorDomain:
*
* Indicates where an error may have come from
*/
typedef enum {
XML_FROM_NONE = 0,
XML_FROM_PARSER, /* The XML parser */
XML_FROM_TREE, /* The tree module */
XML_FROM_NAMESPACE, /* The XML Namespace module */
XML_FROM_DTD, /* The XML DTD validation with parser context*/
XML_FROM_HTML, /* The HTML parser */
XML_FROM_MEMORY, /* The memory allocator */
XML_FROM_OUTPUT, /* The serialization code */
XML_FROM_IO, /* The Input/Output stack */
XML_FROM_FTP, /* The FTP module */
XML_FROM_HTTP, /* The HTTP module */
XML_FROM_XINCLUDE, /* The XInclude processing */
XML_FROM_XPATH, /* The XPath module */
XML_FROM_XPOINTER, /* The XPointer module */
XML_FROM_REGEXP, /* The regular expressions module */
XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */
XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */
XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */
XML_FROM_RELAXNGP, /* The Relax-NG parser module */
XML_FROM_RELAXNGV, /* The Relax-NG validator module */
XML_FROM_CATALOG, /* The Catalog module */
XML_FROM_C14N, /* The Canonicalization module */
XML_FROM_XSLT, /* The XSLT engine from libxslt */
XML_FROM_VALID, /* The XML DTD validation with valid context */
XML_FROM_CHECK, /* The error checking module */
XML_FROM_WRITER, /* The xmlwriter module */
XML_FROM_MODULE, /* The dynamically loaded module module*/
XML_FROM_I18N, /* The module handling character conversion */
XML_FROM_SCHEMATRONV,/* The Schematron validator module */
XML_FROM_BUFFER, /* The buffers module */
XML_FROM_URI /* The URI module */
} xmlErrorDomain;
/**
* xmlError:
*
* An XML Error instance.
*/
typedef struct _xmlError xmlError;
typedef xmlError *xmlErrorPtr;
struct _xmlError {
int domain; /* What part of the library raised this error */
int code; /* The error code, e.g. an xmlParserError */
char *message;/* human-readable informative error message */
xmlErrorLevel level;/* how consequent is the error */
char *file; /* the filename */
int line; /* the line number if available */
char *str1; /* extra string information */
char *str2; /* extra string information */
char *str3; /* extra string information */
int int1; /* extra number information */
int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */
void *ctxt; /* the parser context if available */
void *node; /* the node in the tree */
};
/**
* xmlParserError:
*
* This is an error that the XML (or HTML) parser can generate
*/
typedef enum {
XML_ERR_OK = 0,
XML_ERR_INTERNAL_ERROR, /* 1 */
XML_ERR_NO_MEMORY, /* 2 */
XML_ERR_DOCUMENT_START, /* 3 */
XML_ERR_DOCUMENT_EMPTY, /* 4 */
XML_ERR_DOCUMENT_END, /* 5 */
XML_ERR_INVALID_HEX_CHARREF, /* 6 */
XML_ERR_INVALID_DEC_CHARREF, /* 7 */
XML_ERR_INVALID_CHARREF, /* 8 */
XML_ERR_INVALID_CHAR, /* 9 */
XML_ERR_CHARREF_AT_EOF, /* 10 */
XML_ERR_CHARREF_IN_PROLOG, /* 11 */
XML_ERR_CHARREF_IN_EPILOG, /* 12 */
XML_ERR_CHARREF_IN_DTD, /* 13 */
XML_ERR_ENTITYREF_AT_EOF, /* 14 */
XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */
XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */
XML_ERR_ENTITYREF_IN_DTD, /* 17 */
XML_ERR_PEREF_AT_EOF, /* 18 */
XML_ERR_PEREF_IN_PROLOG, /* 19 */
XML_ERR_PEREF_IN_EPILOG, /* 20 */
XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */
XML_ERR_ENTITYREF_NO_NAME, /* 22 */
XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */
XML_ERR_PEREF_NO_NAME, /* 24 */
XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */
XML_ERR_UNDECLARED_ENTITY, /* 26 */
XML_WAR_UNDECLARED_ENTITY, /* 27 */
XML_ERR_UNPARSED_ENTITY, /* 28 */
XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */
XML_ERR_ENTITY_IS_PARAMETER, /* 30 */
XML_ERR_UNKNOWN_ENCODING, /* 31 */
XML_ERR_UNSUPPORTED_ENCODING, /* 32 */
XML_ERR_STRING_NOT_STARTED, /* 33 */
XML_ERR_STRING_NOT_CLOSED, /* 34 */
XML_ERR_NS_DECL_ERROR, /* 35 */
XML_ERR_ENTITY_NOT_STARTED, /* 36 */
XML_ERR_ENTITY_NOT_FINISHED, /* 37 */
XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */
XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */
XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */
XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */
XML_ERR_LITERAL_NOT_STARTED, /* 43 */
XML_ERR_LITERAL_NOT_FINISHED, /* 44 */
XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
XML_ERR_PI_NOT_STARTED, /* 46 */
XML_ERR_PI_NOT_FINISHED, /* 47 */
XML_ERR_NOTATION_NOT_STARTED, /* 48 */
XML_ERR_NOTATION_NOT_FINISHED, /* 49 */
XML_ERR_ATTLIST_NOT_STARTED, /* 50 */
XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */
XML_ERR_MIXED_NOT_STARTED, /* 52 */
XML_ERR_MIXED_NOT_FINISHED, /* 53 */
XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */
XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */
XML_ERR_XMLDECL_NOT_STARTED, /* 56 */
XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */
XML_ERR_CONDSEC_NOT_STARTED, /* 58 */
XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */
XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */
XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */
XML_ERR_MISPLACED_CDATA_END, /* 62 */
XML_ERR_CDATA_NOT_FINISHED, /* 63 */
XML_ERR_RESERVED_XML_NAME, /* 64 */
XML_ERR_SPACE_REQUIRED, /* 65 */
XML_ERR_SEPARATOR_REQUIRED, /* 66 */
XML_ERR_NMTOKEN_REQUIRED, /* 67 */
XML_ERR_NAME_REQUIRED, /* 68 */
XML_ERR_PCDATA_REQUIRED, /* 69 */
XML_ERR_URI_REQUIRED, /* 70 */
XML_ERR_PUBID_REQUIRED, /* 71 */
XML_ERR_LT_REQUIRED, /* 72 */
XML_ERR_GT_REQUIRED, /* 73 */
XML_ERR_LTSLASH_REQUIRED, /* 74 */
XML_ERR_EQUAL_REQUIRED, /* 75 */
XML_ERR_TAG_NAME_MISMATCH, /* 76 */
XML_ERR_TAG_NOT_FINISHED, /* 77 */
XML_ERR_STANDALONE_VALUE, /* 78 */
XML_ERR_ENCODING_NAME, /* 79 */
XML_ERR_HYPHEN_IN_COMMENT, /* 80 */
XML_ERR_INVALID_ENCODING, /* 81 */
XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */
XML_ERR_CONDSEC_INVALID, /* 83 */
XML_ERR_VALUE_REQUIRED, /* 84 */
XML_ERR_NOT_WELL_BALANCED, /* 85 */
XML_ERR_EXTRA_CONTENT, /* 86 */
XML_ERR_ENTITY_CHAR_ERROR, /* 87 */
XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
XML_ERR_ENTITY_LOOP, /* 89 */
XML_ERR_ENTITY_BOUNDARY, /* 90 */
XML_ERR_INVALID_URI, /* 91 */
XML_ERR_URI_FRAGMENT, /* 92 */
XML_WAR_CATALOG_PI, /* 93 */
XML_ERR_NO_DTD, /* 94 */
XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */
XML_ERR_VERSION_MISSING, /* 96 */
XML_WAR_UNKNOWN_VERSION, /* 97 */
XML_WAR_LANG_VALUE, /* 98 */
XML_WAR_NS_URI, /* 99 */
XML_WAR_NS_URI_RELATIVE, /* 100 */
XML_ERR_MISSING_ENCODING, /* 101 */
XML_WAR_SPACE_VALUE, /* 102 */
XML_ERR_NOT_STANDALONE, /* 103 */
XML_ERR_ENTITY_PROCESSING, /* 104 */
XML_ERR_NOTATION_PROCESSING, /* 105 */
XML_WAR_NS_COLUMN, /* 106 */
XML_WAR_ENTITY_REDEFINED, /* 107 */
XML_ERR_UNKNOWN_VERSION, /* 108 */
XML_ERR_VERSION_MISMATCH, /* 109 */
XML_ERR_NAME_TOO_LONG, /* 110 */
XML_ERR_USER_STOP, /* 111 */
XML_NS_ERR_XML_NAMESPACE = 200,
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
XML_NS_ERR_QNAME, /* 202 */
XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */
XML_NS_ERR_EMPTY, /* 204 */
XML_NS_ERR_COLON, /* 205 */
XML_DTD_ATTRIBUTE_DEFAULT = 500,
XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */
XML_DTD_ATTRIBUTE_VALUE, /* 502 */
XML_DTD_CONTENT_ERROR, /* 503 */
XML_DTD_CONTENT_MODEL, /* 504 */
XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */
XML_DTD_DIFFERENT_PREFIX, /* 506 */
XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */
XML_DTD_ELEM_NAMESPACE, /* 508 */
XML_DTD_ELEM_REDEFINED, /* 509 */
XML_DTD_EMPTY_NOTATION, /* 510 */
XML_DTD_ENTITY_TYPE, /* 511 */
XML_DTD_ID_FIXED, /* 512 */
XML_DTD_ID_REDEFINED, /* 513 */
XML_DTD_ID_SUBSET, /* 514 */
XML_DTD_INVALID_CHILD, /* 515 */
XML_DTD_INVALID_DEFAULT, /* 516 */
XML_DTD_LOAD_ERROR, /* 517 */
XML_DTD_MISSING_ATTRIBUTE, /* 518 */
XML_DTD_MIXED_CORRUPT, /* 519 */
XML_DTD_MULTIPLE_ID, /* 520 */
XML_DTD_NO_DOC, /* 521 */
XML_DTD_NO_DTD, /* 522 */
XML_DTD_NO_ELEM_NAME, /* 523 */
XML_DTD_NO_PREFIX, /* 524 */
XML_DTD_NO_ROOT, /* 525 */
XML_DTD_NOTATION_REDEFINED, /* 526 */
XML_DTD_NOTATION_VALUE, /* 527 */
XML_DTD_NOT_EMPTY, /* 528 */
XML_DTD_NOT_PCDATA, /* 529 */
XML_DTD_NOT_STANDALONE, /* 530 */
XML_DTD_ROOT_NAME, /* 531 */
XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */
XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */
XML_DTD_UNKNOWN_ELEM, /* 534 */
XML_DTD_UNKNOWN_ENTITY, /* 535 */
XML_DTD_UNKNOWN_ID, /* 536 */
XML_DTD_UNKNOWN_NOTATION, /* 537 */
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
XML_DTD_XMLID_VALUE, /* 539 */
XML_DTD_XMLID_TYPE, /* 540 */
XML_DTD_DUP_TOKEN, /* 541 */
XML_HTML_STRUCURE_ERROR = 800,
XML_HTML_UNKNOWN_TAG, /* 801 */
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
XML_RNGP_ATTR_CONFLICT, /* 1001 */
XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */
XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */
XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */
XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */
XML_RNGP_CHOICE_CONTENT, /* 1006 */
XML_RNGP_CHOICE_EMPTY, /* 1007 */
XML_RNGP_CREATE_FAILURE, /* 1008 */
XML_RNGP_DATA_CONTENT, /* 1009 */
XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */
XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */
XML_RNGP_DEFINE_EMPTY, /* 1012 */
XML_RNGP_DEFINE_MISSING, /* 1013 */
XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */
XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */
XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */
XML_RNGP_ELEMENT_EMPTY, /* 1017 */
XML_RNGP_ELEMENT_CONTENT, /* 1018 */
XML_RNGP_ELEMENT_NAME, /* 1019 */
XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */
XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */
XML_RNGP_EMPTY, /* 1022 */
XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */
XML_RNGP_EMPTY_CONTENT, /* 1024 */
XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */
XML_RNGP_ERROR_TYPE_LIB, /* 1026 */
XML_RNGP_EXCEPT_EMPTY, /* 1027 */
XML_RNGP_EXCEPT_MISSING, /* 1028 */
XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */
XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */
XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */
XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */
XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */
XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */
XML_RNGP_FOREIGN_ELEMENT, /* 1035 */
XML_RNGP_GRAMMAR_CONTENT, /* 1036 */
XML_RNGP_GRAMMAR_EMPTY, /* 1037 */
XML_RNGP_GRAMMAR_MISSING, /* 1038 */
XML_RNGP_GRAMMAR_NO_START, /* 1039 */
XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */
XML_RNGP_HREF_ERROR, /* 1041 */
XML_RNGP_INCLUDE_EMPTY, /* 1042 */
XML_RNGP_INCLUDE_FAILURE, /* 1043 */
XML_RNGP_INCLUDE_RECURSE, /* 1044 */
XML_RNGP_INTERLEAVE_ADD, /* 1045 */
XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */
XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */
XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */
XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */
XML_RNGP_INVALID_URI, /* 1050 */
XML_RNGP_INVALID_VALUE, /* 1051 */
XML_RNGP_MISSING_HREF, /* 1052 */
XML_RNGP_NAME_MISSING, /* 1053 */
XML_RNGP_NEED_COMBINE, /* 1054 */
XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */
XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */
XML_RNGP_NSNAME_NO_NS, /* 1057 */
XML_RNGP_PARAM_FORBIDDEN, /* 1058 */
XML_RNGP_PARAM_NAME_MISSING, /* 1059 */
XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */
XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */
XML_RNGP_PARENTREF_NO_NAME, /* 1062 */
XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */
XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */
XML_RNGP_PARSE_ERROR, /* 1065 */
XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */
XML_RNGP_PAT_ATTR_ATTR, /* 1067 */
XML_RNGP_PAT_ATTR_ELEM, /* 1068 */
XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */
XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */
XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */
XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */
XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */
XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */
XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */
XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */
XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */
XML_RNGP_PAT_LIST_ATTR, /* 1078 */
XML_RNGP_PAT_LIST_ELEM, /* 1079 */
XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */
XML_RNGP_PAT_LIST_LIST, /* 1081 */
XML_RNGP_PAT_LIST_REF, /* 1082 */
XML_RNGP_PAT_LIST_TEXT, /* 1083 */
XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */
XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */
XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */
XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */
XML_RNGP_PAT_START_ATTR, /* 1088 */
XML_RNGP_PAT_START_DATA, /* 1089 */
XML_RNGP_PAT_START_EMPTY, /* 1090 */
XML_RNGP_PAT_START_GROUP, /* 1091 */
XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */
XML_RNGP_PAT_START_LIST, /* 1093 */
XML_RNGP_PAT_START_ONEMORE, /* 1094 */
XML_RNGP_PAT_START_TEXT, /* 1095 */
XML_RNGP_PAT_START_VALUE, /* 1096 */
XML_RNGP_PREFIX_UNDEFINED, /* 1097 */
XML_RNGP_REF_CREATE_FAILED, /* 1098 */
XML_RNGP_REF_CYCLE, /* 1099 */
XML_RNGP_REF_NAME_INVALID, /* 1100 */
XML_RNGP_REF_NO_DEF, /* 1101 */
XML_RNGP_REF_NO_NAME, /* 1102 */
XML_RNGP_REF_NOT_EMPTY, /* 1103 */
XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */
XML_RNGP_START_CONTENT, /* 1105 */
XML_RNGP_START_EMPTY, /* 1106 */
XML_RNGP_START_MISSING, /* 1107 */
XML_RNGP_TEXT_EXPECTED, /* 1108 */
XML_RNGP_TEXT_HAS_CHILD, /* 1109 */
XML_RNGP_TYPE_MISSING, /* 1110 */
XML_RNGP_TYPE_NOT_FOUND, /* 1111 */
XML_RNGP_TYPE_VALUE, /* 1112 */
XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */
XML_RNGP_UNKNOWN_COMBINE, /* 1114 */
XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */
XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */
XML_RNGP_URI_FRAGMENT, /* 1117 */
XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */
XML_RNGP_VALUE_EMPTY, /* 1119 */
XML_RNGP_VALUE_NO_CONTENT, /* 1120 */
XML_RNGP_XMLNS_NAME, /* 1121 */
XML_RNGP_XML_NS, /* 1122 */
XML_XPATH_EXPRESSION_OK = 1200,
XML_XPATH_NUMBER_ERROR, /* 1201 */
XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */
XML_XPATH_START_LITERAL_ERROR, /* 1203 */
XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */
XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */
XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */
XML_XPATH_EXPR_ERROR, /* 1207 */
XML_XPATH_UNCLOSED_ERROR, /* 1208 */
XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */
XML_XPATH_INVALID_OPERAND, /* 1210 */
XML_XPATH_INVALID_TYPE, /* 1211 */
XML_XPATH_INVALID_ARITY, /* 1212 */
XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */
XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */
XML_XPATH_MEMORY_ERROR, /* 1215 */
XML_XPTR_SYNTAX_ERROR, /* 1216 */
XML_XPTR_RESOURCE_ERROR, /* 1217 */
XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */
XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */
XML_XPATH_ENCODING_ERROR, /* 1220 */
XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */
XML_TREE_INVALID_HEX = 1300,
XML_TREE_INVALID_DEC, /* 1301 */
XML_TREE_UNTERMINATED_ENTITY, /* 1302 */
XML_TREE_NOT_UTF8, /* 1303 */
XML_SAVE_NOT_UTF8 = 1400,
XML_SAVE_CHAR_INVALID, /* 1401 */
XML_SAVE_NO_DOCTYPE, /* 1402 */
XML_SAVE_UNKNOWN_ENCODING, /* 1403 */
XML_REGEXP_COMPILE_ERROR = 1450,
XML_IO_UNKNOWN = 1500,
XML_IO_EACCES, /* 1501 */
XML_IO_EAGAIN, /* 1502 */
XML_IO_EBADF, /* 1503 */
XML_IO_EBADMSG, /* 1504 */
XML_IO_EBUSY, /* 1505 */
XML_IO_ECANCELED, /* 1506 */
XML_IO_ECHILD, /* 1507 */
XML_IO_EDEADLK, /* 1508 */
XML_IO_EDOM, /* 1509 */
XML_IO_EEXIST, /* 1510 */
XML_IO_EFAULT, /* 1511 */
XML_IO_EFBIG, /* 1512 */
XML_IO_EINPROGRESS, /* 1513 */
XML_IO_EINTR, /* 1514 */
XML_IO_EINVAL, /* 1515 */
XML_IO_EIO, /* 1516 */
XML_IO_EISDIR, /* 1517 */
XML_IO_EMFILE, /* 1518 */
XML_IO_EMLINK, /* 1519 */
XML_IO_EMSGSIZE, /* 1520 */
XML_IO_ENAMETOOLONG, /* 1521 */
XML_IO_ENFILE, /* 1522 */
XML_IO_ENODEV, /* 1523 */
XML_IO_ENOENT, /* 1524 */
XML_IO_ENOEXEC, /* 1525 */
XML_IO_ENOLCK, /* 1526 */
XML_IO_ENOMEM, /* 1527 */
XML_IO_ENOSPC, /* 1528 */
XML_IO_ENOSYS, /* 1529 */
XML_IO_ENOTDIR, /* 1530 */
XML_IO_ENOTEMPTY, /* 1531 */
XML_IO_ENOTSUP, /* 1532 */
XML_IO_ENOTTY, /* 1533 */
XML_IO_ENXIO, /* 1534 */
XML_IO_EPERM, /* 1535 */
XML_IO_EPIPE, /* 1536 */
XML_IO_ERANGE, /* 1537 */
XML_IO_EROFS, /* 1538 */
XML_IO_ESPIPE, /* 1539 */
XML_IO_ESRCH, /* 1540 */
XML_IO_ETIMEDOUT, /* 1541 */
XML_IO_EXDEV, /* 1542 */
XML_IO_NETWORK_ATTEMPT, /* 1543 */
XML_IO_ENCODER, /* 1544 */
XML_IO_FLUSH, /* 1545 */
XML_IO_WRITE, /* 1546 */
XML_IO_NO_INPUT, /* 1547 */
XML_IO_BUFFER_FULL, /* 1548 */
XML_IO_LOAD_ERROR, /* 1549 */
XML_IO_ENOTSOCK, /* 1550 */
XML_IO_EISCONN, /* 1551 */
XML_IO_ECONNREFUSED, /* 1552 */
XML_IO_ENETUNREACH, /* 1553 */
XML_IO_EADDRINUSE, /* 1554 */
XML_IO_EALREADY, /* 1555 */
XML_IO_EAFNOSUPPORT, /* 1556 */
XML_XINCLUDE_RECURSION=1600,
XML_XINCLUDE_PARSE_VALUE, /* 1601 */
XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */
XML_XINCLUDE_NO_HREF, /* 1603 */
XML_XINCLUDE_NO_FALLBACK, /* 1604 */
XML_XINCLUDE_HREF_URI, /* 1605 */
XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */
XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */
XML_XINCLUDE_INVALID_CHAR, /* 1608 */
XML_XINCLUDE_BUILD_FAILED, /* 1609 */
XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */
XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */
XML_XINCLUDE_XPTR_FAILED, /* 1612 */
XML_XINCLUDE_XPTR_RESULT, /* 1613 */
XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */
XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */
XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */
XML_XINCLUDE_DEPRECATED_NS, /* 1617 */
XML_XINCLUDE_FRAGMENT_ID, /* 1618 */
XML_CATALOG_MISSING_ATTR = 1650,
XML_CATALOG_ENTRY_BROKEN, /* 1651 */
XML_CATALOG_PREFER_VALUE, /* 1652 */
XML_CATALOG_NOT_CATALOG, /* 1653 */
XML_CATALOG_RECURSION, /* 1654 */
XML_SCHEMAP_PREFIX_UNDEFINED = 1700,
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */
XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */
XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */
XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */
XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */
XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */
XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */
XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */
XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */
XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */
XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */
XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */
XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */
XML_SCHEMAP_INVALID_ENUM, /* 1715 */
XML_SCHEMAP_INVALID_FACET, /* 1716 */
XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */
XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */
XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */
XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */
XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */
XML_SCHEMAP_NOATTR_NOREF, /* 1722 */
XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */
XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */
XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */
XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */
XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */
XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */
XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */
XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */
XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */
XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */
XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */
XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */
XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */
XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */
XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */
XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */
XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */
XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */
XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */
XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */
XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */
XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */
XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */
XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */
XML_SCHEMAP_UNKNOWN_REF, /* 1747 */
XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */
XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */
XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */
XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */
XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */
XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */
XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */
XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */
XML_SCHEMAP_REGEXP_INVALID, /* 1756 */
XML_SCHEMAP_FAILED_LOAD, /* 1757 */
XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */
XML_SCHEMAP_NOROOT, /* 1759 */
XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */
XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */
XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */
XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */
XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */
XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */
XML_SCHEMAP_FAILED_PARSE, /* 1766 */
XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */
XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */
XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */
XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */
XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */
XML_SCHEMAP_NOT_SCHEMA, /* 1772 */
XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */
XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */
XML_SCHEMAP_RECURSIVE, /* 1775 */
XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */
XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */
XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */
XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */
XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */
XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */
XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */
XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */
XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */
XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */
XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */
XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */
XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */
XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */
XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */
XML_SCHEMAV_NOROOT = 1801,
XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */
XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */
XML_SCHEMAV_MISSING, /* 1804 */
XML_SCHEMAV_WRONGELEM, /* 1805 */
XML_SCHEMAV_NOTYPE, /* 1806 */
XML_SCHEMAV_NOROLLBACK, /* 1807 */
XML_SCHEMAV_ISABSTRACT, /* 1808 */
XML_SCHEMAV_NOTEMPTY, /* 1809 */
XML_SCHEMAV_ELEMCONT, /* 1810 */
XML_SCHEMAV_HAVEDEFAULT, /* 1811 */
XML_SCHEMAV_NOTNILLABLE, /* 1812 */
XML_SCHEMAV_EXTRACONTENT, /* 1813 */
XML_SCHEMAV_INVALIDATTR, /* 1814 */
XML_SCHEMAV_INVALIDELEM, /* 1815 */
XML_SCHEMAV_NOTDETERMINIST, /* 1816 */
XML_SCHEMAV_CONSTRUCT, /* 1817 */
XML_SCHEMAV_INTERNAL, /* 1818 */
XML_SCHEMAV_NOTSIMPLE, /* 1819 */
XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */
XML_SCHEMAV_ATTRINVALID, /* 1821 */
XML_SCHEMAV_VALUE, /* 1822 */
XML_SCHEMAV_FACET, /* 1823 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */
XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */
XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */
XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */
XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */
XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */
XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */
XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */
XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */
XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */
XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */
XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */
XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */
XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */
XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */
XML_SCHEMAV_CVC_ELT_1, /* 1845 */
XML_SCHEMAV_CVC_ELT_2, /* 1846 */
XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */
XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */
XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */
XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */
XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */
XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */
XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */
XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */
XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */
XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */
XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */
XML_SCHEMAV_CVC_ELT_6, /* 1859 */
XML_SCHEMAV_CVC_ELT_7, /* 1860 */
XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */
XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */
XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */
XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */
XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */
XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */
XML_SCHEMAV_CVC_AU, /* 1874 */
XML_SCHEMAV_CVC_TYPE_1, /* 1875 */
XML_SCHEMAV_CVC_TYPE_2, /* 1876 */
XML_SCHEMAV_CVC_IDC, /* 1877 */
XML_SCHEMAV_CVC_WILDCARD, /* 1878 */
XML_SCHEMAV_MISC, /* 1879 */
XML_XPTR_UNKNOWN_SCHEME = 1900,
XML_XPTR_CHILDSEQ_START, /* 1901 */
XML_XPTR_EVAL_FAILED, /* 1902 */
XML_XPTR_EXTRA_OBJECTS, /* 1903 */
XML_C14N_CREATE_CTXT = 1950,
XML_C14N_REQUIRES_UTF8, /* 1951 */
XML_C14N_CREATE_STACK, /* 1952 */
XML_C14N_INVALID_NODE, /* 1953 */
XML_C14N_UNKNOW_NODE, /* 1954 */
XML_C14N_RELATIVE_NAMESPACE, /* 1955 */
XML_FTP_PASV_ANSWER = 2000,
XML_FTP_EPSV_ANSWER, /* 2001 */
XML_FTP_ACCNT, /* 2002 */
XML_FTP_URL_SYNTAX, /* 2003 */
XML_HTTP_URL_SYNTAX = 2020,
XML_HTTP_USE_IP, /* 2021 */
XML_HTTP_UNKNOWN_HOST, /* 2022 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000,
XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */
XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */
XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */
XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */
XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */
XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */
XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */
XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */
XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */
XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */
XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */
XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */
XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */
XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */
XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */
XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */
XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */
XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */
XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */
XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */
XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */
XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */
XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */
XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */
XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */
XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */
XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
XML_SCHEMAP_NO_XMLNS, /* 3056 */
XML_SCHEMAP_NO_XSI, /* 3057 */
XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */
XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */
XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */
XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */
XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */
XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */
XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */
XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */
XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */
XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */
XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */
XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */
XML_SCHEMAP_SRC_CT_1, /* 3076 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */
XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */
XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */
XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */
XML_SCHEMAP_SRC_REDEFINE, /* 3081 */
XML_SCHEMAP_SRC_IMPORT, /* 3082 */
XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */
XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */
XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */
XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */
XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */
XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */
XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */
XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */
XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */
XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */
XML_SCHEMATRONV_REPORT,
XML_MODULE_OPEN = 4900, /* 4900 */
XML_MODULE_CLOSE, /* 4901 */
XML_CHECK_FOUND_ELEMENT = 5000,
XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */
XML_CHECK_FOUND_TEXT, /* 5002 */
XML_CHECK_FOUND_CDATA, /* 5003 */
XML_CHECK_FOUND_ENTITYREF, /* 5004 */
XML_CHECK_FOUND_ENTITY, /* 5005 */
XML_CHECK_FOUND_PI, /* 5006 */
XML_CHECK_FOUND_COMMENT, /* 5007 */
XML_CHECK_FOUND_DOCTYPE, /* 5008 */
XML_CHECK_FOUND_FRAGMENT, /* 5009 */
XML_CHECK_FOUND_NOTATION, /* 5010 */
XML_CHECK_UNKNOWN_NODE, /* 5011 */
XML_CHECK_ENTITY_TYPE, /* 5012 */
XML_CHECK_NO_PARENT, /* 5013 */
XML_CHECK_NO_DOC, /* 5014 */
XML_CHECK_NO_NAME, /* 5015 */
XML_CHECK_NO_ELEM, /* 5016 */
XML_CHECK_WRONG_DOC, /* 5017 */
XML_CHECK_NO_PREV, /* 5018 */
XML_CHECK_WRONG_PREV, /* 5019 */
XML_CHECK_NO_NEXT, /* 5020 */
XML_CHECK_WRONG_NEXT, /* 5021 */
XML_CHECK_NOT_DTD, /* 5022 */
XML_CHECK_NOT_ATTR, /* 5023 */
XML_CHECK_NOT_ATTR_DECL, /* 5024 */
XML_CHECK_NOT_ELEM_DECL, /* 5025 */
XML_CHECK_NOT_ENTITY_DECL, /* 5026 */
XML_CHECK_NOT_NS_DECL, /* 5027 */
XML_CHECK_NO_HREF, /* 5028 */
XML_CHECK_WRONG_PARENT,/* 5029 */
XML_CHECK_NS_SCOPE, /* 5030 */
XML_CHECK_NS_ANCESTOR, /* 5031 */
XML_CHECK_NOT_UTF8, /* 5032 */
XML_CHECK_NO_DICT, /* 5033 */
XML_CHECK_NOT_NCNAME, /* 5034 */
XML_CHECK_OUTSIDE_DICT, /* 5035 */
XML_CHECK_WRONG_NAME, /* 5036 */
XML_CHECK_NAME_NOT_NULL, /* 5037 */
XML_I18N_NO_NAME = 6000,
XML_I18N_NO_HANDLER, /* 6001 */
XML_I18N_EXCESS_HANDLER, /* 6002 */
XML_I18N_CONV_FAILED, /* 6003 */
XML_I18N_NO_OUTPUT, /* 6004 */
XML_BUF_OVERFLOW = 7000
} xmlParserErrors;
/**
* xmlGenericErrorFunc:
* @ctx: a parsing context
* @msg: the message
* @...: the extra arguments of the varags to format the message
*
* Signature of the function to use when there is an error and
* no parsing or validity context available .
*/
typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlStructuredErrorFunc:
* @userData: user provided data for the error callback
* @error: the error being raised.
*
* Signature of the function to use when there is an error and
* the module handles the new error reporting mechanism.
*/
typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
/*
* Use the following function to reset the two global variables
* xmlGenericError and xmlGenericErrorContext.
*/
XMLPUBFUN void XMLCALL
xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
XMLPUBFUN void XMLCALL
xmlSetStructuredErrorFunc (void *ctx,
xmlStructuredErrorFunc handler);
/*
* Default message routines used by SAX and Valid context for error
* and warning reporting.
*/
XMLPUBFUN void XMLCDECL
xmlParserError (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityError (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCALL
xmlParserPrintFileInfo (xmlParserInputPtr input);
XMLPUBFUN void XMLCALL
xmlParserPrintFileContext (xmlParserInputPtr input);
/*
* Extended error information routines
*/
XMLPUBFUN xmlErrorPtr XMLCALL
xmlGetLastError (void);
XMLPUBFUN void XMLCALL
xmlResetLastError (void);
XMLPUBFUN xmlErrorPtr XMLCALL
xmlCtxtGetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlCtxtResetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlResetError (xmlErrorPtr err);
XMLPUBFUN int XMLCALL
xmlCopyError (xmlErrorPtr from,
xmlErrorPtr to);
#ifdef IN_LIBXML
/*
* Internal callback reporting routine
*/
XMLPUBFUN void XMLCALL
__xmlRaiseError (xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel,
void *data,
void *ctx,
void *node,
int domain,
int code,
xmlErrorLevel level,
const char *file,
int line,
const char *str1,
const char *str2,
const char *str3,
int int1,
int col,
const char *msg,
...) LIBXML_ATTR_FORMAT(16,17);
XMLPUBFUN void XMLCALL
__xmlSimpleError (int domain,
int code,
xmlNodePtr node,
const char *msg,
const char *extra) LIBXML_ATTR_FORMAT(4,0);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_ERROR_H__ */
/*
* Summary: API to handle XML Pointers
* Description: API to handle XML Pointers
* Base implementation was made accordingly to
* W3C Candidate Recommendation 7 June 2000
* http://www.w3.org/TR/2000/CR-xptr-20000607
*
* Added support for the element() scheme described in:
* W3C Proposed Recommendation 13 November 2002
* http://www.w3.org/TR/2002/PR-xptr-element-20021113/
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPTR_H__
#define __XML_XPTR_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPTR_ENABLED
#include <libxml/tree.h>
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* A Location Set
*/
typedef struct _xmlLocationSet xmlLocationSet;
typedef xmlLocationSet *xmlLocationSetPtr;
struct _xmlLocationSet {
int locNr; /* number of locations in the set */
int locMax; /* size of the array as allocated */
xmlXPathObjectPtr *locTab;/* array of locations */
};
/*
* Handling of location sets.
*/
XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
XMLPUBFUN void XMLCALL
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRange (xmlNodePtr start,
int startindex,
xmlNodePtr end,
int endindex);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewCollapsedRange (xmlNodePtr start);
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val);
/*
* Functions.
*/
XMLPUBFUN xmlXPathContextPtr XMLCALL
xmlXPtrNewContext (xmlDocPtr doc,
xmlNodePtr here,
xmlNodePtr origin);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrEval (const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN void XMLCALL
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
int nargs);
XMLPUBFUN xmlNodePtr XMLCALL
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XPTR_H__ */
/*
* Summary: regular expressions handling
* Description: basic API for libxml regular expressions handling used
* for XML Schemas and validation.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_REGEXP_H__
#define __XML_REGEXP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlRegexpPtr:
*
* A libxml regular expression, they can actually be far more complex
* thank the POSIX regex expressions.
*/
typedef struct _xmlRegexp xmlRegexp;
typedef xmlRegexp *xmlRegexpPtr;
/**
* xmlRegExecCtxtPtr:
*
* A libxml progressive regular expression evaluation context
*/
typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The POSIX like API
*/
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpIsDeterminist(xmlRegexpPtr comp);
/**
* xmlRegExecCallbacks:
* @exec: the regular expression context
* @token: the current token string
* @transdata: transition data
* @inputdata: input data
*
* Callback function when doing a transition in the automata
*/
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
const xmlChar *token,
void *transdata,
void *inputdata);
/*
* The progressive API
*/
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
xmlRegNewExecCtxt (xmlRegexpPtr comp,
xmlRegExecCallbacks callback,
void *data);
XMLPUBFUN void XMLCALL
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
XMLPUBFUN int XMLCALL
xmlRegExecPushString(xmlRegExecCtxtPtr exec,
const xmlChar *value,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
const xmlChar *value,
const xmlChar *value2,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
XMLPUBFUN int XMLCALL
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
const xmlChar **string,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
#ifdef LIBXML_EXPR_ENABLED
/*
* Formal regular expression handling
* Its goal is to do some formal work on content models
*/
/* expressions are used within a context */
typedef struct _xmlExpCtxt xmlExpCtxt;
typedef xmlExpCtxt *xmlExpCtxtPtr;
XMLPUBFUN void XMLCALL
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
XMLPUBFUN xmlExpCtxtPtr XMLCALL
xmlExpNewCtxt (int maxNodes,
xmlDictPtr dict);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
/* Expressions are trees but the tree is opaque */
typedef struct _xmlExpNode xmlExpNode;
typedef xmlExpNode *xmlExpNodePtr;
typedef enum {
XML_EXP_EMPTY = 0,
XML_EXP_FORBID = 1,
XML_EXP_ATOM = 2,
XML_EXP_SEQ = 3,
XML_EXP_OR = 4,
XML_EXP_COUNT = 5
} xmlExpNodeType;
/*
* 2 core expressions shared by all for the empty language set
* and for the set with just the empty token
*/
XMLPUBVAR xmlExpNodePtr forbiddenExp;
XMLPUBVAR xmlExpNodePtr emptyExp;
/*
* Expressions are reference counted internally
*/
XMLPUBFUN void XMLCALL
xmlExpFree (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr);
XMLPUBFUN void XMLCALL
xmlExpRef (xmlExpNodePtr expr);
/*
* constructors can be either manual or from a string
*/
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpParse (xmlExpCtxtPtr ctxt,
const char *expr);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewAtom (xmlExpCtxtPtr ctxt,
const xmlChar *name,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewOr (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewSeq (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewRange (xmlExpCtxtPtr ctxt,
xmlExpNodePtr subset,
int min,
int max);
/*
* The really interesting APIs
*/
XMLPUBFUN int XMLCALL
xmlExpIsNillable(xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpMaxToken (xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**langList,
int len);
XMLPUBFUN int XMLCALL
xmlExpGetStart (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**tokList,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpStringDerive(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar *str,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpExpDerive (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN int XMLCALL
xmlExpSubsume (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN void XMLCALL
xmlExpDump (xmlBufferPtr buf,
xmlExpNodePtr expr);
#endif /* LIBXML_EXPR_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_REGEXP_ENABLED */
#endif /*__XML_REGEXP_H__ */
/*
* Summary: interfaces for tree manipulation
* Description: this module describes the structures found in an tree resulting
* from an XML or HTML parsing, as well as the API provided for
* various processing on that tree
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_TREE_H__
#define __XML_TREE_H__
#include <stdio.h>
#include <limits.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some of the basic types pointer to structures:
*/
/* xmlIO.h */
typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
typedef struct _xmlOutputBuffer xmlOutputBuffer;
typedef xmlOutputBuffer *xmlOutputBufferPtr;
/* parser.h */
typedef struct _xmlParserInput xmlParserInput;
typedef xmlParserInput *xmlParserInputPtr;
typedef struct _xmlParserCtxt xmlParserCtxt;
typedef xmlParserCtxt *xmlParserCtxtPtr;
typedef struct _xmlSAXLocator xmlSAXLocator;
typedef xmlSAXLocator *xmlSAXLocatorPtr;
typedef struct _xmlSAXHandler xmlSAXHandler;
typedef xmlSAXHandler *xmlSAXHandlerPtr;
/* entities.h */
typedef struct _xmlEntity xmlEntity;
typedef xmlEntity *xmlEntityPtr;
/**
* BASE_BUFFER_SIZE:
*
* default buffer size 4000.
*/
#define BASE_BUFFER_SIZE 4096
/**
* LIBXML_NAMESPACE_DICT:
*
* Defines experimental behaviour:
* 1) xmlNs gets an additional field @context (a xmlDoc)
* 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc.
*/
/* #define LIBXML_NAMESPACE_DICT */
/**
* xmlBufferAllocationScheme:
*
* A buffer allocation scheme can be defined to either match exactly the
* need or double it's allocated size each time it is found too small.
*/
typedef enum {
XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */
XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
} xmlBufferAllocationScheme;
/**
* xmlBuffer:
*
* A buffer structure, this old construct is limited to 2GB and
* is being deprecated, use API with xmlBuf instead
*/
typedef struct _xmlBuffer xmlBuffer;
typedef xmlBuffer *xmlBufferPtr;
struct _xmlBuffer {
xmlChar *content; /* The buffer content UTF8 */
unsigned int use; /* The buffer size used */
unsigned int size; /* The buffer size */
xmlBufferAllocationScheme alloc; /* The realloc method */
xmlChar *contentIO; /* in IO mode we may have a different base */
};
/**
* xmlBuf:
*
* A buffer structure, new one, the actual structure internals are not public
*/
typedef struct _xmlBuf xmlBuf;
/**
* xmlBufPtr:
*
* A pointer to a buffer structure, the actual structure internals are not
* public
*/
typedef xmlBuf *xmlBufPtr;
/*
* A few public routines for xmlBuf. As those are expected to be used
* mostly internally the bulk of the routines are internal in buf.h
*/
XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf);
XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len);
/*
* LIBXML2_NEW_BUFFER:
*
* Macro used to express that the API use the new buffers for
* xmlParserInputBuffer and xmlOutputBuffer. The change was
* introduced in 2.9.0.
*/
#define LIBXML2_NEW_BUFFER
/**
* XML_XML_NAMESPACE:
*
* This is the namespace for the special xml: prefix predefined in the
* XML Namespace specification.
*/
#define XML_XML_NAMESPACE \
(const xmlChar *) "http://www.w3.org/XML/1998/namespace"
/**
* XML_XML_ID:
*
* This is the name for the special xml:id attribute
*/
#define XML_XML_ID (const xmlChar *) "xml:id"
/*
* The different element types carried by an XML tree.
*
* NOTE: This is synchronized with DOM Level1 values
* See http://www.w3.org/TR/REC-DOM-Level-1/
*
* Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
* be deprecated to use an XML_DTD_NODE.
*/
typedef enum {
XML_ELEMENT_NODE= 1,
XML_ATTRIBUTE_NODE= 2,
XML_TEXT_NODE= 3,
XML_CDATA_SECTION_NODE= 4,
XML_ENTITY_REF_NODE= 5,
XML_ENTITY_NODE= 6,
XML_PI_NODE= 7,
XML_COMMENT_NODE= 8,
XML_DOCUMENT_NODE= 9,
XML_DOCUMENT_TYPE_NODE= 10,
XML_DOCUMENT_FRAG_NODE= 11,
XML_NOTATION_NODE= 12,
XML_HTML_DOCUMENT_NODE= 13,
XML_DTD_NODE= 14,
XML_ELEMENT_DECL= 15,
XML_ATTRIBUTE_DECL= 16,
XML_ENTITY_DECL= 17,
XML_NAMESPACE_DECL= 18,
XML_XINCLUDE_START= 19,
XML_XINCLUDE_END= 20
#ifdef LIBXML_DOCB_ENABLED
,XML_DOCB_DOCUMENT_NODE= 21
#endif
} xmlElementType;
/**
* xmlNotation:
*
* A DTD Notation definition.
*/
typedef struct _xmlNotation xmlNotation;
typedef xmlNotation *xmlNotationPtr;
struct _xmlNotation {
const xmlChar *name; /* Notation name */
const xmlChar *PublicID; /* Public identifier, if any */
const xmlChar *SystemID; /* System identifier, if any */
};
/**
* xmlAttributeType:
*
* A DTD Attribute type definition.
*/
typedef enum {
XML_ATTRIBUTE_CDATA = 1,
XML_ATTRIBUTE_ID,
XML_ATTRIBUTE_IDREF ,
XML_ATTRIBUTE_IDREFS,
XML_ATTRIBUTE_ENTITY,
XML_ATTRIBUTE_ENTITIES,
XML_ATTRIBUTE_NMTOKEN,
XML_ATTRIBUTE_NMTOKENS,
XML_ATTRIBUTE_ENUMERATION,
XML_ATTRIBUTE_NOTATION
} xmlAttributeType;
/**
* xmlAttributeDefault:
*
* A DTD Attribute default definition.
*/
typedef enum {
XML_ATTRIBUTE_NONE = 1,
XML_ATTRIBUTE_REQUIRED,
XML_ATTRIBUTE_IMPLIED,
XML_ATTRIBUTE_FIXED
} xmlAttributeDefault;
/**
* xmlEnumeration:
*
* List structure used when there is an enumeration in DTDs.
*/
typedef struct _xmlEnumeration xmlEnumeration;
typedef xmlEnumeration *xmlEnumerationPtr;
struct _xmlEnumeration {
struct _xmlEnumeration *next; /* next one */
const xmlChar *name; /* Enumeration name */
};
/**
* xmlAttribute:
*
* An Attribute declaration in a DTD.
*/
typedef struct _xmlAttribute xmlAttribute;
typedef xmlAttribute *xmlAttributePtr;
struct _xmlAttribute {
void *_private; /* application data */
xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
const xmlChar *name; /* Attribute name */
struct _xmlNode *children; /* NULL */
struct _xmlNode *last; /* NULL */
struct _xmlDtd *parent; /* -> DTD */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
struct _xmlAttribute *nexth; /* next in hash table */
xmlAttributeType atype; /* The attribute type */
xmlAttributeDefault def; /* the default */
const xmlChar *defaultValue; /* or the default value */
xmlEnumerationPtr tree; /* or the enumeration tree if any */
const xmlChar *prefix; /* the namespace prefix if any */
const xmlChar *elem; /* Element holding the attribute */
};
/**
* xmlElementContentType:
*
* Possible definitions of element content types.
*/
typedef enum {
XML_ELEMENT_CONTENT_PCDATA = 1,
XML_ELEMENT_CONTENT_ELEMENT,
XML_ELEMENT_CONTENT_SEQ,
XML_ELEMENT_CONTENT_OR
} xmlElementContentType;
/**
* xmlElementContentOccur:
*
* Possible definitions of element content occurrences.
*/
typedef enum {
XML_ELEMENT_CONTENT_ONCE = 1,
XML_ELEMENT_CONTENT_OPT,
XML_ELEMENT_CONTENT_MULT,
XML_ELEMENT_CONTENT_PLUS
} xmlElementContentOccur;
/**
* xmlElementContent:
*
* An XML Element content as stored after parsing an element definition
* in a DTD.
*/
typedef struct _xmlElementContent xmlElementContent;
typedef xmlElementContent *xmlElementContentPtr;
struct _xmlElementContent {
xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
const xmlChar *name; /* Element name */
struct _xmlElementContent *c1; /* first child */
struct _xmlElementContent *c2; /* second child */
struct _xmlElementContent *parent; /* parent */
const xmlChar *prefix; /* Namespace prefix */
};
/**
* xmlElementTypeVal:
*
* The different possibilities for an element content type.
*/
typedef enum {
XML_ELEMENT_TYPE_UNDEFINED = 0,
XML_ELEMENT_TYPE_EMPTY = 1,
XML_ELEMENT_TYPE_ANY,
XML_ELEMENT_TYPE_MIXED,
XML_ELEMENT_TYPE_ELEMENT
} xmlElementTypeVal;
#ifdef __cplusplus
}
#endif
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlElement:
*
* An XML Element declaration from a DTD.
*/
typedef struct _xmlElement xmlElement;
typedef xmlElement *xmlElementPtr;
struct _xmlElement {
void *_private; /* application data */
xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
const xmlChar *name; /* Element name */
struct _xmlNode *children; /* NULL */
struct _xmlNode *last; /* NULL */
struct _xmlDtd *parent; /* -> DTD */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
xmlElementTypeVal etype; /* The type */
xmlElementContentPtr content; /* the allowed element content */
xmlAttributePtr attributes; /* List of the declared attributes */
const xmlChar *prefix; /* the namespace prefix if any */
#ifdef LIBXML_REGEXP_ENABLED
xmlRegexpPtr contModel; /* the validating regexp */
#else
void *contModel;
#endif
};
/**
* XML_LOCAL_NAMESPACE:
*
* A namespace declaration node.
*/
#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
typedef xmlElementType xmlNsType;
/**
* xmlNs:
*
* An XML namespace.
* Note that prefix == NULL is valid, it defines the default namespace
* within the subtree (until overridden).
*
* xmlNsType is unified with xmlElementType.
*/
typedef struct _xmlNs xmlNs;
typedef xmlNs *xmlNsPtr;
struct _xmlNs {
struct _xmlNs *next; /* next Ns link for this node */
xmlNsType type; /* global or local */
const xmlChar *href; /* URL for the namespace */
const xmlChar *prefix; /* prefix for the namespace */
void *_private; /* application data */
struct _xmlDoc *context; /* normally an xmlDoc */
};
/**
* xmlDtd:
*
* An XML DTD, as defined by <!DOCTYPE ... There is actually one for
* the internal subset and for the external subset.
*/
typedef struct _xmlDtd xmlDtd;
typedef xmlDtd *xmlDtdPtr;
struct _xmlDtd {
void *_private; /* application data */
xmlElementType type; /* XML_DTD_NODE, must be second ! */
const xmlChar *name; /* Name of the DTD */
struct _xmlNode *children; /* the value of the property link */
struct _xmlNode *last; /* last child link */
struct _xmlDoc *parent; /* child->parent link */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
/* End of common part */
void *notations; /* Hash table for notations if any */
void *elements; /* Hash table for elements if any */
void *attributes; /* Hash table for attributes if any */
void *entities; /* Hash table for entities if any */
const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
void *pentities; /* Hash table for param entities if any */
};
/**
* xmlAttr:
*
* An attribute on an XML node.
*/
typedef struct _xmlAttr xmlAttr;
typedef xmlAttr *xmlAttrPtr;
struct _xmlAttr {
void *_private; /* application data */
xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
const xmlChar *name; /* the name of the property */
struct _xmlNode *children; /* the value of the property */
struct _xmlNode *last; /* NULL */
struct _xmlNode *parent; /* child->parent link */
struct _xmlAttr *next; /* next sibling link */
struct _xmlAttr *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
xmlNs *ns; /* pointer to the associated namespace */
xmlAttributeType atype; /* the attribute type if validating */
void *psvi; /* for type/PSVI informations */
};
#define XML_ATTR_CLEAR_ATYPE(attr) (((attr)->atype) = 0)
#define XML_ATTR_GET_ATYPE(attr) (((attr)->atype) & ~(15U << 27))
#define XML_ATTR_SET_ATYPE(attr, type) ((attr)->atype = ((((attr)->atype) & (15U << 27)) | ((type) & ~(15U << 27))))
/**
* xmlID:
*
* An XML ID instance.
*/
typedef struct _xmlID xmlID;
typedef xmlID *xmlIDPtr;
struct _xmlID {
struct _xmlID *next; /* next ID */
const xmlChar *value; /* The ID name */
xmlAttrPtr attr; /* The attribute holding it */
const xmlChar *name; /* The attribute if attr is not available */
int lineno; /* The line number if attr is not available */
struct _xmlDoc *doc; /* The document holding the ID */
};
/**
* xmlRef:
*
* An XML IDREF instance.
*/
typedef struct _xmlRef xmlRef;
typedef xmlRef *xmlRefPtr;
struct _xmlRef {
struct _xmlRef *next; /* next Ref */
const xmlChar *value; /* The Ref name */
xmlAttrPtr attr; /* The attribute holding it */
const xmlChar *name; /* The attribute if attr is not available */
int lineno; /* The line number if attr is not available */
};
/**
* xmlNode:
*
* A node in an XML tree.
*/
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
struct _xmlNode {
void *_private; /* application data */
xmlElementType type; /* type number, must be second ! */
const xmlChar *name; /* the name of the node, or the entity */
struct _xmlNode *children; /* parent->childs link */
struct _xmlNode *last; /* last child link */
struct _xmlNode *parent; /* child->parent link */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
/* End of common part */
xmlNs *ns; /* pointer to the associated namespace */
xmlChar *content; /* the content */
struct _xmlAttr *properties;/* properties list */
xmlNs *nsDef; /* namespace definitions on this node */
void *psvi; /* for type/PSVI informations */
unsigned short line; /* line number */
unsigned short extra; /* extra data for XPath/XSLT */
};
#define XML_NODE_ADD_EXTRA(node, type) ((node)->extra |= ((type) & ~(15U << 12)))
#define XML_NODE_CLEAR_EXTRA(node) (((node)->extra) = 0)
#define XML_NODE_GET_EXTRA(node) (((node)->extra) & ~(15U << 12))
#define XML_NODE_SET_EXTRA(node, type) ((node)->extra = ((((node)->extra) & (15U << 12)) | ((type) & ~(15U << 12))))
/**
* XML_GET_CONTENT:
*
* Macro to extract the content pointer of a node.
*/
#define XML_GET_CONTENT(n) \
((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
/**
* XML_GET_LINE:
*
* Macro to extract the line number of an element node.
*/
#define XML_GET_LINE(n) \
(xmlGetLineNo(n))
/**
* xmlDocProperty
*
* Set of properties of the document as found by the parser
* Some of them are linked to similary named xmlParserOption
*/
typedef enum {
XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */
XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */
XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */
XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */
XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */
XML_DOC_USERBUILT = 1<<5, /* Document was built using the API
and not by parsing an instance */
XML_DOC_INTERNAL = 1<<6, /* built for internal processing */
XML_DOC_HTML = 1<<7 /* parsed or built HTML document */
} xmlDocProperties;
/**
* xmlDoc:
*
* An XML document.
*/
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
struct _xmlDoc {
void *_private; /* application data */
xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
char *name; /* name/filename/URI of the document */
struct _xmlNode *children; /* the document tree */
struct _xmlNode *last; /* last child link */
struct _xmlNode *parent; /* child->parent link */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* autoreference to itself */
/* End of common part */
int compression;/* level of zlib compression */
int standalone; /* standalone document (no external refs)
1 if standalone="yes"
0 if standalone="no"
-1 if there is no XML declaration
-2 if there is an XML declaration, but no
standalone attribute was specified */
struct _xmlDtd *intSubset; /* the document internal subset */
struct _xmlDtd *extSubset; /* the document external subset */
struct _xmlNs *oldNs; /* Global namespace, the old way */
const xmlChar *version; /* the XML version string */
const xmlChar *encoding; /* external initial encoding, if any */
void *ids; /* Hash table for ID attributes if any */
void *refs; /* Hash table for IDREFs attributes if any */
const xmlChar *URL; /* The URI for that document */
int charset; /* encoding of the in-memory content
actually an xmlCharEncoding */
struct _xmlDict *dict; /* dict used to allocate names or NULL */
void *psvi; /* for type/PSVI informations */
int parseFlags; /* set of xmlParserOption used to parse the
document */
int properties; /* set of xmlDocProperties for this document
set at the end of parsing */
};
#define XML_DOC_ADD_PROPERTIES(doc, type) ((doc)->properties |= ((type) & ~(15U << 27)))
#define XML_DOC_CLEAR_PROPERTIES(doc) (((doc)->properties) = 0)
#define XML_DOC_GET_PROPERTIES(doc) (((doc)->properties) & ~(15U << 27))
#define XML_DOC_SET_PROPERTIES(doc, type) ((doc)->properties = ((((doc)->properties) & (15U << 27)) | ((type) & ~(15U << 27))))
typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
/**
* xmlDOMWrapAcquireNsFunction:
* @ctxt: a DOM wrapper context
* @node: the context node (element or attribute)
* @nsName: the requested namespace name
* @nsPrefix: the requested namespace prefix
*
* A function called to acquire namespaces (xmlNs) from the wrapper.
*
* Returns an xmlNsPtr or NULL in case of an error.
*/
typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr node,
const xmlChar *nsName,
const xmlChar *nsPrefix);
/**
* xmlDOMWrapCtxt:
*
* Context for DOM wrapper-operations.
*/
struct _xmlDOMWrapCtxt {
void * _private;
/*
* The type of this context, just in case we need specialized
* contexts in the future.
*/
int type;
/*
* Internal namespace map used for various operations.
*/
void * namespaceMap;
/*
* Use this one to acquire an xmlNsPtr intended for node->ns.
* (Note that this is not intended for elem->nsDef).
*/
xmlDOMWrapAcquireNsFunction getNsForNodeFunc;
};
/**
* xmlChildrenNode:
*
* Macro for compatibility naming layer with libxml1. Maps
* to "children."
*/
#ifndef xmlChildrenNode
#define xmlChildrenNode children
#endif
/**
* xmlRootNode:
*
* Macro for compatibility naming layer with libxml1. Maps
* to "children".
*/
#ifndef xmlRootNode
#define xmlRootNode children
#endif
/*
* Variables.
*/
/*
* Some helper functions
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \
defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \
defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \
defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateNCName (const xmlChar *value,
int space);
#endif
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateQName (const xmlChar *value,
int space);
XMLPUBFUN int XMLCALL
xmlValidateName (const xmlChar *value,
int space);
XMLPUBFUN int XMLCALL
xmlValidateNMToken (const xmlChar *value,
int space);
#endif
XMLPUBFUN xmlChar * XMLCALL
xmlBuildQName (const xmlChar *ncname,
const xmlChar *prefix,
xmlChar *memory,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlSplitQName2 (const xmlChar *name,
xmlChar **prefix);
XMLPUBFUN const xmlChar * XMLCALL
xmlSplitQName3 (const xmlChar *name,
int *len);
/*
* Handling Buffers, the old ones see @xmlBuf for the new ones.
*/
XMLPUBFUN void XMLCALL
xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
XMLPUBFUN xmlBufferAllocationScheme XMLCALL
xmlGetBufferAllocationScheme(void);
XMLPUBFUN xmlBufferPtr XMLCALL
xmlBufferCreate (void);
XMLPUBFUN xmlBufferPtr XMLCALL
xmlBufferCreateSize (size_t size);
XMLPUBFUN xmlBufferPtr XMLCALL
xmlBufferCreateStatic (void *mem,
size_t size);
XMLPUBFUN int XMLCALL
xmlBufferResize (xmlBufferPtr buf,
unsigned int size);
XMLPUBFUN void XMLCALL
xmlBufferFree (xmlBufferPtr buf);
XMLPUBFUN int XMLCALL
xmlBufferDump (FILE *file,
xmlBufferPtr buf);
XMLPUBFUN int XMLCALL
xmlBufferAdd (xmlBufferPtr buf,
const xmlChar *str,
int len);
XMLPUBFUN int XMLCALL
xmlBufferAddHead (xmlBufferPtr buf,
const xmlChar *str,
int len);
XMLPUBFUN int XMLCALL
xmlBufferCat (xmlBufferPtr buf,
const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlBufferCCat (xmlBufferPtr buf,
const char *str);
XMLPUBFUN int XMLCALL
xmlBufferShrink (xmlBufferPtr buf,
unsigned int len);
XMLPUBFUN int XMLCALL
xmlBufferGrow (xmlBufferPtr buf,
unsigned int len);
XMLPUBFUN void XMLCALL
xmlBufferEmpty (xmlBufferPtr buf);
XMLPUBFUN const xmlChar* XMLCALL
xmlBufferContent (const xmlBuffer *buf);
XMLPUBFUN xmlChar* XMLCALL
xmlBufferDetach (xmlBufferPtr buf);
XMLPUBFUN void XMLCALL
xmlBufferSetAllocationScheme(xmlBufferPtr buf,
xmlBufferAllocationScheme scheme);
XMLPUBFUN int XMLCALL
xmlBufferLength (const xmlBuffer *buf);
/*
* Creating/freeing new structures.
*/
XMLPUBFUN xmlDtdPtr XMLCALL
xmlCreateIntSubset (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
xmlNewDtd (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
xmlGetIntSubset (const xmlDoc *doc);
XMLPUBFUN void XMLCALL
xmlFreeDtd (xmlDtdPtr cur);
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN xmlNsPtr XMLCALL
xmlNewGlobalNs (xmlDocPtr doc,
const xmlChar *href,
const xmlChar *prefix);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlNsPtr XMLCALL
xmlNewNs (xmlNodePtr node,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
xmlFreeNs (xmlNsPtr cur);
XMLPUBFUN void XMLCALL
xmlFreeNsList (xmlNsPtr cur);
XMLPUBFUN xmlDocPtr XMLCALL
xmlNewDoc (const xmlChar *version);
XMLPUBFUN void XMLCALL
xmlFreeDoc (xmlDocPtr cur);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlNewDocProp (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *value);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlAttrPtr XMLCALL
xmlNewProp (xmlNodePtr node,
const xmlChar *name,
const xmlChar *value);
#endif
XMLPUBFUN xmlAttrPtr XMLCALL
xmlNewNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlNewNsPropEatName (xmlNodePtr node,
xmlNsPtr ns,
xmlChar *name,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlFreePropList (xmlAttrPtr cur);
XMLPUBFUN void XMLCALL
xmlFreeProp (xmlAttrPtr cur);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlCopyProp (xmlNodePtr target,
xmlAttrPtr cur);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlCopyPropList (xmlNodePtr target,
xmlAttrPtr cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlDtdPtr XMLCALL
xmlCopyDtd (xmlDtdPtr dtd);
#endif /* LIBXML_TREE_ENABLED */
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlDocPtr XMLCALL
xmlCopyDoc (xmlDocPtr doc,
int recursive);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
/*
* Creating new nodes.
*/
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocNodeEatName (xmlDocPtr doc,
xmlNsPtr ns,
xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewNode (xmlNsPtr ns,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewNodeEatName (xmlNsPtr ns,
xmlChar *name);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
#endif
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocText (const xmlDoc *doc,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewText (const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocPI (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewPI (const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocTextLen (xmlDocPtr doc,
const xmlChar *content,
int len);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewTextLen (const xmlChar *content,
int len);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocComment (xmlDocPtr doc,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewComment (const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewCDataBlock (xmlDocPtr doc,
const xmlChar *content,
int len);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewCharRef (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewReference (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
xmlCopyNode (xmlNodePtr node,
int recursive);
XMLPUBFUN xmlNodePtr XMLCALL
xmlDocCopyNode (xmlNodePtr node,
xmlDocPtr doc,
int recursive);
XMLPUBFUN xmlNodePtr XMLCALL
xmlDocCopyNodeList (xmlDocPtr doc,
xmlNodePtr node);
XMLPUBFUN xmlNodePtr XMLCALL
xmlCopyNodeList (xmlNodePtr node);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewTextChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocRawNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewDocFragment (xmlDocPtr doc);
#endif /* LIBXML_TREE_ENABLED */
/*
* Navigating.
*/
XMLPUBFUN long XMLCALL
xmlGetLineNo (const xmlNode *node);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
XMLPUBFUN xmlChar * XMLCALL
xmlGetNodePath (const xmlNode *node);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
XMLPUBFUN xmlNodePtr XMLCALL
xmlDocGetRootElement (const xmlDoc *doc);
XMLPUBFUN xmlNodePtr XMLCALL
xmlGetLastChild (const xmlNode *parent);
XMLPUBFUN int XMLCALL
xmlNodeIsText (const xmlNode *node);
XMLPUBFUN int XMLCALL
xmlIsBlankNode (const xmlNode *node);
/*
* Changing the structure.
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlDocSetRootElement (xmlDocPtr doc,
xmlNodePtr root);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
xmlNodeSetName (xmlNodePtr cur,
const xmlChar *name);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddChild (xmlNodePtr parent,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddChildList (xmlNodePtr parent,
xmlNodePtr cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlReplaceNode (xmlNodePtr old,
xmlNodePtr cur);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddPrevSibling (xmlNodePtr cur,
xmlNodePtr elem);
#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddSibling (xmlNodePtr cur,
xmlNodePtr elem);
XMLPUBFUN xmlNodePtr XMLCALL
xmlAddNextSibling (xmlNodePtr cur,
xmlNodePtr elem);
XMLPUBFUN void XMLCALL
xmlUnlinkNode (xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextMerge (xmlNodePtr first,
xmlNodePtr second);
XMLPUBFUN int XMLCALL
xmlTextConcat (xmlNodePtr node,
const xmlChar *content,
int len);
XMLPUBFUN void XMLCALL
xmlFreeNodeList (xmlNodePtr cur);
XMLPUBFUN void XMLCALL
xmlFreeNode (xmlNodePtr cur);
XMLPUBFUN void XMLCALL
xmlSetTreeDoc (xmlNodePtr tree,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSetListDoc (xmlNodePtr list,
xmlDocPtr doc);
/*
* Namespaces.
*/
XMLPUBFUN xmlNsPtr XMLCALL
xmlSearchNs (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar *nameSpace);
XMLPUBFUN xmlNsPtr XMLCALL
xmlSearchNsByHref (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar *href);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlNsPtr * XMLCALL
xmlGetNsList (const xmlDoc *doc,
const xmlNode *node);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
XMLPUBFUN void XMLCALL
xmlSetNs (xmlNodePtr node,
xmlNsPtr ns);
XMLPUBFUN xmlNsPtr XMLCALL
xmlCopyNamespace (xmlNsPtr cur);
XMLPUBFUN xmlNsPtr XMLCALL
xmlCopyNamespaceList (xmlNsPtr cur);
/*
* Changing the content.
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
XMLPUBFUN xmlAttrPtr XMLCALL
xmlSetProp (xmlNodePtr node,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlSetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *value);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
XMLPUBFUN xmlChar * XMLCALL
xmlGetNoNsProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
xmlGetProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlHasProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlHasNsProp (const xmlNode *node,
const xmlChar *name,
const xmlChar *nameSpace);
XMLPUBFUN xmlChar * XMLCALL
xmlGetNsProp (const xmlNode *node,
const xmlChar *name,
const xmlChar *nameSpace);
XMLPUBFUN xmlNodePtr XMLCALL
xmlStringGetNodeList (const xmlDoc *doc,
const xmlChar *value);
XMLPUBFUN xmlNodePtr XMLCALL
xmlStringLenGetNodeList (const xmlDoc *doc,
const xmlChar *value,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlNodeListGetString (xmlDocPtr doc,
const xmlNode *list,
int inLine);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlChar * XMLCALL
xmlNodeListGetRawString (const xmlDoc *doc,
const xmlNode *list,
int inLine);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlNodeSetContent (xmlNodePtr cur,
const xmlChar *content);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
xmlNodeSetContentLen (xmlNodePtr cur,
const xmlChar *content,
int len);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlNodeAddContent (xmlNodePtr cur,
const xmlChar *content);
XMLPUBFUN void XMLCALL
xmlNodeAddContentLen (xmlNodePtr cur,
const xmlChar *content,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlNodeGetContent (const xmlNode *cur);
XMLPUBFUN int XMLCALL
xmlNodeBufGetContent (xmlBufferPtr buffer,
const xmlNode *cur);
XMLPUBFUN int XMLCALL
xmlBufGetNodeContent (xmlBufPtr buf,
const xmlNode *cur);
XMLPUBFUN xmlChar * XMLCALL
xmlNodeGetLang (const xmlNode *cur);
XMLPUBFUN int XMLCALL
xmlNodeGetSpacePreserve (const xmlNode *cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
xmlNodeSetLang (xmlNodePtr cur,
const xmlChar *lang);
XMLPUBFUN void XMLCALL
xmlNodeSetSpacePreserve (xmlNodePtr cur,
int val);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlNodeGetBase (const xmlDoc *doc,
const xmlNode *cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
XMLPUBFUN void XMLCALL
xmlNodeSetBase (xmlNodePtr cur,
const xmlChar *uri);
#endif
/*
* Removing content.
*/
XMLPUBFUN int XMLCALL
xmlRemoveProp (xmlAttrPtr cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
xmlUnsetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlUnsetProp (xmlNodePtr node,
const xmlChar *name);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
/*
* Internal, don't use.
*/
XMLPUBFUN void XMLCALL
xmlBufferWriteCHAR (xmlBufferPtr buf,
const xmlChar *string);
XMLPUBFUN void XMLCALL
xmlBufferWriteChar (xmlBufferPtr buf,
const char *string);
XMLPUBFUN void XMLCALL
xmlBufferWriteQuotedString(xmlBufferPtr buf,
const xmlChar *string);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
xmlDocPtr doc,
xmlAttrPtr attr,
const xmlChar *string);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_TREE_ENABLED
/*
* Namespace handling.
*/
XMLPUBFUN int XMLCALL
xmlReconciliateNs (xmlDocPtr doc,
xmlNodePtr tree);
#endif
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Saving.
*/
XMLPUBFUN void XMLCALL
xmlDocDumpFormatMemory (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN void XMLCALL
xmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
xmlChar **doc_txt_ptr,
int * doc_txt_len,
const char *txt_encoding);
XMLPUBFUN void XMLCALL
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
xmlChar **doc_txt_ptr,
int * doc_txt_len,
const char *txt_encoding,
int format);
XMLPUBFUN int XMLCALL
xmlDocFormatDump (FILE *f,
xmlDocPtr cur,
int format);
XMLPUBFUN int XMLCALL
xmlDocDump (FILE *f,
xmlDocPtr cur);
XMLPUBFUN void XMLCALL
xmlElemDump (FILE *f,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN int XMLCALL
xmlSaveFile (const char *filename,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
xmlSaveFormatFile (const char *filename,
xmlDocPtr cur,
int format);
XMLPUBFUN size_t XMLCALL
xmlBufNodeDump (xmlBufPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format);
XMLPUBFUN int XMLCALL
xmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format);
XMLPUBFUN int XMLCALL
xmlSaveFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN int XMLCALL
xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
xmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format,
const char *encoding);
XMLPUBFUN int XMLCALL
xmlSaveFormatFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN int XMLCALL
xmlSaveFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* XHTML
*/
XMLPUBFUN int XMLCALL
xmlIsXHTML (const xmlChar *systemID,
const xmlChar *publicID);
/*
* Compression.
*/
XMLPUBFUN int XMLCALL
xmlGetDocCompressMode (const xmlDoc *doc);
XMLPUBFUN void XMLCALL
xmlSetDocCompressMode (xmlDocPtr doc,
int mode);
XMLPUBFUN int XMLCALL
xmlGetCompressMode (void);
XMLPUBFUN void XMLCALL
xmlSetCompressMode (int mode);
/*
* DOM-wrapper helper functions.
*/
XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
xmlDOMWrapNewCtxt (void);
XMLPUBFUN void XMLCALL
xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr elem,
int options);
XMLPUBFUN int XMLCALL
xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int options);
XMLPUBFUN int XMLCALL
xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr node,
int options);
XMLPUBFUN int XMLCALL
xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlNodePtr *clonedNode,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int deep,
int options);
#ifdef LIBXML_TREE_ENABLED
/*
* 5 interfaces from DOM ElementTraversal, but different in entities
* traversal.
*/
XMLPUBFUN unsigned long XMLCALL
xmlChildElementCount (xmlNodePtr parent);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNextElementSibling (xmlNodePtr node);
XMLPUBFUN xmlNodePtr XMLCALL
xmlFirstElementChild (xmlNodePtr parent);
XMLPUBFUN xmlNodePtr XMLCALL
xmlLastElementChild (xmlNodePtr parent);
XMLPUBFUN xmlNodePtr XMLCALL
xmlPreviousElementSibling (xmlNodePtr node);
#endif
#ifdef __cplusplus
}
#endif
#ifndef __XML_PARSER_H__
#include <libxml/xmlmemory.h>
#endif
#endif /* __XML_TREE_H__ */
/*
* Summary: interface for the memory allocator
* Description: provides interfaces for the memory allocator,
* including debugging capabilities.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DEBUG_MEMORY_ALLOC__
#define __DEBUG_MEMORY_ALLOC__
#include <stdio.h>
#include <libxml/xmlversion.h>
/**
* DEBUG_MEMORY:
*
* DEBUG_MEMORY replaces the allocator with a collect and debug
* shell to the libc allocator.
* DEBUG_MEMORY should only be activated when debugging
* libxml i.e. if libxml has been configured with --with-debug-mem too.
*/
/* #define DEBUG_MEMORY_FREED */
/* #define DEBUG_MEMORY_LOCATION */
#ifdef DEBUG
#ifndef DEBUG_MEMORY
#define DEBUG_MEMORY
#endif
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* DEBUG_MEMORY_LOCATION should be activated only when debugging
* libxml i.e. if libxml has been configured with --with-debug-mem too.
*/
#ifdef DEBUG_MEMORY_LOCATION
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* The XML memory wrapper support 4 basic overloadable functions.
*/
/**
* xmlFreeFunc:
* @mem: an already allocated block of memory
*
* Signature for a free() implementation.
*/
typedef void (XMLCALL *xmlFreeFunc)(void *mem);
/**
* xmlMallocFunc:
* @size: the size requested in bytes
*
* Signature for a malloc() implementation.
*
* Returns a pointer to the newly allocated block or NULL in case of error.
*/
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
/**
* xmlReallocFunc:
* @mem: an already allocated block of memory
* @size: the new size requested in bytes
*
* Signature for a realloc() implementation.
*
* Returns a pointer to the newly reallocated block or NULL in case of error.
*/
typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
/**
* xmlStrdupFunc:
* @str: a zero terminated string
*
* Signature for an strdup() implementation.
*
* Returns the copy of the string or NULL in case of error.
*/
typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
/*
* The 4 interfaces used for all memory handling within libxml.
LIBXML_DLL_IMPORT xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic;
LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
*/
/*
* The way to overload the existing functions.
* The xmlGc function have an extra entry for atomic block
* allocations useful for garbage collected memory allocators
*/
XMLPUBFUN int XMLCALL
xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
xmlMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
XMLPUBFUN int XMLCALL
xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
xmlGcMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlMallocFunc *mallocAtomicFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
/*
* Initialization of the memory layer.
*/
XMLPUBFUN int XMLCALL
xmlInitMemory (void);
/*
* Cleanup of the memory layer.
*/
XMLPUBFUN void XMLCALL
xmlCleanupMemory (void);
/*
* These are specific to the XML debug memory wrapper.
*/
XMLPUBFUN int XMLCALL
xmlMemUsed (void);
XMLPUBFUN int XMLCALL
xmlMemBlocks (void);
XMLPUBFUN void XMLCALL
xmlMemDisplay (FILE *fp);
XMLPUBFUN void XMLCALL
xmlMemDisplayLast(FILE *fp, long nbBytes);
XMLPUBFUN void XMLCALL
xmlMemShow (FILE *fp, int nr);
XMLPUBFUN void XMLCALL
xmlMemoryDump (void);
XMLPUBFUN void * XMLCALL
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlMemRealloc (void *ptr,size_t size);
XMLPUBFUN void XMLCALL
xmlMemFree (void *ptr);
XMLPUBFUN char * XMLCALL
xmlMemoryStrdup (const char *str);
XMLPUBFUN void * XMLCALL
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
XMLPUBFUN void * XMLCALL
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN char * XMLCALL
xmlMemStrdupLoc (const char *str, const char *file, int line);
#ifdef DEBUG_MEMORY_LOCATION
/**
* xmlMalloc:
* @size: number of bytes to allocate
*
* Wrapper for the malloc() function used in the XML library.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
/**
* xmlMallocAtomic:
* @size: number of bytes to allocate
*
* Wrapper for the malloc() function used in the XML library for allocation
* of block not containing pointers to other areas.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__)
/**
* xmlRealloc:
* @ptr: pointer to the existing allocated area
* @size: number of bytes to allocate
*
* Wrapper for the realloc() function used in the XML library.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
/**
* xmlMemStrdup:
* @str: pointer to the existing string
*
* Wrapper for the strdup() function, xmlStrdup() is usually preferred.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
#endif /* DEBUG_MEMORY_LOCATION */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#ifndef __XML_GLOBALS_H
#ifndef __XML_THREADS_H__
#include <libxml/threads.h>
#include <libxml/globals.h>
#endif
#endif
#endif /* __DEBUG_MEMORY_ALLOC__ */
/*
* Summary: string dictionary
* Description: dictionary of reusable strings, just used to avoid allocation
* and freeing operations.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_DICT_H__
#define __XML_DICT_H__
#ifdef __cplusplus
#define __XML_EXTERNC extern "C"
#else
#define __XML_EXTERNC
#endif
/*
* The dictionary.
*/
__XML_EXTERNC typedef struct _xmlDict xmlDict;
__XML_EXTERNC typedef xmlDict *xmlDictPtr;
#include <limits.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Initializer
*/
XMLPUBFUN int XMLCALL xmlInitializeDict(void);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlDictPtr XMLCALL
xmlDictCreate (void);
XMLPUBFUN size_t XMLCALL
xmlDictSetLimit (xmlDictPtr dict,
size_t limit);
XMLPUBFUN size_t XMLCALL
xmlDictGetUsage (xmlDictPtr dict);
XMLPUBFUN xmlDictPtr XMLCALL
xmlDictCreateSub(xmlDictPtr sub);
XMLPUBFUN int XMLCALL
xmlDictReference(xmlDictPtr dict);
XMLPUBFUN void XMLCALL
xmlDictFree (xmlDictPtr dict);
/*
* Lookup of entry in the dictionary.
*/
XMLPUBFUN const xmlChar * XMLCALL
xmlDictLookup (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlDictExists (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlDictQLookup (xmlDictPtr dict,
const xmlChar *prefix,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlDictOwns (xmlDictPtr dict,
const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlDictSize (xmlDictPtr dict);
/*
* Cleanup function
*/
XMLPUBFUN void XMLCALL
xmlDictCleanup (void);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_DICT_H__ */
/*
* Summary: internal interfaces for XML Schemas
* Description: internal interfaces for the XML Schemas handling
* and schema validity checking
* The Schemas development is a Work In Progress.
* Some of those interfaces are not guaranteed to be API or ABI stable !
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_INTERNALS_H__
#define __XML_SCHEMA_INTERNALS_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/xmlregexp.h>
#include <libxml/hash.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMAS_UNKNOWN = 0,
XML_SCHEMAS_STRING = 1,
XML_SCHEMAS_NORMSTRING = 2,
XML_SCHEMAS_DECIMAL = 3,
XML_SCHEMAS_TIME = 4,
XML_SCHEMAS_GDAY = 5,
XML_SCHEMAS_GMONTH = 6,
XML_SCHEMAS_GMONTHDAY = 7,
XML_SCHEMAS_GYEAR = 8,
XML_SCHEMAS_GYEARMONTH = 9,
XML_SCHEMAS_DATE = 10,
XML_SCHEMAS_DATETIME = 11,
XML_SCHEMAS_DURATION = 12,
XML_SCHEMAS_FLOAT = 13,
XML_SCHEMAS_DOUBLE = 14,
XML_SCHEMAS_BOOLEAN = 15,
XML_SCHEMAS_TOKEN = 16,
XML_SCHEMAS_LANGUAGE = 17,
XML_SCHEMAS_NMTOKEN = 18,
XML_SCHEMAS_NMTOKENS = 19,
XML_SCHEMAS_NAME = 20,
XML_SCHEMAS_QNAME = 21,
XML_SCHEMAS_NCNAME = 22,
XML_SCHEMAS_ID = 23,
XML_SCHEMAS_IDREF = 24,
XML_SCHEMAS_IDREFS = 25,
XML_SCHEMAS_ENTITY = 26,
XML_SCHEMAS_ENTITIES = 27,
XML_SCHEMAS_NOTATION = 28,
XML_SCHEMAS_ANYURI = 29,
XML_SCHEMAS_INTEGER = 30,
XML_SCHEMAS_NPINTEGER = 31,
XML_SCHEMAS_NINTEGER = 32,
XML_SCHEMAS_NNINTEGER = 33,
XML_SCHEMAS_PINTEGER = 34,
XML_SCHEMAS_INT = 35,
XML_SCHEMAS_UINT = 36,
XML_SCHEMAS_LONG = 37,
XML_SCHEMAS_ULONG = 38,
XML_SCHEMAS_SHORT = 39,
XML_SCHEMAS_USHORT = 40,
XML_SCHEMAS_BYTE = 41,
XML_SCHEMAS_UBYTE = 42,
XML_SCHEMAS_HEXBINARY = 43,
XML_SCHEMAS_BASE64BINARY = 44,
XML_SCHEMAS_ANYTYPE = 45,
XML_SCHEMAS_ANYSIMPLETYPE = 46
} xmlSchemaValType;
/*
* XML Schemas defines multiple type of types.
*/
typedef enum {
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
XML_SCHEMA_TYPE_ANY,
XML_SCHEMA_TYPE_FACET,
XML_SCHEMA_TYPE_SIMPLE,
XML_SCHEMA_TYPE_COMPLEX,
XML_SCHEMA_TYPE_SEQUENCE = 6,
XML_SCHEMA_TYPE_CHOICE,
XML_SCHEMA_TYPE_ALL,
XML_SCHEMA_TYPE_SIMPLE_CONTENT,
XML_SCHEMA_TYPE_COMPLEX_CONTENT,
XML_SCHEMA_TYPE_UR,
XML_SCHEMA_TYPE_RESTRICTION,
XML_SCHEMA_TYPE_EXTENSION,
XML_SCHEMA_TYPE_ELEMENT,
XML_SCHEMA_TYPE_ATTRIBUTE,
XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
XML_SCHEMA_TYPE_GROUP,
XML_SCHEMA_TYPE_NOTATION,
XML_SCHEMA_TYPE_LIST,
XML_SCHEMA_TYPE_UNION,
XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
XML_SCHEMA_TYPE_IDC_UNIQUE,
XML_SCHEMA_TYPE_IDC_KEY,
XML_SCHEMA_TYPE_IDC_KEYREF,
XML_SCHEMA_TYPE_PARTICLE = 25,
XML_SCHEMA_TYPE_ATTRIBUTE_USE,
XML_SCHEMA_FACET_MININCLUSIVE = 1000,
XML_SCHEMA_FACET_MINEXCLUSIVE,
XML_SCHEMA_FACET_MAXINCLUSIVE,
XML_SCHEMA_FACET_MAXEXCLUSIVE,
XML_SCHEMA_FACET_TOTALDIGITS,
XML_SCHEMA_FACET_FRACTIONDIGITS,
XML_SCHEMA_FACET_PATTERN,
XML_SCHEMA_FACET_ENUMERATION,
XML_SCHEMA_FACET_WHITESPACE,
XML_SCHEMA_FACET_LENGTH,
XML_SCHEMA_FACET_MAXLENGTH,
XML_SCHEMA_FACET_MINLENGTH,
XML_SCHEMA_EXTRA_QNAMEREF = 2000,
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
} xmlSchemaTypeType;
typedef enum {
XML_SCHEMA_CONTENT_UNKNOWN = 0,
XML_SCHEMA_CONTENT_EMPTY = 1,
XML_SCHEMA_CONTENT_ELEMENTS,
XML_SCHEMA_CONTENT_MIXED,
XML_SCHEMA_CONTENT_SIMPLE,
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
XML_SCHEMA_CONTENT_BASIC,
XML_SCHEMA_CONTENT_ANY
} xmlSchemaContentType;
typedef struct _xmlSchemaVal xmlSchemaVal;
typedef xmlSchemaVal *xmlSchemaValPtr;
typedef struct _xmlSchemaType xmlSchemaType;
typedef xmlSchemaType *xmlSchemaTypePtr;
typedef struct _xmlSchemaFacet xmlSchemaFacet;
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
/**
* Annotation
*/
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
struct _xmlSchemaAnnot {
struct _xmlSchemaAnnot *next;
xmlNodePtr content; /* the annotation */
};
/**
* XML_SCHEMAS_ANYATTR_SKIP:
*
* Skip unknown attribute from validation
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_SKIP 1
/**
* XML_SCHEMAS_ANYATTR_LAX:
*
* Ignore validation non definition on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_LAX 2
/**
* XML_SCHEMAS_ANYATTR_STRICT:
*
* Apply strict validation rules on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_STRICT 3
/**
* XML_SCHEMAS_ANY_SKIP:
*
* Skip unknown attribute from validation
*/
#define XML_SCHEMAS_ANY_SKIP 1
/**
* XML_SCHEMAS_ANY_LAX:
*
* Used by wildcards.
* Validate if type found, don't worry if not found
*/
#define XML_SCHEMAS_ANY_LAX 2
/**
* XML_SCHEMAS_ANY_STRICT:
*
* Used by wildcards.
* Apply strict validation rules
*/
#define XML_SCHEMAS_ANY_STRICT 3
/**
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
*
* Used by wildcards.
* The attribute is prohibited.
*/
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
/**
* XML_SCHEMAS_ATTR_USE_REQUIRED:
*
* The attribute is required.
*/
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
/**
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
*
* The attribute is optional.
*/
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
/**
* XML_SCHEMAS_ATTR_GLOBAL:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
/**
* XML_SCHEMAS_ATTR_NSDEFAULT:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
/**
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
*
* this is set when the "type" and "ref" references
* have been resolved.
*/
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
/**
* XML_SCHEMAS_ATTR_FIXED:
*
* the attribute has a fixed value
*/
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
/**
* xmlSchemaAttribute:
* An attribute definition.
*/
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
struct _xmlSchemaAttribute {
xmlSchemaTypeType type;
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
const xmlChar *name; /* the name of the declaration */
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
const xmlChar *typeName; /* the local name of the type definition */
const xmlChar *typeNs; /* the ns URI of the type definition */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr base; /* Deprecated; not used */
int occurs; /* Deprecated; not used */
const xmlChar *defValue; /* The initial value of the value constraint */
xmlSchemaTypePtr subtypes; /* the type definition */
xmlNodePtr node;
const xmlChar *targetNamespace;
int flags;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value constraint */
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
};
/**
* xmlSchemaAttributeLink:
* Used to build a list of attribute uses on complexType definitions.
* WARNING: Deprecated; not used.
*/
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
struct _xmlSchemaAttributeLink {
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
struct _xmlSchemaAttribute *attr;/* the linked attribute */
};
/**
* XML_SCHEMAS_WILDCARD_COMPLETE:
*
* If the wildcard is complete.
*/
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
/**
* xmlSchemaCharValueLink:
* Used to build a list of namespaces on wildcards.
*/
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
struct _xmlSchemaWildcardNs {
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
const xmlChar *value;/* the value */
};
/**
* xmlSchemaWildcard.
* A wildcard.
*/
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
struct _xmlSchemaWildcard {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *id; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int processContents;
int any; /* Indicates if the ns constraint is of ##any */
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
int flags;
};
/**
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
/**
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
/**
* XML_SCHEMAS_ATTRGROUP_MARKED:
*
* Marks the attr group as marked; used for circular checks.
*/
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
/**
* XML_SCHEMAS_ATTRGROUP_REDEFINED:
*
* The attr group was redefined.
*/
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
/**
* XML_SCHEMAS_ATTRGROUP_HAS_REFS:
*
* Whether this attr. group contains attr. group references.
*/
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
/**
* An attribute group definition.
*
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
* must be kept similar
*/
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
struct _xmlSchemaAttributeGroup {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
const xmlChar *name;
const xmlChar *id;
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
xmlNodePtr node;
int flags;
xmlSchemaWildcardPtr attributeWildcard;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
const xmlChar *targetNamespace;
void *attrUses;
};
/**
* xmlSchemaTypeLink:
* Used to build a list of types (e.g. member types of
* simpleType with variety "union").
*/
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
struct _xmlSchemaTypeLink {
struct _xmlSchemaTypeLink *next;/* the next type link ... */
xmlSchemaTypePtr type;/* the linked type */
};
/**
* xmlSchemaFacetLink:
* Used to build a list of facets.
*/
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
struct _xmlSchemaFacetLink {
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
xmlSchemaFacetPtr facet;/* the linked facet */
};
/**
* XML_SCHEMAS_TYPE_MIXED:
*
* the element content type is mixed
*/
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
*
* the simple or complex type has a derivation method of "extension".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
*
* the simple or complex type has a derivation method of "restriction".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
/**
* XML_SCHEMAS_TYPE_GLOBAL:
*
* the type is global
*/
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
/**
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
*
* the complexType owns an attribute wildcard, i.e.
* it can be freed by the complexType
*/
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */
/**
* XML_SCHEMAS_TYPE_VARIETY_ABSENT:
*
* the simpleType has a variety of "absent".
* TODO: Actually not necessary :-/, since if
* none of the variety flags occur then it's
* automatically absent.
*/
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
/**
* XML_SCHEMAS_TYPE_VARIETY_LIST:
*
* the simpleType has a variety of "list".
*/
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
/**
* XML_SCHEMAS_TYPE_VARIETY_UNION:
*
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
/**
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
*
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
/**
* XML_SCHEMAS_TYPE_FINAL_EXTENSION:
*
* the complexType has a final of "extension".
*/
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
/**
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
*
* the simpleType/complexType has a final of "restriction".
*/
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
/**
* XML_SCHEMAS_TYPE_FINAL_LIST:
*
* the simpleType has a final of "list".
*/
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
/**
* XML_SCHEMAS_TYPE_FINAL_UNION:
*
* the simpleType has a final of "union".
*/
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
/**
* XML_SCHEMAS_TYPE_FINAL_DEFAULT:
*
* the simpleType has a final of "default".
*/
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
/**
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
*
* Marks the item as a builtin primitive.
*/
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
/**
* XML_SCHEMAS_TYPE_MARKED:
*
* Marks the item as marked; used for circular checks.
*/
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
/**
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
*
* the complexType did not specify 'block' so use the default of the
* <schema> item.
*/
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
/**
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
*
* the complexType has a 'block' of "extension".
*/
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
/**
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
*
* the complexType has a 'block' of "restriction".
*/
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
/**
* XML_SCHEMAS_TYPE_ABSTRACT:
*
* the simple/complexType is abstract.
*/
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
/**
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
*
* indicates if the facets need a computed value
*/
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
/**
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
*
* indicates that the type was typefixed
*/
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
/**
* XML_SCHEMAS_TYPE_INTERNAL_INVALID:
*
* indicates that the type is invalid
*/
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
/**
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
*
* a whitespace-facet value of "preserve"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
/**
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
*
* a whitespace-facet value of "replace"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
/**
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
*
* a whitespace-facet value of "collapse"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
/**
* XML_SCHEMAS_TYPE_HAS_FACETS:
*
* has facets
*/
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
/**
* XML_SCHEMAS_TYPE_NORMVALUENEEDED:
*
* indicates if the facets (pattern) need a normalized value
*/
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
/**
* XML_SCHEMAS_TYPE_FIXUP_1:
*
* First stage of fixup was done.
*/
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
/**
* XML_SCHEMAS_TYPE_REDEFINED:
*
* The type was redefined.
*/
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
/**
* XML_SCHEMAS_TYPE_REDEFINING:
*
* The type redefines an other type.
*/
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */
/**
* _xmlSchemaType:
*
* Schemas type definition.
*/
struct _xmlSchemaType {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* the next type if in a sequence ... */
const xmlChar *name;
const xmlChar *id ; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes;
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
xmlSchemaContentType contentType;
const xmlChar *base; /* Base type's local name */
const xmlChar *baseNs; /* Base type's target namespace */
xmlSchemaTypePtr baseType; /* The base type component */
xmlSchemaFacetPtr facets; /* Local facets */
struct _xmlSchemaType *redef; /* Deprecated; not used */
int recurse; /* Obsolete */
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
xmlSchemaWildcardPtr attributeWildcard;
int builtInType; /* Type of built-in types. */
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
Could we use @subtypes for this? */
xmlRegexpPtr contModel; /* Holds the automaton of the content model */
const xmlChar *targetNamespace;
void *attrUses;
};
/*
* xmlSchemaElement:
* An element definition.
*
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
* structures must be kept similar
*/
/**
* XML_SCHEMAS_ELEM_NILLABLE:
*
* the element is nillable
*/
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
/**
* XML_SCHEMAS_ELEM_GLOBAL:
*
* the element is global
*/
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
/**
* XML_SCHEMAS_ELEM_DEFAULT:
*
* the element has a default value
*/
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
/**
* XML_SCHEMAS_ELEM_FIXED:
*
* the element has a fixed value
*/
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
/**
* XML_SCHEMAS_ELEM_ABSTRACT:
*
* the element is abstract
*/
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
/**
* XML_SCHEMAS_ELEM_TOPLEVEL:
*
* the element is top level
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
*/
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
/**
* XML_SCHEMAS_ELEM_REF:
*
* the element is a reference to a type
*/
#define XML_SCHEMAS_ELEM_REF 1 << 6
/**
* XML_SCHEMAS_ELEM_NSDEFAULT:
*
* allow elements in no namespace
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
/**
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
*
* this is set when "type", "ref", "substitutionGroup"
* references have been resolved.
*/
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
/**
* XML_SCHEMAS_ELEM_CIRCULAR:
*
* a helper flag for the search of circular references.
*/
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
/**
* XML_SCHEMAS_ELEM_BLOCK_ABSENT:
*
* the "block" attribute is absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
/**
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
*
* disallowed substitutions are absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
/**
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
*
* disallowed substitutions: "restriction"
*/
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
/**
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
*
* disallowed substitutions: "substituion"
*/
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
/**
* XML_SCHEMAS_ELEM_FINAL_ABSENT:
*
* substitution group exclusions are absent
*/
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
/**
* XML_SCHEMAS_ELEM_FINAL_EXTENSION:
*
* substitution group exclusions: "extension"
*/
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
/**
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
*
* substitution group exclusions: "restriction"
*/
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
/**
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
*
* the declaration is a substitution group head
*/
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
/**
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
*
* this is set when the elem decl has been checked against
* all constraints
*/
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
typedef struct _xmlSchemaElement xmlSchemaElement;
typedef xmlSchemaElement *xmlSchemaElementPtr;
struct _xmlSchemaElement {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* Not used? */
const xmlChar *name;
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes; /* the type definition */
xmlSchemaAttributePtr attributes;
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
const xmlChar *targetNamespace;
const xmlChar *namedType;
const xmlChar *namedTypeNs;
const xmlChar *substGroup;
const xmlChar *substGroupNs;
const xmlChar *scope;
const xmlChar *value; /* The original value of the value constraint. */
struct _xmlSchemaElement *refDecl; /* This will now be used for the
substitution group affiliation */
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
xmlSchemaContentType contentType;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value contraint. */
void *idcs; /* The identity-constraint defs */
};
/*
* XML_SCHEMAS_FACET_UNKNOWN:
*
* unknown facet handling
*/
#define XML_SCHEMAS_FACET_UNKNOWN 0
/*
* XML_SCHEMAS_FACET_PRESERVE:
*
* preserve the type of the facet
*/
#define XML_SCHEMAS_FACET_PRESERVE 1
/*
* XML_SCHEMAS_FACET_REPLACE:
*
* replace the type of the facet
*/
#define XML_SCHEMAS_FACET_REPLACE 2
/*
* XML_SCHEMAS_FACET_COLLAPSE:
*
* collapse the types of the facet
*/
#define XML_SCHEMAS_FACET_COLLAPSE 3
/**
* A facet definition.
*/
struct _xmlSchemaFacet {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
const xmlChar *value; /* The original value */
const xmlChar *id; /* Obsolete */
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
int whitespace;
xmlSchemaValPtr val; /* The compiled value */
xmlRegexpPtr regexp; /* The regex for patterns */
};
/**
* A notation definition.
*/
typedef struct _xmlSchemaNotation xmlSchemaNotation;
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
struct _xmlSchemaNotation {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *name;
xmlSchemaAnnotPtr annot;
const xmlChar *identifier;
const xmlChar *targetNamespace;
};
/*
* TODO: Actually all those flags used for the schema should sit
* on the schema parser context, since they are used only
* during parsing an XML schema document, and not available
* on the component level as per spec.
*/
/**
* XML_SCHEMAS_QUALIF_ELEM:
*
* Reflects elementFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
/**
* XML_SCHEMAS_QUALIF_ATTR:
*
* Reflects attributeFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
/**
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
*
* the schema has "extension" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
/**
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
*
* the schema has "restriction" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
/**
* XML_SCHEMAS_FINAL_DEFAULT_LIST:
*
* the cshema has "list" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
/**
* XML_SCHEMAS_FINAL_DEFAULT_UNION:
*
* the schema has "union" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
/**
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
*
* the schema has "extension" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
/**
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
*
* the schema has "restriction" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
/**
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
*
* the schema has "substitution" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
/**
* XML_SCHEMAS_INCLUDING_CONVERT_NS:
*
* the schema is currently including an other schema with
* no target namespace.
*/
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
/**
* _xmlSchema:
*
* A Schemas definition
*/
struct _xmlSchema {
const xmlChar *name; /* schema name */
const xmlChar *targetNamespace; /* the target namespace */
const xmlChar *version;
const xmlChar *id; /* Obsolete */
xmlDocPtr doc;
xmlSchemaAnnotPtr annot;
int flags;
xmlHashTablePtr typeDecl;
xmlHashTablePtr attrDecl;
xmlHashTablePtr attrgrpDecl;
xmlHashTablePtr elemDecl;
xmlHashTablePtr notaDecl;
xmlHashTablePtr schemasImports;
void *_private; /* unused by the library for users or bindings */
xmlHashTablePtr groupDecl;
xmlDictPtr dict;
void *includes; /* the includes, this is opaque for now */
int preserve; /* whether to free the document */
int counter; /* used to give ononymous components unique names */
xmlHashTablePtr idcDef; /* All identity-constraint defs. */
void *volatiles; /* Obsolete */
};
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_INTERNALS_H__ */
/*
* Summary: text writing API for XML
* Description: text writing API for XML
*
* Copy: See Copyright for the status of this software.
*
* Author: Alfred Mickautsch <alfred@mickautsch.de>
*/
#ifndef __XML_XMLWRITER_H__
#define __XML_XMLWRITER_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_WRITER_ENABLED
#include <stdarg.h>
#include <libxml/xmlIO.h>
#include <libxml/list.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlTextWriter xmlTextWriter;
typedef xmlTextWriter *xmlTextWriterPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriter(xmlOutputBufferPtr out);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterFilename(const char *uri, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterMemory(xmlBufferPtr buf, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterDoc(xmlDocPtr * doc, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
int compression);
XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
/*
* Functions
*/
/*
* Document
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDocument(xmlTextWriterPtr writer,
const char *version,
const char *encoding,
const char *standalone);
XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr
writer);
/*
* Comments
*/
XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr
writer);
XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
writer,
const xmlChar *
content);
/*
* Elements
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartElement(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI);
XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr
writer);
/*
* Elements conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* Text
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
const xmlChar * content, int len);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
const xmlChar * content);
XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
writer,
const char
*format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
writer,
const char
*format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
const xmlChar *
content);
XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
const char *data,
int start, int len);
XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
const char *data,
int start, int len);
/*
* Attributes
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI);
XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr
writer);
/*
* Attributes conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* PI's
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartPI(xmlTextWriterPtr writer,
const xmlChar * target);
XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer);
/*
* PI conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWritePI(xmlTextWriterPtr writer,
const xmlChar * target,
const xmlChar * content);
/**
* xmlTextWriterWriteProcessingInstruction:
*
* This macro maps to xmlTextWriterWritePI
*/
#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI
/*
* CDATA
*/
XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
/*
* CDATA conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
const xmlChar * content);
/*
* DTD
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer);
/*
* DTD conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * subset);
/**
* xmlTextWriterWriteDocType:
*
* this macro maps to xmlTextWriterWriteDTD
*/
#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD
/*
* DTD element definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr
writer);
/*
* DTD element definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD attribute list definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
writer);
/*
* DTD attribute list definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD entity definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
int pe, const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr
writer);
/*
* DTD entity definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(4,5);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(4,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
writer,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar *
ndataid);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
writer, int pe,
const xmlChar * name,
const xmlChar *
pubid,
const xmlChar *
sysid,
const xmlChar *
ndataid,
const xmlChar *
content);
/*
* DTD notation definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
/*
* Indentation
*/
XMLPUBFUN int XMLCALL
xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
XMLPUBFUN int XMLCALL
xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
const xmlChar * str);
XMLPUBFUN int XMLCALL
xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar);
/*
* misc
*/
XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_WRITER_ENABLED */
#endif /* __XML_XMLWRITER_H__ */
/*
* Summary: minimal FTP implementation
* Description: minimal FTP implementation allowing to fetch resources
* like external subset.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_FTP_ENABLED
/* Needed for portability to Windows 64 bits */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <winsock2.h>
#else
/**
* SOCKET:
*
* macro used to provide portability of code to windows sockets
*/
#define SOCKET int
/**
* INVALID_SOCKET:
*
* macro used to provide portability of code to windows sockets
* the value to be used when the socket is not valid
*/
#undef INVALID_SOCKET
#define INVALID_SOCKET (-1)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* ftpListCallback:
* @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string
* @owner: the owner string
* @group: the group string
* @size: the file size
* @links: the link count
* @year: the year
* @month: the month
* @day: the day
* @hour: the hour
* @minute: the minute
*
* A callback for the xmlNanoFTPList command.
* Note that only one of year and day:minute are specified.
*/
typedef void (*ftpListCallback) (void *userData,
const char *filename, const char *attrib,
const char *owner, const char *group,
unsigned long size, int links, int year,
const char *month, int day, int hour,
int minute);
/**
* ftpDataCallback:
* @userData: the user provided context
* @data: the data received
* @len: its size in bytes
*
* A callback for the xmlNanoFTPGet command.
*/
typedef void (*ftpDataCallback) (void *userData,
const char *data,
int len);
/*
* Init
*/
XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void);
XMLPUBFUN void XMLCALL
xmlNanoFTPCleanup (void);
/*
* Creating/freeing contexts.
*/
XMLPUBFUN void * XMLCALL
xmlNanoFTPNewCtxt (const char *URL);
XMLPUBFUN void XMLCALL
xmlNanoFTPFreeCtxt (void * ctx);
XMLPUBFUN void * XMLCALL
xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections.
*/
XMLPUBFUN void * XMLCALL
xmlNanoFTPOpen (const char *URL);
XMLPUBFUN int XMLCALL
xmlNanoFTPConnect (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPClose (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPQuit (void *ctx);
XMLPUBFUN void XMLCALL
xmlNanoFTPScanProxy (const char *URL);
XMLPUBFUN void XMLCALL
xmlNanoFTPProxy (const char *host,
int port,
const char *user,
const char *passwd,
int type);
XMLPUBFUN int XMLCALL
xmlNanoFTPUpdateURL (void *ctx,
const char *URL);
/*
* Rather internal commands.
*/
XMLPUBFUN int XMLCALL
xmlNanoFTPGetResponse (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers.
*/
XMLPUBFUN int XMLCALL
xmlNanoFTPCwd (void *ctx,
const char *directory);
XMLPUBFUN int XMLCALL
xmlNanoFTPDele (void *ctx,
const char *file);
XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetConnection (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPCloseConnection(void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
const char *filename);
XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetSocket (void *ctx,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPRead (void *ctx,
void *dest,
int len);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_FTP_ENABLED */
#endif /* __NANO_FTP_H__ */
/*
* Summary: unfinished XLink detection module
* Description: unfinished XLink detection module
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XLINK_H__
#define __XML_XLINK_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XPTR_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* Various defines for the various Link properties.
*
* NOTE: the link detection layer will try to resolve QName expansion
* of namespaces. If "foo" is the prefix for "http://foo.com/"
* then the link detection layer will expand role="foo:myrole"
* to "http://foo.com/:myrole".
* NOTE: the link detection layer will expand URI-Refences found on
* href attributes by using the base mechanism if found.
*/
typedef xmlChar *xlinkHRef;
typedef xmlChar *xlinkRole;
typedef xmlChar *xlinkTitle;
typedef enum {
XLINK_TYPE_NONE = 0,
XLINK_TYPE_SIMPLE,
XLINK_TYPE_EXTENDED,
XLINK_TYPE_EXTENDED_SET
} xlinkType;
typedef enum {
XLINK_SHOW_NONE = 0,
XLINK_SHOW_NEW,
XLINK_SHOW_EMBED,
XLINK_SHOW_REPLACE
} xlinkShow;
typedef enum {
XLINK_ACTUATE_NONE = 0,
XLINK_ACTUATE_AUTO,
XLINK_ACTUATE_ONREQUEST
} xlinkActuate;
/**
* xlinkNodeDetectFunc:
* @ctx: user data pointer
* @node: the node to check
*
* This is the prototype for the link detection routine.
* It calls the default link detection callbacks upon link detection.
*/
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
/*
* The link detection module interact with the upper layers using
* a set of callback registered at parsing time.
*/
/**
* xlinkSimpleLinkFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @href: the target of the link
* @role: the role string
* @title: the link title
*
* This is the prototype for a simple link detection callback.
*/
typedef void
(*xlinkSimpleLinkFunk) (void *ctx,
xmlNodePtr node,
const xlinkHRef href,
const xlinkRole role,
const xlinkTitle title);
/**
* xlinkExtendedLinkFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @nbLocators: the number of locators detected on the link
* @hrefs: pointer to the array of locator hrefs
* @roles: pointer to the array of locator roles
* @nbArcs: the number of arcs detected on the link
* @from: pointer to the array of source roles found on the arcs
* @to: pointer to the array of target roles found on the arcs
* @show: array of values for the show attributes found on the arcs
* @actuate: array of values for the actuate attributes found on the arcs
* @nbTitles: the number of titles detected on the link
* @title: array of titles detected on the link
* @langs: array of xml:lang values for the titles
*
* This is the prototype for a extended link detection callback.
*/
typedef void
(*xlinkExtendedLinkFunk)(void *ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbArcs,
const xlinkRole *from,
const xlinkRole *to,
xlinkShow *show,
xlinkActuate *actuate,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
/**
* xlinkExtendedLinkSetFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @nbLocators: the number of locators detected on the link
* @hrefs: pointer to the array of locator hrefs
* @roles: pointer to the array of locator roles
* @nbTitles: the number of titles detected on the link
* @title: array of titles detected on the link
* @langs: array of xml:lang values for the titles
*
* This is the prototype for a extended link set detection callback.
*/
typedef void
(*xlinkExtendedLinkSetFunk) (void *ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
/**
* This is the structure containing a set of Links detection callbacks.
*
* There is no default xlink callbacks, if one want to get link
* recognition activated, those call backs must be provided before parsing.
*/
typedef struct _xlinkHandler xlinkHandler;
typedef xlinkHandler *xlinkHandlerPtr;
struct _xlinkHandler {
xlinkSimpleLinkFunk simple;
xlinkExtendedLinkFunk extended;
xlinkExtendedLinkSetFunk set;
};
/*
* The default detection routine, can be overridden, they call the default
* detection callbacks.
*/
XMLPUBFUN xlinkNodeDetectFunc XMLCALL
xlinkGetDefaultDetect (void);
XMLPUBFUN void XMLCALL
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
/*
* Routines to set/get the default handlers.
*/
XMLPUBFUN xlinkHandlerPtr XMLCALL
xlinkGetDefaultHandler (void);
XMLPUBFUN void XMLCALL
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
/*
* Link detection module itself.
*/
XMLPUBFUN xlinkType XMLCALL
xlinkIsLink (xmlDocPtr doc,
xmlNodePtr node);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XLINK_H__ */
/*
* Summary: implementation of XML Schema Datatypes
* Description: module providing the XML Schema Datatypes implementation
* both definition and validity checking
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_TYPES_H__
#define __XML_SCHEMA_TYPES_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/schemasInternals.h>
#include <libxml/xmlschemas.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
XML_SCHEMA_WHITESPACE_PRESERVE = 1,
XML_SCHEMA_WHITESPACE_REPLACE = 2,
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
} xmlSchemaWhitespaceValueType;
XMLPUBFUN void XMLCALL
xmlSchemaInitTypes (void);
XMLPUBFUN void XMLCALL
xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetPredefinedType (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val);
XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN void XMLCALL
xmlSchemaFreeValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaFacetPtr XMLCALL
xmlSchemaNewFacet (void);
XMLPUBFUN int XMLCALL
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr ctxt,
const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
XMLPUBFUN int XMLCALL
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar *value,
unsigned long actualLen,
unsigned long *expectedLen);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInType (xmlSchemaValType type);
XMLPUBFUN int XMLCALL
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType);
XMLPUBFUN xmlChar * XMLCALL
xmlSchemaCollapseString (const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
XMLPUBFUN unsigned long XMLCALL
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length);
XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSchemaGetCanonValue (xmlSchemaValPtr val,
const xmlChar **retValue);
XMLPUBFUN int XMLCALL
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
const xmlChar **retValue,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaValueGetNext (xmlSchemaValPtr cur);
XMLPUBFUN const xmlChar * XMLCALL
xmlSchemaValueGetAsString (xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar *value);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewNOTATIONValue (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
const xmlChar *localName);
XMLPUBFUN int XMLCALL
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaValPtr y,
xmlSchemaWhitespaceValueType yws);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaCopyValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValType XMLCALL
xmlSchemaGetValType (xmlSchemaValPtr val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_TYPES_H__ */
/*
* Summary: internal interfaces for XML Path Language implementation
* Description: internal interfaces for XML Path Language implementation
* used to build new modules on top of XPath like XPointer and
* XSLT
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPATH_INTERNALS_H__
#define __XML_XPATH_INTERNALS_H__
#include <libxml/xmlversion.h>
#include <libxml/xpath.h>
#ifdef LIBXML_XPATH_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************
* *
* Helpers *
* *
************************************************************************/
/*
* Many of these macros may later turn into functions. They
* shouldn't be used in #ifdef's preprocessor instructions.
*/
/**
* xmlXPathSetError:
* @ctxt: an XPath parser context
* @err: an xmlXPathError code
*
* Raises an error.
*/
#define xmlXPathSetError(ctxt, err) \
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
if ((ctxt) != NULL) (ctxt)->error = (err); }
/**
* xmlXPathSetArityError:
* @ctxt: an XPath parser context
*
* Raises an XPATH_INVALID_ARITY error.
*/
#define xmlXPathSetArityError(ctxt) \
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
/**
* xmlXPathSetTypeError:
* @ctxt: an XPath parser context
*
* Raises an XPATH_INVALID_TYPE error.
*/
#define xmlXPathSetTypeError(ctxt) \
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
/**
* xmlXPathGetError:
* @ctxt: an XPath parser context
*
* Get the error code of an XPath context.
*
* Returns the context error.
*/
#define xmlXPathGetError(ctxt) ((ctxt)->error)
/**
* xmlXPathCheckError:
* @ctxt: an XPath parser context
*
* Check if an XPath error was raised.
*
* Returns true if an error has been raised, false otherwise.
*/
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
/**
* xmlXPathGetDocument:
* @ctxt: an XPath parser context
*
* Get the document of an XPath context.
*
* Returns the context document.
*/
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
/**
* xmlXPathGetContextNode:
* @ctxt: an XPath parser context
*
* Get the context node of an XPath context.
*
* Returns the context node.
*/
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
XMLPUBFUN int XMLCALL
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
XMLPUBFUN double XMLCALL
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathPopString (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
XMLPUBFUN void * XMLCALL
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
/**
* xmlXPathReturnBoolean:
* @ctxt: an XPath parser context
* @val: a boolean
*
* Pushes the boolean @val on the context stack.
*/
#define xmlXPathReturnBoolean(ctxt, val) \
valuePush((ctxt), xmlXPathNewBoolean(val))
/**
* xmlXPathReturnTrue:
* @ctxt: an XPath parser context
*
* Pushes true on the context stack.
*/
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
/**
* xmlXPathReturnFalse:
* @ctxt: an XPath parser context
*
* Pushes false on the context stack.
*/
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
/**
* xmlXPathReturnNumber:
* @ctxt: an XPath parser context
* @val: a double
*
* Pushes the double @val on the context stack.
*/
#define xmlXPathReturnNumber(ctxt, val) \
valuePush((ctxt), xmlXPathNewFloat(val))
/**
* xmlXPathReturnString:
* @ctxt: an XPath parser context
* @str: a string
*
* Pushes the string @str on the context stack.
*/
#define xmlXPathReturnString(ctxt, str) \
valuePush((ctxt), xmlXPathWrapString(str))
/**
* xmlXPathReturnEmptyString:
* @ctxt: an XPath parser context
*
* Pushes an empty string on the stack.
*/
#define xmlXPathReturnEmptyString(ctxt) \
valuePush((ctxt), xmlXPathNewCString(""))
/**
* xmlXPathReturnNodeSet:
* @ctxt: an XPath parser context
* @ns: a node-set
*
* Pushes the node-set @ns on the context stack.
*/
#define xmlXPathReturnNodeSet(ctxt, ns) \
valuePush((ctxt), xmlXPathWrapNodeSet(ns))
/**
* xmlXPathReturnEmptyNodeSet:
* @ctxt: an XPath parser context
*
* Pushes an empty node-set on the context stack.
*/
#define xmlXPathReturnEmptyNodeSet(ctxt) \
valuePush((ctxt), xmlXPathNewNodeSet(NULL))
/**
* xmlXPathReturnExternal:
* @ctxt: an XPath parser context
* @val: user data
*
* Pushes user data on the context stack.
*/
#define xmlXPathReturnExternal(ctxt, val) \
valuePush((ctxt), xmlXPathWrapExternal(val))
/**
* xmlXPathStackIsNodeSet:
* @ctxt: an XPath parser context
*
* Check if the current value on the XPath stack is a node set or
* an XSLT value tree.
*
* Returns true if the current object on the stack is a node-set.
*/
#define xmlXPathStackIsNodeSet(ctxt) \
(((ctxt)->value != NULL) \
&& (((ctxt)->value->type == XPATH_NODESET) \
|| ((ctxt)->value->type == XPATH_XSLT_TREE)))
/**
* xmlXPathStackIsExternal:
* @ctxt: an XPath parser context
*
* Checks if the current value on the XPath stack is an external
* object.
*
* Returns true if the current object on the stack is an external
* object.
*/
#define xmlXPathStackIsExternal(ctxt) \
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
/**
* xmlXPathEmptyNodeSet:
* @ns: a node-set
*
* Empties a node-set.
*/
#define xmlXPathEmptyNodeSet(ns) \
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }
/**
* CHECK_ERROR:
*
* Macro to return from the function if an XPath error was detected.
*/
#define CHECK_ERROR \
if (ctxt->error != XPATH_EXPRESSION_OK) return
/**
* CHECK_ERROR0:
*
* Macro to return 0 from the function if an XPath error was detected.
*/
#define CHECK_ERROR0 \
if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
/**
* XP_ERROR:
* @X: the error code
*
* Macro to raise an XPath error and return.
*/
#define XP_ERROR(X) \
{ xmlXPathErr(ctxt, X); return; }
/**
* XP_ERROR0:
* @X: the error code
*
* Macro to raise an XPath error and return 0.
*/
#define XP_ERROR0(X) \
{ xmlXPathErr(ctxt, X); return(0); }
/**
* CHECK_TYPE:
* @typeval: the XPath type
*
* Macro to check that the value on top of the XPath stack is of a given
* type.
*/
#define CHECK_TYPE(typeval) \
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR(XPATH_INVALID_TYPE)
/**
* CHECK_TYPE0:
* @typeval: the XPath type
*
* Macro to check that the value on top of the XPath stack is of a given
* type. Return(0) in case of failure
*/
#define CHECK_TYPE0(typeval) \
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR0(XPATH_INVALID_TYPE)
/**
* CHECK_ARITY:
* @x: the number of expected args
*
* Macro to check that the number of args passed to an XPath function matches.
*/
#define CHECK_ARITY(x) \
if (ctxt == NULL) return; \
if (nargs != (x)) \
XP_ERROR(XPATH_INVALID_ARITY); \
if (ctxt->valueNr < ctxt->valueFrame + (x)) \
XP_ERROR(XPATH_STACK_ERROR);
/**
* CAST_TO_STRING:
*
* Macro to try to cast the value on the top of the XPath stack to a string.
*/
#define CAST_TO_STRING \
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
xmlXPathStringFunction(ctxt, 1);
/**
* CAST_TO_NUMBER:
*
* Macro to try to cast the value on the top of the XPath stack to a number.
*/
#define CAST_TO_NUMBER \
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
xmlXPathNumberFunction(ctxt, 1);
/**
* CAST_TO_BOOLEAN:
*
* Macro to try to cast the value on the top of the XPath stack to a boolean.
*/
#define CAST_TO_BOOLEAN \
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
xmlXPathBooleanFunction(ctxt, 1);
/*
* Variable Lookup forwarding.
*/
XMLPUBFUN void XMLCALL
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
xmlXPathVariableLookupFunc f,
void *data);
/*
* Function Lookup forwarding.
*/
XMLPUBFUN void XMLCALL
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
xmlXPathFuncLookupFunc f,
void *funcCtxt);
/*
* Error reporting.
*/
XMLPUBFUN void XMLCALL
xmlXPatherror (xmlXPathParserContextPtr ctxt,
const char *file,
int line,
int no);
XMLPUBFUN void XMLCALL
xmlXPathErr (xmlXPathParserContextPtr ctxt,
int error);
#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void XMLCALL
xmlXPathDebugDumpObject (FILE *output,
xmlXPathObjectPtr cur,
int depth);
XMLPUBFUN void XMLCALL
xmlXPathDebugDumpCompExpr(FILE *output,
xmlXPathCompExprPtr comp,
int depth);
#endif
/**
* NodeSet handling.
*/
XMLPUBFUN int XMLCALL
xmlXPathNodeSetContains (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathDifference (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathIntersection (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathDistinct (xmlNodeSetPtr nodes);
XMLPUBFUN int XMLCALL
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeLeading (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathLeading (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathTrailing (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
/**
* Extending a context.
*/
XMLPUBFUN int XMLCALL
xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
const xmlChar *prefix,
const xmlChar *ns_uri);
XMLPUBFUN const xmlChar * XMLCALL
xmlXPathNsLookup (xmlXPathContextPtr ctxt,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
const xmlChar *name,
xmlXPathFunction f);
XMLPUBFUN int XMLCALL
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathFunction f);
XMLPUBFUN int XMLCALL
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
const xmlChar *name,
xmlXPathObjectPtr value);
XMLPUBFUN int XMLCALL
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathObjectPtr value);
XMLPUBFUN xmlXPathFunction XMLCALL
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathFunction XMLCALL
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void XMLCALL
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void XMLCALL
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
/**
* Utilities to extend XPath.
*/
XMLPUBFUN xmlXPathParserContextPtr XMLCALL
xmlXPathNewParserContext (const xmlChar *str,
xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL
xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
/* TODO: remap to xmlXPathValuePop and Push. */
XMLPUBFUN xmlXPathObjectPtr XMLCALL
valuePop (xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL
valuePush (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr value);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewString (const xmlChar *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewCString (const char *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapString (xmlChar *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapCString (char * val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewFloat (double val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewBoolean (int val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewNodeSet (xmlNodePtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewValueTree (xmlNodePtr val);
XMLPUBFUN int XMLCALL
xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN int XMLCALL
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN int XMLCALL
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
xmlNodePtr node,
xmlNsPtr ns);
XMLPUBFUN void XMLCALL
xmlXPathNodeSetSort (xmlNodeSetPtr set);
XMLPUBFUN void XMLCALL
xmlXPathRoot (xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL
xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathParseName (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
/*
* Existing functions.
*/
XMLPUBFUN double XMLCALL
xmlXPathStringEvalNumber (const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr res);
XMLPUBFUN void XMLCALL
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
xmlNodeSetPtr val2);
XMLPUBFUN void XMLCALL
xmlXPathNodeSetDel (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN void XMLCALL
xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
int val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewNodeSetList (xmlNodeSetPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapNodeSet (xmlNodeSetPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapExternal (void *val);
XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name);
/*
* Some of the axis navigation routines.
*/
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
/*
* The official core of XPath functions.
*/
XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
/**
* Really internal functions
*/
XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED */
#endif /* ! __XML_XPATH_INTERNALS_H__ */
/*
* Summary: interface for an HTML 4.0 non-verifying parser
* Description: this module implements an HTML 4.0 non-verifying parser
* with API compatible with the XML parser ones. It should
* be able to parse "real world" HTML, even if severely
* broken from a specification point of view.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __HTML_PARSER_H__
#define __HTML_PARSER_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most of the back-end structures from XML and HTML are shared.
*/
typedef xmlParserCtxt htmlParserCtxt;
typedef xmlParserCtxtPtr htmlParserCtxtPtr;
typedef xmlParserNodeInfo htmlParserNodeInfo;
typedef xmlSAXHandler htmlSAXHandler;
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
typedef xmlParserInput htmlParserInput;
typedef xmlParserInputPtr htmlParserInputPtr;
typedef xmlDocPtr htmlDocPtr;
typedef xmlNodePtr htmlNodePtr;
/*
* Internal description of an HTML element, representing HTML 4.01
* and XHTML 1.0 (which share the same structure).
*/
typedef struct _htmlElemDesc htmlElemDesc;
typedef htmlElemDesc *htmlElemDescPtr;
struct _htmlElemDesc {
const char *name; /* The tag name */
char startTag; /* Whether the start tag can be implied */
char endTag; /* Whether the end tag can be implied */
char saveEndTag; /* Whether the end tag should be saved */
char empty; /* Is this an empty element ? */
char depr; /* Is this a deprecated element ? */
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
char isinline; /* is this a block 0 or inline 1 element */
const char *desc; /* the description */
/* NRK Jan.2003
* New fields encapsulating HTML structure
*
* Bugs:
* This is a very limited representation. It fails to tell us when
* an element *requires* subelements (we only have whether they're
* allowed or not), and it doesn't tell us where CDATA and PCDATA
* are allowed. Some element relationships are not fully represented:
* these are flagged with the word MODIFIER
*/
const char** subelts; /* allowed sub-elements of this element */
const char* defaultsubelt; /* subelement for suggested auto-repair
if necessary or NULL */
const char** attrs_opt; /* Optional Attributes */
const char** attrs_depr; /* Additional deprecated attributes */
const char** attrs_req; /* Required attributes */
};
/*
* Internal description of an HTML entity.
*/
typedef struct _htmlEntityDesc htmlEntityDesc;
typedef htmlEntityDesc *htmlEntityDescPtr;
struct _htmlEntityDesc {
unsigned int value; /* the UNICODE value for the character */
const char *name; /* The entity name */
const char *desc; /* the description */
};
/*
* There is only few public functions.
*/
XMLPUBFUN const htmlElemDesc * XMLCALL
htmlTagLookup (const xmlChar *tag);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlEntityLookup(const xmlChar *name);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlEntityValueLookup(unsigned int value);
XMLPUBFUN int XMLCALL
htmlIsAutoClosed(htmlDocPtr doc,
htmlNodePtr elem);
XMLPUBFUN int XMLCALL
htmlAutoCloseTag(htmlDocPtr doc,
const xmlChar *name,
htmlNodePtr elem);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
const xmlChar **str);
XMLPUBFUN int XMLCALL
htmlParseCharRef(htmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
htmlParseElement(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlNewParserCtxt(void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN int XMLCALL
htmlParseDocument(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseDoc (const xmlChar *cur,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseDoc (const xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseFile(const char *filename,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseFile (const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
UTF8ToHtml (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
XMLPUBFUN int XMLCALL
htmlEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN int XMLCALL
htmlIsScriptAttribute(const xmlChar *name);
XMLPUBFUN int XMLCALL
htmlHandleOmittedElem(int val);
#ifdef LIBXML_PUSH_ENABLED
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
htmlParseChunk (htmlParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
#endif /* LIBXML_PUSH_ENABLED */
XMLPUBFUN void XMLCALL
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
/*
* New set of simpler/more flexible APIs
*/
/**
* xmlParserOption:
*
* This is the set of XML parser options that can be passed down
* to the xmlReadDoc() and similar calls.
*/
typedef enum {
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
HTML_PARSE_NONET = 1<<11,/* Forbid network access */
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
} htmlParserOption;
XMLPUBFUN void XMLCALL
htmlCtxtReset (htmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/* NRK/Jan2003: further knowledge of HTML structure
*/
typedef enum {
HTML_NA = 0 , /* something we don't check at all */
HTML_INVALID = 0x1 ,
HTML_DEPRECATED = 0x2 ,
HTML_VALID = 0x4 ,
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */
} htmlStatus ;
/* Using htmlElemDesc rather than name here, to emphasise the fact
that otherwise there's a lookup overhead
*/
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
/**
* htmlDefaultSubelement:
* @elt: HTML element
*
* Returns the default subelement for this element
*/
#define htmlDefaultSubelement(elt) elt->defaultsubelt
/**
* htmlElementAllowedHereDesc:
* @parent: HTML parent element
* @elt: HTML element
*
* Checks whether an HTML element description may be a
* direct child of the specified element.
*
* Returns 1 if allowed; 0 otherwise.
*/
#define htmlElementAllowedHereDesc(parent,elt) \
htmlElementAllowedHere((parent), (elt)->name)
/**
* htmlRequiredAttrs:
* @elt: HTML element
*
* Returns the attributes required for the specified element.
*/
#define htmlRequiredAttrs(elt) (elt)->attrs_req
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_PARSER_H__ */
/*
* Summary: the XML document serializer
* Description: API to save document or subtree of document
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XMLSAVE_H__
#define __XML_XMLSAVE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlSaveOption:
*
* This is the set of XML save options that can be passed down
* to the xmlSaveToFd() and similar calls.
*/
typedef enum {
XML_SAVE_FORMAT = 1<<0, /* format save output */
XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */
XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */
} xmlSaveOption;
typedef struct _xmlSaveCtxt xmlSaveCtxt;
typedef xmlSaveCtxt *xmlSaveCtxtPtr;
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFd (int fd,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFilename (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToBuffer (xmlBufferPtr buffer,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
const char *encoding,
int options);
XMLPUBFUN long XMLCALL
xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN long XMLCALL
xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSaveClose (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
XMLPUBFUN int XMLCALL
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* __XML_XMLSAVE_H__ */
/**
* Summary: interfaces for thread handling
* Description: set of generic threading related routines
* should work with pthreads, Windows native or TLS threads
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_THREADS_H__
#define __XML_THREADS_H__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* xmlMutex are a simple mutual exception locks.
*/
typedef struct _xmlMutex xmlMutex;
typedef xmlMutex *xmlMutexPtr;
/*
* xmlRMutex are reentrant mutual exception locks.
*/
typedef struct _xmlRMutex xmlRMutex;
typedef xmlRMutex *xmlRMutexPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/globals.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN xmlMutexPtr XMLCALL
xmlNewMutex (void);
XMLPUBFUN void XMLCALL
xmlMutexLock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlMutexUnlock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlFreeMutex (xmlMutexPtr tok);
XMLPUBFUN xmlRMutexPtr XMLCALL
xmlNewRMutex (void);
XMLPUBFUN void XMLCALL
xmlRMutexLock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlRMutexUnlock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlFreeRMutex (xmlRMutexPtr tok);
/*
* Library wide APIs.
*/
XMLPUBFUN void XMLCALL
xmlInitThreads (void);
XMLPUBFUN void XMLCALL
xmlLockLibrary (void);
XMLPUBFUN void XMLCALL
xmlUnlockLibrary(void);
XMLPUBFUN int XMLCALL
xmlGetThreadId (void);
XMLPUBFUN int XMLCALL
xmlIsMainThread (void);
XMLPUBFUN void XMLCALL
xmlCleanupThreads(void);
XMLPUBFUN xmlGlobalStatePtr XMLCALL
xmlGetGlobalState(void);
#ifdef HAVE_PTHREAD_H
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
int XMLCALL
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
void *lpvReserved);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_THREADS_H__ */
/*
* Summary: minimal HTTP implementation
* Description: minimal HTTP implementation allowing to fetch resources
* like external subset.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __NANO_HTTP_H__
#define __NANO_HTTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTTP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL
xmlNanoHTTPInit (void);
XMLPUBFUN void XMLCALL
xmlNanoHTTPCleanup (void);
XMLPUBFUN void XMLCALL
xmlNanoHTTPScanProxy (const char *URL);
XMLPUBFUN int XMLCALL
xmlNanoHTTPFetch (const char *URL,
const char *filename,
char **contentType);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethod (const char *URL,
const char *method,
const char *input,
char **contentType,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethodRedir (const char *URL,
const char *method,
const char *input,
char **contentType,
char **redir,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpen (const char *URL,
char **contentType);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpenRedir (const char *URL,
char **contentType,
char **redir);
XMLPUBFUN int XMLCALL
xmlNanoHTTPReturnCode (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPAuthHeader (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPRedir (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPContentLength( void * ctx );
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPEncoding (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPMimeType (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPRead (void *ctx,
void *dest,
int len);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
xmlNanoHTTPSave (void *ctxt,
const char *filename);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTTP_ENABLED */
#endif /* __NANO_HTTP_H__ */
/*
* Summary: set of routines to process strings
* Description: type and interfaces needed for the internal string handling
* of the library, especially UTF8 processing.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_STRING_H__
#define __XML_STRING_H__
#include <stdarg.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlChar:
*
* This is a basic byte in an UTF-8 encoded string.
* It's unsigned allowing to pinpoint case where char * are assigned
* to xmlChar * (possibly making serialization back impossible).
*/
typedef unsigned char xmlChar;
/**
* BAD_CAST:
*
* Macro to cast a string to an xmlChar * when one know its safe.
*/
#define BAD_CAST (xmlChar *)
/*
* xmlChar handling
*/
XMLPUBFUN xmlChar * XMLCALL
xmlStrdup (const xmlChar *cur);
XMLPUBFUN xmlChar * XMLCALL
xmlStrndup (const xmlChar *cur,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlCharStrndup (const char *cur,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlCharStrdup (const char *cur);
XMLPUBFUN xmlChar * XMLCALL
xmlStrsub (const xmlChar *str,
int start,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrchr (const xmlChar *str,
xmlChar val);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrstr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrcasestr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN int XMLCALL
xmlStrcmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
xmlStrncmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
xmlStrcasecmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
xmlStrQEqual (const xmlChar *pref,
const xmlChar *name,
const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlStrlen (const xmlChar *str);
XMLPUBFUN xmlChar * XMLCALL
xmlStrcat (xmlChar *cur,
const xmlChar *add);
XMLPUBFUN xmlChar * XMLCALL
xmlStrncat (xmlChar *cur,
const xmlChar *add,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlStrncatNew (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
xmlStrPrintf (xmlChar *buf,
int len,
const char *msg,
...) LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlStrVPrintf (xmlChar *buf,
int len,
const char *msg,
va_list ap) LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
xmlGetUTF8Char (const unsigned char *utf,
int *len);
XMLPUBFUN int XMLCALL
xmlCheckUTF8 (const unsigned char *utf);
XMLPUBFUN int XMLCALL
xmlUTF8Strsize (const xmlChar *utf,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlUTF8Strndup (const xmlChar *utf,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlUTF8Strpos (const xmlChar *utf,
int pos);
XMLPUBFUN int XMLCALL
xmlUTF8Strloc (const xmlChar *utf,
const xmlChar *utfchar);
XMLPUBFUN xmlChar * XMLCALL
xmlUTF8Strsub (const xmlChar *utf,
int start,
int len);
XMLPUBFUN int XMLCALL
xmlUTF8Strlen (const xmlChar *utf);
XMLPUBFUN int XMLCALL
xmlUTF8Size (const xmlChar *utf);
XMLPUBFUN int XMLCALL
xmlUTF8Charcmp (const xmlChar *utf1,
const xmlChar *utf2);
#ifdef __cplusplus
}
#endif
#endif /* __XML_STRING_H__ */
/*
* Summary: Chained hash tables
* Description: This module implements the hash table support used in
* various places in the library.
*
* Copy: See Copyright for the status of this software.
*
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
*/
#ifndef __XML_HASH_H__
#define __XML_HASH_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* The hash table.
*/
typedef struct _xmlHashTable xmlHashTable;
typedef xmlHashTable *xmlHashTablePtr;
#ifdef __cplusplus
}
#endif
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Recent version of gcc produce a warning when a function pointer is assigned
* to an object pointer, or vice versa. The following macro is a dirty hack
* to allow suppression of the warning. If your architecture has function
* pointers which are a different size than a void pointer, there may be some
* serious trouble within the library.
*/
/**
* XML_CAST_FPTR:
* @fptr: pointer to a function
*
* Macro to do a casting from an object pointer to a
* function pointer without encountering a warning from
* gcc
*
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
* This macro violated ISO C aliasing rules (gcc4 on s390 broke)
* so it is disabled now
*/
#define XML_CAST_FPTR(fptr) fptr
/*
* function types:
*/
/**
* xmlHashDeallocator:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to free data from a hash.
*/
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
/**
* xmlHashCopier:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to copy data from a hash.
*
* Returns a copy of the data or NULL in case of error.
*/
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
/**
* xmlHashScanner:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
*
* Callback when scanning data in a hash with the simple scanner.
*/
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
/**
* xmlHashScannerFull:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
* @name2: the second name associated
* @name3: the third name associated
*
* Callback when scanning data in a hash with the full scanner.
*/
typedef void (*xmlHashScannerFull)(void *payload, void *data,
const xmlChar *name, const xmlChar *name2,
const xmlChar *name3);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreate (int size);
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreateDict(int size,
xmlDictPtr dict);
XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f);
/*
* Add a new entry to the hash table.
*/
XMLPUBFUN int XMLCALL
xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar *name,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry(xmlHashTablePtr table,
const xmlChar *name,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashAddEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashAddEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata,
xmlHashDeallocator f);
/*
* Remove an entry from the hash table.
*/
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3,
xmlHashDeallocator f);
/*
* Retrieve the userdata.
*/
XMLPUBFUN void * XMLCALL
xmlHashLookup (xmlHashTablePtr table,
const xmlChar *name);
XMLPUBFUN void * XMLCALL
xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2);
XMLPUBFUN void * XMLCALL
xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3);
XMLPUBFUN void * XMLCALL
xmlHashQLookup (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN void * XMLCALL
xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2);
XMLPUBFUN void * XMLCALL
xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2,
const xmlChar *name3,
const xmlChar *prefix3);
/*
* Helpers.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f);
XMLPUBFUN int XMLCALL
xmlHashSize (xmlHashTablePtr table);
XMLPUBFUN void XMLCALL
xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScan3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScanFull3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScannerFull f,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_HASH_H__ */
/*
* Summary: Provide Canonical XML and Exclusive XML Canonicalization
* Description: the c14n modules provides a
*
* "Canonical XML" implementation
* http://www.w3.org/TR/xml-c14n
*
* and an
*
* "Exclusive XML Canonicalization" implementation
* http://www.w3.org/TR/xml-exc-c14n
* Copy: See Copyright for the status of this software.
*
* Author: Aleksey Sanin <aleksey@aleksey.com>
*/
#ifndef __XML_C14N_H__
#define __XML_C14N_H__
#ifdef LIBXML_C14N_ENABLED
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
/*
* XML Canonicazation
* http://www.w3.org/TR/xml-c14n
*
* Exclusive XML Canonicazation
* http://www.w3.org/TR/xml-exc-c14n
*
* Canonical form of an XML document could be created if and only if
* a) default attributes (if any) are added to all nodes
* b) all character and parsed entity references are resolved
* In order to achive this in libxml2 the document MUST be loaded with
* following global setings:
*
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* xmlSubstituteEntitiesDefault(1);
*
* or corresponding parser context setting:
* xmlParserCtxtPtr ctxt;
*
* ...
* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* ctxt->replaceEntities = 1;
* ...
*/
/*
* xmlC14NMode:
*
* Predefined values for C14N modes
*
*/
typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode;
XMLPUBFUN int XMLCALL
xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
XMLPUBFUN int XMLCALL
xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlChar **doc_txt_ptr);
XMLPUBFUN int XMLCALL
xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
const char* filename,
int compression);
/**
* This is the core C14N function
*/
/**
* xmlC14NIsVisibleCallback:
* @user_data: user data
* @node: the curent node
* @parent: the parent node
*
* Signature for a C14N callback on visible nodes
*
* Returns 1 if the node should be included
*/
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
xmlNodePtr node,
xmlNodePtr parent);
XMLPUBFUN int XMLCALL
xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback,
void* user_data,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_C14N_ENABLED */
#endif /* __XML_C14N_H__ */
/*
* Summary: Tree debugging APIs
* Description: Interfaces to a set of routines used for debugging the tree
* produced by the XML parser.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DEBUG_XML__
#define __DEBUG_XML__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_DEBUG_ENABLED
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The standard Dump routines.
*/
XMLPUBFUN void XMLCALL
xmlDebugDumpString (FILE *output,
const xmlChar *str);
XMLPUBFUN void XMLCALL
xmlDebugDumpAttr (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpAttrList (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpOneNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpNodeList (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpDocumentHead(FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlDebugDumpDocument (FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlDebugDumpDTD (FILE *output,
xmlDtdPtr dtd);
XMLPUBFUN void XMLCALL
xmlDebugDumpEntities (FILE *output,
xmlDocPtr doc);
/****************************************************************
* *
* Checking routines *
* *
****************************************************************/
XMLPUBFUN int XMLCALL
xmlDebugCheckDocument (FILE * output,
xmlDocPtr doc);
/****************************************************************
* *
* XML shell helpers *
* *
****************************************************************/
XMLPUBFUN void XMLCALL
xmlLsOneNode (FILE *output, xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlLsCountNode (xmlNodePtr node);
XMLPUBFUN const char * XMLCALL
xmlBoolToText (int boolval);
/****************************************************************
* *
* The XML shell related structures and functions *
* *
****************************************************************/
#ifdef LIBXML_XPATH_ENABLED
/**
* xmlShellReadlineFunc:
* @prompt: a string prompt
*
* This is a generic signature for the XML shell input function.
*
* Returns a string which will be freed by the Shell.
*/
typedef char * (* xmlShellReadlineFunc)(char *prompt);
/**
* xmlShellCtxt:
*
* A debugging shell context.
* TODO: add the defined function tables.
*/
typedef struct _xmlShellCtxt xmlShellCtxt;
typedef xmlShellCtxt *xmlShellCtxtPtr;
struct _xmlShellCtxt {
char *filename;
xmlDocPtr doc;
xmlNodePtr node;
xmlXPathContextPtr pctxt;
int loaded;
FILE *output;
xmlShellReadlineFunc input;
};
/**
* xmlShellCmd:
* @ctxt: a shell context
* @arg: a string argument
* @node: a first node
* @node2: a second node
*
* This is a generic signature for the XML shell functions.
*
* Returns an int, negative returns indicating errors.
*/
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN void XMLCALL
xmlShellPrintXPathError (int errorType,
const char *arg);
XMLPUBFUN void XMLCALL
xmlShellPrintXPathResult(xmlXPathObjectPtr list);
XMLPUBFUN int XMLCALL
xmlShellList (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellBase (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellDir (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellLoad (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlShellPrintNode (xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlShellCat (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellWrite (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellSave (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
xmlShellValidate (xmlShellCtxtPtr ctxt,
char *dtd,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_VALID_ENABLED */
XMLPUBFUN int XMLCALL
xmlShellDu (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr tree,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellPwd (xmlShellCtxtPtr ctxt,
char *buffer,
xmlNodePtr node,
xmlNodePtr node2);
/*
* The Shell interface.
*/
XMLPUBFUN void XMLCALL
xmlShell (xmlDocPtr doc,
char *filename,
xmlShellReadlineFunc input,
FILE *output);
#endif /* LIBXML_XPATH_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DEBUG_ENABLED */
#endif /* __DEBUG_XML__ */
/*
* Summary: interface for the encoding conversion functions
* Description: interface for the encoding conversion functions needed for
* XML basic encoding and iconv() support.
*
* Related specs are
* rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
* [ISO-10646] UTF-8 and UTF-16 in Annexes
* [ISO-8859-1] ISO Latin-1 characters codes.
* [UNICODE] The Unicode Consortium, "The Unicode Standard --
* Worldwide Character Encoding -- Version 1.0", Addison-
* Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
* described in Unicode Technical Report #4.
* [US-ASCII] Coded Character Set--7-bit American Standard Code for
* Information Interchange, ANSI X3.4-1986.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_CHAR_ENCODING_H__
#define __XML_CHAR_ENCODING_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_ICONV_ENABLED
#include <iconv.h>
#endif
#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* xmlCharEncoding:
*
* Predefined values for some standard encodings.
* Libxml does not do beforehand translation on UTF8 and ISOLatinX.
* It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
*
* Anything else would have to be translated to UTF8 before being
* given to the parser itself. The BOM for UTF16 and the encoding
* declaration are looked at and a converter is looked for at that
* point. If not found the parser stops here as asked by the XML REC. A
* converter can be registered by the user using xmlRegisterCharEncodingHandler
* but the current form doesn't allow stateful transcoding (a serious
* problem agreed !). If iconv has been found it will be used
* automatically and allow stateful transcoding, the simplest is then
* to be sure to enable iconv and to provide iconv libs for the encoding
* support needed.
*
* Note that the generic "UTF-16" is not a predefined value. Instead, only
* the specific UTF-16LE and UTF-16BE are present.
*/
typedef enum {
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
} xmlCharEncoding;
/**
* xmlCharEncodingInputFunc:
* @out: a pointer to an array of bytes to store the UTF-8 result
* @outlen: the length of @out
* @in: a pointer to an array of chars in the original encoding
* @inlen: the length of @in
*
* Take a block of chars in the original encoding and try to convert
* it to an UTF-8 block of chars out.
*
* Returns the number of bytes written, -1 if lack of space, or -2
* if the transcoding failed.
* The value of @inlen after return is the number of octets consumed
* if the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of octets consumed.
*/
typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/**
* xmlCharEncodingOutputFunc:
* @out: a pointer to an array of bytes to store the result
* @outlen: the length of @out
* @in: a pointer to an array of UTF-8 chars
* @inlen: the length of @in
*
* Take a block of UTF-8 chars in and try to convert it to another
* encoding.
* Note: a first call designed to produce heading info is called with
* in = NULL. If stateful this should also initialize the encoder state.
*
* Returns the number of bytes written, -1 if lack of space, or -2
* if the transcoding failed.
* The value of @inlen after return is the number of octets consumed
* if the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of octets produced.
*/
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/*
* Block defining the handlers for non UTF-8 encodings.
* If iconv is supported, there are two extra fields.
*/
#ifdef LIBXML_ICU_ENABLED
struct _uconv_t {
UConverter *uconv; /* for conversion between an encoding and UTF-16 */
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
};
typedef struct _uconv_t uconv_t;
#endif
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
struct _xmlCharEncodingHandler {
char *name;
xmlCharEncodingInputFunc input;
xmlCharEncodingOutputFunc output;
#ifdef LIBXML_ICONV_ENABLED
iconv_t iconv_in;
iconv_t iconv_out;
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
uconv_t *uconv_in;
uconv_t *uconv_out;
#endif /* LIBXML_ICU_ENABLED */
};
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Interfaces for encoding handlers.
*/
XMLPUBFUN void XMLCALL
xmlInitCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
xmlCleanupCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlGetCharEncodingHandler (xmlCharEncoding enc);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlFindCharEncodingHandler (const char *name);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlNewCharEncodingHandler (const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output);
/*
* Interfaces for encoding names and aliases.
*/
XMLPUBFUN int XMLCALL
xmlAddEncodingAlias (const char *name,
const char *alias);
XMLPUBFUN int XMLCALL
xmlDelEncodingAlias (const char *alias);
XMLPUBFUN const char * XMLCALL
xmlGetEncodingAlias (const char *alias);
XMLPUBFUN void XMLCALL
xmlCleanupEncodingAliases (void);
XMLPUBFUN xmlCharEncoding XMLCALL
xmlParseCharEncoding (const char *name);
XMLPUBFUN const char * XMLCALL
xmlGetCharEncodingName (xmlCharEncoding enc);
/*
* Interfaces directly used by the parsers.
*/
XMLPUBFUN xmlCharEncoding XMLCALL
xmlDetectCharEncoding (const unsigned char *in,
int len);
XMLPUBFUN int XMLCALL
xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncInFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
/*
* Export a few useful functions
*/
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
UTF8Toisolat1 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
isolat1ToUTF8 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHAR_ENCODING_H__ */
/*
* Summary: implementation of the Relax-NG validation
* Description: implementation of the Relax-NG validation
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_RELAX_NG__
#define __XML_RELAX_NG__
#include <libxml/xmlversion.h>
#include <libxml/hash.h>
#include <libxml/xmlstring.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlRelaxNG xmlRelaxNG;
typedef xmlRelaxNG *xmlRelaxNGPtr;
/**
* xmlRelaxNGValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlRelaxNGValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context
*/
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
/*
* xmlRelaxNGValidErr:
*
* List of possible Relax NG validation errors
*/
typedef enum {
XML_RELAXNG_OK = 0,
XML_RELAXNG_ERR_MEMORY,
XML_RELAXNG_ERR_TYPE,
XML_RELAXNG_ERR_TYPEVAL,
XML_RELAXNG_ERR_DUPID,
XML_RELAXNG_ERR_TYPECMP,
XML_RELAXNG_ERR_NOSTATE,
XML_RELAXNG_ERR_NODEFINE,
XML_RELAXNG_ERR_LISTEXTRA,
XML_RELAXNG_ERR_LISTEMPTY,
XML_RELAXNG_ERR_INTERNODATA,
XML_RELAXNG_ERR_INTERSEQ,
XML_RELAXNG_ERR_INTEREXTRA,
XML_RELAXNG_ERR_ELEMNAME,
XML_RELAXNG_ERR_ATTRNAME,
XML_RELAXNG_ERR_ELEMNONS,
XML_RELAXNG_ERR_ATTRNONS,
XML_RELAXNG_ERR_ELEMWRONGNS,
XML_RELAXNG_ERR_ATTRWRONGNS,
XML_RELAXNG_ERR_ELEMEXTRANS,
XML_RELAXNG_ERR_ATTREXTRANS,
XML_RELAXNG_ERR_ELEMNOTEMPTY,
XML_RELAXNG_ERR_NOELEM,
XML_RELAXNG_ERR_NOTELEM,
XML_RELAXNG_ERR_ATTRVALID,
XML_RELAXNG_ERR_CONTENTVALID,
XML_RELAXNG_ERR_EXTRACONTENT,
XML_RELAXNG_ERR_INVALIDATTR,
XML_RELAXNG_ERR_DATAELEM,
XML_RELAXNG_ERR_VALELEM,
XML_RELAXNG_ERR_LISTELEM,
XML_RELAXNG_ERR_DATATYPE,
XML_RELAXNG_ERR_VALUE,
XML_RELAXNG_ERR_LIST,
XML_RELAXNG_ERR_NOGRAMMAR,
XML_RELAXNG_ERR_EXTRADATA,
XML_RELAXNG_ERR_LACKDATA,
XML_RELAXNG_ERR_INTERNAL,
XML_RELAXNG_ERR_ELEMWRONG,
XML_RELAXNG_ERR_TEXTWRONG
} xmlRelaxNGValidErr;
/*
* xmlRelaxNGParserFlags:
*
* List of possible Relax NG Parser flags
*/
typedef enum {
XML_RELAXNGP_NONE = 0,
XML_RELAXNGP_FREE_DOC = 1,
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag;
XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes (void);
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewParserCtxt (const char *URL);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
int flag);
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserStructuredErrors(
xmlRelaxNGParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN xmlRelaxNGPtr XMLCALL
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGFree (xmlRelaxNGPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlRelaxNGDump (FILE *output,
xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNGPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, void *ctx);
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc);
/*
* Interfaces for progressive validation when possible
*/
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_RELAX_NG__ */
/*
* Summary: compile-time version informations
* Description: compile-time version informations for the XML library
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VERSION_H__
#define __XML_VERSION_H__
#include <libxml/xmlexports.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* use those to be sure nothing nasty will happen if
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
* LIBXML_DOTTED_VERSION:
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.9.7"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 20907
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "20907"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
*/
#define LIBXML_VERSION_EXTRA ""
/**
* LIBXML_TEST_VERSION:
*
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(20907);
#ifndef VMS
#if 0
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO
#else
/**
* WITHOUT_TRIO:
*
* defined if the trio support should not be configured in
*/
#define WITHOUT_TRIO
#endif
#else /* VMS */
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO 1
#endif /* VMS */
/**
* LIBXML_THREAD_ENABLED:
*
* Whether the thread support is configured in
*/
#if 1
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
#endif
#endif
/**
* LIBXML_THREAD_ALLOC_ENABLED:
*
* Whether the allocation hooks are per-thread
*/
#if 0
#define LIBXML_THREAD_ALLOC_ENABLED
#endif
/**
* LIBXML_TREE_ENABLED:
*
* Whether the DOM like tree manipulation API support is configured in
*/
#if 1
#define LIBXML_TREE_ENABLED
#endif
/**
* LIBXML_OUTPUT_ENABLED:
*
* Whether the serialization/saving support is configured in
*/
#if 1
#define LIBXML_OUTPUT_ENABLED
#endif
/**
* LIBXML_PUSH_ENABLED:
*
* Whether the push parsing interfaces are configured in
*/
#if 1
#define LIBXML_PUSH_ENABLED
#endif
/**
* LIBXML_READER_ENABLED:
*
* Whether the xmlReader parsing interface is configured in
*/
#if 1
#define LIBXML_READER_ENABLED
#endif
/**
* LIBXML_PATTERN_ENABLED:
*
* Whether the xmlPattern node selection interface is configured in
*/
#if 1
#define LIBXML_PATTERN_ENABLED
#endif
/**
* LIBXML_WRITER_ENABLED:
*
* Whether the xmlWriter saving interface is configured in
*/
#if 1
#define LIBXML_WRITER_ENABLED
#endif
/**
* LIBXML_SAX1_ENABLED:
*
* Whether the older SAX1 interface is configured in
*/
#if 1
#define LIBXML_SAX1_ENABLED
#endif
/**
* LIBXML_FTP_ENABLED:
*
* Whether the FTP support is configured in
*/
#if 1
#define LIBXML_FTP_ENABLED
#endif
/**
* LIBXML_HTTP_ENABLED:
*
* Whether the HTTP support is configured in
*/
#if 1
#define LIBXML_HTTP_ENABLED
#endif
/**
* LIBXML_VALID_ENABLED:
*
* Whether the DTD validation support is configured in
*/
#if 1
#define LIBXML_VALID_ENABLED
#endif
/**
* LIBXML_HTML_ENABLED:
*
* Whether the HTML support is configured in
*/
#if 1
#define LIBXML_HTML_ENABLED
#endif
/**
* LIBXML_LEGACY_ENABLED:
*
* Whether the deprecated APIs are compiled in for compatibility
*/
#if 1
#define LIBXML_LEGACY_ENABLED
#endif
/**
* LIBXML_C14N_ENABLED:
*
* Whether the Canonicalization support is configured in
*/
#if 1
#define LIBXML_C14N_ENABLED
#endif
/**
* LIBXML_CATALOG_ENABLED:
*
* Whether the Catalog support is configured in
*/
#if 1
#define LIBXML_CATALOG_ENABLED
#endif
/**
* LIBXML_DOCB_ENABLED:
*
* Whether the SGML Docbook support is configured in
*/
#if 1
#define LIBXML_DOCB_ENABLED
#endif
/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
*/
#if 1
#define LIBXML_XPATH_ENABLED
#endif
/**
* LIBXML_XPTR_ENABLED:
*
* Whether XPointer is configured in
*/
#if 1
#define LIBXML_XPTR_ENABLED
#endif
/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
*/
#if 1
#define LIBXML_XINCLUDE_ENABLED
#endif
/**
* LIBXML_ICONV_ENABLED:
*
* Whether iconv support is available
*/
#if 1
#define LIBXML_ICONV_ENABLED
#endif
/**
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
*/
#if 0
#define LIBXML_ICU_ENABLED
#endif
/**
* LIBXML_ISO8859X_ENABLED:
*
* Whether ISO-8859-* support is made available in case iconv is not
*/
#if 1
#define LIBXML_ISO8859X_ENABLED
#endif
/**
* LIBXML_DEBUG_ENABLED:
*
* Whether Debugging module is configured in
*/
#if 1
#define LIBXML_DEBUG_ENABLED
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* Whether the memory debugging is configured in
*/
#if 0
#define DEBUG_MEMORY_LOCATION
#endif
/**
* LIBXML_DEBUG_RUNTIME:
*
* Whether the runtime debugging is configured in
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
#endif
/**
* LIBXML_UNICODE_ENABLED:
*
* Whether the Unicode related interfaces are compiled in
*/
#if 1
#define LIBXML_UNICODE_ENABLED
#endif
/**
* LIBXML_REGEXP_ENABLED:
*
* Whether the regular expressions interfaces are compiled in
*/
#if 1
#define LIBXML_REGEXP_ENABLED
#endif
/**
* LIBXML_AUTOMATA_ENABLED:
*
* Whether the automata interfaces are compiled in
*/
#if 1
#define LIBXML_AUTOMATA_ENABLED
#endif
/**
* LIBXML_EXPR_ENABLED:
*
* Whether the formal expressions interfaces are compiled in
*/
#if 1
#define LIBXML_EXPR_ENABLED
#endif
/**
* LIBXML_SCHEMAS_ENABLED:
*
* Whether the Schemas validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMAS_ENABLED
#endif
/**
* LIBXML_SCHEMATRON_ENABLED:
*
* Whether the Schematron validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMATRON_ENABLED
#endif
/**
* LIBXML_MODULES_ENABLED:
*
* Whether the module interfaces are compiled in
*/
#if 1
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
*
* the string suffix used by dynamic modules (usually shared libraries)
*/
#define LIBXML_MODULE_EXTENSION ".so"
#endif
/**
* LIBXML_ZLIB_ENABLED:
*
* Whether the Zlib support is compiled in
*/
#if 1
#define LIBXML_ZLIB_ENABLED
#endif
/**
* LIBXML_LZMA_ENABLED:
*
* Whether the Lzma support is compiled in
*/
#if 1
#define LIBXML_LZMA_ENABLED
#endif
#ifdef __GNUC__
#ifdef HAVE_ANSIDECL_H
#include <ansidecl.h>
#endif
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
# define ATTRIBUTE_UNUSED __attribute__((unused))
# else
# define ATTRIBUTE_UNUSED
# endif
#endif
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define LIBXML_ATTR_ALLOC_SIZE(x)
# endif
#else
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# else
# define LIBXML_ATTR_FORMAT(fmt,args)
# endif
#else
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#define ATTRIBUTE_UNUSED
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#define LIBXML_ATTR_ALLOC_SIZE(x)
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif /* __GNUC__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/*
* Summary: internals routines and limits exported by the parser.
* Description: this module exports a number of internal parsing routines
* they are not really all intended for applications but
* can prove useful doing low level processing.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PARSER_INTERNALS_H__
#define __XML_PARSER_INTERNALS_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/HTMLparser.h>
#include <libxml/chvalid.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlParserMaxDepth:
*
* arbitrary depth limit for the XML documents that we allow to
* process. This is not a limitation of the parser but a safety
* boundary feature, use XML_PARSE_HUGE option to override it.
*/
XMLPUBVAR unsigned int xmlParserMaxDepth;
/**
* XML_MAX_TEXT_LENGTH:
*
* Maximum size allowed for a single text node when building a tree.
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Introduced in 2.9.0
*/
#define XML_MAX_TEXT_LENGTH 10000000
/**
* XML_MAX_NAME_LENGTH:
*
* Maximum size allowed for a markup identitier
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Note that with the use of parsing dictionaries overriding the limit
* may result in more runtime memory usage in face of "unfriendly' content
* Introduced in 2.9.0
*/
#define XML_MAX_NAME_LENGTH 50000
/**
* XML_MAX_DICTIONARY_LIMIT:
*
* Maximum size allowed by the parser for a dictionary by default
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Introduced in 2.9.0
*/
#define XML_MAX_DICTIONARY_LIMIT 10000000
/**
* XML_MAX_LOOKUP_LIMIT:
*
* Maximum size allowed by the parser for ahead lookup
* This is an upper boundary enforced by the parser to avoid bad
* behaviour on "unfriendly' content
* Introduced in 2.9.0
*/
#define XML_MAX_LOOKUP_LIMIT 10000000
/**
* XML_MAX_NAMELEN:
*
* Identifiers can be longer, but this will be more costly
* at runtime.
*/
#define XML_MAX_NAMELEN 100
/**
* INPUT_CHUNK:
*
* The parser tries to always have that amount of input ready.
* One of the point is providing context when reporting errors.
*/
#define INPUT_CHUNK 250
/************************************************************************
* *
* UNICODE version of the macros. *
* *
************************************************************************/
/**
* IS_BYTE_CHAR:
* @c: an byte value (int)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20...]
* any byte character in the accepted range
*/
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
/**
* IS_CHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
* | [#x10000-#x10FFFF]
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
*/
#define IS_CHAR(c) xmlIsCharQ(c)
/**
* IS_CHAR_CH:
* @c: an xmlChar (usually an unsigned char)
*
* Behaves like IS_CHAR on single-byte value
*/
#define IS_CHAR_CH(c) xmlIsChar_ch(c)
/**
* IS_BLANK:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [3] S ::= (#x20 | #x9 | #xD | #xA)+
*/
#define IS_BLANK(c) xmlIsBlankQ(c)
/**
* IS_BLANK_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Behaviour same as IS_BLANK
*/
#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
/**
* IS_BASECHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [85] BaseChar ::= ... long list see REC ...
*/
#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
/**
* IS_DIGIT:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [88] Digit ::= ... long list see REC ...
*/
#define IS_DIGIT(c) xmlIsDigitQ(c)
/**
* IS_DIGIT_CH:
* @c: an xmlChar value (usually an unsigned char)
*
* Behaves like IS_DIGIT but with a single byte argument
*/
#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
/**
* IS_COMBINING:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [87] CombiningChar ::= ... long list see REC ...
*/
#define IS_COMBINING(c) xmlIsCombiningQ(c)
/**
* IS_COMBINING_CH:
* @c: an xmlChar (usually an unsigned char)
*
* Always false (all combining chars > 0xff)
*/
#define IS_COMBINING_CH(c) 0
/**
* IS_EXTENDER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
* [#x309D-#x309E] | [#x30FC-#x30FE]
*/
#define IS_EXTENDER(c) xmlIsExtenderQ(c)
/**
* IS_EXTENDER_CH:
* @c: an xmlChar value (usually an unsigned char)
*
* Behaves like IS_EXTENDER but with a single-byte argument
*/
#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
/**
* IS_IDEOGRAPHIC:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
*/
#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
/**
* IS_LETTER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [84] Letter ::= BaseChar | Ideographic
*/
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
/**
* IS_LETTER_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Macro behaves like IS_LETTER, but only check base chars
*
*/
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
/**
* IS_ASCII_LETTER:
* @c: an xmlChar value
*
* Macro to check [a-zA-Z]
*
*/
#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)))
/**
* IS_ASCII_DIGIT:
* @c: an xmlChar value
*
* Macro to check [0-9]
*
*/
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
/**
* IS_PUBIDCHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
*/
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
/**
* IS_PUBIDCHAR_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Same as IS_PUBIDCHAR but for single-byte value
*/
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/**
* SKIP_EOL:
* @p: and UTF8 string pointer
*
* Skips the end of line chars.
*/
#define SKIP_EOL(p) \
if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
/**
* MOVETO_ENDTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '>' char.
*/
#define MOVETO_ENDTAG(p) \
while ((*p) && (*(p) != '>')) (p)++
/**
* MOVETO_STARTTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '<' char.
*/
#define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++
/**
* Global variables used for predefined strings.
*/
XMLPUBVAR const xmlChar xmlStringText[];
XMLPUBVAR const xmlChar xmlStringTextNoenc[];
XMLPUBVAR const xmlChar xmlStringComment[];
/*
* Function to finish the work of the macros where needed.
*/
XMLPUBFUN int XMLCALL xmlIsLetter (int c);
/**
* Parser context.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateFileParserCtxt (const char *filename);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateURLParserCtxt (const char *filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,
const xmlChar *base);
XMLPUBFUN int XMLCALL
xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler);
XMLPUBFUN int XMLCALL
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler);
#ifdef IN_LIBXML
/* internal error reporting */
XMLPUBFUN void XMLCALL
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
xmlParserErrors xmlerr,
const char *msg,
const xmlChar * str1,
const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
#endif
/**
* Input Streams.
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar *buffer);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
XMLPUBFUN int XMLCALL
xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input);
XMLPUBFUN xmlChar XMLCALL
xmlPopInput (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlFreeInputStream (xmlParserInputPtr input);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputStream (xmlParserCtxtPtr ctxt);
/**
* Namespaces.
*/
XMLPUBFUN xmlChar * XMLCALL
xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlChar **prefix);
/**
* Generic production rules.
*/
XMLPUBFUN const xmlChar * XMLCALL
xmlParseName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseNmtoken (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar **orig);
XMLPUBFUN xmlChar * XMLCALL
xmlParseAttValue (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata);
XMLPUBFUN xmlChar * XMLCALL
xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar **publicID,
int strict);
XMLPUBFUN void XMLCALL
xmlParseComment (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
xmlParsePITarget (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParsePI (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseNotationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN int XMLCALL
xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN void XMLCALL
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementMixedContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementChildrenContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN int XMLCALL
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlElementContentPtr *result);
XMLPUBFUN int XMLCALL
xmlParseElementDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseCharRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlParseEntityRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParsePEReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN const xmlChar * XMLCALL
xmlParseStartTag (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseEndTag (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN void XMLCALL
xmlParseCDSect (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseContent (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseElement (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionNum (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseEncName (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseSDDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseTextDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseMisc (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* XML_SUBSTITUTE_NONE:
*
* If no entities need to be substituted.
*/
#define XML_SUBSTITUTE_NONE 0
/**
* XML_SUBSTITUTE_REF:
*
* Whether general entities need to be substituted.
*/
#define XML_SUBSTITUTE_REF 1
/**
* XML_SUBSTITUTE_PEREF:
*
* Whether parameter entities need to be substituted.
*/
#define XML_SUBSTITUTE_PEREF 2
/**
* XML_SUBSTITUTE_BOTH:
*
* Both general and parameter entities need to be substituted.
*/
#define XML_SUBSTITUTE_BOTH 3
XMLPUBFUN xmlChar * XMLCALL
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN xmlChar * XMLCALL
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
/*
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
*/
XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
xmlNodePtr value);
XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
const xmlChar *value);
/*
* other commodities shared between parser.c and parserInternals.
*/
XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
int *len);
XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
/*
* Really core function shared with HTML parser.
*/
XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
int val);
XMLPUBFUN int XMLCALL xmlCopyChar (int len,
xmlChar *out,
int val);
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff.
*/
XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
#endif
/*
* Specific function to keep track of entities references
* and used by the XSLT debugger.
*/
#ifdef LIBXML_LEGACY_ENABLED
/**
* xmlEntityReferenceFunc:
* @ent: the entity
* @firstNode: the fist node in the chunk
* @lastNode: the last nod in the chunk
*
* Callback function used when one needs to be able to track back the
* provenance of a chunk of nodes inherited from an entity replacement.
*/
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
xmlNodePtr firstNode,
xmlNodePtr lastNode);
XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
XMLPUBFUN xmlChar * XMLCALL
xmlParseQuotedString (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseNamespace (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlScanName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar **prefix);
/**
* Entities
*/
XMLPUBFUN xmlChar * XMLCALL
xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN void XMLCALL
xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef IN_LIBXML
/*
* internal only
*/
XMLPUBFUN void XMLCALL
xmlErrMemory (xmlParserCtxtPtr ctxt,
const char *extra);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_PARSER_INTERNALS_H__ */
/**
* Summary: library of generic URI related routines
* Description: library of generic URI related routines
* Implements RFC 2396
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_URI_H__
#define __XML_URI_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlURI:
*
* A parsed URI reference. This is a struct containing the various fields
* as described in RFC 2396 but separated for further processing.
*
* Note: query is a deprecated field which is incorrectly unescaped.
* query_raw takes precedence over query if the former is set.
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
*/
typedef struct _xmlURI xmlURI;
typedef xmlURI *xmlURIPtr;
struct _xmlURI {
char *scheme; /* the URI scheme */
char *opaque; /* opaque part */
char *authority; /* the authority part */
char *server; /* the server part */
char *user; /* the user part */
int port; /* the port number */
char *path; /* the path string */
char *query; /* the query string (deprecated - use with caution) */
char *fragment; /* the fragment identifier */
int cleanup; /* parsing potentially unclean URI */
char *query_raw; /* the query string (as it appears in the URI) */
};
/*
* This function is in tree.h:
* xmlChar * xmlNodeGetBase (xmlDocPtr doc,
* xmlNodePtr cur);
*/
XMLPUBFUN xmlURIPtr XMLCALL
xmlCreateURI (void);
XMLPUBFUN xmlChar * XMLCALL
xmlBuildURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlChar * XMLCALL
xmlBuildRelativeURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURI (const char *str);
XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURIRaw (const char *str,
int raw);
XMLPUBFUN int XMLCALL
xmlParseURIReference (xmlURIPtr uri,
const char *str);
XMLPUBFUN xmlChar * XMLCALL
xmlSaveUri (xmlURIPtr uri);
XMLPUBFUN void XMLCALL
xmlPrintURI (FILE *stream,
xmlURIPtr uri);
XMLPUBFUN xmlChar * XMLCALL
xmlURIEscapeStr (const xmlChar *str,
const xmlChar *list);
XMLPUBFUN char * XMLCALL
xmlURIUnescapeString (const char *str,
int len,
char *target);
XMLPUBFUN int XMLCALL
xmlNormalizeURIPath (char *path);
XMLPUBFUN xmlChar * XMLCALL
xmlURIEscape (const xmlChar *str);
XMLPUBFUN void XMLCALL
xmlFreeURI (xmlURIPtr uri);
XMLPUBFUN xmlChar* XMLCALL
xmlCanonicPath (const xmlChar *path);
XMLPUBFUN xmlChar* XMLCALL
xmlPathToURI (const xmlChar *path);
#ifdef __cplusplus
}
#endif
#endif /* __XML_URI_H__ */
/*
* Summary: XML Schemastron implementation
* Description: interface to the XML Schematron validity checking.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMATRON_H__
#define __XML_SCHEMATRON_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMATRON_ENABLED
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */
XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
} xmlSchematronValidOptions;
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchematron xmlSchematron;
typedef xmlSchematron *xmlSchematronPtr;
/**
* xmlSchematronValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from a Schematron validation
*/
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
/**
* xmlSchematronValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from a Schematron validation
*/
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
/**
* A schemas validation context
*/
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewMemParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
/*****
XMLPUBFUN void XMLCALL
xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc * err,
xmlSchematronValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
*****/
XMLPUBFUN xmlSchematronPtr XMLCALL
xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchematronFree (xmlSchematronPtr schema);
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchematronSetValidStructuredErrors(
xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
/******
XMLPUBFUN void XMLCALL
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc *err,
xmlSchematronValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
xmlNodePtr elem);
*******/
XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options);
XMLPUBFUN void XMLCALL
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMATRON_ENABLED */
#endif /* __XML_SCHEMATRON_H__ */
/*
* Summary: Unicode character range checking
* Description: this module exports interfaces for the character
* range validation APIs
*
* This file is automatically generated from the cvs source
* definition files using the genChRanges.py Python script
*
* Generation date: Mon Mar 27 11:09:48 2006
* Sources: chvalid.def
* Author: William Brack <wbrack@mmm.com.hk>
*/
#ifndef __XML_CHVALID_H__
#define __XML_CHVALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define our typedefs and structures
*
*/
typedef struct _xmlChSRange xmlChSRange;
typedef xmlChSRange *xmlChSRangePtr;
struct _xmlChSRange {
unsigned short low;
unsigned short high;
};
typedef struct _xmlChLRange xmlChLRange;
typedef xmlChLRange *xmlChLRangePtr;
struct _xmlChLRange {
unsigned int low;
unsigned int high;
};
typedef struct _xmlChRangeGroup xmlChRangeGroup;
typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup {
int nbShortRange;
int nbLongRange;
const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange;
};
/**
* Range checking routine
*/
XMLPUBFUN int XMLCALL
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
/**
* xmlIsBaseChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)) || \
((0xc0 <= (c)) && ((c) <= 0xd6)) || \
((0xd8 <= (c)) && ((c) <= 0xf6)) || \
(0xf8 <= (c)))
/**
* xmlIsBaseCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
xmlIsBaseChar_ch((c)) : \
xmlCharInRange((c), &xmlIsBaseCharGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
/**
* xmlIsBlank_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBlank_ch(c) (((c) == 0x20) || \
((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd))
/**
* xmlIsBlankQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBlankQ(c) (((c) < 0x100) ? \
xmlIsBlank_ch((c)) : 0)
/**
* xmlIsChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd) || \
(0x20 <= (c)))
/**
* xmlIsCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsCharQ(c) (((c) < 0x100) ? \
xmlIsChar_ch((c)) :\
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
/**
* xmlIsCombiningQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \
0 : \
xmlCharInRange((c), &xmlIsCombiningGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
/**
* xmlIsDigit_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
/**
* xmlIsDigitQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsDigitQ(c) (((c) < 0x100) ? \
xmlIsDigit_ch((c)) : \
xmlCharInRange((c), &xmlIsDigitGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
/**
* xmlIsExtender_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsExtender_ch(c) (((c) == 0xb7))
/**
* xmlIsExtenderQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \
xmlIsExtender_ch((c)) : \
xmlCharInRange((c), &xmlIsExtenderGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
/**
* xmlIsIdeographicQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
0 :\
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
((c) == 0x3007) || \
((0x3021 <= (c)) && ((c) <= 0x3029))))
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
/**
* xmlIsPubidChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
/**
* xmlIsPubidCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
xmlIsPubidChar_ch((c)) : 0)
XMLPUBFUN int XMLCALL
xmlIsBaseChar(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsBlank(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsChar(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsCombining(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsDigit(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsExtender(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsIdeographic(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsPubidChar(unsigned int ch);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHVALID_H__ */
/*
* Summary: implementation of XInclude
* Description: API to handle XInclude processing,
* implements the
* World Wide Web Consortium Last Call Working Draft 10 November 2003
* http://www.w3.org/TR/2003/WD-xinclude-20031110
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XINCLUDE_H__
#define __XML_XINCLUDE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XINCLUDE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* XINCLUDE_NS:
*
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
*/
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
/**
* XINCLUDE_OLD_NS:
*
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
*/
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
/**
* XINCLUDE_NODE:
*
* Macro defining "include"
*/
#define XINCLUDE_NODE (const xmlChar *) "include"
/**
* XINCLUDE_FALLBACK:
*
* Macro defining "fallback"
*/
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
/**
* XINCLUDE_HREF:
*
* Macro defining "href"
*/
#define XINCLUDE_HREF (const xmlChar *) "href"
/**
* XINCLUDE_PARSE:
*
* Macro defining "parse"
*/
#define XINCLUDE_PARSE (const xmlChar *) "parse"
/**
* XINCLUDE_PARSE_XML:
*
* Macro defining "xml"
*/
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
/**
* XINCLUDE_PARSE_TEXT:
*
* Macro defining "text"
*/
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
/**
* XINCLUDE_PARSE_ENCODING:
*
* Macro defining "encoding"
*/
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
/**
* XINCLUDE_PARSE_XPOINTER:
*
* Macro defining "xpointer"
*/
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
/*
* standalone processing
*/
XMLPUBFUN int XMLCALL
xmlXIncludeProcess (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlags (xmlDocPtr doc,
int flags);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTree (xmlNodePtr tree);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
int flags);
/*
* contextual processing
*/
XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
xmlXIncludeNewContext (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
int flags);
XMLPUBFUN void XMLCALL
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
xmlNodePtr tree);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XINCLUDE_ENABLED */
#endif /* __XML_XINCLUDE_H__ */
/*
* Summary: the XMLReader implementation
* Description: API of the XML streaming API based on C# interfaces.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XMLREADER_H__
#define __XML_XMLREADER_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
#include <libxml/xmlschemas.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlParserSeverities:
*
* How severe an error callback is when the per-reader error callback API
* is used.
*/
typedef enum {
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
XML_PARSER_SEVERITY_WARNING = 3,
XML_PARSER_SEVERITY_ERROR = 4
} xmlParserSeverities;
#ifdef LIBXML_READER_ENABLED
/**
* xmlTextReaderMode:
*
* Internal state values for the reader.
*/
typedef enum {
XML_TEXTREADER_MODE_INITIAL = 0,
XML_TEXTREADER_MODE_INTERACTIVE = 1,
XML_TEXTREADER_MODE_ERROR = 2,
XML_TEXTREADER_MODE_EOF =3,
XML_TEXTREADER_MODE_CLOSED = 4,
XML_TEXTREADER_MODE_READING = 5
} xmlTextReaderMode;
/**
* xmlParserProperties:
*
* Some common options to use with xmlTextReaderSetParserProp, but it
* is better to use xmlParserOption and the xmlReaderNewxxx and
* xmlReaderForxxx APIs now.
*/
typedef enum {
XML_PARSER_LOADDTD = 1,
XML_PARSER_DEFAULTATTRS = 2,
XML_PARSER_VALIDATE = 3,
XML_PARSER_SUBST_ENTITIES = 4
} xmlParserProperties;
/**
* xmlReaderTypes:
*
* Predefined constants for the different types of nodes.
*/
typedef enum {
XML_READER_TYPE_NONE = 0,
XML_READER_TYPE_ELEMENT = 1,
XML_READER_TYPE_ATTRIBUTE = 2,
XML_READER_TYPE_TEXT = 3,
XML_READER_TYPE_CDATA = 4,
XML_READER_TYPE_ENTITY_REFERENCE = 5,
XML_READER_TYPE_ENTITY = 6,
XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
XML_READER_TYPE_COMMENT = 8,
XML_READER_TYPE_DOCUMENT = 9,
XML_READER_TYPE_DOCUMENT_TYPE = 10,
XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
XML_READER_TYPE_NOTATION = 12,
XML_READER_TYPE_WHITESPACE = 13,
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
XML_READER_TYPE_END_ELEMENT = 15,
XML_READER_TYPE_END_ENTITY = 16,
XML_READER_TYPE_XML_DECLARATION = 17
} xmlReaderTypes;
/**
* xmlTextReader:
*
* Structure for an xmlReader context.
*/
typedef struct _xmlTextReader xmlTextReader;
/**
* xmlTextReaderPtr:
*
* Pointer to an xmlReader context.
*/
typedef xmlTextReader *xmlTextReaderPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlNewTextReader (xmlParserInputBufferPtr input,
const char *URI);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlNewTextReaderFilename(const char *URI);
XMLPUBFUN void XMLCALL
xmlFreeTextReader (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderSetup(xmlTextReaderPtr reader,
xmlParserInputBufferPtr input, const char *URL,
const char *encoding, int options);
/*
* Iterators
*/
XMLPUBFUN int XMLCALL
xmlTextReaderRead (xmlTextReaderPtr reader);
#ifdef LIBXML_WRITER_ENABLED
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader);
#endif
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadString (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader);
/*
* Attributes of the node
*/
XMLPUBFUN int XMLCALL
xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderDepth (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderHasValue(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsDefault (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNodeType (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderReadState (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstPrefix (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstString (xmlTextReaderPtr reader,
const xmlChar *str);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstValue (xmlTextReaderPtr reader);
/*
* use the Const version of the routine for
* better performance and simpler code
*/
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLocalName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderPrefix (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderValue (xmlTextReaderPtr reader);
/*
* Methods of the XmlTextReader
*/
XMLPUBFUN int XMLCALL
xmlTextReaderClose (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
int no);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlTextReaderGetRemainder (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
const xmlChar *prefix);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
int no);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToElement (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNormalization (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstEncoding (xmlTextReaderPtr reader);
/*
* Extensions
*/
XMLPUBFUN int XMLCALL
xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
int prop,
int value);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
int prop);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderPreserve (xmlTextReaderPtr reader);
#ifdef LIBXML_PATTERN_ENABLED
XMLPUBFUN int XMLCALL
xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
const xmlChar *pattern,
const xmlChar **namespaces);
#endif /* LIBXML_PATTERN_ENABLED */
XMLPUBFUN xmlDocPtr XMLCALL
xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderExpand (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNext (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsValid (xmlTextReaderPtr reader);
#ifdef LIBXML_SCHEMAS_ENABLED
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
const char *rng);
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader,
xmlRelaxNGValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
xmlRelaxNGPtr schema);
XMLPUBFUN int XMLCALL
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
const char *xsd);
XMLPUBFUN int XMLCALL
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlTextReaderSetSchema (xmlTextReaderPtr reader,
xmlSchemaPtr schema);
#endif
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderStandalone (xmlTextReaderPtr reader);
/*
* Index lookup
*/
XMLPUBFUN long XMLCALL
xmlTextReaderByteConsumed (xmlTextReaderPtr reader);
/*
* New more complete APIs for simpler creation and reuse of readers
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderWalker (xmlDocPtr doc);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForDoc (const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFile (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewWalker (xmlTextReaderPtr reader,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFile (xmlTextReaderPtr reader,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewMemory (xmlTextReaderPtr reader,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/*
* Error handling extensions
*/
typedef void * xmlTextReaderLocatorPtr;
/**
* xmlTextReaderErrorFunc:
* @arg: the user argument
* @msg: the message
* @severity: the severity of the error
* @locator: a locator indicating where the error occurred
*
* Signature of an error callback from a reader parser
*/
typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg,
const char *msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator);
XMLPUBFUN int XMLCALL
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
XMLPUBFUN void XMLCALL
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc *f,
void **arg);
#endif /* LIBXML_READER_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_XMLREADER_H__ */
/*
* Summary: interface for all global variables of the library
* Description: all the global variables and thread handling for
* those variables is handled by this module.
*
* The bottom of this file is automatically generated by build_glob.py
* based on the description file global.data
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard
*/
#ifndef __XML_GLOBALS_H
#define __XML_GLOBALS_H
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/SAX.h>
#include <libxml/SAX2.h>
#include <libxml/xmlmemory.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitGlobals(void);
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
/**
* xmlParserInputBufferCreateFilenameFunc:
* @URI: the URI to read from
* @enc: the requested source encoding
*
* Signature for the function doing the lookup for a suitable input method
* corresponding to an URI.
*
* Returns the new xmlParserInputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI,
xmlCharEncoding enc);
/**
* xmlOutputBufferCreateFilenameFunc:
* @URI: the URI to write to
* @enc: the requested target encoding
*
* Signature for the function doing the lookup for a suitable output method
* corresponding to an URI.
*
* Returns the new xmlOutputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
/*
* Externally global symbols which need to be protected for backwards
* compatibility support.
*/
#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlFree
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlMalloc
#undef xmlMallocAtomic
#undef xmlMemStrdup
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlLastError
#undef xmlParserInputBufferCreateFilenameValue
#undef xmlOutputBufferCreateFilenameValue
/**
* xmlRegisterNodeFunc:
* @node: the current node
*
* Signature for the registration callback of a created node
*/
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
/**
* xmlDeregisterNodeFunc:
* @node: the current node
*
* Signature for the deregistration callback of a discarded node
*/
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
{
const char *xmlParserVersion;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandlerV1 xmlDefaultSAXHandler;
xmlSAXHandlerV1 docbDefaultSAXHandler;
xmlSAXHandlerV1 htmlDefaultSAXHandler;
xmlFreeFunc xmlFree;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
xmlReallocFunc xmlRealloc;
xmlGenericErrorFunc xmlGenericError;
xmlStructuredErrorFunc xmlStructuredError;
void *xmlGenericErrorContext;
int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme;
int xmlDefaultBufferSize;
int xmlSubstituteEntitiesDefaultValue;
int xmlDoValidityCheckingDefaultValue;
int xmlGetWarningsDefaultValue;
int xmlKeepBlanksDefaultValue;
int xmlLineNumbersDefaultValue;
int xmlLoadExtDtdDefaultValue;
int xmlParserDebugEntities;
int xmlPedanticParserDefaultValue;
int xmlSaveNoEmptyTags;
int xmlIndentTreeOutput;
const char *xmlTreeIndentString;
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
xmlMallocFunc xmlMallocAtomic;
xmlError xmlLastError;
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
void *xmlStructuredErrorContext;
};
#ifdef __cplusplus
}
#endif
#include <libxml/threads.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs);
XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlMallocAtomic
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
XMLPUBVAR xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
#define xmlMallocAtomic \
(*(__xmlMallocAtomic()))
#else
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
XMLPUBVAR xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
XMLPUBVAR xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
XMLPUBVAR xmlReallocFunc xmlRealloc;
XMLPUBVAR xmlFreeFunc xmlFree;
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define docbDefaultSAXHandler \
(*(__docbDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
#endif
#endif
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLastError \
(*(__xmlLastError()))
#else
XMLPUBVAR xmlError xmlLastError;
#endif
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
* Do not modify the previous line.
*/
XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
#ifdef LIBXML_THREAD_ENABLED
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
XMLPUBVAR int oldXMLWDcompatibility;
#endif
XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
XMLPUBFUN xmlBufferAllocationScheme XMLCALL
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
XMLPUBVAR int xmlDefaultBufferSize;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif
XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
#endif
XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericError \
(*(__xmlGenericError()))
#else
XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
#endif
XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredError \
(*(__xmlStructuredError()))
#else
XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
#endif
XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
#else
XMLPUBVAR void * xmlGenericErrorContext;
#endif
XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredErrorContext \
(*(__xmlStructuredErrorContext()))
#else
XMLPUBVAR void * xmlStructuredErrorContext;
#endif
XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
XMLPUBVAR int xmlGetWarningsDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
XMLPUBVAR int xmlIndentTreeOutput;
#endif
XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlTreeIndentString \
(*(__xmlTreeIndentString()))
#else
XMLPUBVAR const char * xmlTreeIndentString;
#endif
XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
XMLPUBVAR int xmlKeepBlanksDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
XMLPUBVAR int xmlLineNumbersDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
XMLPUBVAR int xmlLoadExtDtdDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
XMLPUBVAR int xmlParserDebugEntities;
#endif
XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserVersion \
(*(__xmlParserVersion()))
#else
XMLPUBVAR const char * xmlParserVersion;
#endif
XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
XMLPUBVAR int xmlPedanticParserDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
XMLPUBVAR int xmlSaveNoEmptyTags;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlRegisterNodeDefaultValue \
(*(__xmlRegisterNodeDefaultValue()))
#else
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
#endif
XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDeregisterNodeDefaultValue \
(*(__xmlDeregisterNodeDefaultValue()))
#else
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
#endif
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
__xmlParserInputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserInputBufferCreateFilenameValue \
(*(__xmlParserInputBufferCreateFilenameValue()))
#else
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
#endif
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlOutputBufferCreateFilenameValue \
(*(__xmlOutputBufferCreateFilenameValue()))
#else
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_GLOBALS_H */
/*
* Summary: Unicode character APIs
* Description: API for the Unicode character APIs
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html
* using the genUnicode.py Python script.
*
* Generation date: Mon Mar 27 11:09:52 2006
* Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt
* Author: Daniel Veillard
*/
#ifndef __XML_UNICODE_H__
#define __XML_UNICODE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code);
XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code);
XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLao (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code);
XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code);
XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTags (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThai (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code);
XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block);
XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */
/*
* Summary: XML Path Language implementation
* Description: API for the XML Path Language implementation
*
* XML Path Language implementation
* XPath is a language for addressing parts of an XML document,
* designed to be used by both XSLT and XPointer
* http://www.w3.org/TR/xpath
*
* Implements
* W3C Recommendation 16 November 1999
* http://www.w3.org/TR/1999/REC-xpath-19991116
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPATH_H__
#define __XML_XPATH_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPATH_ENABLED
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/hash.h>
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
#ifdef __cplusplus
extern "C" {
#endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_XPATH_ENABLED
typedef struct _xmlXPathContext xmlXPathContext;
typedef xmlXPathContext *xmlXPathContextPtr;
typedef struct _xmlXPathParserContext xmlXPathParserContext;
typedef xmlXPathParserContext *xmlXPathParserContextPtr;
/**
* The set of XPath error codes.
*/
typedef enum {
XPATH_EXPRESSION_OK = 0,
XPATH_NUMBER_ERROR,
XPATH_UNFINISHED_LITERAL_ERROR,
XPATH_START_LITERAL_ERROR,
XPATH_VARIABLE_REF_ERROR,
XPATH_UNDEF_VARIABLE_ERROR,
XPATH_INVALID_PREDICATE_ERROR,
XPATH_EXPR_ERROR,
XPATH_UNCLOSED_ERROR,
XPATH_UNKNOWN_FUNC_ERROR,
XPATH_INVALID_OPERAND,
XPATH_INVALID_TYPE,
XPATH_INVALID_ARITY,
XPATH_INVALID_CTXT_SIZE,
XPATH_INVALID_CTXT_POSITION,
XPATH_MEMORY_ERROR,
XPTR_SYNTAX_ERROR,
XPTR_RESOURCE_ERROR,
XPTR_SUB_RESOURCE_ERROR,
XPATH_UNDEF_PREFIX_ERROR,
XPATH_ENCODING_ERROR,
XPATH_INVALID_CHAR_ERROR,
XPATH_INVALID_CTXT,
XPATH_STACK_ERROR,
XPATH_FORBID_VARIABLE_ERROR
} xmlXPathError;
/*
* A node-set (an unordered collection of nodes without duplicates).
*/
typedef struct _xmlNodeSet xmlNodeSet;
typedef xmlNodeSet *xmlNodeSetPtr;
struct _xmlNodeSet {
int nodeNr; /* number of nodes in the set */
int nodeMax; /* size of the array as allocated */
xmlNodePtr *nodeTab; /* array of nodes in no particular order */
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
};
/*
* An expression is evaluated to yield an object, which
* has one of the following four basic types:
* - node-set
* - boolean
* - number
* - string
*
* @@ XPointer will add more types !
*/
typedef enum {
XPATH_UNDEFINED = 0,
XPATH_NODESET = 1,
XPATH_BOOLEAN = 2,
XPATH_NUMBER = 3,
XPATH_STRING = 4,
XPATH_POINT = 5,
XPATH_RANGE = 6,
XPATH_LOCATIONSET = 7,
XPATH_USERS = 8,
XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
} xmlXPathObjectType;
typedef struct _xmlXPathObject xmlXPathObject;
typedef xmlXPathObject *xmlXPathObjectPtr;
struct _xmlXPathObject {
xmlXPathObjectType type;
xmlNodeSetPtr nodesetval;
int boolval;
double floatval;
xmlChar *stringval;
void *user;
int index;
void *user2;
int index2;
};
/**
* xmlXPathConvertFunc:
* @obj: an XPath object
* @type: the number of the target type
*
* A conversion function is associated to a type and used to cast
* the new type to primitive values.
*
* Returns -1 in case of error, 0 otherwise
*/
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
/*
* Extra type: a name and a conversion function.
*/
typedef struct _xmlXPathType xmlXPathType;
typedef xmlXPathType *xmlXPathTypePtr;
struct _xmlXPathType {
const xmlChar *name; /* the type name */
xmlXPathConvertFunc func; /* the conversion function */
};
/*
* Extra variable: a name and a value.
*/
typedef struct _xmlXPathVariable xmlXPathVariable;
typedef xmlXPathVariable *xmlXPathVariablePtr;
struct _xmlXPathVariable {
const xmlChar *name; /* the variable name */
xmlXPathObjectPtr value; /* the value */
};
/**
* xmlXPathEvalFunc:
* @ctxt: an XPath parser context
* @nargs: the number of arguments passed to the function
*
* An XPath evaluation function, the parameters are on the XPath context stack.
*/
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
int nargs);
/*
* Extra function: a name and a evaluation function.
*/
typedef struct _xmlXPathFunct xmlXPathFunct;
typedef xmlXPathFunct *xmlXPathFuncPtr;
struct _xmlXPathFunct {
const xmlChar *name; /* the function name */
xmlXPathEvalFunc func; /* the evaluation function */
};
/**
* xmlXPathAxisFunc:
* @ctxt: the XPath interpreter context
* @cur: the previous node being explored on that axis
*
* An axis traversal function. To traverse an axis, the engine calls
* the first time with cur == NULL and repeat until the function returns
* NULL indicating the end of the axis traversal.
*
* Returns the next node in that axis or NULL if at the end of the axis.
*/
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr cur);
/*
* Extra axis: a name and an axis function.
*/
typedef struct _xmlXPathAxis xmlXPathAxis;
typedef xmlXPathAxis *xmlXPathAxisPtr;
struct _xmlXPathAxis {
const xmlChar *name; /* the axis name */
xmlXPathAxisFunc func; /* the search function */
};
/**
* xmlXPathFunction:
* @ctxt: the XPath interprestation context
* @nargs: the number of arguments
*
* An XPath function.
* The arguments (if any) are popped out from the context stack
* and the result is pushed on the stack.
*/
typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
/*
* Function and Variable Lookup.
*/
/**
* xmlXPathVariableLookupFunc:
* @ctxt: an XPath context
* @name: name of the variable
* @ns_uri: the namespace name hosting this variable
*
* Prototype for callbacks used to plug variable lookup in the XPath
* engine.
*
* Returns the XPath object value or NULL if not found.
*/
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* xmlXPathFuncLookupFunc:
* @ctxt: an XPath context
* @name: name of the function
* @ns_uri: the namespace name hosting this function
*
* Prototype for callbacks used to plug function lookup in the XPath
* engine.
*
* Returns the XPath function or NULL if not found.
*/
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* xmlXPathFlags:
* Flags for XPath engine compilation and runtime
*/
/**
* XML_XPATH_CHECKNS:
*
* check namespaces at compilation
*/
#define XML_XPATH_CHECKNS (1<<0)
/**
* XML_XPATH_NOVAR:
*
* forbid variables in expression
*/
#define XML_XPATH_NOVAR (1<<1)
/**
* xmlXPathContext:
*
* Expression evaluation occurs with respect to a context.
* he context consists of:
* - a node (the context node)
* - a node list (the context node list)
* - a set of variable bindings
* - a function library
* - the set of namespace declarations in scope for the expression
* Following the switch to hash tables, this need to be trimmed up at
* the next binary incompatible release.
* The node may be modified when the context is passed to libxml2
* for an XPath evaluation so you may need to initialize it again
* before the next call.
*/
struct _xmlXPathContext {
xmlDocPtr doc; /* The current document */
xmlNodePtr node; /* The current node */
int nb_variables_unused; /* unused (hash table) */
int max_variables_unused; /* unused (hash table) */
xmlHashTablePtr varHash; /* Hash table of defined variables */
int nb_types; /* number of defined types */
int max_types; /* max number of types */
xmlXPathTypePtr types; /* Array of defined types */
int nb_funcs_unused; /* unused (hash table) */
int max_funcs_unused; /* unused (hash table) */
xmlHashTablePtr funcHash; /* Hash table of defined funcs */
int nb_axis; /* number of defined axis */
int max_axis; /* max number of axis */
xmlXPathAxisPtr axis; /* Array of defined axis */
/* the namespace nodes of the context node */
xmlNsPtr *namespaces; /* Array of namespaces */
int nsNr; /* number of namespace in scope */
void *user; /* function to free */
/* extra variables */
int contextSize; /* the context size */
int proximityPosition; /* the proximity position */
/* extra stuff for XPointer */
int xptr; /* is this an XPointer context? */
xmlNodePtr here; /* for here() */
xmlNodePtr origin; /* for origin() */
/* the set of namespace declarations in scope for the expression */
xmlHashTablePtr nsHash; /* The namespaces hash table */
xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
void *varLookupData; /* variable lookup data */
/* Possibility to link in an extra item */
void *extra; /* needed for XSLT */
/* The function name and URI when calling a function */
const xmlChar *function;
const xmlChar *functionURI;
/* function lookup function and data */
xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
void *funcLookupData; /* function lookup data */
/* temporary namespace lists kept for walking the namespace axis */
xmlNsPtr *tmpNsList; /* Array of namespaces */
int tmpNsNr; /* number of namespaces in scope */
/* error reporting mechanism */
void *userData; /* user specific data block */
xmlStructuredErrorFunc error; /* the callback in case of errors */
xmlError lastError; /* the last error */
xmlNodePtr debugNode; /* the source node XSLT */
/* dictionary */
xmlDictPtr dict; /* dictionary if any */
int flags; /* flags to control compilation */
/* Cache for reusal of XPath objects */
void *cache;
};
/*
* The structure of a compiled expression form is not public.
*/
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
/**
* xmlXPathParserContext:
*
* An XPath parser context. It contains pure parsing informations,
* an xmlXPathContext, and the stack of objects.
*/
struct _xmlXPathParserContext {
const xmlChar *cur; /* the current char being parsed */
const xmlChar *base; /* the full expression */
int error; /* error code */
xmlXPathContextPtr context; /* the evaluation context */
xmlXPathObjectPtr value; /* the current value */
int valueNr; /* number of values stacked */
int valueMax; /* max number of values stacked */
xmlXPathObjectPtr *valueTab; /* stack of values */
xmlXPathCompExprPtr comp; /* the precompiled expression */
int xptr; /* it this an XPointer expression */
xmlNodePtr ancestor; /* used for walking preceding axis */
int valueFrame; /* used to limit Pop on the stack */
};
/************************************************************************
* *
* Public API *
* *
************************************************************************/
/**
* Objects and Nodesets handling
*/
XMLPUBVAR double xmlXPathNAN;
XMLPUBVAR double xmlXPathPINF;
XMLPUBVAR double xmlXPathNINF;
/* These macros may later turn into functions */
/**
* xmlXPathNodeSetGetLength:
* @ns: a node-set
*
* Implement a functionality similar to the DOM NodeList.length.
*
* Returns the number of nodes in the node-set.
*/
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
/**
* xmlXPathNodeSetItem:
* @ns: a node-set
* @index: index of a node in the set
*
* Implements a functionality similar to the DOM NodeList.item().
*
* Returns the xmlNodePtr at the given @index in @ns or NULL if
* @index is out of range (0 to length-1)
*/
#define xmlXPathNodeSetItem(ns, index) \
((((ns) != NULL) && \
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
(ns)->nodeTab[(index)] \
: NULL)
/**
* xmlXPathNodeSetIsEmpty:
* @ns: a node-set
*
* Checks whether @ns is empty or not.
*
* Returns %TRUE if @ns is an empty node-set.
*/
#define xmlXPathNodeSetIsEmpty(ns) \
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
XMLPUBFUN void XMLCALL
xmlXPathFreeObject (xmlXPathObjectPtr obj);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeSetCreate (xmlNodePtr val);
XMLPUBFUN void XMLCALL
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL
xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathObjectCopy (xmlXPathObjectPtr val);
XMLPUBFUN int XMLCALL
xmlXPathCmpNodes (xmlNodePtr node1,
xmlNodePtr node2);
/**
* Conversion functions to basic types.
*/
XMLPUBFUN int XMLCALL
xmlXPathCastNumberToBoolean (double val);
XMLPUBFUN int XMLCALL
xmlXPathCastStringToBoolean (const xmlChar * val);
XMLPUBFUN int XMLCALL
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
XMLPUBFUN int XMLCALL
xmlXPathCastToBoolean (xmlXPathObjectPtr val);
XMLPUBFUN double XMLCALL
xmlXPathCastBooleanToNumber (int val);
XMLPUBFUN double XMLCALL
xmlXPathCastStringToNumber (const xmlChar * val);
XMLPUBFUN double XMLCALL
xmlXPathCastNodeToNumber (xmlNodePtr node);
XMLPUBFUN double XMLCALL
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
XMLPUBFUN double XMLCALL
xmlXPathCastToNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastBooleanToString (int val);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNumberToString (double val);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNodeToString (xmlNodePtr node);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastToString (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertBoolean (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertString (xmlXPathObjectPtr val);
/**
* Context handling.
*/
XMLPUBFUN xmlXPathContextPtr XMLCALL
xmlXPathNewContext (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
int active,
int value,
int options);
/**
* Evaluation functions.
*/
XMLPUBFUN long XMLCALL
xmlXPathOrderDocElems (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXPathSetContextNode (xmlNodePtr node,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNodeEval (xmlNodePtr node,
const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEval (const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEvalExpression (const xmlChar *str,
xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
xmlXPathObjectPtr res);
/**
* Separate compilation/evaluation entry points.
*/
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
xmlXPathCompile (const xmlChar *str);
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
const xmlChar *str);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctx);
XMLPUBFUN int XMLCALL
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN void XMLCALL
xmlXPathInit (void);
XMLPUBFUN int XMLCALL
xmlXPathIsNaN (double val);
XMLPUBFUN int XMLCALL
xmlXPathIsInf (double val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
#endif /* ! __XML_XPATH_H__ */
/*
* Summary: dynamic module loading
* Description: basic API for dynamic module loading, used by
* libexslt added in 2.6.17
*
* Copy: See Copyright for the status of this software.
*
* Author: Joel W. Reed
*/
#ifndef __XML_MODULE_H__
#define __XML_MODULE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_MODULES_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlModulePtr:
*
* A handle to a dynamically loaded module
*/
typedef struct _xmlModule xmlModule;
typedef xmlModule *xmlModulePtr;
/**
* xmlModuleOption:
*
* enumeration of options that can be passed down to xmlModuleOpen()
*/
typedef enum {
XML_MODULE_LAZY = 1, /* lazy binding */
XML_MODULE_LOCAL= 2 /* local binding */
} xmlModuleOption;
XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename,
int options);
XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module,
const char* name,
void **result);
XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module);
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_MODULES_ENABLED */
#endif /*__XML_MODULE_H__ */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _ULIMIT_H
#define _ULIMIT_H 1
#include <features.h>
/* Constants used as the first parameter for `ulimit'. They denote limits
which can be set or retrieved using this function. */
enum
{
UL_GETFSIZE = 1, /* Return limit on the size of a file,
in units of 512 bytes. */
#define UL_GETFSIZE UL_GETFSIZE
UL_SETFSIZE, /* Set limit on the size of a file to
second argument. */
#define UL_SETFSIZE UL_SETFSIZE
__UL_GETMAXBRK, /* Return the maximum possible address
of the data segment. */
__UL_GETOPENMAX /* Return the maximum number of files
that the calling process can open.*/
};
__BEGIN_DECLS
/* Control process limits according to CMD. */
extern long int ulimit (int __cmd, ...) __THROW;
__END_DECLS
#endif /* ulimit.h */
/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */
/*
Configuration defines for installed libtiff.
This file maintained for backward compatibility. Do not use definitions
from this file in your programs.
*/
#ifndef _TIFFCONF_
#define _TIFFCONF_
/* Signed 16-bit type */
#define TIFF_INT16_T signed short
/* Signed 32-bit type */
#define TIFF_INT32_T signed int
/* Signed 64-bit type */
#define TIFF_INT64_T signed long
/* Signed 8-bit type */
#define TIFF_INT8_T signed char
/* Unsigned 16-bit type */
#define TIFF_UINT16_T unsigned short
/* Unsigned 32-bit type */
#define TIFF_UINT32_T unsigned int
/* Unsigned 64-bit type */
#define TIFF_UINT64_T unsigned long
/* Unsigned 8-bit type */
#define TIFF_UINT8_T unsigned char
/* Signed size type */
#define TIFF_SSIZE_T signed long
/* Pointer difference type */
#define TIFF_PTRDIFF_T ptrdiff_t
/* Define to 1 if the system has the type `int16'. */
/* #undef HAVE_INT16 */
/* Define to 1 if the system has the type `int32'. */
/* #undef HAVE_INT32 */
/* Define to 1 if the system has the type `int8'. */
/* #undef HAVE_INT8 */
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format suported by the
machine */
#define HAVE_IEEEFP 1
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_LSB2MSB
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
(Intel) */
#define HOST_BIGENDIAN 0
/* Support CCITT Group 3 & 4 algorithms */
#define CCITT_SUPPORT 1
/* Support JPEG compression (requires IJG JPEG library) */
#define JPEG_SUPPORT 1
/* Support JBIG compression (requires JBIG-KIT library) */
#define JBIG_SUPPORT 1
/* Support LogLuv high dynamic range encoding */
#define LOGLUV_SUPPORT 1
/* Support LZW algorithm */
#define LZW_SUPPORT 1
/* Support NeXT 2-bit RLE algorithm */
#define NEXT_SUPPORT 1
/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
fails with unpatched IJG JPEG library) */
#define OJPEG_SUPPORT 1
/* Support Macintosh PackBits algorithm */
#define PACKBITS_SUPPORT 1
/* Support Pixar log-format algorithm (requires Zlib) */
#define PIXARLOG_SUPPORT 1
/* Support ThunderScan 4-bit RLE algorithm */
#define THUNDER_SUPPORT 1
/* Support Deflate compression */
#define ZIP_SUPPORT 1
/* Support strip chopping (whether or not to convert single-strip uncompressed
images to mutiple strips of ~8Kb to reduce memory usage) */
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
/* Enable SubIFD tag (330) support */
#define SUBIFD_SUPPORT 1
/* Treat extra sample as alpha (default enabled). The RGBA interface will
treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
packages produce RGBA files but don't mark the alpha properly. */
#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
lacking the tag (default enabled). */
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
/* Support MS MDI magic number files as TIFF */
#define MDI_SUPPORT 1
/*
* Feature support definitions.
* XXX: These macros are obsoleted. Don't use them in your apps!
* Macros stays here for backward compatibility and should be always defined.
*/
#define COLORIMETRY_SUPPORT
#define YCBCR_SUPPORT
#define CMYK_SUPPORT
#define ICC_SUPPORT
#define PHOTOSHOP_SUPPORT
#define IPTC_SUPPORT
#endif /* _TIFFCONF_ */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2018 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* LDAP C Defines */
#ifndef _LDAP_CDEFS_H
#define _LDAP_CDEFS_H
#if defined(__cplusplus) || defined(c_plusplus)
# define LDAP_BEGIN_DECL extern "C" {
# define LDAP_END_DECL }
#else
# define LDAP_BEGIN_DECL /* begin declarations */
# define LDAP_END_DECL /* end declarations */
#endif
#if !defined(LDAP_NO_PROTOTYPES) && ( defined(LDAP_NEEDS_PROTOTYPES) || \
defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) )
/* ANSI C or C++ */
# define LDAP_P(protos) protos
# define LDAP_CONCAT1(x,y) x ## y
# define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
# define LDAP_STRING(x) #x /* stringify without expanding x */
# define LDAP_XSTRING(x) LDAP_STRING(x) /* expand x, then stringify */
#ifndef LDAP_CONST
# define LDAP_CONST const
#endif
#else /* no prototypes */
/* traditional C */
# define LDAP_P(protos) ()
# define LDAP_CONCAT(x,y) x/**/y
# define LDAP_STRING(x) "x"
#ifndef LDAP_CONST
# define LDAP_CONST /* no const */
#endif
#endif /* no prototypes */
#if (__GNUC__) * 1000 + (__GNUC_MINOR__) >= 2006
# define LDAP_GCCATTR(attrs) __attribute__(attrs)
#else
# define LDAP_GCCATTR(attrs)
#endif
/*
* Support for Windows DLLs.
*
* When external source code includes header files for dynamic libraries,
* the external source code is "importing" DLL symbols into its resulting
* object code. On Windows, symbols imported from DLLs must be explicitly
* indicated in header files with the __declspec(dllimport) directive.
* This is not totally necessary for functions because the compiler
* (gcc or MSVC) will generate stubs when this directive is absent.
* However, this is required for imported variables.
*
* The LDAP libraries, i.e. liblber and libldap, can be built as
* static or shared, based on configuration. Just about all other source
* code in OpenLDAP use these libraries. If the LDAP libraries
* are configured as shared, 'configure' defines the LDAP_LIBS_DYNAMIC
* macro. When other source files include LDAP library headers, the
* LDAP library symbols will automatically be marked as imported. When
* the actual LDAP libraries are being built, the symbols will not
* be marked as imported because the LBER_LIBRARY or LDAP_LIBRARY macros
* will be respectively defined.
*
* Any project outside of OpenLDAP with source code wanting to use
* LDAP dynamic libraries should explicitly define LDAP_LIBS_DYNAMIC.
* This will ensure that external source code appropriately marks symbols
* that will be imported.
*
* The slapd executable, itself, can be used as a dynamic library.
* For example, if a backend module is compiled as shared, it will
* import symbols from slapd. When this happens, the slapd symbols
* must be marked as imported in header files that the backend module
* includes. Remember that slapd links with various static libraries.
* If the LDAP libraries were configured as static, their object
* code is also part of the monolithic slapd executable. Thus, when
* a backend module imports symbols from slapd, it imports symbols from
* all of the static libraries in slapd as well. Thus, the SLAP_IMPORT
* macro, when defined, will appropriately mark symbols as imported.
* This macro should be used by shared backend modules as well as any
* other external source code that imports symbols from the slapd
* executable as if it were a DLL.
*
* Note that we don't actually have to worry about using the
* __declspec(dllexport) directive anywhere. This is because both
* MSVC and Mingw provide alternate (more effective) methods for exporting
* symbols out of binaries, i.e. the use of a DEF file.
*
* NOTE ABOUT BACKENDS: Backends can be configured as static or dynamic.
* When a backend is configured as dynamic, slapd will load the backend
* explicitly and populate function pointer structures by calling
* the backend's well-known initialization function. Because of this
* procedure, slapd never implicitly imports symbols from dynamic backends.
* This makes it unnecessary to tag various backend functions with the
* __declspec(dllimport) directive. This is because neither slapd nor
* any other external binary should ever be implicitly loading a backend
* dynamic module.
*
* Backends are supposed to be self-contained. However, it appears that
* back-meta DOES implicitly import symbols from back-ldap. This means
* that the __declspec(dllimport) directive should be marked on back-ldap
* functions (in its header files) if and only if we're compiling for
* windows AND back-ldap has been configured as dynamic AND back-meta
* is the client of back-ldap. When client is slapd, there is no effect
* since slapd does not implicitly import symbols.
*
* TODO(?): Currently, back-meta nor back-ldap is supported for Mingw32.
* Thus, there's no need to worry about this right now. This is something that
* may or may not have to be addressed in the future.
*/
/* LBER library */
#if defined(_WIN32) && \
((defined(LDAP_LIBS_DYNAMIC) && !defined(LBER_LIBRARY)) || \
(!defined(LDAP_LIBS_DYNAMIC) && defined(SLAPD_IMPORT)))
# define LBER_F(type) extern __declspec(dllimport) type
# define LBER_V(type) extern __declspec(dllimport) type
#else
# define LBER_F(type) extern type
# define LBER_V(type) extern type
#endif
/* LDAP library */
#if defined(_WIN32) && \
((defined(LDAP_LIBS_DYNAMIC) && !defined(LDAP_LIBRARY)) || \
(!defined(LDAP_LIBS_DYNAMIC) && defined(SLAPD_IMPORT)))
# define LDAP_F(type) extern __declspec(dllimport) type
# define LDAP_V(type) extern __declspec(dllimport) type
#else
# define LDAP_F(type) extern type
# define LDAP_V(type) extern type
#endif
/* AVL library */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_AVL_F(type) extern __declspec(dllimport) type
# define LDAP_AVL_V(type) extern __declspec(dllimport) type
#else
# define LDAP_AVL_F(type) extern type
# define LDAP_AVL_V(type) extern type
#endif
/* LDIF library */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_LDIF_F(type) extern __declspec(dllimport) type
# define LDAP_LDIF_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LDIF_F(type) extern type
# define LDAP_LDIF_V(type) extern type
#endif
/* LUNICODE library */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_LUNICODE_F(type) extern __declspec(dllimport) type
# define LDAP_LUNICODE_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LUNICODE_F(type) extern type
# define LDAP_LUNICODE_V(type) extern type
#endif
/* LUTIL library */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_LUTIL_F(type) extern __declspec(dllimport) type
# define LDAP_LUTIL_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LUTIL_F(type) extern type
# define LDAP_LUTIL_V(type) extern type
#endif
/* REWRITE library */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_REWRITE_F(type) extern __declspec(dllimport) type
# define LDAP_REWRITE_V(type) extern __declspec(dllimport) type
#else
# define LDAP_REWRITE_F(type) extern type
# define LDAP_REWRITE_V(type) extern type
#endif
/* SLAPD (as a dynamic library exporting symbols) */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_SLAPD_F(type) extern __declspec(dllimport) type
# define LDAP_SLAPD_V(type) extern __declspec(dllimport) type
#else
# define LDAP_SLAPD_F(type) extern type
# define LDAP_SLAPD_V(type) extern type
#endif
/* SLAPD (as a dynamic library exporting symbols) */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define LDAP_SLAPI_F(type) extern __declspec(dllimport) type
# define LDAP_SLAPI_V(type) extern __declspec(dllimport) type
#else
# define LDAP_SLAPI_F(type) extern type
# define LDAP_SLAPI_V(type) extern type
#endif
/* SLAPD (as a dynamic library exporting symbols) */
#if defined(_WIN32) && defined(SLAPD_IMPORT)
# define SLAPI_F(type) extern __declspec(dllimport) type
# define SLAPI_V(type) extern __declspec(dllimport) type
#else
# define SLAPI_F(type) extern type
# define SLAPI_V(type) extern type
#endif
/*
* C library. Mingw32 links with the dynamic C run-time library by default,
* so the explicit definition of CSTATIC will keep dllimport from
* being defined, if desired.
*
* MSVC defines the _DLL macro when the compiler is invoked with /MD or /MDd,
* which means the resulting object code will be linked with the dynamic
* C run-time library.
*
* Technically, it shouldn't be necessary to redefine any functions that
* the headers for the C library should already contain. Nevertheless, this
* is here as a safe-guard.
*
* TODO: Determine if these macros ever get expanded for Windows. If not,
* the declspec expansion can probably be removed.
*/
#if (defined(__MINGW32__) && !defined(CSTATIC)) || \
(defined(_MSC_VER) && defined(_DLL))
# define LDAP_LIBC_F(type) extern __declspec(dllimport) type
# define LDAP_LIBC_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LIBC_F(type) extern type
# define LDAP_LIBC_V(type) extern type
#endif
#endif /* _LDAP_CDEFS_H */
/* Interface for nlist.
Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
it under the terms of either
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version
or both in parallel, as here.
elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifndef _NLIST_H
#define _NLIST_H 1
/* Symbol list type. */
struct nlist
{
char *n_name; /* Symbol name. */
long int n_value; /* Value of symbol. */
short int n_scnum; /* Section number found in. */
unsigned short int n_type; /* Type of symbol. */
char n_sclass; /* Storage class. */
char n_numaux; /* Number of auxiliary entries. */
};
#ifdef __cplusplus
extern "C" {
#endif
/* Get specified entries from file. */
extern int nlist (__const char *__filename, struct nlist *__nl);
#ifdef __cplusplus
}
#endif
#endif /* nlist.h */
#ifndef HASHMAP_H
# define HASHMAP_H
# include <stdlib.h>
# include <stdint.h>
#ifndef __GNUC_PREREQ
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
#define __GNUC_PREREQ(maj, min) 0
#endif
#endif
struct ext2fs_hashmap {
uint32_t size;
uint32_t(*hash)(const void *key, size_t len);
void(*free)(void*);
struct ext2fs_hashmap_entry *first;
struct ext2fs_hashmap_entry *last;
struct ext2fs_hashmap_entry {
void *data;
const void *key;
size_t key_len;
struct ext2fs_hashmap_entry *next;
struct ext2fs_hashmap_entry *list_next;
struct ext2fs_hashmap_entry *list_prev;
#if __GNUC_PREREQ (4, 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
} *entries[0];
#if __GNUC_PREREQ (4, 8)
#pragma GCC diagnostic pop
#endif
};
struct ext2fs_hashmap *ext2fs_hashmap_create(
uint32_t(*hash_fct)(const void*, size_t),
void(*free_fct)(void*), size_t size);
void ext2fs_hashmap_add(struct ext2fs_hashmap *h, void *data, const void *key,
size_t key_len);
void *ext2fs_hashmap_lookup(struct ext2fs_hashmap *h, const void *key,
size_t key_len);
void *ext2fs_hashmap_iter_in_order(struct ext2fs_hashmap *h,
struct ext2fs_hashmap_entry **it);
void ext2fs_hashmap_del(struct ext2fs_hashmap *h,
struct ext2fs_hashmap_entry *e);
void ext2fs_hashmap_free(struct ext2fs_hashmap *h);
uint32_t ext2fs_djb2_hash(const void *str, size_t size);
#endif /* !HASHMAP_H */
/*
* Kluge to support multilib installation of both 32- and 64-bit RPMS:
* we need to arrange that header files that appear in both RPMs are
* identical. Hence, this file is architecture-independent and calls
* in an arch-dependent file that will appear in just one RPM.
*
* To avoid breaking arches not explicitly supported by Red Hat, we
* use this indirection file *only* on known multilib arches.
*
* We pay attention to include _only_ the original multilib-unclean
* header file. Including any other system-header file could cause
* unpredictable include-ordering issues (rhbz#1412274, comment #16).
*
* Note: this may well fail if user tries to use gcc's -I- option.
* But that option is deprecated anyway.
*/
#if defined(__x86_64__)
#include "ext2_types-x86_64.h"
#elif defined(__i386__)
#include "ext2_types-i386.h"
#elif defined(__ppc64__) || defined(__powerpc64__)
#include "ext2_types-ppc64.h"
#elif defined(__ppc__) || defined(__powerpc__)
#include "ext2_types-ppc.h"
#elif defined(__s390x__)
#include "ext2_types-s390x.h"
#elif defined(__s390__)
#include "ext2_types-s390.h"
#elif defined(__sparc__) && defined(__arch64__)
#include "ext2_types-sparc64.h"
#elif defined(__sparc__)
#include "ext2_types-sparc.h"
#endif
/*
* io.h --- the I/O manager abstraction
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifndef _EXT2FS_EXT2_IO_H
#define _EXT2FS_EXT2_IO_H
#include <ext2fs/ext2_types.h>
/*
* ext2_loff_t is defined here since unix_io.c needs it.
*/
#if defined(__GNUC__) || defined(HAS_LONG_LONG)
typedef long long ext2_loff_t;
#else
typedef long ext2_loff_t;
#endif
/* llseek.c */
ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int);
typedef struct struct_io_manager *io_manager;
typedef struct struct_io_channel *io_channel;
typedef struct struct_io_stats *io_stats;
#define CHANNEL_FLAGS_WRITETHROUGH 0x01
#define CHANNEL_FLAGS_DISCARD_ZEROES 0x02
#define CHANNEL_FLAGS_BLOCK_DEVICE 0x04
#define io_channel_discard_zeroes_data(i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES)
struct struct_io_channel {
errcode_t magic;
io_manager manager;
char *name;
int block_size;
errcode_t (*read_error)(io_channel channel,
unsigned long block,
int count,
void *data,
size_t size,
int actual_bytes_read,
errcode_t error);
errcode_t (*write_error)(io_channel channel,
unsigned long block,
int count,
const void *data,
size_t size,
int actual_bytes_written,
errcode_t error);
int refcount;
int flags;
long reserved[14];
void *private_data;
void *app_data;
int align;
};
struct struct_io_stats {
int num_fields;
int reserved;
unsigned long long bytes_read;
unsigned long long bytes_written;
};
struct struct_io_manager {
errcode_t magic;
const char *name;
errcode_t (*open)(const char *name, int flags, io_channel *channel);
errcode_t (*close)(io_channel channel);
errcode_t (*set_blksize)(io_channel channel, int blksize);
errcode_t (*read_blk)(io_channel channel, unsigned long block,
int count, void *data);
errcode_t (*write_blk)(io_channel channel, unsigned long block,
int count, const void *data);
errcode_t (*flush)(io_channel channel);
errcode_t (*write_byte)(io_channel channel, unsigned long offset,
int count, const void *data);
errcode_t (*set_option)(io_channel channel, const char *option,
const char *arg);
errcode_t (*get_stats)(io_channel channel, io_stats *io_stats);
errcode_t (*read_blk64)(io_channel channel, unsigned long long block,
int count, void *data);
errcode_t (*write_blk64)(io_channel channel, unsigned long long block,
int count, const void *data);
errcode_t (*discard)(io_channel channel, unsigned long long block,
unsigned long long count);
errcode_t (*cache_readahead)(io_channel channel,
unsigned long long block,
unsigned long long count);
errcode_t (*zeroout)(io_channel channel, unsigned long long block,
unsigned long long count);
long reserved[14];
};
#define IO_FLAG_RW 0x0001
#define IO_FLAG_EXCLUSIVE 0x0002
#define IO_FLAG_DIRECT_IO 0x0004
#define IO_FLAG_FORCE_BOUNCE 0x0008
/*
* Convenience functions....
*/
#define io_channel_close(c) ((c)->manager->close((c)))
#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s))
#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d))
#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
#define io_channel_flush(c) ((c)->manager->flush((c)))
#define io_channel_bumpcount(c) ((c)->refcount++)
/* io_manager.c */
extern errcode_t io_channel_set_options(io_channel channel,
const char *options);
extern errcode_t io_channel_write_byte(io_channel channel,
unsigned long offset,
int count, const void *data);
extern errcode_t io_channel_read_blk64(io_channel channel,
unsigned long long block,
int count, void *data);
extern errcode_t io_channel_write_blk64(io_channel channel,
unsigned long long block,
int count, const void *data);
extern errcode_t io_channel_discard(io_channel channel,
unsigned long long block,
unsigned long long count);
extern errcode_t io_channel_zeroout(io_channel channel,
unsigned long long block,
unsigned long long count);
extern errcode_t io_channel_alloc_buf(io_channel channel,
int count, void *ptr);
extern errcode_t io_channel_cache_readahead(io_channel io,
unsigned long long block,
unsigned long long count);
/* unix_io.c */
extern io_manager unix_io_manager;
extern io_manager unixfd_io_manager;
/* sparse_io.c */
extern io_manager sparse_io_manager;
extern io_manager sparsefd_io_manager;
/* undo_io.c */
extern io_manager undo_io_manager;
extern errcode_t set_undo_io_backing_manager(io_manager manager);
extern errcode_t set_undo_io_backup_file(char *file_name);
/* test_io.c */
extern io_manager test_io_manager, test_io_backing_manager;
extern void (*test_io_cb_read_blk)
(unsigned long block, int count, errcode_t err);
extern void (*test_io_cb_write_blk)
(unsigned long block, int count, errcode_t err);
extern void (*test_io_cb_read_blk64)
(unsigned long long block, int count, errcode_t err);
extern void (*test_io_cb_write_blk64)
(unsigned long long block, int count, errcode_t err);
extern void (*test_io_cb_set_blksize)
(int blksize, errcode_t err);
#endif /* _EXT2FS_EXT2_IO_H */
/*
* ext2_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define EXT2_ET_BASE (2133571328L)
#define EXT2_ET_MAGIC_EXT2FS_FILSYS (2133571329L)
#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L)
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L)
#define EXT2_ET_MAGIC_INODE_SCAN (2133571332L)
#define EXT2_ET_MAGIC_IO_CHANNEL (2133571333L)
#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL (2133571334L)
#define EXT2_ET_MAGIC_IO_MANAGER (2133571335L)
#define EXT2_ET_MAGIC_BLOCK_BITMAP (2133571336L)
#define EXT2_ET_MAGIC_INODE_BITMAP (2133571337L)
#define EXT2_ET_MAGIC_GENERIC_BITMAP (2133571338L)
#define EXT2_ET_MAGIC_TEST_IO_CHANNEL (2133571339L)
#define EXT2_ET_MAGIC_DBLIST (2133571340L)
#define EXT2_ET_MAGIC_ICOUNT (2133571341L)
#define EXT2_ET_MAGIC_PQ_IO_CHANNEL (2133571342L)
#define EXT2_ET_MAGIC_EXT2_FILE (2133571343L)
#define EXT2_ET_MAGIC_E2IMAGE (2133571344L)
#define EXT2_ET_MAGIC_INODE_IO_CHANNEL (2133571345L)
#define EXT2_ET_MAGIC_EXTENT_HANDLE (2133571346L)
#define EXT2_ET_BAD_MAGIC (2133571347L)
#define EXT2_ET_REV_TOO_HIGH (2133571348L)
#define EXT2_ET_RO_FILSYS (2133571349L)
#define EXT2_ET_GDESC_READ (2133571350L)
#define EXT2_ET_GDESC_WRITE (2133571351L)
#define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571352L)
#define EXT2_ET_GDESC_BAD_INODE_MAP (2133571353L)
#define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571354L)
#define EXT2_ET_INODE_BITMAP_WRITE (2133571355L)
#define EXT2_ET_INODE_BITMAP_READ (2133571356L)
#define EXT2_ET_BLOCK_BITMAP_WRITE (2133571357L)
#define EXT2_ET_BLOCK_BITMAP_READ (2133571358L)
#define EXT2_ET_INODE_TABLE_WRITE (2133571359L)
#define EXT2_ET_INODE_TABLE_READ (2133571360L)
#define EXT2_ET_NEXT_INODE_READ (2133571361L)
#define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571362L)
#define EXT2_ET_DIR_CORRUPTED (2133571363L)
#define EXT2_ET_SHORT_READ (2133571364L)
#define EXT2_ET_SHORT_WRITE (2133571365L)
#define EXT2_ET_DIR_NO_SPACE (2133571366L)
#define EXT2_ET_NO_INODE_BITMAP (2133571367L)
#define EXT2_ET_NO_BLOCK_BITMAP (2133571368L)
#define EXT2_ET_BAD_INODE_NUM (2133571369L)
#define EXT2_ET_BAD_BLOCK_NUM (2133571370L)
#define EXT2_ET_EXPAND_DIR_ERR (2133571371L)
#define EXT2_ET_TOOSMALL (2133571372L)
#define EXT2_ET_BAD_BLOCK_MARK (2133571373L)
#define EXT2_ET_BAD_BLOCK_UNMARK (2133571374L)
#define EXT2_ET_BAD_BLOCK_TEST (2133571375L)
#define EXT2_ET_BAD_INODE_MARK (2133571376L)
#define EXT2_ET_BAD_INODE_UNMARK (2133571377L)
#define EXT2_ET_BAD_INODE_TEST (2133571378L)
#define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571379L)
#define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571380L)
#define EXT2_ET_BAD_IND_BLOCK (2133571381L)
#define EXT2_ET_BAD_DIND_BLOCK (2133571382L)
#define EXT2_ET_BAD_TIND_BLOCK (2133571383L)
#define EXT2_ET_NEQ_BLOCK_BITMAP (2133571384L)
#define EXT2_ET_NEQ_INODE_BITMAP (2133571385L)
#define EXT2_ET_BAD_DEVICE_NAME (2133571386L)
#define EXT2_ET_MISSING_INODE_TABLE (2133571387L)
#define EXT2_ET_CORRUPT_SUPERBLOCK (2133571388L)
#define EXT2_ET_BAD_GENERIC_MARK (2133571389L)
#define EXT2_ET_BAD_GENERIC_UNMARK (2133571390L)
#define EXT2_ET_BAD_GENERIC_TEST (2133571391L)
#define EXT2_ET_SYMLINK_LOOP (2133571392L)
#define EXT2_ET_CALLBACK_NOTHANDLED (2133571393L)
#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571394L)
#define EXT2_ET_UNSUPP_FEATURE (2133571395L)
#define EXT2_ET_RO_UNSUPP_FEATURE (2133571396L)
#define EXT2_ET_LLSEEK_FAILED (2133571397L)
#define EXT2_ET_NO_MEMORY (2133571398L)
#define EXT2_ET_INVALID_ARGUMENT (2133571399L)
#define EXT2_ET_BLOCK_ALLOC_FAIL (2133571400L)
#define EXT2_ET_INODE_ALLOC_FAIL (2133571401L)
#define EXT2_ET_NO_DIRECTORY (2133571402L)
#define EXT2_ET_TOO_MANY_REFS (2133571403L)
#define EXT2_ET_FILE_NOT_FOUND (2133571404L)
#define EXT2_ET_FILE_RO (2133571405L)
#define EXT2_ET_DB_NOT_FOUND (2133571406L)
#define EXT2_ET_DIR_EXISTS (2133571407L)
#define EXT2_ET_UNIMPLEMENTED (2133571408L)
#define EXT2_ET_CANCEL_REQUESTED (2133571409L)
#define EXT2_ET_FILE_TOO_BIG (2133571410L)
#define EXT2_ET_JOURNAL_NOT_BLOCK (2133571411L)
#define EXT2_ET_NO_JOURNAL_SB (2133571412L)
#define EXT2_ET_JOURNAL_TOO_SMALL (2133571413L)
#define EXT2_ET_JOURNAL_UNSUPP_VERSION (2133571414L)
#define EXT2_ET_LOAD_EXT_JOURNAL (2133571415L)
#define EXT2_ET_NO_JOURNAL (2133571416L)
#define EXT2_ET_DIRHASH_UNSUPP (2133571417L)
#define EXT2_ET_BAD_EA_BLOCK_NUM (2133571418L)
#define EXT2_ET_TOO_MANY_INODES (2133571419L)
#define EXT2_ET_NOT_IMAGE_FILE (2133571420L)
#define EXT2_ET_RES_GDT_BLOCKS (2133571421L)
#define EXT2_ET_RESIZE_INODE_CORRUPT (2133571422L)
#define EXT2_ET_SET_BMAP_NO_IND (2133571423L)
#define EXT2_ET_TDB_SUCCESS (2133571424L)
#define EXT2_ET_TDB_ERR_CORRUPT (2133571425L)
#define EXT2_ET_TDB_ERR_IO (2133571426L)
#define EXT2_ET_TDB_ERR_LOCK (2133571427L)
#define EXT2_ET_TDB_ERR_OOM (2133571428L)
#define EXT2_ET_TDB_ERR_EXISTS (2133571429L)
#define EXT2_ET_TDB_ERR_NOLOCK (2133571430L)
#define EXT2_ET_TDB_ERR_EINVAL (2133571431L)
#define EXT2_ET_TDB_ERR_NOEXIST (2133571432L)
#define EXT2_ET_TDB_ERR_RDONLY (2133571433L)
#define EXT2_ET_DBLIST_EMPTY (2133571434L)
#define EXT2_ET_RO_BLOCK_ITERATE (2133571435L)
#define EXT2_ET_MAGIC_EXTENT_PATH (2133571436L)
#define EXT2_ET_MAGIC_GENERIC_BITMAP64 (2133571437L)
#define EXT2_ET_MAGIC_BLOCK_BITMAP64 (2133571438L)
#define EXT2_ET_MAGIC_INODE_BITMAP64 (2133571439L)
#define EXT2_ET_MAGIC_RESERVED_13 (2133571440L)
#define EXT2_ET_MAGIC_RESERVED_14 (2133571441L)
#define EXT2_ET_MAGIC_RESERVED_15 (2133571442L)
#define EXT2_ET_MAGIC_RESERVED_16 (2133571443L)
#define EXT2_ET_MAGIC_RESERVED_17 (2133571444L)
#define EXT2_ET_MAGIC_RESERVED_18 (2133571445L)
#define EXT2_ET_MAGIC_RESERVED_19 (2133571446L)
#define EXT2_ET_EXTENT_HEADER_BAD (2133571447L)
#define EXT2_ET_EXTENT_INDEX_BAD (2133571448L)
#define EXT2_ET_EXTENT_LEAF_BAD (2133571449L)
#define EXT2_ET_EXTENT_NO_SPACE (2133571450L)
#define EXT2_ET_INODE_NOT_EXTENT (2133571451L)
#define EXT2_ET_EXTENT_NO_NEXT (2133571452L)
#define EXT2_ET_EXTENT_NO_PREV (2133571453L)
#define EXT2_ET_EXTENT_NO_UP (2133571454L)
#define EXT2_ET_EXTENT_NO_DOWN (2133571455L)
#define EXT2_ET_NO_CURRENT_NODE (2133571456L)
#define EXT2_ET_OP_NOT_SUPPORTED (2133571457L)
#define EXT2_ET_CANT_INSERT_EXTENT (2133571458L)
#define EXT2_ET_CANT_SPLIT_EXTENT (2133571459L)
#define EXT2_ET_EXTENT_NOT_FOUND (2133571460L)
#define EXT2_ET_EXTENT_NOT_SUPPORTED (2133571461L)
#define EXT2_ET_EXTENT_INVALID_LENGTH (2133571462L)
#define EXT2_ET_IO_CHANNEL_NO_SUPPORT_64 (2133571463L)
#define EXT2_ET_NO_MTAB_FILE (2133571464L)
#define EXT2_ET_CANT_USE_LEGACY_BITMAPS (2133571465L)
#define EXT2_ET_MMP_MAGIC_INVALID (2133571466L)
#define EXT2_ET_MMP_FAILED (2133571467L)
#define EXT2_ET_MMP_FSCK_ON (2133571468L)
#define EXT2_ET_MMP_BAD_BLOCK (2133571469L)
#define EXT2_ET_MMP_UNKNOWN_SEQ (2133571470L)
#define EXT2_ET_MMP_CHANGE_ABORT (2133571471L)
#define EXT2_ET_MMP_OPEN_DIRECT (2133571472L)
#define EXT2_ET_BAD_DESC_SIZE (2133571473L)
#define EXT2_ET_INODE_CSUM_INVALID (2133571474L)
#define EXT2_ET_INODE_BITMAP_CSUM_INVALID (2133571475L)
#define EXT2_ET_EXTENT_CSUM_INVALID (2133571476L)
#define EXT2_ET_DIR_NO_SPACE_FOR_CSUM (2133571477L)
#define EXT2_ET_DIR_CSUM_INVALID (2133571478L)
#define EXT2_ET_EXT_ATTR_CSUM_INVALID (2133571479L)
#define EXT2_ET_SB_CSUM_INVALID (2133571480L)
#define EXT2_ET_UNKNOWN_CSUM (2133571481L)
#define EXT2_ET_MMP_CSUM_INVALID (2133571482L)
#define EXT2_ET_FILE_EXISTS (2133571483L)
#define EXT2_ET_BLOCK_BITMAP_CSUM_INVALID (2133571484L)
#define EXT2_ET_INLINE_DATA_CANT_ITERATE (2133571485L)
#define EXT2_ET_EA_BAD_NAME_LEN (2133571486L)
#define EXT2_ET_EA_BAD_VALUE_SIZE (2133571487L)
#define EXT2_ET_BAD_EA_HASH (2133571488L)
#define EXT2_ET_BAD_EA_HEADER (2133571489L)
#define EXT2_ET_EA_KEY_NOT_FOUND (2133571490L)
#define EXT2_ET_EA_NO_SPACE (2133571491L)
#define EXT2_ET_MISSING_EA_FEATURE (2133571492L)
#define EXT2_ET_NO_INLINE_DATA (2133571493L)
#define EXT2_ET_INLINE_DATA_NO_BLOCK (2133571494L)
#define EXT2_ET_INLINE_DATA_NO_SPACE (2133571495L)
#define EXT2_ET_MAGIC_EA_HANDLE (2133571496L)
#define EXT2_ET_INODE_IS_GARBAGE (2133571497L)
#define EXT2_ET_EA_BAD_VALUE_OFFSET (2133571498L)
#define EXT2_ET_JOURNAL_FLAGS_WRONG (2133571499L)
#define EXT2_ET_UNDO_FILE_CORRUPT (2133571500L)
#define EXT2_ET_UNDO_FILE_WRONG (2133571501L)
#define EXT2_ET_FILESYSTEM_CORRUPTED (2133571502L)
#define EXT2_ET_BAD_CRC (2133571503L)
#define EXT2_ET_CORRUPT_JOURNAL_SB (2133571504L)
#define EXT2_ET_INODE_CORRUPTED (2133571505L)
#define EXT2_ET_EA_INODE_CORRUPTED (2133571506L)
#define EXT2_ET_NO_GDESC (2133571507L)
#define EXT2_FILSYS_CORRUPTED (2133571508L)
extern const struct error_table et_ext2_error_table;
extern void initialize_ext2_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_ext2_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_ext2 (2133571328L)
/* for compatibility with older versions... */
#define init_ext2_err_tbl initialize_ext2_error_table
#define ext2_err_base ERROR_TABLE_BASE_ext2
/*
File: linux/ext2_ext_attr.h
On-disk format of extended attributes for the ext2 filesystem.
(C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
#ifndef _EXT2_EXT_ATTR_H
#define _EXT2_EXT_ATTR_H
/* Magic value in attribute blocks */
#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000
#define EXT2_EXT_ATTR_MAGIC 0xEA020000
/* Maximum number of references to one attribute block */
#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024
struct ext2_ext_attr_header {
__u32 h_magic; /* magic number for identification */
__u32 h_refcount; /* reference count */
__u32 h_blocks; /* number of disk blocks used */
__u32 h_hash; /* hash value of all attributes */
__u32 h_checksum; /* crc32c(uuid+id+xattrs) */
/* id = inum if refcount = 1, else blknum */
__u32 h_reserved[3]; /* zero right now */
};
struct ext2_ext_attr_entry {
__u8 e_name_len; /* length of name */
__u8 e_name_index; /* attribute name index */
__u16 e_value_offs; /* offset in disk block of value */
__u32 e_value_inum; /* inode in which the value is stored */
__u32 e_value_size; /* size of attribute value */
__u32 e_hash; /* hash value of name and value */
#if 0
char e_name[0]; /* attribute name */
#endif
};
#define EXT2_EXT_ATTR_PAD_BITS 2
#define EXT2_EXT_ATTR_PAD ((unsigned) 1<<EXT2_EXT_ATTR_PAD_BITS)
#define EXT2_EXT_ATTR_ROUND (EXT2_EXT_ATTR_PAD-1)
#define EXT2_EXT_ATTR_LEN(name_len) \
(((name_len) + EXT2_EXT_ATTR_ROUND + \
sizeof(struct ext2_ext_attr_entry)) & ~EXT2_EXT_ATTR_ROUND)
#define EXT2_EXT_ATTR_NEXT(entry) \
( (struct ext2_ext_attr_entry *)( \
(char *)(entry) + EXT2_EXT_ATTR_LEN((entry)->e_name_len)) )
#define EXT2_EXT_ATTR_SIZE(size) \
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL)
#define EXT2_EXT_ATTR_NAME(entry) \
(((char *) (entry)) + sizeof(struct ext2_ext_attr_entry))
#define EXT2_XATTR_LEN(name_len) \
(((name_len) + EXT2_EXT_ATTR_ROUND + \
sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND)
#define EXT2_XATTR_SIZE(size) \
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
#ifdef __KERNEL__
# ifdef CONFIG_EXT2_FS_EXT_ATTR
extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int);
extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int);
extern void ext2_ext_attr_free_inode(struct inode *inode);
extern void ext2_ext_attr_put_super(struct super_block *sb);
extern int ext2_ext_attr_init(void);
extern void ext2_ext_attr_done(void);
# else
# define ext2_get_ext_attr NULL
# define ext2_set_ext_attr NULL
# endif
#endif /* __KERNEL__ */
#endif /* _EXT2_EXT_ATTR_H */
/*
* If linux/types.h is already been included, assume it has defined
* everything we need. (cross fingers) Other header files may have
* also defined the types that we need.
*/
#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
!defined(_EXT2_TYPES_H))
#define _EXT2_TYPES_H
#define __S8_TYPEDEF __signed__ char
#define __U8_TYPEDEF unsigned char
#define __S16_TYPEDEF __signed__ short
#define __U16_TYPEDEF unsigned short
#define __S32_TYPEDEF __signed__ int
#define __U32_TYPEDEF unsigned int
#define __S64_TYPEDEF __signed__ long long
#define __U64_TYPEDEF unsigned long long
#ifndef HAVE___U8
#define HAVE___U8
#ifdef __U8_TYPEDEF
typedef __U8_TYPEDEF __u8;
#else
typedef unsigned char __u8;
#endif
#endif /* HAVE___U8 */
#ifndef HAVE___S8
#define HAVE___S8
#ifdef __S8_TYPEDEF
typedef __S8_TYPEDEF __s8;
#else
typedef signed char __s8;
#endif
#endif /* HAVE___S8 */
#ifndef HAVE___U16
#define HAVE___U16
#ifdef __U16_TYPEDEF
typedef __U16_TYPEDEF __u16;
#else
#if (4 == 2)
typedef unsigned int __u16;
#else
#if (2 == 2)
typedef unsigned short __u16;
#else
#undef HAVE___U16
?==error: undefined 16 bit type
#endif /* SIZEOF_SHORT == 2 */
#endif /* SIZEOF_INT == 2 */
#endif /* __U16_TYPEDEF */
#endif /* HAVE___U16 */
#ifndef HAVE___S16
#define HAVE___S16
#ifdef __S16_TYPEDEF
typedef __S16_TYPEDEF __s16;
#else
#if (4 == 2)
typedef int __s16;
#else
#if (2 == 2)
typedef short __s16;
#else
#undef HAVE___S16
?==error: undefined 16 bit type
#endif /* SIZEOF_SHORT == 2 */
#endif /* SIZEOF_INT == 2 */
#endif /* __S16_TYPEDEF */
#endif /* HAVE___S16 */
#ifndef HAVE___U32
#define HAVE___U32
#ifdef __U32_TYPEDEF
typedef __U32_TYPEDEF __u32;
#else
#if (4 == 4)
typedef unsigned int __u32;
#else
#if (8 == 4)
typedef unsigned long __u32;
#else
#if (2 == 4)
typedef unsigned short __u32;
#else
#undef HAVE___U32
?== error: undefined 32 bit type
#endif /* SIZEOF_SHORT == 4 */
#endif /* SIZEOF_LONG == 4 */
#endif /* SIZEOF_INT == 4 */
#endif /* __U32_TYPEDEF */
#endif /* HAVE___U32 */
#ifndef HAVE___S32
#define HAVE___S32
#ifdef __S32_TYPEDEF
typedef __S32_TYPEDEF __s32;
#else
#if (4 == 4)
typedef int __s32;
#else
#if (8 == 4)
typedef long __s32;
#else
#if (2 == 4)
typedef short __s32;
#else
#undef HAVE___S32
?== error: undefined 32 bit type
#endif /* SIZEOF_SHORT == 4 */
#endif /* SIZEOF_LONG == 4 */
#endif /* SIZEOF_INT == 4 */
#endif /* __S32_TYPEDEF */
#endif /* HAVE___S32 */
#ifndef HAVE___U64
#define HAVE___U64
#ifdef __U64_TYPEDEF
typedef __U64_TYPEDEF __u64;
#else
#if (4 == 8)
typedef unsigned int __u64;
#else
#if (8 == 8)
typedef unsigned long long __u64;
#else
#if (8 == 8)
typedef unsigned long __u64;
#else
#undef HAVE___U64
?== error: undefined 64 bit type
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
#endif /* __U64_TYPEDEF */
#endif /* HAVE___U64 */
#ifndef HAVE___S64
#define HAVE___S64
#ifdef __S64_TYPEDEF
typedef __S64_TYPEDEF __s64;
#else
#if (4 == 8)
typedef int __s64;
#else
#if (8 == 8)
#if defined(__GNUC__)
typedef __signed__ long long __s64;
#else
typedef signed long long __s64;
#endif /* __GNUC__ */
#else
#if (8 == 8)
typedef long __s64;
#else
#undef HAVE___S64
?== error: undefined 64 bit type
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
#endif /* __S64_TYPEDEF */
#endif /* HAVE___S64 */
#undef __S8_TYPEDEF
#undef __U8_TYPEDEF
#undef __S16_TYPEDEF
#undef __U16_TYPEDEF
#undef __S32_TYPEDEF
#undef __U32_TYPEDEF
#undef __S64_TYPEDEF
#undef __U64_TYPEDEF
#endif /* _*_TYPES_H */
#include <stdint.h>
/* endian checking stuff */
#ifndef EXT2_ENDIAN_H_
#define EXT2_ENDIAN_H_
#ifdef __CHECKER__
# ifndef __bitwise
# define __bitwise __attribute__((bitwise))
# endif
#define __force __attribute__((force))
#else
# ifndef __bitwise
# define __bitwise
# endif
#define __force
#endif
typedef __u16 __bitwise __le16;
typedef __u32 __bitwise __le32;
typedef __u64 __bitwise __le64;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __be32;
typedef __u64 __bitwise __be64;
#endif /* EXT2_ENDIAN_H_ */
/* These defines are needed for the public ext2fs.h header file */
#define HAVE_SYS_TYPES_H 1
#undef WORDS_BIGENDIAN
/*
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
* also included here.
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifdef WORDS_BIGENDIAN
#define ext2fs_cpu_to_le64(x) ((__force __le64)ext2fs_swab64((__u64)(x)))
#define ext2fs_le64_to_cpu(x) ext2fs_swab64((__force __u64)(__le64)(x))
#define ext2fs_cpu_to_le32(x) ((__force __le32)ext2fs_swab32((__u32)(x)))
#define ext2fs_le32_to_cpu(x) ext2fs_swab32((__force __u32)(__le32)(x))
#define ext2fs_cpu_to_le16(x) ((__force __le16)ext2fs_swab16((__u16)(x)))
#define ext2fs_le16_to_cpu(x) ext2fs_swab16((__force __u16)(__le16)(x))
#define ext2fs_cpu_to_be64(x) ((__force __be64)(__u64)(x))
#define ext2fs_be64_to_cpu(x) ((__force __u64)(__be64)(x))
#define ext2fs_cpu_to_be32(x) ((__force __be32)(__u32)(x))
#define ext2fs_be32_to_cpu(x) ((__force __u32)(__be32)(x))
#define ext2fs_cpu_to_be16(x) ((__force __be16)(__u16)(x))
#define ext2fs_be16_to_cpu(x) ((__force __u16)(__be16)(x))
#else
#define ext2fs_cpu_to_le64(x) ((__force __le64)(__u64)(x))
#define ext2fs_le64_to_cpu(x) ((__force __u64)(__le64)(x))
#define ext2fs_cpu_to_le32(x) ((__force __le32)(__u32)(x))
#define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x))
#define ext2fs_cpu_to_le16(x) ((__force __le16)(__u16)(x))
#define ext2fs_le16_to_cpu(x) ((__force __u16)(__le16)(x))
#define ext2fs_cpu_to_be64(x) ((__force __be64)ext2fs_swab64((__u64)(x)))
#define ext2fs_be64_to_cpu(x) ext2fs_swab64((__force __u64)(__be64)(x))
#define ext2fs_cpu_to_be32(x) ((__force __be32)ext2fs_swab32((__u32)(x)))
#define ext2fs_be32_to_cpu(x) ext2fs_swab32((__force __u32)(__be32)(x))
#define ext2fs_cpu_to_be16(x) ((__force __be16)ext2fs_swab16((__u16)(x)))
#define ext2fs_be16_to_cpu(x) ext2fs_swab16((__force __u16)(__be16)(x))
#endif
/*
* EXT2FS bitmap manipulation routines.
*/
/* Support for sending warning messages from the inline subroutines */
extern const char *ext2fs_block_string;
extern const char *ext2fs_inode_string;
extern const char *ext2fs_mark_string;
extern const char *ext2fs_unmark_string;
extern const char *ext2fs_test_string;
extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
const char *description);
extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
int code, unsigned long arg);
#ifdef NO_INLINE_FUNCS
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
extern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
extern __u16 ext2fs_swab16(__u16 val);
extern __u32 ext2fs_swab32(__u32 val);
extern __u64 ext2fs_swab64(__u64 val);
extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
#endif
/* These functions routines moved to gen_bitmap.c */
extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode, int num);
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
__u32 bitno);
extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
blk_t bitno);
extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
blk_t bitno);
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
/* 64-bit versions */
#ifdef NO_INLINE_FUNCS
extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out);
extern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out);
extern errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out);
extern errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out);
extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap);
extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap);
extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
#endif
/* These routines moved to gen_bitmap64.c */
extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
ext2fs_generic_bitmap bm1,
ext2fs_generic_bitmap bm2);
extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
blk64_t bitno);
extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
blk64_t bitno);
extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
blk64_t bitno);
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap);
extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap);
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
__u64 start, __u64 end,
__u64 *out);
extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap,
__u64 start, __u64 end,
__u64 *out);
/*
* The inline routines themselves...
*
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
* functions at all; they will be included as normal functions in
* inline.c
*/
#ifdef NO_INLINE_FUNCS
#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
defined(__i586__)))
/* This prevents bitops.c from trying to include the C */
/* function version of these functions */
#define _EXT2_HAVE_ASM_BITOPS_
#endif
#endif /* NO_INLINE_FUNCS */
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef INCLUDE_INLINE_FUNCS
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ extern inline
#else
#define _INLINE_ inline
#endif
#else /* !INCLUDE_INLINE FUNCS */
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else /* not C99 */
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* INCLUDE_INLINE_FUNCS */
/*
* Fast bit set/clear functions that doesn't need to return the
* previous bit value.
*/
_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR |= (unsigned char) (1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR |= (unsigned char) (1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
(defined(__i386__) || defined(__i486__) || defined(__i586__)))
#define _EXT2_HAVE_ASM_BITOPS_
#define _EXT2_HAVE_ASM_SWAB_
/*
* These are done by inline assembly for speed reasons.....
*
* All bitoperations return 0 if the bit was cleared before the
* operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32
* is the LSB of (addr+1).
*/
/*
* Some hacks to defeat gcc over-optimizations..
*/
struct __dummy_h { unsigned long a[100]; };
#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
{
int oldbit;
addr = (void *) (((unsigned char *) addr) + (nr >> 3));
__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"+m" (EXT2FS_ADDR)
:"r" (nr & 7));
return oldbit;
}
_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
{
int oldbit;
addr = (void *) (((unsigned char *) addr) + (nr >> 3));
__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"+m" (EXT2FS_ADDR)
:"r" (nr & 7));
return oldbit;
}
_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
{
int oldbit;
addr = (const void *) (((const unsigned char *) addr) + (nr >> 3));
__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit)
:"m" (EXT2FS_CONST_ADDR),"r" (nr & 7));
return oldbit;
}
_INLINE_ __u32 ext2fs_swab32(__u32 val)
{
#ifdef EXT2FS_REQUIRE_486
__asm__("bswap %0" : "=r" (val) : "0" (val));
#else
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
:"=q" (val)
: "0" (val));
#endif
return val;
}
_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
__asm__("xchgb %b0,%h0" /* swap bytes */ \
: "=q" (val) \
: "0" (val)); \
return val;
}
#undef EXT2FS_ADDR
#endif /* i386 */
#if !defined(_EXT2_HAVE_ASM_SWAB_)
_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
return (val >> 8) | (__u16) (val << 8);
}
_INLINE_ __u32 ext2fs_swab32(__u32 val)
{
return ((val>>24) | ((val>>8)&0xFF00) |
((val<<8)&0xFF0000) | (val<<24));
}
#endif /* !_EXT2_HAVE_ASM_SWAB */
_INLINE_ __u64 ext2fs_swab64(__u64 val)
{
return (ext2fs_swab32((__u32) (val >> 32)) |
(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
}
_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
return ext2fs_test_block_bitmap_range(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
ext2fs_mark_block_bitmap_range(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
ext2fs_unmark_block_bitmap_range(bitmap, block, num);
}
/* 64-bit versions */
_INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = o;
return rv;
}
_INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = (ext2_ino_t) o;
return rv;
}
_INLINE_ errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = o;
return rv;
}
_INLINE_ errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = (ext2_ino_t) o;
return rv;
}
_INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap)
{
return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap)
{
return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num)
{
return ext2fs_test_block_bitmap_range2(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num)
{
ext2fs_mark_block_bitmap_range2(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num)
{
ext2fs_unmark_block_bitmap_range2(bitmap, block, num);
}
#undef _INLINE_
#endif
#ifndef _EXT2_HAVE_ASM_BITOPS_
extern int ext2fs_set_bit(unsigned int nr,void * addr);
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
#endif
extern int ext2fs_set_bit64(__u64 nr,void * addr);
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes);
#ifndef __TDB_H__
#define __TDB_H__
/*
Unix SMB/CIFS implementation.
trivial database library
Copyright (C) Andrew Tridgell 1999-2004
** NOTE! The following LGPL license applies to the tdb
** library. This does NOT imply that all of Samba is released
** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef __cplusplus
extern "C" {
#endif
/* flags to tdb_store() */
#define TDB_REPLACE 1
#define TDB_INSERT 2
#define TDB_MODIFY 3
/* flags for tdb_open() */
#define TDB_DEFAULT 0 /* just a readability place holder */
#define TDB_CLEAR_IF_FIRST 1
#define TDB_INTERNAL 2 /* don't store on disk */
#define TDB_NOLOCK 4 /* don't do any locking */
#define TDB_NOMMAP 8 /* don't use mmap */
#define TDB_CONVERT 16 /* convert endian (internal use) */
#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */
#define TDB_NOSYNC 64 /* don't use synchronous transactions */
#define TDB_SEQNUM 128 /* maintain a sequence number */
#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret)
/* error codes */
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT,
TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY};
/* debugging uses one of the following levels */
enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
typedef struct TDB_DATA {
unsigned char *dptr;
size_t dsize;
} TDB_DATA;
#ifndef PRINTF_ATTRIBUTE
#if (__GNUC__ >= 3)
/** Use gcc attribute to check printf fns. a1 is the 1-based index of
* the parameter containing the format, and a2 the index of the first
* argument. Note that some gcc 2.x versions don't handle this
* properly **/
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
#else
#define PRINTF_ATTRIBUTE(a1, a2)
#endif
#endif
/* ext2fs tdb renames */
#define tdb_open ext2fs_tdb_open
#define tdb_open_ex ext2fs_tdb_open_ex
#define tdb_set_max_dead ext2fs_tdb_set_max_dead
#define tdb_reopen ext2fs_tdb_reopen
#define tdb_reopen_all ext2fs_tdb_reopen_all
#define tdb_set_logging_function ext2fs_tdb_set_logging_function
#define tdb_error ext2fs_tdb_error
#define tdb_errorstr ext2fs_tdb_errorstr
#define tdb_fetch ext2fs_tdb_fetch
#define tdb_parse_record ext2fs_tdb_parse_record
#define tdb_delete ext2fs_tdb_delete
#define tdb_store ext2fs_tdb_store
#define tdb_append ext2fs_tdb_append
#define tdb_close ext2fs_tdb_close
#define tdb_firstkey ext2fs_tdb_firstkey
#define tdb_nextkey ext2fs_tdb_nextkey
#define tdb_traverse ext2fs_tdb_traverse
#define tdb_traverse_read ext2fs_tdb_traverse_read
#define tdb_exists ext2fs_tdb_exists
#define tdb_lockall ext2fs_tdb_lockall
#define tdb_unlockall ext2fs_tdb_unlockall
#define tdb_lockall_read ext2fs_tdb_lockall_read
#define tdb_unlockall_read ext2fs_tdb_unlockall_read
#define tdb_name ext2fs_tdb_name
#define tdb_fd ext2fs_tdb_fd
#define tdb_log_fn ext2fs_tdb_log_fn
#define tdb_get_logging_private ext2fs_tdb_get_logging_private
#define tdb_transaction_start ext2fs_tdb_transaction_start
#define tdb_transaction_commit ext2fs_tdb_transaction_commit
#define tdb_transaction_cancel ext2fs_tdb_transaction_cancel
#define tdb_transaction_recover ext2fs_tdb_transaction_recover
#define tdb_get_seqnum ext2fs_tdb_get_seqnum
#define tdb_hash_size ext2fs_tdb_hash_size
#define tdb_map_size ext2fs_tdb_map_size
#define tdb_get_flags ext2fs_tdb_get_flags
#define tdb_chainlock ext2fs_tdb_chainlock
#define tdb_chainunlock ext2fs_tdb_chainunlock
#define tdb_chainlock_read ext2fs_tdb_chainlock_read
#define tdb_chainunlock_read ext2fs_tdb_chainunlock_read
#define tdb_dump_all ext2fs_tdb_dump_all
#define tdb_printfreelist ext2fs_tdb_printfreelist
#define tdb_validate_freelist ext2fs_tdb_validate_freelist
#define tdb_chainlock_mark ext2fs_tdb_chainlock_mark
#define tdb_chainlock_nonblock ext2fs_tdb_chainlock_nonblock
#define tdb_chainlock_unmark ext2fs_tdb_chainlock_unmark
#define tdb_enable_seqnum ext2fs_tdb_enable_seqnum
#define tdb_increment_seqnum_nonblock ext2fs_tdb_increment_seqnum_nonblock
#define tdb_lock_nonblock ext2fs_tdb_lock_nonblock
#define tdb_lockall_mark ext2fs_tdb_lockall_mark
#define tdb_lockall_nonblock ext2fs_tdb_lockall_nonblock
#define tdb_lockall_read_nonblock ext2fs_tdb_lockall_read_nonblock
#define tdb_lockall_unmark ext2fs_tdb_lockall_unmark
#define tdb_flush ext2fs_tdb_flush
/* this is the context structure that is returned from a db open */
typedef struct tdb_context TDB_CONTEXT;
typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
typedef unsigned int (*tdb_hash_func)(TDB_DATA *key);
struct tdb_logging_context {
tdb_log_func log_fn;
void *log_private;
};
struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode);
struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode,
const struct tdb_logging_context *log_ctx,
tdb_hash_func hash_fn);
void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
int tdb_reopen(struct tdb_context *tdb);
int tdb_reopen_all(int parent_longlived);
void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
enum TDB_ERROR tdb_error(struct tdb_context *tdb);
const char *tdb_errorstr(struct tdb_context *tdb);
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
int (*parser)(TDB_DATA key, TDB_DATA data,
void *private_data),
void *private_data);
int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
int tdb_close(struct tdb_context *tdb);
TDB_DATA tdb_firstkey(struct tdb_context *tdb);
TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *);
int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *);
int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
int tdb_lockall(struct tdb_context *tdb);
int tdb_lockall_nonblock(struct tdb_context *tdb);
int tdb_unlockall(struct tdb_context *tdb);
int tdb_lockall_read(struct tdb_context *tdb);
int tdb_lockall_read_nonblock(struct tdb_context *tdb);
int tdb_unlockall_read(struct tdb_context *tdb);
int tdb_lockall_mark(struct tdb_context *tdb);
int tdb_lockall_unmark(struct tdb_context *tdb);
const char *tdb_name(struct tdb_context *tdb);
int tdb_fd(struct tdb_context *tdb);
tdb_log_func tdb_log_fn(struct tdb_context *tdb);
void *tdb_get_logging_private(struct tdb_context *tdb);
int tdb_transaction_start(struct tdb_context *tdb);
int tdb_transaction_commit(struct tdb_context *tdb);
int tdb_transaction_cancel(struct tdb_context *tdb);
int tdb_transaction_recover(struct tdb_context *tdb);
int tdb_get_seqnum(struct tdb_context *tdb);
int tdb_hash_size(struct tdb_context *tdb);
size_t tdb_map_size(struct tdb_context *tdb);
int tdb_get_flags(struct tdb_context *tdb);
void tdb_enable_seqnum(struct tdb_context *tdb);
void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
int tdb_flush(struct tdb_context *tdb);
/* Low level locking functions: use with care */
int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key);
/* Debug functions. Not used in production. */
void tdb_dump_all(struct tdb_context *tdb);
int tdb_printfreelist(struct tdb_context *tdb);
int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
#ifdef __cplusplus
}
#endif
#endif /* tdb.h */
/*
* ext2fs.h --- ext2fs
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifndef _EXT2FS_EXT2FS_H
#define _EXT2FS_EXT2FS_H
#ifdef __GNUC__
#define EXT2FS_ATTR(x) __attribute__(x)
#else
#define EXT2FS_ATTR(x)
#endif
#ifdef CONFIG_TDB
#define EXT2FS_NO_TDB_UNUSED
#else
#define EXT2FS_NO_TDB_UNUSED EXT2FS_ATTR((unused))
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Non-GNU C compilers won't necessarily understand inline
*/
#if (!defined(__GNUC__) && !defined(__WATCOMC__))
#define NO_INLINE_FUNCS
#endif
/*
* Where the master copy of the superblock is located, and how big
* superblocks are supposed to be. We define SUPERBLOCK_SIZE because
* the size of the superblock structure is not necessarily trustworthy
* (some versions have the padding set up so that the superblock is
* 1032 bytes long).
*/
#define SUPERBLOCK_OFFSET 1024
#define SUPERBLOCK_SIZE 1024
#define UUID_STR_SIZE 37
/*
* The last ext2fs revision level that this version of the library is
* able to support.
*/
#define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#if EXT2_FLAT_INCLUDES
#include "e2_types.h"
#include "ext2_fs.h"
#include "ext3_extents.h"
#else
#include <ext2fs/ext2_types.h>
#include <ext2fs/ext2_fs.h>
#include <ext2fs/ext3_extents.h>
#endif /* EXT2_FLAT_INCLUDES */
typedef __u32 __bitwise ext2_ino_t;
typedef __u32 __bitwise blk_t;
typedef __u64 __bitwise blk64_t;
typedef __u32 __bitwise dgrp_t;
typedef __s32 __bitwise ext2_off_t;
typedef __s64 __bitwise ext2_off64_t;
typedef __s64 __bitwise e2_blkcnt_t;
typedef __u32 __bitwise ext2_dirhash_t;
#if EXT2_FLAT_INCLUDES
#include "com_err.h"
#include "ext2_io.h"
#include "ext2_err.h"
#include "ext2_ext_attr.h"
#else
#include <et/com_err.h>
#include <ext2fs/ext2_io.h>
#include <ext2fs/ext2_err.h>
#include <ext2fs/ext2_ext_attr.h>
#endif
#include "hashmap.h"
/*
* Portability help for Microsoft Visual C++
*/
#ifdef _MSC_VER
#define EXT2_QSORT_TYPE int __cdecl
#else
#define EXT2_QSORT_TYPE int
#endif
typedef struct struct_ext2_filsys *ext2_filsys;
#define EXT2FS_MARK_ERROR 0
#define EXT2FS_UNMARK_ERROR 1
#define EXT2FS_TEST_ERROR 2
typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap;
typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s)
/*
* Badblocks list definitions
*/
typedef struct ext2_struct_u32_list *ext2_badblocks_list;
typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
typedef struct ext2_struct_u32_list *ext2_u32_list;
typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
/* old */
typedef struct ext2_struct_u32_list *badblocks_list;
typedef struct ext2_struct_u32_iterate *badblocks_iterate;
#define BADBLOCKS_FLAG_DIRTY 1
/*
* ext2_dblist structure and abstractions (see dblist.c)
*/
struct ext2_db_entry2 {
ext2_ino_t ino;
blk64_t blk;
e2_blkcnt_t blockcnt;
};
/* Ye Olde 32-bit version */
struct ext2_db_entry {
ext2_ino_t ino;
blk_t blk;
int blockcnt;
};
typedef struct ext2_struct_dblist *ext2_dblist;
#define DBLIST_ABORT 1
/*
* ext2_fileio definitions
*/
#define EXT2_FILE_WRITE 0x0001
#define EXT2_FILE_CREATE 0x0002
#define EXT2_FILE_MASK 0x00FF
#define EXT2_FILE_BUF_DIRTY 0x4000
#define EXT2_FILE_BUF_VALID 0x2000
typedef struct ext2_file *ext2_file_t;
#define EXT2_SEEK_SET 0
#define EXT2_SEEK_CUR 1
#define EXT2_SEEK_END 2
/*
* Flags for the ext2_filsys structure and for ext2fs_open()
*/
#define EXT2_FLAG_RW 0x01
#define EXT2_FLAG_CHANGED 0x02
#define EXT2_FLAG_DIRTY 0x04
#define EXT2_FLAG_VALID 0x08
#define EXT2_FLAG_IB_DIRTY 0x10
#define EXT2_FLAG_BB_DIRTY 0x20
#define EXT2_FLAG_SWAP_BYTES 0x40
#define EXT2_FLAG_SWAP_BYTES_READ 0x80
#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
#define EXT2_FLAG_MASTER_SB_ONLY 0x200
#define EXT2_FLAG_FORCE 0x400
#define EXT2_FLAG_SUPER_ONLY 0x800
#define EXT2_FLAG_JOURNAL_DEV_OK 0x1000
#define EXT2_FLAG_IMAGE_FILE 0x2000
#define EXT2_FLAG_EXCLUSIVE 0x4000
#define EXT2_FLAG_SOFTSUPP_FEATURES 0x8000
#define EXT2_FLAG_NOFREE_ON_ERROR 0x10000
#define EXT2_FLAG_64BITS 0x20000
#define EXT2_FLAG_PRINT_PROGRESS 0x40000
#define EXT2_FLAG_DIRECT_IO 0x80000
#define EXT2_FLAG_SKIP_MMP 0x100000
#define EXT2_FLAG_IGNORE_CSUM_ERRORS 0x200000
#define EXT2_FLAG_SHARE_DUP 0x400000
#define EXT2_FLAG_IGNORE_SB_ERRORS 0x800000
#define EXT2_FLAG_BBITMAP_TAIL_PROBLEM 0x1000000
#define EXT2_FLAG_IBITMAP_TAIL_PROBLEM 0x2000000
/*
* Special flag in the ext2 inode i_flag field that means that this is
* a new inode. (So that ext2_write_inode() can clear extra fields.)
*/
#define EXT2_NEW_INODE_FL 0x80000000
/*
* Flags for mkjournal
*/
#define EXT2_MKJOURNAL_V1_SUPER 0x0000001 /* create V1 superblock (deprecated) */
#define EXT2_MKJOURNAL_LAZYINIT 0x0000002 /* don't zero journal inode before use*/
#define EXT2_MKJOURNAL_NO_MNT_CHECK 0x0000004 /* don't check mount status */
struct blk_alloc_ctx;
struct opaque_ext2_group_desc;
struct struct_ext2_filsys {
errcode_t magic;
io_channel io;
int flags;
char * device_name;
struct ext2_super_block * super;
unsigned int blocksize;
int fragsize;
dgrp_t group_desc_count;
unsigned long desc_blocks;
struct opaque_ext2_group_desc * group_desc;
unsigned int inode_blocks_per_group;
ext2fs_inode_bitmap inode_map;
ext2fs_block_bitmap block_map;
/* XXX FIXME-64: not 64-bit safe, but not used? */
errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino);
errcode_t (*write_bitmaps)(ext2_filsys fs);
errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode);
errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode);
ext2_badblocks_list badblocks;
ext2_dblist dblist;
__u32 stride; /* for mke2fs */
struct ext2_super_block * orig_super;
struct ext2_image_hdr * image_header;
__u32 umask;
time_t now;
int cluster_ratio_bits;
__u16 default_bitmap_type;
__u16 pad;
/*
* RedHat specific change to prevent ABI change by using 8
* reserved bytes
*/
const struct ext2fs_nls_table *encoding;
/*
* Reserved for future expansion
*/
__u32 reserved[5 - (sizeof(long int)/4)];
/*
* Reserved for the use of the calling application.
*/
void * priv_data;
/*
* Inode cache
*/
struct ext2_inode_cache *icache;
io_channel image_io;
/*
* More callback functions
*/
errcode_t (*get_alloc_block)(ext2_filsys fs, blk64_t goal,
blk64_t *ret);
errcode_t (*get_alloc_block2)(ext2_filsys fs, blk64_t goal,
blk64_t *ret, struct blk_alloc_ctx *ctx);
void (*block_alloc_stats)(ext2_filsys fs, blk64_t blk, int inuse);
/*
* Buffers for Multiple mount protection(MMP) block.
*/
void *mmp_buf;
void *mmp_cmp;
int mmp_fd;
/*
* Time at which e2fsck last updated the MMP block.
*/
long mmp_last_written;
/* progress operation functions */
struct ext2fs_progress_ops *progress_ops;
/* Precomputed FS UUID checksum for seeding other checksums */
__u32 csum_seed;
io_channel journal_io;
char *journal_name;
/* New block range allocation hooks */
errcode_t (*new_range)(ext2_filsys fs, int flags, blk64_t goal,
blk64_t len, blk64_t *pblk, blk64_t *plen);
void (*block_alloc_stats_range)(ext2_filsys fs, blk64_t blk, blk_t num,
int inuse);
/* hashmap for SHA of data blocks */
struct ext2fs_hashmap* block_sha_map;
};
#if EXT2_FLAT_INCLUDES
#include "e2_bitops.h"
#else
#include <ext2fs/bitops.h>
#endif
/*
* 64-bit bitmap backend types
*/
#define EXT2FS_BMAP64_BITARRAY 1
#define EXT2FS_BMAP64_RBTREE 2
#define EXT2FS_BMAP64_AUTODIR 3
/*
* Return flags for the block iterator functions
*/
#define BLOCK_CHANGED 1
#define BLOCK_ABORT 2
#define BLOCK_ERROR 4
#define BLOCK_INLINE_DATA_CHANGED 8
/*
* Block interate flags
*
* BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
* function should be called on blocks where the block number is zero.
* This is used by ext2fs_expand_dir() to be able to add a new block
* to an inode. It can also be used for programs that want to be able
* to deal with files that contain "holes".
*
* BLOCK_FLAG_DEPTH_TRAVERSE indicates that the iterator function for
* the indirect, doubly indirect, etc. blocks should be called after
* all of the blocks contained in the indirect blocks are processed.
* This is useful if you are going to be deallocating blocks from an
* inode.
*
* BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be
* called for data blocks only.
*
* BLOCK_FLAG_READ_ONLY is a promise by the caller that it will not
* modify returned block number.
*
* BLOCK_FLAG_NO_LARGE is for internal use only. It informs
* ext2fs_block_iterate2 that large files won't be accepted.
*/
#define BLOCK_FLAG_APPEND 1
#define BLOCK_FLAG_HOLE 1
#define BLOCK_FLAG_DEPTH_TRAVERSE 2
#define BLOCK_FLAG_DATA_ONLY 4
#define BLOCK_FLAG_READ_ONLY 8
#define BLOCK_FLAG_NO_LARGE 0x1000
/*
* Magic "block count" return values for the block iterator function.
*/
#define BLOCK_COUNT_IND (-1)
#define BLOCK_COUNT_DIND (-2)
#define BLOCK_COUNT_TIND (-3)
#define BLOCK_COUNT_TRANSLATOR (-4)
#define BLOCK_ALLOC_UNKNOWN 0
#define BLOCK_ALLOC_DATA 1
#define BLOCK_ALLOC_METADATA 2
struct blk_alloc_ctx {
ext2_ino_t ino;
struct ext2_inode *inode;
blk64_t lblk;
int flags;
};
#if 0
/*
* Flags for ext2fs_move_blocks
*/
#define EXT2_BMOVE_GET_DBLIST 0x0001
#define EXT2_BMOVE_DEBUG 0x0002
#endif
/*
* Generic (non-filesystem layout specific) extents structure
*/
#define EXT2_EXTENT_FLAGS_LEAF 0x0001
#define EXT2_EXTENT_FLAGS_UNINIT 0x0002
#define EXT2_EXTENT_FLAGS_SECOND_VISIT 0x0004
struct ext2fs_extent {
blk64_t e_pblk; /* first physical block */
blk64_t e_lblk; /* first logical block extent covers */
__u32 e_len; /* number of blocks covered by extent */
__u32 e_flags; /* extent flags */
};
typedef struct ext2_extent_handle *ext2_extent_handle_t;
typedef struct ext2_extent_path *ext2_extent_path_t;
/*
* Flags used by ext2fs_extent_get()
*/
#define EXT2_EXTENT_CURRENT 0x0000
#define EXT2_EXTENT_MOVE_MASK 0x000F
#define EXT2_EXTENT_ROOT 0x0001
#define EXT2_EXTENT_LAST_LEAF 0x0002
#define EXT2_EXTENT_FIRST_SIB 0x0003
#define EXT2_EXTENT_LAST_SIB 0x0004
#define EXT2_EXTENT_NEXT_SIB 0x0005
#define EXT2_EXTENT_PREV_SIB 0x0006
#define EXT2_EXTENT_NEXT_LEAF 0x0007
#define EXT2_EXTENT_PREV_LEAF 0x0008
#define EXT2_EXTENT_NEXT 0x0009
#define EXT2_EXTENT_PREV 0x000A
#define EXT2_EXTENT_UP 0x000B
#define EXT2_EXTENT_DOWN 0x000C
#define EXT2_EXTENT_DOWN_AND_LAST 0x000D
/*
* Flags used by ext2fs_extent_insert()
*/
#define EXT2_EXTENT_INSERT_AFTER 0x0001 /* insert after handle loc'n */
#define EXT2_EXTENT_INSERT_NOSPLIT 0x0002 /* insert may not cause split */
/*
* Flags used by ext2fs_extent_delete()
*/
#define EXT2_EXTENT_DELETE_KEEP_EMPTY 0x001 /* keep node if last extent gone */
/*
* Flags used by ext2fs_extent_set_bmap()
*/
#define EXT2_EXTENT_SET_BMAP_UNINIT 0x0001
/*
* Data structure returned by ext2fs_extent_get_info()
*/
struct ext2_extent_info {
int curr_entry;
int curr_level;
int num_entries;
int max_entries;
int max_depth;
int bytes_avail;
blk64_t max_lblk;
blk64_t max_pblk;
__u32 max_len;
__u32 max_uninit_len;
};
/*
* Flags for directory block reading and writing functions
*/
#define EXT2_DIRBLOCK_V2_STRUCT 0x0001
/*
* Return flags for the directory iterator functions
*/
#define DIRENT_CHANGED 1
#define DIRENT_ABORT 2
#define DIRENT_ERROR 3
/*
* Directory iterator flags
*/
#define DIRENT_FLAG_INCLUDE_EMPTY 1
#define DIRENT_FLAG_INCLUDE_REMOVED 2
#define DIRENT_FLAG_INCLUDE_CSUM 4
#define DIRENT_FLAG_INCLUDE_INLINE_DATA 8
#define DIRENT_DOT_FILE 1
#define DIRENT_DOT_DOT_FILE 2
#define DIRENT_OTHER_FILE 3
#define DIRENT_DELETED_FILE 4
#define DIRENT_CHECKSUM 5
/*
* Inode scan definitions
*/
typedef struct ext2_struct_inode_scan *ext2_inode_scan;
/*
* ext2fs_scan flags
*/
#define EXT2_SF_CHK_BADBLOCKS 0x0001
#define EXT2_SF_BAD_INODE_BLK 0x0002
#define EXT2_SF_BAD_EXTRA_BYTES 0x0004
#define EXT2_SF_SKIP_MISSING_ITABLE 0x0008
#define EXT2_SF_DO_LAZY 0x0010
#define EXT2_SF_WARN_GARBAGE_INODES 0x0020
/*
* ext2fs_check_if_mounted flags
*/
#define EXT2_MF_MOUNTED 1
#define EXT2_MF_ISROOT 2
#define EXT2_MF_READONLY 4
#define EXT2_MF_SWAP 8
#define EXT2_MF_BUSY 16
/*
* Ext2/linux mode flags. We define them here so that we don't need
* to depend on the OS's sys/stat.h, since we may be compiling on a
* non-Linux system.
*/
#define LINUX_S_IFMT 00170000
#define LINUX_S_IFSOCK 0140000
#define LINUX_S_IFLNK 0120000
#define LINUX_S_IFREG 0100000
#define LINUX_S_IFBLK 0060000
#define LINUX_S_IFDIR 0040000
#define LINUX_S_IFCHR 0020000
#define LINUX_S_IFIFO 0010000
#define LINUX_S_ISUID 0004000
#define LINUX_S_ISGID 0002000
#define LINUX_S_ISVTX 0001000
#define LINUX_S_IRWXU 00700
#define LINUX_S_IRUSR 00400
#define LINUX_S_IWUSR 00200
#define LINUX_S_IXUSR 00100
#define LINUX_S_IRWXG 00070
#define LINUX_S_IRGRP 00040
#define LINUX_S_IWGRP 00020
#define LINUX_S_IXGRP 00010
#define LINUX_S_IRWXO 00007
#define LINUX_S_IROTH 00004
#define LINUX_S_IWOTH 00002
#define LINUX_S_IXOTH 00001
#define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
#define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
#define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
#define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
#define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
#define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
#define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
/*
* ext2 size of an inode
*/
#define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32))
/*
* ext2_icount_t abstraction
*/
#define EXT2_ICOUNT_OPT_INCREMENT 0x01
#define EXT2_ICOUNT_OPT_FULLMAP 0x02
typedef struct ext2_icount *ext2_icount_t;
/*
* Flags for ext2fs_bmap
*/
#define BMAP_ALLOC 0x0001
#define BMAP_SET 0x0002
#define BMAP_UNINIT 0x0004
#define BMAP_ZERO 0x0008
/*
* Returned flags from ext2fs_bmap
*/
#define BMAP_RET_UNINIT 0x0001
/*
* Flags for ext2fs_read_inode2
*/
#define READ_INODE_NOCSUM 0x0001
/*
* Flags for ext2fs_write_inode2
*/
#define WRITE_INODE_NOCSUM 0x0001
/*
* Flags for imager.c functions
*/
#define IMAGER_FLAG_INODEMAP 1
#define IMAGER_FLAG_SPARSEWRITE 2
/*
* For checking structure magic numbers...
*/
#define EXT2_CHECK_MAGIC(struct, code) \
if ((struct)->magic != (code)) return (code)
/*
* Features supported by this version of the library
*/
#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
EXT3_FEATURE_COMPAT_HAS_JOURNAL|\
EXT2_FEATURE_COMPAT_RESIZE_INODE|\
EXT2_FEATURE_COMPAT_DIR_INDEX|\
EXT2_FEATURE_COMPAT_EXT_ATTR|\
EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
#ifdef CONFIG_MMP
#define EXT4_LIB_INCOMPAT_MMP EXT4_FEATURE_INCOMPAT_MMP
#else
#define EXT4_LIB_INCOMPAT_MMP (0)
#endif
#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
EXT2_FEATURE_INCOMPAT_META_BG|\
EXT3_FEATURE_INCOMPAT_RECOVER|\
EXT3_FEATURE_INCOMPAT_EXTENTS|\
EXT4_FEATURE_INCOMPAT_FLEX_BG|\
EXT4_FEATURE_INCOMPAT_EA_INODE|\
EXT4_LIB_INCOMPAT_MMP|\
EXT4_FEATURE_INCOMPAT_64BIT|\
EXT4_FEATURE_INCOMPAT_INLINE_DATA|\
EXT4_FEATURE_INCOMPAT_ENCRYPT|\
EXT4_FEATURE_INCOMPAT_CASEFOLD|\
EXT4_FEATURE_INCOMPAT_CSUM_SEED|\
EXT4_FEATURE_INCOMPAT_LARGEDIR)
#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
EXT4_FEATURE_RO_COMPAT_BIGALLOC|\
EXT4_FEATURE_RO_COMPAT_QUOTA|\
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
EXT4_FEATURE_RO_COMPAT_READONLY |\
EXT4_FEATURE_RO_COMPAT_PROJECT |\
EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS |\
EXT4_FEATURE_RO_COMPAT_VERITY)
/*
* These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed
* to ext2fs_openfs()
*/
#define EXT2_LIB_SOFTSUPP_INCOMPAT (0)
#define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_REPLICA)
/* Translate a block number to a cluster number */
#define EXT2FS_CLUSTER_RATIO(fs) (1 << (fs)->cluster_ratio_bits)
#define EXT2FS_CLUSTER_MASK(fs) (EXT2FS_CLUSTER_RATIO(fs) - 1)
#define EXT2FS_B2C(fs, blk) ((blk) >> (fs)->cluster_ratio_bits)
/* Translate a cluster number to a block number */
#define EXT2FS_C2B(fs, cluster) ((cluster) << (fs)->cluster_ratio_bits)
/* Translate # of blks to # of clusters */
#define EXT2FS_NUM_B2C(fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \
(fs)->cluster_ratio_bits)
#if defined(HAVE_FSTAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
typedef struct stat64 ext2fs_struct_stat;
#else
typedef struct stat ext2fs_struct_stat;
#endif
/*
* For ext2fs_close2() and ext2fs_flush2(), this flag allows you to
* avoid the fsync call.
*/
#define EXT2_FLAG_FLUSH_NO_SYNC 1
/*
* Modify and iterate extended attributes
*/
struct ext2_xattr_handle;
#define XATTR_ABORT 1
#define XATTR_CHANGED 2
/*
* function prototypes
*/
static inline int ext2fs_has_group_desc_csum(ext2_filsys fs)
{
return ext2fs_has_feature_metadata_csum(fs->super) ||
ext2fs_has_feature_gdt_csum(fs->super);
}
/* The LARGE_FILE feature should be set if we have stored files 2GB+ in size */
static inline int ext2fs_needs_large_file_feature(unsigned long long file_size)
{
return file_size >= 0x80000000ULL;
}
/* alloc.c */
extern void ext2fs_clear_block_uninit(ext2_filsys fs, dgrp_t group);
extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
ext2fs_inode_bitmap map, ext2_ino_t *ret);
extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
ext2fs_block_bitmap map, blk_t *ret);
extern errcode_t ext2fs_new_block2(ext2_filsys fs, blk64_t goal,
ext2fs_block_bitmap map, blk64_t *ret);
extern errcode_t ext2fs_new_block3(ext2_filsys fs, blk64_t goal,
ext2fs_block_bitmap map, blk64_t *ret,
struct blk_alloc_ctx *ctx);
extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start,
blk_t finish, int num,
ext2fs_block_bitmap map,
blk_t *ret);
extern errcode_t ext2fs_get_free_blocks2(ext2_filsys fs, blk64_t start,
blk64_t finish, int num,
ext2fs_block_bitmap map,
blk64_t *ret);
extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
char *block_buf, blk_t *ret);
extern errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal,
char *block_buf, blk64_t *ret);
extern errcode_t ext2fs_alloc_block3(ext2_filsys fs, blk64_t goal,
char *block_buf, blk64_t *ret,
struct blk_alloc_ctx *ctx);
extern void ext2fs_set_alloc_block_callback(ext2_filsys fs,
errcode_t (*func)(ext2_filsys fs,
blk64_t goal,
blk64_t *ret),
errcode_t (**old)(ext2_filsys fs,
blk64_t goal,
blk64_t *ret));
blk64_t ext2fs_find_inode_goal(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode, blk64_t lblk);
extern void ext2fs_set_new_range_callback(ext2_filsys fs,
errcode_t (*func)(ext2_filsys fs, int flags, blk64_t goal,
blk64_t len, blk64_t *pblk, blk64_t *plen),
errcode_t (**old)(ext2_filsys fs, int flags, blk64_t goal,
blk64_t len, blk64_t *pblk, blk64_t *plen));
extern void ext2fs_set_block_alloc_stats_range_callback(ext2_filsys fs,
void (*func)(ext2_filsys fs, blk64_t blk,
blk_t num, int inuse),
void (**old)(ext2_filsys fs, blk64_t blk,
blk_t num, int inuse));
#define EXT2_NEWRANGE_FIXED_GOAL (0x1)
#define EXT2_NEWRANGE_MIN_LENGTH (0x2)
#define EXT2_NEWRANGE_ALL_FLAGS (0x3)
errcode_t ext2fs_new_range(ext2_filsys fs, int flags, blk64_t goal,
blk64_t len, ext2fs_block_bitmap map, blk64_t *pblk,
blk64_t *plen);
#define EXT2_ALLOCRANGE_FIXED_GOAL (0x1)
#define EXT2_ALLOCRANGE_ZERO_BLOCKS (0x2)
#define EXT2_ALLOCRANGE_ALL_FLAGS (0x3)
errcode_t ext2fs_alloc_range(ext2_filsys fs, int flags, blk64_t goal,
blk_t len, blk64_t *ret);
/* alloc_sb.c */
extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
dgrp_t group,
ext2fs_block_bitmap bmap);
extern void ext2fs_set_block_alloc_stats_callback(ext2_filsys fs,
void (*func)(ext2_filsys fs,
blk64_t blk,
int inuse),
void (**old)(ext2_filsys fs,
blk64_t blk,
int inuse));
/* alloc_stats.c */
void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);
void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
int inuse, int isdir);
void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse);
void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse);
void ext2fs_block_alloc_stats_range(ext2_filsys fs, blk64_t blk,
blk_t num, int inuse);
/* alloc_tables.c */
extern errcode_t ext2fs_allocate_tables(ext2_filsys fs);
extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
ext2fs_block_bitmap bmap);
/* badblocks.c */
extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size);
extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk);
extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk);
extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk);
extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
ext2_u32_iterate *ret);
extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk);
extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter);
extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest);
extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2);
extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret,
int size);
extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb,
blk_t blk);
extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb,
blk_t blk);
extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk);
extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk);
extern errcode_t
ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb,
ext2_badblocks_iterate *ret);
extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter,
blk_t *blk);
extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter);
extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src,
ext2_badblocks_list *dest);
extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1,
ext2_badblocks_list bb2);
extern int ext2fs_u32_list_count(ext2_u32_list bb);
/* bb_compat */
extern errcode_t badblocks_list_create(badblocks_list *ret, int size);
extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk);
extern int badblocks_list_test(badblocks_list bb, blk_t blk);
extern errcode_t badblocks_list_iterate_begin(badblocks_list bb,
badblocks_iterate *ret);
extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk);
extern void badblocks_list_iterate_end(badblocks_iterate iter);
extern void badblocks_list_free(badblocks_list bb);
/* bb_inode.c */
extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs,
ext2_badblocks_list bb_list);
/* bitmaps.c */
extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
ext2fs_generic_bitmap *dest);
extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs);
extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
const char *descr,
ext2fs_block_bitmap *ret);
extern errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs,
const char *descr,
ext2fs_block_bitmap *ret);
extern int ext2fs_get_bitmap_granularity(ext2fs_block_bitmap bitmap);
extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
const char *descr,
ext2fs_inode_bitmap *ret);
extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
ext2_ino_t end, ext2_ino_t *oend);
extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
blk_t end, blk_t *oend);
extern errcode_t ext2fs_fudge_block_bitmap_end2(ext2fs_block_bitmap bitmap,
blk64_t end, blk64_t *oend);
extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs);
extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
ext2fs_inode_bitmap bmap);
extern errcode_t ext2fs_resize_inode_bitmap2(__u64 new_end,
__u64 new_real_end,
ext2fs_inode_bitmap bmap);
extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
ext2fs_block_bitmap bmap);
extern errcode_t ext2fs_resize_block_bitmap2(__u64 new_end,
__u64 new_real_end,
ext2fs_block_bitmap bmap);
extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
ext2fs_block_bitmap bm2);
extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
ext2fs_inode_bitmap bm2);
extern errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap,
ext2_ino_t start, unsigned int num,
void *in);
extern errcode_t ext2fs_set_inode_bitmap_range2(ext2fs_inode_bitmap bmap,
__u64 start, size_t num,
void *in);
extern errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap,
ext2_ino_t start, unsigned int num,
void *out);
extern errcode_t ext2fs_get_inode_bitmap_range2(ext2fs_inode_bitmap bmap,
__u64 start, size_t num,
void *out);
extern errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap,
blk_t start, unsigned int num,
void *in);
extern errcode_t ext2fs_set_block_bitmap_range2(ext2fs_block_bitmap bmap,
blk64_t start, size_t num,
void *in);
extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap,
blk_t start, unsigned int num,
void *out);
extern errcode_t ext2fs_get_block_bitmap_range2(ext2fs_block_bitmap bmap,
blk64_t start, size_t num,
void *out);
/* blknum.c */
extern __u32 ext2fs_inode_bitmap_checksum(ext2_filsys fs, dgrp_t group);
extern __u32 ext2fs_block_bitmap_checksum(ext2_filsys fs, dgrp_t group);
extern dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t);
extern blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group);
extern blk64_t ext2fs_group_last_block2(ext2_filsys fs, dgrp_t group);
extern int ext2fs_group_blocks_count(ext2_filsys fs, dgrp_t group);
extern blk64_t ext2fs_inode_data_blocks2(ext2_filsys fs,
struct ext2_inode *inode);
extern blk64_t ext2fs_inode_i_blocks(ext2_filsys fs,
struct ext2_inode *inode);
extern blk64_t ext2fs_get_stat_i_blocks(ext2_filsys fs,
struct ext2_inode *inode);
extern blk64_t ext2fs_blocks_count(struct ext2_super_block *super);
extern void ext2fs_blocks_count_set(struct ext2_super_block *super,
blk64_t blk);
extern void ext2fs_blocks_count_add(struct ext2_super_block *super,
blk64_t blk);
extern blk64_t ext2fs_r_blocks_count(struct ext2_super_block *super);
extern void ext2fs_r_blocks_count_set(struct ext2_super_block *super,
blk64_t blk);
extern void ext2fs_r_blocks_count_add(struct ext2_super_block *super,
blk64_t blk);
extern blk64_t ext2fs_free_blocks_count(struct ext2_super_block *super);
extern void ext2fs_free_blocks_count_set(struct ext2_super_block *super,
blk64_t blk);
extern void ext2fs_free_blocks_count_add(struct ext2_super_block *super,
blk64_t blk);
/* Block group descriptor accessor functions */
extern struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs,
struct opaque_ext2_group_desc *gdp,
dgrp_t group);
extern blk64_t ext2fs_block_bitmap_csum(ext2_filsys fs, dgrp_t group);
extern blk64_t ext2fs_block_bitmap_loc(ext2_filsys fs, dgrp_t group);
extern void ext2fs_block_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern __u32 ext2fs_inode_bitmap_csum(ext2_filsys fs, dgrp_t group);
extern blk64_t ext2fs_inode_bitmap_loc(ext2_filsys fs, dgrp_t group);
extern void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group);
extern void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group,
__u32 n);
extern __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group,
__u32 n);
extern __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group,
__u32 n);
extern __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group,
__u32 n);
extern __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_flags_zap(ext2_filsys fs, dgrp_t group);
extern int ext2fs_bg_flags_test(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
extern void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
extern __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum);
extern blk64_t ext2fs_file_acl_block(ext2_filsys fs,
const struct ext2_inode *inode);
extern void ext2fs_file_acl_block_set(ext2_filsys fs,
struct ext2_inode *inode, blk64_t blk);
extern errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode,
ext2_off64_t size);
/* block.c */
extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
ext2_ino_t ino,
int flags,
char *block_buf,
int (*func)(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *priv_data),
void *priv_data);
errcode_t ext2fs_block_iterate2(ext2_filsys fs,
ext2_ino_t ino,
int flags,
char *block_buf,
int (*func)(ext2_filsys fs,
blk_t *blocknr,
e2_blkcnt_t blockcnt,
blk_t ref_blk,
int ref_offset,
void *priv_data),
void *priv_data);
errcode_t ext2fs_block_iterate3(ext2_filsys fs,
ext2_ino_t ino,
int flags,
char *block_buf,
int (*func)(ext2_filsys fs,
blk64_t *blocknr,
e2_blkcnt_t blockcnt,
blk64_t ref_blk,
int ref_offset,
void *priv_data),
void *priv_data);
/* bmap.c */
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
char *block_buf, int bmap_flags,
blk_t block, blk_t *phys_blk);
extern errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
char *block_buf, int bmap_flags, blk64_t block,
int *ret_flags, blk64_t *phys_blk);
errcode_t ext2fs_map_cluster_block(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode, blk64_t lblk,
blk64_t *pblk);
#if 0
/* bmove.c */
extern errcode_t ext2fs_move_blocks(ext2_filsys fs,
ext2fs_block_bitmap reserve,
ext2fs_block_bitmap alloc_map,
int flags);
#endif
/* check_desc.c */
extern errcode_t ext2fs_check_desc(ext2_filsys fs);
/* closefs.c */
extern errcode_t ext2fs_close(ext2_filsys fs);
extern errcode_t ext2fs_close2(ext2_filsys fs, int flags);
extern errcode_t ext2fs_close_free(ext2_filsys *fs);
extern errcode_t ext2fs_flush(ext2_filsys fs);
extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags);
extern int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group_block);
extern errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs,
dgrp_t group,
blk64_t *ret_super_blk,
blk64_t *ret_old_desc_blk,
blk64_t *ret_new_desc_blk,
blk_t *ret_used_blks);
extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
dgrp_t group,
blk_t *ret_super_blk,
blk_t *ret_old_desc_blk,
blk_t *ret_new_desc_blk,
int *ret_meta_bg);
extern void ext2fs_update_dynamic_rev(ext2_filsys fs);
/* crc32c.c */
extern __u32 ext2fs_crc32_be(__u32 crc, unsigned char const *p, size_t len);
extern __u32 ext2fs_crc32c_le(__u32 crc, unsigned char const *p, size_t len);
/* csum.c */
extern void ext2fs_init_csum_seed(ext2_filsys fs);
extern errcode_t ext2fs_mmp_csum_set(ext2_filsys fs, struct mmp_struct *mmp);
extern int ext2fs_mmp_csum_verify(ext2_filsys, struct mmp_struct *mmp);
extern int ext2fs_verify_csum_type(ext2_filsys fs, struct ext2_super_block *sb);
extern errcode_t ext2fs_superblock_csum_set(ext2_filsys fs,
struct ext2_super_block *sb);
extern int ext2fs_superblock_csum_verify(ext2_filsys fs,
struct ext2_super_block *sb);
extern errcode_t ext2fs_ext_attr_block_csum_set(ext2_filsys fs,
ext2_ino_t inum, blk64_t block,
struct ext2_ext_attr_header *hdr);
extern int ext2fs_ext_attr_block_csum_verify(ext2_filsys fs, ext2_ino_t inum,
blk64_t block,
struct ext2_ext_attr_header *hdr);
#define EXT2_DIRENT_TAIL(block, blocksize) \
((struct ext2_dir_entry_tail *)(((char *)(block)) + \
(blocksize) - sizeof(struct ext2_dir_entry_tail)))
extern void ext2fs_initialize_dirent_tail(ext2_filsys fs,
struct ext2_dir_entry_tail *t);
extern int ext2fs_dirent_has_tail(ext2_filsys fs,
struct ext2_dir_entry *dirent);
extern int ext2fs_dirent_csum_verify(ext2_filsys fs, ext2_ino_t inum,
struct ext2_dir_entry *dirent);
extern int ext2fs_dir_block_csum_verify(ext2_filsys fs, ext2_ino_t inum,
struct ext2_dir_entry *dirent);
extern errcode_t ext2fs_dir_block_csum_set(ext2_filsys fs, ext2_ino_t inum,
struct ext2_dir_entry *dirent);
extern errcode_t ext2fs_get_dx_countlimit(ext2_filsys fs,
struct ext2_dir_entry *dirent,
struct ext2_dx_countlimit **cc,
int *offset);
extern errcode_t ext2fs_extent_block_csum_set(ext2_filsys fs,
ext2_ino_t inum,
struct ext3_extent_header *eh);
extern int ext2fs_extent_block_csum_verify(ext2_filsys fs,
ext2_ino_t inum,
struct ext3_extent_header *eh);
extern errcode_t ext2fs_block_bitmap_csum_set(ext2_filsys fs, dgrp_t group,
char *bitmap, int size);
extern int ext2fs_block_bitmap_csum_verify(ext2_filsys fs, dgrp_t group,
char *bitmap, int size);
extern errcode_t ext2fs_inode_bitmap_csum_set(ext2_filsys fs, dgrp_t group,
char *bitmap, int size);
extern int ext2fs_inode_bitmap_csum_verify(ext2_filsys fs, dgrp_t group,
char *bitmap, int size);
extern errcode_t ext2fs_inode_csum_set(ext2_filsys fs, ext2_ino_t inum,
struct ext2_inode_large *inode);
extern int ext2fs_inode_csum_verify(ext2_filsys fs, ext2_ino_t inum,
struct ext2_inode_large *inode);
extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group);
extern int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group);
extern errcode_t ext2fs_set_gdt_csum(ext2_filsys fs);
extern __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group);
/* dblist.c */
extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist);
extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino,
blk_t blk, int blockcnt);
extern errcode_t ext2fs_add_dir_block2(ext2_dblist dblist, ext2_ino_t ino,
blk64_t blk, e2_blkcnt_t blockcnt);
extern void ext2fs_dblist_sort(ext2_dblist dblist,
EXT2_QSORT_TYPE (*sortfunc)(const void *,
const void *));
extern void ext2fs_dblist_sort2(ext2_dblist dblist,
EXT2_QSORT_TYPE (*sortfunc)(const void *,
const void *));
extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
void *priv_data),
void *priv_data);
extern errcode_t ext2fs_dblist_iterate2(ext2_dblist dblist,
int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info,
void *priv_data),
void *priv_data);
extern errcode_t ext2fs_dblist_iterate3(ext2_dblist dblist,
int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info,
void *priv_data),
unsigned long long start,
unsigned long long count,
void *priv_data);
extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino,
blk_t blk, int blockcnt);
extern errcode_t ext2fs_set_dir_block2(ext2_dblist dblist, ext2_ino_t ino,
blk64_t blk, e2_blkcnt_t blockcnt);
extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
ext2_dblist *dest);
extern int ext2fs_dblist_count(ext2_dblist dblist);
extern blk64_t ext2fs_dblist_count2(ext2_dblist dblist);
extern errcode_t ext2fs_dblist_get_last(ext2_dblist dblist,
struct ext2_db_entry **entry);
extern errcode_t ext2fs_dblist_get_last2(ext2_dblist dblist,
struct ext2_db_entry2 **entry);
extern errcode_t ext2fs_dblist_drop_last(ext2_dblist dblist);
/* dblist_dir.c */
extern errcode_t
ext2fs_dblist_dir_iterate(ext2_dblist dblist,
int flags,
char *block_buf,
int (*func)(ext2_ino_t dir,
int entry,
struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *priv_data),
void *priv_data);
#if 0
/* digest_encode.c */
#define EXT2FS_DIGEST_SIZE EXT2FS_SHA256_LENGTH
extern int ext2fs_digest_encode(const char *src, int len, char *dst);
extern int ext2fs_digest_decode(const char *src, int len, char *dst);
#endif
/* dirblock.c */
extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
void *buf);
extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
void *buf, int flags);
extern errcode_t ext2fs_read_dir_block3(ext2_filsys fs, blk64_t block,
void *buf, int flags);
extern errcode_t ext2fs_read_dir_block4(ext2_filsys fs, blk64_t block,
void *buf, int flags, ext2_ino_t ino);
extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
void *buf);
extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
void *buf, int flags);
extern errcode_t ext2fs_write_dir_block3(ext2_filsys fs, blk64_t block,
void *buf, int flags);
extern errcode_t ext2fs_write_dir_block4(ext2_filsys fs, blk64_t block,
void *buf, int flags, ext2_ino_t ino);
/* dirhash.c */
extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
const __u32 *seed,
ext2_dirhash_t *ret_hash,
ext2_dirhash_t *ret_minor_hash);
extern errcode_t ext2fs_dirhash2(int version, const char *name, int len,
const struct ext2fs_nls_table *charset,
int hash_flags,
const __u32 *seed,
ext2_dirhash_t *ret_hash,
ext2_dirhash_t *ret_minor_hash);
/* dir_iterate.c */
extern errcode_t ext2fs_get_rec_len(ext2_filsys fs,
struct ext2_dir_entry *dirent,
unsigned int *rec_len);
extern errcode_t ext2fs_set_rec_len(ext2_filsys fs,
unsigned int len,
struct ext2_dir_entry *dirent);
extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
ext2_ino_t dir,
int flags,
char *block_buf,
int (*func)(struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *priv_data),
void *priv_data);
extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
ext2_ino_t dir,
int flags,
char *block_buf,
int (*func)(ext2_ino_t dir,
int entry,
struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *priv_data),
void *priv_data);
/* dupfs.c */
extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
/* expanddir.c */
extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);
/* ext_attr.c */
extern __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry,
void *data);
extern errcode_t ext2fs_ext_attr_hash_entry2(ext2_filsys fs,
struct ext2_ext_attr_entry *entry,
void *data, __u32 *hash);
extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
extern errcode_t ext2fs_read_ext_attr2(ext2_filsys fs, blk64_t block,
void *buf);
extern errcode_t ext2fs_read_ext_attr3(ext2_filsys fs, blk64_t block,
void *buf, ext2_ino_t inum);
extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block,
void *buf);
extern errcode_t ext2fs_write_ext_attr2(ext2_filsys fs, blk64_t block,
void *buf);
extern errcode_t ext2fs_write_ext_attr3(ext2_filsys fs, blk64_t block,
void *buf, ext2_ino_t inum);
extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
char *block_buf,
int adjust, __u32 *newcount);
extern errcode_t ext2fs_adjust_ea_refcount2(ext2_filsys fs, blk64_t blk,
char *block_buf,
int adjust, __u32 *newcount);
extern errcode_t ext2fs_adjust_ea_refcount3(ext2_filsys fs, blk64_t blk,
char *block_buf,
int adjust, __u32 *newcount,
ext2_ino_t inum);
errcode_t ext2fs_xattrs_write(struct ext2_xattr_handle *handle);
errcode_t ext2fs_xattrs_read(struct ext2_xattr_handle *handle);
errcode_t ext2fs_xattrs_iterate(struct ext2_xattr_handle *h,
int (*func)(char *name, char *value,
size_t value_len, void *data),
void *data);
errcode_t ext2fs_xattr_get(struct ext2_xattr_handle *h, const char *key,
void **value, size_t *value_len);
errcode_t ext2fs_xattr_set(struct ext2_xattr_handle *handle,
const char *key,
const void *value,
size_t value_len);
errcode_t ext2fs_xattr_remove(struct ext2_xattr_handle *handle,
const char *key);
errcode_t ext2fs_xattrs_open(ext2_filsys fs, ext2_ino_t ino,
struct ext2_xattr_handle **handle);
errcode_t ext2fs_xattrs_close(struct ext2_xattr_handle **handle);
errcode_t ext2fs_free_ext_attr(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode_large *inode);
errcode_t ext2fs_xattrs_count(struct ext2_xattr_handle *handle, size_t *count);
errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino,
size_t *size);
#define XATTR_HANDLE_FLAG_RAW 0x0001
errcode_t ext2fs_xattrs_flags(struct ext2_xattr_handle *handle,
unsigned int *new_flags, unsigned int *old_flags);
extern void ext2fs_ext_attr_block_rehash(struct ext2_ext_attr_header *header,
struct ext2_ext_attr_entry *end);
extern __u32 ext2fs_get_ea_inode_hash(struct ext2_inode *inode);
extern void ext2fs_set_ea_inode_hash(struct ext2_inode *inode, __u32 hash);
extern __u64 ext2fs_get_ea_inode_ref(struct ext2_inode *inode);
extern void ext2fs_set_ea_inode_ref(struct ext2_inode *inode, __u64 ref_count);
/* extent.c */
extern errcode_t ext2fs_extent_header_verify(void *ptr, int size);
extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino,
ext2_extent_handle_t *handle);
extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
ext2_extent_handle_t *ret_handle);
extern void ext2fs_extent_free(ext2_extent_handle_t handle);
extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle,
int flags, struct ext2fs_extent *extent);
extern errcode_t ext2fs_extent_node_split(ext2_extent_handle_t handle);
extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags,
struct ext2fs_extent *extent);
extern errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags,
struct ext2fs_extent *extent);
extern errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle,
blk64_t logical, blk64_t physical,
int flags);
extern errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags);
extern errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle,
struct ext2_extent_info *info);
extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle,
blk64_t blk);
extern errcode_t ext2fs_extent_goto2(ext2_extent_handle_t handle,
int leaf_level, blk64_t blk);
extern errcode_t ext2fs_extent_fix_parents(ext2_extent_handle_t handle);
extern size_t ext2fs_max_extent_depth(ext2_extent_handle_t handle);
extern errcode_t ext2fs_fix_extents_checksums(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode);
/* fallocate.c */
#define EXT2_FALLOCATE_ZERO_BLOCKS (0x1)
#define EXT2_FALLOCATE_FORCE_INIT (0x2)
#define EXT2_FALLOCATE_FORCE_UNINIT (0x4)
#define EXT2_FALLOCATE_INIT_BEYOND_EOF (0x8)
#define EXT2_FALLOCATE_ALL_FLAGS (0xF)
errcode_t ext2fs_fallocate(ext2_filsys fs, int flags, ext2_ino_t ino,
struct ext2_inode *inode, blk64_t goal,
blk64_t start, blk64_t len);
/* fileio.c */
extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
int flags, ext2_file_t *ret);
extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
int flags, ext2_file_t *ret);
extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);
extern ext2_ino_t ext2fs_file_get_inode_num(ext2_file_t file);
extern errcode_t ext2fs_file_close(ext2_file_t file);
extern errcode_t ext2fs_file_flush(ext2_file_t file);
extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
unsigned int wanted, unsigned int *got);
extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
unsigned int nbytes, unsigned int *written);
extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset,
int whence, __u64 *ret_pos);
extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
int whence, ext2_off_t *ret_pos);
errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size);
extern ext2_off_t ext2fs_file_get_size(ext2_file_t file);
extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size);
extern errcode_t ext2fs_file_set_size2(ext2_file_t file, ext2_off64_t size);
/* finddev.c */
extern char *ext2fs_find_block_device(dev_t device);
/* flushb.c */
extern errcode_t ext2fs_sync_device(int fd, int flushb);
/* freefs.c */
extern void ext2fs_free(ext2_filsys fs);
extern void ext2fs_free_dblist(ext2_dblist dblist);
extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb);
extern void ext2fs_u32_list_free(ext2_u32_list bb);
/* gen_bitmap.c */
extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap);
extern errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
__u32 start, __u32 end,
__u32 real_end,
const char *descr, char *init_map,
ext2fs_generic_bitmap *ret);
extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
__u32 end,
__u32 real_end,
const char *descr,
ext2fs_generic_bitmap *ret);
extern errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src,
ext2fs_generic_bitmap *dest);
extern void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap);
extern errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap,
errcode_t magic,
errcode_t neq,
ext2_ino_t end,
ext2_ino_t *oend);
extern void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map);
extern errcode_t ext2fs_resize_generic_bitmap(errcode_t magic,
__u32 new_end,
__u32 new_real_end,
ext2fs_generic_bitmap bmap);
extern errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq,
ext2fs_generic_bitmap bm1,
ext2fs_generic_bitmap bm2);
extern errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap,
errcode_t magic,
__u32 start, __u32 num,
void *out);
extern errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap,
errcode_t magic,
__u32 start, __u32 num,
void *in);
extern errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap bitmap,
__u32 start, __u32 end,
__u32 *out);
extern errcode_t ext2fs_find_first_set_generic_bitmap(ext2fs_generic_bitmap bitmap,
__u32 start, __u32 end,
__u32 *out);
/* gen_bitmap64.c */
void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap);
errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
int type, __u64 start, __u64 end,
__u64 real_end,
const char *descr,
ext2fs_generic_bitmap *ret);
errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
ext2fs_generic_bitmap *dest);
void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
errcode_t neq,
__u64 end, __u64 *oend);
void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
__u64 new_end,
__u64 new_real_end);
errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
ext2fs_generic_bitmap bm1,
ext2fs_generic_bitmap bm2);
errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap,
__u64 start, unsigned int num,
void *out);
errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap,
__u64 start, unsigned int num,
void *in);
errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
ext2fs_block_bitmap *bitmap);
/* get_num_dirs.c */
extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs);
/* getsize.c */
extern errcode_t ext2fs_get_device_size(const char *file, int blocksize,
blk_t *retblocks);
extern errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
blk64_t *retblocks);
/* getsectsize.c */
extern int ext2fs_get_dio_alignment(int fd);
errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize);
errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize);
/* i_block.c */
errcode_t ext2fs_iblk_add_blocks(ext2_filsys fs, struct ext2_inode *inode,
blk64_t num_blocks);
errcode_t ext2fs_iblk_sub_blocks(ext2_filsys fs, struct ext2_inode *inode,
blk64_t num_blocks);
errcode_t ext2fs_iblk_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t b);
/* imager.c */
extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags);
extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags);
extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags);
extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags);
extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags);
extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags);
/* ind_block.c */
errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf);
errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf);
/* initialize.c */
extern errcode_t ext2fs_initialize(const char *name, int flags,
struct ext2_super_block *param,
io_manager manager, ext2_filsys *ret_fs);
/* icount.c */
extern void ext2fs_free_icount(ext2_icount_t icount);
extern errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
int flags, ext2_icount_t *ret);
extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags,
unsigned int size,
ext2_icount_t hint, ext2_icount_t *ret);
extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
unsigned int size,
ext2_icount_t *ret);
extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
__u16 *ret);
extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
__u16 *ret);
extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
__u16 *ret);
extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
__u16 count);
extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
/* inline.c */
extern errcode_t ext2fs_get_memalign(unsigned long size,
unsigned long align, void *ptr);
/* inline_data.c */
extern errcode_t ext2fs_inline_data_init(ext2_filsys fs, ext2_ino_t ino);
extern errcode_t ext2fs_inline_data_size(ext2_filsys fs, ext2_ino_t ino,
size_t *size);
extern errcode_t ext2fs_inline_data_get(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
void *buf, size_t *size);
extern errcode_t ext2fs_inline_data_set(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
void *buf, size_t size);
/* inode.c */
extern errcode_t ext2fs_create_inode_cache(ext2_filsys fs,
unsigned int cache_size);
extern void ext2fs_free_inode_cache(struct ext2_inode_cache *icache);
extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
ext2_ino_t *ino,
struct ext2_inode *inode,
int bufsize);
#define EXT2_INODE_SCAN_DEFAULT_BUFFER_BLOCKS 8
extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
ext2_inode_scan *ret_scan);
extern void ext2fs_close_inode_scan(ext2_inode_scan scan);
extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
struct ext2_inode *inode);
extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
int group);
extern void ext2fs_set_inode_callback
(ext2_inode_scan scan,
errcode_t (*done_group)(ext2_filsys fs,
ext2_inode_scan scan,
dgrp_t group,
void * priv_data),
void *done_group_data);
extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
int clear_flags);
extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode,
int bufsize);
extern errcode_t ext2fs_read_inode(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode);
extern errcode_t ext2fs_read_inode2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode,
int bufsize, int flags);
extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode,
int bufsize);
extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode);
extern errcode_t ext2fs_write_inode2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode,
int bufsize, int flags);
extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode);
extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
/* inode_io.c */
extern io_manager inode_io_manager;
extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
char **name);
extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
char **name);
/* ismounted.c */
extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
char *mtpt, int mtlen);
/* punch.c */
/*
* NOTE: This function removes from an inode the blocks "start", "end", and
* every block in between.
*/
extern errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
char *block_buf, blk64_t start,
blk64_t end);
/* namei.c */
extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
int namelen, char *buf, ext2_ino_t *inode);
extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
const char *name, ext2_ino_t *inode);
errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
const char *name, ext2_ino_t *inode);
extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
ext2_ino_t inode, ext2_ino_t *res_inode);
/* native.c */
int ext2fs_native_flag(void);
/* newdir.c */
extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
ext2_ino_t parent_ino, char **block);
extern errcode_t ext2fs_new_dir_inline_data(ext2_filsys fs, ext2_ino_t dir_ino,
ext2_ino_t parent_ino, __u32 *iblock);
/* nls_utf8.c */
extern const struct ext2fs_nls_table *ext2fs_load_nls_table(int encoding);
/* mkdir.c */
extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
const char *name);
/* mkjournal.c */
extern errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num,
blk_t *ret_blk, int *ret_count);
extern errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num,
blk64_t *ret_blk, int *ret_count);
extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
__u32 num_blocks, int flags,
char **ret_jsb);
extern errcode_t ext2fs_add_journal_device(ext2_filsys fs,
ext2_filsys journal_dev);
extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t num_blocks,
int flags);
extern errcode_t ext2fs_add_journal_inode2(ext2_filsys fs, blk_t num_blocks,
blk64_t goal, int flags);
extern int ext2fs_default_journal_size(__u64 num_blocks);
extern int ext2fs_journal_sb_start(int blocksize);
/* openfs.c */
extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
unsigned int block_size, io_manager manager,
ext2_filsys *ret_fs);
extern errcode_t ext2fs_open2(const char *name, const char *io_options,
int flags, int superblock,
unsigned int block_size, io_manager manager,
ext2_filsys *ret_fs);
/*
* The dgrp_t argument to these two functions is not actually a group number
* but a block number offset within a group table! Convert with the formula
* (group_number / groups_per_block).
*/
extern blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs,
blk64_t group_block, dgrp_t i);
extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block,
dgrp_t i);
errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io);
/* get_pathname.c */
extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
char **name);
/* link.c */
errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
ext2_ino_t ino, int flags);
errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name,
ext2_ino_t ino, int flags);
/* symlink.c */
errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino,
const char *name, const char *target);
int ext2fs_is_fast_symlink(struct ext2_inode *inode);
/* mmp.c */
errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf);
errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf);
errcode_t ext2fs_mmp_clear(ext2_filsys fs);
errcode_t ext2fs_mmp_init(ext2_filsys fs);
errcode_t ext2fs_mmp_start(ext2_filsys fs);
errcode_t ext2fs_mmp_update(ext2_filsys fs);
errcode_t ext2fs_mmp_update2(ext2_filsys fs, int immediately);
errcode_t ext2fs_mmp_stop(ext2_filsys fs);
unsigned ext2fs_mmp_new_seq(void);
/* read_bb.c */
extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
ext2_badblocks_list *bb_list);
/* read_bb_file.c */
extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
ext2_badblocks_list *bb_list,
void *priv_data,
void (*invalid)(ext2_filsys fs,
blk_t blk,
char *badstr,
void *priv_data));
extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
ext2_badblocks_list *bb_list,
void (*invalid)(ext2_filsys fs,
blk_t blk));
/* res_gdt.c */
extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs);
/*sha256.c */
#define EXT2FS_SHA256_LENGTH 32
#if 0
extern void ext2fs_sha256(const unsigned char *in, unsigned long in_size,
unsigned char out[EXT2FS_SHA256_LENGTH]);
#endif
/* sha512.c */
#define EXT2FS_SHA512_LENGTH 64
extern void ext2fs_sha512(const unsigned char *in, unsigned long in_size,
unsigned char out[EXT2FS_SHA512_LENGTH]);
/* swapfs.c */
extern errcode_t ext2fs_dirent_swab_in2(ext2_filsys fs, char *buf, size_t size,
int flags);
extern errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags);
extern errcode_t ext2fs_dirent_swab_out2(ext2_filsys fs, char *buf, size_t size,
int flags);
extern errcode_t ext2fs_dirent_swab_out(ext2_filsys fs, char *buf, int flags);
extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize,
int has_header);
extern void ext2fs_swap_ext_attr_header(struct ext2_ext_attr_header *to_header,
struct ext2_ext_attr_header *from_hdr);
extern void ext2fs_swap_ext_attr_entry(struct ext2_ext_attr_entry *to_entry,
struct ext2_ext_attr_entry *from_entry);
extern void ext2fs_swap_super(struct ext2_super_block * super);
extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
extern void ext2fs_swap_group_desc2(ext2_filsys, struct ext2_group_desc *gdp);
extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
struct ext2_inode_large *f, int hostorder,
int bufsize);
extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t,
struct ext2_inode *f, int hostorder);
extern void ext2fs_swap_mmp(struct mmp_struct *mmp);
/* unix_io.c */
extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode);
extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
/* valid_blk.c */
extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
extern int ext2fs_inode_has_valid_blocks2(ext2_filsys fs,
struct ext2_inode *inode);
/* version.c */
extern int ext2fs_parse_version_string(const char *ver_string);
extern int ext2fs_get_library_version(const char **ver_string,
const char **date_string);
/* write_bb_file.c */
extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
unsigned int flags,
FILE *f);
/* inline functions */
#ifdef NO_INLINE_FUNCS
extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr);
extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr);
extern errcode_t ext2fs_get_array(unsigned long count,
unsigned long size, void *ptr);
extern errcode_t ext2fs_get_arrayzero(unsigned long count,
unsigned long size, void *ptr);
extern errcode_t ext2fs_free_mem(void *ptr);
extern errcode_t ext2fs_resize_mem(unsigned long old_size,
unsigned long size, void *ptr);
extern errcode_t ext2fs_resize_array(unsigned long old_count, unsigned long count,
unsigned long size, void *ptr);
extern void ext2fs_mark_super_dirty(ext2_filsys fs);
extern void ext2fs_mark_changed(ext2_filsys fs);
extern int ext2fs_test_changed(ext2_filsys fs);
extern void ext2fs_mark_valid(ext2_filsys fs);
extern void ext2fs_unmark_valid(ext2_filsys fs);
extern int ext2fs_test_valid(ext2_filsys fs);
extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
extern int ext2fs_test_ib_dirty(ext2_filsys fs);
extern int ext2fs_test_bb_dirty(ext2_filsys fs);
extern dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
extern dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group);
extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group);
extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
struct ext2_inode *inode);
extern int ext2fs_htree_intnode_maxrecs(ext2_filsys fs, int blocks);
extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
extern int ext2fs_dirent_name_len(const struct ext2_dir_entry *entry);
extern void ext2fs_dirent_set_name_len(struct ext2_dir_entry *entry, int len);
extern int ext2fs_dirent_file_type(const struct ext2_dir_entry *entry);
extern void ext2fs_dirent_set_file_type(struct ext2_dir_entry *entry, int type);
extern struct ext2_inode *ext2fs_inode(struct ext2_inode_large * large_inode);
extern const struct ext2_inode *ext2fs_const_inode(const struct ext2_inode_large * large_inode);
#endif
/*
* The actual inlined functions definitions themselves...
*
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
* functions at all!
*/
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef INCLUDE_INLINE_FUNCS
#define _INLINE_ extern
#else
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif
#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
#include <string.h>
/*
* Allocate memory. The 'ptr' arg must point to a pointer.
*/
_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
{
void *pp;
pp = malloc(size);
if (!pp)
return EXT2_ET_NO_MEMORY;
memcpy(ptr, &pp, sizeof (pp));
return 0;
}
_INLINE_ errcode_t ext2fs_get_memzero(unsigned long size, void *ptr)
{
void *pp;
pp = malloc(size);
if (!pp)
return EXT2_ET_NO_MEMORY;
memset(pp, 0, size);
memcpy(ptr, &pp, sizeof(pp));
return 0;
}
_INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size,
void *ptr)
{
if (count && (~0UL)/count < size)
return EXT2_ET_NO_MEMORY;
return ext2fs_get_mem(count*size, ptr);
}
_INLINE_ errcode_t ext2fs_get_arrayzero(unsigned long count,
unsigned long size, void *ptr)
{
if (count && (~0UL)/count < size)
return EXT2_ET_NO_MEMORY;
return ext2fs_get_memzero((size_t)count * size, ptr);
}
/*
* Free memory. The 'ptr' arg must point to a pointer.
*/
_INLINE_ errcode_t ext2fs_free_mem(void *ptr)
{
void *p;
memcpy(&p, ptr, sizeof(p));
free(p);
p = 0;
memcpy(ptr, &p, sizeof(p));
return 0;
}
/*
* Resize memory. The 'ptr' arg must point to a pointer.
*/
_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
unsigned long size, void *ptr)
{
void *p;
/* Use "memcpy" for pointer assignments here to avoid problems
* with C99 strict type aliasing rules. */
memcpy(&p, ptr, sizeof(p));
p = realloc(p, size);
if (!p)
return EXT2_ET_NO_MEMORY;
memcpy(ptr, &p, sizeof(p));
return 0;
}
/*
* Resize array. The 'ptr' arg must point to a pointer.
*/
_INLINE_ errcode_t ext2fs_resize_array(unsigned long size,
unsigned long old_count,
unsigned long count, void *ptr)
{
unsigned long old_size;
errcode_t retval;
if (count && (~0UL)/count < size)
return EXT2_ET_NO_MEMORY;
size *= count;
old_size = size * old_count;
retval = ext2fs_resize_mem(old_size, size, ptr);
if (retval)
return retval;
if (size > old_size) {
void *p;
memcpy(&p, ptr, sizeof(p));
memset((char *)p + old_size, 0, size - old_size);
memcpy(ptr, &p, sizeof(p));
}
return 0;
}
#endif /* Custom memory routines */
/*
* Mark a filesystem superblock as dirty
*/
_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
{
fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
}
/*
* Mark a filesystem as changed
*/
_INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
{
fs->flags |= EXT2_FLAG_CHANGED;
}
/*
* Check to see if a filesystem has changed
*/
_INLINE_ int ext2fs_test_changed(ext2_filsys fs)
{
return (fs->flags & EXT2_FLAG_CHANGED);
}
/*
* Mark a filesystem as valid
*/
_INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
{
fs->flags |= EXT2_FLAG_VALID;
}
/*
* Mark a filesystem as NOT valid
*/
_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
{
fs->flags &= ~EXT2_FLAG_VALID;
}
/*
* Check to see if a filesystem is valid
*/
_INLINE_ int ext2fs_test_valid(ext2_filsys fs)
{
return (fs->flags & EXT2_FLAG_VALID);
}
/*
* Mark the inode bitmap as dirty
*/
_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
{
fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
}
/*
* Mark the block bitmap as dirty
*/
_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
{
fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
}
/*
* Check to see if a filesystem's inode bitmap is dirty
*/
_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
{
return (fs->flags & EXT2_FLAG_IB_DIRTY);
}
/*
* Check to see if a filesystem's block bitmap is dirty
*/
_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
{
return (fs->flags & EXT2_FLAG_BB_DIRTY);
}
/*
* Return the group # of a block
*/
_INLINE_ dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
{
return ext2fs_group_of_blk2(fs, blk);
}
/*
* Return the group # of an inode number
*/
_INLINE_ dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
{
return (ino - 1) / fs->super->s_inodes_per_group;
}
/*
* Return the first block (inclusive) in a group
*/
_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
{
return (blk_t) ext2fs_group_first_block2(fs, group);
}
/*
* Return the last block (inclusive) in a group
*/
_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group)
{
return (blk_t) ext2fs_group_last_block2(fs, group);
}
_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
struct ext2_inode *inode)
{
return (blk_t) ext2fs_inode_data_blocks2(fs, inode);
}
_INLINE_ int ext2fs_htree_intnode_maxrecs(ext2_filsys fs, int blocks)
{
int csum_size = 0;
if ((EXT2_SB(fs->super)->s_feature_ro_compat &
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) != 0)
csum_size = sizeof(struct ext2_dx_tail);
return blocks * ((fs->blocksize - (8 + csum_size)) /
sizeof(struct ext2_dx_entry));
}
/*
* This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b)
*/
_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b)
{
if (!a)
return 0;
return ((a - 1) / b) + 1;
}
_INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b)
{
if (!a)
return 0;
return ((a - 1) / b) + 1;
}
_INLINE_ int ext2fs_dirent_name_len(const struct ext2_dir_entry *entry)
{
return entry->name_len & 0xff;
}
_INLINE_ void ext2fs_dirent_set_name_len(struct ext2_dir_entry *entry, int len)
{
entry->name_len = (entry->name_len & 0xff00) | (len & 0xff);
}
_INLINE_ int ext2fs_dirent_file_type(const struct ext2_dir_entry *entry)
{
return entry->name_len >> 8;
}
_INLINE_ void ext2fs_dirent_set_file_type(struct ext2_dir_entry *entry, int type)
{
entry->name_len = (entry->name_len & 0xff) | (type << 8);
}
_INLINE_ struct ext2_inode *ext2fs_inode(struct ext2_inode_large * large_inode)
{
/* It is always safe to convert large inode to a small inode */
return (struct ext2_inode *) large_inode;
}
_INLINE_ const struct ext2_inode *
ext2fs_const_inode(const struct ext2_inode_large * large_inode)
{
/* It is always safe to convert large inode to a small inode */
return (const struct ext2_inode *) large_inode;
}
#undef _INLINE_
#endif
/* htree levels for ext4 */
#define EXT4_HTREE_LEVEL_COMPAT 2
#define EXT4_HTREE_LEVEL 3
static inline unsigned int ext2_dir_htree_level(ext2_filsys fs)
{
if (ext2fs_has_feature_largedir(fs->super))
return EXT4_HTREE_LEVEL;
return EXT4_HTREE_LEVEL_COMPAT;
}
#ifdef __cplusplus
}
#endif
#endif /* _EXT2FS_EXT2FS_H */
/*
* linux/include/linux/ext2_fs.h
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
* from
*
* linux/include/linux/minix_fs.h
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef _LINUX_EXT2_FS_H
#define _LINUX_EXT2_FS_H
#include <ext2fs/ext2_types.h> /* Changed from linux/types.h */
#ifndef __GNUC_PREREQ
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
#define __GNUC_PREREQ(maj, min) 0
#endif
#endif
/*
* The second extended filesystem constants/structures
*/
/*
* Define EXT2FS_DEBUG to produce debug messages
*/
#undef EXT2FS_DEBUG
/*
* Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
*/
#define EXT2_PREALLOCATE
#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
/*
* The second extended file system version
*/
#define EXT2FS_DATE "95/08/09"
#define EXT2FS_VERSION "0.5b"
/*
* Special inode numbers
*/
#define EXT2_BAD_INO 1 /* Bad blocks inode */
#define EXT2_ROOT_INO 2 /* Root inode */
#define EXT4_USR_QUOTA_INO 3 /* User quota inode */
#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */
#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */
#define EXT2_JOURNAL_INO 8 /* Journal inode */
#define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */
#define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */
/* First non-reserved inode for old ext2 filesystems */
#define EXT2_GOOD_OLD_FIRST_INO 11
/*
* The second extended file system magic number
*/
#define EXT2_SUPER_MAGIC 0xEF53
#ifdef __KERNEL__
#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
#else
/* Assume that user mode programs are passing in an ext2fs superblock, not
* a kernel struct super_block. This will allow us to call the feature-test
* macros from user land. */
#define EXT2_SB(sb) (sb)
#endif
/*
* Maximal count of links to a file
*/
#define EXT2_LINK_MAX 65000
/*
* Macro-instructions used to manage several block sizes
*/
#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */
#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */
#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE)
#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE)
#ifdef __KERNEL__
#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits)
#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
#else
#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino)
#endif
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32))
/*
* Macro-instructions used to manage allocation clusters
*/
#define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
#define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */
#define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE
#define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE)
#define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \
(s)->s_log_cluster_size)
#define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10)
/*
* Macro-instructions used to manage fragments
*
* Note: for backwards compatibility only, for the dump program.
* Ext2/3/4 will never support fragments....
*/
#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE
#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE
#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
#define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s)
#define EXT2_FRAGS_PER_BLOCK(s) 1
/*
* ACL structures
*/
struct ext2_acl_header /* Header of Access Control Lists */
{
__u32 aclh_size;
__u32 aclh_file_count;
__u32 aclh_acle_count;
__u32 aclh_first_acle;
};
struct ext2_acl_entry /* Access Control List Entry */
{
__u32 acle_size;
__u16 acle_perms; /* Access permissions */
__u16 acle_type; /* Type of entry */
__u16 acle_tag; /* User or group identity */
__u16 acle_pad1;
__u32 acle_next; /* Pointer on next entry for the */
/* same inode or on next free entry */
};
/*
* Structure of a blocks group descriptor
*/
struct ext2_group_desc
{
__u32 bg_block_bitmap; /* Blocks bitmap block */
__u32 bg_inode_bitmap; /* Inodes bitmap block */
__u32 bg_inode_table; /* Inodes table block */
__u16 bg_free_blocks_count; /* Free blocks count */
__u16 bg_free_inodes_count; /* Free inodes count */
__u16 bg_used_dirs_count; /* Directories count */
__u16 bg_flags;
__u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
__u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
__u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
__u16 bg_itable_unused; /* Unused inodes count */
__u16 bg_checksum; /* crc16(s_uuid+group_num+group_desc)*/
};
/*
* Structure of a blocks group descriptor
*/
struct ext4_group_desc
{
__u32 bg_block_bitmap; /* Blocks bitmap block */
__u32 bg_inode_bitmap; /* Inodes bitmap block */
__u32 bg_inode_table; /* Inodes table block */
__u16 bg_free_blocks_count; /* Free blocks count */
__u16 bg_free_inodes_count; /* Free inodes count */
__u16 bg_used_dirs_count; /* Directories count */
__u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
__u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
__u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
__u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
__u16 bg_itable_unused; /* Unused inodes count */
__u16 bg_checksum; /* crc16(sb_uuid+group+desc) */
__u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
__u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
__u32 bg_inode_table_hi; /* Inodes table block MSB */
__u16 bg_free_blocks_count_hi;/* Free blocks count MSB */
__u16 bg_free_inodes_count_hi;/* Free inodes count MSB */
__u16 bg_used_dirs_count_hi; /* Directories count MSB */
__u16 bg_itable_unused_hi; /* Unused inodes count MSB */
__u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */
__u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
__u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
__u32 bg_reserved;
};
#define EXT4_BG_INODE_BITMAP_CSUM_HI_END \
(offsetof(struct ext4_group_desc, bg_inode_bitmap_csum_hi) + \
sizeof(__u16))
#define EXT4_BG_BLOCK_BITMAP_CSUM_HI_LOCATION \
(offsetof(struct ext4_group_desc, bg_block_bitmap_csum_hi) + \
sizeof(__u16))
#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */
#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */
#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
/*
* Data structures used by the directory indexing feature
*
* Note: all of the multibyte integer fields are little endian.
*/
/*
* Note: dx_root_info is laid out so that if it should somehow get
* overlaid by a dirent the two low bits of the hash version will be
* zero. Therefore, the hash version mod 4 should never be 0.
* Sincerely, the paranoia department.
*/
struct ext2_dx_root_info {
__u32 reserved_zero;
__u8 hash_version; /* 0 now, 1 at release */
__u8 info_length; /* 8 */
__u8 indirect_levels;
__u8 unused_flags;
};
#define EXT2_HASH_LEGACY 0
#define EXT2_HASH_HALF_MD4 1
#define EXT2_HASH_TEA 2
#define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */
#define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */
#define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */
#define EXT2_HASH_FLAG_INCOMPAT 0x1
#define EXT4_DX_BLOCK_MASK 0x0fffffff
struct ext2_dx_entry {
__le32 hash;
__le32 block;
};
struct ext2_dx_countlimit {
__le16 limit;
__le16 count;
};
/*
* This goes at the end of each htree block.
*/
struct ext2_dx_tail {
__le32 dt_reserved;
__le32 dt_checksum; /* crc32c(uuid+inum+dxblock) */
};
/*
* Macro-instructions used to manage group descriptors
*/
#define EXT2_MIN_DESC_SIZE 32
#define EXT2_MIN_DESC_SIZE_64BIT 64
#define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE
#define EXT2_DESC_SIZE(s) \
((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \
(s)->s_desc_size : EXT2_MIN_DESC_SIZE)
#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group)
#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \
(EXT2_CLUSTER_SIZE(s) / \
EXT2_BLOCK_SIZE(s)))
#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8)
#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \
EXT2_INODES_PER_BLOCK(s))
#ifdef __KERNEL__
#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
#else
#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
#endif
#define EXT2_GROUPS_TO_BLOCKS(s, g) ((blk64_t) EXT2_BLOCKS_PER_GROUP(s) * \
(g))
#define EXT2_GROUPS_TO_CLUSTERS(s, g) ((blk64_t) EXT2_CLUSTERS_PER_GROUP(s) * \
(g))
/*
* Constants relative to the data blocks
*/
#define EXT2_NDIR_BLOCKS 12
#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
/*
* Inode flags
*/
#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
#define EXT2_UNRM_FL 0x00000002 /* Undelete */
#define EXT2_COMPR_FL 0x00000004 /* Compress file */
#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
/* Reserved for compression usage... */
#define EXT2_DIRTY_FL 0x00000100
#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
/* nb: was previously EXT2_ECOMPR_FL */
#define EXT4_ENCRYPT_FL 0x00000800 /* encrypted inode */
/* End compression flags --- maybe not all used */
#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
#define EXT2_IMAGIC_FL 0x00002000
#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
#define EXT4_VERITY_FL 0x00100000 /* Verity protected inode */
#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
/* EXT4_EOFBLOCKS_FL 0x00400000 was here */
#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
#define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
#define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
#define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
#define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
#define EXT4_PROJINHERIT_FL 0x20000000 /* Create with parents projid */
#define EXT4_CASEFOLD_FL 0x40000000 /* Casefolded file */
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
#define EXT2_FL_USER_VISIBLE 0x604BDFFF /* User visible flags */
#define EXT2_FL_USER_MODIFIABLE 0x604B80FF /* User modifiable flags */
/*
* ioctl commands
*/
/* Used for online resize */
struct ext2_new_group_input {
__u32 group; /* Group number for this data */
__u32 block_bitmap; /* Absolute block number of block bitmap */
__u32 inode_bitmap; /* Absolute block number of inode bitmap */
__u32 inode_table; /* Absolute block number of inode table start */
__u32 blocks_count; /* Total number of blocks in this group */
__u16 reserved_blocks; /* Number of reserved blocks in this group */
__u16 unused; /* Number of reserved GDT blocks in group */
};
struct ext4_new_group_input {
__u32 group; /* Group number for this data */
__u64 block_bitmap; /* Absolute block number of block bitmap */
__u64 inode_bitmap; /* Absolute block number of inode bitmap */
__u64 inode_table; /* Absolute block number of inode table start */
__u32 blocks_count; /* Total number of blocks in this group */
__u16 reserved_blocks; /* Number of reserved blocks in this group */
__u16 unused;
};
#ifdef __GNU__ /* Needed for the Hurd */
#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
#endif
#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
#define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long)
#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long)
#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input)
#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
/*00*/ __u16 i_mode; /* File mode */
__u16 i_uid; /* Low 16 bits of Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Inode change time */
/*10*/ __u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Low 16 bits of Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
/*20*/ __u32 i_flags; /* File flags */
union {
struct {
__u32 l_i_version; /* was l_i_reserved1 */
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
} osd1; /* OS dependent 1 */
/*28*/ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
/*64*/ __u32 i_generation; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_size_high;
/*70*/ __u32 i_faddr; /* Fragment address */
union {
struct {
__u16 l_i_blocks_hi;
__u16 l_i_file_acl_high;
__u16 l_i_uid_high; /* these 2 fields */
__u16 l_i_gid_high; /* were reserved2[0] */
__u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
__u16 l_i_reserved;
} linux2;
struct {
__u8 h_i_frag; /* Fragment number */
__u8 h_i_fsize; /* Fragment size */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
} osd2; /* OS dependent 2 */
};
/*
* Permanent part of an large inode on the disk
*/
struct ext2_inode_large {
/*00*/ __u16 i_mode; /* File mode */
__u16 i_uid; /* Low 16 bits of Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Inode Change time */
/*10*/ __u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Low 16 bits of Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
/*20*/ __u32 i_flags; /* File flags */
union {
struct {
__u32 l_i_version; /* was l_i_reserved1 */
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
} osd1; /* OS dependent 1 */
/*28*/ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
/*64*/ __u32 i_generation; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_size_high;
/*70*/ __u32 i_faddr; /* Fragment address */
union {
struct {
__u16 l_i_blocks_hi;
__u16 l_i_file_acl_high;
__u16 l_i_uid_high; /* these 2 fields */
__u16 l_i_gid_high; /* were reserved2[0] */
__u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
__u16 l_i_reserved;
} linux2;
struct {
__u8 h_i_frag; /* Fragment number */
__u8 h_i_fsize; /* Fragment size */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
} osd2; /* OS dependent 2 */
/*80*/ __u16 i_extra_isize;
__u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */
__u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
__u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */
__u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
/*90*/ __u32 i_crtime; /* File creation time */
__u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/
__u32 i_version_hi; /* high 32 bits for 64-bit version */
/*9c*/ __u32 i_projid; /* Project ID */
};
#define EXT4_INODE_CSUM_HI_EXTRA_END \
(offsetof(struct ext2_inode_large, i_checksum_hi) + sizeof(__u16) - \
EXT2_GOOD_OLD_INODE_SIZE)
#define EXT4_EPOCH_BITS 2
#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
#define i_checksum_lo osd2.linux2.l_i_checksum_lo
#define inode_includes(size, field) \
(size >= (sizeof(((struct ext2_inode_large *)0)->field) + \
offsetof(struct ext2_inode_large, field)))
#if defined(__KERNEL__) || defined(__linux__)
#define i_reserved1 osd1.linux1.l_i_reserved1
#define i_frag osd2.linux2.l_i_frag
#define i_fsize osd2.linux2.l_i_fsize
#define i_uid_low i_uid
#define i_gid_low i_gid
#define i_uid_high osd2.linux2.l_i_uid_high
#define i_gid_high osd2.linux2.l_i_gid_high
#else
#if defined(__GNU__)
#define i_translator osd1.hurd1.h_i_translator
#define i_frag osd2.hurd2.h_i_frag;
#define i_fsize osd2.hurd2.h_i_fsize;
#define i_uid_high osd2.hurd2.h_i_uid_high
#define i_gid_high osd2.hurd2.h_i_gid_high
#define i_author osd2.hurd2.h_i_author
#endif /* __GNU__ */
#endif /* defined(__KERNEL__) || defined(__linux__) */
#define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16)
#define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16)
#define inode_projid(inode) ((inode).i_projid)
#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x))
#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x))
static inline
struct ext2_inode *EXT2_INODE(struct ext2_inode_large *large_inode)
{
return (struct ext2_inode *) large_inode;
}
/*
* File system states
*/
#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
#define EXT2_ERROR_FS 0x0002 /* Errors detected */
#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
/*
* Misc. filesystem flags
*/
#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */
#define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */
#define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */
#define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */
/*
* Mount flags
*/
#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
EXT2_MOUNT_##opt)
/*
* Maximal mount counts between two filesystem checks
*/
#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
/*
* Behaviour when detecting errors
*/
#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
#define EXT2_ERRORS_PANIC 3 /* Panic */
#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
#if (__GNUC__ >= 4)
#define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
#else
#define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
/* Metadata checksum algorithms */
#define EXT2_CRC32C_CHKSUM 1
/* Encryption algorithms, key size and key reference len */
#define EXT4_ENCRYPTION_MODE_INVALID 0
#define EXT4_ENCRYPTION_MODE_AES_256_XTS 1
#define EXT4_ENCRYPTION_MODE_AES_256_GCM 2
#define EXT4_ENCRYPTION_MODE_AES_256_CBC 3
#define EXT4_ENCRYPTION_MODE_AES_256_CTS 4
#define EXT4_AES_256_XTS_KEY_SIZE 64
#define EXT4_AES_256_GCM_KEY_SIZE 32
#define EXT4_AES_256_CBC_KEY_SIZE 32
#define EXT4_AES_256_CTS_KEY_SIZE 32
#define EXT4_MAX_KEY_SIZE 64
#define EXT4_KEY_DESCRIPTOR_SIZE 8
#define EXT4_CRYPTO_BLOCK_SIZE 16
/* Password derivation constants */
#define EXT4_MAX_PASSPHRASE_SIZE 1024
#define EXT4_MAX_SALT_SIZE 256
#define EXT4_PBKDF2_ITERATIONS 0xFFFF
#define EXT2_LABEL_LEN 16
/*
* Policy provided via an ioctl on the topmost directory. This
* structure is also in the kernel.
*/
struct ext4_encryption_policy {
char version;
char contents_encryption_mode;
char filenames_encryption_mode;
char flags;
char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE];
} __attribute__((__packed__));
struct ext4_encryption_key {
__u32 mode;
char raw[EXT4_MAX_KEY_SIZE];
__u32 size;
} __attribute__((__packed__));
/*
* Structure of the super block
*/
struct ext2_super_block {
/*000*/ __u32 s_inodes_count; /* Inodes count */
__u32 s_blocks_count; /* Blocks count */
__u32 s_r_blocks_count; /* Reserved blocks count */
__u32 s_free_blocks_count; /* Free blocks count */
/*010*/ __u32 s_free_inodes_count; /* Free inodes count */
__u32 s_first_data_block; /* First Data Block */
__u32 s_log_block_size; /* Block size */
__u32 s_log_cluster_size; /* Allocation cluster size */
/*020*/ __u32 s_blocks_per_group; /* # Blocks per group */
__u32 s_clusters_per_group; /* # Fragments per group */
__u32 s_inodes_per_group; /* # Inodes per group */
__u32 s_mtime; /* Mount time */
/*030*/ __u32 s_wtime; /* Write time */
__u16 s_mnt_count; /* Mount count */
__s16 s_max_mnt_count; /* Maximal mount count */
__u16 s_magic; /* Magic signature */
__u16 s_state; /* File system state */
__u16 s_errors; /* Behaviour when detecting errors */
__u16 s_minor_rev_level; /* minor revision level */
/*040*/ __u32 s_lastcheck; /* time of last check */
__u32 s_checkinterval; /* max. time between checks */
__u32 s_creator_os; /* OS */
__u32 s_rev_level; /* Revision level */
/*050*/ __u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
/*
* These fields are for EXT2_DYNAMIC_REV superblocks only.
*
* Note: the difference between the compatible feature set and
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
*
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
__u32 s_first_ino; /* First non-reserved inode */
__u16 s_inode_size; /* size of inode structure */
__u16 s_block_group_nr; /* block group # of this superblock */
__u32 s_feature_compat; /* compatible feature set */
/*060*/ __u32 s_feature_incompat; /* incompatible feature set */
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
/*068*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
/*078*/ __u8 s_volume_name[EXT2_LABEL_LEN]; /* volume name, no NUL? */
/*088*/ __u8 s_last_mounted[64]; /* directory last mounted on, no NUL? */
/*0c8*/ __u32 s_algorithm_usage_bitmap; /* For compression */
/*
* Performance hints. Directory preallocation should only
* happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
*/
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
__u16 s_reserved_gdt_blocks; /* Per group table for online growth */
/*
* Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
*/
/*0d0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
/*0e0*/ __u32 s_journal_inum; /* inode number of journal file */
__u32 s_journal_dev; /* device number of journal file */
__u32 s_last_orphan; /* start of list of inodes to delete */
/*0ec*/ __u32 s_hash_seed[4]; /* HTREE hash seed */
/*0fc*/ __u8 s_def_hash_version; /* Default hash version to use */
__u8 s_jnl_backup_type; /* Default type of journal backup */
__u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */
/*100*/ __u32 s_default_mount_opts; /* default EXT2_MOUNT_* flags used */
__u32 s_first_meta_bg; /* First metablock group */
__u32 s_mkfs_time; /* When the filesystem was created */
/*10c*/ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
/*150*/ __u32 s_blocks_count_hi; /* Blocks count high 32bits */
__u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/
__u32 s_free_blocks_hi; /* Free blocks count */
__u16 s_min_extra_isize; /* All inodes have at least # bytes */
__u16 s_want_extra_isize; /* New inodes should reserve # bytes */
/*160*/ __u32 s_flags; /* Miscellaneous flags */
__u16 s_raid_stride; /* RAID stride in blocks */
__u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
__u64 s_mmp_block; /* Block for multi-mount protection */
/*170*/ __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
__u8 s_log_groups_per_flex; /* FLEX_BG group size */
__u8 s_checksum_type; /* metadata checksum algorithm */
__u8 s_encryption_level; /* versioning level for encryption */
__u8 s_reserved_pad; /* Padding to next 32bits */
__u64 s_kbytes_written; /* nr of lifetime kilobytes written */
/*180*/ __u32 s_snapshot_inum; /* Inode number of active snapshot */
__u32 s_snapshot_id; /* sequential ID of active snapshot */
__u64 s_snapshot_r_blocks_count; /* active snapshot reserved blocks */
/*190*/ __u32 s_snapshot_list; /* inode number of disk snapshot list */
#define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count)
__u32 s_error_count; /* number of fs errors */
__u32 s_first_error_time; /* first time an error happened */
__u32 s_first_error_ino; /* inode involved in first error */
/*1a0*/ __u64 s_first_error_block; /* block involved in first error */
__u8 s_first_error_func[32]; /* function where error hit, no NUL? */
/*1c8*/ __u32 s_first_error_line; /* line number where error happened */
__u32 s_last_error_time; /* most recent time of an error */
/*1d0*/ __u32 s_last_error_ino; /* inode involved in last error */
__u32 s_last_error_line; /* line number where error happened */
__u64 s_last_error_block; /* block involved of last error */
/*1e0*/ __u8 s_last_error_func[32]; /* function where error hit, no NUL? */
#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
/*200*/ __u8 s_mount_opts[64]; /* default mount options, no NUL? */
/*240*/ __u32 s_usr_quota_inum; /* inode number of user quota file */
__u32 s_grp_quota_inum; /* inode number of group quota file */
__u32 s_overhead_blocks; /* overhead blocks/clusters in fs */
/*24c*/ __u32 s_backup_bgs[2]; /* If sparse_super2 enabled */
/*254*/ __u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
/*258*/ __u8 s_encrypt_pw_salt[16]; /* Salt used for string2key algorithm */
/*268*/ __le32 s_lpf_ino; /* Location of the lost+found inode */
__le32 s_prj_quota_inum; /* inode for tracking project quota */
/*270*/ __le32 s_checksum_seed; /* crc32c(orig_uuid) if csum_seed set */
/*274*/ __u8 s_wtime_hi;
__u8 s_mtime_hi;
__u8 s_mkfs_time_hi;
__u8 s_lastcheck_hi;
__u8 s_first_error_time_hi;
__u8 s_last_error_time_hi;
__u8 s_pad[2];
/*27c*/ __le16 s_encoding; /* Filename charset encoding */
__le16 s_encoding_flags; /* Filename charset encoding flags */
__le32 s_reserved[95]; /* Padding to the end of the block */
/*3fc*/ __u32 s_checksum; /* crc32c(superblock) */
};
#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
#define EXT2_LEN_STR(buf) (int)sizeof(buf), (char *)buf
/*
* Codes for operating systems
*/
#define EXT2_OS_LINUX 0
#define EXT2_OS_HURD 1
#define EXT2_OBSO_OS_MASIX 2
#define EXT2_OS_FREEBSD 3
#define EXT2_OS_LITES 4
/*
* Revision levels
*/
#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
#define EXT2_GOOD_OLD_INODE_SIZE 128
/*
* Journal inode backup types
*/
#define EXT3_JNL_BACKUP_BLOCKS 1
/*
* Feature set definitions
*/
#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
( EXT2_SB(sb)->s_feature_compat & (mask) )
#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
( EXT2_SB(sb)->s_feature_ro_compat & (mask) )
#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
( EXT2_SB(sb)->s_feature_incompat & (mask) )
#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010
#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
#define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040
/* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */
#define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100
#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2 0x0200
#define EXT4_FEATURE_COMPAT_FAST_COMMIT 0x0400
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */
#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080
#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200
/*
* METADATA_CSUM implies GDT_CSUM. When METADATA_CSUM is set, group
* descriptor checksums use the same algorithm as all other data
* structures' checksums.
*/
#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400
#define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800
#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000
#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000 /* Project quota */
#define EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS 0x4000
#define EXT4_FEATURE_RO_COMPAT_VERITY 0x8000
#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400
#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000
#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000
#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */
#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000
#define EXT4_FEATURE_INCOMPAT_CASEFOLD 0x20000
#define EXT4_FEATURE_COMPAT_FUNCS(name, ver, flagname) \
static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \
{ \
return ((EXT2_SB(sb)->s_feature_compat & \
EXT##ver##_FEATURE_COMPAT_##flagname) != 0); \
} \
static inline void ext2fs_set_feature_##name(struct ext2_super_block *sb) \
{ \
EXT2_SB(sb)->s_feature_compat |= \
EXT##ver##_FEATURE_COMPAT_##flagname; \
} \
static inline void ext2fs_clear_feature_##name(struct ext2_super_block *sb) \
{ \
EXT2_SB(sb)->s_feature_compat &= \
~EXT##ver##_FEATURE_COMPAT_##flagname; \
}
#define EXT4_FEATURE_RO_COMPAT_FUNCS(name, ver, flagname) \
static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \
{ \
return ((EXT2_SB(sb)->s_feature_ro_compat & \
EXT##ver##_FEATURE_RO_COMPAT_##flagname) != 0); \
} \
static inline void ext2fs_set_feature_##name(struct ext2_super_block *sb) \
{ \
EXT2_SB(sb)->s_feature_ro_compat |= \
EXT##ver##_FEATURE_RO_COMPAT_##flagname; \
} \
static inline void ext2fs_clear_feature_##name(struct ext2_super_block *sb) \
{ \
EXT2_SB(sb)->s_feature_ro_compat &= \
~EXT##ver##_FEATURE_RO_COMPAT_##flagname; \
}
#define EXT4_FEATURE_INCOMPAT_FUNCS(name, ver, flagname) \
static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \
{ \
return ((EXT2_SB(sb)->s_feature_incompat & \
EXT##ver##_FEATURE_INCOMPAT_##flagname) != 0); \
} \
static inline void ext2fs_set_feature_##name(struct ext2_super_block *sb) \
{ \
EXT2_SB(sb)->s_feature_incompat |= \
EXT##ver##_FEATURE_INCOMPAT_##flagname; \
} \
static inline void ext2fs_clear_feature_##name(struct ext2_super_block *sb) \
{ \
EXT2_SB(sb)->s_feature_incompat &= \
~EXT##ver##_FEATURE_INCOMPAT_##flagname; \
}
EXT4_FEATURE_COMPAT_FUNCS(dir_prealloc, 2, DIR_PREALLOC)
EXT4_FEATURE_COMPAT_FUNCS(imagic_inodes, 2, IMAGIC_INODES)
EXT4_FEATURE_COMPAT_FUNCS(journal, 3, HAS_JOURNAL)
EXT4_FEATURE_COMPAT_FUNCS(xattr, 2, EXT_ATTR)
EXT4_FEATURE_COMPAT_FUNCS(resize_inode, 2, RESIZE_INODE)
EXT4_FEATURE_COMPAT_FUNCS(dir_index, 2, DIR_INDEX)
EXT4_FEATURE_COMPAT_FUNCS(lazy_bg, 2, LAZY_BG)
EXT4_FEATURE_COMPAT_FUNCS(exclude_bitmap, 2, EXCLUDE_BITMAP)
EXT4_FEATURE_COMPAT_FUNCS(sparse_super2, 4, SPARSE_SUPER2)
EXT4_FEATURE_COMPAT_FUNCS(fast_commit, 4, FAST_COMMIT)
EXT4_FEATURE_RO_COMPAT_FUNCS(sparse_super, 2, SPARSE_SUPER)
EXT4_FEATURE_RO_COMPAT_FUNCS(large_file, 2, LARGE_FILE)
EXT4_FEATURE_RO_COMPAT_FUNCS(huge_file, 4, HUGE_FILE)
EXT4_FEATURE_RO_COMPAT_FUNCS(gdt_csum, 4, GDT_CSUM)
EXT4_FEATURE_RO_COMPAT_FUNCS(dir_nlink, 4, DIR_NLINK)
EXT4_FEATURE_RO_COMPAT_FUNCS(extra_isize, 4, EXTRA_ISIZE)
EXT4_FEATURE_RO_COMPAT_FUNCS(has_snapshot, 4, HAS_SNAPSHOT)
EXT4_FEATURE_RO_COMPAT_FUNCS(quota, 4, QUOTA)
EXT4_FEATURE_RO_COMPAT_FUNCS(bigalloc, 4, BIGALLOC)
EXT4_FEATURE_RO_COMPAT_FUNCS(metadata_csum, 4, METADATA_CSUM)
EXT4_FEATURE_RO_COMPAT_FUNCS(replica, 4, REPLICA)
EXT4_FEATURE_RO_COMPAT_FUNCS(readonly, 4, READONLY)
EXT4_FEATURE_RO_COMPAT_FUNCS(project, 4, PROJECT)
EXT4_FEATURE_RO_COMPAT_FUNCS(shared_blocks, 4, SHARED_BLOCKS)
EXT4_FEATURE_RO_COMPAT_FUNCS(verity, 4, VERITY)
EXT4_FEATURE_INCOMPAT_FUNCS(compression, 2, COMPRESSION)
EXT4_FEATURE_INCOMPAT_FUNCS(filetype, 2, FILETYPE)
EXT4_FEATURE_INCOMPAT_FUNCS(journal_needs_recovery, 3, RECOVER)
EXT4_FEATURE_INCOMPAT_FUNCS(journal_dev, 3, JOURNAL_DEV)
EXT4_FEATURE_INCOMPAT_FUNCS(meta_bg, 2, META_BG)
EXT4_FEATURE_INCOMPAT_FUNCS(extents, 3, EXTENTS)
EXT4_FEATURE_INCOMPAT_FUNCS(64bit, 4, 64BIT)
EXT4_FEATURE_INCOMPAT_FUNCS(mmp, 4, MMP)
EXT4_FEATURE_INCOMPAT_FUNCS(flex_bg, 4, FLEX_BG)
EXT4_FEATURE_INCOMPAT_FUNCS(ea_inode, 4, EA_INODE)
EXT4_FEATURE_INCOMPAT_FUNCS(dirdata, 4, DIRDATA)
EXT4_FEATURE_INCOMPAT_FUNCS(csum_seed, 4, CSUM_SEED)
EXT4_FEATURE_INCOMPAT_FUNCS(largedir, 4, LARGEDIR)
EXT4_FEATURE_INCOMPAT_FUNCS(inline_data, 4, INLINE_DATA)
EXT4_FEATURE_INCOMPAT_FUNCS(encrypt, 4, ENCRYPT)
EXT4_FEATURE_INCOMPAT_FUNCS(casefold, 4, CASEFOLD)
#define EXT2_FEATURE_COMPAT_SUPP 0
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
EXT4_FEATURE_INCOMPAT_MMP| \
EXT4_FEATURE_INCOMPAT_LARGEDIR| \
EXT4_FEATURE_INCOMPAT_EA_INODE)
#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
EXT2_FEATURE_RO_COMPAT_BTREE_DIR| \
EXT4_FEATURE_RO_COMPAT_VERITY)
/*
* Default values for user and/or group using reserved blocks
*/
#define EXT2_DEF_RESUID 0
#define EXT2_DEF_RESGID 0
/*
* Default mount options
*/
#define EXT2_DEFM_DEBUG 0x0001
#define EXT2_DEFM_BSDGROUPS 0x0002
#define EXT2_DEFM_XATTR_USER 0x0004
#define EXT2_DEFM_ACL 0x0008
#define EXT2_DEFM_UID16 0x0010
#define EXT3_DEFM_JMODE 0x0060
#define EXT3_DEFM_JMODE_DATA 0x0020
#define EXT3_DEFM_JMODE_ORDERED 0x0040
#define EXT3_DEFM_JMODE_WBACK 0x0060
#define EXT4_DEFM_NOBARRIER 0x0100
#define EXT4_DEFM_BLOCK_VALIDITY 0x0200
#define EXT4_DEFM_DISCARD 0x0400
#define EXT4_DEFM_NODELALLOC 0x0800
/*
* Structure of a directory entry
*/
#define EXT2_NAME_LEN 255
struct ext2_dir_entry {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u16 name_len; /* Name length */
char name[EXT2_NAME_LEN]; /* File name */
};
/*
* The new version of the directory entry. Since EXT2 structures are
* stored in intel byte order, and the name_len field could never be
* bigger than 255 chars, it's safe to reclaim the extra byte for the
* file_type field.
*
* This structure is deprecated due to endian issues. Please use struct
* ext2_dir_entry and accessor functions
* ext2fs_dirent_name_len
* ext2fs_dirent_set_name_len
* ext2fs_dirent_file_type
* ext2fs_dirent_set_file_type
* to get and set name_len and file_type fields.
*/
struct ext2_dir_entry_2 {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
char name[EXT2_NAME_LEN]; /* File name */
};
/*
* This is a bogus directory entry at the end of each leaf block that
* records checksums.
*/
struct ext2_dir_entry_tail {
__u32 det_reserved_zero1; /* Pretend to be unused */
__u16 det_rec_len; /* 12 */
__u16 det_reserved_name_len; /* 0xDE00, fake namelen/filetype */
__u32 det_checksum; /* crc32c(uuid+inode+dirent) */
};
/*
* Ext2 directory file types. Only the low 3 bits are used. The
* other bits are reserved for now.
*/
#define EXT2_FT_UNKNOWN 0
#define EXT2_FT_REG_FILE 1
#define EXT2_FT_DIR 2
#define EXT2_FT_CHRDEV 3
#define EXT2_FT_BLKDEV 4
#define EXT2_FT_FIFO 5
#define EXT2_FT_SOCK 6
#define EXT2_FT_SYMLINK 7
#define EXT2_FT_MAX 8
/*
* Annoyingly, e2fsprogs always swab16s ext2_dir_entry.name_len, so we
* have to build ext2_dir_entry_tail with that assumption too. This
* constant helps to build the dir_entry_tail to look like it has an
* "invalid" file type.
*/
#define EXT2_DIR_NAME_LEN_CSUM 0xDE00
/*
* EXT2_DIR_PAD defines the directory entries boundaries
*
* NOTE: It must be a multiple of 4
*/
#define EXT2_DIR_ENTRY_HEADER_LEN 8
#define EXT2_DIR_PAD 4
#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + \
EXT2_DIR_ENTRY_HEADER_LEN + \
EXT2_DIR_ROUND) & \
~EXT2_DIR_ROUND)
/*
* Constants for ext4's extended time encoding
*/
#define EXT4_EPOCH_BITS 2
#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
#define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS)
/*
* This structure is used for multiple mount protection. It is written
* into the block number saved in the s_mmp_block field in the superblock.
* Programs that check MMP should assume that if SEQ_FSCK (or any unknown
* code above SEQ_MAX) is present then it is NOT safe to use the filesystem,
* regardless of how old the timestamp is.
*
* The timestamp in the MMP structure will be updated by e2fsck at some
* arbitrary intervals (start of passes, after every few groups of inodes
* in pass1 and pass1b). There is no guarantee that e2fsck is updating
* the MMP block in a timely manner, and the updates it does are purely
* for the convenience of the sysadmin and not for automatic validation.
*
* Note: Only the mmp_seq value is used to determine whether the MMP block
* is being updated. The mmp_time, mmp_nodename, and mmp_bdevname
* fields are only for informational purposes for the administrator,
* due to clock skew between nodes and hostname HA service takeover.
*/
#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */
#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */
#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */
/* Not endian-annotated; it's swapped at read/write time */
struct mmp_struct {
__u32 mmp_magic; /* Magic number for MMP */
__u32 mmp_seq; /* Sequence no. updated periodically */
__u64 mmp_time; /* Time last updated (seconds) */
__u8 mmp_nodename[64]; /* Node updating MMP block, no NUL? */
__u8 mmp_bdevname[32]; /* Bdev updating MMP block, no NUL? */
__u16 mmp_check_interval; /* Changed mmp_check_interval */
__u16 mmp_pad1;
__u32 mmp_pad2[226];
__u32 mmp_checksum; /* crc32c(uuid+mmp_block) */
};
/*
* Default interval for MMP update in seconds.
*/
#define EXT4_MMP_UPDATE_INTERVAL 5
/*
* Maximum interval for MMP update in seconds.
*/
#define EXT4_MMP_MAX_UPDATE_INTERVAL 300
/*
* Minimum interval for MMP checking in seconds.
*/
#define EXT4_MMP_MIN_CHECK_INTERVAL 5
/*
* Minimum size of inline data.
*/
#define EXT4_MIN_INLINE_DATA_SIZE ((sizeof(__u32) * EXT2_N_BLOCKS))
/*
* Size of a parent inode in inline data directory.
*/
#define EXT4_INLINE_DATA_DOTDOT_SIZE (4)
#define EXT4_ENC_UTF8_12_1 1
#define EXT4_ENC_STRICT_MODE_FL (1 << 0) /* Reject invalid sequences */
#endif /* _LINUX_EXT2_FS_H */
/*
* qcow2.h --- structures and function prototypes for qcow2.c to generate
* qcow2 formatted disk images. This format is used originally by QEMU
* for virtual machines, and stores the filesystem data on disk in a
* packed format to avoid creating sparse image files that need lots of
* seeking to read and write.
*
* The qcow2 format supports zlib compression, but that is not yet
* implemented.
*
* It is possible to directly mount a qcow2 image using qemu-nbd:
*
* [root]# modprobe nbd max_part=63
* [root]# qemu-nbd -c /dev/nbd0 image.img
* [root]# mount /dev/nbd0p1 /mnt/qemu
*
* Format details at http://people.gnome.org/~markmc/qcow-image-format.html
*
* Copyright (C) 2010 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
/* Number of l2 tables in memory before writeback */
#define L2_CACHE_PREALLOC 512
#define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb)
#define QCOW_VERSION 2
#define QCOW_OFLAG_COPIED (1ULL << 63)
#define QCOW_OFLAG_COMPRESSED (1ULL << 62)
#define QCOW_COMPRESSED 1
#define QCOW_ENCRYPTED 2
#define QCOW_CORRUPTED 3
struct ext2_qcow2_hdr {
__u32 magic;
__u32 version;
__u64 backing_file_offset;
__u32 backing_file_size;
__u32 cluster_bits;
__u64 size;
__u32 crypt_method;
__u32 l1_size;
__u64 l1_table_offset;
__u64 refcount_table_offset;
__u32 refcount_table_clusters;
__u32 nb_snapshots;
__u64 snapshots_offset;
};
typedef struct ext2_qcow2_l2_table L2_CACHE_HEAD;
struct ext2_qcow2_l2_table {
__u32 l1_index;
__u64 offset;
__u64 *data;
L2_CACHE_HEAD *next;
};
struct ext2_qcow2_l2_cache {
L2_CACHE_HEAD *used_head;
L2_CACHE_HEAD *used_tail;
L2_CACHE_HEAD *free_head;
__u32 free;
__u32 count;
__u64 next_offset;
};
struct ext2_qcow2_refcount {
__u64 *refcount_table;
__u64 refcount_table_offset;
__u64 refcount_block_offset;
__u32 refcount_table_clusters;
__u32 refcount_table_index;
__u32 refcount_block_index;
__u16 *refcount_block;
};
struct ext2_qcow2_image {
int fd;
struct ext2_qcow2_hdr *hdr;
struct ext2_qcow2_l2_cache *l2_cache;
struct ext2_qcow2_refcount refcount;
__u32 cluster_size;
__u32 cluster_bits;
__u32 l1_size;
__u32 l2_size;
__u64 *l1_table;
__u64 l2_offset;
__u64 l1_offset;
__u64 image_size;
};
/* Function prototypes */
/* qcow2.c */
/* Functions for converting qcow2 image into raw image */
struct ext2_qcow2_hdr *qcow2_read_header(int);
int qcow2_write_raw_image(int, int, struct ext2_qcow2_hdr *);
/*
* Copyright (c) 2003,2004 Cluster File Systems, Inc, info@clusterfs.com
* Written by Alex Tomas <alex@clusterfs.com>
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifndef _LINUX_EXT3_EXTENTS
#define _LINUX_EXT3_EXTENTS
/*
* ext3_inode has i_block array (total 60 bytes)
* first 4 bytes are used to store:
* - tree depth (0 mean there is no tree yet. all extents in the inode)
* - number of alive extents in the inode
*/
/*
* This is extent tail on-disk structure.
* All other extent structures are 12 bytes long. It turns out that
* block_size % 12 >= 4 for at least all powers of 2 greater than 512, which
* covers all valid ext4 block sizes. Therefore, this tail structure can be
* crammed into the end of the block without having to rebalance the tree.
*/
struct ext3_extent_tail {
__le32 et_checksum; /* crc32c(uuid+inum+extent_block) */
};
/*
* this is extent on-disk structure
* it's used at the bottom of the tree
*/
struct ext3_extent {
__le32 ee_block; /* first logical block extent covers */
__le16 ee_len; /* number of blocks covered by extent */
__le16 ee_start_hi; /* high 16 bits of physical block */
__le32 ee_start; /* low 32 bigs of physical block */
};
/*
* this is index on-disk structure
* it's used at all the levels, but the bottom
*/
struct ext3_extent_idx {
__le32 ei_block; /* index covers logical blocks from 'block' */
__le32 ei_leaf; /* pointer to the physical block of the next *
* level. leaf or next index could bet here */
__le16 ei_leaf_hi; /* high 16 bits of physical block */
__le16 ei_unused;
};
/*
* each block (leaves and indexes), even inode-stored has header
*/
struct ext3_extent_header {
__le16 eh_magic; /* probably will support different formats */
__le16 eh_entries; /* number of valid entries */
__le16 eh_max; /* capacity of store in entries */
__le16 eh_depth; /* has tree real underlying blocks? */
__le32 eh_generation; /* generation of the tree */
};
#define EXT3_EXT_MAGIC 0xf30a
/*
* array of ext3_ext_path contains path to some extent
* creation/lookup routines use it for traversal/splitting/etc
* truncate uses it to simulate recursive walking
*/
struct ext3_ext_path {
__u32 p_block;
__u16 p_depth;
struct ext3_extent *p_ext;
struct ext3_extent_idx *p_idx;
struct ext3_extent_header *p_hdr;
struct buffer_head *p_bh;
};
/*
* EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
* initialized extent. This is 2^15 and not (2^16 - 1), since we use the
* MSB of ee_len field in the extent datastructure to signify if this
* particular extent is an initialized extent or an uninitialized (i.e.
* preallocated).
* EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
* uninitialized extent.
* If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
* uninitialized one. In other words, if MSB of ee_len is set, it is an
* uninitialized extent with only one special scenario when ee_len = 0x8000.
* In this case we can not have an uninitialized extent of zero length and
* thus we make it as a special case of initialized extent with 0x8000 length.
* This way we get better extent-to-group alignment for initialized extents.
* Hence, the maximum number of blocks we can have in an *initialized*
* extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
*/
#define EXT_INIT_MAX_LEN (1UL << 15)
#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
#define EXT_MAX_EXTENT_LBLK (((__u64) 1 << 32) - 1)
#define EXT_MAX_EXTENT_PBLK (((__u64) 1 << 48) - 1)
#define EXT_FIRST_EXTENT(__hdr__) \
((struct ext3_extent *) (((char *) (__hdr__)) + \
sizeof(struct ext3_extent_header)))
#define EXT_FIRST_INDEX(__hdr__) \
((struct ext3_extent_idx *) (((char *) (__hdr__)) + \
sizeof(struct ext3_extent_header)))
#define EXT_HAS_FREE_INDEX(__path__) \
(ext2fs_le16_to_cpu((__path__)->p_hdr->eh_entries) < \
ext2fs_le16_to_cpu((__path__)->p_hdr->eh_max))
#define EXT_LAST_EXTENT(__hdr__) \
(EXT_FIRST_EXTENT((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1)
#define EXT_LAST_INDEX(__hdr__) \
(EXT_FIRST_INDEX((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1)
#define EXT_MAX_EXTENT(__hdr__) \
(EXT_FIRST_EXTENT((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)
#define EXT_MAX_INDEX(__hdr__) \
(EXT_FIRST_INDEX((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)
#endif /* _LINUX_EXT3_EXTENTS */
/*-------------------------------------------------------------*/
/*--- Public header file for the library. ---*/
/*--- bzlib.h ---*/
/*-------------------------------------------------------------*/
/* ------------------------------------------------------------------
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
in the file LICENSE.
------------------------------------------------------------------ */
#ifndef _BZLIB_H
#define _BZLIB_H
#ifdef __cplusplus
extern "C" {
#endif
#define BZ_RUN 0
#define BZ_FLUSH 1
#define BZ_FINISH 2
#define BZ_OK 0
#define BZ_RUN_OK 1
#define BZ_FLUSH_OK 2
#define BZ_FINISH_OK 3
#define BZ_STREAM_END 4
#define BZ_SEQUENCE_ERROR (-1)
#define BZ_PARAM_ERROR (-2)
#define BZ_MEM_ERROR (-3)
#define BZ_DATA_ERROR (-4)
#define BZ_DATA_ERROR_MAGIC (-5)
#define BZ_IO_ERROR (-6)
#define BZ_UNEXPECTED_EOF (-7)
#define BZ_OUTBUFF_FULL (-8)
#define BZ_CONFIG_ERROR (-9)
typedef
struct {
char *next_in;
unsigned int avail_in;
unsigned int total_in_lo32;
unsigned int total_in_hi32;
char *next_out;
unsigned int avail_out;
unsigned int total_out_lo32;
unsigned int total_out_hi32;
void *state;
void *(*bzalloc)(void *,int,int);
void (*bzfree)(void *,void *);
void *opaque;
}
bz_stream;
#ifndef BZ_IMPORT
#define BZ_EXPORT
#endif
#ifndef BZ_NO_STDIO
/* Need a definitition for FILE */
#include <stdio.h>
#endif
#ifdef _WIN32
# include <windows.h>
# ifdef small
/* windows.h define small to char */
# undef small
# endif
# ifdef BZ_EXPORT
# define BZ_API(func) WINAPI func
# define BZ_EXTERN extern
# else
/* import windows dll dynamically */
# define BZ_API(func) (WINAPI * func)
# define BZ_EXTERN
# endif
#else
# define BZ_API(func) func
# define BZ_EXTERN extern
#endif
/*-- Core (low-level) library functions --*/
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
bz_stream* strm,
int blockSize100k,
int verbosity,
int workFactor
);
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
bz_stream* strm,
int action
);
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
bz_stream* strm
);
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
bz_stream *strm,
int verbosity,
int small
);
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
bz_stream* strm
);
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
bz_stream *strm
);
/*-- High(er) level library functions --*/
#ifndef BZ_NO_STDIO
#define BZ_MAX_UNUSED 5000
typedef void BZFILE;
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
int* bzerror,
FILE* f,
int verbosity,
int small,
void* unused,
int nUnused
);
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
int* bzerror,
BZFILE* b
);
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
int* bzerror,
BZFILE* b,
void** unused,
int* nUnused
);
BZ_EXTERN int BZ_API(BZ2_bzRead) (
int* bzerror,
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
int* bzerror,
FILE* f,
int blockSize100k,
int verbosity,
int workFactor
);
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
int* bzerror,
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in,
unsigned int* nbytes_out
);
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in_lo32,
unsigned int* nbytes_in_hi32,
unsigned int* nbytes_out_lo32,
unsigned int* nbytes_out_hi32
);
#endif
/*-- Utility functions --*/
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int blockSize100k,
int verbosity,
int workFactor
);
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int small,
int verbosity
);
/*--
Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
to support better zlib compatibility.
This code is not _officially_ part of libbzip2 (yet);
I haven't tested it, documented it, or considered the
threading-safeness of it.
If this code breaks, please contact both Yoshioka and me.
--*/
BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
void
);
#ifndef BZ_NO_STDIO
BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
const char *path,
const char *mode
);
BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
int fd,
const char *mode
);
BZ_EXTERN int BZ_API(BZ2_bzread) (
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN int BZ_API(BZ2_bzwrite) (
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN int BZ_API(BZ2_bzflush) (
BZFILE* b
);
BZ_EXTERN void BZ_API(BZ2_bzclose) (
BZFILE* b
);
BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
BZFILE *b,
int *errnum
);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*-------------------------------------------------------------*/
/*--- end bzlib.h ---*/
/*-------------------------------------------------------------*/
/* Definitions for POSIX spawn interface.
Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SPAWN_H
#define _SPAWN_H 1
#include <features.h>
#include <sched.h>
#include <sys/types.h>
#include <bits/types/sigset_t.h>
/* Data structure to contain attributes for thread creation. */
typedef struct
{
short int __flags;
pid_t __pgrp;
sigset_t __sd;
sigset_t __ss;
struct sched_param __sp;
int __policy;
int __pad[16];
} posix_spawnattr_t;
/* Data structure to contain information about the actions to be
performed in the new process with respect to file descriptors. */
typedef struct
{
int __allocated;
int __used;
struct __spawn_action *__actions;
int __pad[16];
} posix_spawn_file_actions_t;
/* Flags to be set in the `posix_spawnattr_t'. */
#define POSIX_SPAWN_RESETIDS 0x01
#define POSIX_SPAWN_SETPGROUP 0x02
#define POSIX_SPAWN_SETSIGDEF 0x04
#define POSIX_SPAWN_SETSIGMASK 0x08
#define POSIX_SPAWN_SETSCHEDPARAM 0x10
#define POSIX_SPAWN_SETSCHEDULER 0x20
#ifdef __USE_GNU
# define POSIX_SPAWN_USEVFORK 0x40
# define POSIX_SPAWN_SETSID 0x80
#endif
__BEGIN_DECLS
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
Before running the process perform the actions described in FILE-ACTIONS.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int posix_spawn (pid_t *__restrict __pid,
const char *__restrict __path,
const posix_spawn_file_actions_t *__restrict
__file_actions,
const posix_spawnattr_t *__restrict __attrp,
char *const __argv[__restrict_arr],
char *const __envp[__restrict_arr]);
/* Similar to `posix_spawn' but search for FILE in the PATH.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int posix_spawnp (pid_t *__pid, const char *__file,
const posix_spawn_file_actions_t *__file_actions,
const posix_spawnattr_t *__attrp,
char *const __argv[], char *const __envp[]);
/* Initialize data structure with attributes for `spawn' to default values. */
extern int posix_spawnattr_init (posix_spawnattr_t *__attr) __THROW;
/* Free resources associated with ATTR. */
extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr) __THROW;
/* Store signal mask for signals with default handling from ATTR in
SIGDEFAULT. */
extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t *
__restrict __attr,
sigset_t *__restrict __sigdefault)
__THROW;
/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr,
const sigset_t *__restrict
__sigdefault)
__THROW;
/* Store signal mask for the new process from ATTR in SIGMASK. */
extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *__restrict
__attr,
sigset_t *__restrict __sigmask) __THROW;
/* Set signal mask for the new process in ATTR to SIGMASK. */
extern int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr,
const sigset_t *__restrict __sigmask)
__THROW;
/* Get flag word from the attribute structure. */
extern int posix_spawnattr_getflags (const posix_spawnattr_t *__restrict
__attr,
short int *__restrict __flags) __THROW;
/* Store flags in the attribute structure. */
extern int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
short int __flags) __THROW;
/* Get process group ID from the attribute structure. */
extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *__restrict
__attr, pid_t *__restrict __pgroup)
__THROW;
/* Store process group ID in the attribute structure. */
extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
pid_t __pgroup) __THROW;
/* Get scheduling policy from the attribute structure. */
extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *
__restrict __attr,
int *__restrict __schedpolicy)
__THROW;
/* Store scheduling policy in the attribute structure. */
extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
int __schedpolicy) __THROW;
/* Get scheduling parameters from the attribute structure. */
extern int posix_spawnattr_getschedparam (const posix_spawnattr_t *
__restrict __attr,
struct sched_param *__restrict
__schedparam) __THROW;
/* Store scheduling parameters in the attribute structure. */
extern int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr,
const struct sched_param *
__restrict __schedparam) __THROW;
/* Initialize data structure for file attribute for `spawn' call. */
extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
__file_actions) __THROW;
/* Free resources associated with FILE-ACTIONS. */
extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *
__file_actions) __THROW;
/* Add an action to FILE-ACTIONS which tells the implementation to call
`open' for the given file during the `spawn' call. */
extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *
__restrict __file_actions,
int __fd,
const char *__restrict __path,
int __oflag, mode_t __mode)
__THROW;
/* Add an action to FILE-ACTIONS which tells the implementation to call
`close' for the given file descriptor during the `spawn' call. */
extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
__file_actions, int __fd)
__THROW;
/* Add an action to FILE-ACTIONS which tells the implementation to call
`dup2' for the given file descriptors during the `spawn' call. */
extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
__file_actions,
int __fd, int __newfd) __THROW;
__END_DECLS
#endif /* spawn.h */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
*/
#ifndef _ARPA_TELNET_H
#define _ARPA_TELNET_H 1
/*
* Definitions for the TELNET protocol.
*/
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define EOR 239 /* end of record (transparent mode) */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
#define SYNCH 242 /* for telfunc calls */
#ifdef TELCMDS
char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
};
#else
extern char *telcmds[];
#endif
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
/* telnet options */
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascii character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37/* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_EXOPL 255 /* extended-options-list */
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
#ifdef TELOPTS
char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON",
0,
};
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_NEW_ENVIRON
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#endif
/* sub-option qualifiers */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
/*
* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_MASK 0x1f
/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define NSLC 18
/*
* For backwards compatibility, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
#ifdef SLC_NAMES
char *slc_names[] = {
SLC_NAMELIST
};
#else
extern char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#endif
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
/*
* AUTHENTICATION suboptions
*/
/*
* Who is authenticating who ...
*/
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
/*
* amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_CNT 5
#define AUTHTYPE_TEST 99
#ifdef AUTH_NAMES
char *authtype_names[] = {
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
};
#else
extern char *authtype_names[];
#endif
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CNT 3
#ifdef ENCRYPT_NAMES
char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0,
};
char *enctype_names[] = {
"ANY", "DES_CFB64", "DES_OFB64", 0,
};
#else
extern char *encrypt_names[];
extern char *enctype_names[];
#endif
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
#endif /* arpa/telnet.h */
/* Copyright (c) 1983, 1989
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
#include <endian.h>
/*%
* Structure for query header. The order of the fields is machine- and
* compiler-dependent, depending on the byte/bit order and the layout
* of bit fields. We use bit fields only in int variables, as this
* is all ANSI requires. This requires a somewhat confusing rearrangement.
*/
typedef struct {
unsigned id :16; /*%< query identification number */
#if __BYTE_ORDER == __BIG_ENDIAN
/* fields in third byte */
unsigned qr: 1; /*%< response flag */
unsigned opcode: 4; /*%< purpose of message */
unsigned aa: 1; /*%< authoritive answer */
unsigned tc: 1; /*%< truncated message */
unsigned rd: 1; /*%< recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /*%< recursion available */
unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
unsigned ad: 1; /*%< authentic data from named */
unsigned cd: 1; /*%< checking disabled by resolver */
unsigned rcode :4; /*%< response code */
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
/* fields in third byte */
unsigned rd :1; /*%< recursion desired */
unsigned tc :1; /*%< truncated message */
unsigned aa :1; /*%< authoritive answer */
unsigned opcode :4; /*%< purpose of message */
unsigned qr :1; /*%< response flag */
/* fields in fourth byte */
unsigned rcode :4; /*%< response code */
unsigned cd: 1; /*%< checking disabled by resolver */
unsigned ad: 1; /*%< authentic data from named */
unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /*%< recursion available */
#endif
/* remaining bytes */
unsigned qdcount :16; /*%< number of question entries */
unsigned ancount :16; /*%< number of answer entries */
unsigned nscount :16; /*%< number of authority entries */
unsigned arcount :16; /*%< number of resource entries */
} HEADER;
#define PACKETSZ NS_PACKETSZ
#define MAXDNAME NS_MAXDNAME
#define MAXCDNAME NS_MAXCDNAME
#define MAXLABEL NS_MAXLABEL
#define HFIXEDSZ NS_HFIXEDSZ
#define QFIXEDSZ NS_QFIXEDSZ
#define RRFIXEDSZ NS_RRFIXEDSZ
#define INT32SZ NS_INT32SZ
#define INT16SZ NS_INT16SZ
#define INT8SZ NS_INT8SZ
#define INADDRSZ NS_INADDRSZ
#define IN6ADDRSZ NS_IN6ADDRSZ
#define INDIR_MASK NS_CMPRSFLGS
#define NAMESERVER_PORT NS_DEFAULTPORT
#define S_ZONE ns_s_zn
#define S_PREREQ ns_s_pr
#define S_UPDATE ns_s_ud
#define S_ADDT ns_s_ar
#define QUERY ns_o_query
#define IQUERY ns_o_iquery
#define STATUS ns_o_status
#define NS_NOTIFY_OP ns_o_notify
#define NS_UPDATE_OP ns_o_update
#define NOERROR ns_r_noerror
#define FORMERR ns_r_formerr
#define SERVFAIL ns_r_servfail
#define NXDOMAIN ns_r_nxdomain
#define NOTIMP ns_r_notimpl
#define REFUSED ns_r_refused
#define YXDOMAIN ns_r_yxdomain
#define YXRRSET ns_r_yxrrset
#define NXRRSET ns_r_nxrrset
#define NOTAUTH ns_r_notauth
#define NOTZONE ns_r_notzone
/*#define BADSIG ns_r_badsig*/
/*#define BADKEY ns_r_badkey*/
/*#define BADTIME ns_r_badtime*/
#define DELETE ns_uop_delete
#define ADD ns_uop_add
#define T_A ns_t_a
#define T_NS ns_t_ns
#define T_MD ns_t_md
#define T_MF ns_t_mf
#define T_CNAME ns_t_cname
#define T_SOA ns_t_soa
#define T_MB ns_t_mb
#define T_MG ns_t_mg
#define T_MR ns_t_mr
#define T_NULL ns_t_null
#define T_WKS ns_t_wks
#define T_PTR ns_t_ptr
#define T_HINFO ns_t_hinfo
#define T_MINFO ns_t_minfo
#define T_MX ns_t_mx
#define T_TXT ns_t_txt
#define T_RP ns_t_rp
#define T_AFSDB ns_t_afsdb
#define T_X25 ns_t_x25
#define T_ISDN ns_t_isdn
#define T_RT ns_t_rt
#define T_NSAP ns_t_nsap
#define T_NSAP_PTR ns_t_nsap_ptr
#define T_SIG ns_t_sig
#define T_KEY ns_t_key
#define T_PX ns_t_px
#define T_GPOS ns_t_gpos
#define T_AAAA ns_t_aaaa
#define T_LOC ns_t_loc
#define T_NXT ns_t_nxt
#define T_EID ns_t_eid
#define T_NIMLOC ns_t_nimloc
#define T_SRV ns_t_srv
#define T_ATMA ns_t_atma
#define T_NAPTR ns_t_naptr
#define T_KX ns_t_kx
#define T_CERT ns_t_cert
#define T_A6 ns_t_a6
#define T_DNAME ns_t_dname
#define T_SINK ns_t_sink
#define T_OPT ns_t_opt
#define T_APL ns_t_apl
#define T_DS ns_t_ds
#define T_SSHFP ns_t_sshfp
#define T_IPSECKEY ns_t_ipseckey
#define T_RRSIG ns_t_rrsig
#define T_NSEC ns_t_nsec
#define T_DNSKEY ns_t_dnskey
#define T_DHCID ns_t_dhcid
#define T_NSEC3 ns_t_nsec3
#define T_NSEC3PARAM ns_t_nsec3param
#define T_TLSA ns_t_tlsa
#define T_SMIMEA ns_t_smimea
#define T_HIP ns_t_hip
#define T_NINFO ns_t_ninfo
#define T_RKEY ns_t_rkey
#define T_TALINK ns_t_talink
#define T_CDS ns_t_cds
#define T_CDNSKEY ns_t_cdnskey
#define T_OPENPGPKEY ns_t_openpgpkey
#define T_CSYNC ns_t_csync
#define T_SPF ns_t_spf
#define T_UINFO ns_t_uinfo
#define T_UID ns_t_uid
#define T_GID ns_t_gid
#define T_UNSPEC ns_t_unspec
#define T_NID ns_t_nid
#define T_L32 ns_t_l32
#define T_L64 ns_t_l64
#define T_LP ns_t_lp
#define T_EUI48 ns_t_eui48
#define T_EUI64 ns_t_eui64
#define T_TKEY ns_t_tkey
#define T_TSIG ns_t_tsig
#define T_IXFR ns_t_ixfr
#define T_AXFR ns_t_axfr
#define T_MAILB ns_t_mailb
#define T_MAILA ns_t_maila
#define T_ANY ns_t_any
#define T_URI ns_t_uri
#define T_CAA ns_t_caa
#define T_AVC ns_t_avc
#define T_TA ns_t_ta
#define T_DLV ns_t_dlv
#define C_IN ns_c_in
#define C_CHAOS ns_c_chaos
#define C_HS ns_c_hs
/* BIND_UPDATE */
#define C_NONE ns_c_none
#define C_ANY ns_c_any
#define GETSHORT NS_GET16
#define GETLONG NS_GET32
#define PUTSHORT NS_PUT16
#define PUTLONG NS_PUT32
#endif /* _ARPA_NAMESER_COMPAT_ */
/*! \file */
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_FTP_H
#define _ARPA_FTP_H 1
/* Definitions for FTP; see RFC-765. */
/*
* Reply codes.
*/
#define PRELIM 1 /* positive preliminary */
#define COMPLETE 2 /* positive completion */
#define CONTINUE 3 /* positive intermediate */
#define TRANSIENT 4 /* transient negative completion */
#define ERROR 5 /* permanent negative completion */
/*
* Type codes
*/
#define TYPE_A 1 /* ASCII */
#define TYPE_E 2 /* EBCDIC */
#define TYPE_I 3 /* image */
#define TYPE_L 4 /* local byte size */
#ifdef FTP_NAMES
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
#endif
/*
* Form codes
*/
#define FORM_N 1 /* non-print */
#define FORM_T 2 /* telnet format effectors */
#define FORM_C 3 /* carriage control (ASA) */
#ifdef FTP_NAMES
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
#endif
/*
* Structure codes
*/
#define STRU_F 1 /* file (no record structure) */
#define STRU_R 2 /* record structure */
#define STRU_P 3 /* page structure */
#ifdef FTP_NAMES
char *strunames[] = {"0", "File", "Record", "Page" };
#endif
/*
* Mode types
*/
#define MODE_S 1 /* stream */
#define MODE_B 2 /* block */
#define MODE_C 3 /* compressed */
#ifdef FTP_NAMES
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
#endif
/*
* Record Tokens
*/
#define REC_ESC '\377' /* Record-mode Escape */
#define REC_EOR '\001' /* Record-mode End-of-Record */
#define REC_EOF '\002' /* Record-mode End-of-File */
/*
* Block Header
*/
#define BLK_EOR 0x80 /* Block is End-of-Record */
#define BLK_EOF 0x40 /* Block is End-of-File */
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
#define BLK_RESTART 0x10 /* Block is Restart Marker */
#define BLK_BYTECOUNT 2 /* Bytes in this block */
#endif /* arpa/ftp.h */
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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.
*/
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
#include <sys/param.h>
#include <sys/types.h>
#include <stdint.h>
/*
* Define constants based on RFC 883, RFC 1034, RFC 1035
*/
#define NS_PACKETSZ 512 /*%< default UDP packet size */
#define NS_MAXDNAME 1025 /*%< maximum domain name */
#define NS_MAXMSG 65535 /*%< maximum message size */
#define NS_MAXCDNAME 255 /*%< maximum compressed domain name */
#define NS_MAXLABEL 63 /*%< maximum length of domain label */
#define NS_HFIXEDSZ 12 /*%< #/bytes of fixed data in header */
#define NS_QFIXEDSZ 4 /*%< #/bytes of fixed data in query */
#define NS_RRFIXEDSZ 10 /*%< #/bytes of fixed data in r record */
#define NS_INT32SZ 4 /*%< #/bytes of data in a uint32_t */
#define NS_INT16SZ 2 /*%< #/bytes of data in a uint16_t */
#define NS_INT8SZ 1 /*%< #/bytes of data in a uint8_t */
#define NS_INADDRSZ 4 /*%< IPv4 T_A */
#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
#define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */
#define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */
/*
* These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
* in synch with it.
*/
typedef enum __ns_sect {
ns_s_qd = 0, /*%< Query: Question. */
ns_s_zn = 0, /*%< Update: Zone. */
ns_s_an = 1, /*%< Query: Answer. */
ns_s_pr = 1, /*%< Update: Prerequisites. */
ns_s_ns = 2, /*%< Query: Name servers. */
ns_s_ud = 2, /*%< Update: Update. */
ns_s_ar = 3, /*%< Query|Update: Additional records. */
ns_s_max = 4
} ns_sect;
/*%
* This is a message handle. It is caller allocated and has no dynamic data.
* This structure is intended to be opaque to all but ns_parse.c, thus the
* leading _'s on the member names. Use the accessor functions, not the _'s.
*/
typedef struct __ns_msg {
const unsigned char *_msg, *_eom;
uint16_t _id, _flags, _counts[ns_s_max];
const unsigned char *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
const unsigned char *_msg_ptr;
} ns_msg;
/* Private data structure - do not use from outside library. */
struct _ns_flagdata { int mask, shift; };
extern const struct _ns_flagdata _ns_flagdata[];
/* Accessor macros - this is part of the public interface. */
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
/*%
* This is a parsed record. It is caller allocated and has no dynamic data.
*/
typedef struct __ns_rr {
char name[NS_MAXDNAME];
uint16_t type;
uint16_t rr_class;
uint32_t ttl;
uint16_t rdlength;
const unsigned char * rdata;
} ns_rr;
/* Accessor macros - this is part of the public interface. */
#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0))
#define ns_rr_ttl(rr) ((rr).ttl + 0)
#define ns_rr_rdlen(rr) ((rr).rdlength + 0)
#define ns_rr_rdata(rr) ((rr).rdata + 0)
/*%
* These don't have to be in the same order as in the packet flags word,
* and they can even overlap in some cases, but they will need to be kept
* in synch with ns_parse.c:ns_flagdata[].
*/
typedef enum __ns_flag {
ns_f_qr, /*%< Question/Response. */
ns_f_opcode, /*%< Operation code. */
ns_f_aa, /*%< Authoritative Answer. */
ns_f_tc, /*%< Truncation occurred. */
ns_f_rd, /*%< Recursion Desired. */
ns_f_ra, /*%< Recursion Available. */
ns_f_z, /*%< MBZ. */
ns_f_ad, /*%< Authentic Data (DNSSEC). */
ns_f_cd, /*%< Checking Disabled (DNSSEC). */
ns_f_rcode, /*%< Response code. */
ns_f_max
} ns_flag;
/*%
* Currently defined opcodes.
*/
typedef enum __ns_opcode {
ns_o_query = 0, /*%< Standard query. */
ns_o_iquery = 1, /*%< Inverse query (deprecated/unsupported). */
ns_o_status = 2, /*%< Name server status query (unsupported). */
/* Opcode 3 is undefined/reserved. */
ns_o_notify = 4, /*%< Zone change notification. */
ns_o_update = 5, /*%< Zone update message. */
ns_o_max = 6
} ns_opcode;
/*%
* Currently defined response codes.
*/
typedef enum __ns_rcode {
ns_r_noerror = 0, /*%< No error occurred. */
ns_r_formerr = 1, /*%< Format error. */
ns_r_servfail = 2, /*%< Server failure. */
ns_r_nxdomain = 3, /*%< Name error. */
ns_r_notimpl = 4, /*%< Unimplemented. */
ns_r_refused = 5, /*%< Operation refused. */
/* these are for BIND_UPDATE */
ns_r_yxdomain = 6, /*%< Name exists */
ns_r_yxrrset = 7, /*%< RRset exists */
ns_r_nxrrset = 8, /*%< RRset does not exist */
ns_r_notauth = 9, /*%< Not authoritative for zone */
ns_r_notzone = 10, /*%< Zone of record different from zone section */
ns_r_max = 11,
/* The following are EDNS extended rcodes */
ns_r_badvers = 16,
/* The following are TSIG errors */
ns_r_badsig = 16,
ns_r_badkey = 17,
ns_r_badtime = 18
} ns_rcode;
/* BIND_UPDATE */
typedef enum __ns_update_operation {
ns_uop_delete = 0,
ns_uop_add = 1,
ns_uop_max = 2
} ns_update_operation;
/*%
* This structure is used for TSIG authenticated messages
*/
struct ns_tsig_key {
char name[NS_MAXDNAME], alg[NS_MAXDNAME];
unsigned char *data;
int len;
};
typedef struct ns_tsig_key ns_tsig_key;
/*%
* This structure is used for TSIG authenticated TCP messages
*/
struct ns_tcp_tsig_state {
int counter;
struct dst_key *key;
void *ctx;
unsigned char sig[NS_PACKETSZ];
int siglen;
};
typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
#define NS_TSIG_FUDGE 300
#define NS_TSIG_TCP_COUNT 100
#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
#define NS_TSIG_ERROR_NO_TSIG -10
#define NS_TSIG_ERROR_NO_SPACE -11
#define NS_TSIG_ERROR_FORMERR -12
/*%
* Currently defined type values for resources and queries.
*/
typedef enum __ns_type
{
ns_t_invalid = 0,
ns_t_a = 1,
ns_t_ns = 2,
ns_t_md = 3,
ns_t_mf = 4,
ns_t_cname = 5,
ns_t_soa = 6,
ns_t_mb = 7,
ns_t_mg = 8,
ns_t_mr = 9,
ns_t_null = 10,
ns_t_wks = 11,
ns_t_ptr = 12,
ns_t_hinfo = 13,
ns_t_minfo = 14,
ns_t_mx = 15,
ns_t_txt = 16,
ns_t_rp = 17,
ns_t_afsdb = 18,
ns_t_x25 = 19,
ns_t_isdn = 20,
ns_t_rt = 21,
ns_t_nsap = 22,
ns_t_nsap_ptr = 23,
ns_t_sig = 24,
ns_t_key = 25,
ns_t_px = 26,
ns_t_gpos = 27,
ns_t_aaaa = 28,
ns_t_loc = 29,
ns_t_nxt = 30,
ns_t_eid = 31,
ns_t_nimloc = 32,
ns_t_srv = 33,
ns_t_atma = 34,
ns_t_naptr = 35,
ns_t_kx = 36,
ns_t_cert = 37,
ns_t_a6 = 38,
ns_t_dname = 39,
ns_t_sink = 40,
ns_t_opt = 41,
ns_t_apl = 42,
ns_t_ds = 43,
ns_t_sshfp = 44,
ns_t_ipseckey = 45,
ns_t_rrsig = 46,
ns_t_nsec = 47,
ns_t_dnskey = 48,
ns_t_dhcid = 49,
ns_t_nsec3 = 50,
ns_t_nsec3param = 51,
ns_t_tlsa = 52,
ns_t_smimea = 53,
ns_t_hip = 55,
ns_t_ninfo = 56,
ns_t_rkey = 57,
ns_t_talink = 58,
ns_t_cds = 59,
ns_t_cdnskey = 60,
ns_t_openpgpkey = 61,
ns_t_csync = 62,
ns_t_spf = 99,
ns_t_uinfo = 100,
ns_t_uid = 101,
ns_t_gid = 102,
ns_t_unspec = 103,
ns_t_nid = 104,
ns_t_l32 = 105,
ns_t_l64 = 106,
ns_t_lp = 107,
ns_t_eui48 = 108,
ns_t_eui64 = 109,
ns_t_tkey = 249,
ns_t_tsig = 250,
ns_t_ixfr = 251,
ns_t_axfr = 252,
ns_t_mailb = 253,
ns_t_maila = 254,
ns_t_any = 255,
ns_t_uri = 256,
ns_t_caa = 257,
ns_t_avc = 258,
ns_t_ta = 32768,
ns_t_dlv = 32769,
ns_t_max = 65536
} ns_type;
/*%
* Values for class field
*/
typedef enum __ns_class {
ns_c_invalid = 0, /*%< Cookie. */
ns_c_in = 1, /*%< Internet. */
ns_c_2 = 2, /*%< unallocated/unsupported. */
ns_c_chaos = 3, /*%< MIT Chaos-net. */
ns_c_hs = 4, /*%< MIT Hesiod. */
/* Query class values which do not appear in resource records */
ns_c_none = 254, /*%< for prereq. sections in update requests */
ns_c_any = 255, /*%< Wildcard match. */
ns_c_max = 65536
} ns_class;
/* Certificate type values in CERT resource records. */
typedef enum __ns_cert_types {
cert_t_pkix = 1, /*%< PKIX (X.509v3) */
cert_t_spki = 2, /*%< SPKI */
cert_t_pgp = 3, /*%< PGP */
cert_t_url = 253, /*%< URL private type */
cert_t_oid = 254 /*%< OID private type */
} ns_cert_types;
/*%
* EDNS0 extended flags and option codes, host order.
*/
#define NS_OPT_DNSSEC_OK 0x8000U
#define NS_OPT_NSID 3
/*%
* Inline versions of get/put short/long. Pointer is advanced.
*/
#define NS_GET16(s, cp) do { \
const unsigned char *t_cp = (const unsigned char *)(cp); \
(s) = ((uint16_t)t_cp[0] << 8) \
| ((uint16_t)t_cp[1]) \
; \
(cp) += NS_INT16SZ; \
} while (0)
#define NS_GET32(l, cp) do { \
const unsigned char *t_cp = (const unsigned char *)(cp); \
(l) = ((uint32_t)t_cp[0] << 24) \
| ((uint32_t)t_cp[1] << 16) \
| ((uint32_t)t_cp[2] << 8) \
| ((uint32_t)t_cp[3]) \
; \
(cp) += NS_INT32SZ; \
} while (0)
#define NS_PUT16(s, cp) do { \
uint16_t t_s = (uint16_t)(s); \
unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
(cp) += NS_INT16SZ; \
} while (0)
#define NS_PUT32(l, cp) do { \
uint32_t t_l = (uint32_t)(l); \
unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
*t_cp++ = t_l >> 8; \
*t_cp = t_l; \
(cp) += NS_INT32SZ; \
} while (0)
__BEGIN_DECLS
int ns_msg_getflag (ns_msg, int) __THROW;
unsigned int ns_get16 (const unsigned char *) __THROW;
unsigned long ns_get32 (const unsigned char *) __THROW;
void ns_put16 (unsigned int, unsigned char *) __THROW;
void ns_put32 (unsigned long, unsigned char *) __THROW;
int ns_initparse (const unsigned char *, int, ns_msg *) __THROW;
int ns_skiprr (const unsigned char *, const unsigned char *,
ns_sect, int) __THROW;
int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW;
int ns_sprintrr (const ns_msg *, const ns_rr *,
const char *, const char *, char *, size_t)
__THROW;
int ns_sprintrrf (const unsigned char *, size_t, const char *,
ns_class, ns_type, unsigned long,
const unsigned char *, size_t, const char *,
const char *, char *, size_t) __THROW;
int ns_format_ttl (unsigned long, char *, size_t) __THROW;
int ns_parse_ttl (const char *, unsigned long *) __THROW;
uint32_t ns_datetosecs (const char *, int *) __THROW;
int ns_name_ntol (const unsigned char *, unsigned char *, size_t)
__THROW;
int ns_name_ntop (const unsigned char *, char *, size_t) __THROW;
int ns_name_pton (const char *, unsigned char *, size_t) __THROW;
int ns_name_unpack (const unsigned char *, const unsigned char *,
const unsigned char *, unsigned char *, size_t)
__THROW;
int ns_name_pack (const unsigned char *, unsigned char *, int,
const unsigned char **, const unsigned char **)
__THROW;
int ns_name_uncompress (const unsigned char *,
const unsigned char *,
const unsigned char *,
char *, size_t) __THROW;
int ns_name_compress (const char *, unsigned char *, size_t,
const unsigned char **,
const unsigned char **) __THROW;
int ns_name_skip (const unsigned char **, const unsigned char *)
__THROW;
void ns_name_rollback (const unsigned char *,
const unsigned char **,
const unsigned char **) __THROW;
int ns_samedomain (const char *, const char *) __THROW;
int ns_subdomain (const char *, const char *) __THROW;
int ns_makecanon (const char *, char *, size_t) __THROW;
int ns_samename (const char *, const char *) __THROW;
__END_DECLS
#include <arpa/nameser_compat.h>
#endif /* !_ARPA_NAMESER_H_ */
/*! \file */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _ARPA_INET_H
#define _ARPA_INET_H 1
#include <features.h>
#include <netinet/in.h> /* To define `struct in_addr'. */
/* Type for length arguments in socket calls. */
#ifndef __socklen_t_defined
typedef __socklen_t socklen_t;
# define __socklen_t_defined
#endif
__BEGIN_DECLS
/* Convert Internet host address from numbers-and-dots notation in CP
into binary data in network byte order. */
extern in_addr_t inet_addr (const char *__cp) __THROW;
/* Return the local host address part of the Internet address in IN. */
extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
/* Make Internet host address in network byte order by combining the
network number NET with the local address HOST. */
extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
__THROW;
/* Return network number part of the Internet address IN. */
extern in_addr_t inet_netof (struct in_addr __in) __THROW;
/* Extract the network number in network byte order from the address
in numbers-and-dots natation starting at CP. */
extern in_addr_t inet_network (const char *__cp) __THROW;
/* Convert Internet number in IN to ASCII representation. The return value
is a pointer to an internal array containing the string. */
extern char *inet_ntoa (struct in_addr __in) __THROW;
/* Convert from presentation format of an Internet number in buffer
starting at CP to the binary network format and store result for
interface type AF in buffer starting at BUF. */
extern int inet_pton (int __af, const char *__restrict __cp,
void *__restrict __buf) __THROW;
/* Convert a Internet address in binary network format for interface
type AF in buffer starting at CP to presentation form and place
result in buffer of length LEN astarting at BUF. */
extern const char *inet_ntop (int __af, const void *__restrict __cp,
char *__restrict __buf, socklen_t __len)
__THROW;
/* The following functions are not part of XNS 5.2. */
#ifdef __USE_MISC
/* Convert Internet host address from numbers-and-dots notation in CP
into binary data and store the result in the structure INP. */
extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW;
/* Format a network number NET into presentation format and place result
in buffer starting at BUF with length of LEN bytes. */
extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
/* Convert network number for interface type AF in buffer starting at
CP to presentation format. The result will specifiy BITS bits of
the number. */
extern char *inet_net_ntop (int __af, const void *__cp, int __bits,
char *__buf, size_t __len) __THROW;
/* Convert network number for interface type AF from presentation in
buffer starting at CP to network format and store result int
buffer starting at BUF of size LEN. */
extern int inet_net_pton (int __af, const char *__cp,
void *__buf, size_t __len) __THROW;
/* Convert ASCII representation in hexadecimal form of the Internet
address to binary form and place result in buffer of length LEN
starting at BUF. */
extern unsigned int inet_nsap_addr (const char *__cp,
unsigned char *__buf, int __len) __THROW;
/* Convert internet address in binary form in LEN bytes starting at CP
a presentation form and place result in BUF. */
extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp,
char *__buf) __THROW;
#endif
__END_DECLS
#endif /* arpa/inet.h */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_TFTP_H
#define _ARPA_TFTP_H 1
/*
* Trivial File Transfer Protocol (IEN-133)
*/
#define SEGSIZE 512 /* data segment size */
/*
* Packet types.
*/
#define RRQ 01 /* read request */
#define WRQ 02 /* write request */
#define DATA 03 /* data packet */
#define ACK 04 /* acknowledgement */
#define ERROR 05 /* error code */
struct tftphdr {
short th_opcode; /* packet type */
union {
char tu_padding[3]; /* sizeof() compat */
struct {
union {
unsigned short tu_block; /* block # */
short tu_code; /* error code */
} __attribute__ ((__packed__)) th_u3;
char tu_data[0]; /* data or error string */
} __attribute__ ((__packed__)) th_u2;
char tu_stuff[0]; /* request packet stuff */
} __attribute__ ((__packed__)) th_u1;
} __attribute__ ((__packed__));
#define th_block th_u1.th_u2.th_u3.tu_block
#define th_code th_u1.th_u2.th_u3.tu_code
#define th_stuff th_u1.tu_stuff
#define th_data th_u1.th_u2.tu_data
#define th_msg th_u1.th_u2.tu_data
/*
* Error codes.
*/
#define EUNDEF 0 /* not defined */
#define ENOTFOUND 1 /* file not found */
#define EACCESS 2 /* access violation */
#define ENOSPACE 3 /* disk full or allocation exceeded */
#define EBADOP 4 /* illegal TFTP operation */
#define EBADID 5 /* unknown transfer ID */
#define EEXISTS 6 /* file already exists */
#define ENOUSER 7 /* no such user */
#endif /* arpa/tftp.h */
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _PRINTF_H
#define _PRINTF_H 1
#include <features.h>
__BEGIN_DECLS
#include <bits/types/FILE.h>
#define __need_size_t
#define __need_wchar_t
#include <stddef.h>
#include <stdarg.h>
struct printf_info
{
int prec; /* Precision. */
int width; /* Width. */
wchar_t spec; /* Format letter. */
unsigned int is_long_double:1;/* L flag. */
unsigned int is_short:1; /* h flag. */
unsigned int is_long:1; /* l flag. */
unsigned int alt:1; /* # flag. */
unsigned int space:1; /* Space flag. */
unsigned int left:1; /* - flag. */
unsigned int showsign:1; /* + flag. */
unsigned int group:1; /* ' flag. */
unsigned int extra:1; /* For special use. */
unsigned int is_char:1; /* hh flag. */
unsigned int wide:1; /* Nonzero for wide character streams. */
unsigned int i18n:1; /* I flag. */
unsigned int is_binary128:1; /* Floating-point argument is ABI-compatible
with IEC 60559 binary128. */
unsigned int __pad:3; /* Unused so far. */
unsigned short int user; /* Bits for user-installed modifiers. */
wchar_t pad; /* Padding character. */
};
/* Type of a printf specifier-handler function.
STREAM is the FILE on which to write output.
INFO gives information about the format specification.
ARGS is a vector of pointers to the argument data;
the number of pointers will be the number returned
by the associated arginfo function for the same INFO.
The function should return the number of characters written,
or -1 for errors. */
typedef int printf_function (FILE *__stream,
const struct printf_info *__info,
const void *const *__args);
/* Type of a printf specifier-arginfo function.
INFO gives information about the format specification.
N, ARGTYPES, *SIZE has to contain the size of the parameter for
user-defined types, and return value are as for parse_printf_format
except that -1 should be returned if the handler cannot handle
this case. This allows to partially overwrite the functionality
of existing format specifiers. */
typedef int printf_arginfo_size_function (const struct printf_info *__info,
size_t __n, int *__argtypes,
int *__size);
/* Old version of 'printf_arginfo_function' without a SIZE parameter. */
typedef int printf_arginfo_function (const struct printf_info *__info,
size_t __n, int *__argtypes);
/* Type of a function to get a value of a user-defined from the
variable argument list. */
typedef void printf_va_arg_function (void *__mem, va_list *__ap);
/* Register FUNC to be called to format SPEC specifiers; ARGINFO must be
specified to determine how many arguments a SPEC conversion requires and
what their types are. */
extern int register_printf_specifier (int __spec, printf_function __func,
printf_arginfo_size_function __arginfo)
__THROW;
/* Obsolete interface similar to register_printf_specifier. It can only
handle basic data types because the ARGINFO callback does not return
information on the size of the user-defined type. */
extern int register_printf_function (int __spec, printf_function __func,
printf_arginfo_function __arginfo)
__THROW __attribute_deprecated__;
/* Register a new modifier character sequence. If the call succeeds
it returns a positive value representing the bit set in the USER
field in 'struct printf_info'. */
extern int register_printf_modifier (const wchar_t *__str) __THROW __wur;
/* Register variable argument handler for user type. The return value
is to be used in ARGINFO functions to signal the use of the
type. */
extern int register_printf_type (printf_va_arg_function __fct) __THROW __wur;
/* Parse FMT, and fill in N elements of ARGTYPES with the
types needed for the conversions FMT specifies. Returns
the number of arguments required by FMT.
The ARGINFO function registered with a user-defined format is passed a
`struct printf_info' describing the format spec being parsed. A width
or precision of INT_MIN means a `*' was used to indicate that the
width/precision will come from an arg. The function should fill in the
array it is passed with the types of the arguments it wants, and return
the number of arguments it wants. */
extern size_t parse_printf_format (const char *__restrict __fmt, size_t __n,
int *__restrict __argtypes) __THROW;
/* Codes returned by `parse_printf_format' for basic types.
These values cover all the standard format specifications.
Users can reserve new values after PA_LAST for their own types
using 'register_printf_type'. */
enum
{ /* C type: */
PA_INT, /* int */
PA_CHAR, /* int, cast to char */
PA_WCHAR, /* wide char */
PA_STRING, /* const char *, a '\0'-terminated string */
PA_WSTRING, /* const wchar_t *, wide character string */
PA_POINTER, /* void * */
PA_FLOAT, /* float */
PA_DOUBLE, /* double */
PA_LAST
};
/* Flag bits that can be set in a type returned by `parse_printf_format'. */
#define PA_FLAG_MASK 0xff00
#define PA_FLAG_LONG_LONG (1 << 8)
#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
#define PA_FLAG_LONG (1 << 9)
#define PA_FLAG_SHORT (1 << 10)
#define PA_FLAG_PTR (1 << 11)
/* Function which can be registered as `printf'-handlers. */
/* Print floating point value using using abbreviations for the orders
of magnitude used for numbers ('k' for kilo, 'm' for mega etc). If
the format specifier is a uppercase character powers of 1000 are
used. Otherwise powers of 1024. */
extern int printf_size (FILE *__restrict __fp,
const struct printf_info *__info,
const void *const *__restrict __args) __THROW;
/* This is the appropriate argument information function for `printf_size'. */
extern int printf_size_info (const struct printf_info *__restrict
__info, size_t __n, int *__restrict __argtypes)
__THROW;
#ifdef __LDBL_COMPAT
# include <bits/printf-ldbl.h>
#endif
__END_DECLS
#endif /* printf.h */
/*
* This luaconf.h is a wrapper include file for the original luaconf.h,
* which has been renamed to luaconf-<arch>.h. There are conflicts for the
* original luaconf.h on multilib systems, which result from arch-specific
* configuration options. Please do not use the arch-specific file directly.
*
* Copyright (C) 2015 Tom Callaway <spot@fedoraproject.org>
*/
/**
* \file luaconf.h
*/
#ifdef luaconf_wrapper_h
#error "luaconf_wrapper_h should not be defined!"
#endif
#define luaconf_wrapper_h
#if defined(__i386__)
#include "luaconf-i386.h"
#elif defined(__ia64__)
#include "luaconf-ia64.h"
#elif defined(__powerpc64__)
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#include "luaconf-ppc64.h"
# else
#include "luaconf-ppc64le.h"
# endif
#elif defined(__powerpc__)
#include "luaconf-ppc.h"
#elif defined(__s390x__)
#include "luaconf-s390x.h"
#elif defined(__s390__)
#include "luaconf-s390.h"
#elif defined(__x86_64__)
#include "luaconf-x86_64.h"
#elif defined(__arm__)
#include "luaconf-arm.h"
#elif defined(__alpha__)
#include "luaconf-alpha.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "luaconf-sparc64.h"
#elif defined(__sparc__)
#include "luaconf-sparc.h"
#elif defined(__aarch64__)
#include "luaconf-aarch64.h"
#elif defined(__mips64) && defined(__MIPSEL__)
#include "luaconf-mips64el.h"
#elif defined(__mips64)
#include "luaconf-mips64.h"
#elif defined(__mips) && defined(__MIPSEL__)
#include "luaconf-mipsel.h"
#elif defined(__mips)
#include "luaconf-mips.h"
#elif defined(__riscv)
#include "luaconf-riscv64.h"
#else
#error "The lua-devel package is not usable with the architecture."
#endif
#undef luaconf_wrapper_h
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.21 String handling <string.h>
*/
#ifndef _STRING_H
#define _STRING_H 1
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
#include <bits/libc-header-start.h>
__BEGIN_DECLS
/* Get size_t and NULL from <stddef.h>. */
#define __need_size_t
#define __need_NULL
#include <stddef.h>
/* Tell the caller that we provide correct C++ prototypes. */
#if defined __cplusplus && (__GNUC_PREREQ (4, 4) \
|| __glibc_clang_prereq (3, 5))
# define __CORRECT_ISO_CPP_STRING_H_PROTO
#endif
/* Copy N bytes of SRC to DEST. */
extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
size_t __n) __THROW __nonnull ((1, 2));
/* Copy N bytes of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
extern void *memmove (void *__dest, const void *__src, size_t __n)
__THROW __nonnull ((1, 2));
/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
Return the position in DEST one byte past where C was copied,
or NULL if C was not found in the first N bytes of SRC. */
#if defined __USE_MISC || defined __USE_XOPEN
extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
int __c, size_t __n)
__THROW __nonnull ((1, 2));
#endif /* Misc || X/Open. */
/* Set N bytes of S to C. */
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
/* Compare N bytes of S1 and S2. */
extern int memcmp (const void *__s1, const void *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Search N bytes of S for C. */
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++"
{
extern void *memchr (void *__s, int __c, size_t __n)
__THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
extern const void *memchr (const void *__s, int __c, size_t __n)
__THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
# ifdef __OPTIMIZE__
__extern_always_inline void *
memchr (void *__s, int __c, size_t __n) __THROW
{
return __builtin_memchr (__s, __c, __n);
}
__extern_always_inline const void *
memchr (const void *__s, int __c, size_t __n) __THROW
{
return __builtin_memchr (__s, __c, __n);
}
# endif
}
#else
extern void *memchr (const void *__s, int __c, size_t __n)
__THROW __attribute_pure__ __nonnull ((1));
#endif
#ifdef __USE_GNU
/* Search in S for C. This is similar to `memchr' but there is no
length limit. */
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" void *rawmemchr (void *__s, int __c)
__THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
extern "C++" const void *rawmemchr (const void *__s, int __c)
__THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
# else
extern void *rawmemchr (const void *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
# endif
/* Search N bytes of S for the final occurrence of C. */
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" void *memrchr (void *__s, int __c, size_t __n)
__THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
extern "C++" const void *memrchr (const void *__s, int __c, size_t __n)
__THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
# else
extern void *memrchr (const void *__s, int __c, size_t __n)
__THROW __attribute_pure__ __nonnull ((1));
# endif
#endif
/* Copy SRC to DEST. */
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
/* Copy no more than N characters of SRC to DEST. */
extern char *strncpy (char *__restrict __dest,
const char *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
/* Append SRC onto DEST. */
extern char *strcat (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
/* Append no more than N characters from SRC onto DEST. */
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
size_t __n) __THROW __nonnull ((1, 2));
/* Compare S1 and S2. */
extern int strcmp (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare N characters of S1 and S2. */
extern int strncmp (const char *__s1, const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare the collated forms of S1 and S2. */
extern int strcoll (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Put a transformation of SRC into no more than N bytes of DEST. */
extern size_t strxfrm (char *__restrict __dest,
const char *__restrict __src, size_t __n)
__THROW __nonnull ((2));
#ifdef __USE_XOPEN2K8
/* POSIX.1-2008 extended locale interface (see locale.h). */
# include <bits/types/locale_t.h>
/* Compare the collated forms of S1 and S2, using sorting rules from L. */
extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l)
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
/* Put a transformation of SRC into no more than N bytes of DEST,
using sorting rules from L. */
extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
locale_t __l) __THROW __nonnull ((2, 4));
#endif
#if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 \
|| __GLIBC_USE (LIB_EXT2))
/* Duplicate S, returning an identical malloc'd string. */
extern char *strdup (const char *__s)
__THROW __attribute_malloc__ __nonnull ((1));
#endif
/* Return a malloc'd copy of at most N bytes of STRING. The
resultant string is terminated even if no null terminator
appears before STRING[N]. */
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
extern char *strndup (const char *__string, size_t __n)
__THROW __attribute_malloc__ __nonnull ((1));
#endif
#if defined __USE_GNU && defined __GNUC__
/* Duplicate S, returning an identical alloca'd string. */
# define strdupa(s) \
(__extension__ \
({ \
const char *__old = (s); \
size_t __len = strlen (__old) + 1; \
char *__new = (char *) __builtin_alloca (__len); \
(char *) memcpy (__new, __old, __len); \
}))
/* Return an alloca'd copy of at most N bytes of string. */
# define strndupa(s, n) \
(__extension__ \
({ \
const char *__old = (s); \
size_t __len = strnlen (__old, (n)); \
char *__new = (char *) __builtin_alloca (__len + 1); \
__new[__len] = '\0'; \
(char *) memcpy (__new, __old, __len); \
}))
#endif
/* Find the first occurrence of C in S. */
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++"
{
extern char *strchr (char *__s, int __c)
__THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
extern const char *strchr (const char *__s, int __c)
__THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
# ifdef __OPTIMIZE__
__extern_always_inline char *
strchr (char *__s, int __c) __THROW
{
return __builtin_strchr (__s, __c);
}
__extern_always_inline const char *
strchr (const char *__s, int __c) __THROW
{
return __builtin_strchr (__s, __c);
}
# endif
}
#else
extern char *strchr (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
#endif
/* Find the last occurrence of C in S. */
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++"
{
extern char *strrchr (char *__s, int __c)
__THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
extern const char *strrchr (const char *__s, int __c)
__THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
# ifdef __OPTIMIZE__
__extern_always_inline char *
strrchr (char *__s, int __c) __THROW
{
return __builtin_strrchr (__s, __c);
}
__extern_always_inline const char *
strrchr (const char *__s, int __c) __THROW
{
return __builtin_strrchr (__s, __c);
}
# endif
}
#else
extern char *strrchr (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
#endif
#ifdef __USE_GNU
/* This function is similar to `strchr'. But it returns a pointer to
the closing NUL byte in case C is not found in S. */
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" char *strchrnul (char *__s, int __c)
__THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
extern "C++" const char *strchrnul (const char *__s, int __c)
__THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
# else
extern char *strchrnul (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
# endif
#endif
/* Return the length of the initial segment of S which
consists entirely of characters not in REJECT. */
extern size_t strcspn (const char *__s, const char *__reject)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Return the length of the initial segment of S which
consists entirely of characters in ACCEPT. */
extern size_t strspn (const char *__s, const char *__accept)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence in S of any character in ACCEPT. */
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++"
{
extern char *strpbrk (char *__s, const char *__accept)
__THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
extern const char *strpbrk (const char *__s, const char *__accept)
__THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
# ifdef __OPTIMIZE__
__extern_always_inline char *
strpbrk (char *__s, const char *__accept) __THROW
{
return __builtin_strpbrk (__s, __accept);
}
__extern_always_inline const char *
strpbrk (const char *__s, const char *__accept) __THROW
{
return __builtin_strpbrk (__s, __accept);
}
# endif
}
#else
extern char *strpbrk (const char *__s, const char *__accept)
__THROW __attribute_pure__ __nonnull ((1, 2));
#endif
/* Find the first occurrence of NEEDLE in HAYSTACK. */
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++"
{
extern char *strstr (char *__haystack, const char *__needle)
__THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
extern const char *strstr (const char *__haystack, const char *__needle)
__THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
# ifdef __OPTIMIZE__
__extern_always_inline char *
strstr (char *__haystack, const char *__needle) __THROW
{
return __builtin_strstr (__haystack, __needle);
}
__extern_always_inline const char *
strstr (const char *__haystack, const char *__needle) __THROW
{
return __builtin_strstr (__haystack, __needle);
}
# endif
}
#else
extern char *strstr (const char *__haystack, const char *__needle)
__THROW __attribute_pure__ __nonnull ((1, 2));
#endif
/* Divide S into tokens separated by characters in DELIM. */
extern char *strtok (char *__restrict __s, const char *__restrict __delim)
__THROW __nonnull ((2));
/* Divide S into tokens separated by characters in DELIM. Information
passed between calls are stored in SAVE_PTR. */
extern char *__strtok_r (char *__restrict __s,
const char *__restrict __delim,
char **__restrict __save_ptr)
__THROW __nonnull ((2, 3));
#ifdef __USE_POSIX
extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
char **__restrict __save_ptr)
__THROW __nonnull ((2, 3));
#endif
#ifdef __USE_GNU
/* Similar to `strstr' but this function ignores the case of both strings. */
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" char *strcasestr (char *__haystack, const char *__needle)
__THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
extern "C++" const char *strcasestr (const char *__haystack,
const char *__needle)
__THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
# else
extern char *strcasestr (const char *__haystack, const char *__needle)
__THROW __attribute_pure__ __nonnull ((1, 2));
# endif
#endif
#ifdef __USE_GNU
/* Find the first occurrence of NEEDLE in HAYSTACK.
NEEDLE is NEEDLELEN bytes long;
HAYSTACK is HAYSTACKLEN bytes long. */
extern void *memmem (const void *__haystack, size_t __haystacklen,
const void *__needle, size_t __needlelen)
__THROW __attribute_pure__ __nonnull ((1, 3));
/* Copy N bytes of SRC to DEST, return pointer to bytes after the
last written byte. */
extern void *__mempcpy (void *__restrict __dest,
const void *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
extern void *mempcpy (void *__restrict __dest,
const void *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
#endif
/* Return the length of S. */
extern size_t strlen (const char *__s)
__THROW __attribute_pure__ __nonnull ((1));
#ifdef __USE_XOPEN2K8
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
extern size_t strnlen (const char *__string, size_t __maxlen)
__THROW __attribute_pure__ __nonnull ((1));
#endif
/* Return a string describing the meaning of the `errno' code in ERRNUM. */
extern char *strerror (int __errnum) __THROW;
#ifdef __USE_XOPEN2K
/* Reentrant version of `strerror'.
There are 2 flavors of `strerror_r', GNU which returns the string
and may or may not use the supplied temporary buffer and POSIX one
which fills the string into the buffer.
To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
without -D_GNU_SOURCE is needed, otherwise the GNU version is
preferred. */
# if defined __USE_XOPEN2K && !defined __USE_GNU
/* Fill BUF with a string describing the meaning of the `errno' code in
ERRNUM. */
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (strerror_r,
(int __errnum, char *__buf, size_t __buflen),
__xpg_strerror_r) __nonnull ((2));
# else
extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
__THROW __nonnull ((2));
# define strerror_r __xpg_strerror_r
# endif
# else
/* If a temporary buffer is required, at most BUFLEN bytes of BUF will be
used. */
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
__THROW __nonnull ((2)) __wur;
# endif
#endif
#ifdef __USE_XOPEN2K8
/* Translate error number to string according to the locale L. */
extern char *strerror_l (int __errnum, locale_t __l) __THROW;
#endif
#ifdef __USE_MISC
# include <strings.h>
/* Set N bytes of S to 0. The compiler will not delete a call to this
function, even if S is dead after the call. */
extern void explicit_bzero (void *__s, size_t __n) __THROW __nonnull ((1));
/* Return the next DELIM-delimited token from *STRINGP,
terminating it with a '\0', and update *STRINGP to point past it. */
extern char *strsep (char **__restrict __stringp,
const char *__restrict __delim)
__THROW __nonnull ((1, 2));
#endif
#ifdef __USE_XOPEN2K8
/* Return a string describing the meaning of the signal number in SIG. */
extern char *strsignal (int __sig) __THROW;
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
/* Copy no more than N characters of SRC to DEST, returning the address of
the last character written into DEST. */
extern char *__stpncpy (char *__restrict __dest,
const char *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
extern char *stpncpy (char *__restrict __dest,
const char *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
#endif
#ifdef __USE_GNU
/* Compare S1 and S2 as strings holding name & indices/version numbers. */
extern int strverscmp (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Sautee STRING briskly. */
extern char *strfry (char *__string) __THROW __nonnull ((1));
/* Frobnicate N bytes of S. */
extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));
# ifndef basename
/* Return the file name within directory of FILENAME. We don't
declare the function if the `basename' macro is available (defined
in <libgen.h>) which makes the XPG version of this function
available. */
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" char *basename (char *__filename)
__THROW __asm ("basename") __nonnull ((1));
extern "C++" const char *basename (const char *__filename)
__THROW __asm ("basename") __nonnull ((1));
# else
extern char *basename (const char *__filename) __THROW __nonnull ((1));
# endif
# endif
#endif
#if __GNUC_PREREQ (3,4)
# if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
/* Functions with security checks. */
# include <bits/string_fortified.h>
# endif
#endif
__END_DECLS
#endif /* string.h */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2010 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/* Generic declarations for dynamic modules implementing krb5 plugin
* modules. */
#ifndef KRB5_PLUGIN_H
#define KRB5_PLUGIN_H
/* krb5_plugin_vtable is an abstract type. Module initvt functions will cast
* it to the appropriate interface-specific vtable type. */
typedef struct krb5_plugin_vtable_st *krb5_plugin_vtable;
/*
* krb5_plugin_initvt_fn is the type of all module initvt functions. Based on
* the maj_ver argument, the initvt function should cast vtable to the
* appropriate type and then fill it in. If a vtable has been expanded,
* min_ver indicates which version of the vtable is being filled in.
*/
typedef krb5_error_code
(*krb5_plugin_initvt_fn)(krb5_context context, int maj_ver, int min_ver,
krb5_plugin_vtable vtable);
#endif /* KRB5_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* include/krb5/certauth_plugin.h - certauth plugin header. */
/*
* Copyright (C) 2017 by Red Hat, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for certauth plugin module implementors.
*
* The certauth pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* certauth plugin modules should define a function named
* certauth_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* certauth_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_certauth_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_CERTAUTH_PLUGIN_H
#define KRB5_CERTAUTH_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* Abstract module data type. */
typedef struct krb5_certauth_moddata_st *krb5_certauth_moddata;
/* A module can optionally include <kdb.h> to inspect the client principal
* entry when authorizing a request. */
struct _krb5_db_entry_new;
/*
* Optional: Initialize module data.
*/
typedef krb5_error_code
(*krb5_certauth_init_fn)(krb5_context context,
krb5_certauth_moddata *moddata_out);
/*
* Optional: Clean up the module data.
*/
typedef void
(*krb5_certauth_fini_fn)(krb5_context context, krb5_certauth_moddata moddata);
/*
* Mandatory: return 0 or KRB5_CERTAUTH_HWAUTH if the DER-encoded cert is
* authorized for PKINIT authentication by princ; otherwise return one of the
* following error codes:
* - KRB5KDC_ERR_CLIENT_NAME_MISMATCH - incorrect SAN value
* - KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE - incorrect EKU
* - KRB5KDC_ERR_CERTIFICATE_MISMATCH - other extension error
* - KRB5_PLUGIN_NO_HANDLE - the module has no opinion about cert
*
* Returning KRB5_CERTAUTH_HWAUTH will cause the hw-authent flag to be set in
* the issued ticket (new in release 1.19).
*
* - opts is used by built-in modules to receive internal data, and must be
* ignored by other modules.
* - db_entry receives the client principal database entry, and can be ignored
* by modules that do not link with libkdb5.
* - *authinds_out optionally returns a null-terminated list of authentication
* indicator strings upon KRB5_PLUGIN_NO_HANDLE or accepted authorization.
*/
typedef krb5_error_code
(*krb5_certauth_authorize_fn)(krb5_context context,
krb5_certauth_moddata moddata,
const uint8_t *cert, size_t cert_len,
krb5_const_principal princ, const void *opts,
const struct _krb5_db_entry_new *db_entry,
char ***authinds_out);
/*
* Free indicators allocated by a module. Mandatory if authorize returns
* authentication indicators.
*/
typedef void
(*krb5_certauth_free_indicator_fn)(krb5_context context,
krb5_certauth_moddata moddata,
char **authinds);
typedef struct krb5_certauth_vtable_st {
const char *name;
krb5_certauth_init_fn init;
krb5_certauth_fini_fn fini;
krb5_certauth_authorize_fn authorize;
krb5_certauth_free_indicator_fn free_ind;
} *krb5_certauth_vtable;
#endif /* KRB5_CERTAUTH_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2010 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
#ifndef H_KRB5_KADM5_HOOK_PLUGIN
#define H_KRB5_KADM5_HOOK_PLUGIN
/**
* @file krb5/krb5_kadm5_hook_plugin.h
* Provide a plugin interface for kadm5 operations. This interface
* permits a plugin to intercept principal modification, creation and
* change password operations. Operations run at two stages: a
* precommit stage that runs before the operation is committed to the
* database and a postcommit operation that runs after the database
* is updated; see #kadm5_hook_stage for details on semantics.
*
* This interface is based on a proposed extension to Heimdal by Russ
* Allbery; it is likely that Heimdal will adopt an approach based on
* stacked kdb modules rather than this interface. For MIT, writing a
* plugin to this interface is significantly easier than stacking kdb
* modules. Also, the kadm5 interface is significantly more stable
* than the kdb interface, so this approach is more desirable than
* stacked kdb modules.
*
* This interface depends on kadm5/admin.h. As such, the interface
* does not provide strong guarantees of ABI stability.
*
* The kadm5_hook interface currently has only one supported major version,
* which is 1. Major version 1 has a current minor version number of 2.
*
* kadm5_hook plugins should:
* kadm5_hook_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* kadm5_hook_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to kadm5_hook_vftable_1
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#include <krb5/krb5.h>
#include <krb5/plugin.h>
#include <kadm5/admin.h>
/**
* Whether the operation is being run before or after the database
* update.
*/
enum kadm5_hook_stage {
/** In this stage, any plugin failure prevents following plugins from
* running and aborts the operation.*/
KADM5_HOOK_STAGE_PRECOMMIT,
/** In this stage, plugin failures are logged but otherwise ignored.*/
KADM5_HOOK_STAGE_POSTCOMMIT
};
/** Opaque module data pointer. */
typedef struct kadm5_hook_modinfo_st kadm5_hook_modinfo;
/**
* Interface for the v1 virtual table for the kadm5_hook plugin.
* All entry points are optional. The name field must be provided.
*/
typedef struct kadm5_hook_vtable_1_st {
/** A text string identifying the plugin for logging messages. */
const char *name;
/** Initialize a plugin module.
* @param modinfo returns newly allocated module info for future
* calls. Cleaned up by the fini() function.
*/
kadm5_ret_t (*init)(krb5_context, kadm5_hook_modinfo **modinfo);
/** Clean up a module and free @a modinfo. */
void (*fini)(krb5_context, kadm5_hook_modinfo *modinfo);
/** Indicates that the password is being changed.
* @param stage is an integer from #kadm5_hook_stage enumeration
* @param keepold is true if existing keys are being kept.
* @param newpass is NULL if the key sare being randomized.
*/
kadm5_ret_t (*chpass)(krb5_context,
kadm5_hook_modinfo *modinfo,
int stage,
krb5_principal, krb5_boolean keepold,
int n_ks_tuple,
krb5_key_salt_tuple *ks_tuple,
const char *newpass);
/** Indicate a principal is created. */
kadm5_ret_t (*create)(krb5_context,
kadm5_hook_modinfo *,
int stage,
kadm5_principal_ent_t, long mask,
int n_ks_tuple,
krb5_key_salt_tuple *ks_tuple,
const char *password);
/** Modify a principal. */
kadm5_ret_t (*modify)(krb5_context,
kadm5_hook_modinfo *,
int stage,
kadm5_principal_ent_t, long mask);
/** Indicate a principal is deleted. */
kadm5_ret_t (*remove)(krb5_context,
kadm5_hook_modinfo *modinfo,
int stage, krb5_principal);
/* End of minor version 1. */
/** Indicate a principal is renamed. */
kadm5_ret_t (*rename)(krb5_context,
kadm5_hook_modinfo *modinfo,
int stage, krb5_principal, krb5_principal);
/* End of minor version 2. */
} kadm5_hook_vftable_1;
#endif /*H_KRB5_KADM5_HOOK_PLUGIN*/
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2010 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
* Declarations for password quality plugin module implementors.
*
* The password quality pluggable interface currently has only one supported
* major version, which is 1. Major version 1 has a current minor version
* number of 1.
*
* Password quality plugin modules should define a function named
* pwqual_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* pwqual_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_pwqual_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_PWQUAL_PLUGIN_H
#define KRB5_PWQUAL_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
#include <kadm5/admin.h>
/* An abstract type for password quality module data. */
typedef struct krb5_pwqual_moddata_st *krb5_pwqual_moddata;
/*** Method type declarations ***/
/* Optional: Initialize module data. dictfile is the realm's configured
* dictionary filename. */
typedef krb5_error_code
(*krb5_pwqual_open_fn)(krb5_context context, const char *dict_file,
krb5_pwqual_moddata *data);
/*
* Mandatory: Check a password for the principal princ, which has an associated
* password policy named policy_name (or no associated policy if policy_name is
* NULL). The parameter languages, if not NULL, contains a null-terminated
* list of client-specified language tags as defined in RFC 5646. The method
* should return one of the following errors if the password fails quality
* standards:
*
* - KADM5_PASS_Q_TOOSHORT: password should be longer
* - KADM5_PASS_Q_CLASS: password must have more character classes
* - KADM5_PASS_Q_DICT: password contains dictionary words
* - KADM5_PASS_Q_GENERIC: unspecified quality failure
*
* The module should also set an extended error message with
* krb5_set_error_message(). The message may be localized according to one of
* the language tags in languages.
*/
typedef krb5_error_code
(*krb5_pwqual_check_fn)(krb5_context context, krb5_pwqual_moddata data,
const char *password, const char *policy_name,
krb5_principal princ, const char **languages);
/* Optional: Release resources used by module data. */
typedef void
(*krb5_pwqual_close_fn)(krb5_context context, krb5_pwqual_moddata data);
/*** vtable declarations **/
/* Password quality plugin vtable for major version 1. */
typedef struct krb5_pwqual_vtable_st {
const char *name; /* Mandatory: name of module. */
krb5_pwqual_open_fn open;
krb5_pwqual_check_fn check;
krb5_pwqual_close_fn close;
/* Minor version 1 ends here. */
} *krb5_pwqual_vtable;
#endif /* KRB5_PWQUAL_PLUGIN_H */
/* This file is generated, please don't edit it directly. */
#ifndef KRB5_KRB5_H_INCLUDED
#define KRB5_KRB5_H_INCLUDED
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* General definitions for Kerberos version 5. */
/*
* Copyright 1989, 1990, 1995, 2001, 2003, 2007, 2011 by the Massachusetts
* Institute of Technology. All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* All rights reserved.
*
* Export of this software from the United States of America may require
* a specific license from the United States Government. It is the
* responsibility of any person or organization contemplating export to
* obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of FundsXpress. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. FundsXpress makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef KRB5_GENERAL__
#define KRB5_GENERAL__
/** @defgroup KRB5_H krb5 library API
* @{
*/
/* By default, do not expose deprecated interfaces. */
#ifndef KRB5_DEPRECATED
#define KRB5_DEPRECATED 0
#endif
#if defined(__MACH__) && defined(__APPLE__)
# include <TargetConditionals.h>
# if TARGET_RT_MAC_CFM
# error "Use KfM 4.0 SDK headers for CFM compilation."
# endif
#endif
#if defined(_MSDOS) || defined(_WIN32)
#include <win-mac.h>
#endif
#ifndef KRB5_CONFIG__
#ifndef KRB5_CALLCONV
#define KRB5_CALLCONV
#define KRB5_CALLCONV_C
#endif /* !KRB5_CALLCONV */
#endif /* !KRB5_CONFIG__ */
#ifndef KRB5_CALLCONV_WRONG
#define KRB5_CALLCONV_WRONG
#endif
#ifndef THREEPARAMOPEN
#define THREEPARAMOPEN(x,y,z) open(x,y,z)
#endif
#if KRB5_PRIVATE
#ifndef WRITABLEFOPEN
#define WRITABLEFOPEN(x,y) fopen(x,y)
#endif
#endif
#define KRB5_OLD_CRYPTO
#include <stdlib.h>
#include <limits.h> /* for *_MAX */
#include <stdarg.h>
#include <stdint.h>
#ifndef KRB5INT_BEGIN_DECLS
#if defined(__cplusplus)
#define KRB5INT_BEGIN_DECLS extern "C" {
#define KRB5INT_END_DECLS }
#else
#define KRB5INT_BEGIN_DECLS
#define KRB5INT_END_DECLS
#endif
#endif
KRB5INT_BEGIN_DECLS
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
# pragma pack(push,2)
#endif
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 30203
# define KRB5_ATTR_DEPRECATED __attribute__((deprecated))
#elif defined _WIN32
# define KRB5_ATTR_DEPRECATED __declspec(deprecated)
#else
# define KRB5_ATTR_DEPRECATED
#endif
/* from profile.h */
struct _profile_t;
/* typedef struct _profile_t *profile_t; */
/*
* begin wordsize.h
*/
/*
* Word-size related definition.
*/
typedef uint8_t krb5_octet;
typedef int16_t krb5_int16;
typedef uint16_t krb5_ui_2;
typedef int32_t krb5_int32;
typedef uint32_t krb5_ui_4;
#define VALID_INT_BITS INT_MAX
#define VALID_UINT_BITS UINT_MAX
#define KRB5_INT32_MAX 2147483647
/* this strange form is necessary since - is a unary operator, not a sign
indicator */
#define KRB5_INT32_MIN (-KRB5_INT32_MAX-1)
#define KRB5_INT16_MAX 65535
/* this strange form is necessary since - is a unary operator, not a sign
indicator */
#define KRB5_INT16_MIN (-KRB5_INT16_MAX-1)
/*
* end wordsize.h
*/
/*
* begin "base-defs.h"
*/
/*
* Basic definitions for Kerberos V5 library
*/
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef unsigned int krb5_boolean;
typedef unsigned int krb5_msgtype;
typedef unsigned int krb5_kvno;
typedef krb5_int32 krb5_addrtype;
typedef krb5_int32 krb5_enctype;
typedef krb5_int32 krb5_cksumtype;
typedef krb5_int32 krb5_authdatatype;
typedef krb5_int32 krb5_keyusage;
typedef krb5_int32 krb5_cryptotype;
typedef krb5_int32 krb5_preauthtype; /* This may change, later on */
typedef krb5_int32 krb5_flags;
/**
* Represents a timestamp in seconds since the POSIX epoch. This legacy type
* is used frequently in the ABI, but cannot represent timestamps after 2038 as
* a positive number. Code which uses this type should cast values of it to
* uint32_t so that negative values are treated as timestamps between 2038 and
* 2106 on platforms with 64-bit time_t.
*/
typedef krb5_int32 krb5_timestamp;
typedef krb5_int32 krb5_deltat;
/**
* Used to convey an operation status. The value 0 indicates success; any
* other values are com_err codes. Use krb5_get_error_message() to obtain a
* string describing the error.
*/
typedef krb5_int32 krb5_error_code;
typedef krb5_error_code krb5_magic;
typedef struct _krb5_data {
krb5_magic magic;
unsigned int length;
char *data;
} krb5_data;
/* Originally introduced for PKINIT; now unused. Do not use this. */
typedef struct _krb5_octet_data {
krb5_magic magic;
unsigned int length;
krb5_octet *data;
} krb5_octet_data;
/* Originally used to recognize AFS and default salts. No longer used. */
#define SALT_TYPE_AFS_LENGTH UINT_MAX
#define SALT_TYPE_NO_LENGTH UINT_MAX
typedef void * krb5_pointer;
typedef void const * krb5_const_pointer;
typedef struct krb5_principal_data {
krb5_magic magic;
krb5_data realm;
krb5_data *data; /**< An array of strings */
krb5_int32 length;
krb5_int32 type;
} krb5_principal_data;
typedef krb5_principal_data * krb5_principal;
/*
* Per V5 spec on definition of principal types
*/
#define KRB5_NT_UNKNOWN 0 /**< Name type not known */
#define KRB5_NT_PRINCIPAL 1 /**< Just the name of the principal
as in DCE, or for users */
#define KRB5_NT_SRV_INST 2 /**< Service and other unique instance (krbtgt) */
#define KRB5_NT_SRV_HST 3 /**< Service with host name as instance
(telnet, rcommands) */
#define KRB5_NT_SRV_XHST 4 /**< Service with host as remaining components */
#define KRB5_NT_UID 5 /**< Unique ID */
#define KRB5_NT_X500_PRINCIPAL 6 /**< PKINIT */
#define KRB5_NT_SMTP_NAME 7 /**< Name in form of SMTP email name */
#define KRB5_NT_ENTERPRISE_PRINCIPAL 10 /**< Windows 2000 UPN */
#define KRB5_NT_WELLKNOWN 11 /**< Well-known (special) principal */
#define KRB5_WELLKNOWN_NAMESTR "WELLKNOWN" /**< First component of
NT_WELLKNOWN principals */
#define KRB5_NT_MS_PRINCIPAL -128 /**< Windows 2000 UPN and SID */
#define KRB5_NT_MS_PRINCIPAL_AND_ID -129 /**< NT 4 style name */
#define KRB5_NT_ENT_PRINCIPAL_AND_ID -130 /**< NT 4 style name and SID */
/** Constant version of krb5_principal_data */
typedef const krb5_principal_data *krb5_const_principal;
#define krb5_princ_realm(context, princ) (&(princ)->realm)
#define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value))
#define krb5_princ_set_realm_length(context, princ,value) (princ)->realm.length = (value)
#define krb5_princ_set_realm_data(context, princ,value) (princ)->realm.data = (value)
#define krb5_princ_size(context, princ) (princ)->length
#define krb5_princ_type(context, princ) (princ)->type
#define krb5_princ_name(context, princ) (princ)->data
#define krb5_princ_component(context, princ,i) \
(((i) < krb5_princ_size(context, princ)) \
? (princ)->data + (i) \
: NULL)
/** Constant for realm referrals. */
#define KRB5_REFERRAL_REALM ""
/*
* Referral-specific functions.
*/
/**
* Check for a match with KRB5_REFERRAL_REALM.
*
* @param [in] r Realm to check
*
* @return @c TRUE if @a r is zero-length, @c FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_is_referral_realm(const krb5_data *r);
/**
* Return an anonymous realm data.
*
* This function returns constant storage that must not be freed.
*
* @sa #KRB5_ANONYMOUS_REALMSTR
*/
const krb5_data *KRB5_CALLCONV
krb5_anonymous_realm(void);
/**
* Build an anonymous principal.
*
* This function returns constant storage that must not be freed.
*
* @sa #KRB5_ANONYMOUS_PRINCSTR
*/
krb5_const_principal KRB5_CALLCONV
krb5_anonymous_principal(void);
#define KRB5_ANONYMOUS_REALMSTR "WELLKNOWN:ANONYMOUS" /**< Anonymous realm */
#define KRB5_ANONYMOUS_PRINCSTR "ANONYMOUS" /**< Anonymous principal name */
/*
* end "base-defs.h"
*/
/*
* begin "hostaddr.h"
*/
/** Structure for address */
typedef struct _krb5_address {
krb5_magic magic;
krb5_addrtype addrtype;
unsigned int length;
krb5_octet *contents;
} krb5_address;
/* per Kerberos v5 protocol spec */
#define ADDRTYPE_INET 0x0002
#define ADDRTYPE_CHAOS 0x0005
#define ADDRTYPE_XNS 0x0006
#define ADDRTYPE_ISO 0x0007
#define ADDRTYPE_DDP 0x0010
#define ADDRTYPE_NETBIOS 0x0014
#define ADDRTYPE_INET6 0x0018
/* not yet in the spec... */
#define ADDRTYPE_ADDRPORT 0x0100
#define ADDRTYPE_IPPORT 0x0101
/* macros to determine if a type is a local type */
#define ADDRTYPE_IS_LOCAL(addrtype) (addrtype & 0x8000)
/*
* end "hostaddr.h"
*/
struct _krb5_context;
typedef struct _krb5_context * krb5_context;
struct _krb5_auth_context;
typedef struct _krb5_auth_context * krb5_auth_context;
struct _krb5_cryptosystem_entry;
/*
* begin "encryption.h"
*/
/** Exposed contents of a key. */
typedef struct _krb5_keyblock {
krb5_magic magic;
krb5_enctype enctype;
unsigned int length;
krb5_octet *contents;
} krb5_keyblock;
struct krb5_key_st;
/**
* Opaque identifier for a key.
*
* Use with the krb5_k APIs for better performance for repeated operations with
* the same key and usage. Key identifiers must not be used simultaneously
* within multiple threads, as they may contain mutable internal state and are
* not mutex-protected.
*/
typedef struct krb5_key_st *krb5_key;
#ifdef KRB5_OLD_CRYPTO
typedef struct _krb5_encrypt_block {
krb5_magic magic;
krb5_enctype crypto_entry; /* to call krb5_encrypt_size, you need
this. it was a pointer, but it
doesn't have to be. gross. */
krb5_keyblock *key;
} krb5_encrypt_block;
#endif
typedef struct _krb5_checksum {
krb5_magic magic;
krb5_cksumtype checksum_type; /* checksum type */
unsigned int length;
krb5_octet *contents;
} krb5_checksum;
typedef struct _krb5_enc_data {
krb5_magic magic;
krb5_enctype enctype;
krb5_kvno kvno;
krb5_data ciphertext;
} krb5_enc_data;
/**
* Structure to describe a region of text to be encrypted or decrypted.
*
* The @a flags member describes the type of the iov.
* The @a data member points to the memory that will be manipulated.
* All iov APIs take a pointer to the first element of an array of krb5_crypto_iov's
* along with the size of that array. Buffer contents are manipulated in-place;
* data is overwritten. Callers must allocate the right number of krb5_crypto_iov
* structures before calling into an iov API.
*/
typedef struct _krb5_crypto_iov {
krb5_cryptotype flags; /**< @ref KRB5_CRYPTO_TYPE type of the iov */
krb5_data data;
} krb5_crypto_iov;
/* per Kerberos v5 protocol spec */
#define ENCTYPE_NULL 0x0000
#define ENCTYPE_DES_CBC_CRC 0x0001 /**< @deprecated no longer supported */
#define ENCTYPE_DES_CBC_MD4 0x0002 /**< @deprecated no longer supported */
#define ENCTYPE_DES_CBC_MD5 0x0003 /**< @deprecated no longer supported */
#define ENCTYPE_DES_CBC_RAW 0x0004 /**< @deprecated no longer supported */
#define ENCTYPE_DES3_CBC_SHA 0x0005 /**< @deprecated no longer supported */
#define ENCTYPE_DES3_CBC_RAW 0x0006 /**< @deprecated no longer supported */
#define ENCTYPE_DES_HMAC_SHA1 0x0008 /**< @deprecated no longer supported */
/* PKINIT */
#define ENCTYPE_DSA_SHA1_CMS 0x0009 /**< DSA with SHA1, CMS signature */
#define ENCTYPE_MD5_RSA_CMS 0x000a /**< MD5 with RSA, CMS signature */
#define ENCTYPE_SHA1_RSA_CMS 0x000b /**< SHA1 with RSA, CMS signature */
#define ENCTYPE_RC2_CBC_ENV 0x000c /**< RC2 cbc mode, CMS enveloped data */
#define ENCTYPE_RSA_ENV 0x000d /**< RSA encryption, CMS enveloped data */
#define ENCTYPE_RSA_ES_OAEP_ENV 0x000e /**< RSA w/OEAP encryption, CMS enveloped data */
#define ENCTYPE_DES3_CBC_ENV 0x000f /**< @deprecated no longer supported */
#define ENCTYPE_DES3_CBC_SHA1 0x0010 /**< @deprecated removed */
#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 /**< RFC 3962 */
#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 /**< RFC 3962 */
#define ENCTYPE_AES128_CTS_HMAC_SHA256_128 0x0013 /**< RFC 8009 */
#define ENCTYPE_AES256_CTS_HMAC_SHA384_192 0x0014 /**< RFC 8009 */
#define ENCTYPE_ARCFOUR_HMAC 0x0017 /**< RFC 4757 */
#define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018 /**< RFC 4757 */
#define ENCTYPE_CAMELLIA128_CTS_CMAC 0x0019 /**< RFC 6803 */
#define ENCTYPE_CAMELLIA256_CTS_CMAC 0x001a /**< RFC 6803 */
#define ENCTYPE_UNKNOWN 0x01ff
/*
* Historically we used the value 9 for unkeyed SHA-1. RFC 3961 assigns this
* value to rsa-md5-des3, which fortunately is unused. For ABI compatibility
* we allow either 9 or 14 for SHA-1.
*/
#define CKSUMTYPE_CRC32 0x0001
#define CKSUMTYPE_RSA_MD4 0x0002
#define CKSUMTYPE_RSA_MD4_DES 0x0003
#define CKSUMTYPE_DESCBC 0x0004
/* des-mac-k */
/* rsa-md4-des-k */
#define CKSUMTYPE_RSA_MD5 0x0007
#define CKSUMTYPE_RSA_MD5_DES 0x0008
#define CKSUMTYPE_NIST_SHA 0x0009
#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c /* @deprecated removed */
#define CKSUMTYPE_SHA1 0x000d /**< RFC 3962 */
#define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f /**< RFC 3962. Used with
ENCTYPE_AES128_CTS_HMAC_SHA1_96 */
#define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 /**< RFC 3962. Used with
ENCTYPE_AES256_CTS_HMAC_SHA1_96 */
#define CKSUMTYPE_HMAC_SHA256_128_AES128 0x0013 /**< RFC 8009 */
#define CKSUMTYPE_HMAC_SHA384_192_AES256 0x0014 /**< RFC 8009 */
#define CKSUMTYPE_CMAC_CAMELLIA128 0x0011 /**< RFC 6803 */
#define CKSUMTYPE_CMAC_CAMELLIA256 0x0012 /**< RFC 6803 */
#define CKSUMTYPE_MD5_HMAC_ARCFOUR -137 /* Microsoft netlogon */
#define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /**< RFC 4757 */
/*
* The following are entropy source designations. Whenever
* krb5_C_random_add_entropy is called, one of these source ids is passed in.
* This allows the library to better estimate bits of entropy in the sample and
* to keep track of what sources of entropy have contributed enough entropy.
* Sources marked internal MUST NOT be used by applications outside the
* Kerberos library
*/
enum {
KRB5_C_RANDSOURCE_OLDAPI = 0, /*calls to krb5_C_RANDOM_SEED (INTERNAL)*/
KRB5_C_RANDSOURCE_OSRAND = 1, /* /dev/random or equivalent (internal)*/
KRB5_C_RANDSOURCE_TRUSTEDPARTY = 2, /* From KDC or other trusted party*/
/*
* This source should be used carefully; data in this category
* should be from a third party trusted to give random bits
* For example keys issued by the KDC in the application server.
*/
KRB5_C_RANDSOURCE_TIMING = 3, /* Timing of operations*/
KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL = 4, /*Protocol data possibly from attacker*/
KRB5_C_RANDSOURCE_MAX = 5 /*Do not use; maximum source ID*/
};
#ifndef krb5_roundup
/* round x up to nearest multiple of y */
#define krb5_roundup(x, y) ((((x) + (y) - 1)/(y))*(y))
#endif /* roundup */
/* macro function definitions to help clean up code */
#if 1
#define krb5_x(ptr,args) ((ptr)?((*(ptr)) args):(abort(),1))
#define krb5_xc(ptr,args) ((ptr)?((*(ptr)) args):(abort(),(char*)0))
#else
#define krb5_x(ptr,args) ((*(ptr)) args)
#define krb5_xc(ptr,args) ((*(ptr)) args)
#endif
/**
* Encrypt data using a key (operates on keyblock).
*
* @param [in] context Library context
* @param [in] key Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in,out] cipher_state Cipher state; specify NULL if not needed
* @param [in] input Data to be encrypted
* @param [out] output Encrypted data
*
* This function encrypts the data block @a input and stores the output into @a
* output. The actual encryption key will be derived from @a key and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the encryption operation, and
* is updated with the state to be passed as input to the next operation.
*
* @note The caller must initialize @a output and allocate at least enough
* space for the result (using krb5_c_encrypt_length() to determine the amount
* of space needed). @a output->length will be set to the actual length of the
* ciphertext.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_encrypt(krb5_context context, const krb5_keyblock *key,
krb5_keyusage usage, const krb5_data *cipher_state,
const krb5_data *input, krb5_enc_data *output);
/**
* Decrypt data using a key (operates on keyblock).
*
* @param [in] context Library context
* @param [in] key Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in,out] cipher_state Cipher state; specify NULL if not needed
* @param [in] input Encrypted data
* @param [out] output Decrypted data
*
* This function decrypts the data block @a input and stores the output into @a
* output. The actual decryption key will be derived from @a key and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the decryption operation, and
* is updated with the state to be passed as input to the next operation.
*
* @note The caller must initialize @a output and allocate at least enough
* space for the result. The usual practice is to allocate an output buffer as
* long as the ciphertext, and let krb5_c_decrypt() trim @a output->length.
* For some enctypes, the resulting @a output->length may include padding
* bytes.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_decrypt(krb5_context context, const krb5_keyblock *key,
krb5_keyusage usage, const krb5_data *cipher_state,
const krb5_enc_data *input, krb5_data *output);
/**
* Compute encrypted data length.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] inputlen Length of the data to be encrypted
* @param [out] length Length of the encrypted data
*
* This function computes the length of the ciphertext produced by encrypting
* @a inputlen bytes including padding, confounder, and checksum.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype,
size_t inputlen, size_t *length);
/**
* Return cipher block size.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [out] blocksize Block size for @a enctype
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_block_size(krb5_context context, krb5_enctype enctype,
size_t *blocksize);
/**
* Return length of the specified key in bytes.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [out] keybytes Number of bytes required to make a key
* @param [out] keylength Length of final key
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_keylengths(krb5_context context, krb5_enctype enctype,
size_t *keybytes, size_t *keylength);
/**
* Initialize a new cipher state.
*
* @param [in] context Library context
* @param [in] key Key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [out] new_state New cipher state
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_init_state(krb5_context context, const krb5_keyblock *key,
krb5_keyusage usage, krb5_data *new_state);
/**
* Free a cipher state previously allocated by krb5_c_init_state().
*
* @param [in] context Library context
* @param [in] key Key
* @param [in] state Cipher state to be freed
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_free_state(krb5_context context, const krb5_keyblock *key,
krb5_data *state);
/**
* Generate enctype-specific pseudo-random bytes.
*
* @param [in] context Library context
* @param [in] keyblock Key
* @param [in] input Input data
* @param [out] output Output data
*
* This function selects a pseudo-random function based on @a keyblock and
* computes its value over @a input, placing the result into @a output.
* The caller must preinitialize @a output and allocate space for the
* result, using krb5_c_prf_length() to determine the required length.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock,
krb5_data *input, krb5_data *output);
/**
* Get the output length of pseudo-random functions for an encryption type.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [out] len Length of PRF output
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_prf_length(krb5_context context, krb5_enctype enctype, size_t *len);
/**
* Generate pseudo-random bytes using RFC 6113 PRF+.
*
* @param [in] context Library context
* @param [in] k KDC contribution key
* @param [in] input Input data
* @param [out] output Pseudo-random output buffer
*
* This function fills @a output with PRF+(k, input) as defined in RFC 6113
* section 5.1. The caller must preinitialize @a output and allocate the
* desired amount of space. The length of the pseudo-random output will match
* the length of @a output.
*
* @note RFC 4402 defines a different PRF+ operation. This function does not
* implement that operation.
*
* @return 0 on success, @c E2BIG if output->length is too large for PRF+ to
* generate, @c ENOMEM on allocation failure, or an error code from
* krb5_c_prf()
*/
krb5_error_code KRB5_CALLCONV
krb5_c_prfplus(krb5_context context, const krb5_keyblock *k,
const krb5_data *input, krb5_data *output);
/**
* Derive a key using some input data (via RFC 6113 PRF+).
*
* @param [in] context Library context
* @param [in] k KDC contribution key
* @param [in] input Input string
* @param [in] enctype Output key enctype (or @c ENCTYPE_NULL)
* @param [out] out Derived keyblock
*
* This function uses PRF+ as defined in RFC 6113 to derive a key from another
* key and an input string. If @a enctype is @c ENCTYPE_NULL, the output key
* will have the same enctype as the input key.
*/
krb5_error_code KRB5_CALLCONV
krb5_c_derive_prfplus(krb5_context context, const krb5_keyblock *k,
const krb5_data *input, krb5_enctype enctype,
krb5_keyblock **out);
/**
* Compute the KRB-FX-CF2 combination of two keys and pepper strings.
*
* @param [in] context Library context
* @param [in] k1 KDC contribution key
* @param [in] pepper1 String "PKINIT"
* @param [in] k2 Reply key
* @param [in] pepper2 String "KeyExchange"
* @param [out] out Output key
*
* This function computes the KRB-FX-CF2 function over its inputs and places
* the results in a newly allocated keyblock. This function is simple in that
* it assumes that @a pepper1 and @a pepper2 are C strings with no internal
* nulls and that the enctype of the result will be the same as that of @a k1.
* @a k1 and @a k2 may be of different enctypes.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_fx_cf2_simple(krb5_context context,
const krb5_keyblock *k1, const char *pepper1,
const krb5_keyblock *k2, const char *pepper2,
krb5_keyblock **out);
/**
* Generate an enctype-specific random encryption key.
*
* @param [in] context Library context
* @param [in] enctype Encryption type of the generated key
* @param [out] k5_random_key An allocated and initialized keyblock
*
* Use krb5_free_keyblock_contents() to free @a k5_random_key when
* no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_make_random_key(krb5_context context, krb5_enctype enctype,
krb5_keyblock *k5_random_key);
/**
* Generate an enctype-specific key from random data.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] random_data Random input data
* @param [out] k5_random_key Resulting key
*
* This function takes random input data @a random_data and produces a valid
* key @a k5_random_key for a given @a enctype.
*
* @note It is assumed that @a k5_random_key has already been initialized and
* @a k5_random_key->contents has been allocated with the correct length.
*
* @sa krb5_c_keylengths()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_random_to_key(krb5_context context, krb5_enctype enctype,
krb5_data *random_data, krb5_keyblock *k5_random_key);
/**
* Add entropy to the pseudo-random number generator.
*
* @param [in] context Library context
* @param [in] randsource Entropy source (see KRB5_RANDSOURCE types)
* @param [in] data Data
*
* Contribute entropy to the PRNG used by krb5 crypto operations. This may or
* may not affect the output of the next crypto operation requiring random
* data.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_random_add_entropy(krb5_context context, unsigned int randsource,
const krb5_data *data);
/**
* Generate pseudo-random bytes.
*
* @param [in] context Library context
* @param [out] data Random data
*
* Fills in @a data with bytes from the PRNG used by krb5 crypto operations.
* The caller must preinitialize @a data and allocate the desired amount of
* space.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_random_make_octets(krb5_context context, krb5_data *data);
/**
* Collect entropy from the OS if possible.
*
* @param [in] context Library context
* @param [in] strong Strongest available source of entropy
* @param [out] success 1 if OS provides entropy, 0 otherwise
*
* If @a strong is non-zero, this function attempts to use the strongest
* available source of entropy. Setting this flag may cause the function to
* block on some operating systems. Good uses include seeding the PRNG for
* kadmind and realm setup.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_random_os_entropy(krb5_context context, int strong, int *success);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_c_random_seed(krb5_context context, krb5_data *data);
/**
* Convert a string (such a password) to a key.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] string String to be converted
* @param [in] salt Salt value
* @param [out] key Generated key
*
* This function converts @a string to a @a key of encryption type @a enctype,
* using the specified @a salt. The newly created @a key must be released by
* calling krb5_free_keyblock_contents() when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_string_to_key(krb5_context context, krb5_enctype enctype,
const krb5_data *string, const krb5_data *salt,
krb5_keyblock *key);
/**
* Convert a string (such as a password) to a key with additional parameters.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] string String to be converted
* @param [in] salt Salt value
* @param [in] params Parameters
* @param [out] key Generated key
*
* This function is similar to krb5_c_string_to_key(), but also takes
* parameters which may affect the algorithm in an enctype-dependent way. The
* newly created @a key must be released by calling
* krb5_free_keyblock_contents() when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_string_to_key_with_params(krb5_context context,
krb5_enctype enctype,
const krb5_data *string,
const krb5_data *salt,
const krb5_data *params,
krb5_keyblock *key);
/**
* Compare two encryption types.
*
* @param [in] context Library context
* @param [in] e1 First encryption type
* @param [in] e2 Second encryption type
* @param [out] similar @c TRUE if types are similar, @c FALSE if not
*
* This function determines whether two encryption types use the same kind of
* keys.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_enctype_compare(krb5_context context, krb5_enctype e1, krb5_enctype e2,
krb5_boolean *similar);
/**
* Compute a checksum (operates on keyblock).
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type (0 for mandatory type)
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] input Input data
* @param [out] cksum Generated checksum
*
* This function computes a checksum of type @a cksumtype over @a input, using
* @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and
* @a key is non-null, the checksum type will be the mandatory-to-implement
* checksum type for the key's encryption type. The actual checksum key will
* be derived from @a key and @a usage if key derivation is specified for the
* checksum type. The newly created @a cksum must be released by calling
* krb5_free_checksum_contents() when it is no longer needed.
*
* @note This function is similar to krb5_k_make_checksum(), but operates
* on keyblock @a key.
*
* @sa krb5_c_verify_checksum()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_make_checksum(krb5_context context, krb5_cksumtype cksumtype,
const krb5_keyblock *key, krb5_keyusage usage,
const krb5_data *input, krb5_checksum *cksum);
/**
* Verify a checksum (operates on keyblock).
*
* @param [in] context Library context
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage @a key usage
* @param [in] data Data to be used to compute a new checksum
* using @a key to compare @a cksum against
* @param [in] cksum Checksum to be verified
* @param [out] valid Non-zero for success, zero for failure
*
* This function verifies that @a cksum is a valid checksum for @a data. If
* the checksum type of @a cksum is a keyed checksum, @a key is used to verify
* the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL,
* the mandatory checksum type for @a key will be used. The actual checksum
* key will be derived from @a key and @a usage if key derivation is specified
* for the checksum type.
*
* @note This function is similar to krb5_k_verify_checksum(), but operates
* on keyblock @a key.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key,
krb5_keyusage usage, const krb5_data *data,
const krb5_checksum *cksum, krb5_boolean *valid);
/**
* Return the length of checksums for a checksum type.
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type
* @param [out] length Checksum length
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_checksum_length(krb5_context context, krb5_cksumtype cksumtype,
size_t *length);
/**
* Return a list of keyed checksum types usable with an encryption type.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [out] count Count of allowable checksum types
* @param [out] cksumtypes Array of allowable checksum types
*
* Use krb5_free_cksumtypes() to free @a cksumtypes when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype,
unsigned int *count, krb5_cksumtype **cksumtypes);
/** @defgroup KRB5_KEYUSAGE KRB5_KEYUSAGE
* @{
*/
#define KRB5_KEYUSAGE_AS_REQ_PA_ENC_TS 1
#define KRB5_KEYUSAGE_KDC_REP_TICKET 2
#define KRB5_KEYUSAGE_AS_REP_ENCPART 3
#define KRB5_KEYUSAGE_TGS_REQ_AD_SESSKEY 4
#define KRB5_KEYUSAGE_TGS_REQ_AD_SUBKEY 5
#define KRB5_KEYUSAGE_TGS_REQ_AUTH_CKSUM 6
#define KRB5_KEYUSAGE_TGS_REQ_AUTH 7
#define KRB5_KEYUSAGE_TGS_REP_ENCPART_SESSKEY 8
#define KRB5_KEYUSAGE_TGS_REP_ENCPART_SUBKEY 9
#define KRB5_KEYUSAGE_AP_REQ_AUTH_CKSUM 10
#define KRB5_KEYUSAGE_AP_REQ_AUTH 11
#define KRB5_KEYUSAGE_AP_REP_ENCPART 12
#define KRB5_KEYUSAGE_KRB_PRIV_ENCPART 13
#define KRB5_KEYUSAGE_KRB_CRED_ENCPART 14
#define KRB5_KEYUSAGE_KRB_SAFE_CKSUM 15
#define KRB5_KEYUSAGE_APP_DATA_ENCRYPT 16
#define KRB5_KEYUSAGE_APP_DATA_CKSUM 17
#define KRB5_KEYUSAGE_KRB_ERROR_CKSUM 18
#define KRB5_KEYUSAGE_AD_KDCISSUED_CKSUM 19
#define KRB5_KEYUSAGE_AD_MTE 20
#define KRB5_KEYUSAGE_AD_ITE 21
/* XXX need to register these */
#define KRB5_KEYUSAGE_GSS_TOK_MIC 22
#define KRB5_KEYUSAGE_GSS_TOK_WRAP_INTEG 23
#define KRB5_KEYUSAGE_GSS_TOK_WRAP_PRIV 24
/* Defined in Integrating SAM Mechanisms with Kerberos draft */
#define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_CKSUM 25
/** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST */
#define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID 26
/** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY */
#define KRB5_KEYUSAGE_PA_SAM_RESPONSE 27
/* Defined in [MS-SFU] */
/** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID */
#define KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST 26
/** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_RESPONSE */
#define KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY 27
/* unused */
#define KRB5_KEYUSAGE_PA_REFERRAL 26
#define KRB5_KEYUSAGE_AD_SIGNEDPATH -21
#define KRB5_KEYUSAGE_IAKERB_FINISHED 42
#define KRB5_KEYUSAGE_PA_PKINIT_KX 44
#define KRB5_KEYUSAGE_PA_OTP_REQUEST 45 /**< See RFC 6560 section 4.2 */
/* define in draft-ietf-krb-wg-preauth-framework*/
#define KRB5_KEYUSAGE_FAST_REQ_CHKSUM 50
#define KRB5_KEYUSAGE_FAST_ENC 51
#define KRB5_KEYUSAGE_FAST_REP 52
#define KRB5_KEYUSAGE_FAST_FINISHED 53
#define KRB5_KEYUSAGE_ENC_CHALLENGE_CLIENT 54
#define KRB5_KEYUSAGE_ENC_CHALLENGE_KDC 55
#define KRB5_KEYUSAGE_AS_REQ 56
#define KRB5_KEYUSAGE_CAMMAC 64
#define KRB5_KEYUSAGE_SPAKE 65
/* Key usage values 512-1023 are reserved for uses internal to a Kerberos
* implementation. */
#define KRB5_KEYUSAGE_PA_FX_COOKIE 513 /**< Used for encrypted FAST cookies */
#define KRB5_KEYUSAGE_PA_AS_FRESHNESS 514 /**< Used for freshness tokens */
/** @} */ /* end of KRB5_KEYUSAGE group */
/**
* Verify that a specified encryption type is a valid Kerberos encryption type.
*
* @param [in] ktype Encryption type
*
* @return @c TRUE if @a ktype is valid, @c FALSE if not
*/
krb5_boolean KRB5_CALLCONV
krb5_c_valid_enctype(krb5_enctype ktype);
/**
* Verify that specified checksum type is a valid Kerberos checksum type.
*
* @param [in] ctype Checksum type
*
* @return @c TRUE if @a ctype is valid, @c FALSE if not
*/
krb5_boolean KRB5_CALLCONV
krb5_c_valid_cksumtype(krb5_cksumtype ctype);
/**
* Test whether a checksum type is collision-proof.
*
* @param [in] ctype Checksum type
*
* @return @c TRUE if @a ctype is collision-proof, @c FALSE if it is not
* collision-proof or not a valid checksum type.
*/
krb5_boolean KRB5_CALLCONV
krb5_c_is_coll_proof_cksum(krb5_cksumtype ctype);
/**
* Test whether a checksum type is keyed.
*
* @param [in] ctype Checksum type
*
* @return @c TRUE if @a ctype is a keyed checksum type, @c FALSE otherwise.
*/
krb5_boolean KRB5_CALLCONV
krb5_c_is_keyed_cksum(krb5_cksumtype ctype);
/* AEAD APIs */
/** @defgroup KRB5_CRYPTO_TYPE KRB5_CRYPTO_TYPE
* @{
*/
#define KRB5_CRYPTO_TYPE_EMPTY 0 /**< [in] ignored */
#define KRB5_CRYPTO_TYPE_HEADER 1 /**< [out] header */
#define KRB5_CRYPTO_TYPE_DATA 2 /**< [in, out] plaintext */
#define KRB5_CRYPTO_TYPE_SIGN_ONLY 3 /**< [in] associated data */
#define KRB5_CRYPTO_TYPE_PADDING 4 /**< [out] padding */
#define KRB5_CRYPTO_TYPE_TRAILER 5 /**< [out] checksum for encrypt */
#define KRB5_CRYPTO_TYPE_CHECKSUM 6 /**< [out] checksum for MIC */
#define KRB5_CRYPTO_TYPE_STREAM 7 /**< [in] entire message without
decomposing the structure into
header, data and trailer buffers */
/** @} */ /* end of KRB5_CRYPTO_TYPE group */
/**
* Fill in a checksum element in IOV array (operates on keyblock)
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type (0 for mandatory type)
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in,out] data IOV array
* @param [in] num_data Size of @a data
*
* Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over
* #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data.
* Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified.
*
* @note This function is similar to krb5_k_make_checksum_iov(), but operates
* on keyblock @a key.
*
* @sa krb5_c_verify_checksum_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype,
const krb5_keyblock *key, krb5_keyusage usage,
krb5_crypto_iov *data, size_t num_data);
/**
* Validate a checksum element in IOV array (operates on keyblock).
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type (0 for mandatory type)
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] data IOV array
* @param [in] num_data Size of @a data
* @param [out] valid Non-zero for success, zero for failure
*
* Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a
* valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY
* regions in the iov.
*
* @note This function is similar to krb5_k_verify_checksum_iov(), but operates
* on keyblock @a key.
*
* @sa krb5_c_make_checksum_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype,
const krb5_keyblock *key, krb5_keyusage usage,
const krb5_crypto_iov *data, size_t num_data,
krb5_boolean *valid);
/**
* Encrypt data in place supporting AEAD (operates on keyblock).
*
* @param [in] context Library context
* @param [in] keyblock Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] cipher_state Cipher state; specify NULL if not needed
* @param [in,out] data IOV array. Modified in-place.
* @param [in] num_data Size of @a data
*
* This function encrypts the data block @a data and stores the output in-place.
* The actual encryption key will be derived from @a keyblock and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the encryption operation, and
* is updated with the state to be passed as input to the next operation.
* The caller must allocate the right number of krb5_crypto_iov
* structures before calling into this API.
*
* @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the
* iov structure are adjusted to reflect actual lengths of the ciphertext used.
* For example, if the padding length is too large, the length will be reduced.
* Lengths are never increased.
*
* @note This function is similar to krb5_k_encrypt_iov(), but operates
* on keyblock @a keyblock.
*
* @sa krb5_c_decrypt_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_encrypt_iov(krb5_context context, const krb5_keyblock *keyblock,
krb5_keyusage usage, const krb5_data *cipher_state,
krb5_crypto_iov *data, size_t num_data);
/**
* Decrypt data in place supporting AEAD (operates on keyblock).
*
* @param [in] context Library context
* @param [in] keyblock Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] cipher_state Cipher state; specify NULL if not needed
* @param [in,out] data IOV array. Modified in-place.
* @param [in] num_data Size of @a data
*
* This function decrypts the data block @a data and stores the output in-place.
* The actual decryption key will be derived from @a keyblock and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the decryption operation, and
* is updated with the state to be passed as input to the next operation.
* The caller must allocate the right number of krb5_crypto_iov
* structures before calling into this API.
*
* @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the
* iov structure are adjusted to reflect actual lengths of the ciphertext used.
* For example, if the padding length is too large, the length will be reduced.
* Lengths are never increased.
*
* @note This function is similar to krb5_k_decrypt_iov(), but operates
* on keyblock @a keyblock.
*
* @sa krb5_c_decrypt_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_decrypt_iov(krb5_context context, const krb5_keyblock *keyblock,
krb5_keyusage usage, const krb5_data *cipher_state,
krb5_crypto_iov *data, size_t num_data);
/**
* Return a length of a message field specific to the encryption type.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] type Type field (See @ref KRB5_CRYPTO_TYPE types)
* @param [out] size Length of the @a type specific to @a enctype
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_crypto_length(krb5_context context, krb5_enctype enctype,
krb5_cryptotype type, unsigned int *size);
/**
* Fill in lengths for header, trailer and padding in a IOV array.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in,out] data IOV array
* @param [in] num_data Size of @a data
*
* Padding is set to the actual padding required based on the provided
* @a data buffers. Typically this API is used after setting up the data
* buffers and #KRB5_CRYPTO_TYPE_SIGN_ONLY buffers, but before actually
* allocating header, trailer and padding.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_c_crypto_length_iov(krb5_context context, krb5_enctype enctype,
krb5_crypto_iov *data, size_t num_data);
/**
* Return a number of padding octets.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] data_length Length of the plaintext to pad
* @param [out] size Number of padding octets
*
* This function returns the number of the padding octets required to pad
* @a data_length octets of plaintext.
*
* @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE
*/
krb5_error_code KRB5_CALLCONV
krb5_c_padding_length(krb5_context context, krb5_enctype enctype,
size_t data_length, unsigned int *size);
/**
* Create a krb5_key from the enctype and key data in a keyblock.
*
* @param [in] context Library context
* @param [in] key_data Keyblock
* @param [out] out Opaque key
*
* The reference count on a key @a out is set to 1.
* Use krb5_k_free_key() to free @a out when it is no longer needed.
*
* @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE
*/
krb5_error_code KRB5_CALLCONV
krb5_k_create_key(krb5_context context, const krb5_keyblock *key_data,
krb5_key *out);
/** Increment the reference count on a key. */
void KRB5_CALLCONV
krb5_k_reference_key(krb5_context context, krb5_key key);
/** Decrement the reference count on a key and free it if it hits zero. */
void KRB5_CALLCONV
krb5_k_free_key(krb5_context context, krb5_key key);
/** Retrieve a copy of the keyblock from a krb5_key structure. */
krb5_error_code KRB5_CALLCONV
krb5_k_key_keyblock(krb5_context context, krb5_key key,
krb5_keyblock **key_data);
/** Retrieve the enctype of a krb5_key structure. */
krb5_enctype KRB5_CALLCONV
krb5_k_key_enctype(krb5_context context, krb5_key key);
/**
* Encrypt data using a key (operates on opaque key).
*
* @param [in] context Library context
* @param [in] key Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in,out] cipher_state Cipher state; specify NULL if not needed
* @param [in] input Data to be encrypted
* @param [out] output Encrypted data
*
* This function encrypts the data block @a input and stores the output into @a
* output. The actual encryption key will be derived from @a key and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the encryption operation, and
* is updated with the state to be passed as input to the next operation.
*
* @note The caller must initialize @a output and allocate at least enough
* space for the result (using krb5_c_encrypt_length() to determine the amount
* of space needed). @a output->length will be set to the actual length of the
* ciphertext.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_encrypt(krb5_context context, krb5_key key, krb5_keyusage usage,
const krb5_data *cipher_state, const krb5_data *input,
krb5_enc_data *output);
/**
* Encrypt data in place supporting AEAD (operates on opaque key).
*
* @param [in] context Library context
* @param [in] key Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] cipher_state Cipher state; specify NULL if not needed
* @param [in,out] data IOV array. Modified in-place.
* @param [in] num_data Size of @a data
*
* This function encrypts the data block @a data and stores the output in-place.
* The actual encryption key will be derived from @a key and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the encryption operation, and
* is updated with the state to be passed as input to the next operation.
* The caller must allocate the right number of krb5_crypto_iov
* structures before calling into this API.
*
* @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the
* iov structure are adjusted to reflect actual lengths of the ciphertext used.
* For example, if the padding length is too large, the length will be reduced.
* Lengths are never increased.
*
* @note This function is similar to krb5_c_encrypt_iov(), but operates
* on opaque key @a key.
*
* @sa krb5_k_decrypt_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_encrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage,
const krb5_data *cipher_state, krb5_crypto_iov *data,
size_t num_data);
/**
* Decrypt data using a key (operates on opaque key).
*
* @param [in] context Library context
* @param [in] key Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in,out] cipher_state Cipher state; specify NULL if not needed
* @param [in] input Encrypted data
* @param [out] output Decrypted data
*
* This function decrypts the data block @a input and stores the output into @a
* output. The actual decryption key will be derived from @a key and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the decryption operation, and
* is updated with the state to be passed as input to the next operation.
*
* @note The caller must initialize @a output and allocate at least enough
* space for the result. The usual practice is to allocate an output buffer as
* long as the ciphertext, and let krb5_c_decrypt() trim @a output->length.
* For some enctypes, the resulting @a output->length may include padding
* bytes.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_decrypt(krb5_context context, krb5_key key, krb5_keyusage usage,
const krb5_data *cipher_state, const krb5_enc_data *input,
krb5_data *output);
/**
* Decrypt data in place supporting AEAD (operates on opaque key).
*
* @param [in] context Library context
* @param [in] key Encryption key
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] cipher_state Cipher state; specify NULL if not needed
* @param [in,out] data IOV array. Modified in-place.
* @param [in] num_data Size of @a data
*
* This function decrypts the data block @a data and stores the output in-place.
* The actual decryption key will be derived from @a key and @a usage
* if key derivation is specified for the encryption type. If non-null, @a
* cipher_state specifies the beginning state for the decryption operation, and
* is updated with the state to be passed as input to the next operation.
* The caller must allocate the right number of krb5_crypto_iov
* structures before calling into this API.
*
* @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the
* iov structure are adjusted to reflect actual lengths of the ciphertext used.
* For example, if the padding length is too large, the length will be reduced.
* Lengths are never increased.
*
* @note This function is similar to krb5_c_decrypt_iov(), but operates
* on opaque key @a key.
*
* @sa krb5_k_encrypt_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_decrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage,
const krb5_data *cipher_state, krb5_crypto_iov *data,
size_t num_data);
/**
* Compute a checksum (operates on opaque key).
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type (0 for mandatory type)
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] input Input data
* @param [out] cksum Generated checksum
*
* This function computes a checksum of type @a cksumtype over @a input, using
* @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and
* @a key is non-null, the checksum type will be the mandatory-to-implement
* checksum type for the key's encryption type. The actual checksum key will
* be derived from @a key and @a usage if key derivation is specified for the
* checksum type. The newly created @a cksum must be released by calling
* krb5_free_checksum_contents() when it is no longer needed.
*
* @note This function is similar to krb5_c_make_checksum(), but operates
* on opaque @a key.
*
* @sa krb5_c_verify_checksum()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_make_checksum(krb5_context context, krb5_cksumtype cksumtype,
krb5_key key, krb5_keyusage usage, const krb5_data *input,
krb5_checksum *cksum);
/**
* Fill in a checksum element in IOV array (operates on opaque key)
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type (0 for mandatory type)
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in,out] data IOV array
* @param [in] num_data Size of @a data
*
* Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over
* #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data.
* Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified.
*
* @note This function is similar to krb5_c_make_checksum_iov(), but operates
* on opaque @a key.
*
* @sa krb5_k_verify_checksum_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype,
krb5_key key, krb5_keyusage usage,
krb5_crypto_iov *data, size_t num_data);
/**
* Verify a checksum (operates on opaque key).
*
* @param [in] context Library context
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage @a key usage
* @param [in] data Data to be used to compute a new checksum
* using @a key to compare @a cksum against
* @param [in] cksum Checksum to be verified
* @param [out] valid Non-zero for success, zero for failure
*
* This function verifies that @a cksum is a valid checksum for @a data. If
* the checksum type of @a cksum is a keyed checksum, @a key is used to verify
* the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL,
* the mandatory checksum type for @a key will be used. The actual checksum
* key will be derived from @a key and @a usage if key derivation is specified
* for the checksum type.
*
* @note This function is similar to krb5_c_verify_checksum(), but operates
* on opaque @a key.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_verify_checksum(krb5_context context, krb5_key key, krb5_keyusage usage,
const krb5_data *data, const krb5_checksum *cksum,
krb5_boolean *valid);
/**
* Validate a checksum element in IOV array (operates on opaque key).
*
* @param [in] context Library context
* @param [in] cksumtype Checksum type (0 for mandatory type)
* @param [in] key Encryption key for a keyed checksum
* @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types)
* @param [in] data IOV array
* @param [in] num_data Size of @a data
* @param [out] valid Non-zero for success, zero for failure
*
* Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a
* valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY
* regions in the iov.
*
* @note This function is similar to krb5_c_verify_checksum_iov(), but operates
* on opaque @a key.
*
* @sa krb5_k_make_checksum_iov()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype,
krb5_key key, krb5_keyusage usage,
const krb5_crypto_iov *data, size_t num_data,
krb5_boolean *valid);
/**
* Generate enctype-specific pseudo-random bytes (operates on opaque key).
*
* @param [in] context Library context
* @param [in] key Key
* @param [in] input Input data
* @param [out] output Output data
*
* This function selects a pseudo-random function based on @a key and
* computes its value over @a input, placing the result into @a output.
* The caller must preinitialize @a output and allocate space for the
* result.
*
* @note This function is similar to krb5_c_prf(), but operates
* on opaque @a key.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_k_prf(krb5_context context, krb5_key key, krb5_data *input, krb5_data *output);
#ifdef KRB5_OLD_CRYPTO
/*
* old cryptosystem routine prototypes. These are now layered
* on top of the functions above.
*/
/** @deprecated Replaced by krb5_c_* API family.*/
krb5_error_code KRB5_CALLCONV
krb5_encrypt(krb5_context context, krb5_const_pointer inptr,
krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock,
krb5_pointer ivec);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_decrypt(krb5_context context, krb5_const_pointer inptr,
krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock,
krb5_pointer ivec);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_process_key(krb5_context context, krb5_encrypt_block *eblock,
const krb5_keyblock * key);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_finish_key(krb5_context context, krb5_encrypt_block * eblock);
/** @deprecated See krb5_c_string_to_key() */
krb5_error_code KRB5_CALLCONV
krb5_string_to_key(krb5_context context, const krb5_encrypt_block *eblock,
krb5_keyblock * keyblock, const krb5_data *data,
const krb5_data *salt);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_init_random_key(krb5_context context, const krb5_encrypt_block *eblock,
const krb5_keyblock *keyblock, krb5_pointer *ptr);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_finish_random_key(krb5_context context, const krb5_encrypt_block *eblock,
krb5_pointer *ptr);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_random_key(krb5_context context, const krb5_encrypt_block *eblock,
krb5_pointer ptr, krb5_keyblock **keyblock);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_enctype KRB5_CALLCONV
krb5_eblock_enctype(krb5_context context, const krb5_encrypt_block *eblock);
/** @deprecated Replaced by krb5_c_* API family. */
krb5_error_code KRB5_CALLCONV
krb5_use_enctype(krb5_context context, krb5_encrypt_block *eblock,
krb5_enctype enctype);
/** @deprecated Replaced by krb5_c_* API family. */
size_t KRB5_CALLCONV
krb5_encrypt_size(size_t length, krb5_enctype crypto);
/** @deprecated See krb5_c_checksum_length() */
size_t KRB5_CALLCONV
krb5_checksum_size(krb5_context context, krb5_cksumtype ctype);
/** @deprecated See krb5_c_make_checksum() */
krb5_error_code KRB5_CALLCONV
krb5_calculate_checksum(krb5_context context, krb5_cksumtype ctype,
krb5_const_pointer in, size_t in_length,
krb5_const_pointer seed, size_t seed_length,
krb5_checksum * outcksum);
/** @deprecated See krb5_c_verify_checksum() */
krb5_error_code KRB5_CALLCONV
krb5_verify_checksum(krb5_context context, krb5_cksumtype ctype,
const krb5_checksum * cksum, krb5_const_pointer in,
size_t in_length, krb5_const_pointer seed,
size_t seed_length);
#endif /* KRB5_OLD_CRYPTO */
/*
* end "encryption.h"
*/
/*
* begin "fieldbits.h"
*/
/* kdc_options for kdc_request */
/* options is 32 bits; each host is responsible to put the 4 bytes
representing these bits into net order before transmission */
/* #define KDC_OPT_RESERVED 0x80000000 */
#define KDC_OPT_FORWARDABLE 0x40000000
#define KDC_OPT_FORWARDED 0x20000000
#define KDC_OPT_PROXIABLE 0x10000000
#define KDC_OPT_PROXY 0x08000000
#define KDC_OPT_ALLOW_POSTDATE 0x04000000
#define KDC_OPT_POSTDATED 0x02000000
/* #define KDC_OPT_UNUSED 0x01000000 */
#define KDC_OPT_RENEWABLE 0x00800000
/* #define KDC_OPT_UNUSED 0x00400000 */
/* #define KDC_OPT_RESERVED 0x00200000 */
/* #define KDC_OPT_RESERVED 0x00100000 */
/* #define KDC_OPT_RESERVED 0x00080000 */
/* #define KDC_OPT_RESERVED 0x00040000 */
#define KDC_OPT_CNAME_IN_ADDL_TKT 0x00020000
#define KDC_OPT_CANONICALIZE 0x00010000
#define KDC_OPT_REQUEST_ANONYMOUS 0x00008000
/* #define KDC_OPT_RESERVED 0x00004000 */
/* #define KDC_OPT_RESERVED 0x00002000 */
/* #define KDC_OPT_RESERVED 0x00001000 */
/* #define KDC_OPT_RESERVED 0x00000800 */
/* #define KDC_OPT_RESERVED 0x00000400 */
/* #define KDC_OPT_RESERVED 0x00000200 */
/* #define KDC_OPT_RESERVED 0x00000100 */
/* #define KDC_OPT_RESERVED 0x00000080 */
/* #define KDC_OPT_RESERVED 0x00000040 */
#define KDC_OPT_DISABLE_TRANSITED_CHECK 0x00000020
#define KDC_OPT_RENEWABLE_OK 0x00000010
#define KDC_OPT_ENC_TKT_IN_SKEY 0x00000008
/* #define KDC_OPT_UNUSED 0x00000004 */
#define KDC_OPT_RENEW 0x00000002
#define KDC_OPT_VALIDATE 0x00000001
/*
* Mask of ticket flags in the TGT which should be converted into KDC
* options when using the TGT to get derivative tickets.
*
* New mask = KDC_OPT_FORWARDABLE | KDC_OPT_PROXIABLE |
* KDC_OPT_ALLOW_POSTDATE | KDC_OPT_RENEWABLE
*/
#define KDC_TKT_COMMON_MASK 0x54800000
/* definitions for ap_options fields */
/** @defgroup AP_OPTS AP_OPTS
*
* ap_options are 32 bits; each host is responsible to put the 4 bytes
* representing these bits into net order before transmission
* @{
*/
#define AP_OPTS_RESERVED 0x80000000
#define AP_OPTS_USE_SESSION_KEY 0x40000000 /**< Use session key */
#define AP_OPTS_MUTUAL_REQUIRED 0x20000000 /**< Perform a mutual
authentication exchange */
#define AP_OPTS_ETYPE_NEGOTIATION 0x00000002
#define AP_OPTS_USE_SUBKEY 0x00000001 /**< Generate a subsession key
from the current session key
obtained from the
credentials */
/* #define AP_OPTS_RESERVED 0x10000000 */
/* #define AP_OPTS_RESERVED 0x08000000 */
/* #define AP_OPTS_RESERVED 0x04000000 */
/* #define AP_OPTS_RESERVED 0x02000000 */
/* #define AP_OPTS_RESERVED 0x01000000 */
/* #define AP_OPTS_RESERVED 0x00800000 */
/* #define AP_OPTS_RESERVED 0x00400000 */
/* #define AP_OPTS_RESERVED 0x00200000 */
/* #define AP_OPTS_RESERVED 0x00100000 */
/* #define AP_OPTS_RESERVED 0x00080000 */
/* #define AP_OPTS_RESERVED 0x00040000 */
/* #define AP_OPTS_RESERVED 0x00020000 */
/* #define AP_OPTS_RESERVED 0x00010000 */
/* #define AP_OPTS_RESERVED 0x00008000 */
/* #define AP_OPTS_RESERVED 0x00004000 */
/* #define AP_OPTS_RESERVED 0x00002000 */
/* #define AP_OPTS_RESERVED 0x00001000 */
/* #define AP_OPTS_RESERVED 0x00000800 */
/* #define AP_OPTS_RESERVED 0x00000400 */
/* #define AP_OPTS_RESERVED 0x00000200 */
/* #define AP_OPTS_RESERVED 0x00000100 */
/* #define AP_OPTS_RESERVED 0x00000080 */
/* #define AP_OPTS_RESERVED 0x00000040 */
/* #define AP_OPTS_RESERVED 0x00000020 */
/* #define AP_OPTS_RESERVED 0x00000010 */
/* #define AP_OPTS_RESERVED 0x00000008 */
/* #define AP_OPTS_RESERVED 0x00000004 */
#define AP_OPTS_WIRE_MASK 0xfffffff0
/** @} */ /* end of AP_OPTS group */
/* definitions for ad_type fields. */
#define AD_TYPE_RESERVED 0x8000
#define AD_TYPE_EXTERNAL 0x4000
#define AD_TYPE_REGISTERED 0x2000
#define AD_TYPE_FIELD_TYPE_MASK 0x1fff
/* Ticket flags */
/* flags are 32 bits; each host is responsible to put the 4 bytes
representing these bits into net order before transmission */
/* #define TKT_FLG_RESERVED 0x80000000 */
#define TKT_FLG_FORWARDABLE 0x40000000
#define TKT_FLG_FORWARDED 0x20000000
#define TKT_FLG_PROXIABLE 0x10000000
#define TKT_FLG_PROXY 0x08000000
#define TKT_FLG_MAY_POSTDATE 0x04000000
#define TKT_FLG_POSTDATED 0x02000000
#define TKT_FLG_INVALID 0x01000000
#define TKT_FLG_RENEWABLE 0x00800000
#define TKT_FLG_INITIAL 0x00400000
#define TKT_FLG_PRE_AUTH 0x00200000
#define TKT_FLG_HW_AUTH 0x00100000
#define TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000
#define TKT_FLG_OK_AS_DELEGATE 0x00040000
#define TKT_FLG_ENC_PA_REP 0x00010000
#define TKT_FLG_ANONYMOUS 0x00008000
/* #define TKT_FLG_RESERVED 0x00004000 */
/* #define TKT_FLG_RESERVED 0x00002000 */
/* #define TKT_FLG_RESERVED 0x00001000 */
/* #define TKT_FLG_RESERVED 0x00000800 */
/* #define TKT_FLG_RESERVED 0x00000400 */
/* #define TKT_FLG_RESERVED 0x00000200 */
/* #define TKT_FLG_RESERVED 0x00000100 */
/* #define TKT_FLG_RESERVED 0x00000080 */
/* #define TKT_FLG_RESERVED 0x00000040 */
/* #define TKT_FLG_RESERVED 0x00000020 */
/* #define TKT_FLG_RESERVED 0x00000010 */
/* #define TKT_FLG_RESERVED 0x00000008 */
/* #define TKT_FLG_RESERVED 0x00000004 */
/* #define TKT_FLG_RESERVED 0x00000002 */
/* #define TKT_FLG_RESERVED 0x00000001 */
/* definitions for lr_type fields. */
#define LR_TYPE_THIS_SERVER_ONLY 0x8000
#define LR_TYPE_INTERPRETATION_MASK 0x7fff
/* definitions for msec direction bit for KRB_SAFE, KRB_PRIV */
#define MSEC_DIRBIT 0x8000
#define MSEC_VAL_MASK 0x7fff
/*
* end "fieldbits.h"
*/
/*
* begin "proto.h"
*/
/** Protocol version number */
#define KRB5_PVNO 5
/* Message types */
#define KRB5_AS_REQ ((krb5_msgtype)10) /**< Initial authentication request */
#define KRB5_AS_REP ((krb5_msgtype)11) /**< Response to AS request */
#define KRB5_TGS_REQ ((krb5_msgtype)12) /**< Ticket granting server request */
#define KRB5_TGS_REP ((krb5_msgtype)13) /**< Response to TGS request */
#define KRB5_AP_REQ ((krb5_msgtype)14) /**< Auth req to application server */
#define KRB5_AP_REP ((krb5_msgtype)15) /**< Response to mutual AP request */
#define KRB5_SAFE ((krb5_msgtype)20) /**< Safe application message */
#define KRB5_PRIV ((krb5_msgtype)21) /**< Private application message */
#define KRB5_CRED ((krb5_msgtype)22) /**< Cred forwarding message */
#define KRB5_ERROR ((krb5_msgtype)30) /**< Error response */
/* LastReq types */
#define KRB5_LRQ_NONE 0
#define KRB5_LRQ_ALL_LAST_TGT 1
#define KRB5_LRQ_ONE_LAST_TGT (-1)
#define KRB5_LRQ_ALL_LAST_INITIAL 2
#define KRB5_LRQ_ONE_LAST_INITIAL (-2)
#define KRB5_LRQ_ALL_LAST_TGT_ISSUED 3
#define KRB5_LRQ_ONE_LAST_TGT_ISSUED (-3)
#define KRB5_LRQ_ALL_LAST_RENEWAL 4
#define KRB5_LRQ_ONE_LAST_RENEWAL (-4)
#define KRB5_LRQ_ALL_LAST_REQ 5
#define KRB5_LRQ_ONE_LAST_REQ (-5)
#define KRB5_LRQ_ALL_PW_EXPTIME 6
#define KRB5_LRQ_ONE_PW_EXPTIME (-6)
#define KRB5_LRQ_ALL_ACCT_EXPTIME 7
#define KRB5_LRQ_ONE_ACCT_EXPTIME (-7)
/* PADATA types */
#define KRB5_PADATA_NONE 0
#define KRB5_PADATA_AP_REQ 1
#define KRB5_PADATA_TGS_REQ KRB5_PADATA_AP_REQ
#define KRB5_PADATA_ENC_TIMESTAMP 2 /**< RFC 4120 */
#define KRB5_PADATA_PW_SALT 3 /**< RFC 4120 */
#if 0 /* Not used */
#define KRB5_PADATA_ENC_ENCKEY 4 /* Key encrypted within itself */
#endif
#define KRB5_PADATA_ENC_UNIX_TIME 5 /**< timestamp encrypted in key. RFC 4120 */
#define KRB5_PADATA_ENC_SANDIA_SECURID 6 /**< SecurId passcode. RFC 4120 */
#define KRB5_PADATA_SESAME 7 /**< Sesame project. RFC 4120 */
#define KRB5_PADATA_OSF_DCE 8 /**< OSF DCE. RFC 4120 */
#define KRB5_CYBERSAFE_SECUREID 9 /**< Cybersafe. RFC 4120 */
#define KRB5_PADATA_AFS3_SALT 10 /**< Cygnus. RFC 4120, 3961 */
#define KRB5_PADATA_ETYPE_INFO 11 /**< Etype info for preauth. RFC 4120 */
#define KRB5_PADATA_SAM_CHALLENGE 12 /**< SAM/OTP */
#define KRB5_PADATA_SAM_RESPONSE 13 /**< SAM/OTP */
#define KRB5_PADATA_PK_AS_REQ_OLD 14 /**< PKINIT */
#define KRB5_PADATA_PK_AS_REP_OLD 15 /**< PKINIT */
#define KRB5_PADATA_PK_AS_REQ 16 /**< PKINIT. RFC 4556 */
#define KRB5_PADATA_PK_AS_REP 17 /**< PKINIT. RFC 4556 */
#define KRB5_PADATA_ETYPE_INFO2 19 /**< RFC 4120 */
#define KRB5_PADATA_USE_SPECIFIED_KVNO 20 /**< RFC 4120 */
#define KRB5_PADATA_SVR_REFERRAL_INFO 20 /**< Windows 2000 referrals. RFC 6820 */
#define KRB5_PADATA_SAM_REDIRECT 21 /**< SAM/OTP. RFC 4120 */
#define KRB5_PADATA_GET_FROM_TYPED_DATA 22 /**< Embedded in typed data. RFC 4120 */
#define KRB5_PADATA_REFERRAL 25 /**< draft referral system */
#define KRB5_PADATA_SAM_CHALLENGE_2 30 /**< draft challenge system, updated */
#define KRB5_PADATA_SAM_RESPONSE_2 31 /**< draft challenge system, updated */
/* MS-KILE */
#define KRB5_PADATA_PAC_REQUEST 128 /**< include Windows PAC */
#define KRB5_PADATA_FOR_USER 129 /**< username protocol transition request */
#define KRB5_PADATA_S4U_X509_USER 130 /**< certificate protocol transition request */
#define KRB5_PADATA_AS_CHECKSUM 132 /**< AS checksum */
#define KRB5_PADATA_FX_COOKIE 133 /**< RFC 6113 */
#define KRB5_PADATA_FX_FAST 136 /**< RFC 6113 */
#define KRB5_PADATA_FX_ERROR 137 /**< RFC 6113 */
#define KRB5_PADATA_ENCRYPTED_CHALLENGE 138 /**< RFC 6113 */
#define KRB5_PADATA_OTP_CHALLENGE 141 /**< RFC 6560 section 4.1 */
#define KRB5_PADATA_OTP_REQUEST 142 /**< RFC 6560 section 4.2 */
#define KRB5_PADATA_OTP_PIN_CHANGE 144 /**< RFC 6560 section 4.3 */
#define KRB5_PADATA_PKINIT_KX 147 /**< RFC 6112 */
#define KRB5_ENCPADATA_REQ_ENC_PA_REP 149 /**< RFC 6806 */
#define KRB5_PADATA_AS_FRESHNESS 150 /**< RFC 8070 */
#define KRB5_PADATA_SPAKE 151
#define KRB5_PADATA_PAC_OPTIONS 167 /**< MS-KILE and MS-SFU */
#define KRB5_SAM_USE_SAD_AS_KEY 0x80000000
#define KRB5_SAM_SEND_ENCRYPTED_SAD 0x40000000
#define KRB5_SAM_MUST_PK_ENCRYPT_SAD 0x20000000 /**< currently must be zero */
/** Transited encoding types */
#define KRB5_DOMAIN_X500_COMPRESS 1
/** alternate authentication types */
#define KRB5_ALTAUTH_ATT_CHALLENGE_RESPONSE 64
/* authorization data types. See RFC 4120 section 5.2.6 */
/** @defgroup KRB5_AUTHDATA KRB5_AUTHDATA
* @{
*/
#define KRB5_AUTHDATA_IF_RELEVANT 1
#define KRB5_AUTHDATA_KDC_ISSUED 4
#define KRB5_AUTHDATA_AND_OR 5
#define KRB5_AUTHDATA_MANDATORY_FOR_KDC 8
#define KRB5_AUTHDATA_INITIAL_VERIFIED_CAS 9
#define KRB5_AUTHDATA_OSF_DCE 64
#define KRB5_AUTHDATA_SESAME 65
#define KRB5_AUTHDATA_CAMMAC 96
#define KRB5_AUTHDATA_WIN2K_PAC 128
#define KRB5_AUTHDATA_ETYPE_NEGOTIATION 129 /**< RFC 4537 */
#define KRB5_AUTHDATA_SIGNTICKET 512 /**< @deprecated use PAC */
#define KRB5_AUTHDATA_FX_ARMOR 71
#define KRB5_AUTHDATA_AUTH_INDICATOR 97
#define KRB5_AUTHDATA_AP_OPTIONS 143
/** @} */ /* end of KRB5_AUTHDATA group */
/* password change constants */
#define KRB5_KPASSWD_SUCCESS 0 /**< Success */
#define KRB5_KPASSWD_MALFORMED 1 /**< Malformed request */
#define KRB5_KPASSWD_HARDERROR 2 /**< Server error */
#define KRB5_KPASSWD_AUTHERROR 3 /**< Authentication error */
#define KRB5_KPASSWD_SOFTERROR 4 /**< Password change rejected */
/* These are Microsoft's extensions in RFC 3244, and it looks like
they'll become standardized, possibly with other additions. */
#define KRB5_KPASSWD_ACCESSDENIED 5 /**< Not authorized */
#define KRB5_KPASSWD_BAD_VERSION 6 /**< Unknown RPC version */
/** The presented credentials were not obtained using a password directly */
#define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7
/*
* end "proto.h"
*/
/* Time set */
/** Ticket start time, end time, and renewal duration. */
typedef struct _krb5_ticket_times {
krb5_timestamp authtime; /**< Time at which KDC issued the initial ticket that corresponds to this ticket */
/* XXX ? should ktime in KDC_REP == authtime
in ticket? otherwise client can't get this */
krb5_timestamp starttime; /**< optional in ticket, if not present, use @a authtime */
krb5_timestamp endtime; /**< Ticket expiration time */
krb5_timestamp renew_till; /**< Latest time at which renewal of ticket can be valid */
} krb5_ticket_times;
/** Structure for auth data */
typedef struct _krb5_authdata {
krb5_magic magic;
krb5_authdatatype ad_type; /**< ADTYPE */
unsigned int length; /**< Length of data */
krb5_octet *contents; /**< Data */
} krb5_authdata;
/** Structure for transited encoding */
typedef struct _krb5_transited {
krb5_magic magic;
krb5_octet tr_type; /**< Transited encoding type */
krb5_data tr_contents; /**< Contents */
} krb5_transited;
/** Encrypted part of ticket. */
typedef struct _krb5_enc_tkt_part {
krb5_magic magic;
/* to-be-encrypted portion */
krb5_flags flags; /**< flags */
krb5_keyblock *session; /**< session key: includes enctype */
krb5_principal client; /**< client name/realm */
krb5_transited transited; /**< list of transited realms */
krb5_ticket_times times; /**< auth, start, end, renew_till */
krb5_address **caddrs; /**< array of ptrs to addresses */
krb5_authdata **authorization_data; /**< auth data */
} krb5_enc_tkt_part;
/**
* Ticket structure.
*
* The C representation of the ticket message, with a pointer to the
* C representation of the encrypted part.
*/
typedef struct _krb5_ticket {
krb5_magic magic;
/* cleartext portion */
krb5_principal server; /**< server name/realm */
krb5_enc_data enc_part; /**< encryption type, kvno, encrypted encoding */
krb5_enc_tkt_part *enc_part2; /**< ptr to decrypted version, if available */
} krb5_ticket;
/* the unencrypted version */
/**
* Ticket authenticator.
*
* The C representation of an unencrypted authenticator.
*/
typedef struct _krb5_authenticator {
krb5_magic magic;
krb5_principal client; /**< client name/realm */
krb5_checksum *checksum; /**< checksum, includes type, optional */
krb5_int32 cusec; /**< client usec portion */
krb5_timestamp ctime; /**< client sec portion */
krb5_keyblock *subkey; /**< true session key, optional */
krb5_ui_4 seq_number; /**< sequence #, optional */
krb5_authdata **authorization_data; /**< authoriazation data */
} krb5_authenticator;
/** Ticket authentication data. */
typedef struct _krb5_tkt_authent {
krb5_magic magic;
krb5_ticket *ticket;
krb5_authenticator *authenticator;
krb5_flags ap_options;
} krb5_tkt_authent;
/** Credentials structure including ticket, session key, and lifetime info. */
typedef struct _krb5_creds {
krb5_magic magic;
krb5_principal client; /**< client's principal identifier */
krb5_principal server; /**< server's principal identifier */
krb5_keyblock keyblock; /**< session encryption key info */
krb5_ticket_times times; /**< lifetime info */
krb5_boolean is_skey; /**< true if ticket is encrypted in
another ticket's skey */
krb5_flags ticket_flags; /**< flags in ticket */
krb5_address **addresses; /**< addrs in ticket */
krb5_data ticket; /**< ticket string itself */
krb5_data second_ticket; /**< second ticket, if related to
ticket (via DUPLICATE-SKEY or
ENC-TKT-IN-SKEY) */
krb5_authdata **authdata; /**< authorization data */
} krb5_creds;
/** Last request entry */
typedef struct _krb5_last_req_entry {
krb5_magic magic;
krb5_int32 lr_type; /**< LR type */
krb5_timestamp value; /**< Timestamp */
} krb5_last_req_entry;
/** Pre-authentication data */
typedef struct _krb5_pa_data {
krb5_magic magic;
krb5_preauthtype pa_type; /**< Preauthentication data type */
unsigned int length; /**< Length of data */
krb5_octet *contents; /**< Data */
} krb5_pa_data;
/* Don't use this; use krb5_pa_data instead. */
typedef struct _krb5_typed_data {
krb5_magic magic;
krb5_int32 type;
unsigned int length;
krb5_octet *data;
} krb5_typed_data;
/** C representation of KDC-REQ protocol message, including KDC-REQ-BODY */
typedef struct _krb5_kdc_req {
krb5_magic magic;
krb5_msgtype msg_type; /**< KRB5_AS_REQ or KRB5_TGS_REQ */
krb5_pa_data **padata; /**< Preauthentication data */
/* real body */
krb5_flags kdc_options; /**< Requested options */
krb5_principal client; /**< Client principal and realm */
krb5_principal server; /**< Server principal and realm */
krb5_timestamp from; /**< Requested start time */
krb5_timestamp till; /**< Requested end time */
krb5_timestamp rtime; /**< Requested renewable end time */
krb5_int32 nonce; /**< Nonce to match request and response */
int nktypes; /**< Number of enctypes */
krb5_enctype *ktype; /**< Requested enctypes */
krb5_address **addresses; /**< Requested addresses (optional) */
krb5_enc_data authorization_data; /**< Encrypted authz data (optional) */
krb5_authdata **unenc_authdata; /**< Unencrypted authz data */
krb5_ticket **second_ticket; /**< Second ticket array (optional) */
} krb5_kdc_req;
/**
* C representation of @c EncKDCRepPart protocol message.
*
* This is the cleartext message that is encrypted and inserted in @c KDC-REP.
*/
typedef struct _krb5_enc_kdc_rep_part {
krb5_magic magic;
/* encrypted part: */
krb5_msgtype msg_type; /**< krb5 message type */
krb5_keyblock *session; /**< Session key */
krb5_last_req_entry **last_req; /**< Array of pointers to entries */
krb5_int32 nonce; /**< Nonce from request */
krb5_timestamp key_exp; /**< Expiration date */
krb5_flags flags; /**< Ticket flags */
krb5_ticket_times times; /**< Lifetime info */
krb5_principal server; /**< Server's principal identifier */
krb5_address **caddrs; /**< Array of ptrs to addrs, optional */
krb5_pa_data **enc_padata; /**< Encrypted preauthentication data */
} krb5_enc_kdc_rep_part;
/** Representation of the @c KDC-REP protocol message. */
typedef struct _krb5_kdc_rep {
krb5_magic magic;
/* cleartext part: */
krb5_msgtype msg_type; /**< KRB5_AS_REP or KRB5_KDC_REP */
krb5_pa_data **padata; /**< Preauthentication data from KDC */
krb5_principal client; /**< Client principal and realm */
krb5_ticket *ticket; /**< Ticket */
krb5_enc_data enc_part; /**< Encrypted part of reply */
krb5_enc_kdc_rep_part *enc_part2; /**< Unencrypted version, if available */
} krb5_kdc_rep;
/** Error message structure */
typedef struct _krb5_error {
krb5_magic magic;
/* some of these may be meaningless in certain contexts */
krb5_timestamp ctime; /**< Client sec portion; optional */
krb5_int32 cusec; /**< Client usec portion; optional */
krb5_int32 susec; /**< Server usec portion */
krb5_timestamp stime; /**< Server sec portion */
krb5_ui_4 error; /**< Error code (protocol error #'s) */
krb5_principal client; /**< Client principal and realm */
krb5_principal server; /**< Server principal and realm */
krb5_data text; /**< Descriptive text */
krb5_data e_data; /**< Additional error-describing data */
} krb5_error;
/** Authentication header. */
typedef struct _krb5_ap_req {
krb5_magic magic;
krb5_flags ap_options; /**< Requested options */
krb5_ticket *ticket; /**< Ticket */
krb5_enc_data authenticator; /**< Encrypted authenticator */
} krb5_ap_req;
/**
* C representaton of AP-REP message.
*
* The server's response to a client's request for mutual authentication.
*/
typedef struct _krb5_ap_rep {
krb5_magic magic;
krb5_enc_data enc_part; /**< Ciphertext of ApRepEncPart */
} krb5_ap_rep;
/** Cleartext that is encrypted and put into @c _krb5_ap_rep. */
typedef struct _krb5_ap_rep_enc_part {
krb5_magic magic;
krb5_timestamp ctime; /**< Client time, seconds portion */
krb5_int32 cusec; /**< Client time, microseconds portion */
krb5_keyblock *subkey; /**< Subkey (optional) */
krb5_ui_4 seq_number; /**< Sequence number */
} krb5_ap_rep_enc_part;
/* Unused */
typedef struct _krb5_response {
krb5_magic magic;
krb5_octet message_type;
krb5_data response;
krb5_int32 expected_nonce;
krb5_timestamp request_time;
} krb5_response;
/** Credentials information inserted into @c EncKrbCredPart. */
typedef struct _krb5_cred_info {
krb5_magic magic;
krb5_keyblock *session; /**< Session key used to encrypt ticket */
krb5_principal client; /**< Client principal and realm */
krb5_principal server; /**< Server principal and realm */
krb5_flags flags; /**< Ticket flags */
krb5_ticket_times times; /**< Auth, start, end, renew_till */
krb5_address **caddrs; /**< Array of pointers to addrs (optional) */
} krb5_cred_info;
/** Cleartext credentials information. */
typedef struct _krb5_cred_enc_part {
krb5_magic magic;
krb5_int32 nonce; /**< Nonce (optional) */
krb5_timestamp timestamp; /**< Generation time, seconds portion */
krb5_int32 usec; /**< Generation time, microseconds portion */
krb5_address *s_address; /**< Sender address (optional) */
krb5_address *r_address; /**< Recipient address (optional) */
krb5_cred_info **ticket_info;
} krb5_cred_enc_part;
/** Credentials data structure.*/
typedef struct _krb5_cred {
krb5_magic magic;
krb5_ticket **tickets; /**< Tickets */
krb5_enc_data enc_part; /**< Encrypted part */
krb5_cred_enc_part *enc_part2; /**< Unencrypted version, if available */
} krb5_cred;
/* Unused, but here for API compatibility. */
typedef struct _passwd_phrase_element {
krb5_magic magic;
krb5_data *passwd;
krb5_data *phrase;
} passwd_phrase_element;
/* Unused, but here for API compatibility. */
typedef struct _krb5_pwd_data {
krb5_magic magic;
int sequence_count;
passwd_phrase_element **element;
} krb5_pwd_data;
/* Unused, but here for API compatibility. */
typedef struct _krb5_pa_svr_referral_data {
/** Referred name, only realm is required */
krb5_principal principal;
} krb5_pa_svr_referral_data;
/* Unused, but here for API compatibility. */
typedef struct _krb5_pa_server_referral_data {
krb5_data *referred_realm;
krb5_principal true_principal_name;
krb5_principal requested_principal_name;
krb5_timestamp referral_valid_until;
krb5_checksum rep_cksum;
} krb5_pa_server_referral_data;
typedef struct _krb5_pa_pac_req {
/** TRUE if a PAC should be included in TGS-REP */
krb5_boolean include_pac;
} krb5_pa_pac_req;
/*
* begin "safepriv.h"
*/
/** @defgroup KRB5_AUTH_CONTEXT KRB5_AUTH_CONTEXT
* @{
*/
/** Prevent replays with timestamps and replay cache. */
#define KRB5_AUTH_CONTEXT_DO_TIME 0x00000001
/** Save timestamps for application. */
#define KRB5_AUTH_CONTEXT_RET_TIME 0x00000002
/** Prevent replays with sequence numbers. */
#define KRB5_AUTH_CONTEXT_DO_SEQUENCE 0x00000004
/** Save sequence numbers for application. */
#define KRB5_AUTH_CONTEXT_RET_SEQUENCE 0x00000008
#define KRB5_AUTH_CONTEXT_PERMIT_ALL 0x00000010
#define KRB5_AUTH_CONTEXT_USE_SUBKEY 0x00000020
/** @} */ /* end of KRB5_AUTH_CONTEXT group */
/**
* Replay data.
*
* Sequence number and timestamp information output by krb5_rd_priv() and
* krb5_rd_safe().
*/
typedef struct krb5_replay_data {
krb5_timestamp timestamp; /**< Timestamp, seconds portion */
krb5_int32 usec; /**< Timestamp, microseconds portion */
krb5_ui_4 seq; /**< Sequence number */
} krb5_replay_data;
/* Flags for krb5_auth_con_genaddrs(). */
/** Generate the local network address. */
#define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR 0x00000001
/** Generate the remote network address. */
#define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR 0x00000002
/** Generate the local network address and the local port. */
#define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR 0x00000004
/** Generate the remote network address and the remote port. */
#define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR 0x00000008
/** Type of function used as a callback to generate checksum data for mk_req */
typedef krb5_error_code
(KRB5_CALLCONV * krb5_mk_req_checksum_func)(krb5_context, krb5_auth_context,
void *, krb5_data **);
/*
* end "safepriv.h"
*/
/*
* begin "ccache.h"
*/
/** Cursor for sequential lookup */
typedef krb5_pointer krb5_cc_cursor;
struct _krb5_ccache;
typedef struct _krb5_ccache *krb5_ccache;
struct _krb5_cc_ops;
typedef struct _krb5_cc_ops krb5_cc_ops;
struct _krb5_cccol_cursor;
/** Cursor for iterating over all ccaches */
typedef struct _krb5_cccol_cursor *krb5_cccol_cursor;
/* Flags for krb5_cc_retrieve_cred. */
/** The requested lifetime must be at least as great as the time specified. */
#define KRB5_TC_MATCH_TIMES 0x00000001
/** The is_skey field must match exactly. */
#define KRB5_TC_MATCH_IS_SKEY 0x00000002
/** All the flags set in the match credentials must be set. */
#define KRB5_TC_MATCH_FLAGS 0x00000004
/** All the time fields must match exactly. */
#define KRB5_TC_MATCH_TIMES_EXACT 0x00000008
/** All the flags must match exactly. */
#define KRB5_TC_MATCH_FLAGS_EXACT 0x00000010
/** The authorization data must match. */
#define KRB5_TC_MATCH_AUTHDATA 0x00000020
/** Only the name portion of the principal name must match. */
#define KRB5_TC_MATCH_SRV_NAMEONLY 0x00000040
/** The second ticket must match. */
#define KRB5_TC_MATCH_2ND_TKT 0x00000080
/** The encryption key type must match. */
#define KRB5_TC_MATCH_KTYPE 0x00000100
/** The supported key types must match. */
#define KRB5_TC_SUPPORTED_KTYPES 0x00000200
/* Flags for krb5_cc_set_flags and similar. */
/** Open and close the file for each cache operation. */
#define KRB5_TC_OPENCLOSE 0x00000001 /**< @deprecated has no effect */
#define KRB5_TC_NOTICKET 0x00000002
/**
* Retrieve the name, but not type of a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
*
* @warning Returns the name of the credential cache. The result is an alias
* into @a cache and should not be freed or modified by the caller. This name
* does not include the cache type, so should not be used as input to
* krb5_cc_resolve().
*
* @return
* On success - the name of the credential cache.
*/
const char * KRB5_CALLCONV
krb5_cc_get_name(krb5_context context, krb5_ccache cache);
/**
* Retrieve the full name of a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [out] fullname_out Full name of cache
*
* Use krb5_free_string() to free @a fullname_out when it is no longer needed.
*
* @version New in 1.10
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_get_full_name(krb5_context context, krb5_ccache cache,
char **fullname_out);
#if KRB5_DEPRECATED
krb5_error_code KRB5_CALLCONV
krb5_cc_gen_new(krb5_context context, krb5_ccache *cache);
#endif /* KRB5_DEPRECATED */
/**
* Initialize a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] principal Default principal name
*
* Destroy any existing contents of @a cache and initialize it for the default
* principal @a principal.
*
* @retval
* 0 Success
* @return
* System errors; Permission errors; Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_initialize(krb5_context context, krb5_ccache cache,
krb5_principal principal);
/**
* Destroy a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
*
* This function destroys any existing contents of @a cache and closes the
* handle to it.
*
* @retval
* 0 Success
* @return
* Permission errors
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_destroy(krb5_context context, krb5_ccache cache);
/**
* Close a credential cache handle.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
*
* This function closes a credential cache handle @a cache without affecting
* the contents of the cache.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_close(krb5_context context, krb5_ccache cache);
/**
* Store credentials in a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] creds Credentials to be stored in cache
*
* This function stores @a creds into @a cache. If @a creds->server and the
* server in the decoded ticket @a creds->ticket differ, the credentials will
* be stored under both server principal names.
*
* @retval
* 0 Success
* @return Permission errors; storage failure errors; Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_store_cred(krb5_context context, krb5_ccache cache, krb5_creds *creds);
/**
* Retrieve a specified credentials from a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] flags Flags bit mask
* @param [in] mcreds Credentials to match
* @param [out] creds Credentials matching the requested value
*
* This function searches a credential cache for credentials matching @a mcreds
* and returns it if found.
*
* Valid values for @a flags are:
*
* @li #KRB5_TC_MATCH_TIMES The requested lifetime must be at least as
* great as in @a mcreds .
* @li #KRB5_TC_MATCH_IS_SKEY The @a is_skey field much match exactly.
* @li #KRB5_TC_MATCH_FLAGS Flags set in @a mcreds must be set.
* @li #KRB5_TC_MATCH_TIMES_EXACT The requested lifetime must match exactly.
* @li #KRB5_TC_MATCH_FLAGS_EXACT Flags must match exactly.
* @li #KRB5_TC_MATCH_AUTHDATA The authorization data must match.
* @li #KRB5_TC_MATCH_SRV_NAMEONLY Only the name portion of the principal
* name must match, not the realm.
* @li #KRB5_TC_MATCH_2ND_TKT The second tickets must match.
* @li #KRB5_TC_MATCH_KTYPE The encryption key types must match.
* @li #KRB5_TC_SUPPORTED_KTYPES Check all matching entries that have any
* supported encryption type and return the
* one with the encryption type listed earliest.
*
* Use krb5_free_cred_contents() to free @a creds when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_retrieve_cred(krb5_context context, krb5_ccache cache,
krb5_flags flags, krb5_creds *mcreds,
krb5_creds *creds);
/**
* Get the default principal of a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [out] principal Primary principal
*
* Returns the default client principal of a credential cache as set by
* krb5_cc_initialize().
*
* Use krb5_free_principal() to free @a principal when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_get_principal(krb5_context context, krb5_ccache cache,
krb5_principal *principal);
/**
* Prepare to sequentially read every credential in a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [out] cursor Cursor
*
* krb5_cc_end_seq_get() must be called to complete the retrieve operation.
*
* @note If the cache represented by @a cache is modified between the time of
* the call to this function and the time of the final krb5_cc_end_seq_get(),
* these changes may not be reflected in the results of krb5_cc_next_cred()
* calls.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_start_seq_get(krb5_context context, krb5_ccache cache,
krb5_cc_cursor *cursor);
/**
* Retrieve the next entry from the credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] cursor Cursor
* @param [out] creds Next credential cache entry
*
* This function fills in @a creds with the next entry in @a cache and advances
* @a cursor.
*
* Use krb5_free_cred_contents() to free @a creds when it is no longer needed.
*
* @sa krb5_cc_start_seq_get(), krb5_end_seq_get()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_next_cred(krb5_context context, krb5_ccache cache,
krb5_cc_cursor *cursor, krb5_creds *creds);
/**
* Finish a series of sequential processing credential cache entries.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] cursor Cursor
*
* This function finishes processing credential cache entries and invalidates
* @a cursor.
*
* @sa krb5_cc_start_seq_get(), krb5_cc_next_cred()
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_end_seq_get(krb5_context context, krb5_ccache cache,
krb5_cc_cursor *cursor);
/**
* Remove credentials from a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] flags Bitwise-ORed search flags
* @param [in] creds Credentials to be matched
*
* @warning This function is not implemented for some cache types.
*
* This function accepts the same flag values as krb5_cc_retrieve_cred().
*
* @retval KRB5_CC_NOSUPP Not implemented for this cache type
* @return No matches found; Data cannot be deleted; Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags,
krb5_creds *creds);
/**
* Set options flags on a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [in] flags Flag bit mask
*
* This function resets @a cache flags to @a flags.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_set_flags(krb5_context context, krb5_ccache cache, krb5_flags flags);
/**
* Retrieve flags from a credential cache structure.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
* @param [out] flags Flag bit mask
*
* @warning For memory credential cache always returns a flag mask of 0.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_get_flags(krb5_context context, krb5_ccache cache, krb5_flags *flags);
/**
* Retrieve the type of a credential cache.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
*
* @return The type of a credential cache as an alias that must not be modified
* or freed by the caller.
*/
const char * KRB5_CALLCONV
krb5_cc_get_type(krb5_context context, krb5_ccache cache);
/**
* Move a credential cache.
*
* @param [in] context Library context
* @param [in] src The credential cache to move the content from
* @param [in] dst The credential cache to move the content to
*
* This function reinitializes @a dst and populates it with the credentials and
* default principal of @a src; then, if successful, destroys @a src.
*
* @retval
* 0 Success; @a src is closed.
* @return
* Kerberos error codes; @a src is still allocated.
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst);
/**
* Prepare to iterate over the collection of known credential caches.
*
* @param [in] context Library context
* @param [out] cursor Cursor
*
* Get a new cache iteration @a cursor that will iterate over all known
* credential caches independent of type.
*
* Use krb5_cccol_cursor_free() to release @a cursor when it is no longer
* needed.
*
* @sa krb5_cccol_cursor_next()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor);
/**
* Get the next credential cache in the collection.
*
* @param [in] context Library context
* @param [in] cursor Cursor
* @param [out] ccache Credential cache handle
*
* @note When all caches are iterated over and the end of the list is reached,
* @a ccache is set to NULL.
*
* Use krb5_cc_close() to close @a ccache when it is no longer needed.
*
* @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_free()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor,
krb5_ccache *ccache);
/**
* Free a credential cache collection cursor.
*
* @param [in] context Library context
* @param [in] cursor Cursor
*
* @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_next()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor);
/**
* Check if the credential cache collection contains any credentials.
*
* @param [in] context Library context
*
* @version New in 1.11
*
* @retval 0 Credentials are available in the collection
* @retval KRB5_CC_NOTFOUND The collection contains no credentials
*/
krb5_error_code KRB5_CALLCONV
krb5_cccol_have_content(krb5_context context);
/**
* Create a new credential cache of the specified type with a unique name.
*
* @param [in] context Library context
* @param [in] type Credential cache type name
* @param [in] hint Unused
* @param [out] id Credential cache handle
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_new_unique(krb5_context context, const char *type, const char *hint,
krb5_ccache *id);
/*
* end "ccache.h"
*/
/*
* begin "rcache.h"
*/
struct krb5_rc_st;
typedef struct krb5_rc_st *krb5_rcache;
/*
* end "rcache.h"
*/
/*
* begin "keytab.h"
*/
/* XXX */
#define MAX_KEYTAB_NAME_LEN 1100 /**< Long enough for MAXPATHLEN + some extra */
typedef krb5_pointer krb5_kt_cursor;
/** A key table entry. */
typedef struct krb5_keytab_entry_st {
krb5_magic magic;
krb5_principal principal; /**< Principal of this key */
krb5_timestamp timestamp; /**< Time entry written to keytable */
krb5_kvno vno; /**< Key version number */
krb5_keyblock key; /**< The secret key */
} krb5_keytab_entry;
struct _krb5_kt;
typedef struct _krb5_kt *krb5_keytab;
/**
* Return the type of a key table.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
*
* @return The type of a key table as an alias that must not be modified or
* freed by the caller.
*/
const char * KRB5_CALLCONV
krb5_kt_get_type(krb5_context context, krb5_keytab keytab);
/**
* Get a key table name.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
* @param [out] name Key table name
* @param [in] namelen Maximum length to fill in name
*
* Fill @a name with the name of @a keytab including the type and delimiter.
*
* @sa MAX_KEYTAB_NAME_LEN
*
* @retval
* 0 Success
* @retval
* KRB5_KT_NAME_TOOLONG Key table name does not fit in @a namelen bytes
*
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name,
unsigned int namelen);
/**
* Close a key table handle.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
*
* @retval 0
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_close(krb5_context context, krb5_keytab keytab);
/**
* Get an entry from a key table.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
* @param [in] principal Principal name
* @param [in] vno Key version number (0 for highest available)
* @param [in] enctype Encryption type (0 zero for any enctype)
* @param [out] entry Returned entry from key table
*
* Retrieve an entry from a key table which matches the @a keytab, @a
* principal, @a vno, and @a enctype. If @a vno is zero, retrieve the
* highest-numbered kvno matching the other fields. If @a enctype is 0, match
* any enctype.
*
* Use krb5_free_keytab_entry_contents() to free @a entry when it is no longer
* needed.
*
* @note If @a vno is zero, the function retrieves the highest-numbered-kvno
* entry that matches the specified principal.
*
* @retval
* 0 Success
* @retval
* Kerberos error codes on failure
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_get_entry(krb5_context context, krb5_keytab keytab,
krb5_const_principal principal, krb5_kvno vno,
krb5_enctype enctype, krb5_keytab_entry *entry);
/**
* Start a sequential retrieval of key table entries.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
* @param [out] cursor Cursor
*
* Prepare to read sequentially every key in the specified key table. Use
* krb5_kt_end_seq_get() to release the cursor when it is no longer needed.
*
* @sa krb5_kt_next_entry(), krb5_kt_end_seq_get()
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab,
krb5_kt_cursor *cursor);
/**
* Retrieve the next entry from the key table.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
* @param [out] entry Returned key table entry
* @param [in] cursor Key table cursor
*
* Return the next sequential entry in @a keytab and advance @a cursor.
* Callers must release the returned entry with krb5_kt_free_entry().
*
* @sa krb5_kt_start_seq_get(), krb5_kt_end_seq_get()
*
* @retval
* 0 Success
* @retval
* KRB5_KT_END - if the last entry was reached
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_next_entry(krb5_context context, krb5_keytab keytab,
krb5_keytab_entry *entry, krb5_kt_cursor *cursor);
/**
* Release a keytab cursor.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
* @param [out] cursor Cursor
*
* This function should be called to release the cursor created by
* krb5_kt_start_seq_get().
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab,
krb5_kt_cursor *cursor);
/**
* Check if a keytab exists and contains entries.
*
* @param [in] context Library context
* @param [in] keytab Key table handle
*
* @version New in 1.11
*
* @retval 0 Keytab exists and contains entries
* @retval KRB5_KT_NOTFOUND Keytab does not contain entries
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_have_content(krb5_context context, krb5_keytab keytab);
/*
* end "keytab.h"
*/
/*
* begin "func-proto.h"
*/
#define KRB5_INIT_CONTEXT_SECURE 0x1 /**< Use secure context configuration */
#define KRB5_INIT_CONTEXT_KDC 0x2 /**< Use KDC configuration if available */
/**
* Create a krb5 library context.
*
* @param [out] context Library context
*
* The @a context must be released by calling krb5_free_context() when
* it is no longer needed.
*
* @warning Any program or module that needs the Kerberos code to not trust the
* environment must use krb5_init_secure_context(), or clean out the
* environment.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_context(krb5_context *context);
/**
* Create a krb5 library context using only configuration files.
*
* @param [out] context Library context
*
* Create a context structure, using only system configuration files. All
* information passed through the environment variables is ignored.
*
* The @a context must be released by calling krb5_free_context() when
* it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_secure_context(krb5_context *context);
/**
* Create a krb5 library context using a specified profile.
*
* @param [in] profile Profile object (NULL to create default profile)
* @param [in] flags Context initialization flags
* @param [out] context Library context
*
* Create a context structure, optionally using a specified profile and
* initialization flags. If @a profile is NULL, the default profile will be
* created from config files. If @a profile is non-null, a copy of it will be
* made for the new context; the caller should still clean up its copy. Valid
* flag values are:
*
* @li #KRB5_INIT_CONTEXT_SECURE Ignore environment variables
* @li #KRB5_INIT_CONTEXT_KDC Use KDC configuration if creating profile
*/
krb5_error_code KRB5_CALLCONV
krb5_init_context_profile(struct _profile_t *profile, krb5_flags flags,
krb5_context *context);
/**
* Free a krb5 library context.
*
* @param [in] context Library context
*
* This function frees a @a context that was created by krb5_init_context()
* or krb5_init_secure_context().
*/
void KRB5_CALLCONV
krb5_free_context(krb5_context context);
/**
* Copy a krb5_context structure.
*
* @param [in] ctx Library context
* @param [out] nctx_out New context structure
*
* The newly created context must be released by calling krb5_free_context()
* when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_context(krb5_context ctx, krb5_context *nctx_out);
/**
* Set default TGS encryption types in a krb5_context structure.
*
* @param [in] context Library context
* @param [in] etypes Encryption type(s) to set
*
* This function sets the default enctype list for TGS requests
* made using @a context to @a etypes.
*
* @note This overrides the default list (from config file or built-in).
*
* @retval
* 0 Success
* @retval
* KRB5_PROG_ETYPE_NOSUPP Program lacks support for encryption type
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_set_default_tgs_enctypes(krb5_context context, const krb5_enctype *etypes);
/**
* Return a list of encryption types permitted for session keys.
*
* @param [in] context Library context
* @param [out] ktypes Zero-terminated list of encryption types
*
* This function returns the list of encryption types permitted for session
* keys within @a context, as determined by configuration or by a previous call
* to krb5_set_default_tgs_enctypes().
*
* Use krb5_free_enctypes() to free @a ktypes when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_permitted_enctypes(krb5_context context, krb5_enctype **ktypes);
/**
* Test whether the Kerberos library was built with multithread support.
*
* @retval
* TRUE if the library is threadsafe; FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_is_thread_safe(void);
/* libkrb.spec */
/**
* Decrypt a ticket using the specified key table.
*
* @param [in] context Library context
* @param [in] kt Key table
* @param [in] ticket Ticket to be decrypted
*
* This function takes a @a ticket as input and decrypts it using
* key data from @a kt. The result is placed into @a ticket->enc_part2.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_server_decrypt_ticket_keytab(krb5_context context, const krb5_keytab kt,
krb5_ticket *ticket);
/**
* Free an array of credential structures.
*
* @param [in] context Library context
* @param [in] tgts Null-terminated array of credentials to free
*
* @note The last entry in the array @a tgts must be a NULL pointer.
*/
void KRB5_CALLCONV
krb5_free_tgt_creds(krb5_context context, krb5_creds **tgts);
/** @defgroup KRB5_GC KRB5_GC
* @{
*/
#define KRB5_GC_USER_USER 1 /**< Want user-user ticket */
#define KRB5_GC_CACHED 2 /**< Want cached ticket only */
#define KRB5_GC_CANONICALIZE 4 /**< Set canonicalize KDC option */
#define KRB5_GC_NO_STORE 8 /**< Do not store in credential cache */
#define KRB5_GC_FORWARDABLE 16 /**< Acquire forwardable tickets */
#define KRB5_GC_NO_TRANSIT_CHECK 32 /**< Disable transited check */
#define KRB5_GC_CONSTRAINED_DELEGATION 64 /**< Constrained delegation */
/** @} */ /* end of KRB5_GC group */
/**
* Get an additional ticket.
*
* @param [in] context Library context
* @param [in] options Options
* @param [in] ccache Credential cache handle
* @param [in] in_creds Input credentials
* @param [out] out_creds Output updated credentials
*
* Use @a ccache or a TGS exchange to get a service ticket matching @a
* in_creds.
*
* Valid values for @a options are:
* @li #KRB5_GC_CACHED Search only credential cache for the ticket
* @li #KRB5_GC_USER_USER Return a user to user authentication ticket
*
* @a in_creds must be non-null. @a in_creds->client and @a in_creds->server
* must be filled in to specify the client and the server respectively. If any
* authorization data needs to be requested for the service ticket (such as
* restrictions on how the ticket can be used), specify it in @a
* in_creds->authdata; otherwise set @a in_creds->authdata to NULL. The
* session key type is specified in @a in_creds->keyblock.enctype, if it is
* nonzero.
*
* The expiration date is specified in @a in_creds->times.endtime.
* The KDC may return tickets with an earlier expiration date.
* If @a in_creds->times.endtime is set to 0, the latest possible
* expiration date will be requested.
*
* Any returned ticket and intermediate ticket-granting tickets are stored
* in @a ccache.
*
* Use krb5_free_creds() to free @a out_creds when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_credentials(krb5_context context, krb5_flags options,
krb5_ccache ccache, krb5_creds *in_creds,
krb5_creds **out_creds);
/**
* Serialize a @c krb5_creds object.
*
* @param [in] context Library context
* @param [in] creds The credentials object to serialize
* @param [out] data_out The serialized credentials
*
* Serialize @a creds in the format used by the FILE ccache format (vesion 4)
* and KCM ccache protocol.
*
* Use krb5_free_data() to free @a data_out when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_marshal_credentials(krb5_context context, krb5_creds *in_creds,
krb5_data **data_out);
/**
* Deserialize a @c krb5_creds object.
*
* @param [in] context Library context
* @param [in] data The serialized credentials
* @param [out] creds_out The resulting creds object
*
* Deserialize @a data to credentials in the format used by the FILE ccache
* format (vesion 4) and KCM ccache protocol.
*
* Use krb5_free_creds() to free @a creds_out when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_unmarshal_credentials(krb5_context context, const krb5_data *data,
krb5_creds **creds_out);
/** @deprecated Replaced by krb5_get_validated_creds. */
krb5_error_code KRB5_CALLCONV
krb5_get_credentials_validate(krb5_context context, krb5_flags options,
krb5_ccache ccache, krb5_creds *in_creds,
krb5_creds **out_creds);
/** @deprecated Replaced by krb5_get_renewed_creds. */
krb5_error_code KRB5_CALLCONV
krb5_get_credentials_renew(krb5_context context, krb5_flags options,
krb5_ccache ccache, krb5_creds *in_creds,
krb5_creds **out_creds);
/**
* Create a @c KRB_AP_REQ message.
*
* @param [in] context Library context
* @param [in,out] auth_context Pre-existing or newly created auth context
* @param [in] ap_req_options @ref AP_OPTS options
* @param [in] service Service name, or NULL to use @c "host"
* @param [in] hostname Host name, or NULL to use local hostname
* @param [in] in_data Application data to be checksummed in the
* authenticator, or NULL
* @param [in] ccache Credential cache used to obtain credentials
* for the desired service.
* @param [out] outbuf @c AP-REQ message
*
* This function is similar to krb5_mk_req_extended() except that it uses a
* given @a hostname, @a service, and @a ccache to construct a service
* principal name and obtain credentials.
*
* Use krb5_free_data_contents() to free @a outbuf when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_req(krb5_context context, krb5_auth_context *auth_context,
krb5_flags ap_req_options, const char *service,
const char *hostname, krb5_data *in_data, krb5_ccache ccache,
krb5_data *outbuf);
/**
* Create a @c KRB_AP_REQ message using supplied credentials.
*
* @param [in] context Library context
* @param [in,out] auth_context Pre-existing or newly created auth context
* @param [in] ap_req_options @ref AP_OPTS options
* @param [in] in_data Application data to be checksummed in the
* authenticator, or NULL
* @param [in] in_creds Credentials for the service with valid ticket
* and key
* @param [out] outbuf @c AP-REQ message
*
* Valid @a ap_req_options are:
* @li #AP_OPTS_USE_SESSION_KEY - Use the session key when creating the
* request used for user to user
* authentication.
* @li #AP_OPTS_MUTUAL_REQUIRED - Request a mutual authentication packet from
* the receiver.
* @li #AP_OPTS_USE_SUBKEY - Generate a subsession key from the current
* session key obtained from the credentials.
*
* This function creates a KRB_AP_REQ message using supplied credentials @a
* in_creds. @a auth_context may point to an existing auth context or to NULL,
* in which case a new one will be created. If @a in_data is non-null, a
* checksum of it will be included in the authenticator contained in the
* KRB_AP_REQ message. Use krb5_free_data_contents() to free @a outbuf when it
* is no longer needed.
*
* On successful return, the authenticator is stored in @a auth_context with
* the @a client and @a checksum fields nulled out. (This is to prevent
* pointer-sharing problems; the caller should not need these fields anyway,
* since the caller supplied them.)
*
* @sa krb5_mk_req()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_req_extended(krb5_context context, krb5_auth_context *auth_context,
krb5_flags ap_req_options, krb5_data *in_data,
krb5_creds *in_creds, krb5_data *outbuf);
/**
* Format and encrypt a @c KRB_AP_REP message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] outbuf @c AP-REP message
*
* This function fills in @a outbuf with an AP-REP message using information
* from @a auth_context.
*
* If the flags in @a auth_context indicate that a sequence number should be
* used (either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or
* #KRB5_AUTH_CONTEXT_RET_SEQUENCE) and the local sequence number in @a
* auth_context is 0, a new number will be generated with
* krb5_generate_seq_number().
*
* Use krb5_free_data_contents() to free @a outbuf when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_rep(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf);
/**
* Format and encrypt a @c KRB_AP_REP message for DCE RPC.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] outbuf @c AP-REP message
*
* Use krb5_free_data_contents() to free @a outbuf when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_rep_dce(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf);
/**
* Parse and decrypt a @c KRB_AP_REP message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] inbuf AP-REP message
* @param [out] repl Decrypted reply message
*
* This function parses, decrypts and verifies a message from @a inbuf and
* fills in @a repl with a pointer to allocated memory containing the fields
* from the encrypted response.
*
* Use krb5_free_ap_rep_enc_part() to free @a repl when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_rep(krb5_context context, krb5_auth_context auth_context,
const krb5_data *inbuf, krb5_ap_rep_enc_part **repl);
/**
* Parse and decrypt a @c KRB_AP_REP message for DCE RPC.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] inbuf AP-REP message
* @param [out] nonce Sequence number from the decrypted reply
*
* This function parses, decrypts and verifies a message from @a inbuf and
* fills in @a nonce with a decrypted reply sequence number.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_rep_dce(krb5_context context, krb5_auth_context auth_context,
const krb5_data *inbuf, krb5_ui_4 *nonce);
/**
* Format and encode a @c KRB_ERROR message.
*
* @param [in] context Library context
* @param [in] dec_err Error structure to be encoded
* @param [out] enc_err Encoded error structure
*
* This function creates a @c KRB_ERROR message in @a enc_err. Use
* krb5_free_data_contents() to free @a enc_err when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_error(krb5_context context, const krb5_error *dec_err,
krb5_data *enc_err);
/**
* Decode a @c KRB-ERROR message.
*
* @param [in] context Library context
* @param [in] enc_errbuf Encoded error message
* @param [out] dec_error Decoded error message
*
* This function processes @c KRB-ERROR message @a enc_errbuf and returns
* an allocated structure @a dec_error containing the error message.
* Use krb5_free_error() to free @a dec_error when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_error(krb5_context context, const krb5_data *enc_errbuf,
krb5_error **dec_error);
/**
* Process @c KRB-SAFE message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] inbuf @c KRB-SAFE message to be parsed
* @param [out] userdata_out Data parsed from @c KRB-SAFE message
* @param [out] rdata_out Replay data. Specify NULL if not needed
*
* This function parses a @c KRB-SAFE message, verifies its integrity, and
* stores its data into @a userdata_out.
*
* @note The @a rdata_out argument is required if the
* #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set
* in @a auth_context.
*
* If @a auth_context has a remote address set, the address will be used to
* verify the sender address in the KRB-SAFE message. If @a auth_context has a
* local address set, it will be used to verify the receiver address in the
* KRB-SAFE message if the message contains one.
*
* If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the
* sequence number of the KRB-SAFE message is checked against the remote
* sequence number field of @a auth_context. Otherwise, the sequence number is
* not used.
*
* If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, then the
* timestamp in the message is verified to be within the permitted clock skew
* of the current time, and the message is checked against an in-memory replay
* cache to detect reflections or replays.
*
* Use krb5_free_data_contents() to free @a userdata_out when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_safe(krb5_context context, krb5_auth_context auth_context,
const krb5_data *inbuf, krb5_data *userdata_out,
krb5_replay_data *rdata_out);
/**
* Process a @c KRB-PRIV message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication structure
* @param [in] inbuf @c KRB-PRIV message to be parsed
* @param [out] userdata_out Data parsed from @c KRB-PRIV message
* @param [out] rdata_out Replay data. Specify NULL if not needed
*
* This function parses a @c KRB-PRIV message, verifies its integrity, and
* stores its unencrypted data into @a userdata_out.
*
* @note The @a rdata_out argument is required if the
* #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set
* in @a auth_context.
*
* If @a auth_context has a remote address set, the address will be used to
* verify the sender address in the KRB-PRIV message. If @a auth_context has a
* local address set, it will be used to verify the receiver address in the
* KRB-PRIV message if the message contains one.
*
* If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the
* sequence number of the KRB-PRIV message is checked against the remote
* sequence number field of @a auth_context. Otherwise, the sequence number is
* not used.
*
* If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, then the
* timestamp in the message is verified to be within the permitted clock skew
* of the current time, and the message is checked against an in-memory replay
* cache to detect reflections or replays.
*
* Use krb5_free_data_contents() to free @a userdata_out when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_priv(krb5_context context, krb5_auth_context auth_context,
const krb5_data *inbuf, krb5_data *userdata_out,
krb5_replay_data *rdata_out);
/**
* Convert a string principal name to a krb5_principal structure.
*
* @param [in] context Library context
* @param [in] name String representation of a principal name
* @param [out] principal_out New principal
*
* Convert a string representation of a principal name to a krb5_principal
* structure.
*
* A string representation of a Kerberos name consists of one or more principal
* name components, separated by slashes, optionally followed by the \@
* character and a realm name. If the realm name is not specified, the local
* realm is used.
*
* To use the slash and \@ symbols as part of a component (quoted) instead of
* using them as a component separator or as a realm prefix), put a backslash
* (\) character in front of the symbol. Similarly, newline, tab, backspace,
* and NULL characters can be included in a component by using @c n, @c t, @c b
* or @c 0, respectively.
*
* @note The realm in a Kerberos @a name cannot contain slash, colon,
* or NULL characters.
*
* Use krb5_free_principal() to free @a principal_out when it is no longer
* needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_parse_name(krb5_context context, const char *name,
krb5_principal *principal_out);
#define KRB5_PRINCIPAL_PARSE_NO_REALM 0x1 /**< Error if realm is present */
#define KRB5_PRINCIPAL_PARSE_REQUIRE_REALM 0x2 /**< Error if realm is not present */
#define KRB5_PRINCIPAL_PARSE_ENTERPRISE 0x4 /**< Create single-component
enterprise principle */
#define KRB5_PRINCIPAL_PARSE_IGNORE_REALM 0x8 /**< Ignore realm if present */
/**
* Convert a string principal name to a krb5_principal with flags.
*
* @param [in] context Library context
* @param [in] name String representation of a principal name
* @param [in] flags Flag
* @param [out] principal_out New principal
*
* Similar to krb5_parse_name(), this function converts a single-string
* representation of a principal name to a krb5_principal structure.
*
* The following flags are valid:
* @li #KRB5_PRINCIPAL_PARSE_NO_REALM - no realm must be present in @a name
* @li #KRB5_PRINCIPAL_PARSE_REQUIRE_REALM - realm must be present in @a name
* @li #KRB5_PRINCIPAL_PARSE_ENTERPRISE - create single-component enterprise
* principal
* @li #KRB5_PRINCIPAL_PARSE_IGNORE_REALM - ignore realm if present in @a name
*
* If @c KRB5_PRINCIPAL_PARSE_NO_REALM or @c KRB5_PRINCIPAL_PARSE_IGNORE_REALM
* is specified in @a flags, the realm of the new principal will be empty.
* Otherwise, the default realm for @a context will be used if @a name does not
* specify a realm.
*
* Use krb5_free_principal() to free @a principal_out when it is no longer
* needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_parse_name_flags(krb5_context context, const char *name,
int flags, krb5_principal *principal_out);
/**
* Convert a krb5_principal structure to a string representation.
*
* @param [in] context Library context
* @param [in] principal Principal
* @param [out] name String representation of principal name
*
* The resulting string representation uses the format and quoting conventions
* described for krb5_parse_name().
*
* Use krb5_free_unparsed_name() to free @a name when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_unparse_name(krb5_context context, krb5_const_principal principal,
char **name);
/**
* Convert krb5_principal structure to string and length.
*
* @param [in] context Library context
* @param [in] principal Principal
* @param [in,out] name String representation of principal name
* @param [in,out] size Size of unparsed name
*
* This function is similar to krb5_unparse_name(), but allows the use of an
* existing buffer for the result. If size is not NULL, then @a name must
* point to either NULL or an existing buffer of at least the size pointed to
* by @a size. The buffer will be allocated or resized if necessary, with the
* new pointer stored into @a name. Whether or not the buffer is resized, the
* necessary space for the result, including null terminator, will be stored
* into @a size.
*
* If size is NULL, this function behaves exactly as krb5_unparse_name().
*
* @retval
* 0 Success
* @return
* Kerberos error codes. On failure @a name is set to NULL
*/
krb5_error_code KRB5_CALLCONV
krb5_unparse_name_ext(krb5_context context, krb5_const_principal principal,
char **name, unsigned int *size);
#define KRB5_PRINCIPAL_UNPARSE_SHORT 0x1 /**< Omit realm if it is the local realm */
#define KRB5_PRINCIPAL_UNPARSE_NO_REALM 0x2 /**< Omit realm always */
#define KRB5_PRINCIPAL_UNPARSE_DISPLAY 0x4 /**< Don't escape special characters */
/**
* Convert krb5_principal structure to a string with flags.
*
* @param [in] context Library context
* @param [in] principal Principal
* @param [in] flags Flags
* @param [out] name String representation of principal name
*
* Similar to krb5_unparse_name(), this function converts a krb5_principal
* structure to a string representation.
*
* The following flags are valid:
* @li #KRB5_PRINCIPAL_UNPARSE_SHORT - omit realm if it is the local realm
* @li #KRB5_PRINCIPAL_UNPARSE_NO_REALM - omit realm
* @li #KRB5_PRINCIPAL_UNPARSE_DISPLAY - do not quote special characters
*
* Use krb5_free_unparsed_name() to free @a name when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes. On failure @a name is set to NULL
*/
krb5_error_code KRB5_CALLCONV
krb5_unparse_name_flags(krb5_context context, krb5_const_principal principal,
int flags, char **name);
/**
* Convert krb5_principal structure to string format with flags.
*
* @param [in] context Library context
* @param [in] principal Principal
* @param [in] flags Flags
* @param [out] name Single string format of principal name
* @param [out] size Size of unparsed name buffer
*
* @sa krb5_unparse_name() krb5_unparse_name_flags() krb5_unparse_name_ext()
*
* @retval
* 0 Success
* @return
* Kerberos error codes. On failure @a name is set to NULL
*/
krb5_error_code KRB5_CALLCONV
krb5_unparse_name_flags_ext(krb5_context context, krb5_const_principal principal,
int flags, char **name, unsigned int *size);
/**
* Set the realm field of a principal
*
* @param [in] context Library context
* @param [in] principal Principal name
* @param [in] realm Realm name
*
* Set the realm name part of @a principal to @a realm, overwriting the
* previous realm.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_set_principal_realm(krb5_context context, krb5_principal principal,
const char *realm);
/**
* Search a list of addresses for a specified address.
*
* @param [in] context Library context
* @param [in] addr Address to search for
* @param [in] addrlist Address list to be searched (or NULL)
*
* @note If @a addrlist contains only a NetBIOS addresses, it will be treated
* as a null list.
*
* @return
* TRUE if @a addr is listed in @a addrlist, or @c addrlist is NULL; FALSE
* otherwise
*/
krb5_boolean KRB5_CALLCONV_WRONG
krb5_address_search(krb5_context context, const krb5_address *addr,
krb5_address *const *addrlist);
/**
* Compare two Kerberos addresses.
*
* @param [in] context Library context
* @param [in] addr1 First address to be compared
* @param [in] addr2 Second address to be compared
*
* @return
* TRUE if the addresses are the same, FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_address_compare(krb5_context context, const krb5_address *addr1,
const krb5_address *addr2);
/**
* Return an ordering of the specified addresses.
*
* @param [in] context Library context
* @param [in] addr1 First address
* @param [in] addr2 Second address
*
* @retval
* 0 The two addresses are the same
* @retval
* \< 0 First address is less than second
* @retval
* \> 0 First address is greater than second
*/
int KRB5_CALLCONV
krb5_address_order(krb5_context context, const krb5_address *addr1,
const krb5_address *addr2);
/**
* Compare the realms of two principals.
*
* @param [in] context Library context
* @param [in] princ1 First principal
* @param [in] princ2 Second principal
*
* @retval
* TRUE if the realm names are the same; FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_realm_compare(krb5_context context, krb5_const_principal princ1,
krb5_const_principal princ2);
/**
* Compare two principals.
*
* @param [in] context Library context
* @param [in] princ1 First principal
* @param [in] princ2 Second principal
*
* @retval
* TRUE if the principals are the same; FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_principal_compare(krb5_context context,
krb5_const_principal princ1,
krb5_const_principal princ2);
/**
* Compare two principals ignoring realm components.
*
* @param [in] context Library context
* @param [in] princ1 First principal
* @param [in] princ2 Second principal
*
* Similar to krb5_principal_compare(), but do not compare the realm
* components of the principals.
*
* @retval
* TRUE if the principals are the same; FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_principal_compare_any_realm(krb5_context context,
krb5_const_principal princ1,
krb5_const_principal princ2);
#define KRB5_PRINCIPAL_COMPARE_IGNORE_REALM 1 /**< ignore realm component */
#define KRB5_PRINCIPAL_COMPARE_ENTERPRISE 2 /**< UPNs as real principals */
#define KRB5_PRINCIPAL_COMPARE_CASEFOLD 4 /**< case-insensitive */
#define KRB5_PRINCIPAL_COMPARE_UTF8 8 /**< treat principals as UTF-8 */
/**
* Compare two principals with additional flags.
*
* @param [in] context Library context
* @param [in] princ1 First principal
* @param [in] princ2 Second principal
* @param [in] flags Flags
*
* Valid flags are:
* @li #KRB5_PRINCIPAL_COMPARE_IGNORE_REALM - ignore realm component
* @li #KRB5_PRINCIPAL_COMPARE_ENTERPRISE - UPNs as real principals
* @li #KRB5_PRINCIPAL_COMPARE_CASEFOLD case-insensitive
* @li #KRB5_PRINCIPAL_COMPARE_UTF8 - treat principals as UTF-8
*
* @sa krb5_principal_compare()
*
* @retval
* TRUE if the principal names are the same; FALSE otherwise
*/
krb5_boolean KRB5_CALLCONV
krb5_principal_compare_flags(krb5_context context,
krb5_const_principal princ1,
krb5_const_principal princ2,
int flags);
/**
* Initialize an empty @c krb5_keyblock.
*
* @param [in] context Library context
* @param [in] enctype Encryption type
* @param [in] length Length of keyblock (or 0)
* @param [out] out New keyblock structure
*
* Initialize a new keyblock and allocate storage for the contents of the key.
* It is legal to pass in a length of 0, in which case contents are left
* unallocated. Use krb5_free_keyblock() to free @a out when it is no longer
* needed.
*
* @note If @a length is set to 0, contents are left unallocated.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_keyblock(krb5_context context, krb5_enctype enctype,
size_t length, krb5_keyblock **out);
/**
* Copy a keyblock.
*
* @param [in] context Library context
* @param [in] from Keyblock to be copied
* @param [out] to Copy of keyblock @a from
*
* This function creates a new keyblock with the same contents as @a from. Use
* krb5_free_keyblock() to free @a to when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_keyblock(krb5_context context, const krb5_keyblock *from,
krb5_keyblock **to);
/**
* Copy the contents of a keyblock.
*
* @param [in] context Library context
* @param [in] from Key to be copied
* @param [out] to Output key
*
* This function copies the contents of @a from to @a to. Use
* krb5_free_keyblock_contents() to free @a to when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_keyblock_contents(krb5_context context, const krb5_keyblock *from,
krb5_keyblock *to);
/**
* Copy a krb5_creds structure.
*
* @param [in] context Library context
* @param [in] incred Credentials structure to be copied
* @param [out] outcred Copy of @a incred
*
* This function creates a new credential with the contents of @a incred. Use
* krb5_free_creds() to free @a outcred when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_creds(krb5_context context, const krb5_creds *incred, krb5_creds **outcred);
/**
* Copy a krb5_data object.
*
* @param [in] context Library context
* @param [in] indata Data object to be copied
* @param [out] outdata Copy of @a indata
*
* This function creates a new krb5_data object with the contents of @a indata.
* Use krb5_free_data() to free @a outdata when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdata);
/**
* Copy a principal.
*
* @param [in] context Library context
* @param [in] inprinc Principal to be copied
* @param [out] outprinc Copy of @a inprinc
*
* This function creates a new principal structure with the contents of @a
* inprinc. Use krb5_free_principal() to free @a outprinc when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_principal(krb5_context context, krb5_const_principal inprinc,
krb5_principal *outprinc);
/**
* Copy an array of addresses.
*
* @param [in] context Library context
* @param [in] inaddr Array of addresses to be copied
* @param [out] outaddr Copy of array of addresses
*
* This function creates a new address array containing a copy of @a inaddr.
* Use krb5_free_addresses() to free @a outaddr when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_addresses(krb5_context context, krb5_address *const *inaddr,
krb5_address ***outaddr);
/**
* Copy a krb5_ticket structure.
*
* @param [in] context Library context
* @param [in] from Ticket to be copied
* @param [out] pto Copy of ticket
*
* This function creates a new krb5_ticket structure containing the contents of
* @a from. Use krb5_free_ticket() to free @a pto when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_ticket(krb5_context context, const krb5_ticket *from, krb5_ticket **pto);
/**
* Copy an authorization data list.
*
* @param [in] context Library context
* @param [in] in_authdat List of @a krb5_authdata structures
* @param [out] out New array of @a krb5_authdata structures
*
* This function creates a new authorization data list containing a copy of @a
* in_authdat, which must be null-terminated. Use krb5_free_authdata() to free
* @a out when it is no longer needed.
*
* @note The last array entry in @a in_authdat must be a NULL pointer.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_authdata(krb5_context context,
krb5_authdata *const *in_authdat, krb5_authdata ***out);
/**
* Find authorization data elements.
*
* @param [in] context Library context
* @param [in] ticket_authdata Authorization data list from ticket
* @param [in] ap_req_authdata Authorization data list from AP request
* @param [in] ad_type Authorization data type to find
* @param [out] results List of matching entries
*
* This function searches @a ticket_authdata and @a ap_req_authdata for
* elements of type @a ad_type. Either input list may be NULL, in which case
* it will not be searched; otherwise, the input lists must be terminated by
* NULL entries. This function will search inside AD-IF-RELEVANT containers if
* found in either list. Use krb5_free_authdata() to free @a results when it
* is no longer needed.
*
* @version New in 1.10
*/
krb5_error_code KRB5_CALLCONV
krb5_find_authdata(krb5_context context, krb5_authdata *const *ticket_authdata,
krb5_authdata *const *ap_req_authdata,
krb5_authdatatype ad_type, krb5_authdata ***results);
/**
* Merge two authorization data lists into a new list.
*
* @param [in] context Library context
* @param [in] inauthdat1 First list of @a krb5_authdata structures
* @param [in] inauthdat2 Second list of @a krb5_authdata structures
* @param [out] outauthdat Merged list of @a krb5_authdata structures
*
* Merge two authdata arrays, such as the array from a ticket
* and authenticator.
* Use krb5_free_authdata() to free @a outauthdat when it is no longer needed.
*
* @note The last array entry in @a inauthdat1 and @a inauthdat2
* must be a NULL pointer.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_merge_authdata(krb5_context context,
krb5_authdata *const *inauthdat1,
krb5_authdata * const *inauthdat2,
krb5_authdata ***outauthdat);
/**
* Copy a krb5_authenticator structure.
*
* @param [in] context Library context
* @param [in] authfrom krb5_authenticator structure to be copied
* @param [out] authto Copy of krb5_authenticator structure
*
* This function creates a new krb5_authenticator structure with the content of
* @a authfrom. Use krb5_free_authenticator() to free @a authto when it is no
* longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_authenticator(krb5_context context, const krb5_authenticator *authfrom,
krb5_authenticator **authto);
/**
* Copy a krb5_checksum structure.
*
* @param [in] context Library context
* @param [in] ckfrom Checksum to be copied
* @param [out] ckto Copy of krb5_checksum structure
*
* This function creates a new krb5_checksum structure with the contents of @a
* ckfrom. Use krb5_free_checksum() to free @a ckto when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_copy_checksum(krb5_context context, const krb5_checksum *ckfrom,
krb5_checksum **ckto);
/**
* Generate a replay cache object for server use and open it.
*
* @param [in] context Library context
* @param [in] piece Unused (replay cache identifier)
* @param [out] rcptr Handle to an open rcache
*
* This function creates a handle to the default replay cache. Use
* krb5_rc_close() to close @a rcptr when it is no longer needed.
*
* @version Prior to release 1.18, this function creates a handle to a
* different replay cache for each unique value of @a piece.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_server_rcache(krb5_context context, const krb5_data *piece,
krb5_rcache *rcptr);
/**
* Build a principal name using length-counted strings.
*
* @param [in] context Library context
* @param [out] princ Principal name
* @param [in] rlen Realm name length
* @param [in] realm Realm name
* @param [in] ... List of unsigned int/char * components, followed by 0
*
* This function creates a principal from a length-counted string and a
* variable-length list of length-counted components. The list of components
* ends with the first 0 length argument (so it is not possible to specify an
* empty component with this function). Call krb5_free_principal() to free
* allocated memory for principal when it is no longer needed.
*
* @code
* Example of how to build principal WELLKNOWN/ANONYMOUS@R
* krb5_build_principal_ext(context, &principal, strlen("R"), "R",
* (unsigned int)strlen(KRB5_WELLKNOWN_NAMESTR),
* KRB5_WELLKNOWN_NAMESTR,
* (unsigned int)strlen(KRB5_ANONYMOUS_PRINCSTR),
* KRB5_ANONYMOUS_PRINCSTR, 0);
* @endcode
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV_C
krb5_build_principal_ext(krb5_context context, krb5_principal * princ,
unsigned int rlen, const char * realm, ...);
/**
* Build a principal name using null-terminated strings.
*
* @param [in] context Library context
* @param [out] princ Principal name
* @param [in] rlen Realm name length
* @param [in] realm Realm name
* @param [in] ... List of char * components, ending with NULL
*
* Call krb5_free_principal() to free @a princ when it is no longer needed.
*
* @note krb5_build_principal() and krb5_build_principal_alloc_va() perform the
* same task. krb5_build_principal() takes variadic arguments.
* krb5_build_principal_alloc_va() takes a pre-computed @a varargs pointer.
*
* @code
* Example of how to build principal H/S@R
* krb5_build_principal(context, &principal,
* strlen("R"), "R", "H", "S", (char*)NULL);
* @endcode
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV_C
krb5_build_principal(krb5_context context,
krb5_principal * princ,
unsigned int rlen,
const char * realm, ...)
#if __GNUC__ >= 4
__attribute__ ((sentinel))
#endif
;
#if KRB5_DEPRECATED
/** @deprecated Replaced by krb5_build_principal_alloc_va(). */
KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV
krb5_build_principal_va(krb5_context context,
krb5_principal princ,
unsigned int rlen,
const char *realm,
va_list ap);
#endif
/**
* Build a principal name, using a precomputed variable argument list
*
* @param [in] context Library context
* @param [out] princ Principal structure
* @param [in] rlen Realm name length
* @param [in] realm Realm name
* @param [in] ap List of char * components, ending with NULL
*
* Similar to krb5_build_principal(), this function builds a principal name,
* but its name components are specified as a va_list.
*
* Use krb5_free_principal() to deallocate @a princ when it is no longer
* needed.
*
* @code
* Function usage example:
* va_list ap;
* va_start(ap, realm);
* krb5_build_principal_alloc_va(context, princ, rlen, realm, ap);
* va_end(ap);
* @endcode
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_build_principal_alloc_va(krb5_context context,
krb5_principal *princ,
unsigned int rlen,
const char *realm,
va_list ap);
/**
* Convert a Kerberos V4 principal to a Kerberos V5 principal.
*
* @param [in] context Library context
* @param [in] name V4 name
* @param [in] instance V4 instance
* @param [in] realm Realm
* @param [out] princ V5 principal
*
* This function builds a @a princ from V4 specification based on given input
* @a name.instance\@realm.
*
* Use krb5_free_principal() to free @a princ when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_425_conv_principal(krb5_context context, const char *name,
const char *instance, const char *realm,
krb5_principal *princ);
/**
* Convert a Kerberos V5 principal to a Kerberos V4 principal.
*
* @param [in] context Library context
* @param [in] princ V5 Principal
* @param [out] name V4 principal's name to be filled in
* @param [out] inst V4 principal's instance name to be filled in
* @param [out] realm Principal's realm name to be filled in
*
* This function separates a V5 principal @a princ into @a name, @a instance,
* and @a realm.
*
* @retval
* 0 Success
* @retval
* KRB5_INVALID_PRINCIPAL Invalid principal name
* @retval
* KRB5_CONFIG_CANTOPEN Can't open or find Kerberos configuration file
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_524_conv_principal(krb5_context context, krb5_const_principal princ,
char *name, char *inst, char *realm);
/**
*@deprecated
*/
struct credentials;
/**
* Convert a Kerberos V5 credentials to a Kerberos V4 credentials
*
* @note Not implemented
*
* @retval KRB524_KRB4_DISABLED (always)
*/
int KRB5_CALLCONV
krb5_524_convert_creds(krb5_context context, krb5_creds *v5creds,
struct credentials *v4creds);
#if KRB5_DEPRECATED
#define krb524_convert_creds_kdc krb5_524_convert_creds
#define krb524_init_ets(x) (0)
#endif
/* libkt.spec */
/**
* Get a handle for a key table.
*
* @param [in] context Library context
* @param [in] name Name of the key table
* @param [out] ktid Key table handle
*
* Resolve the key table name @a name and set @a ktid to a handle identifying
* the key table. Use krb5_kt_close() to free @a ktid when it is no longer
* needed.
*
* @a name must be of the form @c type:residual, where @a type must be a type
* known to the library and @a residual portion should be specific to the
* particular keytab type. If no @a type is given, the default is @c FILE.
*
* If @a name is of type @c FILE, the keytab file is not opened by this call.
*
* @code
* Example: krb5_kt_resolve(context, "FILE:/tmp/filename", &ktid);
* @endcode
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_resolve(krb5_context context, const char *name, krb5_keytab *ktid);
/**
* Duplicate keytab handle.
*
* @param [in] context Library context
* @param [in] in Key table handle to be duplicated
* @param [out] out Key table handle
*
* Create a new handle referring to the same key table as @a in. The new
* handle and @a in can be closed independently.
*
* @version New in 1.12
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_dup(krb5_context context, krb5_keytab in, krb5_keytab *out);
/**
* Get the default key table name.
*
* @param [in] context Library context
* @param [out] name Default key table name
* @param [in] name_size Space available in @a name
*
* Fill @a name with the name of the default key table for @a context.
*
* @sa MAX_KEYTAB_NAME_LEN
*
* @retval
* 0 Success
* @retval
* KRB5_CONFIG_NOTENUFSPACE Buffer is too short
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_default_name(krb5_context context, char *name, int name_size);
/**
* Resolve the default key table.
*
* @param [in] context Library context
* @param [out] id Key table handle
*
* Set @a id to a handle to the default key table. The key table is not
* opened.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_default(krb5_context context, krb5_keytab *id);
/**
* Resolve the default client key table.
*
* @param [in] context Library context
* @param [out] keytab_out Key table handle
*
* Fill @a keytab_out with a handle to the default client key table.
*
* @version New in 1.11
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_client_default(krb5_context context, krb5_keytab *keytab_out);
/**
* Free the contents of a key table entry.
*
* @param [in] context Library context
* @param [in] entry Key table entry whose contents are to be freed
*
* @note The pointer is not freed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_free_keytab_entry_contents(krb5_context context, krb5_keytab_entry *entry);
/** @deprecated Use krb5_free_keytab_entry_contents instead. */
krb5_error_code KRB5_CALLCONV
krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *entry);
/* remove and add are functions, so that they can return NOWRITE
if not a writable keytab */
/**
* Remove an entry from a key table.
*
* @param [in] context Library context
* @param [in] id Key table handle
* @param [in] entry Entry to remove from key table
*
* @retval
* 0 Success
* @retval
* KRB5_KT_NOWRITE Key table is not writable
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_remove_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry);
/**
* Add a new entry to a key table.
*
* @param [in] context Library context
* @param [in] id Key table handle
* @param [in] entry Entry to be added
*
* @retval
* 0 Success
* @retval
* ENOMEM Insufficient memory
* @retval
* KRB5_KT_NOWRITE Key table is not writeable
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_add_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry);
/**
* Convert a principal name into the default salt for that principal.
*
* @param [in] context Library context
* @param [in] pr Principal name
* @param [out] ret Default salt for @a pr to be filled in
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV_WRONG
krb5_principal2salt(krb5_context context,
krb5_const_principal pr, krb5_data *ret);
/* librc.spec--see rcache.h */
/* libcc.spec */
/**
* Resolve a credential cache name.
*
* @param [in] context Library context
* @param [in] name Credential cache name to be resolved
* @param [out] cache Credential cache handle
*
* Fills in @a cache with a @a cache handle that corresponds to the name in @a
* name. @a name should be of the form @c type:residual, and @a type must be a
* type known to the library. If the @a name does not contain a colon,
* interpret it as a file name.
*
* @code
* Example: krb5_cc_resolve(context, "MEMORY:C_", &cache);
* @endcode
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_resolve(krb5_context context, const char *name, krb5_ccache *cache);
/**
* Duplicate ccache handle.
*
* @param [in] context Library context
* @param [in] in Credential cache handle to be duplicated
* @param [out] out Credential cache handle
*
* Create a new handle referring to the same cache as @a in.
* The new handle and @a in can be closed independently.
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_dup(krb5_context context, krb5_ccache in, krb5_ccache *out);
/**
* Return the name of the default credential cache.
*
* @param [in] context Library context
*
* Return a pointer to the default credential cache name for @a context, as
* determined by a prior call to krb5_cc_set_default_name(), by the KRB5CCNAME
* environment variable, by the default_ccache_name profile variable, or by the
* operating system or build-time default value. The returned value must not
* be modified or freed by the caller. The returned value becomes invalid when
* @a context is destroyed krb5_free_context() or if a subsequent call to
* krb5_cc_set_default_name() is made on @a context.
*
* The default credential cache name is cached in @a context between calls to
* this function, so if the value of KRB5CCNAME changes in the process
* environment after the first call to this function on, that change will not
* be reflected in later calls with the same context. The caller can invoke
* krb5_cc_set_default_name() with a NULL value of @a name to clear the cached
* value and force the default name to be recomputed.
*
* @return
* Name of default credential cache for the current user.
*/
const char *KRB5_CALLCONV
krb5_cc_default_name(krb5_context context);
/**
* Set the default credential cache name.
*
* @param [in] context Library context
* @param [in] name Default credential cache name or NULL
*
* Set the default credential cache name to @a name for future operations using
* @a context. If @a name is NULL, clear any previous application-set default
* name and forget any cached value of the default name for @a context.
*
* Calls to this function invalidate the result of any previous calls to
* krb5_cc_default_name() using @a context.
*
* @retval
* 0 Success
* @retval
* KV5M_CONTEXT Bad magic number for @c _krb5_context structure
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_set_default_name(krb5_context context, const char *name);
/**
* Resolve the default credential cache name.
*
* @param [in] context Library context
* @param [out] ccache Pointer to credential cache name
*
* Create a handle to the default credential cache as given by
* krb5_cc_default_name().
*
* @retval
* 0 Success
* @retval
* KV5M_CONTEXT Bad magic number for @c _krb5_context structure
* @retval
* KRB5_FCC_INTERNAL The name of the default credential cache cannot be
* obtained
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_default(krb5_context context, krb5_ccache *ccache);
/**
* Copy a credential cache.
*
* @param [in] context Library context
* @param [in] incc Credential cache to be copied
* @param [out] outcc Copy of credential cache to be filled in
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_copy_creds(krb5_context context, krb5_ccache incc, krb5_ccache outcc);
/**
* Get a configuration value from a credential cache.
*
* @param [in] context Library context
* @param [in] id Credential cache handle
* @param [in] principal Configuration for this principal;
* if NULL, global for the whole cache
* @param [in] key Name of config variable
* @param [out] data Data to be fetched
*
* Use krb5_free_data_contents() to free @a data when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_get_config(krb5_context context, krb5_ccache id,
krb5_const_principal principal,
const char *key, krb5_data *data);
/**
* Store a configuration value in a credential cache.
*
* @param [in] context Library context
* @param [in] id Credential cache handle
* @param [in] principal Configuration for a specific principal;
* if NULL, global for the whole cache
* @param [in] key Name of config variable
* @param [in] data Data to store, or NULL to remove
*
* @note Existing configuration under the same key is over-written.
*
* @warning Before version 1.10 @a data was assumed to be always non-null.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_set_config(krb5_context context, krb5_ccache id,
krb5_const_principal principal,
const char *key, krb5_data *data);
/**
* Test whether a principal is a configuration principal.
*
* @param [in] context Library context
* @param [in] principal Principal to check
*
* @return
* @c TRUE if the principal is a configuration principal (generated part of
* krb5_cc_set_config()); @c FALSE otherwise.
*/
krb5_boolean KRB5_CALLCONV
krb5_is_config_principal(krb5_context context, krb5_const_principal principal);
/**
* Make a credential cache the primary cache for its collection.
*
* @param [in] context Library context
* @param [in] cache Credential cache handle
*
* If the type of @a cache supports it, set @a cache to be the primary
* credential cache for the collection it belongs to.
*
* @retval
* 0 Success, or the type of @a cache doesn't support switching
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_switch(krb5_context context, krb5_ccache cache);
/**
* Determine whether a credential cache type supports switching.
*
* @param [in] context Library context
* @param [in] type Credential cache type
*
* @version New in 1.10
*
* @retval TRUE if @a type supports switching
* @retval FALSE if it does not or is not a valid credential cache type.
*/
krb5_boolean KRB5_CALLCONV
krb5_cc_support_switch(krb5_context context, const char *type);
/**
* Find a credential cache with a specified client principal.
*
* @param [in] context Library context
* @param [in] client Client principal
* @param [out] cache_out Credential cache handle
*
* Find a cache within the collection whose default principal is @a client.
* Use @a krb5_cc_close to close @a ccache when it is no longer needed.
*
* @retval 0 Success
* @retval KRB5_CC_NOTFOUND
*
* @sa krb5_cccol_cursor_new
*
* @version New in 1.10
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_cache_match(krb5_context context, krb5_principal client,
krb5_ccache *cache_out);
/**
* Select a credential cache to use with a server principal.
*
* @param [in] context Library context
* @param [in] server Server principal
* @param [out] cache_out Credential cache handle
* @param [out] princ_out Client principal
*
* Select a cache within the collection containing credentials most appropriate
* for use with @a server, according to configured rules and heuristics.
*
* Use krb5_cc_close() to release @a cache_out when it is no longer needed.
* Use krb5_free_principal() to release @a princ_out when it is no longer
* needed. Note that @a princ_out is set in some error conditions.
*
* @return
* If an appropriate cache is found, 0 is returned, @a cache_out is set to the
* selected cache, and @a princ_out is set to the default principal of that
* cache.
*
* If the appropriate client principal can be authoritatively determined but
* the cache collection contains no credentials for that principal, then
* KRB5_CC_NOTFOUND is returned, @a cache_out is set to NULL, and @a princ_out
* is set to the appropriate client principal.
*
* If no configured mechanism can determine the appropriate cache or principal,
* KRB5_CC_NOTFOUND is returned and @a cache_out and @a princ_out are set to
* NULL.
*
* Any other error code indicates a fatal error in the processing of a cache
* selection mechanism.
*
* @version New in 1.10
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_select(krb5_context context, krb5_principal server,
krb5_ccache *cache_out, krb5_principal *princ_out);
/* krb5_free.c */
/**
* Free the storage assigned to a principal.
*
* @param [in] context Library context
* @param [in] val Principal to be freed
*/
void KRB5_CALLCONV
krb5_free_principal(krb5_context context, krb5_principal val);
/**
* Free a krb5_authenticator structure.
*
* @param [in] context Library context
* @param [in] val Authenticator structure to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_authenticator(krb5_context context, krb5_authenticator *val);
/**
* Free the data stored in array of addresses.
*
* @param [in] context Library context
* @param [in] val Array of addresses to be freed
*
* This function frees the contents of @a val and the array itself.
*
* @note The last entry in the array must be a NULL pointer.
*/
void KRB5_CALLCONV
krb5_free_addresses(krb5_context context, krb5_address **val);
/**
* Free the storage assigned to array of authentication data.
*
* @param [in] context Library context
* @param [in] val Array of authentication data to be freed
*
* This function frees the contents of @a val and the array itself.
*
* @note The last entry in the array must be a NULL pointer.
*/
void KRB5_CALLCONV
krb5_free_authdata(krb5_context context, krb5_authdata **val);
/**
* Free a ticket.
*
* @param [in] context Library context
* @param [in] val Ticket to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_ticket(krb5_context context, krb5_ticket *val);
/**
* Free an error allocated by krb5_read_error() or krb5_sendauth().
*
* @param [in] context Library context
* @param [in] val Error data structure to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_error(krb5_context context, krb5_error *val);
/**
* Free a krb5_creds structure.
*
* @param [in] context Library context
* @param [in] val Credential structure to be freed.
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_creds(krb5_context context, krb5_creds *val);
/**
* Free the contents of a krb5_creds structure.
*
* @param [in] context Library context
* @param [in] val Credential structure to free contents of
*
* This function frees the contents of @a val, but not the structure itself.
*/
void KRB5_CALLCONV
krb5_free_cred_contents(krb5_context context, krb5_creds *val);
/**
* Free a krb5_checksum structure.
*
* @param [in] context Library context
* @param [in] val Checksum structure to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_checksum(krb5_context context, krb5_checksum *val);
/**
* Free the contents of a krb5_checksum structure.
*
* @param [in] context Library context
* @param [in] val Checksum structure to free contents of
*
* This function frees the contents of @a val, but not the structure itself.
*/
void KRB5_CALLCONV
krb5_free_checksum_contents(krb5_context context, krb5_checksum *val);
/**
* Free a krb5_keyblock structure.
*
* @param [in] context Library context
* @param [in] val Keyblock to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_keyblock(krb5_context context, krb5_keyblock *val);
/**
* Free the contents of a krb5_keyblock structure.
*
* @param [in] context Library context
* @param [in] key Keyblock to be freed
*
* This function frees the contents of @a key, but not the structure itself.
*/
void KRB5_CALLCONV
krb5_free_keyblock_contents(krb5_context context, krb5_keyblock *key);
/**
* Free a krb5_ap_rep_enc_part structure.
*
* @param [in] context Library context
* @param [in] val AP-REP enc part to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_ap_rep_enc_part(krb5_context context, krb5_ap_rep_enc_part *val);
/**
* Free a krb5_data structure.
*
* @param [in] context Library context
* @param [in] val Data structure to be freed
*
* This function frees the contents of @a val and the structure itself.
*/
void KRB5_CALLCONV
krb5_free_data(krb5_context context, krb5_data *val);
/* Free a krb5_octet_data structure (should be unused). */
void KRB5_CALLCONV
krb5_free_octet_data(krb5_context context, krb5_octet_data *val);
/**
* Free the contents of a krb5_data structure and zero the data field.
*
* @param [in] context Library context
* @param [in] val Data structure to free contents of
*
* This function frees the contents of @a val, but not the structure itself.
*/
void KRB5_CALLCONV
krb5_free_data_contents(krb5_context context, krb5_data *val);
/**
* Free a string representation of a principal.
*
* @param [in] context Library context
* @param [in] val Name string to be freed
*/
void KRB5_CALLCONV
krb5_free_unparsed_name(krb5_context context, char *val);
/**
* Free a string allocated by a krb5 function.
*
* @param [in] context Library context
* @param [in] val String to be freed
*
* @version New in 1.10
*/
void KRB5_CALLCONV
krb5_free_string(krb5_context context, char *val);
/**
* Free an array of encryption types.
*
* @param [in] context Library context
* @param [in] val Array of enctypes to be freed
*
* @version New in 1.12
*/
void KRB5_CALLCONV
krb5_free_enctypes(krb5_context context, krb5_enctype *val);
/**
* Free an array of checksum types.
*
* @param [in] context Library context
* @param [in] val Array of checksum types to be freed
*/
void KRB5_CALLCONV
krb5_free_cksumtypes(krb5_context context, krb5_cksumtype *val);
/* From krb5/os, but needed by the outside world */
/**
* Retrieve the system time of day, in sec and ms, since the epoch.
*
* @param [in] context Library context
* @param [out] seconds System timeofday, seconds portion
* @param [out] microseconds System timeofday, microseconds portion
*
* This function retrieves the system time of day with the context
* specific time offset adjustment.
*
* @sa krb5_crypto_us_timeofday()
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_us_timeofday(krb5_context context,
krb5_timestamp *seconds, krb5_int32 *microseconds);
/**
* Retrieve the current time with context specific time offset adjustment.
*
* @param [in] context Library context
* @param [out] timeret Timestamp to fill in
*
* This function retrieves the system time of day with the context specific
* time offset adjustment.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_timeofday(krb5_context context, krb5_timestamp *timeret);
/**
* Check if a timestamp is within the allowed clock skew of the current time.
*
* @param [in] context Library context
* @param [in] date Timestamp to check
*
* This function checks if @a date is close enough to the current time
* according to the configured allowable clock skew.
*
* @version New in 1.10
*
* @retval 0 Success
* @retval KRB5KRB_AP_ERR_SKEW @a date is not within allowable clock skew
*/
krb5_error_code KRB5_CALLCONV
krb5_check_clockskew(krb5_context context, krb5_timestamp date);
/**
* Return all interface addresses for this host.
*
* @param [in] context Library context
* @param [out] addr Array of krb5_address pointers, ending with
* NULL
*
* Use krb5_free_addresses() to free @a addr when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_os_localaddr(krb5_context context, krb5_address ***addr);
/**
* Retrieve the default realm.
*
* @param [in] context Library context
* @param [out] lrealm Default realm name
*
* Retrieves the default realm to be used if no user-specified realm is
* available.
*
* Use krb5_free_default_realm() to free @a lrealm when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_default_realm(krb5_context context, char **lrealm);
/**
* Override the default realm for the specified context.
*
* @param [in] context Library context
* @param [in] lrealm Realm name for the default realm
*
* If @a lrealm is NULL, clear the default realm setting.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_set_default_realm(krb5_context context, const char *lrealm);
/**
* Free a default realm string returned by krb5_get_default_realm().
*
* @param [in] context Library context
* @param [in] lrealm Realm to be freed
*/
void KRB5_CALLCONV
krb5_free_default_realm(krb5_context context, char *lrealm);
/**
* Canonicalize a hostname, possibly using name service.
*
* @param [in] context Library context
* @param [in] host Input hostname
* @param [out] canonhost_out Canonicalized hostname
*
* This function canonicalizes orig_hostname, possibly using name service
* lookups if configuration permits. Use krb5_free_string() to free @a
* canonhost_out when it is no longer needed.
*
* @version New in 1.15
*/
krb5_error_code KRB5_CALLCONV
krb5_expand_hostname(krb5_context context, const char *host,
char **canonhost_out);
/**
* Generate a full principal name from a service name.
*
* @param [in] context Library context
* @param [in] hostname Host name, or NULL to use local host
* @param [in] sname Service name, or NULL to use @c "host"
* @param [in] type Principal type
* @param [out] ret_princ Generated principal
*
* This function converts a @a hostname and @a sname into @a krb5_principal
* structure @a ret_princ. The returned principal will be of the form @a
* sname\/hostname\@REALM where REALM is determined by krb5_get_host_realm().
* In some cases this may be the referral (empty) realm.
*
* The @a type can be one of the following:
*
* @li #KRB5_NT_SRV_HST canonicalizes the host name before looking up the
* realm and generating the principal.
*
* @li #KRB5_NT_UNKNOWN accepts the hostname as given, and does not
* canonicalize it.
*
* Use krb5_free_principal to free @a ret_princ when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_sname_to_principal(krb5_context context, const char *hostname, const char *sname,
krb5_int32 type, krb5_principal *ret_princ);
/**
* Test whether a principal matches a matching principal.
*
* @param [in] context Library context
* @param [in] matching Matching principal
* @param [in] princ Principal to test
*
* @note A matching principal is a host-based principal with an empty realm
* and/or second data component (hostname). Profile configuration may cause
* the hostname to be ignored even if it is present. A principal matches a
* matching principal if the former has the same non-empty (and non-ignored)
* components of the latter.
*
* If @a matching is NULL, return TRUE. If @a matching is not a matching
* principal, return the value of krb5_principal_compare(context, matching,
* princ).
*
* @return
* TRUE if @a princ matches @a matching, FALSE otherwise.
*/
krb5_boolean KRB5_CALLCONV
krb5_sname_match(krb5_context context, krb5_const_principal matching,
krb5_const_principal princ);
/**
* Change a password for an existing Kerberos account.
*
* @param [in] context Library context
* @param [in] creds Credentials for kadmin/changepw service
* @param [in] newpw New password
* @param [out] result_code Numeric error code from server
* @param [out] result_code_string String equivalent to @a result_code
* @param [out] result_string Change password response from the KDC
*
* Change the password for the existing principal identified by @a creds.
*
* The possible values of the output @a result_code are:
*
* @li #KRB5_KPASSWD_SUCCESS (0) - success
* @li #KRB5_KPASSWD_MALFORMED (1) - Malformed request error
* @li #KRB5_KPASSWD_HARDERROR (2) - Server error
* @li #KRB5_KPASSWD_AUTHERROR (3) - Authentication error
* @li #KRB5_KPASSWD_SOFTERROR (4) - Password change rejected
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_change_password(krb5_context context, krb5_creds *creds,
const char *newpw, int *result_code,
krb5_data *result_code_string, krb5_data *result_string);
/**
* Set a password for a principal using specified credentials.
*
* @param [in] context Library context
* @param [in] creds Credentials for kadmin/changepw service
* @param [in] newpw New password
* @param [in] change_password_for Change the password for this principal
* @param [out] result_code Numeric error code from server
* @param [out] result_code_string String equivalent to @a result_code
* @param [out] result_string Data returned from the remote system
*
* This function uses the credentials @a creds to set the password @a newpw for
* the principal @a change_password_for. It implements the set password
* operation of RFC 3244, for interoperability with Microsoft Windows
* implementations.
*
* @note If @a change_password_for is NULL, the change is performed on the
* current principal. If @a change_password_for is non-null, the change is
* performed on the principal name passed in @a change_password_for.
*
* The error code and strings are returned in @a result_code,
* @a result_code_string and @a result_string.
*
* @sa krb5_set_password_using_ccache()
*
* @retval
* 0 Success and result_code is set to #KRB5_KPASSWD_SUCCESS.
* @return
* Kerberos error codes.
*/
krb5_error_code KRB5_CALLCONV
krb5_set_password(krb5_context context, krb5_creds *creds, const char *newpw,
krb5_principal change_password_for, int *result_code,
krb5_data *result_code_string, krb5_data *result_string);
/**
* Set a password for a principal using cached credentials.
*
* @param [in] context Library context
* @param [in] ccache Credential cache
* @param [in] newpw New password
* @param [in] change_password_for Change the password for this principal
* @param [out] result_code Numeric error code from server
* @param [out] result_code_string String equivalent to @a result_code
* @param [out] result_string Data returned from the remote system
*
* This function uses the cached credentials from @a ccache to set the password
* @a newpw for the principal @a change_password_for. It implements RFC 3244
* set password operation (interoperable with MS Windows implementations) using
* the credential cache.
*
* The error code and strings are returned in @a result_code,
* @a result_code_string and @a result_string.
*
* @note If @a change_password_for is set to NULL, the change is performed on
* the default principal in @a ccache. If @a change_password_for is non null,
* the change is performed on the specified principal.
*
* @sa krb5_set_password()
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_set_password_using_ccache(krb5_context context, krb5_ccache ccache,
const char *newpw,
krb5_principal change_password_for,
int *result_code, krb5_data *result_code_string,
krb5_data *result_string);
/**
* Get a result message for changing or setting a password.
*
* @param [in] context Library context
* @param [in] server_string Data returned from the remote system
* @param [out] message_out A message displayable to the user
*
* This function processes the @a server_string returned in the @a
* result_string parameter of krb5_change_password(), krb5_set_password(), and
* related functions, and returns a displayable string. If @a server_string
* contains Active Directory structured policy information, it will be
* converted into human-readable text.
*
* Use krb5_free_string() to free @a message_out when it is no longer needed.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*
* @version New in 1.11
*/
krb5_error_code KRB5_CALLCONV
krb5_chpw_message(krb5_context context, const krb5_data *server_string,
char **message_out);
/**
* Retrieve configuration profile from the context.
*
* @param [in] context Library context
* @param [out] profile Pointer to data read from a configuration file
*
* This function creates a new @a profile object that reflects profile
* in the supplied @a context.
*
* The @a profile object may be freed with profile_release() function.
* See profile.h and profile API for more details.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_profile(krb5_context context, struct _profile_t ** profile);
#if KRB5_DEPRECATED
/** @deprecated Replaced by krb5_get_init_creds_password().*/
KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV
krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options,
krb5_address *const *addrs, krb5_enctype *ktypes,
krb5_preauthtype *pre_auth_types,
const char *password, krb5_ccache ccache,
krb5_creds *creds, krb5_kdc_rep **ret_as_reply);
/** @deprecated Replaced by krb5_get_init_creds(). */
KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV
krb5_get_in_tkt_with_skey(krb5_context context, krb5_flags options,
krb5_address *const *addrs, krb5_enctype *ktypes,
krb5_preauthtype *pre_auth_types,
const krb5_keyblock *key, krb5_ccache ccache,
krb5_creds *creds, krb5_kdc_rep **ret_as_reply);
/** @deprecated Replaced by krb5_get_init_creds_keytab(). */
KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV
krb5_get_in_tkt_with_keytab(krb5_context context, krb5_flags options,
krb5_address *const *addrs, krb5_enctype *ktypes,
krb5_preauthtype *pre_auth_types,
krb5_keytab arg_keytab, krb5_ccache ccache,
krb5_creds *creds, krb5_kdc_rep **ret_as_reply);
#endif /* KRB5_DEPRECATED */
/**
* Parse and decrypt a @c KRB_AP_REQ message.
*
* @param [in] context Library context
* @param [in,out] auth_context Pre-existing or newly created auth context
* @param [in] inbuf AP-REQ message to be parsed
* @param [in] server Matching principal for server, or NULL to
* allow any principal in keytab
* @param [in] keytab Key table, or NULL to use the default
* @param [out] ap_req_options If non-null, the AP-REQ flags on output
* @param [out] ticket If non-null, ticket from the AP-REQ message
*
* This function parses, decrypts and verifies a AP-REQ message from @a inbuf
* and stores the authenticator in @a auth_context.
*
* If a keyblock was specified in @a auth_context using
* krb5_auth_con_setuseruserkey(), that key is used to decrypt the ticket in
* AP-REQ message and @a keytab is ignored. In this case, @a server should be
* specified as a complete principal name to allow for proper transited-path
* checking and replay cache selection.
*
* Otherwise, the decryption key is obtained from @a keytab, or from the
* default keytab if it is NULL. In this case, @a server may be a complete
* principal name, a matching principal (see krb5_sname_match()), or NULL to
* match any principal name. The keys tried against the encrypted part of the
* ticket are determined as follows:
*
* - If @a server is a complete principal name, then its entry in @a keytab is
* tried.
* - Otherwise, if @a keytab is iterable, then all entries in @a keytab which
* match @a server are tried.
* - Otherwise, the server principal in the ticket must match @a server, and
* its entry in @a keytab is tried.
*
* The client specified in the decrypted authenticator must match the client
* specified in the decrypted ticket.
*
* If the @a remote_addr field of @a auth_context is set, the request must come
* from that address.
*
* If a replay cache handle is provided in the @a auth_context, the
* authenticator and ticket are verified against it. If no conflict is found,
* the new authenticator is then stored in the replay cache of @a auth_context.
*
* Various other checks are performed on the decoded data, including
* cross-realm policy, clockskew, and ticket validation times.
*
* On success the authenticator, subkey, and remote sequence number of the
* request are stored in @a auth_context. If the #AP_OPTS_MUTUAL_REQUIRED
* bit is set, the local sequence number is XORed with the remote sequence
* number in the request.
*
* Use krb5_free_ticket() to free @a ticket when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_req(krb5_context context, krb5_auth_context *auth_context,
const krb5_data *inbuf, krb5_const_principal server,
krb5_keytab keytab, krb5_flags *ap_req_options,
krb5_ticket **ticket);
/**
* Retrieve a service key from a key table.
*
* @param [in] context Library context
* @param [in] keyprocarg Name of a key table (NULL to use default name)
* @param [in] principal Service principal
* @param [in] vno Key version number (0 for highest available)
* @param [in] enctype Encryption type (0 for any type)
* @param [out] key Service key from key table
*
* Open and search the specified key table for the entry identified by @a
* principal, @a enctype, and @a vno. If no key is found, return an error code.
*
* The default key table is used, unless @a keyprocarg is non-null.
* @a keyprocarg designates a specific key table.
*
* Use krb5_free_keyblock() to free @a key when it is no longer needed.
*
* @retval
* 0 Success
* @return Kerberos error code if not found or @a keyprocarg is invalid.
*/
krb5_error_code KRB5_CALLCONV
krb5_kt_read_service_key(krb5_context context, krb5_pointer keyprocarg,
krb5_principal principal, krb5_kvno vno,
krb5_enctype enctype, krb5_keyblock **key);
/**
* Format a @c KRB-SAFE message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] userdata User data in the message
* @param [out] der_out Formatted @c KRB-SAFE buffer
* @param [out] rdata_out Replay data. Specify NULL if not needed
*
* This function creates an integrity protected @c KRB-SAFE message
* using data supplied by the application.
*
* Fields in @a auth_context specify the checksum type, the keyblock that
* can be used to seed the checksum, full addresses (host and port) for
* the sender and receiver, and @ref KRB5_AUTH_CONTEXT flags.
*
* The local address in @a auth_context must be set, and is used to form the
* sender address used in the KRB-SAFE message. The remote address is
* optional; if specified, it will be used to form the receiver address used in
* the message.
*
* @note The @a rdata_out argument is required if the
* #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set
* in @a auth_context.
*
* If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, a
* timestamp is included in the KRB-SAFE message, and an entry for the message
* is entered in an in-memory replay cache to detect if the message is
* reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, no
* replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a
* auth_context, a timestamp is included in the KRB-SAFE message and is stored
* in @a rdata_out.
*
* If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE
* is set, the @a auth_context local sequence number is included in the
* KRB-SAFE message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE
* is set, the sequence number used is stored in @a rdata_out.
*
* Use krb5_free_data_contents() to free @a der_out when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_safe(krb5_context context, krb5_auth_context auth_context,
const krb5_data *userdata, krb5_data *der_out,
krb5_replay_data *rdata_out);
/**
* Format a @c KRB-PRIV message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] userdata User data for @c KRB-PRIV message
* @param [out] der_out Formatted @c KRB-PRIV message
* @param [out] rdata_out Replay data (NULL if not needed)
*
* This function is similar to krb5_mk_safe(), but the message is encrypted and
* integrity-protected, not just integrity-protected.
*
* The local address in @a auth_context must be set, and is used to form the
* sender address used in the KRB-PRIV message. The remote address is
* optional; if specified, it will be used to form the receiver address used in
* the message.
*
* @note The @a rdata_out argument is required if the
* #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set
* in @a auth_context.
*
* If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, a
* timestamp is included in the KRB-PRIV message, and an entry for the message
* is entered in an in-memory replay cache to detect if the message is
* reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, no
* replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a
* auth_context, a timestamp is included in the KRB-PRIV message and is stored
* in @a rdata_out.
*
* If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE
* is set, the @a auth_context local sequence number is included in the
* KRB-PRIV message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE
* is set, the sequence number used is stored in @a rdata_out.
*
* Use krb5_free_data_contents() to free @a der_out when it is no longer
* needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_priv(krb5_context context, krb5_auth_context auth_context,
const krb5_data *userdata, krb5_data *der_out,
krb5_replay_data *rdata_out);
/**
* Client function for @c sendauth protocol.
*
* @param [in] context Library context
* @param [in,out] auth_context Pre-existing or newly created auth context
* @param [in] fd File descriptor that describes network socket
* @param [in] appl_version Application protocol version to be matched
* with the receiver's application version
* @param [in] client Client principal
* @param [in] server Server principal
* @param [in] ap_req_options @ref AP_OPTS options
* @param [in] in_data Data to be sent to the server
* @param [in] in_creds Input credentials, or NULL to use @a ccache
* @param [in] ccache Credential cache
* @param [out] error If non-null, contains KRB_ERROR message
* returned from server
* @param [out] rep_result If non-null and @a ap_req_options is
* #AP_OPTS_MUTUAL_REQUIRED, contains the result
* of mutual authentication exchange
* @param [out] out_creds If non-null, the retrieved credentials
*
* This function performs the client side of a sendauth/recvauth exchange by
* sending and receiving messages over @a fd.
*
* Credentials may be specified in three ways:
*
* @li If @a in_creds is NULL, credentials are obtained with
* krb5_get_credentials() using the principals @a client and @a server. @a
* server must be non-null; @a client may NULL to use the default principal of
* @a ccache.
*
* @li If @a in_creds is non-null, but does not contain a ticket, credentials
* for the exchange are obtained with krb5_get_credentials() using @a in_creds.
* In this case, the values of @a client and @a server are unused.
*
* @li If @a in_creds is a complete credentials structure, it used directly.
* In this case, the values of @a client, @a server, and @a ccache are unused.
*
* If the server is using a different application protocol than that specified
* in @a appl_version, an error will be returned.
*
* Use krb5_free_creds() to free @a out_creds, krb5_free_ap_rep_enc_part() to
* free @a rep_result, and krb5_free_error() to free @a error when they are no
* longer needed.
*
* @sa krb5_recvauth()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_sendauth(krb5_context context, krb5_auth_context *auth_context,
krb5_pointer fd, char *appl_version, krb5_principal client,
krb5_principal server, krb5_flags ap_req_options,
krb5_data *in_data, krb5_creds *in_creds, krb5_ccache ccache,
krb5_error **error, krb5_ap_rep_enc_part **rep_result,
krb5_creds **out_creds);
/**
* Server function for @a sendauth protocol.
*
* @param [in] context Library context
* @param [in,out] auth_context Pre-existing or newly created auth context
* @param [in] fd File descriptor
* @param [in] appl_version Application protocol version to be matched
* against the client's application version
* @param [in] server Server principal (NULL for any in @a keytab)
* @param [in] flags Additional specifications
* @param [in] keytab Key table containing service keys
* @param [out] ticket Ticket (NULL if not needed)
*
* This function performs the server side of a sendauth/recvauth exchange by
* sending and receiving messages over @a fd.
*
* Use krb5_free_ticket() to free @a ticket when it is no longer needed.
*
* @sa krb5_sendauth()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_recvauth(krb5_context context, krb5_auth_context *auth_context,
krb5_pointer fd, char *appl_version, krb5_principal server,
krb5_int32 flags, krb5_keytab keytab, krb5_ticket **ticket);
/**
* Server function for @a sendauth protocol with version parameter.
*
* @param [in] context Library context
* @param [in,out] auth_context Pre-existing or newly created auth context
* @param [in] fd File descriptor
* @param [in] server Server principal (NULL for any in @a keytab)
* @param [in] flags Additional specifications
* @param [in] keytab Decryption key
* @param [out] ticket Ticket (NULL if not needed)
* @param [out] version sendauth protocol version (NULL if not needed)
*
* This function is similar to krb5_recvauth() with the additional output
* information place into @a version.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_recvauth_version(krb5_context context,
krb5_auth_context *auth_context,
krb5_pointer fd,
krb5_principal server,
krb5_int32 flags,
krb5_keytab keytab,
krb5_ticket **ticket,
krb5_data *version);
/**
* Format a @c KRB-CRED message for an array of credentials.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] creds Null-terminated array of credentials
* @param [out] der_out Encoded credentials
* @param [out] rdata_out Replay cache information (NULL if not needed)
*
* This function takes an array of credentials @a creds and formats
* a @c KRB-CRED message @a der_out to pass to krb5_rd_cred().
*
* The local and remote addresses in @a auth_context are optional; if either is
* specified, they are used to form the sender and receiver addresses in the
* KRB-CRED message.
*
* @note The @a rdata_out argument is required if the
* #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set
* in @a auth_context.
*
* If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, an entry
* for the message is entered in an in-memory replay cache to detect if the
* message is reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not
* set, no replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a
* auth_context, the timestamp used for the KRB-CRED message is stored in @a
* rdata_out.
*
* If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE
* is set, the @a auth_context local sequence number is included in the
* KRB-CRED message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE
* is set, the sequence number used is stored in @a rdata_out.
*
* Use krb5_free_data_contents() to free @a der_out when it is no longer
* needed.
*
* The message will be encrypted using the send subkey of @a auth_context if it
* is present, or the session key otherwise. If neither key is present, the
* credentials will not be encrypted, and the message should only be sent over
* a secure channel. No replay cache entry is used in this case.
*
* @retval
* 0 Success
* @retval
* ENOMEM Insufficient memory
* @retval
* KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_ncred(krb5_context context, krb5_auth_context auth_context,
krb5_creds **creds, krb5_data **der_out,
krb5_replay_data *rdata_out);
/**
* Format a @c KRB-CRED message for a single set of credentials.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] creds Pointer to credentials
* @param [out] der_out Encoded credentials
* @param [out] rdata_out Replay cache data (NULL if not needed)
*
* This is a convenience function that calls krb5_mk_ncred() with a single set
* of credentials.
*
* @retval
* 0 Success
* @retval
* ENOMEM Insufficient memory
* @retval
* KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_mk_1cred(krb5_context context, krb5_auth_context auth_context,
krb5_creds *creds, krb5_data **der_out,
krb5_replay_data *rdata_out);
/**
* Read and validate a @c KRB-CRED message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] creddata @c KRB-CRED message
* @param [out] creds_out Null-terminated array of forwarded credentials
* @param [out] rdata_out Replay data (NULL if not needed)
*
* @note The @a rdata_out argument is required if the
* #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set
* in @a auth_context.`
*
* @a creddata will be decrypted using the receiving subkey if it is present in
* @a auth_context, or the session key if the receiving subkey is not present
* or fails to decrypt the message.
*
* Use krb5_free_tgt_creds() to free @a creds_out when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_rd_cred(krb5_context context, krb5_auth_context auth_context,
krb5_data *creddata, krb5_creds ***creds_out,
krb5_replay_data *rdata_out);
/**
* Get a forwarded TGT and format a @c KRB-CRED message.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] rhost Remote host
* @param [in] client Client principal of TGT
* @param [in] server Principal of server to receive TGT
* @param [in] cc Credential cache handle (NULL to use default)
* @param [in] forwardable Whether TGT should be forwardable
* @param [out] outbuf KRB-CRED message
*
* Get a TGT for use at the remote host @a rhost and format it into a KRB-CRED
* message. If @a rhost is NULL and @a server is of type #KRB5_NT_SRV_HST,
* the second component of @a server will be used.
*
* @retval
* 0 Success
* @retval
* ENOMEM Insufficient memory
* @retval
* KRB5_PRINC_NOMATCH Requested principal and ticket do not match
* @retval
* KRB5_NO_TKT_SUPPLIED Request did not supply a ticket
* @retval
* KRB5_CC_BADNAME Credential cache name or principal name malformed
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_fwd_tgt_creds(krb5_context context, krb5_auth_context auth_context,
const char *rhost, krb5_principal client,
krb5_principal server, krb5_ccache cc, int forwardable,
krb5_data *outbuf);
/**
* Create and initialize an authentication context.
*
* @param [in] context Library context
* @param [out] auth_context Authentication context
*
* This function creates an authentication context to hold configuration and
* state relevant to krb5 functions for authenticating principals and
* protecting messages once authentication has occurred.
*
* By default, flags for the context are set to enable the use of the replay
* cache (#KRB5_AUTH_CONTEXT_DO_TIME), but not sequence numbers. Use
* krb5_auth_con_setflags() to change the flags.
*
* The allocated @a auth_context must be freed with krb5_auth_con_free() when
* it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_init(krb5_context context, krb5_auth_context *auth_context);
/**
* Free a krb5_auth_context structure.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context to be freed
*
* This function frees an auth context allocated by krb5_auth_con_init().
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_free(krb5_context context, krb5_auth_context auth_context);
/**
* Set a flags field in a krb5_auth_context structure.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] flags Flags bit mask
*
* Valid values for @a flags are:
* @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps
* @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps
* @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers
* @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setflags(krb5_context context, krb5_auth_context auth_context, krb5_int32 flags);
/**
* Retrieve flags from a krb5_auth_context structure.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] flags Flags bit mask
*
* Valid values for @a flags are:
* @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps
* @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps
* @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers
* @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getflags(krb5_context context, krb5_auth_context auth_context,
krb5_int32 *flags);
/**
* Set a checksum callback in an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] func Checksum callback
* @param [in] data Callback argument
*
* Set a callback to obtain checksum data in krb5_mk_req(). The callback will
* be invoked after the subkey and local sequence number are stored in @a
* auth_context.
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_set_checksum_func( krb5_context context,
krb5_auth_context auth_context,
krb5_mk_req_checksum_func func,
void *data);
/**
* Get the checksum callback from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] func Checksum callback
* @param [out] data Callback argument
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_get_checksum_func( krb5_context context,
krb5_auth_context auth_context,
krb5_mk_req_checksum_func *func,
void **data);
/**
* Set the local and remote addresses in an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] local_addr Local address
* @param [in] remote_addr Remote address
*
* This function releases the storage assigned to the contents of the local and
* remote addresses of @a auth_context and then sets them to @a local_addr and
* @a remote_addr respectively.
*
* @sa krb5_auth_con_genaddrs()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV_WRONG
krb5_auth_con_setaddrs(krb5_context context, krb5_auth_context auth_context,
krb5_address *local_addr, krb5_address *remote_addr);
/**
* Retrieve address fields from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] local_addr Local address (NULL if not needed)
* @param [out] remote_addr Remote address (NULL if not needed)
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getaddrs(krb5_context context, krb5_auth_context auth_context,
krb5_address **local_addr, krb5_address **remote_addr);
/**
* Set local and remote port fields in an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] local_port Local port
* @param [in] remote_port Remote port
*
* This function releases the storage assigned to the contents of the local and
* remote ports of @a auth_context and then sets them to @a local_port and @a
* remote_port respectively.
*
* @sa krb5_auth_con_genaddrs()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setports(krb5_context context, krb5_auth_context auth_context,
krb5_address *local_port, krb5_address *remote_port);
/**
* Set the session key in an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] keyblock User key
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context,
krb5_keyblock *keyblock);
/**
* Retrieve the session key from an auth context as a keyblock.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] keyblock Session key
*
* This function creates a keyblock containing the session key from @a
* auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no
* longer needed
*
* @retval 0 Success. Otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getkey(krb5_context context, krb5_auth_context auth_context,
krb5_keyblock **keyblock);
/**
* Retrieve the session key from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] key Session key
*
* This function sets @a key to the session key from @a auth_context. Use
* krb5_k_free_key() to release @a key when it is no longer needed.
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getkey_k(krb5_context context, krb5_auth_context auth_context,
krb5_key *key);
/**
* Retrieve the send subkey from an auth context as a keyblock.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [out] keyblock Send subkey
*
* This function creates a keyblock containing the send subkey from @a
* auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no
* longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getsendsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock);
/**
* Retrieve the send subkey from an auth context.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [out] key Send subkey
*
* This function sets @a key to the send subkey from @a auth_context. Use
* krb5_k_free_key() to release @a key when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getsendsubkey_k(krb5_context ctx, krb5_auth_context ac,
krb5_key *key);
/**
* Retrieve the receiving subkey from an auth context as a keyblock.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [out] keyblock Receiving subkey
*
* This function creates a keyblock containing the receiving subkey from @a
* auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no
* longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getrecvsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock);
/**
* Retrieve the receiving subkey from an auth context as a keyblock.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [out] key Receiving subkey
*
* This function sets @a key to the receiving subkey from @a auth_context. Use
* krb5_k_free_key() to release @a key when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key *key);
/**
* Set the send subkey in an auth context with a keyblock.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [in] keyblock Send subkey
*
* This function sets the send subkey in @a ac to a copy of @a keyblock.
*
* @retval 0 Success. Otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setsendsubkey(krb5_context ctx, krb5_auth_context ac,
krb5_keyblock *keyblock);
/**
* Set the send subkey in an auth context.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [out] key Send subkey
*
* This function sets the send subkey in @a ac to @a key, incrementing its
* reference count.
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setsendsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key key);
/**
* Set the receiving subkey in an auth context with a keyblock.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [in] keyblock Receiving subkey
*
* This function sets the receiving subkey in @a ac to a copy of @a keyblock.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setrecvsubkey(krb5_context ctx, krb5_auth_context ac,
krb5_keyblock *keyblock);
/**
* Set the receiving subkey in an auth context.
*
* @param [in] ctx Library context
* @param [in] ac Authentication context
* @param [in] key Receiving subkey
*
* This function sets the receiving subkey in @a ac to @a key, incrementing its
* reference count.
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setrecvsubkey_k(krb5_context ctx, krb5_auth_context ac,
krb5_key key);
#if KRB5_DEPRECATED
/** @deprecated Replaced by krb5_auth_con_getsendsubkey(). */
KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV
krb5_auth_con_getlocalsubkey(krb5_context context, krb5_auth_context auth_context,
krb5_keyblock **keyblock);
/** @deprecated Replaced by krb5_auth_con_getrecvsubkey(). */
KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV
krb5_auth_con_getremotesubkey(krb5_context context, krb5_auth_context auth_context,
krb5_keyblock **keyblock);
#endif
/**
* Retrieve the local sequence number from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] seqnumber Local sequence number
*
* Retrieve the local sequence number from @a auth_context and return it in @a
* seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a
* auth_context for this function to be useful.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getlocalseqnumber(krb5_context context, krb5_auth_context auth_context,
krb5_int32 *seqnumber);
/**
* Retrieve the remote sequence number from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] seqnumber Remote sequence number
*
* Retrieve the remote sequence number from @a auth_context and return it in @a
* seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a
* auth_context for this function to be useful.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context,
krb5_int32 *seqnumber);
/**
* Cause an auth context to use cipher state.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
*
* Prepare @a auth_context to use cipher state when krb5_mk_priv() or
* krb5_rd_priv() encrypt or decrypt data.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_initivector(krb5_context context, krb5_auth_context auth_context);
/**
* Set the replay cache in an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] rcache Replay cache haddle
*
* This function sets the replay cache in @a auth_context to @a rcache. @a
* rcache will be closed when @a auth_context is freed, so the caller should
* relinquish that responsibility.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_setrcache(krb5_context context, krb5_auth_context auth_context,
krb5_rcache rcache);
/**
* Retrieve the replay cache from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] rcache Replay cache handle
*
* This function fetches the replay cache from @a auth_context. The caller
* should not close @a rcache.
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV_WRONG
krb5_auth_con_getrcache(krb5_context context, krb5_auth_context auth_context,
krb5_rcache *rcache);
/**
* Retrieve the authenticator from an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [out] authenticator Authenticator
*
* Use krb5_free_authenticator() to free @a authenticator when it is no longer
* needed.
*
* @retval 0 Success. Otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_getauthenticator(krb5_context context, krb5_auth_context auth_context,
krb5_authenticator **authenticator);
/**
* Set checksum type in an an auth context.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] cksumtype Checksum type
*
* This function sets the checksum type in @a auth_context to be used by
* krb5_mk_req() for the authenticator checksum.
*
* @retval 0 Success. Otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_set_req_cksumtype(krb5_context context, krb5_auth_context auth_context,
krb5_cksumtype cksumtype);
#define KRB5_REALM_BRANCH_CHAR '.'
/*
* end "func-proto.h"
*/
/*
* begin stuff from libos.h
*/
/**
* @brief Read a password from keyboard input.
*
* @param [in] context Library context
* @param [in] prompt First user prompt when reading password
* @param [in] prompt2 Second user prompt (NULL to prompt only once)
* @param [out] return_pwd Returned password
* @param [in,out] size_return On input, maximum size of password; on output,
* size of password read
*
* This function reads a password from keyboard input and stores it in @a
* return_pwd. @a size_return should be set by the caller to the amount of
* storage space available in @a return_pwd; on successful return, it will be
* set to the length of the password read.
*
* @a prompt is printed to the terminal, followed by ": ", and then a password
* is read from the keyboard.
*
* If @a prompt2 is NULL, the password is read only once. Otherwise, @a
* prompt2 is printed to the terminal and a second password is read. If the
* two passwords entered are not identical, KRB5_LIBOS_BADPWDMATCH is returned.
*
* Echoing is turned off when the password is read.
*
* @retval
* 0 Success
* @return
* Error in reading or verifying the password
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_read_password(krb5_context context,
const char *prompt, const char *prompt2,
char *return_pwd, unsigned int *size_return);
/**
* Convert a principal name to a local name.
*
* @param [in] context Library context
* @param [in] aname Principal name
* @param [in] lnsize_in Space available in @a lname
* @param [out] lname Local name buffer to be filled in
*
* If @a aname does not correspond to any local account, KRB5_LNAME_NOTRANS is
* returned. If @a lnsize_in is too small for the local name,
* KRB5_CONFIG_NOTENUFSPACE is returned.
*
* Local names, rather than principal names, can be used by programs that
* translate to an environment-specific name (for example, a user account
* name).
*
* @retval
* 0 Success
* @retval
* System errors
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_aname_to_localname(krb5_context context, krb5_const_principal aname,
int lnsize_in, char *lname);
/**
* Get the Kerberos realm names for a host.
*
* @param [in] context Library context
* @param [in] host Host name (or NULL)
* @param [out] realmsp Null-terminated list of realm names
*
* Fill in @a realmsp with a pointer to a null-terminated list of realm names.
* If there are no known realms for the host, a list containing the referral
* (empty) realm is returned.
*
* If @a host is NULL, the local host's realms are determined.
*
* Use krb5_free_host_realm() to release @a realmsp when it is no longer
* needed.
*
* @retval
* 0 Success
* @retval
* ENOMEM Insufficient memory
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp);
/**
*
* @param [in] context Library context
* @param [in] hdata Host name (or NULL)
* @param [out] realmsp Null-terminated list of realm names
*
* Fill in @a realmsp with a pointer to a null-terminated list of realm names
* obtained through heuristics or insecure resolution methods which have lower
* priority than KDC referrals.
*
* If @a host is NULL, the local host's realms are determined.
*
* Use krb5_free_host_realm() to release @a realmsp when it is no longer
* needed.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_fallback_host_realm(krb5_context context,
krb5_data *hdata, char ***realmsp);
/**
* Free the memory allocated by krb5_get_host_realm().
*
* @param [in] context Library context
* @param [in] realmlist List of realm names to be released
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_free_host_realm(krb5_context context, char *const *realmlist);
/**
* Determine if a principal is authorized to log in as a local user.
*
* @param [in] context Library context
* @param [in] principal Principal name
* @param [in] luser Local username
*
* Determine whether @a principal is authorized to log in as a local user @a
* luser.
*
* @retval
* TRUE Principal is authorized to log in as user; FALSE otherwise.
*/
krb5_boolean KRB5_CALLCONV
krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser);
/**
* Generate auth context addresses from a connected socket.
*
* @param [in] context Library context
* @param [in] auth_context Authentication context
* @param [in] infd Connected socket descriptor
* @param [in] flags Flags
*
* This function sets the local and/or remote addresses in @a auth_context
* based on the local and remote endpoints of the socket @a infd. The
* following flags determine the operations performed:
*
* @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR Generate local address.
* @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR Generate remote address.
* @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR Generate local address and port.
* @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR Generate remote address and port.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context,
int infd, int flags);
/**
* Set time offset field in a krb5_context structure.
*
* @param [in] context Library context
* @param [in] seconds Real time, seconds portion
* @param [in] microseconds Real time, microseconds portion
*
* This function sets the time offset in @a context to the difference between
* the system time and the real time as determined by @a seconds and @a
* microseconds.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_set_real_time(krb5_context context, krb5_timestamp seconds,
krb5_int32 microseconds);
/**
* Return the time offsets from the os context.
*
* @param [in] context Library context
* @param [out] seconds Time offset, seconds portion
* @param [out] microseconds Time offset, microseconds portion
*
* This function returns the time offsets in @a context.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_time_offsets(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds);
/* str_conv.c */
/**
* Convert a string to an encryption type.
*
* @param [in] string String to convert to an encryption type
* @param [out] enctypep Encryption type
*
* @retval 0 Success; otherwise - EINVAL
*/
krb5_error_code KRB5_CALLCONV
krb5_string_to_enctype(char *string, krb5_enctype *enctypep);
/**
* Convert a string to a salt type.
*
* @param [in] string String to convert to an encryption type
* @param [out] salttypep Salt type to be filled in
*
* @retval 0 Success; otherwise - EINVAL
*/
krb5_error_code KRB5_CALLCONV
krb5_string_to_salttype(char *string, krb5_int32 *salttypep);
/**
* Convert a string to a checksum type.
*
* @param [in] string String to be converted
* @param [out] cksumtypep Checksum type to be filled in
*
* @retval 0 Success; otherwise - EINVAL
*/
krb5_error_code KRB5_CALLCONV
krb5_string_to_cksumtype(char *string, krb5_cksumtype *cksumtypep);
/**
* Convert a string to a timestamp.
*
* @param [in] string String to be converted
* @param [out] timestampp Pointer to timestamp
*
* @retval 0 Success; otherwise - EINVAL
*/
krb5_error_code KRB5_CALLCONV
krb5_string_to_timestamp(char *string, krb5_timestamp *timestampp);
/**
* Convert a string to a delta time value.
*
* @param [in] string String to be converted
* @param [out] deltatp Delta time to be filled in
*
* @retval 0 Success; otherwise - KRB5_DELTAT_BADFORMAT
*/
krb5_error_code KRB5_CALLCONV
krb5_string_to_deltat(char *string, krb5_deltat *deltatp);
/**
* Convert an encryption type to a string.
*
* @param [in] enctype Encryption type
* @param [out] buffer Buffer to hold encryption type string
* @param [in] buflen Storage available in @a buffer
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_enctype_to_string(krb5_enctype enctype, char *buffer, size_t buflen);
/**
* Convert an encryption type to a name or alias.
*
* @param [in] enctype Encryption type
* @param [in] shortest Flag
* @param [out] buffer Buffer to hold encryption type string
* @param [in] buflen Storage available in @a buffer
*
* If @a shortest is FALSE, this function returns the enctype's canonical name
* (like "aes128-cts-hmac-sha1-96"). If @a shortest is TRUE, it return the
* enctype's shortest alias (like "aes128-cts").
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_enctype_to_name(krb5_enctype enctype, krb5_boolean shortest,
char *buffer, size_t buflen);
/**
* Convert a salt type to a string.
*
* @param [in] salttype Salttype to convert
* @param [out] buffer Buffer to receive the converted string
* @param [in] buflen Storage available in @a buffer
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_salttype_to_string(krb5_int32 salttype, char *buffer, size_t buflen);
/**
* Convert a checksum type to a string.
*
* @param [in] cksumtype Checksum type
* @param [out] buffer Buffer to hold converted checksum type
* @param [in] buflen Storage available in @a buffer
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_cksumtype_to_string(krb5_cksumtype cksumtype, char *buffer, size_t buflen);
/**
* Convert a timestamp to a string.
*
* @param [in] timestamp Timestamp to convert
* @param [out] buffer Buffer to hold converted timestamp
* @param [in] buflen Storage available in @a buffer
*
* The string is returned in the locale's appropriate date and time
* representation.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_timestamp_to_string(krb5_timestamp timestamp, char *buffer, size_t buflen);
/**
* Convert a timestamp to a string, with optional output padding
*
* @param [in] timestamp Timestamp to convert
* @param [out] buffer Buffer to hold the converted timestamp
* @param [in] buflen Length of buffer
* @param [in] pad Optional value to pad @a buffer if converted
* timestamp does not fill it
*
* If @a pad is not NULL, @a buffer is padded out to @a buflen - 1 characters
* with the value of *@a pad.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_timestamp_to_sfstring(krb5_timestamp timestamp, char *buffer,
size_t buflen, char *pad);
/**
* Convert a relative time value to a string.
*
* @param [in] deltat Relative time value to convert
* @param [out] buffer Buffer to hold time string
* @param [in] buflen Storage available in @a buffer
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_deltat_to_string(krb5_deltat deltat, char *buffer, size_t buflen);
/* The name of the Kerberos ticket granting service... and its size */
#define KRB5_TGS_NAME "krbtgt"
#define KRB5_TGS_NAME_SIZE 6
/* flags for recvauth */
#define KRB5_RECVAUTH_SKIP_VERSION 0x0001
#define KRB5_RECVAUTH_BADAUTHVERS 0x0002
/* initial ticket api functions */
/** Text for prompt used in prompter callback function. */
typedef struct _krb5_prompt {
char *prompt; /**< The prompt to show to the user */
int hidden; /**< Boolean; informative prompt or hidden (e.g. PIN) */
krb5_data *reply; /**< Must be allocated before call to prompt routine */
} krb5_prompt;
/** Pointer to a prompter callback function. */
typedef krb5_error_code
(KRB5_CALLCONV *krb5_prompter_fct)(krb5_context context, void *data,
const char *name, const char *banner,
int num_prompts, krb5_prompt prompts[]);
/**
* Prompt user for password.
*
* @param [in] context Library context
* @param data Unused (callback argument)
* @param [in] name Name to output during prompt
* @param [in] banner Banner to output during prompt
* @param [in] num_prompts Number of prompts in @a prompts
* @param [in] prompts Array of prompts and replies
*
* This function is intended to be used as a prompter callback for
* krb5_get_init_creds_password() or krb5_init_creds_init().
*
* Writes @a name and @a banner to stdout, each followed by a newline, then
* writes each prompt field in the @a prompts array, followed by ": ", and sets
* the reply field of the entry to a line of input read from stdin. If the
* hidden flag is set for a prompt, then terminal echoing is turned off when
* input is read.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*
*/
krb5_error_code KRB5_CALLCONV
krb5_prompter_posix(krb5_context context, void *data, const char *name,
const char *banner, int num_prompts,
krb5_prompt prompts[]);
/**
* Long-term password responder question
*
* This question is asked when the long-term password is needed. It has no
* challenge and the response is simply the password string.
*
* @version New in 1.11
*/
#define KRB5_RESPONDER_QUESTION_PASSWORD "password"
/**
* OTP responder question
*
* The OTP responder question is asked when the KDC indicates that an OTP
* value is required in order to complete the authentication. The JSON format
* of the challenge is:
*
* @n {
* @n "service": <string (optional)>,
* @n "tokenInfo": [
* @n {
* @n "flags": <number>,
* @n "vendor": <string (optional)>,
* @n "challenge": <string (optional)>,
* @n "length": <number (optional)>,
* @n "format": <number (optional)>,
* @n "tokenID": <string (optional)>,
* @n "algID": <string (optional)>,
* @n },
* @n ...
* @n ]
* @n }
*
* The answer to the question MUST be JSON formatted:
*
* @n {
* @n "tokeninfo": <number>,
* @n "value": <string (optional)>,
* @n "pin": <string (optional)>,
* @n }
*
* For more detail, please see RFC 6560.
*
* @version New in 1.11
*/
#define KRB5_RESPONDER_QUESTION_OTP "otp"
/**
* These format constants identify the format of the token value.
*/
#define KRB5_RESPONDER_OTP_FORMAT_DECIMAL 0
#define KRB5_RESPONDER_OTP_FORMAT_HEXADECIMAL 1
#define KRB5_RESPONDER_OTP_FORMAT_ALPHANUMERIC 2
/**
* This flag indicates that the token value MUST be collected.
*/
#define KRB5_RESPONDER_OTP_FLAGS_COLLECT_TOKEN 0x0001
/**
* This flag indicates that the PIN value MUST be collected.
*/
#define KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN 0x0002
/**
* This flag indicates that the token is now in re-synchronization mode with
* the server. The user is expected to reply with the next code displayed on
* the token.
*/
#define KRB5_RESPONDER_OTP_FLAGS_NEXTOTP 0x0004
/**
* This flag indicates that the PIN MUST be returned as a separate item. This
* flag only takes effect if KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN is set. If
* this flag is not set, the responder may either concatenate PIN + token value
* and store it as "value" in the answer or it may return them separately. If
* they are returned separately, they will be concatenated internally.
*/
#define KRB5_RESPONDER_OTP_FLAGS_SEPARATE_PIN 0x0008
/**
* PKINIT responder question
*
* The PKINIT responder question is asked when the client needs a password
* that's being used to protect key information, and is formatted as a JSON
* object. A specific identity's flags value, if not zero, is the bitwise-OR
* of one or more of the KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_* flags defined
* below, and possibly other flags to be added later. Any resemblance to
* similarly-named CKF_* values in the PKCS#11 API should not be depended on.
*
* @n {
* @n identity <string> : flags <number>,
* @n ...
* @n }
*
* The answer to the question MUST be JSON formatted:
*
* @n {
* @n identity <string> : password <string>,
* @n ...
* @n }
*
* @version New in 1.12
*/
#define KRB5_RESPONDER_QUESTION_PKINIT "pkinit"
/**
* This flag indicates that an incorrect PIN was supplied at least once since
* the last time the correct PIN was supplied.
*/
#define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_COUNT_LOW (1 << 0)
/**
* This flag indicates that supplying an incorrect PIN will cause the token to
* lock itself.
*/
#define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_FINAL_TRY (1 << 1)
/**
* This flag indicates that the user PIN is locked, and you can't log in to the
* token with it.
*/
#define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_LOCKED (1 << 2)
/**
* A container for a set of preauthentication questions and answers
*
* A responder context is supplied by the krb5 authentication system to a @ref
* krb5_responder_fn callback. It contains a list of questions and can receive
* answers. Questions contained in a responder context can be listed using
* krb5_responder_list_questions(), retrieved using
* krb5_responder_get_challenge(), or answered using
* krb5_responder_set_answer(). The form of a question's challenge and
* answer depend on the question name.
*
* @version New in 1.11
*/
typedef struct krb5_responder_context_st *krb5_responder_context;
/**
* List the question names contained in the responder context.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
*
* Return a pointer to a null-terminated list of question names which are
* present in @a rctx. The pointer is an alias, valid only as long as the
* lifetime of @a rctx, and should not be modified or freed by the caller. A
* question's challenge can be retrieved using krb5_responder_get_challenge()
* and answered using krb5_responder_set_answer().
*
* @version New in 1.11
*/
const char * const * KRB5_CALLCONV
krb5_responder_list_questions(krb5_context ctx, krb5_responder_context rctx);
/**
* Retrieve the challenge data for a given question in the responder context.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [in] question Question name
*
* Return a pointer to a C string containing the challenge for @a question
* within @a rctx, or NULL if the question is not present in @a rctx. The
* structure of the question depends on the question name, but will always be
* printable UTF-8 text. The returned pointer is an alias, valid only as long
* as the lifetime of @a rctx, and should not be modified or freed by the
* caller.
*
* @version New in 1.11
*/
const char * KRB5_CALLCONV
krb5_responder_get_challenge(krb5_context ctx, krb5_responder_context rctx,
const char *question);
/**
* Answer a named question in the responder context.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [in] question Question name
* @param [in] answer The string to set (MUST be printable UTF-8)
*
* This function supplies an answer to @a question within @a rctx. The
* appropriate form of the answer depends on the question name.
*
* @retval EINVAL @a question is not present within @a rctx
*
* @version New in 1.11
*/
krb5_error_code KRB5_CALLCONV
krb5_responder_set_answer(krb5_context ctx, krb5_responder_context rctx,
const char *question, const char *answer);
/**
* Responder function for an initial credential exchange.
*
* @param [in] ctx Library context
* @param [in] data Callback data
* @param [in] rctx Responder context
*
* A responder function is like a prompter function, but is used for handling
* questions and answers as potentially complex data types. Client
* preauthentication modules will insert a set of named "questions" into
* the responder context. Each question may optionally contain a challenge.
* This challenge is printable UTF-8, but may be an encoded value. The
* precise encoding and contents of the challenge are specific to the question
* asked. When the responder is called, it should answer all the questions it
* understands. Like the challenge, the answer MUST be printable UTF-8, but
* may contain structured/encoded data formatted to the expected answer format
* of the question.
*
* If a required question is unanswered, the prompter may be called.
*/
typedef krb5_error_code
(KRB5_CALLCONV *krb5_responder_fn)(krb5_context ctx, void *data,
krb5_responder_context rctx);
typedef struct _krb5_responder_otp_tokeninfo {
krb5_flags flags;
krb5_int32 format; /* -1 when not specified. */
krb5_int32 length; /* -1 when not specified. */
char *vendor;
char *challenge;
char *token_id;
char *alg_id;
} krb5_responder_otp_tokeninfo;
typedef struct _krb5_responder_otp_challenge {
char *service;
krb5_responder_otp_tokeninfo **tokeninfo;
} krb5_responder_otp_challenge;
/**
* Decode the KRB5_RESPONDER_QUESTION_OTP to a C struct.
*
* A convenience function which parses the KRB5_RESPONDER_QUESTION_OTP
* question challenge data, making it available in native C. The main feature
* of this function is the ability to interact with OTP tokens without parsing
* the JSON.
*
* The returned value must be passed to krb5_responder_otp_challenge_free() to
* be freed.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [out] chl Challenge structure
*
* @version New in 1.11
*/
krb5_error_code KRB5_CALLCONV
krb5_responder_otp_get_challenge(krb5_context ctx,
krb5_responder_context rctx,
krb5_responder_otp_challenge **chl);
/**
* Answer the KRB5_RESPONDER_QUESTION_OTP question.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [in] ti The index of the tokeninfo selected
* @param [in] value The value to set, or NULL for none
* @param [in] pin The pin to set, or NULL for none
*
* @version New in 1.11
*/
krb5_error_code KRB5_CALLCONV
krb5_responder_otp_set_answer(krb5_context ctx, krb5_responder_context rctx,
size_t ti, const char *value, const char *pin);
/**
* Free the value returned by krb5_responder_otp_get_challenge().
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [in] chl The challenge to free
*
* @version New in 1.11
*/
void KRB5_CALLCONV
krb5_responder_otp_challenge_free(krb5_context ctx,
krb5_responder_context rctx,
krb5_responder_otp_challenge *chl);
typedef struct _krb5_responder_pkinit_identity {
char *identity;
krb5_int32 token_flags; /* 0 when not specified or not applicable. */
} krb5_responder_pkinit_identity;
typedef struct _krb5_responder_pkinit_challenge {
krb5_responder_pkinit_identity **identities;
} krb5_responder_pkinit_challenge;
/**
* Decode the KRB5_RESPONDER_QUESTION_PKINIT to a C struct.
*
* A convenience function which parses the KRB5_RESPONDER_QUESTION_PKINIT
* question challenge data, making it available in native C. The main feature
* of this function is the ability to read the challenge without parsing
* the JSON.
*
* The returned value must be passed to krb5_responder_pkinit_challenge_free()
* to be freed.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [out] chl_out Challenge structure
*
* @version New in 1.12
*/
krb5_error_code KRB5_CALLCONV
krb5_responder_pkinit_get_challenge(krb5_context ctx,
krb5_responder_context rctx,
krb5_responder_pkinit_challenge **chl_out);
/**
* Answer the KRB5_RESPONDER_QUESTION_PKINIT question for one identity.
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [in] identity The identity for which a PIN is being supplied
* @param [in] pin The provided PIN, or NULL for none
*
* @version New in 1.12
*/
krb5_error_code KRB5_CALLCONV
krb5_responder_pkinit_set_answer(krb5_context ctx, krb5_responder_context rctx,
const char *identity, const char *pin);
/**
* Free the value returned by krb5_responder_pkinit_get_challenge().
*
* @param [in] ctx Library context
* @param [in] rctx Responder context
* @param [in] chl The challenge to free
*
* @version New in 1.12
*/
void KRB5_CALLCONV
krb5_responder_pkinit_challenge_free(krb5_context ctx,
krb5_responder_context rctx,
krb5_responder_pkinit_challenge *chl);
/** Store options for @c _krb5_get_init_creds */
typedef struct _krb5_get_init_creds_opt {
krb5_flags flags;
krb5_deltat tkt_life;
krb5_deltat renew_life;
int forwardable;
int proxiable;
krb5_enctype *etype_list;
int etype_list_length;
krb5_address **address_list;
krb5_preauthtype *preauth_list;
int preauth_list_length;
krb5_data *salt;
} krb5_get_init_creds_opt;
#define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001
#define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002
#define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004
#define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008
#define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010
#define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020
#define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040
#define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080
#define KRB5_GET_INIT_CREDS_OPT_CHG_PWD_PRMPT 0x0100
#define KRB5_GET_INIT_CREDS_OPT_CANONICALIZE 0x0200
#define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0400
/**
* Allocate a new initial credential options structure.
*
* @param [in] context Library context
* @param [out] opt New options structure
*
* This function is the preferred way to create an options structure for
* getting initial credentials, and is required to make use of certain options.
* Use krb5_get_init_creds_opt_free() to free @a opt when it is no longer
* needed.
*
* @retval 0 - Success; Kerberos errors otherwise.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_alloc(krb5_context context,
krb5_get_init_creds_opt **opt);
/**
* Free initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options structure to free
*
* @sa krb5_get_init_creds_opt_alloc()
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_free(krb5_context context,
krb5_get_init_creds_opt *opt);
/** @deprecated Use krb5_get_init_creds_opt_alloc() instead. */
void KRB5_CALLCONV
krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt);
/**
* Set the ticket lifetime in initial credential options.
*
* @param [in] opt Options structure
* @param [in] tkt_life Ticket lifetime
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt,
krb5_deltat tkt_life);
/**
* Set the ticket renewal lifetime in initial credential options.
*
* @param [in] opt Pointer to @a options field
* @param [in] renew_life Ticket renewal lifetime
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt,
krb5_deltat renew_life);
/**
* Set or unset the forwardable flag in initial credential options.
*
* @param [in] opt Options structure
* @param [in] forwardable Whether credentials should be forwardable
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt,
int forwardable);
/**
* Set or unset the proxiable flag in initial credential options.
*
* @param [in] opt Options structure
* @param [in] proxiable Whether credentials should be proxiable
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt,
int proxiable);
/**
* Set or unset the canonicalize flag in initial credential options.
*
* @param [in] opt Options structure
* @param [in] canonicalize Whether to canonicalize client principal
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_canonicalize(krb5_get_init_creds_opt *opt,
int canonicalize);
/**
* Set or unset the anonymous flag in initial credential options.
*
* @param [in] opt Options structure
* @param [in] anonymous Whether to make an anonymous request
*
* This function may be used to request anonymous credentials from the KDC by
* setting @a anonymous to non-zero. Note that anonymous credentials are only
* a request; clients must verify that credentials are anonymous if that is a
* requirement.
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt,
int anonymous);
/**
* Set allowable encryption types in initial credential options.
*
* @param [in] opt Options structure
* @param [in] etype_list Array of encryption types
* @param [in] etype_list_length Length of @a etype_list
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt,
krb5_enctype *etype_list,
int etype_list_length);
/**
* Set address restrictions in initial credential options.
*
* @param [in] opt Options structure
* @param [in] addresses Null-terminated array of addresses
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt,
krb5_address **addresses);
/**
* Set preauthentication types in initial credential options.
*
* @param [in] opt Options structure
* @param [in] preauth_list Array of preauthentication types
* @param [in] preauth_list_length Length of @a preauth_list
*
* This function can be used to perform optimistic preauthentication when
* getting initial credentials, in combination with
* krb5_get_init_creds_opt_set_salt() and krb5_get_init_creds_opt_set_pa().
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt,
krb5_preauthtype *preauth_list,
int preauth_list_length);
/**
* Set salt for optimistic preauthentication in initial credential options.
*
* @param [in] opt Options structure
* @param [in] salt Salt data
*
* When getting initial credentials with a password, a salt string it used to
* convert the password to a key. Normally this salt is obtained from the
* first KDC reply, but when performing optimistic preauthentication, the
* client may need to supply the salt string with this function.
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt,
krb5_data *salt);
/**
* Set or unset change-password-prompt flag in initial credential options.
*
* @param [in] opt Options structure
* @param [in] prompt Whether to prompt to change password
*
* This flag is on by default. It controls whether
* krb5_get_init_creds_password() will react to an expired-password error by
* prompting for a new password and attempting to change the old one.
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_set_change_password_prompt(krb5_get_init_creds_opt *opt,
int prompt);
/** Generic preauth option attribute/value pairs */
typedef struct _krb5_gic_opt_pa_data {
char *attr;
char *value;
} krb5_gic_opt_pa_data;
/**
* Supply options for preauthentication in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options structure
* @param [in] attr Preauthentication option name
* @param [in] value Preauthentication option value
*
* This function allows the caller to supply options for preauthentication.
* The values of @a attr and @a value are supplied to each preauthentication
* module available within @a context.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_pa(krb5_context context,
krb5_get_init_creds_opt *opt, const char *attr,
const char *value);
/**
* Set location of FAST armor ccache in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options
* @param [in] fast_ccache_name Credential cache name
*
* Sets the location of a credential cache containing an armor ticket to
* protect an initial credential exchange using the FAST protocol extension.
*
* In version 1.7, setting an armor ccache requires that FAST be used for the
* exchange. In version 1.8 or later, setting the armor ccache causes FAST to
* be used if the KDC supports it; krb5_get_init_creds_opt_set_fast_flags()
* must be used to require that FAST be used.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_fast_ccache_name(krb5_context context,
krb5_get_init_creds_opt *opt,
const char *fast_ccache_name);
/**
* Set FAST armor cache in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options
* @param [in] ccache Credential cache handle
*
* This function is similar to krb5_get_init_creds_opt_set_fast_ccache_name(),
* but uses a credential cache handle instead of a name.
*
* @version New in 1.9
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_fast_ccache(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_ccache ccache);
/**
* Set an input credential cache in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options
* @param [in] ccache Credential cache handle
*
* If an input credential cache is set, then the krb5_get_init_creds family of
* APIs will read settings from it. Setting an input ccache is desirable when
* the application wishes to perform authentication in the same way (using the
* same preauthentication mechanisms, and making the same non-security-
* sensitive choices) as the previous authentication attempt, which stored
* information in the passed-in ccache.
*
* @version New in 1.11
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_in_ccache(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_ccache ccache);
/**
* Set an output credential cache in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options
* @param [in] ccache Credential cache handle
*
* If an output credential cache is set, then the krb5_get_init_creds family of
* APIs will write credentials to it. Setting an output ccache is desirable
* both because it simplifies calling code and because it permits the
* krb5_get_init_creds APIs to write out configuration information about the
* realm to the ccache.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_out_ccache(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_ccache ccache);
/**
* @brief Ask the KDC to include or not include a PAC in the ticket
*
* @param [in] context Library context
* @param [in] opt Options structure
* @param [in] req_pac Whether to request a PAC or not
*
* If this option is set, the AS request will include a PAC-REQUEST pa-data
* item explicitly asking the KDC to either include or not include a privilege
* attribute certificate in the ticket authorization data. By default, no
* request is made; typically the KDC will default to including a PAC if it
* supports them.
*
* @version New in 1.15
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_pac_request(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_boolean req_pac);
/**
* Set FAST flags in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options
* @param [in] flags FAST flags
*
* The following flag values are valid:
* @li #KRB5_FAST_REQUIRED - Require FAST to be used
*
* @retval
* 0 - Success; Kerberos errors otherwise.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_fast_flags(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_flags flags);
/**
* Retrieve FAST flags from initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options
* @param [out] out_flags FAST flags
*
* @retval
* 0 - Success; Kerberos errors otherwise.
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_get_fast_flags(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_flags *out_flags);
/* Fast flags*/
#define KRB5_FAST_REQUIRED 0x0001 /**< Require KDC to support FAST*/
typedef void
(KRB5_CALLCONV *krb5_expire_callback_func)(krb5_context context, void *data,
krb5_timestamp password_expiration,
krb5_timestamp account_expiration,
krb5_boolean is_last_req);
/**
* Set an expiration callback in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options structure
* @param [in] cb Callback function
* @param [in] data Callback argument
*
* Set a callback to receive password and account expiration times.
*
* @a cb will be invoked if and only if credentials are successfully acquired.
* The callback will receive the @a context from the calling function and the
* @a data argument supplied with this API. The remaining arguments should be
* interpreted as follows:
*
* If @a is_last_req is true, then the KDC reply contained last-req entries
* which unambiguously indicated the password expiration, account expiration,
* or both. (If either value was not present, the corresponding argument will
* be 0.) Furthermore, a non-zero @a password_expiration should be taken as a
* suggestion from the KDC that a warning be displayed.
*
* If @a is_last_req is false, then @a account_expiration will be 0 and @a
* password_expiration will contain the expiration time of either the password
* or account, or 0 if no expiration time was indicated in the KDC reply. The
* callback should independently decide whether to display a password
* expiration warning.
*
* Note that @a cb may be invoked even if credentials are being acquired for
* the kadmin/changepw service in order to change the password. It is the
* caller's responsibility to avoid displaying a password expiry warning in
* this case.
*
* @warning Setting an expire callback with this API will cause
* krb5_get_init_creds_password() not to send password expiry warnings to the
* prompter, as it ordinarily may.
*
* @version New in 1.9
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_expire_callback(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_expire_callback_func cb,
void *data);
/**
* Set the responder function in initial credential options.
*
* @param [in] context Library context
* @param [in] opt Options structure
* @param [in] responder Responder function
* @param [in] data Responder data argument
*
* @version New in 1.11
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_set_responder(krb5_context context,
krb5_get_init_creds_opt *opt,
krb5_responder_fn responder, void *data);
/**
* Get initial credentials using a password.
*
* @param [in] context Library context
* @param [out] creds New credentials
* @param [in] client Client principal
* @param [in] password Password (or NULL)
* @param [in] prompter Prompter function
* @param [in] data Prompter callback data
* @param [in] start_time Time when ticket becomes valid (0 for now)
* @param [in] in_tkt_service Service name of initial credentials (or NULL)
* @param [in] k5_gic_options Initial credential options
*
* This function requests KDC for an initial credentials for @a client using @a
* password. If @a password is NULL, a password will be prompted for using @a
* prompter if necessary. If @a in_tkt_service is specified, it is parsed as a
* principal name (with the realm ignored) and used as the service principal
* for the request; otherwise the ticket-granting service is used.
*
* @sa krb5_verify_init_creds()
*
* @retval
* 0 Success
* @retval
* EINVAL Invalid argument
* @retval
* KRB5_KDC_UNREACH Cannot contact any KDC for requested realm
* @retval
* KRB5_PREAUTH_FAILED Generic Pre-athentication failure
* @retval
* KRB5_LIBOS_PWDINTR Password read interrupted
* @retval
* KRB5_REALM_CANT_RESOLVE Cannot resolve network address for KDC in requested realm
* @retval
* KRB5KDC_ERR_KEY_EXP Password has expired
* @retval
* KRB5_LIBOS_BADPWDMATCH Password mismatch
* @retval
* KRB5_CHPW_PWDNULL New password cannot be zero length
* @retval
* KRB5_CHPW_FAIL Password change failed
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_password(krb5_context context, krb5_creds *creds,
krb5_principal client, const char *password,
krb5_prompter_fct prompter, void *data,
krb5_deltat start_time,
const char *in_tkt_service,
krb5_get_init_creds_opt *k5_gic_options);
/**
* Retrieve enctype, salt and s2kparams from KDC
*
* @param [in] context Library context
* @param [in] principal Principal whose information is requested
* @param [in] opt Initial credential options
* @param [out] enctype_out The enctype chosen by KDC
* @param [out] salt_out Salt returned from KDC
* @param [out] s2kparams_out String-to-key parameters returned from KDC
*
* Send an initial ticket request for @a principal and extract the encryption
* type, salt type, and string-to-key parameters from the KDC response. If the
* KDC provides no etype-info, set @a enctype_out to @c ENCTYPE_NULL and set @a
* salt_out and @a s2kparams_out to empty. If the KDC etype-info provides no
* salt, compute the default salt and place it in @a salt_out. If the KDC
* etype-info provides no string-to-key parameters, set @a s2kparams_out to
* empty.
*
* @a opt may be used to specify options which affect the initial request, such
* as request encryption types or a FAST armor cache (see
* krb5_get_init_creds_opt_set_etype_list() and
* krb5_get_init_creds_opt_set_fast_ccache_name()).
*
* Use krb5_free_data_contents() to free @a salt_out and @a s2kparams_out when
* they are no longer needed.
*
* @version New in 1.17
*
* @retval 0 Success
* @return A Kerberos error code
*/
krb5_error_code KRB5_CALLCONV
krb5_get_etype_info(krb5_context context, krb5_principal principal,
krb5_get_init_creds_opt *opt, krb5_enctype *enctype_out,
krb5_data *salt_out, krb5_data *s2kparams_out);
struct _krb5_init_creds_context;
typedef struct _krb5_init_creds_context *krb5_init_creds_context;
#define KRB5_INIT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */
/**
* Free an initial credentials context.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
*
* @a context must be the same as the one passed to krb5_init_creds_init() for
* this initial credentials context.
*/
void KRB5_CALLCONV
krb5_init_creds_free(krb5_context context, krb5_init_creds_context ctx);
/**
* Acquire credentials using an initial credentials context.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
*
* This function synchronously obtains credentials using a context created by
* krb5_init_creds_init(). On successful return, the credentials can be
* retrieved with krb5_init_creds_get_creds().
*
* @a context must be the same as the one passed to krb5_init_creds_init() for
* this initial credentials context.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_get(krb5_context context, krb5_init_creds_context ctx);
/**
* Retrieve acquired credentials from an initial credentials context.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [out] creds Acquired credentials
*
* This function copies the acquired initial credentials from @a ctx into @a
* creds, after the successful completion of krb5_init_creds_get() or
* krb5_init_creds_step(). Use krb5_free_cred_contents() to free @a creds when
* it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_get_creds(krb5_context context, krb5_init_creds_context ctx,
krb5_creds *creds);
/**
* Get the last error from KDC from an initial credentials context.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [out] error Error from KDC, or NULL if none was received
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_get_error(krb5_context context, krb5_init_creds_context ctx,
krb5_error **error);
/**
* Create a context for acquiring initial credentials.
*
* @param [in] context Library context
* @param [in] client Client principal to get initial creds for
* @param [in] prompter Prompter callback
* @param [in] data Prompter callback argument
* @param [in] start_time Time when credentials become valid (0 for now)
* @param [in] options Options structure (NULL for default)
* @param [out] ctx New initial credentials context
*
* This function creates a new context for acquiring initial credentials. Use
* krb5_init_creds_free() to free @a ctx when it is no longer needed.
*
* Any subsequent calls to krb5_init_creds_step(), krb5_init_creds_get(), or
* krb5_init_creds_free() for this initial credentials context must use the
* same @a context argument as the one passed to this function.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_init(krb5_context context, krb5_principal client,
krb5_prompter_fct prompter, void *data,
krb5_deltat start_time, krb5_get_init_creds_opt *options,
krb5_init_creds_context *ctx);
/**
* Specify a keytab to use for acquiring initial credentials.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [in] keytab Key table handle
*
* This function supplies a keytab containing the client key for an initial
* credentials request.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_set_keytab(krb5_context context, krb5_init_creds_context ctx,
krb5_keytab keytab);
/**
* Get the next KDC request for acquiring initial credentials.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [in] in KDC response (empty on the first call)
* @param [out] out Next KDC request
* @param [out] realm Realm for next KDC request
* @param [out] flags Output flags
*
* This function constructs the next KDC request in an initial credential
* exchange, allowing the caller to control the transport of KDC requests and
* replies. On the first call, @a in should be set to an empty buffer; on
* subsequent calls, it should be set to the KDC's reply to the previous
* request.
*
* If more requests are needed, @a flags will be set to
* #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in
* @a out. If no more requests are needed, @a flags will not contain
* #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty.
*
* If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should
* transmit the next request using TCP rather than UDP. If this function
* returns any other error, the initial credential exchange has failed.
*
* @a context must be the same as the one passed to krb5_init_creds_init() for
* this initial credentials context.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_step(krb5_context context, krb5_init_creds_context ctx,
krb5_data *in, krb5_data *out, krb5_data *realm,
unsigned int *flags);
/**
* Set a password for acquiring initial credentials.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [in] password Password
*
* This function supplies a password to be used to construct the client key for
* an initial credentials request.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_set_password(krb5_context context, krb5_init_creds_context ctx,
const char *password);
/**
* Specify a service principal for acquiring initial credentials.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [in] service Service principal string
*
* This function supplies a service principal string to acquire initial
* credentials for instead of the default krbtgt service. @a service is parsed
* as a principal name; any realm part is ignored.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_set_service(krb5_context context, krb5_init_creds_context ctx,
const char *service);
/**
* Retrieve ticket times from an initial credentials context.
*
* @param [in] context Library context
* @param [in] ctx Initial credentials context
* @param [out] times Ticket times for acquired credentials
*
* The initial credentials context must have completed obtaining credentials
* via either krb5_init_creds_get() or krb5_init_creds_step().
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_init_creds_get_times(krb5_context context, krb5_init_creds_context ctx,
krb5_ticket_times *times);
struct _krb5_tkt_creds_context;
typedef struct _krb5_tkt_creds_context *krb5_tkt_creds_context;
/**
* Create a context to get credentials from a KDC's Ticket Granting Service.
*
* @param[in] context Library context
* @param[in] ccache Credential cache handle
* @param[in] creds Input credentials
* @param[in] options @ref KRB5_GC options for this request.
* @param[out] ctx New TGS request context
*
* This function prepares to obtain credentials matching @a creds, either by
* retrieving them from @a ccache or by making requests to ticket-granting
* services beginning with a ticket-granting ticket for the client principal's
* realm.
*
* The resulting TGS acquisition context can be used asynchronously with
* krb5_tkt_creds_step() or synchronously with krb5_tkt_creds_get(). See also
* krb5_get_credentials() for synchronous use.
*
* Use krb5_tkt_creds_free() to free @a ctx when it is no longer needed.
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_tkt_creds_init(krb5_context context, krb5_ccache ccache,
krb5_creds *creds, krb5_flags options,
krb5_tkt_creds_context *ctx);
/**
* Synchronously obtain credentials using a TGS request context.
*
* @param[in] context Library context
* @param[in] ctx TGS request context
*
* This function synchronously obtains credentials using a context created by
* krb5_tkt_creds_init(). On successful return, the credentials can be
* retrieved with krb5_tkt_creds_get_creds().
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_tkt_creds_get(krb5_context context, krb5_tkt_creds_context ctx);
/**
* Retrieve acquired credentials from a TGS request context.
*
* @param[in] context Library context
* @param[in] ctx TGS request context
* @param[out] creds Acquired credentials
*
* This function copies the acquired initial credentials from @a ctx into @a
* creds, after the successful completion of krb5_tkt_creds_get() or
* krb5_tkt_creds_step(). Use krb5_free_cred_contents() to free @a creds when
* it is no longer needed.
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_tkt_creds_get_creds(krb5_context context, krb5_tkt_creds_context ctx,
krb5_creds *creds);
/**
* Free a TGS request context.
*
* @param[in] context Library context
* @param[in] ctx TGS request context
*
* @version New in 1.9
*/
void KRB5_CALLCONV
krb5_tkt_creds_free(krb5_context context, krb5_tkt_creds_context ctx);
#define KRB5_TKT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */
/**
* Get the next KDC request in a TGS exchange.
*
* @param[in] context Library context
* @param[in] ctx TGS request context
* @param[in] in KDC response (empty on the first call)
* @param[out] out Next KDC request
* @param[out] realm Realm for next KDC request
* @param[out] flags Output flags
*
* This function constructs the next KDC request for a TGS exchange, allowing
* the caller to control the transport of KDC requests and replies. On the
* first call, @a in should be set to an empty buffer; on subsequent calls, it
* should be set to the KDC's reply to the previous request.
*
* If more requests are needed, @a flags will be set to
* #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in @a
* out. If no more requests are needed, @a flags will not contain
* #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty.
*
* If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should
* transmit the next request using TCP rather than UDP. If this function
* returns any other error, the TGS exchange has failed.
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_tkt_creds_step(krb5_context context, krb5_tkt_creds_context ctx,
krb5_data *in, krb5_data *out, krb5_data *realm,
unsigned int *flags);
/**
* Retrieve ticket times from a TGS request context.
*
* @param[in] context Library context
* @param[in] ctx TGS request context
* @param[out] times Ticket times for acquired credentials
*
* The TGS request context must have completed obtaining credentials via either
* krb5_tkt_creds_get() or krb5_tkt_creds_step().
*
* @version New in 1.9
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_tkt_creds_get_times(krb5_context context, krb5_tkt_creds_context ctx,
krb5_ticket_times *times);
/**
* Get initial credentials using a key table.
*
* @param [in] context Library context
* @param [out] creds New credentials
* @param [in] client Client principal
* @param [in] arg_keytab Key table handle
* @param [in] start_time Time when ticket becomes valid (0 for now)
* @param [in] in_tkt_service Service name of initial credentials (or NULL)
* @param [in] k5_gic_options Initial credential options
*
* This function requests KDC for an initial credentials for @a client using a
* client key stored in @a arg_keytab. If @a in_tkt_service is specified, it
* is parsed as a principal name (with the realm ignored) and used as the
* service principal for the request; otherwise the ticket-granting service is
* used.
*
* @sa krb5_verify_init_creds()
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_keytab(krb5_context context, krb5_creds *creds,
krb5_principal client, krb5_keytab arg_keytab,
krb5_deltat start_time, const char *in_tkt_service,
krb5_get_init_creds_opt *k5_gic_options);
typedef struct _krb5_verify_init_creds_opt {
krb5_flags flags;
int ap_req_nofail; /**< boolean */
} krb5_verify_init_creds_opt;
#define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001
/**
* Initialize a credential verification options structure.
*
* @param [in] k5_vic_options Verification options structure
*/
void KRB5_CALLCONV
krb5_verify_init_creds_opt_init(krb5_verify_init_creds_opt *k5_vic_options);
/**
* Set whether credential verification is required.
*
* @param [in] k5_vic_options Verification options structure
* @param [in] ap_req_nofail Whether to require successful verification
*
* This function determines how krb5_verify_init_creds() behaves if no keytab
* information is available. If @a ap_req_nofail is @c FALSE, verification
* will be skipped in this case and krb5_verify_init_creds() will return
* successfully. If @a ap_req_nofail is @c TRUE, krb5_verify_init_creds() will
* not return successfully unless verification can be performed.
*
* If this function is not used, the behavior of krb5_verify_init_creds() is
* determined through configuration.
*/
void KRB5_CALLCONV
krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_verify_init_creds_opt * k5_vic_options,
int ap_req_nofail);
/**
* Verify initial credentials against a keytab.
*
* @param [in] context Library context
* @param [in] creds Initial credentials to be verified
* @param [in] server Server principal (or NULL)
* @param [in] keytab Key table (NULL to use default keytab)
* @param [in] ccache Credential cache for fetched creds (or NULL)
* @param [in] options Verification options (NULL for default options)
*
* This function attempts to verify that @a creds were obtained from a KDC with
* knowledge of a key in @a keytab, or the default keytab if @a keytab is NULL.
* If @a server is provided, the highest-kvno key entry for that principal name
* is used to verify the credentials; otherwise, all unique "host" service
* principals in the keytab are tried.
*
* If the specified keytab does not exist, or is empty, or cannot be read, or
* does not contain an entry for @a server, then credential verification may be
* skipped unless configuration demands that it succeed. The caller can
* control this behavior by providing a verification options structure; see
* krb5_verify_init_creds_opt_init() and
* krb5_verify_init_creds_opt_set_ap_req_nofail().
*
* If @a ccache is NULL, any additional credentials fetched during the
* verification process will be destroyed. If @a ccache points to NULL, a
* memory ccache will be created for the additional credentials and returned in
* @a ccache. If @a ccache points to a valid credential cache handle, the
* additional credentials will be stored in that cache.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_verify_init_creds(krb5_context context, krb5_creds *creds,
krb5_principal server, krb5_keytab keytab,
krb5_ccache *ccache,
krb5_verify_init_creds_opt *options);
/**
* Get validated credentials from the KDC.
*
* @param [in] context Library context
* @param [out] creds Validated credentials
* @param [in] client Client principal name
* @param [in] ccache Credential cache
* @param [in] in_tkt_service Server principal string (or NULL)
*
* This function gets a validated credential using a postdated credential from
* @a ccache. If @a in_tkt_service is specified, it is parsed (with the realm
* part ignored) and used as the server principal of the credential;
* otherwise, the ticket-granting service is used.
*
* If successful, the validated credential is placed in @a creds.
*
* @sa krb5_get_renewed_creds()
*
* @retval
* 0 Success
* @retval
* KRB5_NO_2ND_TKT Request missing second ticket
* @retval
* KRB5_NO_TKT_SUPPLIED Request did not supply a ticket
* @retval
* KRB5_PRINC_NOMATCH Requested principal and ticket do not match
* @retval
* KRB5_KDCREP_MODIFIED KDC reply did not match expectations
* @retval
* KRB5_KDCREP_SKEW Clock skew too great in KDC reply
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_validated_creds(krb5_context context, krb5_creds *creds,
krb5_principal client, krb5_ccache ccache,
const char *in_tkt_service);
/**
* Get renewed credential from KDC using an existing credential.
*
* @param [in] context Library context
* @param [out] creds Renewed credentials
* @param [in] client Client principal name
* @param [in] ccache Credential cache
* @param [in] in_tkt_service Server principal string (or NULL)
*
* This function gets a renewed credential using an existing one from @a
* ccache. If @a in_tkt_service is specified, it is parsed (with the realm
* part ignored) and used as the server principal of the credential; otherwise,
* the ticket-granting service is used.
*
* If successful, the renewed credential is placed in @a creds.
*
* @retval
* 0 Success
* @return
* Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_get_renewed_creds(krb5_context context, krb5_creds *creds,
krb5_principal client, krb5_ccache ccache,
const char *in_tkt_service);
/**
* Decode an ASN.1-formatted ticket.
*
* @param [in] code ASN.1-formatted ticket
* @param [out] rep Decoded ticket information
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_decode_ticket(const krb5_data *code, krb5_ticket **rep);
/**
* Retrieve a string value from the appdefaults section of krb5.conf.
*
* @param [in] context Library context
* @param [in] appname Application name
* @param [in] realm Realm name
* @param [in] option Option to be checked
* @param [in] default_value Default value to return if no match is found
* @param [out] ret_value String value of @a option
*
* This function gets the application defaults for @a option based on the given
* @a appname and/or @a realm.
*
* @sa krb5_appdefault_boolean()
*/
void KRB5_CALLCONV
krb5_appdefault_string(krb5_context context, const char *appname,
const krb5_data *realm, const char *option,
const char *default_value, char ** ret_value);
/**
* Retrieve a boolean value from the appdefaults section of krb5.conf.
*
* @param [in] context Library context
* @param [in] appname Application name
* @param [in] realm Realm name
* @param [in] option Option to be checked
* @param [in] default_value Default value to return if no match is found
* @param [out] ret_value Boolean value of @a option
*
* This function gets the application defaults for @a option based on the given
* @a appname and/or @a realm.
*
* @sa krb5_appdefault_string()
*/
void KRB5_CALLCONV
krb5_appdefault_boolean(krb5_context context, const char *appname,
const krb5_data *realm, const char *option,
int default_value, int *ret_value);
/*
* Prompter enhancements
*/
/** Prompt for password */
#define KRB5_PROMPT_TYPE_PASSWORD 0x1
/** Prompt for new password (during password change) */
#define KRB5_PROMPT_TYPE_NEW_PASSWORD 0x2
/** Prompt for new password again */
#define KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN 0x3
/** Prompt for preauthentication data (such as an OTP value) */
#define KRB5_PROMPT_TYPE_PREAUTH 0x4
typedef krb5_int32 krb5_prompt_type;
/**
* Get prompt types array from a context.
*
* @param [in] context Library context
*
* @return
* Pointer to an array of prompt types corresponding to the prompter's @a
* prompts arguments. Each type has one of the following values:
* @li #KRB5_PROMPT_TYPE_PASSWORD
* @li #KRB5_PROMPT_TYPE_NEW_PASSWORD
* @li #KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN
* @li #KRB5_PROMPT_TYPE_PREAUTH
*/
krb5_prompt_type* KRB5_CALLCONV
krb5_get_prompt_types(krb5_context context);
/* Error reporting */
/**
* Set an extended error message for an error code.
*
* @param [in] ctx Library context
* @param [in] code Error code
* @param [in] fmt Error string for the error code
* @param [in] ... printf(3) style parameters
*/
void KRB5_CALLCONV_C
krb5_set_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, ...)
#if !defined(__cplusplus) && (__GNUC__ > 2)
__attribute__((__format__(__printf__, 3, 4)))
#endif
;
/**
* Set an extended error message for an error code using a va_list.
*
* @param [in] ctx Library context
* @param [in] code Error code
* @param [in] fmt Error string for the error code
* @param [in] args List of vprintf(3) style arguments
*/
void KRB5_CALLCONV
krb5_vset_error_message(krb5_context ctx, krb5_error_code code,
const char *fmt, va_list args)
#if !defined(__cplusplus) && (__GNUC__ > 2)
__attribute__((__format__(__printf__, 3, 0)))
#endif
;
/**
* Add a prefix to the message for an error code.
*
* @param [in] ctx Library context
* @param [in] code Error code
* @param [in] fmt Format string for error message prefix
* @param [in] ... printf(3) style parameters
*
* Format a message and prepend it to the current message for @a code. The
* prefix will be separated from the old message with a colon and space.
*/
void KRB5_CALLCONV_C
krb5_prepend_error_message(krb5_context ctx, krb5_error_code code,
const char *fmt, ...)
#if !defined(__cplusplus) && (__GNUC__ > 2)
__attribute__((__format__(__printf__, 3, 4)))
#endif
;
/**
* Add a prefix to the message for an error code using a va_list.
*
* @param [in] ctx Library context
* @param [in] code Error code
* @param [in] fmt Format string for error message prefix
* @param [in] args List of vprintf(3) style arguments
*
* This function is similar to krb5_prepend_error_message(), but uses a
* va_list instead of variadic arguments.
*/
void KRB5_CALLCONV
krb5_vprepend_error_message(krb5_context ctx, krb5_error_code code,
const char *fmt, va_list args)
#if !defined(__cplusplus) && (__GNUC__ > 2)
__attribute__((__format__(__printf__, 3, 0)))
#endif
;
/**
* Add a prefix to a different error code's message.
*
* @param [in] ctx Library context
* @param [in] old_code Previous error code
* @param [in] code Error code
* @param [in] fmt Format string for error message prefix
* @param [in] ... printf(3) style parameters
*
* Format a message and prepend it to the message for @a old_code. The prefix
* will be separated from the old message with a colon and space. Set the
* resulting message as the extended error message for @a code.
*/
void KRB5_CALLCONV_C
krb5_wrap_error_message(krb5_context ctx, krb5_error_code old_code,
krb5_error_code code, const char *fmt, ...)
#if !defined(__cplusplus) && (__GNUC__ > 2)
__attribute__((__format__(__printf__, 4, 5)))
#endif
;
/**
* Add a prefix to a different error code's message using a va_list.
*
* @param [in] ctx Library context
* @param [in] old_code Previous error code
* @param [in] code Error code
* @param [in] fmt Format string for error message prefix
* @param [in] args List of vprintf(3) style arguments
*
* This function is similar to krb5_wrap_error_message(), but uses a
* va_list instead of variadic arguments.
*/
void KRB5_CALLCONV
krb5_vwrap_error_message(krb5_context ctx, krb5_error_code old_code,
krb5_error_code code, const char *fmt, va_list args)
#if !defined(__cplusplus) && (__GNUC__ > 2)
__attribute__((__format__(__printf__, 4, 0)))
#endif
;
/**
* Copy the most recent extended error message from one context to another.
*
* @param [in] dest_ctx Library context to copy message to
* @param [in] src_ctx Library context with current message
*/
void KRB5_CALLCONV
krb5_copy_error_message(krb5_context dest_ctx, krb5_context src_ctx);
/**
* Get the (possibly extended) error message for a code.
*
* @param [in] ctx Library context
* @param [in] code Error code
*
* The behavior of krb5_get_error_message() is only defined the first time it
* is called after a failed call to a krb5 function using the same context, and
* only when the error code passed in is the same as that returned by the krb5
* function.
*
* This function never returns NULL, so its result may be used unconditionally
* as a C string.
*
* The string returned by this function must be freed using
* krb5_free_error_message()
*
* @note Future versions may return the same string for the second
* and following calls.
*/
const char * KRB5_CALLCONV
krb5_get_error_message(krb5_context ctx, krb5_error_code code);
/**
* Free an error message generated by krb5_get_error_message().
*
* @param [in] ctx Library context
* @param [in] msg Pointer to error message
*/
void KRB5_CALLCONV
krb5_free_error_message(krb5_context ctx, const char *msg);
/**
* Clear the extended error message in a context.
*
* @param [in] ctx Library context
*
* This function unsets the extended error message in a context, to ensure that
* it is not mistakenly applied to another occurrence of the same error code.
*/
void KRB5_CALLCONV
krb5_clear_error_message(krb5_context ctx);
/**
* Unwrap authorization data.
*
* @param [in] context Library context
* @param [in] type @ref KRB5_AUTHDATA type of @a container
* @param [in] container Authorization data to be decoded
* @param [out] authdata List of decoded authorization data
*
* @sa krb5_encode_authdata_container()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_decode_authdata_container(krb5_context context,
krb5_authdatatype type,
const krb5_authdata *container,
krb5_authdata ***authdata);
/**
* Wrap authorization data in a container.
*
* @param [in] context Library context
* @param [in] type @ref KRB5_AUTHDATA type of @a container
* @param [in] authdata List of authorization data to be encoded
* @param [out] container List of encoded authorization data
*
* The result is returned in @a container as a single-element list.
*
* @sa krb5_decode_authdata_container()
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_encode_authdata_container(krb5_context context,
krb5_authdatatype type,
krb5_authdata * const*authdata,
krb5_authdata ***container);
/*
* AD-KDCIssued
*/
/**
* Encode and sign AD-KDCIssued authorization data.
*
* @param [in] context Library context
* @param [in] key Session key
* @param [in] issuer The name of the issuing principal
* @param [in] authdata List of authorization data to be signed
* @param [out] ad_kdcissued List containing AD-KDCIssued authdata
*
* This function wraps a list of authorization data entries @a authdata in an
* AD-KDCIssued container (see RFC 4120 section 5.2.6.2) signed with @a key.
* The result is returned in @a ad_kdcissued as a single-element list.
*/
krb5_error_code KRB5_CALLCONV
krb5_make_authdata_kdc_issued(krb5_context context,
const krb5_keyblock *key,
krb5_const_principal issuer,
krb5_authdata *const *authdata,
krb5_authdata ***ad_kdcissued);
/**
* Unwrap and verify AD-KDCIssued authorization data.
*
* @param [in] context Library context
* @param [in] key Session key
* @param [in] ad_kdcissued AD-KDCIssued authorization data to be unwrapped
* @param [out] issuer Name of issuing principal (or NULL)
* @param [out] authdata Unwrapped list of authorization data
*
* This function unwraps an AD-KDCIssued authdatum (see RFC 4120 section
* 5.2.6.2) and verifies its signature against @a key. The issuer field of the
* authdatum element is returned in @a issuer, and the unwrapped list of
* authdata is returned in @a authdata.
*/
krb5_error_code KRB5_CALLCONV
krb5_verify_authdata_kdc_issued(krb5_context context,
const krb5_keyblock *key,
const krb5_authdata *ad_kdcissued,
krb5_principal *issuer,
krb5_authdata ***authdata);
/*
* Windows PAC
*/
/* Microsoft defined types of data */
#define KRB5_PAC_LOGON_INFO 1 /**< Logon information */
#define KRB5_PAC_CREDENTIALS_INFO 2 /**< Credentials information */
#define KRB5_PAC_SERVER_CHECKSUM 6 /**< Server checksum */
#define KRB5_PAC_PRIVSVR_CHECKSUM 7 /**< KDC checksum */
#define KRB5_PAC_CLIENT_INFO 10 /**< Client name and ticket info */
#define KRB5_PAC_DELEGATION_INFO 11 /**< Constrained delegation info */
#define KRB5_PAC_UPN_DNS_INFO 12 /**< User principal name and DNS info */
#define KRB5_PAC_CLIENT_CLAIMS 13 /**< Client claims information */
#define KRB5_PAC_DEVICE_INFO 14 /**< Device information */
#define KRB5_PAC_DEVICE_CLAIMS 15 /**< Device claims information */
#define KRB5_PAC_TICKET_CHECKSUM 16 /**< Ticket checksum */
#define KRB5_PAC_ATTRIBUTES_INFO 17 /**< PAC attributes */
#define KRB5_PAC_REQUESTOR 18 /**< PAC requestor SID */
#define KRB5_PAC_FULL_CHECKSUM 19 /**< KDC full checksum */
struct krb5_pac_data;
/** PAC data structure to convey authorization information */
typedef struct krb5_pac_data *krb5_pac;
/**
* Add a buffer to a PAC handle.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [in] type Buffer type
* @param [in] data contents
*
* This function adds a buffer of type @a type and contents @a data to @a pac
* if there isn't already a buffer of this type present.
*
* The valid values of @a type is one of the following:
* @li #KRB5_PAC_LOGON_INFO - Logon information
* @li #KRB5_PAC_CREDENTIALS_INFO - Credentials information
* @li #KRB5_PAC_SERVER_CHECKSUM - Server checksum
* @li #KRB5_PAC_PRIVSVR_CHECKSUM - KDC checksum
* @li #KRB5_PAC_CLIENT_INFO - Client name and ticket information
* @li #KRB5_PAC_DELEGATION_INFO - Constrained delegation information
* @li #KRB5_PAC_UPN_DNS_INFO - User principal name and DNS information
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_add_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type,
const krb5_data *data);
/**
* Free a PAC handle.
*
* @param [in] context Library context
* @param [in] pac PAC to be freed
*
* This function frees the contents of @a pac and the structure itself.
*/
void KRB5_CALLCONV
krb5_pac_free(krb5_context context, krb5_pac pac);
/**
* Retrieve a buffer value from a PAC.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [in] type Type of buffer to retrieve
* @param [out] data Buffer value
*
* Use krb5_free_data_contents() to free @a data when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_get_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type,
krb5_data *data);
/**
* Return an array of buffer types in a PAC handle.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [out] len Number of entries in @a types
* @param [out] types Array of buffer types
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_get_types(krb5_context context, krb5_pac pac, size_t *len,
krb5_ui_4 **types);
/**
* Create an empty Privilege Attribute Certificate (PAC) handle.
*
* @param [in] context Library context
* @param [out] pac New PAC handle
*
* Use krb5_pac_free() to free @a pac when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_init(krb5_context context, krb5_pac *pac);
/**
* Unparse an encoded PAC into a new handle.
*
* @param [in] context Library context
* @param [in] ptr PAC buffer
* @param [in] len Length of @a ptr
* @param [out] pac PAC handle
*
* Use krb5_pac_free() to free @a pac when it is no longer needed.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_parse(krb5_context context, const void *ptr, size_t len,
krb5_pac *pac);
/**
* Verify a PAC.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [in] authtime Expected timestamp
* @param [in] principal Expected principal name (or NULL)
* @param [in] server Key to validate server checksum (or NULL)
* @param [in] privsvr Key to validate KDC checksum (or NULL)
*
* This function validates @a pac against the supplied @a server, @a privsvr,
* @a principal and @a authtime. If @a principal is NULL, the principal and
* authtime are not verified. If @a server or @a privsvr is NULL, the
* corresponding checksum is not verified.
*
* If successful, @a pac is marked as verified.
*
* @note A checksum mismatch can occur if the PAC was copied from a cross-realm
* TGT by an ignorant KDC; also macOS Server Open Directory (as of 10.6)
* generates PACs with no server checksum at all. One should consider not
* failing the whole authentication because of this reason, but, instead,
* treating the ticket as if it did not contain a PAC or marking the PAC
* information as non-verified.
*
* @retval 0 Success; otherwise - Kerberos error codes
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_verify(krb5_context context, const krb5_pac pac,
krb5_timestamp authtime, krb5_const_principal principal,
const krb5_keyblock *server, const krb5_keyblock *privsvr);
/**
* Verify a PAC, possibly from a specified realm.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [in] authtime Expected timestamp
* @param [in] principal Expected principal name (or NULL)
* @param [in] server Key to validate server checksum (or NULL)
* @param [in] privsvr Key to validate KDC checksum (or NULL)
* @param [in] with_realm If true, expect the realm of @a principal
*
* This function is similar to krb5_pac_verify(), but adds a parameter
* @a with_realm. If @a with_realm is true, the PAC_CLIENT_INFO field is
* expected to include the realm of @a principal as well as the name. This
* flag is necessary to verify PACs in cross-realm S4U2Self referral TGTs.
*
* @version New in 1.17
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_verify_ext(krb5_context context, const krb5_pac pac,
krb5_timestamp authtime, krb5_const_principal principal,
const krb5_keyblock *server, const krb5_keyblock *privsvr,
krb5_boolean with_realm);
/**
* Verify a PAC, possibly including ticket signature
*
* @param [in] context Library context
* @param [in] enc_tkt Ticket enc-part, possibly containing a PAC
* @param [in] server_princ Canonicalized name of ticket server
* @param [in] server Key to validate server checksum (or NULL)
* @param [in] privsvr Key to validate KDC checksum (or NULL)
* @param [out] pac_out Verified PAC (NULL if no PAC included)
*
* If a PAC is present in @a enc_tkt, verify its signatures. If @a privsvr is
* not NULL and @a server_princ is not a krbtgt or kadmin/changepw service,
* require a ticket signature over @a enc_tkt in addition to the KDC signature.
* Place the verified PAC in @a pac_out. If an invalid PAC signature is found,
* return an error matching the Windows KDC protocol code for that condition as
* closely as possible.
*
* If no PAC is present in @a enc_tkt, set @a pac_out to NULL and return
* successfully.
*
* @note This function does not validate the PAC_CLIENT_INFO buffer. If a
* specific value is expected, the caller can make a separate call to
* krb5_pac_verify_ext() with a principal but no keys.
*
* @retval 0 Success; otherwise - Kerberos error codes
*
* @version New in 1.20
*/
krb5_error_code KRB5_CALLCONV
krb5_kdc_verify_ticket(krb5_context context, const krb5_enc_tkt_part *enc_tkt,
krb5_const_principal server_princ,
const krb5_keyblock *server,
const krb5_keyblock *privsvr, krb5_pac *pac_out);
/** @deprecated Use krb5_kdc_sign_ticket() instead. */
krb5_error_code KRB5_CALLCONV
krb5_pac_sign(krb5_context context, krb5_pac pac, krb5_timestamp authtime,
krb5_const_principal principal, const krb5_keyblock *server_key,
const krb5_keyblock *privsvr_key, krb5_data *data);
/** @deprecated Use krb5_kdc_sign_ticket() instead. */
krb5_error_code KRB5_CALLCONV
krb5_pac_sign_ext(krb5_context context, krb5_pac pac, krb5_timestamp authtime,
krb5_const_principal principal,
const krb5_keyblock *server_key,
const krb5_keyblock *privsvr_key, krb5_boolean with_realm,
krb5_data *data);
/**
* Compatibility function used by IPA if the 1.20 KDB diver API is not
* available. It generates PAC signatures, including the extended KDC one when
* relevant.
*
* It is similar to krb5_kdc_sign_ticket(), except it will not generate the
* PAC ticket signature, and therefore does not expect encrypted ticket part as
* parameter.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [in] authtime Expected timestamp
* @param [in] client_princ Client principal name (or NULL)
* @param [in] server_princ Server principal name
* @param [in] server_key Key for server checksum
* @param [in] privsvr_key Key for KDC checksum
* @param [in] with_realm If true, include the realm of @a client_princ
* @param [out] data Signed PAC encoding
*
* This function signs @a pac using the keys @a server_key and @a privsvr_key
* and returns the signed encoding in @a data. @a pac is modified to include
* the server and KDC checksum buffers. Use krb5_free_data_contents() to free
* @a data when it is no longer needed.
*
* If @a with_realm is true, the PAC_CLIENT_INFO field of the signed PAC will
* include the realm of @a client_princ as well as the name. This flag is
* necessary to generate PACs for cross-realm S4U2Self referrals.
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_full_sign_compat(krb5_context context, krb5_pac pac,
krb5_timestamp authtime,
krb5_const_principal client_princ,
krb5_const_principal server_princ,
const krb5_keyblock *server_key,
const krb5_keyblock *privsvr_key,
krb5_boolean with_realm,
krb5_data *data);
/**
* Sign a PAC, possibly including a ticket signature
*
* @param [in] context Library context
* @param [in] enc_tkt The ticket for the signature
* @param [in] pac PAC handle
* @param [in] server_princ Canonical ticket server name
* @param [in] client_princ PAC_CLIENT_INFO principal (or NULL)
* @param [in] server Key for server checksum
* @param [in] privsvr Key for KDC and ticket checksum
* @param [in] with_realm If true, include the realm of @a principal
*
* Sign @a pac using the keys @a server and @a privsvr. Include a ticket
* signature over @a enc_tkt if @a server_princ is not a TGS or kadmin/changepw
* principal name. Add the signed PAC's encoding to the authorization data of
* @a enc_tkt in the first slot, wrapped in an AD-IF-RELEVANT container. If @a
* client_princ is non-null, add a PAC_CLIENT_INFO buffer, including the realm
* if @a with_realm is true.
*
* @retval 0 on success, otherwise - Kerberos error codes
*
* @version New in 1.20
*/
krb5_error_code KRB5_CALLCONV
krb5_kdc_sign_ticket(krb5_context context, krb5_enc_tkt_part *enc_tkt,
const krb5_pac pac, krb5_const_principal server_princ,
krb5_const_principal client_princ,
const krb5_keyblock *server, const krb5_keyblock *privsvr,
krb5_boolean with_realm);
/**
* Read client information from a PAC.
*
* @param [in] context Library context
* @param [in] pac PAC handle
* @param [out] authtime_out Authentication timestamp (NULL if not needed)
* @param [out] princname_out Client account name
*
* Read the PAC_CLIENT_INFO buffer in @a pac. Place the client account name as
* a string in @a princname_out. If @a authtime_out is not NULL, place the
* initial authentication timestamp in @a authtime_out.
*
* @retval 0 on success, ENOENT if no PAC_CLIENT_INFO buffer is present in @a
* pac, ERANGE if the buffer contains invalid lengths.
*
* @version New in 1.18
*/
krb5_error_code KRB5_CALLCONV
krb5_pac_get_client_info(krb5_context context, const krb5_pac pac,
krb5_timestamp *authtime_out, char **princname_out);
/**
* Allow the application to override the profile's allow_weak_crypto setting.
*
* @param [in] context Library context
* @param [in] enable Boolean flag
*
* This function allows an application to override the allow_weak_crypto
* setting. It is primarily for use by aklog.
*
* @retval 0 (always)
*/
krb5_error_code KRB5_CALLCONV
krb5_allow_weak_crypto(krb5_context context, krb5_boolean enable);
/**
* A wrapper for passing information to a @c krb5_trace_callback.
*
* Currently, it only contains the formatted message as determined
* the the format string and arguments of the tracing macro, but it
* may be extended to contain more fields in the future.
*/
typedef struct _krb5_trace_info {
const char *message;
} krb5_trace_info;
typedef void
(KRB5_CALLCONV *krb5_trace_callback)(krb5_context context,
const krb5_trace_info *info,
void *cb_data);
/**
* Specify a callback function for trace events.
*
* @param [in] context Library context
* @param [in] fn Callback function
* @param [in] cb_data Callback data
*
* Specify a callback for trace events occurring in krb5 operations performed
* within @a context. @a fn will be invoked with @a context as the first
* argument, @a cb_data as the last argument, and a pointer to a
* krb5_trace_info as the second argument. If the trace callback is reset via
* this function or @a context is destroyed, @a fn will be invoked with a NULL
* second argument so it can clean up @a cb_data. Supply a NULL value for @a
* fn to disable trace callbacks within @a context.
*
* @note This function overrides the information passed through the
* @a KRB5_TRACE environment variable.
*
* @version New in 1.9
*
* @return Returns KRB5_TRACE_NOSUPP if tracing is not supported in the library
* (unless @a fn is NULL).
*/
krb5_error_code KRB5_CALLCONV
krb5_set_trace_callback(krb5_context context, krb5_trace_callback fn,
void *cb_data);
/**
* Specify a file name for directing trace events.
*
* @param [in] context Library context
* @param [in] filename File name
*
* Open @a filename for appending (creating it, if necessary) and set up a
* callback to write trace events to it.
*
* @note This function overrides the information passed through the
* @a KRB5_TRACE environment variable.
*
* @version New in 1.9
*
* @retval KRB5_TRACE_NOSUPP Tracing is not supported in the library.
*/
krb5_error_code KRB5_CALLCONV
krb5_set_trace_filename(krb5_context context, const char *filename);
/**
* Hook function for inspecting or modifying messages sent to KDCs.
*
* @param [in] context Library context
* @param [in] data Callback data
* @param [in] realm The realm the message will be sent to
* @param [in] message The original message to be sent to the KDC
* @param [out] new_message_out Optional replacement message to be sent
* @param [out] reply_out Optional synthetic reply
*
* If the hook function returns an error code, the KDC communication will be
* aborted and the error code will be returned to the library operation which
* initiated the communication.
*
* If the hook function sets @a reply_out, @a message will not be sent to the
* KDC, and the given reply will used instead.
*
* If the hook function sets @a new_message_out, the given message will be sent
* to the KDC in place of @a message.
*
* If the hook function returns successfully without setting either output,
* @a message will be sent to the KDC normally.
*
* The hook function should use krb5_copy_data() to construct the value for
* @a new_message_out or @a reply_out, to ensure that it can be freed correctly
* by the library.
*
* @version New in 1.15
*
* @retval 0 Success
* @return A Kerberos error code
*/
typedef krb5_error_code
(KRB5_CALLCONV *krb5_pre_send_fn)(krb5_context context, void *data,
const krb5_data *realm,
const krb5_data *message,
krb5_data **new_message_out,
krb5_data **new_reply_out);
/**
* Hook function for inspecting or overriding KDC replies.
*
* @param [in] context Library context
* @param [in] data Callback data
* @param [in] code Status of KDC communication
* @param [in] realm The realm the reply was received from
* @param [in] message The message sent to the realm's KDC
* @param [in] reply The reply received from the KDC
* @param [out] new_reply_out Optional replacement reply
*
* If @a code is zero, @a reply contains the reply received from the KDC. The
* hook function may return an error code to simulate an error, may synthesize
* a different reply by setting @a new_reply_out, or may simply return
* successfully to do nothing.
*
* If @a code is non-zero, KDC communication failed and @a reply should be
* ignored. The hook function may return @a code or a different error code, or
* may synthesize a reply by setting @a new_reply_out and return successfully.
*
* The hook function should use krb5_copy_data() to construct the value for
* @a new_reply_out, to ensure that it can be freed correctly by the library.
*
* @version New in 1.15
*
* @retval 0 Success
* @return A Kerberos error code
*/
typedef krb5_error_code
(KRB5_CALLCONV *krb5_post_recv_fn)(krb5_context context, void *data,
krb5_error_code code,
const krb5_data *realm,
const krb5_data *message,
const krb5_data *reply,
krb5_data **new_reply_out);
/**
* Set a KDC pre-send hook function.
*
* @param [in] context Library context
* @param [in] send_hook Hook function (or NULL to disable the hook)
* @param [in] data Callback data to be passed to @a send_hook
*
* @a send_hook will be called before messages are sent to KDCs by library
* functions such as krb5_get_credentials(). The hook function may inspect,
* override, or synthesize its own reply to the message.
*
* @version New in 1.15
*/
void KRB5_CALLCONV
krb5_set_kdc_send_hook(krb5_context context, krb5_pre_send_fn send_hook,
void *data);
/**
* Set a KDC post-receive hook function.
*
* @param [in] context The library context.
* @param [in] recv_hook Hook function (or NULL to disable the hook)
* @param [in] data Callback data to be passed to @a recv_hook
*
* @a recv_hook will be called after a reply is received from a KDC during a
* call to a library function such as krb5_get_credentials(). The hook
* function may inspect or override the reply. This hook will not be executed
* if the pre-send hook returns a synthetic reply.
*
* @version New in 1.15
*/
void KRB5_CALLCONV
krb5_set_kdc_recv_hook(krb5_context context, krb5_post_recv_fn recv_hook,
void *data);
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
# pragma pack(pop)
#endif
KRB5INT_END_DECLS
/* Don't use this! We're going to phase it out. It's just here to keep
applications from breaking right away. */
#define krb5_const const
#undef KRB5_ATTR_DEPRECATED
/** @} */ /* end of KRB5_H group */
#endif /* KRB5_GENERAL__ */
/*
* et-h-krb5_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define KRB5KDC_ERR_NONE (-1765328384L)
#define KRB5KDC_ERR_NAME_EXP (-1765328383L)
#define KRB5KDC_ERR_SERVICE_EXP (-1765328382L)
#define KRB5KDC_ERR_BAD_PVNO (-1765328381L)
#define KRB5KDC_ERR_C_OLD_MAST_KVNO (-1765328380L)
#define KRB5KDC_ERR_S_OLD_MAST_KVNO (-1765328379L)
#define KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (-1765328378L)
#define KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN (-1765328377L)
#define KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE (-1765328376L)
#define KRB5KDC_ERR_NULL_KEY (-1765328375L)
#define KRB5KDC_ERR_CANNOT_POSTDATE (-1765328374L)
#define KRB5KDC_ERR_NEVER_VALID (-1765328373L)
#define KRB5KDC_ERR_POLICY (-1765328372L)
#define KRB5KDC_ERR_BADOPTION (-1765328371L)
#define KRB5KDC_ERR_ETYPE_NOSUPP (-1765328370L)
#define KRB5KDC_ERR_SUMTYPE_NOSUPP (-1765328369L)
#define KRB5KDC_ERR_PADATA_TYPE_NOSUPP (-1765328368L)
#define KRB5KDC_ERR_TRTYPE_NOSUPP (-1765328367L)
#define KRB5KDC_ERR_CLIENT_REVOKED (-1765328366L)
#define KRB5KDC_ERR_SERVICE_REVOKED (-1765328365L)
#define KRB5KDC_ERR_TGT_REVOKED (-1765328364L)
#define KRB5KDC_ERR_CLIENT_NOTYET (-1765328363L)
#define KRB5KDC_ERR_SERVICE_NOTYET (-1765328362L)
#define KRB5KDC_ERR_KEY_EXP (-1765328361L)
#define KRB5KDC_ERR_PREAUTH_FAILED (-1765328360L)
#define KRB5KDC_ERR_PREAUTH_REQUIRED (-1765328359L)
#define KRB5KDC_ERR_SERVER_NOMATCH (-1765328358L)
#define KRB5KDC_ERR_MUST_USE_USER2USER (-1765328357L)
#define KRB5KDC_ERR_PATH_NOT_ACCEPTED (-1765328356L)
#define KRB5KDC_ERR_SVC_UNAVAILABLE (-1765328355L)
#define KRB5PLACEHOLD_30 (-1765328354L)
#define KRB5KRB_AP_ERR_BAD_INTEGRITY (-1765328353L)
#define KRB5KRB_AP_ERR_TKT_EXPIRED (-1765328352L)
#define KRB5KRB_AP_ERR_TKT_NYV (-1765328351L)
#define KRB5KRB_AP_ERR_REPEAT (-1765328350L)
#define KRB5KRB_AP_ERR_NOT_US (-1765328349L)
#define KRB5KRB_AP_ERR_BADMATCH (-1765328348L)
#define KRB5KRB_AP_ERR_SKEW (-1765328347L)
#define KRB5KRB_AP_ERR_BADADDR (-1765328346L)
#define KRB5KRB_AP_ERR_BADVERSION (-1765328345L)
#define KRB5KRB_AP_ERR_MSG_TYPE (-1765328344L)
#define KRB5KRB_AP_ERR_MODIFIED (-1765328343L)
#define KRB5KRB_AP_ERR_BADORDER (-1765328342L)
#define KRB5KRB_AP_ERR_ILL_CR_TKT (-1765328341L)
#define KRB5KRB_AP_ERR_BADKEYVER (-1765328340L)
#define KRB5KRB_AP_ERR_NOKEY (-1765328339L)
#define KRB5KRB_AP_ERR_MUT_FAIL (-1765328338L)
#define KRB5KRB_AP_ERR_BADDIRECTION (-1765328337L)
#define KRB5KRB_AP_ERR_METHOD (-1765328336L)
#define KRB5KRB_AP_ERR_BADSEQ (-1765328335L)
#define KRB5KRB_AP_ERR_INAPP_CKSUM (-1765328334L)
#define KRB5KRB_AP_PATH_NOT_ACCEPTED (-1765328333L)
#define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L)
#define KRB5PLACEHOLD_53 (-1765328331L)
#define KRB5PLACEHOLD_54 (-1765328330L)
#define KRB5PLACEHOLD_55 (-1765328329L)
#define KRB5PLACEHOLD_56 (-1765328328L)
#define KRB5PLACEHOLD_57 (-1765328327L)
#define KRB5PLACEHOLD_58 (-1765328326L)
#define KRB5PLACEHOLD_59 (-1765328325L)
#define KRB5KRB_ERR_GENERIC (-1765328324L)
#define KRB5KRB_ERR_FIELD_TOOLONG (-1765328323L)
#define KRB5KDC_ERR_CLIENT_NOT_TRUSTED (-1765328322L)
#define KRB5KDC_ERR_KDC_NOT_TRUSTED (-1765328321L)
#define KRB5KDC_ERR_INVALID_SIG (-1765328320L)
#define KRB5KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED (-1765328319L)
#define KRB5KDC_ERR_CERTIFICATE_MISMATCH (-1765328318L)
#define KRB5KRB_AP_ERR_NO_TGT (-1765328317L)
#define KRB5KDC_ERR_WRONG_REALM (-1765328316L)
#define KRB5KRB_AP_ERR_USER_TO_USER_REQUIRED (-1765328315L)
#define KRB5KDC_ERR_CANT_VERIFY_CERTIFICATE (-1765328314L)
#define KRB5KDC_ERR_INVALID_CERTIFICATE (-1765328313L)
#define KRB5KDC_ERR_REVOKED_CERTIFICATE (-1765328312L)
#define KRB5KDC_ERR_REVOCATION_STATUS_UNKNOWN (-1765328311L)
#define KRB5KDC_ERR_REVOCATION_STATUS_UNAVAILABLE (-1765328310L)
#define KRB5KDC_ERR_CLIENT_NAME_MISMATCH (-1765328309L)
#define KRB5KDC_ERR_KDC_NAME_MISMATCH (-1765328308L)
#define KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE (-1765328307L)
#define KRB5KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED (-1765328306L)
#define KRB5KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED (-1765328305L)
#define KRB5KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED (-1765328304L)
#define KRB5KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED (-1765328303L)
#define KRB5PLACEHOLD_82 (-1765328302L)
#define KRB5PLACEHOLD_83 (-1765328301L)
#define KRB5PLACEHOLD_84 (-1765328300L)
#define KRB5KRB_AP_ERR_IAKERB_KDC_NOT_FOUND (-1765328299L)
#define KRB5KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE (-1765328298L)
#define KRB5PLACEHOLD_87 (-1765328297L)
#define KRB5PLACEHOLD_88 (-1765328296L)
#define KRB5PLACEHOLD_89 (-1765328295L)
#define KRB5KDC_ERR_PREAUTH_EXPIRED (-1765328294L)
#define KRB5KDC_ERR_MORE_PREAUTH_DATA_REQUIRED (-1765328293L)
#define KRB5PLACEHOLD_92 (-1765328292L)
#define KRB5KDC_ERR_UNKNOWN_CRITICAL_FAST_OPTION (-1765328291L)
#define KRB5PLACEHOLD_94 (-1765328290L)
#define KRB5PLACEHOLD_95 (-1765328289L)
#define KRB5PLACEHOLD_96 (-1765328288L)
#define KRB5PLACEHOLD_97 (-1765328287L)
#define KRB5PLACEHOLD_98 (-1765328286L)
#define KRB5PLACEHOLD_99 (-1765328285L)
#define KRB5KDC_ERR_NO_ACCEPTABLE_KDF (-1765328284L)
#define KRB5PLACEHOLD_101 (-1765328283L)
#define KRB5PLACEHOLD_102 (-1765328282L)
#define KRB5PLACEHOLD_103 (-1765328281L)
#define KRB5PLACEHOLD_104 (-1765328280L)
#define KRB5PLACEHOLD_105 (-1765328279L)
#define KRB5PLACEHOLD_106 (-1765328278L)
#define KRB5PLACEHOLD_107 (-1765328277L)
#define KRB5PLACEHOLD_108 (-1765328276L)
#define KRB5PLACEHOLD_109 (-1765328275L)
#define KRB5PLACEHOLD_110 (-1765328274L)
#define KRB5PLACEHOLD_111 (-1765328273L)
#define KRB5PLACEHOLD_112 (-1765328272L)
#define KRB5PLACEHOLD_113 (-1765328271L)
#define KRB5PLACEHOLD_114 (-1765328270L)
#define KRB5PLACEHOLD_115 (-1765328269L)
#define KRB5PLACEHOLD_116 (-1765328268L)
#define KRB5PLACEHOLD_117 (-1765328267L)
#define KRB5PLACEHOLD_118 (-1765328266L)
#define KRB5PLACEHOLD_119 (-1765328265L)
#define KRB5PLACEHOLD_120 (-1765328264L)
#define KRB5PLACEHOLD_121 (-1765328263L)
#define KRB5PLACEHOLD_122 (-1765328262L)
#define KRB5PLACEHOLD_123 (-1765328261L)
#define KRB5PLACEHOLD_124 (-1765328260L)
#define KRB5PLACEHOLD_125 (-1765328259L)
#define KRB5PLACEHOLD_126 (-1765328258L)
#define KRB5PLACEHOLD_127 (-1765328257L)
#define KRB5_ERR_RCSID (-1765328256L)
#define KRB5_LIBOS_BADLOCKFLAG (-1765328255L)
#define KRB5_LIBOS_CANTREADPWD (-1765328254L)
#define KRB5_LIBOS_BADPWDMATCH (-1765328253L)
#define KRB5_LIBOS_PWDINTR (-1765328252L)
#define KRB5_PARSE_ILLCHAR (-1765328251L)
#define KRB5_PARSE_MALFORMED (-1765328250L)
#define KRB5_CONFIG_CANTOPEN (-1765328249L)
#define KRB5_CONFIG_BADFORMAT (-1765328248L)
#define KRB5_CONFIG_NOTENUFSPACE (-1765328247L)
#define KRB5_BADMSGTYPE (-1765328246L)
#define KRB5_CC_BADNAME (-1765328245L)
#define KRB5_CC_UNKNOWN_TYPE (-1765328244L)
#define KRB5_CC_NOTFOUND (-1765328243L)
#define KRB5_CC_END (-1765328242L)
#define KRB5_NO_TKT_SUPPLIED (-1765328241L)
#define KRB5KRB_AP_WRONG_PRINC (-1765328240L)
#define KRB5KRB_AP_ERR_TKT_INVALID (-1765328239L)
#define KRB5_PRINC_NOMATCH (-1765328238L)
#define KRB5_KDCREP_MODIFIED (-1765328237L)
#define KRB5_KDCREP_SKEW (-1765328236L)
#define KRB5_IN_TKT_REALM_MISMATCH (-1765328235L)
#define KRB5_PROG_ETYPE_NOSUPP (-1765328234L)
#define KRB5_PROG_KEYTYPE_NOSUPP (-1765328233L)
#define KRB5_WRONG_ETYPE (-1765328232L)
#define KRB5_PROG_SUMTYPE_NOSUPP (-1765328231L)
#define KRB5_REALM_UNKNOWN (-1765328230L)
#define KRB5_SERVICE_UNKNOWN (-1765328229L)
#define KRB5_KDC_UNREACH (-1765328228L)
#define KRB5_NO_LOCALNAME (-1765328227L)
#define KRB5_MUTUAL_FAILED (-1765328226L)
#define KRB5_RC_TYPE_EXISTS (-1765328225L)
#define KRB5_RC_MALLOC (-1765328224L)
#define KRB5_RC_TYPE_NOTFOUND (-1765328223L)
#define KRB5_RC_UNKNOWN (-1765328222L)
#define KRB5_RC_REPLAY (-1765328221L)
#define KRB5_RC_IO (-1765328220L)
#define KRB5_RC_NOIO (-1765328219L)
#define KRB5_RC_PARSE (-1765328218L)
#define KRB5_RC_IO_EOF (-1765328217L)
#define KRB5_RC_IO_MALLOC (-1765328216L)
#define KRB5_RC_IO_PERM (-1765328215L)
#define KRB5_RC_IO_IO (-1765328214L)
#define KRB5_RC_IO_UNKNOWN (-1765328213L)
#define KRB5_RC_IO_SPACE (-1765328212L)
#define KRB5_TRANS_CANTOPEN (-1765328211L)
#define KRB5_TRANS_BADFORMAT (-1765328210L)
#define KRB5_LNAME_CANTOPEN (-1765328209L)
#define KRB5_LNAME_NOTRANS (-1765328208L)
#define KRB5_LNAME_BADFORMAT (-1765328207L)
#define KRB5_CRYPTO_INTERNAL (-1765328206L)
#define KRB5_KT_BADNAME (-1765328205L)
#define KRB5_KT_UNKNOWN_TYPE (-1765328204L)
#define KRB5_KT_NOTFOUND (-1765328203L)
#define KRB5_KT_END (-1765328202L)
#define KRB5_KT_NOWRITE (-1765328201L)
#define KRB5_KT_IOERR (-1765328200L)
#define KRB5_NO_TKT_IN_RLM (-1765328199L)
#define KRB5DES_BAD_KEYPAR (-1765328198L)
#define KRB5DES_WEAK_KEY (-1765328197L)
#define KRB5_BAD_ENCTYPE (-1765328196L)
#define KRB5_BAD_KEYSIZE (-1765328195L)
#define KRB5_BAD_MSIZE (-1765328194L)
#define KRB5_CC_TYPE_EXISTS (-1765328193L)
#define KRB5_KT_TYPE_EXISTS (-1765328192L)
#define KRB5_CC_IO (-1765328191L)
#define KRB5_FCC_PERM (-1765328190L)
#define KRB5_FCC_NOFILE (-1765328189L)
#define KRB5_FCC_INTERNAL (-1765328188L)
#define KRB5_CC_WRITE (-1765328187L)
#define KRB5_CC_NOMEM (-1765328186L)
#define KRB5_CC_FORMAT (-1765328185L)
#define KRB5_CC_NOT_KTYPE (-1765328184L)
#define KRB5_INVALID_FLAGS (-1765328183L)
#define KRB5_NO_2ND_TKT (-1765328182L)
#define KRB5_NOCREDS_SUPPLIED (-1765328181L)
#define KRB5_SENDAUTH_BADAUTHVERS (-1765328180L)
#define KRB5_SENDAUTH_BADAPPLVERS (-1765328179L)
#define KRB5_SENDAUTH_BADRESPONSE (-1765328178L)
#define KRB5_SENDAUTH_REJECTED (-1765328177L)
#define KRB5_PREAUTH_BAD_TYPE (-1765328176L)
#define KRB5_PREAUTH_NO_KEY (-1765328175L)
#define KRB5_PREAUTH_FAILED (-1765328174L)
#define KRB5_RCACHE_BADVNO (-1765328173L)
#define KRB5_CCACHE_BADVNO (-1765328172L)
#define KRB5_KEYTAB_BADVNO (-1765328171L)
#define KRB5_PROG_ATYPE_NOSUPP (-1765328170L)
#define KRB5_RC_REQUIRED (-1765328169L)
#define KRB5_ERR_BAD_HOSTNAME (-1765328168L)
#define KRB5_ERR_HOST_REALM_UNKNOWN (-1765328167L)
#define KRB5_SNAME_UNSUPP_NAMETYPE (-1765328166L)
#define KRB5KRB_AP_ERR_V4_REPLY (-1765328165L)
#define KRB5_REALM_CANT_RESOLVE (-1765328164L)
#define KRB5_TKT_NOT_FORWARDABLE (-1765328163L)
#define KRB5_FWD_BAD_PRINCIPAL (-1765328162L)
#define KRB5_GET_IN_TKT_LOOP (-1765328161L)
#define KRB5_CONFIG_NODEFREALM (-1765328160L)
#define KRB5_SAM_UNSUPPORTED (-1765328159L)
#define KRB5_SAM_INVALID_ETYPE (-1765328158L)
#define KRB5_SAM_NO_CHECKSUM (-1765328157L)
#define KRB5_SAM_BAD_CHECKSUM (-1765328156L)
#define KRB5_KT_NAME_TOOLONG (-1765328155L)
#define KRB5_KT_KVNONOTFOUND (-1765328154L)
#define KRB5_APPL_EXPIRED (-1765328153L)
#define KRB5_LIB_EXPIRED (-1765328152L)
#define KRB5_CHPW_PWDNULL (-1765328151L)
#define KRB5_CHPW_FAIL (-1765328150L)
#define KRB5_KT_FORMAT (-1765328149L)
#define KRB5_NOPERM_ETYPE (-1765328148L)
#define KRB5_CONFIG_ETYPE_NOSUPP (-1765328147L)
#define KRB5_OBSOLETE_FN (-1765328146L)
#define KRB5_EAI_FAIL (-1765328145L)
#define KRB5_EAI_NODATA (-1765328144L)
#define KRB5_EAI_NONAME (-1765328143L)
#define KRB5_EAI_SERVICE (-1765328142L)
#define KRB5_ERR_NUMERIC_REALM (-1765328141L)
#define KRB5_ERR_BAD_S2K_PARAMS (-1765328140L)
#define KRB5_ERR_NO_SERVICE (-1765328139L)
#define KRB5_CC_READONLY (-1765328138L)
#define KRB5_CC_NOSUPP (-1765328137L)
#define KRB5_DELTAT_BADFORMAT (-1765328136L)
#define KRB5_PLUGIN_NO_HANDLE (-1765328135L)
#define KRB5_PLUGIN_OP_NOTSUPP (-1765328134L)
#define KRB5_ERR_INVALID_UTF8 (-1765328133L)
#define KRB5_ERR_FAST_REQUIRED (-1765328132L)
#define KRB5_LOCAL_ADDR_REQUIRED (-1765328131L)
#define KRB5_REMOTE_ADDR_REQUIRED (-1765328130L)
#define KRB5_TRACE_NOSUPP (-1765328129L)
extern const struct error_table et_krb5_error_table;
extern void initialize_krb5_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_krb5_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_krb5 (-1765328384L)
/* for compatibility with older versions... */
#define init_krb5_err_tbl initialize_krb5_error_table
#define krb5_err_base ERROR_TABLE_BASE_krb5
/*
* et-h-k5e1_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define KRB5_PLUGIN_VER_NOTSUPP (-1750600192L)
#define KRB5_PLUGIN_BAD_MODULE_SPEC (-1750600191L)
#define KRB5_PLUGIN_NAME_NOTFOUND (-1750600190L)
#define KRB5KDC_ERR_DISCARD (-1750600189L)
#define KRB5_DCC_CANNOT_CREATE (-1750600188L)
#define KRB5_KCC_INVALID_ANCHOR (-1750600187L)
#define KRB5_KCC_UNKNOWN_VERSION (-1750600186L)
#define KRB5_KCC_INVALID_UID (-1750600185L)
#define KRB5_KCM_MALFORMED_REPLY (-1750600184L)
#define KRB5_KCM_RPC_ERROR (-1750600183L)
#define KRB5_KCM_REPLY_TOO_BIG (-1750600182L)
#define KRB5_KCM_NO_SERVER (-1750600181L)
#define KRB5_CERTAUTH_HWAUTH (-1750600180L)
extern const struct error_table et_k5e1_error_table;
extern void initialize_k5e1_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_k5e1_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_k5e1 (-1750600192L)
/* for compatibility with older versions... */
#define init_k5e1_err_tbl initialize_k5e1_error_table
#define k5e1_err_base ERROR_TABLE_BASE_k5e1
/*
* et-h-kdb5_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define KRB5_KDB_RCSID (-1780008448L)
#define KRB5_KDB_INUSE (-1780008447L)
#define KRB5_KDB_UK_SERROR (-1780008446L)
#define KRB5_KDB_UK_RERROR (-1780008445L)
#define KRB5_KDB_UNAUTH (-1780008444L)
#define KRB5_KDB_NOENTRY (-1780008443L)
#define KRB5_KDB_ILL_WILDCARD (-1780008442L)
#define KRB5_KDB_DB_INUSE (-1780008441L)
#define KRB5_KDB_DB_CHANGED (-1780008440L)
#define KRB5_KDB_TRUNCATED_RECORD (-1780008439L)
#define KRB5_KDB_RECURSIVELOCK (-1780008438L)
#define KRB5_KDB_NOTLOCKED (-1780008437L)
#define KRB5_KDB_BADLOCKMODE (-1780008436L)
#define KRB5_KDB_DBNOTINITED (-1780008435L)
#define KRB5_KDB_DBINITED (-1780008434L)
#define KRB5_KDB_ILLDIRECTION (-1780008433L)
#define KRB5_KDB_NOMASTERKEY (-1780008432L)
#define KRB5_KDB_BADMASTERKEY (-1780008431L)
#define KRB5_KDB_INVALIDKEYSIZE (-1780008430L)
#define KRB5_KDB_CANTREAD_STORED (-1780008429L)
#define KRB5_KDB_BADSTORED_MKEY (-1780008428L)
#define KRB5_KDB_NOACTMASTERKEY (-1780008427L)
#define KRB5_KDB_KVNONOMATCH (-1780008426L)
#define KRB5_KDB_STORED_MKEY_NOTCURRENT (-1780008425L)
#define KRB5_KDB_CANTLOCK_DB (-1780008424L)
#define KRB5_KDB_DB_CORRUPT (-1780008423L)
#define KRB5_KDB_BAD_VERSION (-1780008422L)
#define KRB5_KDB_BAD_SALTTYPE (-1780008421L)
#define KRB5_KDB_BAD_ENCTYPE (-1780008420L)
#define KRB5_KDB_BAD_CREATEFLAGS (-1780008419L)
#define KRB5_KDB_NO_PERMITTED_KEY (-1780008418L)
#define KRB5_KDB_NO_MATCHING_KEY (-1780008417L)
#define KRB5_KDB_DBTYPE_NOTFOUND (-1780008416L)
#define KRB5_KDB_DBTYPE_NOSUP (-1780008415L)
#define KRB5_KDB_DBTYPE_INIT (-1780008414L)
#define KRB5_KDB_SERVER_INTERNAL_ERR (-1780008413L)
#define KRB5_KDB_ACCESS_ERROR (-1780008412L)
#define KRB5_KDB_INTERNAL_ERROR (-1780008411L)
#define KRB5_KDB_CONSTRAINT_VIOLATION (-1780008410L)
#define KRB5_LOG_CONV (-1780008409L)
#define KRB5_LOG_UNSTABLE (-1780008408L)
#define KRB5_LOG_CORRUPT (-1780008407L)
#define KRB5_LOG_ERROR (-1780008406L)
#define KRB5_KDB_DBTYPE_MISMATCH (-1780008405L)
#define KRB5_KDB_POLICY_REF (-1780008404L)
#define KRB5_KDB_STRINGS_TOOLONG (-1780008403L)
extern const struct error_table et_kdb5_error_table;
extern void initialize_kdb5_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_kdb5_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_kdb5 (-1780008448L)
/* for compatibility with older versions... */
#define init_kdb5_err_tbl initialize_kdb5_error_table
#define kdb5_err_base ERROR_TABLE_BASE_kdb5
/*
* et-h-kv5m_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define KV5M_NONE (-1760647424L)
#define KV5M_PRINCIPAL (-1760647423L)
#define KV5M_DATA (-1760647422L)
#define KV5M_KEYBLOCK (-1760647421L)
#define KV5M_CHECKSUM (-1760647420L)
#define KV5M_ENCRYPT_BLOCK (-1760647419L)
#define KV5M_ENC_DATA (-1760647418L)
#define KV5M_CRYPTOSYSTEM_ENTRY (-1760647417L)
#define KV5M_CS_TABLE_ENTRY (-1760647416L)
#define KV5M_CHECKSUM_ENTRY (-1760647415L)
#define KV5M_AUTHDATA (-1760647414L)
#define KV5M_TRANSITED (-1760647413L)
#define KV5M_ENC_TKT_PART (-1760647412L)
#define KV5M_TICKET (-1760647411L)
#define KV5M_AUTHENTICATOR (-1760647410L)
#define KV5M_TKT_AUTHENT (-1760647409L)
#define KV5M_CREDS (-1760647408L)
#define KV5M_LAST_REQ_ENTRY (-1760647407L)
#define KV5M_PA_DATA (-1760647406L)
#define KV5M_KDC_REQ (-1760647405L)
#define KV5M_ENC_KDC_REP_PART (-1760647404L)
#define KV5M_KDC_REP (-1760647403L)
#define KV5M_ERROR (-1760647402L)
#define KV5M_AP_REQ (-1760647401L)
#define KV5M_AP_REP (-1760647400L)
#define KV5M_AP_REP_ENC_PART (-1760647399L)
#define KV5M_RESPONSE (-1760647398L)
#define KV5M_SAFE (-1760647397L)
#define KV5M_PRIV (-1760647396L)
#define KV5M_PRIV_ENC_PART (-1760647395L)
#define KV5M_CRED (-1760647394L)
#define KV5M_CRED_INFO (-1760647393L)
#define KV5M_CRED_ENC_PART (-1760647392L)
#define KV5M_PWD_DATA (-1760647391L)
#define KV5M_ADDRESS (-1760647390L)
#define KV5M_KEYTAB_ENTRY (-1760647389L)
#define KV5M_CONTEXT (-1760647388L)
#define KV5M_OS_CONTEXT (-1760647387L)
#define KV5M_ALT_METHOD (-1760647386L)
#define KV5M_ETYPE_INFO_ENTRY (-1760647385L)
#define KV5M_DB_CONTEXT (-1760647384L)
#define KV5M_AUTH_CONTEXT (-1760647383L)
#define KV5M_KEYTAB (-1760647382L)
#define KV5M_RCACHE (-1760647381L)
#define KV5M_CCACHE (-1760647380L)
#define KV5M_PREAUTH_OPS (-1760647379L)
#define KV5M_SAM_CHALLENGE (-1760647378L)
#define KV5M_SAM_CHALLENGE_2 (-1760647377L)
#define KV5M_SAM_KEY (-1760647376L)
#define KV5M_ENC_SAM_RESPONSE_ENC (-1760647375L)
#define KV5M_ENC_SAM_RESPONSE_ENC_2 (-1760647374L)
#define KV5M_SAM_RESPONSE (-1760647373L)
#define KV5M_SAM_RESPONSE_2 (-1760647372L)
#define KV5M_PREDICTED_SAM_RESPONSE (-1760647371L)
#define KV5M_PASSWD_PHRASE_ELEMENT (-1760647370L)
#define KV5M_GSS_OID (-1760647369L)
#define KV5M_GSS_QUEUE (-1760647368L)
#define KV5M_FAST_ARMORED_REQ (-1760647367L)
#define KV5M_FAST_REQ (-1760647366L)
#define KV5M_FAST_RESPONSE (-1760647365L)
#define KV5M_AUTHDATA_CONTEXT (-1760647364L)
extern const struct error_table et_kv5m_error_table;
extern void initialize_kv5m_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_kv5m_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_kv5m (-1760647424L)
/* for compatibility with older versions... */
#define init_kv5m_err_tbl initialize_kv5m_error_table
#define kv5m_err_base ERROR_TABLE_BASE_kv5m
/*
* et-h-krb524_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define KRB524_BADKEY (-1750206208L)
#define KRB524_BADADDR (-1750206207L)
#define KRB524_BADPRINC (-1750206206L)
#define KRB524_BADREALM (-1750206205L)
#define KRB524_V4ERR (-1750206204L)
#define KRB524_ENCFULL (-1750206203L)
#define KRB524_DECEMPTY (-1750206202L)
#define KRB524_NOTRESP (-1750206201L)
#define KRB524_KRB4_DISABLED (-1750206200L)
extern const struct error_table et_k524_error_table;
extern void initialize_k524_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_k524_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_k524 (-1750206208L)
/* for compatibility with older versions... */
#define init_k524_err_tbl initialize_k524_error_table
#define k524_err_base ERROR_TABLE_BASE_k524
/*
* et-h-asn1_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define ASN1_BAD_TIMEFORMAT (1859794432L)
#define ASN1_MISSING_FIELD (1859794433L)
#define ASN1_MISPLACED_FIELD (1859794434L)
#define ASN1_TYPE_MISMATCH (1859794435L)
#define ASN1_OVERFLOW (1859794436L)
#define ASN1_OVERRUN (1859794437L)
#define ASN1_BAD_ID (1859794438L)
#define ASN1_BAD_LENGTH (1859794439L)
#define ASN1_BAD_FORMAT (1859794440L)
#define ASN1_PARSE_ERROR (1859794441L)
#define ASN1_BAD_GMTIME (1859794442L)
#define ASN1_MISMATCH_INDEF (1859794443L)
#define ASN1_MISSING_EOC (1859794444L)
#define ASN1_OMITTED (1859794445L)
extern const struct error_table et_asn1_error_table;
extern void initialize_asn1_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_asn1_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_asn1 (1859794432L)
/* for compatibility with older versions... */
#define init_asn1_err_tbl initialize_asn1_error_table
#define asn1_err_base ERROR_TABLE_BASE_asn1
#endif /* KRB5_KRB5_H_INCLUDED */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (c) 2006 Red Hat, Inc.
* Portions copyright (c) 2006, 2011 Massachusetts Institute of Technology
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Red Hat, Inc., nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for kdcpreauth plugin module implementors.
*
* The kdcpreauth interface has a single supported major version, which is 1.
* Major version 1 has a current minor version of 2. kdcpreauth modules should
* define a function named kdcpreauth_<modulename>_initvt, matching the
* signature:
*
* krb5_error_code
* kdcpreauth_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for the interface and maj_ver:
* kdcpreauth, maj_ver == 1: Cast to krb5_kdcpreauth_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_KDCPREAUTH_PLUGIN_H
#define KRB5_KDCPREAUTH_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* kdcpreauth mechanism property flags */
/*
* Causes the KDC to include this mechanism in a list of supported preauth
* types if the user's DB entry flags the user as requiring hardware-based
* preauthentication.
*/
#define PA_HARDWARE 0x00000004
/*
* Causes the KDC to include this mechanism in a list of supported preauth
* types if the user's DB entry flags the user as requiring preauthentication,
* and to fail preauthentication if we can't verify the client data. The
* flipside of PA_SUFFICIENT.
*/
#define PA_REQUIRED 0x00000008
/*
* Causes the KDC to include this mechanism in a list of supported preauth
* types if the user's DB entry flags the user as requiring preauthentication,
* and to mark preauthentication as successful if we can verify the client
* data. The flipside of PA_REQUIRED.
*/
#define PA_SUFFICIENT 0x00000010
/*
* Marks this preauthentication mechanism as one which changes the key which is
* used for encrypting the response to the client. Modules which have this
* flag have their server_return_fn called before modules which do not, and are
* passed over if a previously-called module has modified the encrypting key.
*/
#define PA_REPLACES_KEY 0x00000020
/*
* Not really a padata type, so don't include it in any list of preauth types
* which gets sent over the wire.
*/
#define PA_PSEUDO 0x00000080
/*
* Indicates that e_data in non-FAST errors should be encoded as typed data
* instead of padata.
*/
#define PA_TYPED_E_DATA 0x00000100
/* Abstract type for a KDC callback data handle. */
typedef struct krb5_kdcpreauth_rock_st *krb5_kdcpreauth_rock;
/* Abstract type for module data and per-request module data. */
typedef struct krb5_kdcpreauth_moddata_st *krb5_kdcpreauth_moddata;
typedef struct krb5_kdcpreauth_modreq_st *krb5_kdcpreauth_modreq;
/* The verto context structure type (typedef is in verto.h; we want to avoid a
* header dependency for the moment). */
struct verto_ctx;
/* Before using a callback after version 1, modules must check the vers
* field of the callback structure. */
typedef struct krb5_kdcpreauth_callbacks_st {
int vers;
krb5_deltat (*max_time_skew)(krb5_context context,
krb5_kdcpreauth_rock rock);
/*
* Get an array of krb5_keyblock structures containing the client keys
* matching the request enctypes, terminated by an entry with key type = 0.
* Returns ENOENT if no keys are available for the request enctypes. Free
* the resulting object with the free_keys callback.
*/
krb5_error_code (*client_keys)(krb5_context context,
krb5_kdcpreauth_rock rock,
krb5_keyblock **keys_out);
/* Free the result of client_keys. */
void (*free_keys)(krb5_context context, krb5_kdcpreauth_rock rock,
krb5_keyblock *keys);
/*
* Get the encoded request body, which is sometimes needed for checksums.
* For a FAST request this is the encoded inner request body. The returned
* pointer is an alias and should not be freed.
*/
krb5_data *(*request_body)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* Get a pointer to the FAST armor key, or NULL if the request did not use
* FAST. The returned pointer is an alias and should not be freed. */
krb5_keyblock *(*fast_armor)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* Retrieve a string attribute from the client DB entry, or NULL if no such
* attribute is set. Free the result with the free_string callback. */
krb5_error_code (*get_string)(krb5_context context,
krb5_kdcpreauth_rock rock, const char *key,
char **value_out);
/* Free the result of get_string. */
void (*free_string)(krb5_context context, krb5_kdcpreauth_rock rock,
char *string);
/* Get a pointer to the client DB entry (returned as a void pointer to
* avoid a dependency on a libkdb5 type). */
void *(*client_entry)(krb5_context context, krb5_kdcpreauth_rock rock);
/* Get a pointer to the verto context which should be used by an
* asynchronous edata or verify method. */
struct verto_ctx *(*event_context)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* End of version 1 kdcpreauth callbacks. */
/* Return true if the client DB entry contains any keys matching the
* request enctypes. */
krb5_boolean (*have_client_keys)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* End of version 2 kdcpreauth callbacks. */
/*
* Get the decrypted client long-term key chosen according to the request
* enctype list, or NULL if no matching key was found. The returned
* pointer is an alias and should not be freed. If invoked from
* return_padata, the result will be the same as the encrypting_key
* parameter if it is not NULL, and will therefore reflect the modified
* reply key if a return_padata handler has replaced the reply key.
*/
const krb5_keyblock *(*client_keyblock)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* Assert an authentication indicator in the AS-REP authdata. Duplicate
* indicators will be ignored. */
krb5_error_code (*add_auth_indicator)(krb5_context context,
krb5_kdcpreauth_rock rock,
const char *indicator);
/*
* Read a data value for pa_type from the request cookie, placing it in
* *out. The value placed there is an alias and must not be freed.
* Returns true if a value for pa_type was retrieved, false if not.
*/
krb5_boolean (*get_cookie)(krb5_context context, krb5_kdcpreauth_rock rock,
krb5_preauthtype pa_type, krb5_data *out);
/*
* Set a data value for pa_type to be sent in a secure cookie in the next
* error response. If pa_type is already present, the value is ignored.
* If the preauth mechanism has different preauth types for requests and
* responses, use the request type. Secure cookies are encrypted in a key
* known only to the KDCs, but can be replayed within a short time window
* for requests using the same client principal.
*/
krb5_error_code (*set_cookie)(krb5_context context,
krb5_kdcpreauth_rock rock,
krb5_preauthtype pa_type,
const krb5_data *data);
/* End of version 3 kdcpreauth callbacks. */
/*
* Return true if princ matches the principal named in the request or the
* client principal (possibly canonicalized). If princ does not match,
* attempt a database lookup of princ with aliases allowed and compare the
* result to the client principal, returning true if it matches.
* Otherwise, return false.
*/
krb5_boolean (*match_client)(krb5_context context,
krb5_kdcpreauth_rock rock,
krb5_principal princ);
/*
* Get an alias to the client DB entry principal (possibly canonicalized).
*/
krb5_principal (*client_name)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* End of version 4 kdcpreauth callbacks. */
/*
* Instruct the KDC to send a freshness token in the method data
* accompanying a PREAUTH_REQUIRED or PREAUTH_FAILED error, if the client
* indicated support for freshness tokens. This callback should only be
* invoked from the edata method.
*/
void (*send_freshness_token)(krb5_context context,
krb5_kdcpreauth_rock rock);
/* Validate a freshness token sent by the client. Return 0 on success,
* KRB5KDC_ERR_PREAUTH_EXPIRED on error. */
krb5_error_code (*check_freshness_token)(krb5_context context,
krb5_kdcpreauth_rock rock,
const krb5_data *token);
/* End of version 5 kdcpreauth callbacks. */
} *krb5_kdcpreauth_callbacks;
/* Optional: preauth plugin initialization function. */
typedef krb5_error_code
(*krb5_kdcpreauth_init_fn)(krb5_context context,
krb5_kdcpreauth_moddata *moddata_out,
const char **realmnames);
/* Optional: preauth plugin cleanup function. */
typedef void
(*krb5_kdcpreauth_fini_fn)(krb5_context context,
krb5_kdcpreauth_moddata moddata);
/*
* Optional: return the flags which the KDC should use for this module. This
* is a callback instead of a static value because the module may or may not
* wish to count itself as a hardware preauthentication module (in other words,
* the flags may be affected by the configuration, for example if a site
* administrator can force a particular preauthentication type to be supported
* using only hardware). This function is called for each entry entry in the
* server_pa_type_list.
*/
typedef int
(*krb5_kdcpreauth_flags_fn)(krb5_context context, krb5_preauthtype pa_type);
/*
* Responder for krb5_kdcpreauth_edata_fn. If invoked with a non-zero code, pa
* will be ignored and the padata type will not be included in the hint list.
* If invoked with a zero code and a null pa value, the padata type will be
* included in the list with an empty value. If invoked with a zero code and a
* non-null pa value, pa will be included in the hint list and will later be
* freed by the KDC.
*/
typedef void
(*krb5_kdcpreauth_edata_respond_fn)(void *arg, krb5_error_code code,
krb5_pa_data *pa);
/*
* Optional: provide pa_data to send to the client as part of the "you need to
* use preauthentication" error. The implementation must invoke the respond
* when complete, whether successful or not, either before returning or
* asynchronously using the verto context returned by cb->event_context().
*
* This function is not allowed to create a modreq object because we have no
* guarantee that the client will ever make a follow-up request, or that it
* will hit this KDC if it does.
*/
typedef void
(*krb5_kdcpreauth_edata_fn)(krb5_context context, krb5_kdc_req *request,
krb5_kdcpreauth_callbacks cb,
krb5_kdcpreauth_rock rock,
krb5_kdcpreauth_moddata moddata,
krb5_preauthtype pa_type,
krb5_kdcpreauth_edata_respond_fn respond,
void *arg);
/*
* Responder for krb5_kdcpreauth_verify_fn. Invoke with the arg parameter
* supplied to verify, the error code (0 for success), an optional module
* request state object to be consumed by return_fn or free_modreq_fn, optional
* e_data to be passed to the caller if code is nonzero, and optional
* authorization data to be included in the ticket. In non-FAST replies,
* e_data will be encoded as typed-data if the module sets the PA_TYPED_E_DATA
* flag, and as pa-data otherwise. e_data and authz_data will be freed by the
* KDC.
*/
typedef void
(*krb5_kdcpreauth_verify_respond_fn)(void *arg, krb5_error_code code,
krb5_kdcpreauth_modreq modreq,
krb5_pa_data **e_data,
krb5_authdata **authz_data);
/*
* Optional: verify preauthentication data sent by the client, setting the
* TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags"
* field as appropriate. The implementation must invoke the respond function
* when complete, whether successful or not, either before returning or
* asynchronously using the verto context returned by cb->event_context().
*/
typedef void
(*krb5_kdcpreauth_verify_fn)(krb5_context context,
krb5_data *req_pkt, krb5_kdc_req *request,
krb5_enc_tkt_part *enc_tkt_reply,
krb5_pa_data *data,
krb5_kdcpreauth_callbacks cb,
krb5_kdcpreauth_rock rock,
krb5_kdcpreauth_moddata moddata,
krb5_kdcpreauth_verify_respond_fn respond,
void *arg);
/*
* Optional: generate preauthentication response data to send to the client as
* part of the AS-REP. If it needs to override the key which is used to
* encrypt the response, it can do so.
*/
typedef krb5_error_code
(*krb5_kdcpreauth_return_fn)(krb5_context context,
krb5_pa_data *padata,
krb5_data *req_pkt,
krb5_kdc_req *request,
krb5_kdc_rep *reply,
krb5_keyblock *encrypting_key,
krb5_pa_data **send_pa_out,
krb5_kdcpreauth_callbacks cb,
krb5_kdcpreauth_rock rock,
krb5_kdcpreauth_moddata moddata,
krb5_kdcpreauth_modreq modreq);
/* Optional: free a per-request context. */
typedef void
(*krb5_kdcpreauth_free_modreq_fn)(krb5_context,
krb5_kdcpreauth_moddata moddata,
krb5_kdcpreauth_modreq modreq);
/* Optional: invoked after init_fn to provide the module with a pointer to the
* verto main loop. */
typedef krb5_error_code
(*krb5_kdcpreauth_loop_fn)(krb5_context context,
krb5_kdcpreauth_moddata moddata,
struct verto_ctx *ctx);
typedef struct krb5_kdcpreauth_vtable_st {
/* Mandatory: name of module. */
char *name;
/* Mandatory: pointer to zero-terminated list of pa_types which this module
* can provide services for. */
krb5_preauthtype *pa_type_list;
krb5_kdcpreauth_init_fn init;
krb5_kdcpreauth_fini_fn fini;
krb5_kdcpreauth_flags_fn flags;
krb5_kdcpreauth_edata_fn edata;
krb5_kdcpreauth_verify_fn verify;
krb5_kdcpreauth_return_fn return_padata;
krb5_kdcpreauth_free_modreq_fn free_modreq;
/* Minor 1 ends here. */
krb5_kdcpreauth_loop_fn loop;
/* Minor 2 ends here. */
} *krb5_kdcpreauth_vtable;
#endif /* KRB5_KDCPREAUTH_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* include/krb5/kdcpolicy_plugin.h - KDC policy plugin interface */
/*
* Copyright (C) 2017 by Red Hat, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for kdcpolicy plugin module implementors.
*
* The kdcpolicy pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* kdcpolicy plugin modules should define a function named
* kdcpolicy_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* kdcpolicy_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_kdcpolicy_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_POLICY_PLUGIN_H
#define KRB5_POLICY_PLUGIN_H
#include <krb5/krb5.h>
/* Abstract module datatype. */
typedef struct krb5_kdcpolicy_moddata_st *krb5_kdcpolicy_moddata;
/* A module can optionally include kdb.h to inspect principal entries when
* authorizing requests. */
struct _krb5_db_entry_new;
/*
* Optional: Initialize module data. Return 0 on success,
* KRB5_PLUGIN_NO_HANDLE if the module is inoperable (due to configuration, for
* example), and any other error code to abort KDC startup. Optionally set
* *data_out to a module data object to be passed to future calls.
*/
typedef krb5_error_code
(*krb5_kdcpolicy_init_fn)(krb5_context context,
krb5_kdcpolicy_moddata *data_out);
/* Optional: Clean up module data. */
typedef krb5_error_code
(*krb5_kdcpolicy_fini_fn)(krb5_context context,
krb5_kdcpolicy_moddata moddata);
/*
* Optional: return an error code and set status to an appropriate string
* literal to deny an AS request; otherwise return 0. lifetime_out, if set,
* restricts the ticket lifetime. renew_lifetime_out, if set, restricts the
* ticket renewable lifetime.
*/
typedef krb5_error_code
(*krb5_kdcpolicy_check_as_fn)(krb5_context context,
krb5_kdcpolicy_moddata moddata,
const krb5_kdc_req *request,
const struct _krb5_db_entry_new *client,
const struct _krb5_db_entry_new *server,
const char *const *auth_indicators,
const char **status, krb5_deltat *lifetime_out,
krb5_deltat *renew_lifetime_out);
/*
* Optional: return an error code and set status to an appropriate string
* literal to deny a TGS request; otherwise return 0. lifetime_out, if set,
* restricts the ticket lifetime. renew_lifetime_out, if set, restricts the
* ticket renewable lifetime.
*/
typedef krb5_error_code
(*krb5_kdcpolicy_check_tgs_fn)(krb5_context context,
krb5_kdcpolicy_moddata moddata,
const krb5_kdc_req *request,
const struct _krb5_db_entry_new *server,
const krb5_ticket *ticket,
const char *const *auth_indicators,
const char **status, krb5_deltat *lifetime_out,
krb5_deltat *renew_lifetime_out);
typedef struct krb5_kdcpolicy_vtable_st {
const char *name;
krb5_kdcpolicy_init_fn init;
krb5_kdcpolicy_fini_fn fini;
krb5_kdcpolicy_check_as_fn check_as;
krb5_kdcpolicy_check_tgs_fn check_tgs;
} *krb5_kdcpolicy_vtable;
#endif /* KRB5_POLICY_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2012 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* This header includes the clpreauth and kdcpreauth interface declarations,
* for backward compatibility and convenience. */
#ifndef KRB5_PREAUTH_PLUGIN_H
#define KRB5_PREAUTH_PLUGIN_H
#include <krb5/clpreauth_plugin.h>
#include <krb5/kdcpreauth_plugin.h>
#endif /* KRB5_PREAUTH_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2006 Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
*
* Service location plugin definitions for Kerberos 5.
*/
#ifndef KRB5_LOCATE_PLUGIN_H_INCLUDED
#define KRB5_LOCATE_PLUGIN_H_INCLUDED
#include <krb5/krb5.h>
enum locate_service_type {
locate_service_kdc = 1,
locate_service_master_kdc,
locate_service_kadmin,
locate_service_krb524,
locate_service_kpasswd
};
typedef struct krb5plugin_service_locate_ftable {
int minor_version; /* currently 0 */
/* Per-context setup and teardown. Returned void* blob is
private to the plugin. */
krb5_error_code (*init)(krb5_context, void **);
void (*fini)(void *);
/* Callback function returns non-zero if the plugin function
should quit and return; this may be because of an error, or may
indicate we've already contacted the service, whatever. The
lookup function should only return an error if it detects a
problem, not if the callback function tells it to quit. */
krb5_error_code (*lookup)(void *,
enum locate_service_type svc, const char *realm,
int socktype, int family,
int (*cbfunc)(void *,int,struct sockaddr *),
void *cbdata);
} krb5plugin_service_locate_ftable;
/* extern krb5plugin_service_locate_ftable service_locator; */
#endif
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2017 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for kadm5_auth plugin module implementors.
*
* The kadm5_auth pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* kadm5_auth plugin modules should define a function named
* kadm5_auth_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* kadm5_auth_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_kadm5_auth_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_KADM5_AUTH_PLUGIN_H
#define KRB5_KADM5_AUTH_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* An abstract type for kadm5_auth module data. */
typedef struct kadm5_auth_moddata_st *kadm5_auth_moddata;
/*
* A module can optionally include <kadm5/admin.h> to inspect principal or
* policy records from requests that add or modify principals or policies.
* Note that fields of principal and policy structures are only valid if the
* corresponding bit is set in the accompanying mask parameter.
*/
struct _kadm5_principal_ent_t;
struct _kadm5_policy_ent_t;
/*
* A module can optionally generate restrictions when checking permissions for
* adding or modifying a principal entry. Restriction fields will only be
* honored if the corresponding mask bit is set. The operable mask bits are
* defined in <kadmin/admin.h> and are:
*
* - KADM5_ATTRIBUTES for require_attrs, forbid_attrs
* - KADM5_POLICY for policy
* - KADM5_POLICY_CLR to require that policy be unset
* - KADM5_PRINC_EXPIRE_TIME for princ_lifetime
* - KADM5_PW_EXPIRATION for pw_lifetime
* - KADM5_MAX_LIFE for max_life
* - KADM5_MAX_RLIFE for max_renewable_life
*/
struct kadm5_auth_restrictions {
long mask;
krb5_flags require_attrs;
krb5_flags forbid_attrs;
krb5_deltat princ_lifetime;
krb5_deltat pw_lifetime;
krb5_deltat max_life;
krb5_deltat max_renewable_life;
char *policy;
};
/*** Method type declarations ***/
/*
* Optional: Initialize module data. acl_file is the realm's configured ACL
* file, or NULL if none was configured. Return 0 on success,
* KRB5_PLUGIN_NO_HANDLE if the module is inoperable (due to configuration, for
* example), and any other error code to abort kadmind startup. Optionally set
* *data_out to a module data object to be passed to future calls.
*/
typedef krb5_error_code
(*kadm5_auth_init_fn)(krb5_context context, const char *acl_file,
kadm5_auth_moddata *data_out);
/* Optional: Release resources used by module data. */
typedef void
(*kadm5_auth_fini_fn)(krb5_context context, kadm5_auth_moddata data);
/*
* Each check method below should return 0 to explicitly authorize the request,
* KRB5_PLUGIN_NO_HANDLE to neither authorize nor deny the request, and any
* other error code (such as EPERM) to explicitly deny the request. If a check
* method is not defined, the module will neither authorize nor deny the
* request. A request succeeds if at least one kadm5_auth module explicitly
* authorizes the request and none of the modules explicitly deny it.
*/
/* Optional: authorize an add-principal operation, and optionally generate
* restrictions. */
typedef krb5_error_code
(*kadm5_auth_addprinc_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target,
const struct _kadm5_principal_ent_t *ent, long mask,
struct kadm5_auth_restrictions **rs_out);
/* Optional: authorize a modify-principal operation, and optionally generate
* restrictions. */
typedef krb5_error_code
(*kadm5_auth_modprinc_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target,
const struct _kadm5_principal_ent_t *ent, long mask,
struct kadm5_auth_restrictions **rs_out);
/* Optional: authorize a set-string operation. */
typedef krb5_error_code
(*kadm5_auth_setstr_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target,
const char *key, const char *value);
/* Optional: authorize a change-password operation. */
typedef krb5_error_code
(*kadm5_auth_cpw_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client, krb5_const_principal target);
/* Optional: authorize a randomize-keys operation. */
typedef krb5_error_code
(*kadm5_auth_chrand_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize a set-key operation. */
typedef krb5_error_code
(*kadm5_auth_setkey_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize a purgekeys operation. */
typedef krb5_error_code
(*kadm5_auth_purgekeys_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize a delete-principal operation. */
typedef krb5_error_code
(*kadm5_auth_delprinc_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize a rename-principal operation. */
typedef krb5_error_code
(*kadm5_auth_renprinc_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal src,
krb5_const_principal dest);
/* Optional: authorize a get-principal operation. */
typedef krb5_error_code
(*kadm5_auth_getprinc_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize a get-strings operation. */
typedef krb5_error_code
(*kadm5_auth_getstrs_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize an extract-keys operation. */
typedef krb5_error_code
(*kadm5_auth_extract_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client,
krb5_const_principal target);
/* Optional: authorize a list-principals operation. */
typedef krb5_error_code
(*kadm5_auth_listprincs_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client);
/* Optional: authorize an add-policy operation. */
typedef krb5_error_code
(*kadm5_auth_addpol_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client, const char *policy,
const struct _kadm5_policy_ent_t *ent, long mask);
/* Optional: authorize a modify-policy operation. */
typedef krb5_error_code
(*kadm5_auth_modpol_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client, const char *policy,
const struct _kadm5_policy_ent_t *ent, long mask);
/* Optional: authorize a delete-policy operation. */
typedef krb5_error_code
(*kadm5_auth_delpol_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client, const char *policy);
/* Optional: authorize a get-policy operation. client_policy is the client
* principal's policy name, or NULL if it does not have one. */
typedef krb5_error_code
(*kadm5_auth_getpol_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client, const char *policy,
const char *client_policy);
/* Optional: authorize a list-policies operation. */
typedef krb5_error_code
(*kadm5_auth_listpols_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client);
/* Optional: authorize an iprop operation. */
typedef krb5_error_code
(*kadm5_auth_iprop_fn)(krb5_context context, kadm5_auth_moddata data,
krb5_const_principal client);
/*
* Optional: receive a notification that the most recent authorized operation
* has ended. If a kadm5_auth module is also a KDB module, it can assume that
* all KDB methods invoked between a kadm5_auth authorization method invocation
* and a kadm5_auth end invocation are performed as part of the authorized
* operation.
*
* The end method may be invoked without a preceding authorization method in
* some cases; the module must be prepared to ignore such calls.
*/
typedef void
(*kadm5_auth_end_fn)(krb5_context context, kadm5_auth_moddata data);
/*
* Optional: free a restrictions object. This method does not need to be
* defined if the module does not generate restrictions objects, or if it
* returns aliases to restrictions objects contained from within the module
* data.
*/
typedef void
(*kadm5_auth_free_restrictions_fn)(krb5_context context,
kadm5_auth_moddata data,
struct kadm5_auth_restrictions *rs);
/* kadm5_auth vtable for major version 1. */
typedef struct kadm5_auth_vtable_st {
const char *name; /* Mandatory: name of module. */
kadm5_auth_init_fn init;
kadm5_auth_fini_fn fini;
kadm5_auth_addprinc_fn addprinc;
kadm5_auth_modprinc_fn modprinc;
kadm5_auth_setstr_fn setstr;
kadm5_auth_cpw_fn cpw;
kadm5_auth_chrand_fn chrand;
kadm5_auth_setkey_fn setkey;
kadm5_auth_purgekeys_fn purgekeys;
kadm5_auth_delprinc_fn delprinc;
kadm5_auth_renprinc_fn renprinc;
kadm5_auth_getprinc_fn getprinc;
kadm5_auth_getstrs_fn getstrs;
kadm5_auth_extract_fn extract;
kadm5_auth_listprincs_fn listprincs;
kadm5_auth_addpol_fn addpol;
kadm5_auth_modpol_fn modpol;
kadm5_auth_delpol_fn delpol;
kadm5_auth_getpol_fn getpol;
kadm5_auth_listpols_fn listpols;
kadm5_auth_iprop_fn iprop;
kadm5_auth_end_fn end;
kadm5_auth_free_restrictions_fn free_restrictions;
/* Minor version 1 ends here. */
} *kadm5_auth_vtable;
#endif /* KRB5_KADM5_AUTH_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2013 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for localauth plugin module implementors.
*
* The localauth pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* Localauth plugin modules should define a function named
* localauth_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* localauth_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_localauth_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_LOCALAUTH_PLUGIN_H
#define KRB5_LOCALAUTH_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* An abstract type for localauth module data. */
typedef struct krb5_localauth_moddata_st *krb5_localauth_moddata;
/*** Method type declarations ***/
/* Optional: Initialize module data. */
typedef krb5_error_code
(*krb5_localauth_init_fn)(krb5_context context,
krb5_localauth_moddata *data);
/* Optional: Release resources used by module data. */
typedef void
(*krb5_localauth_fini_fn)(krb5_context context, krb5_localauth_moddata data);
/*
* Optional: Determine whether aname is authorized to log in as the local
* account lname. Return 0 if aname is authorized, EPERM if aname is
* authoritatively not authorized, KRB5_PLUGIN_NO_HANDLE if the module cannot
* determine whether aname is authorized, and any other error code for a
* serious failure to process the request. aname will be considered authorized
* if at least one module returns 0 and all other modules return
* KRB5_PLUGIN_NO_HANDLE.
*/
typedef krb5_error_code
(*krb5_localauth_userok_fn)(krb5_context context, krb5_localauth_moddata data,
krb5_const_principal aname, const char *lname);
/*
* Optional (mandatory if an2ln_types is set): Determine the local account name
* corresponding to aname. Return 0 and set *lname_out if a mapping can be
* determined; the contents of *lname_out will later be released with a call to
* the module's free_string method. Return KRB5_LNAME_NOTRANS if no mapping
* can be determined. Return any other error code for a serious failure to
* process the request; this will halt the krb5_aname_to_localname operation.
*
* If the module's an2ln_types field is set, this method will only be invoked
* when a profile "auth_to_local" value references one of the module's types.
* type and residual will be set to the type and residual of the auth_to_local
* value.
*
* If the module's an2ln_types field is not set but the an2ln method is
* implemented, this method will be invoked independently of the profile's
* auth_to_local settings, with type and residual set to NULL. If multiple
* modules are registered with an2ln methods but no an2ln_types field, the
* order of invocation is not defined, but all such modules will be consulted
* before the built-in mechanisms are tried.
*/
typedef krb5_error_code
(*krb5_localauth_an2ln_fn)(krb5_context context, krb5_localauth_moddata data,
const char *type, const char *residual,
krb5_const_principal aname, char **lname_out);
/*
* Optional (mandatory if an2ln is implemented): Release the memory returned by
* an invocation of an2ln.
*/
typedef void
(*krb5_localauth_free_string_fn)(krb5_context context,
krb5_localauth_moddata data, char *str);
/* localauth vtable for major version 1. */
typedef struct krb5_localauth_vtable_st {
const char *name; /* Mandatory: name of module. */
const char **an2ln_types; /* Optional: uppercase auth_to_local types */
krb5_localauth_init_fn init;
krb5_localauth_fini_fn fini;
krb5_localauth_userok_fn userok;
krb5_localauth_an2ln_fn an2ln;
krb5_localauth_free_string_fn free_string;
/* Minor version 1 ends here. */
} *krb5_localauth_vtable;
#endif /* KRB5_LOCALAUTH_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2013 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for hostrealm plugin module implementors.
*
* The hostrealm pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* Hostrealm plugin modules should define a function named
* hostrealm_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* hostrealm_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_hostrealm_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_HOSTREALM_PLUGIN_H
#define KRB5_HOSTREALM_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* An abstract type for hostrealm module data. */
typedef struct krb5_hostrealm_moddata_st *krb5_hostrealm_moddata;
/*** Method type declarations ***/
/* Optional: Initialize module data. */
typedef krb5_error_code
(*krb5_hostrealm_init_fn)(krb5_context context,
krb5_hostrealm_moddata *data);
/*
* Optional: Determine the possible realms of a hostname, using only secure,
* authoritative mechanisms (ones which should be used prior to trying
* referrals when getting a service ticket). Return success with a
* null-terminated list of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to
* defer to later modules, or another error to terminate processing.
*/
typedef krb5_error_code
(*krb5_hostrealm_host_realm_fn)(krb5_context context,
krb5_hostrealm_moddata data,
const char *host, char ***realms_out);
/*
* Optional: Determine the possible realms of a hostname, using heuristic or
* less secure mechanisms (ones which should be used after trying referrals
* when getting a service ticket). Return success with a null-terminated list
* of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to defer to later modules,
* or another error to terminate processing.
*/
typedef krb5_error_code
(*krb5_hostrealm_fallback_realm_fn)(krb5_context context,
krb5_hostrealm_moddata data,
const char *host, char ***realms_out);
/*
* Optional: Determine the possible default realms of the local host. Return
* success with a null-terminated list of realms in *realms_out,
* KRB5_PLUGIN_NO_HANDLE to defer to later modules, or another error to
* terminate processing.
*/
typedef krb5_error_code
(*krb5_hostrealm_default_realm_fn)(krb5_context context,
krb5_hostrealm_moddata data,
char ***realms_out);
/*
* Mandatory (if any of the query methods are implemented): Release the memory
* returned by one of the interface methods.
*/
typedef void
(*krb5_hostrealm_free_list_fn)(krb5_context context,
krb5_hostrealm_moddata data, char **list);
/* Optional: Release resources used by module data. */
typedef void
(*krb5_hostrealm_fini_fn)(krb5_context context, krb5_hostrealm_moddata data);
/* hostrealm vtable for major version 1. */
typedef struct krb5_hostrealm_vtable_st {
const char *name; /* Mandatory: name of module. */
krb5_hostrealm_init_fn init;
krb5_hostrealm_fini_fn fini;
krb5_hostrealm_host_realm_fn host_realm;
krb5_hostrealm_fallback_realm_fn fallback_realm;
krb5_hostrealm_default_realm_fn default_realm;
krb5_hostrealm_free_list_fn free_list;
/* Minor version 1 ends here. */
} *krb5_hostrealm_vtable;
#endif /* KRB5_HOSTREALM_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (c) 2006 Red Hat, Inc.
* Portions copyright (c) 2006, 2011 Massachusetts Institute of Technology
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Red Hat, Inc., nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Declarations for clpreauth plugin module implementors.
*
* The clpreauth interface has a single supported major version, which is
* 1. Major version 1 has a current minor version of 2. clpreauth modules
* should define a function named clpreauth_<modulename>_initvt, matching
* the signature:
*
* krb5_error_code
* clpreauth_modname_initvt(krb5_context context, int maj_ver,
* int min_ver, krb5_plugin_vtable vtable);
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for the interface and maj_ver:
* maj_ver == 1: Cast to krb5_clpreauth_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_CLPREAUTH_PLUGIN_H
#define KRB5_CLPREAUTH_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* clpreauth mechanism property flags */
/* Provides a real answer which we can send back to the KDC. The client
* assumes that one real answer will be enough. */
#define PA_REAL 0x00000001
/* Doesn't provide a real answer, but must be given a chance to run before any
* REAL mechanism callbacks. */
#define PA_INFO 0x00000002
/* Abstract type for a client request information handle. */
typedef struct krb5_clpreauth_rock_st *krb5_clpreauth_rock;
/* Abstract types for module data and per-request module data. */
typedef struct krb5_clpreauth_moddata_st *krb5_clpreauth_moddata;
typedef struct krb5_clpreauth_modreq_st *krb5_clpreauth_modreq;
/* Before using a callback after version 1, modules must check the vers
* field of the callback structure. */
typedef struct krb5_clpreauth_callbacks_st {
int vers;
/*
* If an AS-REP has been received, return the enctype of the AS-REP
* encrypted part. Otherwise return the enctype chosen from etype-info, or
* the first requested enctype if no etype-info was received.
*/
krb5_enctype (*get_etype)(krb5_context context, krb5_clpreauth_rock rock);
/* Get a pointer to the FAST armor key, or NULL if the client is not using
* FAST. The returned pointer is an alias and should not be freed. */
krb5_keyblock *(*fast_armor)(krb5_context context,
krb5_clpreauth_rock rock);
/*
* Get a pointer to the client-supplied reply key, possibly invoking the
* prompter to ask for a password if this has not already been done. The
* returned pointer is an alias and should not be freed.
*/
krb5_error_code (*get_as_key)(krb5_context context,
krb5_clpreauth_rock rock,
krb5_keyblock **keyblock);
/* Replace the reply key to be used to decrypt the AS response. */
krb5_error_code (*set_as_key)(krb5_context context,
krb5_clpreauth_rock rock,
const krb5_keyblock *keyblock);
/* End of version 1 clpreauth callbacks. */
/*
* Get the current time for use in a preauth response. If
* allow_unauth_time is true and the library has been configured to allow
* it, the current time will be offset using unauthenticated timestamp
* information received from the KDC in the preauth-required error, if one
* has been received. Otherwise, the timestamp in a preauth-required error
* will only be used if it is protected by a FAST channel. Only set
* allow_unauth_time if using an unauthenticated time offset would not
* create a security issue.
*/
krb5_error_code (*get_preauth_time)(krb5_context context,
krb5_clpreauth_rock rock,
krb5_boolean allow_unauth_time,
krb5_timestamp *time_out,
krb5_int32 *usec_out);
/* Set a question to be answered by the responder and optionally provide
* a challenge. */
krb5_error_code (*ask_responder_question)(krb5_context context,
krb5_clpreauth_rock rock,
const char *question,
const char *challenge);
/* Get an answer from the responder, or NULL if the question was
* unanswered. */
const char *(*get_responder_answer)(krb5_context context,
krb5_clpreauth_rock rock,
const char *question);
/* Indicate interest in the AS key through the responder interface. */
void (*need_as_key)(krb5_context context, krb5_clpreauth_rock rock);
/*
* Get a configuration/state item from an input ccache, which may allow it
* to retrace the steps it took last time. The returned data string is an
* alias and should not be freed.
*/
const char *(*get_cc_config)(krb5_context context,
krb5_clpreauth_rock rock, const char *key);
/*
* Set a configuration/state item which will be recorded to an output
* ccache, if the calling application supplied one. Both key and data
* should be valid UTF-8 text.
*/
krb5_error_code (*set_cc_config)(krb5_context context,
krb5_clpreauth_rock rock,
const char *key, const char *data);
/* End of version 2 clpreauth callbacks (added in 1.11). */
/*
* Prevent further fallbacks to other preauth mechanisms if the KDC replies
* with an error. (The module itself can still respond to errors with its
* tryagain method, or continue after KDC_ERR_MORE_PREAUTH_DATA_REQUIRED
* errors with its process method.) A module should invoke this callback
* from the process method when it generates an authenticated request using
* credentials; often this will be the first or only client message
* generated by the mechanism.
*/
void (*disable_fallback)(krb5_context context, krb5_clpreauth_rock rock);
/* End of version 3 clpreauth callbacks (added in 1.17). */
} *krb5_clpreauth_callbacks;
/*
* Optional: per-plugin initialization/cleanup. The init function is called by
* libkrb5 when the plugin is loaded, and the fini function is called before
* the plugin is unloaded. These may be called multiple times in case the
* plugin is used in multiple contexts. The returned context lives the
* lifetime of the krb5_context.
*/
typedef krb5_error_code
(*krb5_clpreauth_init_fn)(krb5_context context,
krb5_clpreauth_moddata *moddata_out);
typedef void
(*krb5_clpreauth_fini_fn)(krb5_context context,
krb5_clpreauth_moddata moddata);
/*
* Optional (mandatory before MIT krb5 1.12): pa_type will be a member of the
* vtable's pa_type_list. Return PA_REAL if pa_type is a real
* preauthentication type or PA_INFO if it is an informational type. If this
* function is not defined in 1.12 or later, all pa_type values advertised by
* the module will be assumed to be real.
*/
typedef int
(*krb5_clpreauth_get_flags_fn)(krb5_context context, krb5_preauthtype pa_type);
/*
* Optional: per-request initialization/cleanup. The request_init function is
* called when beginning to process a get_init_creds request and the
* request_fini function is called when processing of the request is complete.
* This is optional. It may be called multiple times in the lifetime of a
* krb5_context.
*/
typedef void
(*krb5_clpreauth_request_init_fn)(krb5_context context,
krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq *modreq_out);
typedef void
(*krb5_clpreauth_request_fini_fn)(krb5_context context,
krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq modreq);
/*
* Optional: process server-supplied data in pa_data and set responder
* questions.
*
* encoded_previous_request may be NULL if there has been no previous request
* in the AS exchange.
*/
typedef krb5_error_code
(*krb5_clpreauth_prep_questions_fn)(krb5_context context,
krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq modreq,
krb5_get_init_creds_opt *opt,
krb5_clpreauth_callbacks cb,
krb5_clpreauth_rock rock,
krb5_kdc_req *request,
krb5_data *encoded_request_body,
krb5_data *encoded_previous_request,
krb5_pa_data *pa_data);
/*
* Mandatory: process server-supplied data in pa_data and return created data
* in pa_data_out. Also called after the AS-REP is received if the AS-REP
* includes preauthentication data of the associated type.
*
* as_key contains the client-supplied key if known, or an empty keyblock if
* not. If it is empty, the module may use gak_fct to fill it in.
*
* encoded_previous_request may be NULL if there has been no previous request
* in the AS exchange.
*/
typedef krb5_error_code
(*krb5_clpreauth_process_fn)(krb5_context context,
krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq modreq,
krb5_get_init_creds_opt *opt,
krb5_clpreauth_callbacks cb,
krb5_clpreauth_rock rock,
krb5_kdc_req *request,
krb5_data *encoded_request_body,
krb5_data *encoded_previous_request,
krb5_pa_data *pa_data,
krb5_prompter_fct prompter, void *prompter_data,
krb5_pa_data ***pa_data_out);
/*
* Optional: Attempt to use error and error_padata to try to recover from the
* given error. To work with both FAST and non-FAST errors, an implementation
* should generally consult error_padata rather than decoding error->e_data.
* For non-FAST errors, it contains the e_data decoded as either pa-data or
* typed-data.
*
* If this function is provided, and it returns 0 and stores data in
* pa_data_out, then the client library will retransmit the request.
*/
typedef krb5_error_code
(*krb5_clpreauth_tryagain_fn)(krb5_context context,
krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq modreq,
krb5_get_init_creds_opt *opt,
krb5_clpreauth_callbacks cb,
krb5_clpreauth_rock rock,
krb5_kdc_req *request,
krb5_data *encoded_request_body,
krb5_data *encoded_previous_request,
krb5_preauthtype pa_type,
krb5_error *error,
krb5_pa_data **error_padata,
krb5_prompter_fct prompter, void *prompter_data,
krb5_pa_data ***pa_data_out);
/*
* Optional: receive krb5_get_init_creds_opt information. The attr and value
* information supplied should be copied into moddata by the module if it
* wishes to reference it after returning from this call.
*/
typedef krb5_error_code
(*krb5_clpreauth_supply_gic_opts_fn)(krb5_context context,
krb5_clpreauth_moddata moddata,
krb5_get_init_creds_opt *opt,
const char *attr, const char *value);
typedef struct krb5_clpreauth_vtable_st {
/* Mandatory: name of module. */
char *name;
/* Mandatory: pointer to zero-terminated list of pa_types which this module
* can provide services for. */
krb5_preauthtype *pa_type_list;
/* Optional: pointer to zero-terminated list of enc_types which this module
* claims to add support for. */
krb5_enctype *enctype_list;
krb5_clpreauth_init_fn init;
krb5_clpreauth_fini_fn fini;
krb5_clpreauth_get_flags_fn flags;
krb5_clpreauth_request_init_fn request_init;
krb5_clpreauth_request_fini_fn request_fini;
krb5_clpreauth_process_fn process;
krb5_clpreauth_tryagain_fn tryagain;
krb5_clpreauth_supply_gic_opts_fn gic_opts;
/* Minor version 1 ends here. */
krb5_clpreauth_prep_questions_fn prep_questions;
/* Minor version 2 ends here. */
} *krb5_clpreauth_vtable;
/*
* This function allows a clpreauth plugin to obtain preauth options. The
* preauth_data returned from this function should be freed by calling
* krb5_get_init_creds_opt_free_pa().
*/
krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_opt_get_pa(krb5_context context,
krb5_get_init_creds_opt *opt,
int *num_preauth_data,
krb5_gic_opt_pa_data **preauth_data);
/*
* This function frees the preauth_data that was returned by
* krb5_get_init_creds_opt_get_pa().
*/
void KRB5_CALLCONV
krb5_get_init_creds_opt_free_pa(krb5_context context,
int num_preauth_data,
krb5_gic_opt_pa_data *preauth_data);
#endif /* KRB5_CLPREAUTH_PLUGIN_H */
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
* Declarations for credential cache selection module implementors.
*
* The ccselect pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* Credential cache selection modules should define a function named
* ccselect_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* ccselect_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_ccselect_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_CCSELECT_PLUGIN_H
#define KRB5_CCSELECT_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* An abstract type for credential cache selection module data. */
typedef struct krb5_ccselect_moddata_st *krb5_ccselect_moddata;
#define KRB5_CCSELECT_PRIORITY_AUTHORITATIVE 2
#define KRB5_CCSELECT_PRIORITY_HEURISTIC 1
/*** Method type declarations ***/
/*
* Mandatory: Initialize module data and set *priority_out to one of the
* KRB5_CCSELECT_PRIORITY constants above. Authoritative modules will be
* consulted before heuristic ones.
*/
typedef krb5_error_code
(*krb5_ccselect_init_fn)(krb5_context context, krb5_ccselect_moddata *data_out,
int *priority_out);
/*
* Mandatory: Select a cache based on a server principal. Return 0 on success,
* with *cache_out set to the selected cache and *princ_out set to its default
* principal. Return KRB5_PLUGIN_NO_HANDLE to defer to other modules. Return
* KRB5_CC_NOTFOUND with *princ_out set if the client principal can be
* authoritatively determined but no cache exists for it. Return other errors
* as appropriate.
*/
typedef krb5_error_code
(*krb5_ccselect_choose_fn)(krb5_context context, krb5_ccselect_moddata data,
krb5_principal server, krb5_ccache *cache_out,
krb5_principal *princ_out);
/* Optional: Release resources used by module data. */
typedef void
(*krb5_ccselect_fini_fn)(krb5_context context, krb5_ccselect_moddata data);
/*** vtable declarations **/
/* Credential cache selection plugin vtable for major version 1. */
typedef struct krb5_ccselect_vtable_st {
const char *name; /* Mandatory: name of module. */
krb5_ccselect_init_fn init;
krb5_ccselect_choose_fn choose;
krb5_ccselect_fini_fn fini;
/* Minor version 1 ends here. */
} *krb5_ccselect_vtable;
#endif /* KRB5_CCSELECT_PLUGIN_H */
/* Copyright (C) 1992-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* X/Open Portability Guide 4.2: ftw.h
*/
#ifndef _FTW_H
#define _FTW_H 1
#include <features.h>
#include <sys/types.h>
#include <sys/stat.h>
__BEGIN_DECLS
/* Values for the FLAG argument to the user function passed to `ftw'
and 'nftw'. */
enum
{
FTW_F, /* Regular file. */
#define FTW_F FTW_F
FTW_D, /* Directory. */
#define FTW_D FTW_D
FTW_DNR, /* Unreadable directory. */
#define FTW_DNR FTW_DNR
FTW_NS, /* Unstatable file. */
#define FTW_NS FTW_NS
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
FTW_SL, /* Symbolic link. */
# define FTW_SL FTW_SL
#endif
#ifdef __USE_XOPEN_EXTENDED
/* These flags are only passed from the `nftw' function. */
FTW_DP, /* Directory, all subdirs have been visited. */
# define FTW_DP FTW_DP
FTW_SLN /* Symbolic link naming non-existing file. */
# define FTW_SLN FTW_SLN
#endif /* extended X/Open */
};
#ifdef __USE_XOPEN_EXTENDED
/* Flags for fourth argument of `nftw'. */
enum
{
FTW_PHYS = 1, /* Perform physical walk, ignore symlinks. */
# define FTW_PHYS FTW_PHYS
FTW_MOUNT = 2, /* Report only files on same file system as the
argument. */
# define FTW_MOUNT FTW_MOUNT
FTW_CHDIR = 4, /* Change to current directory while processing it. */
# define FTW_CHDIR FTW_CHDIR
FTW_DEPTH = 8 /* Report files in directory before directory itself.*/
# define FTW_DEPTH FTW_DEPTH
# ifdef __USE_GNU
,
FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of
zero to continue and non-zero to terminate. */
# define FTW_ACTIONRETVAL FTW_ACTIONRETVAL
# endif
};
#ifdef __USE_GNU
/* Return values from callback functions. */
enum
{
FTW_CONTINUE = 0, /* Continue with next sibling or for FTW_D with the
first child. */
# define FTW_CONTINUE FTW_CONTINUE
FTW_STOP = 1, /* Return from `ftw' or `nftw' with FTW_STOP as return
value. */
# define FTW_STOP FTW_STOP
FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the
subtree, instead just continue with its next
sibling. */
# define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory
(if FTW_DEPTH) and then its siblings. */
# define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS
};
#endif
/* Structure used for fourth argument to callback function for `nftw'. */
struct FTW
{
int base;
int level;
};
#endif /* extended X/Open */
/* Convenient types for callback functions. */
typedef int (*__ftw_func_t) (const char *__filename,
const struct stat *__status, int __flag);
#ifdef __USE_LARGEFILE64
typedef int (*__ftw64_func_t) (const char *__filename,
const struct stat64 *__status, int __flag);
#endif
#ifdef __USE_XOPEN_EXTENDED
typedef int (*__nftw_func_t) (const char *__filename,
const struct stat *__status, int __flag,
struct FTW *__info);
# ifdef __USE_LARGEFILE64
typedef int (*__nftw64_func_t) (const char *__filename,
const struct stat64 *__status,
int __flag, struct FTW *__info);
# endif
#endif
/* Call a function on every element in a directory tree.
This function is a possible cancellation point and therefore not
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors)
__nonnull ((1, 2));
#else
# ifdef __REDIRECT
extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func,
int __descriptors), ftw64) __nonnull ((1, 2));
# else
# define ftw ftw64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int ftw64 (const char *__dir, __ftw64_func_t __func,
int __descriptors) __nonnull ((1, 2));
#endif
#ifdef __USE_XOPEN_EXTENDED
/* Call a function on every element in a directory tree. FLAG allows
to specify the behaviour more detailed.
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors,
int __flag) __nonnull ((1, 2));
# else
# ifdef __REDIRECT
extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func,
int __descriptors, int __flag), nftw64)
__nonnull ((1, 2));
# else
# define nftw nftw64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int nftw64 (const char *__dir, __nftw64_func_t __func,
int __descriptors, int __flag) __nonnull ((1, 2));
# endif
#endif
__END_DECLS
#endif /* ftw.h */
/*
** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "lua.h"
/* extra error code for 'luaL_loadfilex' */
#define LUA_ERRFILE (LUA_ERRERR+1)
/* key, in the registry, for table of loaded modules */
#define LUA_LOADED_TABLE "_LOADED"
/* key, in the registry, for table of preloaded loaders */
#define LUA_PRELOAD_TABLE "_PRELOAD"
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number))
LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz);
#define luaL_checkversion(L) \
luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg,
size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg,
const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int arg);
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
/* predefined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
const char *mode);
#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL)
LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
const char *name, const char *mode);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
const char *r);
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);
LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
const char *msg, int level);
LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
lua_CFunction openf, int glb);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_newlibtable(L,l) \
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
#define luaL_newlib(L,l) \
(luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
#define luaL_argcheck(L, cond,arg,extramsg) \
((void)((cond) || luaL_argerror(L, (arg), (extramsg))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
typedef struct luaL_Buffer {
char *b; /* buffer address */
size_t size; /* buffer size */
size_t n; /* number of characters in buffer */
lua_State *L;
char initb[LUAL_BUFFERSIZE]; /* initial buffer */
} luaL_Buffer;
#define luaL_addchar(B,c) \
((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
((B)->b[(B)->n++] = (c)))
#define luaL_addsize(B,s) ((B)->n += (s))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
/* }====================================================== */
/*
** {======================================================
** File handles for IO library
** =======================================================
*/
/*
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
** initial structure 'luaL_Stream' (it may contain other fields
** after that initial structure).
*/
#define LUA_FILEHANDLE "FILE*"
typedef struct luaL_Stream {
FILE *f; /* stream (NULL for incompletely created streams) */
lua_CFunction closef; /* to close stream (NULL for closed streams) */
} luaL_Stream;
/* }====================================================== */
/* compatibility with old module system */
#if defined(LUA_COMPAT_MODULE)
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
int sizehint);
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
const luaL_Reg *l, int nup);
#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0))
#endif
/*
** {==================================================================
** "Abstraction Layer" for basic report of messages and errors
** ===================================================================
*/
/* print a string */
#if !defined(lua_writestring)
#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
#endif
/* print a newline and flush the output */
#if !defined(lua_writeline)
#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout))
#endif
/* print an error message */
#if !defined(lua_writestringerror)
#define lua_writestringerror(s,p) \
(fprintf(stderr, (s), (p)), fflush(stderr))
#endif
/* }================================================================== */
/*
** {============================================================
** Compatibility with deprecated conversions
** =============================================================
*/
#if defined(LUA_COMPAT_APIINTCASTS)
#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a))
#define luaL_optunsigned(L,a,d) \
((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d)))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#endif
/* }============================================================ */
#endif
// Copyright (c) 2005, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Sanjay Ghemawat
//
// A string like object that points into another piece of memory.
// Useful for providing an interface that allows clients to easily
// pass in either a "const char*" or a "string".
//
// Arghh! I wish C++ literals were automatically of type "string".
#ifndef _PCRE_STRINGPIECE_H
#define _PCRE_STRINGPIECE_H
#include <cstring>
#include <string>
#include <iosfwd> // for ostream forward-declaration
#if 0
#define HAVE_TYPE_TRAITS
#include <type_traits.h>
#elif 0
#define HAVE_TYPE_TRAITS
#include <bits/type_traits.h>
#endif
#include <pcre.h>
namespace pcrecpp {
using std::memcmp;
using std::strlen;
using std::string;
class PCRECPP_EXP_DEFN StringPiece {
private:
const char* ptr_;
int length_;
public:
// We provide non-explicit singleton constructors so users can pass
// in a "const char*" or a "string" wherever a "StringPiece" is
// expected.
StringPiece()
: ptr_(NULL), length_(0) { }
StringPiece(const char* str)
: ptr_(str), length_(static_cast<int>(strlen(ptr_))) { }
StringPiece(const unsigned char* str)
: ptr_(reinterpret_cast<const char*>(str)),
length_(static_cast<int>(strlen(ptr_))) { }
StringPiece(const string& str)
: ptr_(str.data()), length_(static_cast<int>(str.size())) { }
StringPiece(const char* offset, int len)
: ptr_(offset), length_(len) { }
// data() may return a pointer to a buffer with embedded NULs, and the
// returned buffer may or may not be null terminated. Therefore it is
// typically a mistake to pass data() to a routine that expects a NUL
// terminated string. Use "as_string().c_str()" if you really need to do
// this. Or better yet, change your routine so it does not rely on NUL
// termination.
const char* data() const { return ptr_; }
int size() const { return length_; }
bool empty() const { return length_ == 0; }
void clear() { ptr_ = NULL; length_ = 0; }
void set(const char* buffer, int len) { ptr_ = buffer; length_ = len; }
void set(const char* str) {
ptr_ = str;
length_ = static_cast<int>(strlen(str));
}
void set(const void* buffer, int len) {
ptr_ = reinterpret_cast<const char*>(buffer);
length_ = len;
}
char operator[](int i) const { return ptr_[i]; }
void remove_prefix(int n) {
ptr_ += n;
length_ -= n;
}
void remove_suffix(int n) {
length_ -= n;
}
bool operator==(const StringPiece& x) const {
return ((length_ == x.length_) &&
(memcmp(ptr_, x.ptr_, length_) == 0));
}
bool operator!=(const StringPiece& x) const {
return !(*this == x);
}
#define STRINGPIECE_BINARY_PREDICATE(cmp,auxcmp) \
bool operator cmp (const StringPiece& x) const { \
int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); \
return ((r auxcmp 0) || ((r == 0) && (length_ cmp x.length_))); \
}
STRINGPIECE_BINARY_PREDICATE(<, <);
STRINGPIECE_BINARY_PREDICATE(<=, <);
STRINGPIECE_BINARY_PREDICATE(>=, >);
STRINGPIECE_BINARY_PREDICATE(>, >);
#undef STRINGPIECE_BINARY_PREDICATE
int compare(const StringPiece& x) const {
int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_);
if (r == 0) {
if (length_ < x.length_) r = -1;
else if (length_ > x.length_) r = +1;
}
return r;
}
string as_string() const {
return string(data(), size());
}
void CopyToString(string* target) const {
target->assign(ptr_, length_);
}
// Does "this" start with "x"
bool starts_with(const StringPiece& x) const {
return ((length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0));
}
};
} // namespace pcrecpp
// ------------------------------------------------------------------
// Functions used to create STL containers that use StringPiece
// Remember that a StringPiece's lifetime had better be less than
// that of the underlying string or char*. If it is not, then you
// cannot safely store a StringPiece into an STL container
// ------------------------------------------------------------------
#ifdef HAVE_TYPE_TRAITS
// This makes vector<StringPiece> really fast for some STL implementations
template<> struct __type_traits<pcrecpp::StringPiece> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
#endif
// allow StringPiece to be logged
PCRECPP_EXP_DECL std::ostream& operator<<(std::ostream& o,
const pcrecpp::StringPiece& piece);
#endif /* _PCRE_STRINGPIECE_H */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GD_IO_H
#define GD_IO_H 1
#include <stdio.h>
#ifdef VMS
# define Putchar gdPutchar
#endif
/*
Group: Types
typedef: gdIOCtx
gdIOCtx structures hold function pointers for doing image IO.
Most of the gd functions that read and write files, such as
<gdImagePng> also have variants that accept a <gdIOCtx> structure;
see <gdImagePngCtx> and <gdImageCreateFromJpegCtx>.
Those who wish to provide their own custom routines to read and
write images can populate a gdIOCtx structure with functions of
their own devising to to read and write data. For image reading, the
only mandatory functions are getC and getBuf, which must return the
number of characters actually read, or a negative value on error or
EOF. These functions must read the number of characters requested
unless at the end of the file.
For image writing, the only mandatory functions are putC and putBuf,
which return the number of characters written; these functions must
write the number of characters requested except in the event of an
error. The seek and tell functions are only required in conjunction
with the gd2 file format, which supports quick loading of partial
images. The gd_free function will not be invoked when calling the
standard Ctx functions; it is an implementation convenience when
adding new data types to gd. For examples, see gd_png.c, gd_gd2.c,
gd_jpeg.c, etc., all of which rely on gdIOCtx to implement the
standard image read and write functions.
> typedef struct gdIOCtx
> {
> int (*getC) (struct gdIOCtx *);
> int (*getBuf) (struct gdIOCtx *, void *, int wanted);
>
> void (*putC) (struct gdIOCtx *, int);
> int (*putBuf) (struct gdIOCtx *, const void *, int wanted);
>
> // seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek!
> int (*seek) (struct gdIOCtx *, const int);
> long (*tell) (struct gdIOCtx *);
>
> void (*gd_free) (struct gdIOCtx *);
> } gdIOCtx;
*/
typedef struct gdIOCtx {
int (*getC)(struct gdIOCtx *);
int (*getBuf)(struct gdIOCtx *, void *, int);
void (*putC)(struct gdIOCtx *, int);
int (*putBuf)(struct gdIOCtx *, const void *, int);
/* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek)(struct gdIOCtx *, const int);
long (*tell)(struct gdIOCtx *);
void (*gd_free)(struct gdIOCtx *);
void *data;
} gdIOCtx;
typedef struct gdIOCtx *gdIOCtxPtr;
void Putword(int w, gdIOCtx *ctx);
void Putchar(int c, gdIOCtx *ctx);
void gdPutC(const unsigned char c, gdIOCtx *ctx);
int gdPutBuf(const void *, int, gdIOCtx *);
void gdPutWord(int w, gdIOCtx *ctx);
void gdPutInt(int w, gdIOCtx *ctx);
int gdGetC(gdIOCtx *ctx);
int gdGetBuf(void *, int, gdIOCtx *);
int gdGetByte(int *result, gdIOCtx *ctx);
int gdGetWord(int *result, gdIOCtx *ctx);
int gdGetWordLSB(signed short int *result, gdIOCtx *ctx);
int gdGetInt(int *result, gdIOCtx *ctx);
int gdGetIntLSB(signed int *result, gdIOCtx *ctx);
int gdSeek(gdIOCtx *ctx, const int offset);
long gdTell(gdIOCtx *ctx);
#endif
#ifdef __cplusplus
}
#endif
/* JIT declarations for GDB, the GNU Debugger.
Copyright (C) 2011-2018 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef GDB_JIT_READER_H
#define GDB_JIT_READER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Versioning information. See gdb_reader_funcs. */
#define GDB_READER_INTERFACE_VERSION 1
/* Readers must be released under a GPL compatible license. To
declare that the reader is indeed released under a GPL compatible
license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source
file. */
#ifdef __cplusplus
#define GDB_DECLARE_GPL_COMPATIBLE_READER \
extern "C" { \
extern int plugin_is_GPL_compatible (void); \
extern int plugin_is_GPL_compatible (void) \
{ \
return 0; \
} \
}
#else
#define GDB_DECLARE_GPL_COMPATIBLE_READER \
extern int plugin_is_GPL_compatible (void); \
extern int plugin_is_GPL_compatible (void) \
{ \
return 0; \
}
#endif
/* Represents an address on the target system. */
typedef unsigned long long GDB_CORE_ADDR;
/* Return status codes. */
enum gdb_status {
GDB_FAIL = 0,
GDB_SUCCESS = 1
};
struct gdb_object;
struct gdb_symtab;
struct gdb_block;
struct gdb_symbol_callbacks;
/* An array of these are used to represent a map from code addresses to line
numbers in the source file. */
struct gdb_line_mapping
{
int line;
GDB_CORE_ADDR pc;
};
/* Create a new GDB code object. Each code object can have one or
more symbol tables, each representing a compiled source file. */
typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb);
/* The callback used to create new symbol table. CB is the
gdb_symbol_callbacks which the structure is part of. FILE_NAME is
an (optionally NULL) file name to associate with this new symbol
table.
Returns a new instance to gdb_symtab that can later be passed to
gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close. */
typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb,
struct gdb_object *obj,
const char *file_name);
/* Creates a new block in a given symbol table. A symbol table is a
forest of blocks, each block representing an code address range and
a corresponding (optionally NULL) NAME. In case the block
corresponds to a function, the NAME passed should be the name of
the function.
If the new block to be created is a child of (i.e. is nested in)
another block, the parent block can be passed in PARENT. SYMTAB is
the symbol table the new block is to belong in. BEGIN, END is the
code address range the block corresponds to.
Returns a new instance of gdb_block, which, as of now, has no use.
Note that the gdb_block returned must not be freed by the
caller. */
typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab,
struct gdb_block *parent,
GDB_CORE_ADDR begin,
GDB_CORE_ADDR end,
const char *name);
/* Adds a PC to line number mapping for the symbol table SYMTAB.
NLINES is the number of elements in LINES, each element
corresponding to one (PC, line) pair. */
typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab,
int nlines,
struct gdb_line_mapping *lines);
/* Close the symtab SYMTAB. This signals to GDB that no more blocks
will be opened on this symtab. */
typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab);
/* Closes the gdb_object OBJ and adds the emitted information into
GDB's internal structures. Once this is done, the debug
information will be picked up and used; this will usually be the
last operation in gdb_read_debug_info. */
typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb,
struct gdb_object *obj);
/* Reads LEN bytes from TARGET_MEM in the target's virtual address
space into GDB_BUF.
Returns GDB_FAIL on failure, and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem,
void *gdb_buf, int len);
/* The list of callbacks that are passed to read. These callbacks are
to be used to construct the symbol table. The functions have been
described above. */
struct gdb_symbol_callbacks
{
gdb_object_open *object_open;
gdb_symtab_open *symtab_open;
gdb_block_open *block_open;
gdb_symtab_close *symtab_close;
gdb_object_close *object_close;
gdb_symtab_add_line_mapping *line_mapping_add;
gdb_target_read *target_read;
/* For internal use by GDB. */
void *priv_data;
};
/* Forward declaration. */
struct gdb_reg_value;
/* A function of this type is used to free a gdb_reg_value. See the
comment on `free' in struct gdb_reg_value. */
typedef void (gdb_reg_value_free) (struct gdb_reg_value *);
/* Denotes the value of a register. */
struct gdb_reg_value
{
/* The size of the register in bytes. The reader need not set this
field. This will be set for (defined) register values being read
from GDB using reg_get. */
int size;
/* Set to non-zero if the value for the register is known. The
registers for which the reader does not call reg_set are also
assumed to be undefined */
int defined;
/* Since gdb_reg_value is a variable sized structure, it will
usually be allocated on the heap. This function is expected to
contain the corresponding "free" function.
When a pointer to gdb_reg_value is being sent from GDB to the
reader (via gdb_unwind_reg_get), the reader is expected to call
this function (with the same gdb_reg_value as argument) once it
is done with the value.
When the function sends the a gdb_reg_value to GDB (via
gdb_unwind_reg_set), it is expected to set this field to point to
an appropriate cleanup routine (or to NULL if no cleanup is
required). */
gdb_reg_value_free *free;
/* The value of the register. */
unsigned char value[1];
};
/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id
corresponding to the current frame. The registers corresponding to
the current frame can be read using reg_get. Calling get_frame_id
on a particular frame should return the same gdb_frame_id
throughout its lifetime (i.e. till before it gets unwound). One
way to do this is by having the CODE_ADDRESS point to the
function's first instruction and STACK_ADDRESS point to the value
of the stack pointer when entering the function. */
struct gdb_frame_id
{
GDB_CORE_ADDR code_address;
GDB_CORE_ADDR stack_address;
};
/* Forward declaration. */
struct gdb_unwind_callbacks;
/* Returns the value of a particular register in the current frame.
The current frame is the frame that needs to be unwound into the
outer (earlier) frame.
CB is the struct gdb_unwind_callbacks * the callback belongs to.
REGNUM is the DWARF register number of the register that needs to
be unwound.
Returns the gdb_reg_value corresponding to the register requested.
In case the value of the register has been optimized away or
otherwise unavailable, the defined flag in the returned
gdb_reg_value will be zero. */
typedef struct gdb_reg_value *(gdb_unwind_reg_get)
(struct gdb_unwind_callbacks *cb, int regnum);
/* Sets the previous value of a particular register. REGNUM is the
(DWARF) register number whose value is to be set. VAL is the value
the register is to be set to.
VAL is *not* copied, so the memory allocated to it cannot be
reused. Once GDB no longer needs the value, it is deallocated
using the FREE function (see gdb_reg_value).
A register can also be "set" to an undefined value by setting the
defined in VAL to zero. */
typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum,
struct gdb_reg_value *val);
/* This struct is passed to unwind in gdb_reader_funcs, and is to be
used to unwind the current frame (current being the frame whose
registers can be read using reg_get) into the earlier frame. The
functions have been described above. */
struct gdb_unwind_callbacks
{
gdb_unwind_reg_get *reg_get;
gdb_unwind_reg_set *reg_set;
gdb_target_read *target_read;
/* For internal use by GDB. */
void *priv_data;
};
/* Forward declaration. */
struct gdb_reader_funcs;
/* Parse the debug info off a block of memory, pointed to by MEMORY
(already copied to GDB's address space) and MEMORY_SZ bytes long.
The implementation has to use the functions in CB to actually emit
the parsed data into GDB. SELF is the same structure returned by
gdb_init_reader.
Return GDB_FAIL on failure and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self,
struct gdb_symbol_callbacks *cb,
void *memory, long memory_sz);
/* Unwind the current frame, CB is the set of unwind callbacks that
are to be used to do this.
Return GDB_FAIL on failure and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self,
struct gdb_unwind_callbacks *cb);
/* Return the frame ID corresponding to the current frame, using C to
read the current register values. See the comment on struct
gdb_frame_id. */
typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self,
struct gdb_unwind_callbacks *c);
/* Called when a reader is being unloaded. This function should also
free SELF, if required. */
typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self);
/* Called when the reader is loaded. Must either return a properly
populated gdb_reader_funcs or NULL. The memory allocated for the
gdb_reader_funcs is to be managed by the reader itself (i.e. if it
is allocated from the heap, it must also be freed in
gdb_destroy_reader). */
extern struct gdb_reader_funcs *gdb_init_reader (void);
/* Pointer to the functions which implement the reader's
functionality. The individual functions have been documented
above.
None of the fields are optional. */
struct gdb_reader_funcs
{
/* Must be set to GDB_READER_INTERFACE_VERSION. */
int reader_version;
/* For use by the reader. */
void *priv_data;
gdb_read_debug_info *read;
gdb_unwind_frame *unwind;
gdb_get_frame_id *get_frame_id;
gdb_destroy_reader *destroy;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.14 Signal handling <signal.h>
*/
#ifndef _SIGNAL_H
#define _SIGNAL_H
#include <features.h>
__BEGIN_DECLS
#include <bits/types.h>
#include <bits/signum.h>
#include <bits/types/sig_atomic_t.h>
#if defined __USE_POSIX
#include <bits/types/sigset_t.h>
#endif
#if defined __USE_XOPEN || defined __USE_XOPEN2K
# ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
#endif
#ifdef __USE_XOPEN
# endif
# ifndef __uid_t_defined
typedef __uid_t uid_t;
# define __uid_t_defined
# endif
#endif /* Unix98 */
#ifdef __USE_POSIX199309
/* We need `struct timespec' later on. */
# include <bits/types/struct_timespec.h>
#endif
#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
# include <bits/types/siginfo_t.h>
# include <bits/siginfo-consts.h>
#endif
#ifdef __USE_MISC
# include <bits/types/sigval_t.h>
#endif
#ifdef __USE_POSIX199309
# include <bits/types/sigevent_t.h>
# include <bits/sigevent-consts.h>
#endif
/* Type of a signal handler. */
typedef void (*__sighandler_t) (int);
/* The X/Open definition of `signal' specifies the SVID semantic. Use
the additional function `sysv_signal' when X/Open compatibility is
requested. */
extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
__THROW;
#ifdef __USE_GNU
extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
__THROW;
#endif
/* Set the handler for the signal SIG to HANDLER, returning the old
handler, or SIG_ERR on error.
By default `signal' has the BSD semantic. */
#ifdef __USE_MISC
extern __sighandler_t signal (int __sig, __sighandler_t __handler)
__THROW;
#else
/* Make sure the used `signal' implementation is the SVID version. */
# ifdef __REDIRECT_NTH
extern __sighandler_t __REDIRECT_NTH (signal,
(int __sig, __sighandler_t __handler),
__sysv_signal);
# else
# define signal __sysv_signal
# endif
#endif
#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8
/* The X/Open definition of `signal' conflicts with the BSD version.
So they defined another function `bsd_signal'. */
extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
__THROW;
#endif
/* Send signal SIG to process number PID. If PID is zero,
send SIG to all processes in the current process's process group.
If PID is < -1, send SIG to all processes in process group - PID. */
#ifdef __USE_POSIX
extern int kill (__pid_t __pid, int __sig) __THROW;
#endif /* Use POSIX. */
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Send SIG to all processes in process group PGRP.
If PGRP is zero, send SIG to all processes in
the current process's process group. */
extern int killpg (__pid_t __pgrp, int __sig) __THROW;
#endif /* Use misc || X/Open Unix. */
/* Raise signal SIG, i.e., send SIG to yourself. */
extern int raise (int __sig) __THROW;
#ifdef __USE_MISC
/* SVID names for the same things. */
extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
__THROW;
extern int gsignal (int __sig) __THROW;
#endif /* Use misc. */
#ifdef __USE_XOPEN2K8
/* Print a message describing the meaning of the given signal number. */
extern void psignal (int __sig, const char *__s);
/* Print a message describing the meaning of the given signal information. */
extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
#endif /* POSIX 2008. */
/* The `sigpause' function in X/Open defines the argument as the
signal number. This requires redirecting to another function
because the default version in glibc uses an old BSD interface.
This function is a cancellation point and therefore not marked with
__THROW. */
#ifdef __USE_XOPEN_EXTENDED
# ifdef __GNUC__
extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
# else
extern int __sigpause (int __sig_or_mask, int __is_sig);
/* Remove a signal from the signal mask and suspend the process. */
# define sigpause(sig) __sigpause ((sig), 1)
# endif
#endif
#ifdef __USE_MISC
/* None of the following functions should be used anymore. They are here
only for compatibility. A single word (`int') is not guaranteed to be
enough to hold a complete signal mask and therefore these functions
simply do not work in many situations. Use `sigprocmask' instead. */
/* Compute mask for signal SIG. */
# define sigmask(sig) ((int)(1u << ((sig) - 1)))
/* Block signals in MASK, returning the old mask. */
extern int sigblock (int __mask) __THROW __attribute_deprecated__;
/* Set the mask of blocked signals to MASK, returning the old mask. */
extern int sigsetmask (int __mask) __THROW __attribute_deprecated__;
/* Return currently selected signal mask. */
extern int siggetmask (void) __THROW __attribute_deprecated__;
#endif /* Use misc. */
#ifdef __USE_MISC
# define NSIG _NSIG
#endif
#ifdef __USE_GNU
typedef __sighandler_t sighandler_t;
#endif
/* 4.4 BSD uses the name `sig_t' for this. */
#ifdef __USE_MISC
typedef __sighandler_t sig_t;
#endif
#ifdef __USE_POSIX
/* Clear all signals from SET. */
extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
/* Set all signals in SET. */
extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
/* Add SIGNO to SET. */
extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
/* Remove SIGNO from SET. */
extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
/* Return 1 if SIGNO is in SET, 0 if not. */
extern int sigismember (const sigset_t *__set, int __signo)
__THROW __nonnull ((1));
# ifdef __USE_GNU
/* Return non-empty value is SET is not empty. */
extern int sigisemptyset (const sigset_t *__set) __THROW __nonnull ((1));
/* Build new signal set by combining the two inputs set using logical AND. */
extern int sigandset (sigset_t *__set, const sigset_t *__left,
const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
/* Build new signal set by combining the two inputs set using logical OR. */
extern int sigorset (sigset_t *__set, const sigset_t *__left,
const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
# endif /* GNU */
/* Get the system-specific definitions of `struct sigaction'
and the `SA_*' and `SIG_*'. constants. */
# include <bits/sigaction.h>
/* Get and/or change the set of blocked signals. */
extern int sigprocmask (int __how, const sigset_t *__restrict __set,
sigset_t *__restrict __oset) __THROW;
/* Change the set of blocked signals to SET,
wait until a signal arrives, and restore the set of blocked signals.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int sigsuspend (const sigset_t *__set) __nonnull ((1));
/* Get and/or set the action for signal SIG. */
extern int sigaction (int __sig, const struct sigaction *__restrict __act,
struct sigaction *__restrict __oact) __THROW;
/* Put in SET all signals that are blocked and waiting to be delivered. */
extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
# ifdef __USE_POSIX199506
/* Select any of pending signals from SET or wait for any to arrive.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
__nonnull ((1, 2));
# endif /* Use POSIX 1995. */
# ifdef __USE_POSIX199309
/* Select any of pending signals from SET and place information in INFO.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int sigwaitinfo (const sigset_t *__restrict __set,
siginfo_t *__restrict __info) __nonnull ((1));
/* Select any of pending signals from SET and place information in INFO.
Wait the time specified by TIMEOUT if no signal is pending.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int sigtimedwait (const sigset_t *__restrict __set,
siginfo_t *__restrict __info,
const struct timespec *__restrict __timeout)
__nonnull ((1));
/* Send signal SIG to the process PID. Associate data in VAL with the
signal. */
extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
__THROW;
# endif /* Use POSIX 199306. */
#endif /* Use POSIX. */
#ifdef __USE_MISC
/* Names of the signals. This variable exists only for compatibility.
Use `strsignal' instead (see <string.h>). */
extern const char *const _sys_siglist[_NSIG];
extern const char *const sys_siglist[_NSIG];
/* Get machine-dependent `struct sigcontext' and signal subcodes. */
# include <bits/sigcontext.h>
/* Restore the state saved in SCP. */
extern int sigreturn (struct sigcontext *__scp) __THROW;
#endif /* Use misc. */
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
# define __need_size_t
# include <stddef.h>
# include <bits/types/stack_t.h>
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* This will define `ucontext_t' and `mcontext_t'. */
# include <sys/ucontext.h>
# endif
#endif /* Use POSIX.1-2008 or X/Open Unix. */
#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
calls be restarted after signal SIG. */
extern int siginterrupt (int __sig, int __interrupt) __THROW;
# include <bits/sigstack.h>
# include <bits/ss_flags.h>
/* Alternate signal handler stack interface.
This interface should always be preferred over `sigstack'. */
extern int sigaltstack (const stack_t *__restrict __ss,
stack_t *__restrict __oss) __THROW;
#endif /* __USE_XOPEN_EXTENDED || __USE_MISC */
#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
|| defined __USE_MISC)
# include <bits/types/struct_sigstack.h>
#endif
#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
|| defined __USE_MISC)
/* Run signals handlers on the stack specified by SS (if not NULL).
If OSS is not NULL, it is filled in with the old signal stack status.
This interface is obsolete and on many platform not implemented. */
extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
__THROW __attribute_deprecated__;
#endif
#ifdef __USE_XOPEN_EXTENDED
/* Simplified interface for signal management. */
/* Add SIG to the calling process' signal mask. */
extern int sighold (int __sig) __THROW;
/* Remove SIG from the calling process' signal mask. */
extern int sigrelse (int __sig) __THROW;
/* Set the disposition of SIG to SIG_IGN. */
extern int sigignore (int __sig) __THROW;
/* Set the disposition of SIG. */
extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
#endif
#if defined __USE_POSIX199506 || defined __USE_UNIX98
/* Some of the functions for handling signals in threaded programs must
be defined here. */
# include <bits/pthreadtypes.h>
# include <bits/sigthread.h>
#endif /* use Unix98 */
/* The following functions are used internally in the C library and in
other code which need deep insights. */
/* Return number of available real-time signal with highest priority. */
extern int __libc_current_sigrtmin (void) __THROW;
/* Return number of available real-time signal with lowest priority. */
extern int __libc_current_sigrtmax (void) __THROW;
#define SIGRTMIN (__libc_current_sigrtmin ())
#define SIGRTMAX (__libc_current_sigrtmax ())
__END_DECLS
#endif /* not signal.h */
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $
#ifndef NCURSES_CURSESAPP_H_incl
#define NCURSES_CURSESAPP_H_incl
#include <cursslk.h>
class NCURSES_IMPEXP NCursesApplication {
public:
typedef struct _slk_link { // This structure is used to maintain
struct _slk_link* prev; // a stack of SLKs
Soft_Label_Key_Set* SLKs;
} SLK_Link;
private:
static int rinit(NCursesWindow& w); // Internal Init function for title
static NCursesApplication* theApp; // Global ref. to the application
static SLK_Link* slk_stack;
protected:
static NCursesWindow* titleWindow; // The Title Window (if any)
bool b_Colors; // Is this a color application?
NCursesWindow* Root_Window; // This is the stdscr equiv.
// Initialization of attributes;
// Rewrite this in your derived class if you prefer other settings
virtual void init(bool bColors);
// The number of lines for the title window. Default is no title window
// You may rewrite this in your derived class
virtual int titlesize() const {
return 0;
}
// This method is called to put something into the title window initially
// You may rewrite this in your derived class
virtual void title() {
}
// The layout used for the Soft Label Keys. Default is to have no SLKs.
// You may rewrite this in your derived class
virtual Soft_Label_Key_Set::Label_Layout useSLKs() const {
return Soft_Label_Key_Set::None;
}
// This method is called to initialize the SLKs. Default is nothing.
// You may rewrite this in your derived class
virtual void init_labels(Soft_Label_Key_Set& S) const {
(void) S;
}
// Your derived class must implement this method. The return value must
// be the exit value of your application.
virtual int run() = 0;
// The constructor is protected, so you may use it in your derived
// class constructor. The argument tells whether or not you want colors.
NCursesApplication(bool wantColors = FALSE);
NCursesApplication& operator=(const NCursesApplication& rhs)
{
if (this != &rhs) {
*this = rhs;
}
return *this;
}
NCursesApplication(const NCursesApplication& rhs)
: b_Colors(rhs.b_Colors),
Root_Window(rhs.Root_Window)
{
}
public:
virtual ~NCursesApplication();
// Get a pointer to the current application object
static NCursesApplication* getApplication() {
return theApp;
}
// This method runs the application and returns its exit value
int operator()(void);
// Process the commandline arguments. The default implementation simply
// ignores them. Your derived class may rewrite this.
virtual void handleArgs(int argc, char* argv[]) {
(void) argc;
(void) argv;
}
// Does this application use colors?
inline bool useColors() const {
return b_Colors;
}
// Push the Key Set S onto the SLK Stack. S then becomes the current set
// of Soft Labelled Keys.
void push(Soft_Label_Key_Set& S);
// Throw away the current set of SLKs and make the previous one the
// new current set.
bool pop();
// Retrieve the current set of Soft Labelled Keys.
Soft_Label_Key_Set* top() const;
// Attributes to use for menu and forms foregrounds
virtual chtype foregrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD;
}
// Attributes to use for menu and forms backgrounds
virtual chtype backgrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL;
}
// Attributes to use for inactive (menu) elements
virtual chtype inactives() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM;
}
// Attributes to use for (form) labels and SLKs
virtual chtype labels() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
}
// Attributes to use for form backgrounds
virtual chtype dialog_backgrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
}
// Attributes to use as default for (form) window backgrounds
virtual chtype window_backgrounds() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL;
}
// Attributes to use for the title window
virtual chtype screen_titles() const {
return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD;
}
};
#endif /* NCURSES_CURSESAPP_H_incl */
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Declaration of types and functions for "shadow" storage of hashed
passphrases. The shadow database is like the user database, but is
only accessible with special privileges, so that malicious users
cannot retrieve everyone else's hashed passphrase to brute-force at
their convenience. */
#ifndef _SHADOW_H
#define _SHADOW_H 1
#include <features.h>
#include <paths.h>
#define __need_size_t
#include <stddef.h>
#include <bits/types/FILE.h>
/* Paths to the user database files. */
#define SHADOW _PATH_SHADOW
__BEGIN_DECLS
/* A record in the shadow database. */
struct spwd
{
char *sp_namp; /* Login name. */
char *sp_pwdp; /* Hashed passphrase. */
long int sp_lstchg; /* Date of last change. */
long int sp_min; /* Minimum number of days between changes. */
long int sp_max; /* Maximum number of days between changes. */
long int sp_warn; /* Number of days to warn user to change
the password. */
long int sp_inact; /* Number of days the account may be
inactive. */
long int sp_expire; /* Number of days since 1970-01-01 until
account expires. */
unsigned long int sp_flag; /* Reserved. */
};
/* Open database for reading.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void setspent (void);
/* Close database.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void endspent (void);
/* Get next entry from database, perhaps after opening the file.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct spwd *getspent (void);
/* Get shadow entry matching NAME.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct spwd *getspnam (const char *__name);
/* Read shadow entry from STRING.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct spwd *sgetspent (const char *__string);
/* Read next shadow entry from STREAM.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct spwd *fgetspent (FILE *__stream);
/* Write line containing shadow entry to stream.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int putspent (const struct spwd *__p, FILE *__stream);
#ifdef __USE_MISC
/* Reentrant versions of some of the functions above.
These functions are not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation they are cancellation points and
therefore not marked with __THROW. */
extern int getspent_r (struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result);
extern int getspnam_r (const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
extern int sgetspent_r (const char *__string, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
#endif /* misc */
/* The simple locking functionality provided here is not suitable for
multi-threaded applications. */
/* Request exclusive access to /etc/passwd and /etc/shadow. */
extern int lckpwdf (void) __THROW;
/* Release exclusive access to /etc/passwd and /etc/shadow. */
extern int ulckpwdf (void) __THROW;
__END_DECLS
#endif /* shadow.h */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_NS_H_
#define _FC_NS_H_
#include <linux/types.h>
/*
* Fibre Channel Services - Name Service (dNS)
* From T11.org FC-GS-2 Rev 5.3 November 1998.
*/
/*
* Common-transport sub-type for Name Server.
*/
#define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */
/*
* Name server Requests.
* Note: this is an incomplete list, some unused requests are omitted.
*/
enum fc_ns_req {
FC_NS_GA_NXT = 0x0100, /* get all next */
FC_NS_GI_A = 0x0101, /* get identifiers - scope */
FC_NS_GPN_ID = 0x0112, /* get port name by ID */
FC_NS_GNN_ID = 0x0113, /* get node name by ID */
FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */
FC_NS_GID_PN = 0x0121, /* get ID for port name */
FC_NS_GID_NN = 0x0131, /* get IDs for node name */
FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
};
/*
* Port type values.
*/
enum fc_ns_pt {
FC_NS_UNID_PORT = 0x00, /* unidentified */
FC_NS_N_PORT = 0x01, /* N port */
FC_NS_NL_PORT = 0x02, /* NL port */
FC_NS_FNL_PORT = 0x03, /* F/NL port */
FC_NS_NX_PORT = 0x7f, /* Nx port */
FC_NS_F_PORT = 0x81, /* F port */
FC_NS_FL_PORT = 0x82, /* FL port */
FC_NS_E_PORT = 0x84, /* E port */
FC_NS_B_PORT = 0x85, /* B port */
};
/*
* Port type object.
*/
struct fc_ns_pt_obj {
__u8 pt_type;
};
/*
* Port ID object
*/
struct fc_ns_fid {
__u8 fp_flags; /* flags for responses only */
__u8 fp_fid[3];
};
/*
* fp_flags in port ID object, for responses only.
*/
#define FC_NS_FID_LAST 0x80 /* last object */
/*
* FC4-types object.
*/
#define FC_NS_TYPES 256 /* number of possible FC-4 types */
#define FC_NS_BPW 32 /* bits per word in bitmap */
struct fc_ns_fts {
__be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
};
/*
* FC4-features object.
*/
struct fc_ns_ff {
__be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
};
/*
* GID_PT request.
*/
struct fc_ns_gid_pt {
__u8 fn_pt_type;
__u8 fn_domain_id_scope;
__u8 fn_area_id_scope;
__u8 fn_resvd;
};
/*
* GID_FT or GPN_FT request.
*/
struct fc_ns_gid_ft {
__u8 fn_resvd;
__u8 fn_domain_id_scope;
__u8 fn_area_id_scope;
__u8 fn_fc4_type;
};
/*
* GPN_FT response.
*/
struct fc_gpn_ft_resp {
__u8 fp_flags; /* see fp_flags definitions above */
__u8 fp_fid[3]; /* port ID */
__be32 fp_resvd;
__be64 fp_wwpn; /* port name */
};
/*
* GID_PN request
*/
struct fc_ns_gid_pn {
__be64 fn_wwpn; /* port name */
};
/*
* GID_PN response or GSPN_ID request
*/
struct fc_gid_pn_resp {
__u8 fp_resvd;
__u8 fp_fid[3]; /* port ID */
};
/*
* GSPN_ID response
*/
struct fc_gspn_resp {
__u8 fp_name_len;
char fp_name[];
};
/*
* RFT_ID request - register FC-4 types for ID.
*/
struct fc_ns_rft_id {
struct fc_ns_fid fr_fid; /* port ID object */
struct fc_ns_fts fr_fts; /* FC-4 types object */
};
/*
* RPN_ID request - register port name for ID.
* RNN_ID request - register node name for ID.
*/
struct fc_ns_rn_id {
struct fc_ns_fid fr_fid; /* port ID object */
__be64 fr_wwn; /* node name or port name */
} __attribute__((__packed__));
/*
* RSNN_NN request - register symbolic node name
*/
struct fc_ns_rsnn {
__be64 fr_wwn; /* node name */
__u8 fr_name_len;
char fr_name[];
} __attribute__((__packed__));
/*
* RSPN_ID request - register symbolic port name
*/
struct fc_ns_rspn {
struct fc_ns_fid fr_fid; /* port ID object */
__u8 fr_name_len;
char fr_name[];
} __attribute__((__packed__));
/*
* RFF_ID request - register FC-4 Features for ID.
*/
struct fc_ns_rff_id {
struct fc_ns_fid fr_fid; /* port ID object */
__u8 fr_resvd[2];
__u8 fr_feat; /* FC-4 Feature bits */
__u8 fr_type; /* FC-4 type */
} __attribute__((__packed__));
#endif /* _FC_NS_H_ */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_GS_H_
#define _FC_GS_H_
#include <linux/types.h>
/*
* Fibre Channel Services - Common Transport.
* From T11.org FC-GS-2 Rev 5.3 November 1998.
*/
struct fc_ct_hdr {
__u8 ct_rev; /* revision */
__u8 ct_in_id[3]; /* N_Port ID of original requestor */
__u8 ct_fs_type; /* type of fibre channel service */
__u8 ct_fs_subtype; /* subtype */
__u8 ct_options;
__u8 _ct_resvd1;
__be16 ct_cmd; /* command / response code */
__be16 ct_mr_size; /* maximum / residual size */
__u8 _ct_resvd2;
__u8 ct_reason; /* reject reason */
__u8 ct_explan; /* reason code explanation */
__u8 ct_vendor; /* vendor unique data */
};
#define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */
enum fc_ct_rev {
FC_CT_REV = 1 /* common transport revision */
};
/*
* ct_fs_type values.
*/
enum fc_ct_fs_type {
FC_FST_ALIAS = 0xf8, /* alias service */
FC_FST_MGMT = 0xfa, /* management service */
FC_FST_TIME = 0xfb, /* time service */
FC_FST_DIR = 0xfc, /* directory service */
};
/*
* ct_cmd: Command / response codes
*/
enum fc_ct_cmd {
FC_FS_RJT = 0x8001, /* reject */
FC_FS_ACC = 0x8002, /* accept */
};
/*
* FS_RJT reason codes.
*/
enum fc_ct_reason {
FC_FS_RJT_CMD = 0x01, /* invalid command code */
FC_FS_RJT_VER = 0x02, /* invalid version level */
FC_FS_RJT_LOG = 0x03, /* logical error */
FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */
FC_FS_RJT_BSY = 0x05, /* logical busy */
FC_FS_RJT_PROTO = 0x07, /* protocol error */
FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */
FC_FS_RJT_UNSUP = 0x0b, /* command not supported */
};
/*
* FS_RJT reason code explanations.
*/
enum fc_ct_explan {
FC_FS_EXP_NONE = 0x00, /* no additional explanation */
FC_FS_EXP_PID = 0x01, /* port ID not registered */
FC_FS_EXP_PNAM = 0x02, /* port name not registered */
FC_FS_EXP_NNAM = 0x03, /* node name not registered */
FC_FS_EXP_COS = 0x04, /* class of service not registered */
FC_FS_EXP_FTNR = 0x07, /* FC-4 types not registered */
/* definitions not complete */
};
#endif /* _FC_GS_H_ */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_ELS_H_
#define _FC_ELS_H_
#include <linux/types.h>
#include <asm/byteorder.h>
/*
* Fibre Channel Switch - Enhanced Link Services definitions.
* From T11 FC-LS Rev 1.2 June 7, 2005.
*/
/*
* ELS Command codes - byte 0 of the frame payload
*/
enum fc_els_cmd {
ELS_LS_RJT = 0x01, /* ESL reject */
ELS_LS_ACC = 0x02, /* ESL Accept */
ELS_PLOGI = 0x03, /* N_Port login */
ELS_FLOGI = 0x04, /* F_Port login */
ELS_LOGO = 0x05, /* Logout */
ELS_ABTX = 0x06, /* Abort exchange - obsolete */
ELS_RCS = 0x07, /* read connection status */
ELS_RES = 0x08, /* read exchange status block */
ELS_RSS = 0x09, /* read sequence status block */
ELS_RSI = 0x0a, /* read sequence initiative */
ELS_ESTS = 0x0b, /* establish streaming */
ELS_ESTC = 0x0c, /* estimate credit */
ELS_ADVC = 0x0d, /* advise credit */
ELS_RTV = 0x0e, /* read timeout value */
ELS_RLS = 0x0f, /* read link error status block */
ELS_ECHO = 0x10, /* echo */
ELS_TEST = 0x11, /* test */
ELS_RRQ = 0x12, /* reinstate recovery qualifier */
ELS_REC = 0x13, /* read exchange concise */
ELS_SRR = 0x14, /* sequence retransmission request */
ELS_FPIN = 0x16, /* Fabric Performance Impact Notification */
ELS_EDC = 0x17, /* Exchange Diagnostic Capabilities */
ELS_RDP = 0x18, /* Read Diagnostic Parameters */
ELS_RDF = 0x19, /* Register Diagnostic Functions */
ELS_PRLI = 0x20, /* process login */
ELS_PRLO = 0x21, /* process logout */
ELS_SCN = 0x22, /* state change notification */
ELS_TPLS = 0x23, /* test process login state */
ELS_TPRLO = 0x24, /* third party process logout */
ELS_LCLM = 0x25, /* login control list mgmt (obs) */
ELS_GAID = 0x30, /* get alias_ID */
ELS_FACT = 0x31, /* fabric activate alias_id */
ELS_FDACDT = 0x32, /* fabric deactivate alias_id */
ELS_NACT = 0x33, /* N-port activate alias_id */
ELS_NDACT = 0x34, /* N-port deactivate alias_id */
ELS_QOSR = 0x40, /* quality of service request */
ELS_RVCS = 0x41, /* read virtual circuit status */
ELS_PDISC = 0x50, /* discover N_port service params */
ELS_FDISC = 0x51, /* discover F_port service params */
ELS_ADISC = 0x52, /* discover address */
ELS_RNC = 0x53, /* report node cap (obs) */
ELS_FARP_REQ = 0x54, /* FC ARP request */
ELS_FARP_REPL = 0x55, /* FC ARP reply */
ELS_RPS = 0x56, /* read port status block */
ELS_RPL = 0x57, /* read port list */
ELS_RPBC = 0x58, /* read port buffer condition */
ELS_FAN = 0x60, /* fabric address notification */
ELS_RSCN = 0x61, /* registered state change notification */
ELS_SCR = 0x62, /* state change registration */
ELS_RNFT = 0x63, /* report node FC-4 types */
ELS_CSR = 0x68, /* clock synch. request */
ELS_CSU = 0x69, /* clock synch. update */
ELS_LINIT = 0x70, /* loop initialize */
ELS_LSTS = 0x72, /* loop status */
ELS_RNID = 0x78, /* request node ID data */
ELS_RLIR = 0x79, /* registered link incident report */
ELS_LIRR = 0x7a, /* link incident record registration */
ELS_SRL = 0x7b, /* scan remote loop */
ELS_SBRP = 0x7c, /* set bit-error reporting params */
ELS_RPSC = 0x7d, /* report speed capabilities */
ELS_QSA = 0x7e, /* query security attributes */
ELS_EVFP = 0x7f, /* exchange virt. fabrics params */
ELS_LKA = 0x80, /* link keep-alive */
ELS_AUTH_ELS = 0x90, /* authentication ELS */
};
/*
* Initializer useful for decoding table.
* Please keep this in sync with the above definitions.
*/
#define FC_ELS_CMDS_INIT { \
[ELS_LS_RJT] = "LS_RJT", \
[ELS_LS_ACC] = "LS_ACC", \
[ELS_PLOGI] = "PLOGI", \
[ELS_FLOGI] = "FLOGI", \
[ELS_LOGO] = "LOGO", \
[ELS_ABTX] = "ABTX", \
[ELS_RCS] = "RCS", \
[ELS_RES] = "RES", \
[ELS_RSS] = "RSS", \
[ELS_RSI] = "RSI", \
[ELS_ESTS] = "ESTS", \
[ELS_ESTC] = "ESTC", \
[ELS_ADVC] = "ADVC", \
[ELS_RTV] = "RTV", \
[ELS_RLS] = "RLS", \
[ELS_ECHO] = "ECHO", \
[ELS_TEST] = "TEST", \
[ELS_RRQ] = "RRQ", \
[ELS_REC] = "REC", \
[ELS_SRR] = "SRR", \
[ELS_FPIN] = "FPIN", \
[ELS_EDC] = "EDC", \
[ELS_RDP] = "RDP", \
[ELS_RDF] = "RDF", \
[ELS_PRLI] = "PRLI", \
[ELS_PRLO] = "PRLO", \
[ELS_SCN] = "SCN", \
[ELS_TPLS] = "TPLS", \
[ELS_TPRLO] = "TPRLO", \
[ELS_LCLM] = "LCLM", \
[ELS_GAID] = "GAID", \
[ELS_FACT] = "FACT", \
[ELS_FDACDT] = "FDACDT", \
[ELS_NACT] = "NACT", \
[ELS_NDACT] = "NDACT", \
[ELS_QOSR] = "QOSR", \
[ELS_RVCS] = "RVCS", \
[ELS_PDISC] = "PDISC", \
[ELS_FDISC] = "FDISC", \
[ELS_ADISC] = "ADISC", \
[ELS_RNC] = "RNC", \
[ELS_FARP_REQ] = "FARP_REQ", \
[ELS_FARP_REPL] = "FARP_REPL", \
[ELS_RPS] = "RPS", \
[ELS_RPL] = "RPL", \
[ELS_RPBC] = "RPBC", \
[ELS_FAN] = "FAN", \
[ELS_RSCN] = "RSCN", \
[ELS_SCR] = "SCR", \
[ELS_RNFT] = "RNFT", \
[ELS_CSR] = "CSR", \
[ELS_CSU] = "CSU", \
[ELS_LINIT] = "LINIT", \
[ELS_LSTS] = "LSTS", \
[ELS_RNID] = "RNID", \
[ELS_RLIR] = "RLIR", \
[ELS_LIRR] = "LIRR", \
[ELS_SRL] = "SRL", \
[ELS_SBRP] = "SBRP", \
[ELS_RPSC] = "RPSC", \
[ELS_QSA] = "QSA", \
[ELS_EVFP] = "EVFP", \
[ELS_LKA] = "LKA", \
[ELS_AUTH_ELS] = "AUTH_ELS", \
}
/*
* LS_ACC payload.
*/
struct fc_els_ls_acc {
__u8 la_cmd; /* command code ELS_LS_ACC */
__u8 la_resv[3]; /* reserved */
};
/*
* ELS reject payload.
*/
struct fc_els_ls_rjt {
__u8 er_cmd; /* command code ELS_LS_RJT */
__u8 er_resv[4]; /* reserved must be zero */
__u8 er_reason; /* reason (enum fc_els_rjt_reason below) */
__u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */
__u8 er_vendor; /* vendor specific code */
};
/*
* ELS reject reason codes (er_reason).
*/
enum fc_els_rjt_reason {
ELS_RJT_NONE = 0, /* no reject - not to be sent */
ELS_RJT_INVAL = 0x01, /* invalid ELS command code */
ELS_RJT_LOGIC = 0x03, /* logical error */
ELS_RJT_BUSY = 0x05, /* logical busy */
ELS_RJT_PROT = 0x07, /* protocol error */
ELS_RJT_UNAB = 0x09, /* unable to perform command request */
ELS_RJT_UNSUP = 0x0b, /* command not supported */
ELS_RJT_INPROG = 0x0e, /* command already in progress */
ELS_RJT_FIP = 0x20, /* FIP error */
ELS_RJT_VENDOR = 0xff, /* vendor specific error */
};
/*
* reason code explanation (er_explan).
*/
enum fc_els_rjt_explan {
ELS_EXPL_NONE = 0x00, /* No additional explanation */
ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
ELS_EXPL_AH = 0x11, /* invalid association header */
ELS_EXPL_AH_REQ = 0x13, /* association_header required */
ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
ELS_EXPL_INPROG = 0x19, /* Request already in progress */
ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
/* TBD - above definitions incomplete */
};
/*
* Link Service TLV Descriptor Tag Values
*/
enum fc_ls_tlv_dtag {
ELS_DTAG_LS_REQ_INFO = 0x00000001,
/* Link Service Request Information Descriptor */
ELS_DTAG_LNK_FAULT_CAP = 0x0001000D,
/* Link Fault Capability Descriptor */
ELS_DTAG_CG_SIGNAL_CAP = 0x0001000F,
/* Congestion Signaling Capability Descriptor */
ELS_DTAG_LNK_INTEGRITY = 0x00020001,
/* Link Integrity Notification Descriptor */
ELS_DTAG_DELIVERY = 0x00020002,
/* Delivery Notification Descriptor */
ELS_DTAG_PEER_CONGEST = 0x00020003,
/* Peer Congestion Notification Descriptor */
ELS_DTAG_CONGESTION = 0x00020004,
/* Congestion Notification Descriptor */
ELS_DTAG_FPIN_REGISTER = 0x00030001,
/* FPIN Registration Descriptor */
};
/*
* Initializer useful for decoding table.
* Please keep this in sync with the above definitions.
*/
#define FC_LS_TLV_DTAG_INIT { \
{ ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, \
{ ELS_DTAG_LNK_FAULT_CAP, "Link Fault Capability" }, \
{ ELS_DTAG_CG_SIGNAL_CAP, "Congestion Signaling Capability" }, \
{ ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, \
{ ELS_DTAG_DELIVERY, "Delivery Notification Present" }, \
{ ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, \
{ ELS_DTAG_CONGESTION, "Congestion Notification" }, \
{ ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \
}
/*
* Generic Link Service TLV Descriptor format
*
* This structure, as it defines no payload, will also be referred to
* as the "tlv header" - which contains the tag and len fields.
*/
struct fc_tlv_desc {
__be32 desc_tag; /* Notification Descriptor Tag */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
__u8 desc_value[0]; /* Descriptor Value */
};
/* Descriptor tag and len fields are considered the mandatory header
* for a descriptor
*/
#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc)
/*
* Macro, used when initializing payloads, to return the descriptor length.
* Length is size of descriptor minus the tag and len fields.
*/
#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \
(sizeof(desc) - FC_TLV_DESC_HDR_SZ)
/* Macro, used on received payloads, to return the descriptor length */
#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \
(__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
/*
* This helper is used to walk descriptors in a descriptor list.
* Given the address of the current descriptor, which minimally contains a
* tag and len field, calculate the address of the next descriptor based
* on the len field.
*/
static __inline__ void *fc_tlv_next_desc(void *desc)
{
struct fc_tlv_desc *tlv = desc;
return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv));
}
/*
* Link Service Request Information Descriptor
*/
struct fc_els_lsri_desc {
__be32 desc_tag; /* descriptor tag (0x0000 0001) */
__be32 desc_len; /* Length of Descriptor (in bytes) (4).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
struct {
__u8 cmd; /* ELS cmd byte */
__u8 bytes[3]; /* bytes 1..3 */
} rqst_w0; /* Request word 0 */
};
/*
* Common service parameters (N ports).
*/
struct fc_els_csp {
__u8 sp_hi_ver; /* highest version supported (obs.) */
__u8 sp_lo_ver; /* highest version supported (obs.) */
__be16 sp_bb_cred; /* buffer-to-buffer credits */
__be16 sp_features; /* common feature flags */
__be16 sp_bb_data; /* b-b state number and data field sz */
union {
struct {
__be16 _sp_tot_seq; /* total concurrent sequences */
__be16 _sp_rel_off; /* rel. offset by info cat */
} sp_plogi;
struct {
__be32 _sp_r_a_tov; /* resource alloc. timeout msec */
} sp_flogi_acc;
} sp_u;
__be32 sp_e_d_tov; /* error detect timeout value */
};
#define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
#define sp_rel_off sp_u.sp_plogi._sp_rel_off
#define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
#define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
/*
* Minimum and maximum values for max data field size in service parameters.
*/
#define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
#define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
/*
* sp_features
*/
#define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
#define FC_SP_FT_RAND 0x4000 /* random relative offset */
#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
#define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
#define FC_SP_FT_MCAST 0x0200 /* multicast */
#define FC_SP_FT_BCAST 0x0100 /* broadcast */
#define FC_SP_FT_HUNT 0x0080 /* hunt group */
#define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
#define FC_SP_FT_SEC 0x0020 /* reserved for security */
#define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
#define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
#define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
#define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
#define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
/*
* Class-specific service parameters.
*/
struct fc_els_cssp {
__be16 cp_class; /* class flags */
__be16 cp_init; /* initiator flags */
__be16 cp_recip; /* recipient flags */
__be16 cp_rdfs; /* receive data field size */
__be16 cp_con_seq; /* concurrent sequences */
__be16 cp_ee_cred; /* N-port end-to-end credit */
__u8 cp_resv1; /* reserved */
__u8 cp_open_seq; /* open sequences per exchange */
__u8 _cp_resv2[2]; /* reserved */
};
/*
* cp_class flags.
*/
#define FC_CPC_VALID 0x8000 /* class valid */
#define FC_CPC_IMIX 0x4000 /* intermix mode */
#define FC_CPC_SEQ 0x0800 /* sequential delivery */
#define FC_CPC_CAMP 0x0200 /* camp-on */
#define FC_CPC_PRI 0x0080 /* priority */
/*
* cp_init flags.
* (TBD: not all flags defined here).
*/
#define FC_CPI_CSYN 0x0010 /* clock synch. capable */
/*
* cp_recip flags.
*/
#define FC_CPR_CSYN 0x0008 /* clock synch. capable */
/*
* NFC_ELS_FLOGI: Fabric login request.
* NFC_ELS_PLOGI: Port login request (same format).
*/
struct fc_els_flogi {
__u8 fl_cmd; /* command */
__u8 _fl_resvd[3]; /* must be zero */
struct fc_els_csp fl_csp; /* common service parameters */
__be64 fl_wwpn; /* port name */
__be64 fl_wwnn; /* node name */
struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
__u8 fl_vend[16]; /* vendor version level */
} __attribute__((__packed__));
/*
* Process login service parameter page.
*/
struct fc_els_spp {
__u8 spp_type; /* type code or common service params */
__u8 spp_type_ext; /* type code extension */
__u8 spp_flags;
__u8 _spp_resvd;
__be32 spp_orig_pa; /* originator process associator */
__be32 spp_resp_pa; /* responder process associator */
__be32 spp_params; /* service parameters */
};
/*
* spp_flags.
*/
#define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
#define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
#define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
#define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
/*
* SPP response code in spp_flags - lower 4 bits.
*/
enum fc_els_spp_resp {
FC_SPP_RESP_ACK = 1, /* request executed */
FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
FC_SPP_RESP_INIT = 3, /* initialization not complete */
FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
FC_SPP_RESP_COND = 6, /* request completed conditionally */
FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
FC_SPP_RESP_INVL = 8, /* SPP is invalid */
};
/*
* ELS_RRQ - Reinstate Recovery Qualifier
*/
struct fc_els_rrq {
__u8 rrq_cmd; /* command (0x12) */
__u8 rrq_zero[3]; /* specified as zero - part of cmd */
__u8 rrq_resvd; /* reserved */
__u8 rrq_s_id[3]; /* originator FID */
__be16 rrq_ox_id; /* originator exchange ID */
__be16 rrq_rx_id; /* responders exchange ID */
};
/*
* ELS_REC - Read exchange concise.
*/
struct fc_els_rec {
__u8 rec_cmd; /* command (0x13) */
__u8 rec_zero[3]; /* specified as zero - part of cmd */
__u8 rec_resvd; /* reserved */
__u8 rec_s_id[3]; /* originator FID */
__be16 rec_ox_id; /* originator exchange ID */
__be16 rec_rx_id; /* responders exchange ID */
};
/*
* ELS_REC LS_ACC payload.
*/
struct fc_els_rec_acc {
__u8 reca_cmd; /* accept (0x02) */
__u8 reca_zero[3]; /* specified as zero - part of cmd */
__be16 reca_ox_id; /* originator exchange ID */
__be16 reca_rx_id; /* responders exchange ID */
__u8 reca_resvd1; /* reserved */
__u8 reca_ofid[3]; /* originator FID */
__u8 reca_resvd2; /* reserved */
__u8 reca_rfid[3]; /* responder FID */
__be32 reca_fc4value; /* FC4 value */
__be32 reca_e_stat; /* ESB (exchange status block) status */
};
/*
* ELS_PRLI - Process login request and response.
*/
struct fc_els_prli {
__u8 prli_cmd; /* command */
__u8 prli_spp_len; /* length of each serv. parm. page */
__be16 prli_len; /* length of entire payload */
/* service parameter pages follow */
};
/*
* ELS_PRLO - Process logout request and response.
*/
struct fc_els_prlo {
__u8 prlo_cmd; /* command */
__u8 prlo_obs; /* obsolete, but shall be set to 10h */
__be16 prlo_len; /* payload length */
};
/*
* ELS_ADISC payload
*/
struct fc_els_adisc {
__u8 adisc_cmd;
__u8 adisc_resv[3];
__u8 adisc_resv1;
__u8 adisc_hard_addr[3];
__be64 adisc_wwpn;
__be64 adisc_wwnn;
__u8 adisc_resv2;
__u8 adisc_port_id[3];
} __attribute__((__packed__));
/*
* ELS_LOGO - process or fabric logout.
*/
struct fc_els_logo {
__u8 fl_cmd; /* command code */
__u8 fl_zero[3]; /* specified as zero - part of cmd */
__u8 fl_resvd; /* reserved */
__u8 fl_n_port_id[3];/* N port ID */
__be64 fl_n_port_wwn; /* port name */
};
/*
* ELS_RTV - read timeout value.
*/
struct fc_els_rtv {
__u8 rtv_cmd; /* command code 0x0e */
__u8 rtv_zero[3]; /* specified as zero - part of cmd */
};
/*
* LS_ACC for ELS_RTV - read timeout value.
*/
struct fc_els_rtv_acc {
__u8 rtv_cmd; /* command code 0x02 */
__u8 rtv_zero[3]; /* specified as zero - part of cmd */
__be32 rtv_r_a_tov; /* resource allocation timeout value */
__be32 rtv_e_d_tov; /* error detection timeout value */
__be32 rtv_toq; /* timeout qualifier (see below) */
};
/*
* rtv_toq bits.
*/
#define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
#define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
/*
* ELS_SCR - state change registration payload.
*/
struct fc_els_scr {
__u8 scr_cmd; /* command code */
__u8 scr_resv[6]; /* reserved */
__u8 scr_reg_func; /* registration function (see below) */
};
enum fc_els_scr_func {
ELS_SCRF_FAB = 1, /* fabric-detected registration */
ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
ELS_SCRF_FULL = 3, /* full registration */
ELS_SCRF_CLEAR = 255, /* remove any current registrations */
};
/*
* ELS_RSCN - registered state change notification payload.
*/
struct fc_els_rscn {
__u8 rscn_cmd; /* RSCN opcode (0x61) */
__u8 rscn_page_len; /* page length (4) */
__be16 rscn_plen; /* payload length including this word */
/* followed by 4-byte generic affected Port_ID pages */
};
struct fc_els_rscn_page {
__u8 rscn_page_flags; /* event and address format */
__u8 rscn_fid[3]; /* fabric ID */
};
#define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
#define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
#define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
#define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
enum fc_els_rscn_ev_qual {
ELS_EV_QUAL_NONE = 0, /* unspecified */
ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
};
enum fc_els_rscn_addr_fmt {
ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
};
/*
* ELS_RNID - request Node ID.
*/
struct fc_els_rnid {
__u8 rnid_cmd; /* RNID opcode (0x78) */
__u8 rnid_resv[3]; /* reserved */
__u8 rnid_fmt; /* data format */
__u8 rnid_resv2[3]; /* reserved */
};
/*
* Node Identification Data formats (rnid_fmt)
*/
enum fc_els_rnid_fmt {
ELS_RNIDF_NONE = 0, /* no specific identification data */
ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
};
/*
* ELS_RNID response.
*/
struct fc_els_rnid_resp {
__u8 rnid_cmd; /* response code (LS_ACC) */
__u8 rnid_resv[3]; /* reserved */
__u8 rnid_fmt; /* data format */
__u8 rnid_cid_len; /* common ID data length */
__u8 rnid_resv2; /* reserved */
__u8 rnid_sid_len; /* specific ID data length */
};
struct fc_els_rnid_cid {
__be64 rnid_wwpn; /* N port name */
__be64 rnid_wwnn; /* node name */
};
struct fc_els_rnid_gen {
__u8 rnid_vend_id[16]; /* vendor-unique ID */
__be32 rnid_atype; /* associated type (see below) */
__be32 rnid_phys_port; /* physical port number */
__be32 rnid_att_nodes; /* number of attached nodes */
__u8 rnid_node_mgmt; /* node management (see below) */
__u8 rnid_ip_ver; /* IP version (see below) */
__be16 rnid_prot_port; /* UDP / TCP port number */
__be32 rnid_ip_addr[4]; /* IP address */
__u8 rnid_resvd[2]; /* reserved */
__be16 rnid_vend_spec; /* vendor-specific field */
};
enum fc_els_rnid_atype {
ELS_RNIDA_UNK = 0x01, /* unknown */
ELS_RNIDA_OTHER = 0x02, /* none of the following */
ELS_RNIDA_HUB = 0x03,
ELS_RNIDA_SWITCH = 0x04,
ELS_RNIDA_GATEWAY = 0x05,
ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
ELS_RNIDA_STORAGE = 0x09,
ELS_RNIDA_HOST = 0x0a,
ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
ELS_RNIDA_NAS = 0x11, /* NAS server */
ELS_RNIDA_BRIDGE = 0x12, /* bridge */
ELS_RNIDA_VIRT = 0x13, /* virtualization device */
ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
};
enum fc_els_rnid_mgmt {
ELS_RNIDM_SNMP = 0,
ELS_RNIDM_TELNET = 1,
ELS_RNIDM_HTTP = 2,
ELS_RNIDM_HTTPS = 3,
ELS_RNIDM_XML = 4, /* HTTP + XML */
};
enum fc_els_rnid_ipver {
ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
ELS_RNIDIP_V4 = 1, /* IPv4 */
ELS_RNIDIP_V6 = 2, /* IPv6 */
};
/*
* ELS RPL - Read Port List.
*/
struct fc_els_rpl {
__u8 rpl_cmd; /* command */
__u8 rpl_resv[5]; /* reserved - must be zero */
__be16 rpl_max_size; /* maximum response size or zero */
__u8 rpl_resv1; /* reserved - must be zero */
__u8 rpl_index[3]; /* starting index */
};
/*
* Port number block in RPL response.
*/
struct fc_els_pnb {
__be32 pnb_phys_pn; /* physical port number */
__u8 pnb_resv; /* reserved */
__u8 pnb_port_id[3]; /* port ID */
__be64 pnb_wwpn; /* port name */
};
/*
* RPL LS_ACC response.
*/
struct fc_els_rpl_resp {
__u8 rpl_cmd; /* ELS_LS_ACC */
__u8 rpl_resv1; /* reserved - must be zero */
__be16 rpl_plen; /* payload length */
__u8 rpl_resv2; /* reserved - must be zero */
__u8 rpl_llen[3]; /* list length */
__u8 rpl_resv3; /* reserved - must be zero */
__u8 rpl_index[3]; /* starting index */
struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
};
/*
* Link Error Status Block.
*/
struct fc_els_lesb {
__be32 lesb_link_fail; /* link failure count */
__be32 lesb_sync_loss; /* loss of synchronization count */
__be32 lesb_sig_loss; /* loss of signal count */
__be32 lesb_prim_err; /* primitive sequence error count */
__be32 lesb_inv_word; /* invalid transmission word count */
__be32 lesb_inv_crc; /* invalid CRC count */
};
/*
* ELS RPS - Read Port Status Block request.
*/
struct fc_els_rps {
__u8 rps_cmd; /* command */
__u8 rps_resv[2]; /* reserved - must be zero */
__u8 rps_flag; /* flag - see below */
__be64 rps_port_spec; /* port selection */
};
enum fc_els_rps_flag {
FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
};
/*
* ELS RPS LS_ACC response.
*/
struct fc_els_rps_resp {
__u8 rps_cmd; /* command - LS_ACC */
__u8 rps_resv[2]; /* reserved - must be zero */
__u8 rps_flag; /* flag - see below */
__u8 rps_resv2[2]; /* reserved */
__be16 rps_status; /* port status - see below */
struct fc_els_lesb rps_lesb; /* link error status block */
};
enum fc_els_rps_resp_flag {
FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
};
enum fc_els_rps_resp_status {
FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
};
/*
* ELS LIRR - Link Incident Record Registration request.
*/
struct fc_els_lirr {
__u8 lirr_cmd; /* command */
__u8 lirr_resv[3]; /* reserved - must be zero */
__u8 lirr_func; /* registration function */
__u8 lirr_fmt; /* FC-4 type of RLIR requested */
__u8 lirr_resv2[2]; /* reserved - must be zero */
};
enum fc_els_lirr_func {
ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
ELS_LIRR_CLEAR = 0xff /* clear registration */
};
/*
* ELS SRL - Scan Remote Loop request.
*/
struct fc_els_srl {
__u8 srl_cmd; /* command */
__u8 srl_resv[3]; /* reserved - must be zero */
__u8 srl_flag; /* flag - see below */
__u8 srl_flag_param[3]; /* flag parameter */
};
enum fc_els_srl_flag {
FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
};
/*
* ELS RLS - Read Link Error Status Block request.
*/
struct fc_els_rls {
__u8 rls_cmd; /* command */
__u8 rls_resv[4]; /* reserved - must be zero */
__u8 rls_port_id[3]; /* port ID */
};
/*
* ELS RLS LS_ACC Response.
*/
struct fc_els_rls_resp {
__u8 rls_cmd; /* ELS_LS_ACC */
__u8 rls_resv[3]; /* reserved - must be zero */
struct fc_els_lesb rls_lesb; /* link error status block */
};
/*
* ELS RLIR - Registered Link Incident Report.
* This is followed by the CLIR and the CLID, described below.
*/
struct fc_els_rlir {
__u8 rlir_cmd; /* command */
__u8 rlir_resv[3]; /* reserved - must be zero */
__u8 rlir_fmt; /* format (FC4-type if type specific) */
__u8 rlir_clr_len; /* common link incident record length */
__u8 rlir_cld_len; /* common link incident desc. length */
__u8 rlir_slr_len; /* spec. link incident record length */
};
/*
* CLIR - Common Link Incident Record Data. - Sent via RLIR.
*/
struct fc_els_clir {
__be64 clir_wwpn; /* incident port name */
__be64 clir_wwnn; /* incident port node name */
__u8 clir_port_type; /* incident port type */
__u8 clir_port_id[3]; /* incident port ID */
__be64 clir_conn_wwpn; /* connected port name */
__be64 clir_conn_wwnn; /* connected node name */
__be64 clir_fab_name; /* fabric name */
__be32 clir_phys_port; /* physical port number */
__be32 clir_trans_id; /* transaction ID */
__u8 clir_resv[3]; /* reserved */
__u8 clir_ts_fmt; /* time stamp format */
__be64 clir_timestamp; /* time stamp */
};
/*
* CLIR clir_ts_fmt - time stamp format values.
*/
enum fc_els_clir_ts_fmt {
ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
};
/*
* Common Link Incident Descriptor - sent via RLIR.
*/
struct fc_els_clid {
__u8 clid_iq; /* incident qualifier flags */
__u8 clid_ic; /* incident code */
__be16 clid_epai; /* domain/area of ISL */
};
/*
* CLID incident qualifier flags.
*/
enum fc_els_clid_iq {
ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
ELS_CLID_SEV_INFO = 0x00, /* report is informational */
ELS_CLID_SEV_INOP = 0x08, /* link not operational */
ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
ELS_CLID_LASER = 0x02, /* subassembly is a laser */
ELS_CLID_FRU = 0x01, /* format can identify a FRU */
};
/*
* CLID incident code.
*/
enum fc_els_clid_ic {
ELS_CLID_IC_IMPL = 1, /* implicit incident */
ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
ELS_CLID_IC_LIP = 8, /* receiving LIP */
};
/*
* Link Integrity event types
*/
enum fc_fpin_li_event_types {
FPIN_LI_UNKNOWN = 0x0,
FPIN_LI_LINK_FAILURE = 0x1,
FPIN_LI_LOSS_OF_SYNC = 0x2,
FPIN_LI_LOSS_OF_SIG = 0x3,
FPIN_LI_PRIM_SEQ_ERR = 0x4,
FPIN_LI_INVALID_TX_WD = 0x5,
FPIN_LI_INVALID_CRC = 0x6,
FPIN_LI_DEVICE_SPEC = 0xF,
};
/*
* Initializer useful for decoding table.
* Please keep this in sync with the above definitions.
*/
#define FC_FPIN_LI_EVT_TYPES_INIT { \
{ FPIN_LI_UNKNOWN, "Unknown" }, \
{ FPIN_LI_LINK_FAILURE, "Link Failure" }, \
{ FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, \
{ FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, \
{ FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, \
{ FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, \
{ FPIN_LI_INVALID_CRC, "Invalid CRC" }, \
{ FPIN_LI_DEVICE_SPEC, "Device Specific" }, \
}
/*
* Delivery event types
*/
enum fc_fpin_deli_event_types {
FPIN_DELI_UNKNOWN = 0x0,
FPIN_DELI_TIMEOUT = 0x1,
FPIN_DELI_UNABLE_TO_ROUTE = 0x2,
FPIN_DELI_DEVICE_SPEC = 0xF,
};
/*
* Initializer useful for decoding table.
* Please keep this in sync with the above definitions.
*/
#define FC_FPIN_DELI_EVT_TYPES_INIT { \
{ FPIN_DELI_UNKNOWN, "Unknown" }, \
{ FPIN_DELI_TIMEOUT, "Timeout" }, \
{ FPIN_DELI_UNABLE_TO_ROUTE, "Unable to Route" }, \
{ FPIN_DELI_DEVICE_SPEC, "Device Specific" }, \
}
/*
* Congestion event types
*/
enum fc_fpin_congn_event_types {
FPIN_CONGN_CLEAR = 0x0,
FPIN_CONGN_LOST_CREDIT = 0x1,
FPIN_CONGN_CREDIT_STALL = 0x2,
FPIN_CONGN_OVERSUBSCRIPTION = 0x3,
FPIN_CONGN_DEVICE_SPEC = 0xF,
};
/*
* Initializer useful for decoding table.
* Please keep this in sync with the above definitions.
*/
#define FC_FPIN_CONGN_EVT_TYPES_INIT { \
{ FPIN_CONGN_CLEAR, "Clear" }, \
{ FPIN_CONGN_LOST_CREDIT, "Lost Credit" }, \
{ FPIN_CONGN_CREDIT_STALL, "Credit Stall" }, \
{ FPIN_CONGN_OVERSUBSCRIPTION, "Oversubscription" }, \
{ FPIN_CONGN_DEVICE_SPEC, "Device Specific" }, \
}
enum fc_fpin_congn_severity_types {
FPIN_CONGN_SEVERITY_WARNING = 0xF1,
FPIN_CONGN_SEVERITY_ERROR = 0xF7,
};
/*
* Link Integrity Notification Descriptor
*/
struct fc_fn_li_desc {
__be32 desc_tag; /* Descriptor Tag (0x00020001) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
__be64 detecting_wwpn; /* Port Name that detected event */
__be64 attached_wwpn; /* Port Name of device attached to
* detecting Port Name
*/
__be16 event_type; /* see enum fc_fpin_li_event_types */
__be16 event_modifier; /* Implementation specific value
* describing the event type
*/
__be32 event_threshold;/* duration in ms of the link
* integrity detection cycle
*/
__be32 event_count; /* minimum number of event
* occurrences during the event
* threshold to caause the LI event
*/
__be32 pname_count; /* number of portname_list elements */
__be64 pname_list[0]; /* list of N_Port_Names accessible
* through the attached port
*/
};
/*
* Delivery Notification Descriptor
*/
struct fc_fn_deli_desc {
__be32 desc_tag; /* Descriptor Tag (0x00020002) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
__be64 detecting_wwpn; /* Port Name that detected event */
__be64 attached_wwpn; /* Port Name of device attached to
* detecting Port Name
*/
__be32 deli_reason_code;/* see enum fc_fpin_deli_event_types */
};
/*
* Peer Congestion Notification Descriptor
*/
struct fc_fn_peer_congn_desc {
__be32 desc_tag; /* Descriptor Tag (0x00020003) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
__be64 detecting_wwpn; /* Port Name that detected event */
__be64 attached_wwpn; /* Port Name of device attached to
* detecting Port Name
*/
__be16 event_type; /* see enum fc_fpin_congn_event_types */
__be16 event_modifier; /* Implementation specific value
* describing the event type
*/
__be32 event_period; /* duration (ms) of the detected
* congestion event
*/
__be32 pname_count; /* number of portname_list elements */
__be64 pname_list[0]; /* list of N_Port_Names accessible
* through the attached port
*/
};
/*
* Congestion Notification Descriptor
*/
struct fc_fn_congn_desc {
__be32 desc_tag; /* Descriptor Tag (0x00020004) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
__be16 event_type; /* see enum fc_fpin_congn_event_types */
__be16 event_modifier; /* Implementation specific value
* describing the event type
*/
__be32 event_period; /* duration (ms) of the detected
* congestion event
*/
__u8 severity; /* command */
__u8 resv[3]; /* reserved - must be zero */
};
/*
* ELS_FPIN - Fabric Performance Impact Notification
*/
struct fc_els_fpin {
__u8 fpin_cmd; /* command (0x16) */
__u8 fpin_zero[3]; /* specified as zero - part of cmd */
__be32 desc_len; /* Length of Descriptor List (in bytes).
* Size of ELS excluding fpin_cmd,
* fpin_zero and desc_len fields.
*/
struct fc_tlv_desc fpin_desc[0]; /* Descriptor list */
};
/* Diagnostic Function Descriptor - FPIN Registration */
struct fc_df_desc_fpin_reg {
__be32 desc_tag; /* FPIN Registration (0x00030001) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
__be32 count; /* Number of desc_tags elements */
__be32 desc_tags[0]; /* Array of Descriptor Tags.
* Each tag indicates a function
* supported by the N_Port (request)
* or by the N_Port and Fabric
* Controller (reply; may be a subset
* of the request).
* See ELS_FN_DTAG_xxx for tag values.
*/
};
/*
* ELS_RDF - Register Diagnostic Functions
*/
struct fc_els_rdf {
__u8 fpin_cmd; /* command (0x19) */
__u8 fpin_zero[3]; /* specified as zero - part of cmd */
__be32 desc_len; /* Length of Descriptor List (in bytes).
* Size of ELS excluding fpin_cmd,
* fpin_zero and desc_len fields.
*/
struct fc_tlv_desc desc[0]; /* Descriptor list */
};
/*
* ELS RDF LS_ACC Response.
*/
struct fc_els_rdf_resp {
struct fc_els_ls_acc acc_hdr;
__be32 desc_list_len; /* Length of response (in
* bytes). Excludes acc_hdr
* and desc_list_len fields.
*/
struct fc_els_lsri_desc lsri;
struct fc_tlv_desc desc[0]; /* Supported Descriptor list */
};
/*
* Diagnostic Capability Descriptors for EDC ELS
*/
/*
* Diagnostic: Link Fault Capability Descriptor
*/
struct fc_diag_lnkflt_desc {
__be32 desc_tag; /* Descriptor Tag (0x0001000D) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
* 12 bytes
*/
__be32 degrade_activate_threshold;
__be32 degrade_deactivate_threshold;
__be32 fec_degrade_interval;
};
enum fc_edc_cg_signal_cap_types {
/* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */
EDC_CG_SIG_NOTSUPPORTED = 0x00, /* neither supported */
EDC_CG_SIG_WARN_ONLY = 0x01,
EDC_CG_SIG_WARN_ALARM = 0x02, /* both supported */
};
/*
* Initializer useful for decoding table.
* Please keep this in sync with the above definitions.
*/
#define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT { \
{ EDC_CG_SIG_NOTSUPPORTED, "Signaling Not Supported" }, \
{ EDC_CG_SIG_WARN_ONLY, "Warning Signal" }, \
{ EDC_CG_SIG_WARN_ALARM, "Warning and Alarm Signals" }, \
}
enum fc_diag_cg_sig_freq_types {
EDC_CG_SIGFREQ_CNT_MIN = 1, /* Min Frequency Count */
EDC_CG_SIGFREQ_CNT_MAX = 999, /* Max Frequency Count */
EDC_CG_SIGFREQ_SEC = 0x1, /* Units: seconds */
EDC_CG_SIGFREQ_MSEC = 0x2, /* Units: milliseconds */
};
struct fc_diag_cg_sig_freq {
__be16 count; /* Time between signals
* note: upper 6 bits rsvd
*/
__be16 units; /* Time unit for count
* note: upper 12 bits rsvd
*/
};
/*
* Diagnostic: Congestion Signaling Capability Descriptor
*/
struct fc_diag_cg_sig_desc {
__be32 desc_tag; /* Descriptor Tag (0x0001000F) */
__be32 desc_len; /* Length of Descriptor (in bytes).
* Size of descriptor excluding
* desc_tag and desc_len fields.
* 16 bytes
*/
__be32 xmt_signal_capability;
struct fc_diag_cg_sig_freq xmt_signal_frequency;
__be32 rcv_signal_capability;
struct fc_diag_cg_sig_freq rcv_signal_frequency;
};
/*
* ELS_EDC - Exchange Diagnostic Capabilities
*/
struct fc_els_edc {
__u8 edc_cmd; /* command (0x17) */
__u8 edc_zero[3]; /* specified as zero - part of cmd */
__be32 desc_len; /* Length of Descriptor List (in bytes).
* Size of ELS excluding edc_cmd,
* edc_zero and desc_len fields.
*/
struct fc_tlv_desc desc[0];
/* Diagnostic Descriptor list */
};
/*
* ELS EDC LS_ACC Response.
*/
struct fc_els_edc_resp {
struct fc_els_ls_acc acc_hdr;
__be32 desc_list_len; /* Length of response (in
* bytes). Excludes acc_hdr
* and desc_list_len fields.
*/
struct fc_els_lsri_desc lsri;
struct fc_tlv_desc desc[0];
/* Supported Diagnostic Descriptor list */
};
#endif /* _FC_ELS_H_ */
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_FS_H_
#define _FC_FS_H_
#include <linux/types.h>
/*
* Fibre Channel Framing and Signalling definitions.
* From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
*/
/*
* Frame header
*/
struct fc_frame_header {
__u8 fh_r_ctl; /* routing control */
__u8 fh_d_id[3]; /* Destination ID */
__u8 fh_cs_ctl; /* class of service control / pri */
__u8 fh_s_id[3]; /* Source ID */
__u8 fh_type; /* see enum fc_fh_type below */
__u8 fh_f_ctl[3]; /* frame control */
__u8 fh_seq_id; /* sequence ID */
__u8 fh_df_ctl; /* data field control */
__be16 fh_seq_cnt; /* sequence count */
__be16 fh_ox_id; /* originator exchange ID */
__be16 fh_rx_id; /* responder exchange ID */
__be32 fh_parm_offset; /* parameter or relative offset */
};
#define FC_FRAME_HEADER_LEN 24 /* expected length of structure */
#define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */
#define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */
#define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
/*
* fh_r_ctl - Routing control definitions.
*/
/*
* FC-4 device_data.
*/
enum fc_rctl {
FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */
FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */
FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */
FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */
FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */
FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */
FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */
FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */
#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */
#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */
/*
* Extended Link_Data
*/
FC_RCTL_ELS_REQ = 0x22, /* extended link services request */
FC_RCTL_ELS_REP = 0x23, /* extended link services reply */
FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */
FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */
/*
* Optional Extended Headers
*/
FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */
FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */
FC_RCTL_ENCH = 0x52, /* encapsulation header */
/*
* Basic Link Services fh_r_ctl values.
*/
FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */
FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */
FC_RCTL_BA_RMC = 0x82, /* remove connection */
FC_RCTL_BA_ACC = 0x84, /* basic accept */
FC_RCTL_BA_RJT = 0x85, /* basic reject */
FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */
/*
* Link Control Information.
*/
FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */
FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */
FC_RCTL_P_RJT = 0xc2, /* port reject */
FC_RCTL_F_RJT = 0xc3, /* fabric reject */
FC_RCTL_P_BSY = 0xc4, /* port busy */
FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */
FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */
FC_RCTL_LCR = 0xc7, /* link credit reset */
FC_RCTL_END = 0xc9, /* end */
};
/* incomplete list of definitions */
/*
* R_CTL names initializer.
* Please keep this matching the above definitions.
*/
#define FC_RCTL_NAMES_INIT { \
[FC_RCTL_DD_UNCAT] = "uncat", \
[FC_RCTL_DD_SOL_DATA] = "sol data", \
[FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \
[FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \
[FC_RCTL_DD_UNSOL_DATA] = "unsol data", \
[FC_RCTL_DD_DATA_DESC] = "data desc", \
[FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \
[FC_RCTL_DD_CMD_STATUS] = "cmd status", \
[FC_RCTL_ELS_REQ] = "ELS req", \
[FC_RCTL_ELS_REP] = "ELS rep", \
[FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \
[FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \
[FC_RCTL_BA_NOP] = "BLS NOP", \
[FC_RCTL_BA_ABTS] = "BLS abort", \
[FC_RCTL_BA_RMC] = "BLS remove connection", \
[FC_RCTL_BA_ACC] = "BLS accept", \
[FC_RCTL_BA_RJT] = "BLS reject", \
[FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \
[FC_RCTL_ACK_1] = "LC ACK_1", \
[FC_RCTL_ACK_0] = "LC ACK_0", \
[FC_RCTL_P_RJT] = "LC port reject", \
[FC_RCTL_F_RJT] = "LC fabric reject", \
[FC_RCTL_P_BSY] = "LC port busy", \
[FC_RCTL_F_BSY] = "LC fabric busy to data frame", \
[FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\
[FC_RCTL_LCR] = "LC link credit reset", \
[FC_RCTL_END] = "LC end", \
}
/*
* Well-known fabric addresses.
*/
enum fc_well_known_fid {
FC_FID_NONE = 0x000000, /* No destination */
FC_FID_BCAST = 0xffffff, /* broadcast */
FC_FID_FLOGI = 0xfffffe, /* fabric login */
FC_FID_FCTRL = 0xfffffd, /* fabric controller */
FC_FID_DIR_SERV = 0xfffffc, /* directory server */
FC_FID_TIME_SERV = 0xfffffb, /* time server */
FC_FID_MGMT_SERV = 0xfffffa, /* management server */
FC_FID_QOS = 0xfffff9, /* QoS Facilitator */
FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */
FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */
FC_FID_CLOCK = 0xfffff6, /* clock synch server */
FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */
};
#define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */
#define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */
/*
* Other well-known addresses, outside the above contiguous range.
*/
#define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */
/*
* Fabric ID bytes.
*/
#define FC_FID_DOMAIN 0
#define FC_FID_PORT 1
#define FC_FID_LINK 2
/*
* fh_type codes
*/
enum fc_fh_type {
FC_TYPE_BLS = 0x00, /* basic link service */
FC_TYPE_ELS = 0x01, /* extended link service */
FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */
FC_TYPE_FCP = 0x08, /* SCSI FCP */
FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */
FC_TYPE_ILS = 0x22, /* internal link service */
FC_TYPE_NVME = 0x28, /* FC-NVME */
};
/*
* FC_TYPE names initializer.
* Please keep this matching the above definitions.
*/
#define FC_TYPE_NAMES_INIT { \
[FC_TYPE_BLS] = "BLS", \
[FC_TYPE_ELS] = "ELS", \
[FC_TYPE_IP] = "IP", \
[FC_TYPE_FCP] = "FCP", \
[FC_TYPE_CT] = "CT", \
[FC_TYPE_ILS] = "ILS", \
[FC_TYPE_NVME] = "NVME", \
}
/*
* Exchange IDs.
*/
#define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */
#define FC_XID_MIN 0x0 /* supported min exchange ID */
#define FC_XID_MAX 0xfffe /* supported max exchange ID */
/*
* fh_f_ctl - Frame control flags.
*/
#define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */
#define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */
#define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */
#define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */
#define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */
#define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */
#define FC_FC_RES_B17 (1 << 17) /* reserved */
#define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */
#define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */
#define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */
#define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */
#define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */
#define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */
#define FC_FC_RES_B11 (1 << 11) /* reserved */
#define FC_FC_RES_B10 (1 << 10) /* reserved */
#define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */
#define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */
#define FC_FC_CONT_SEQ(i) ((i) << 6)
#define FC_FC_ABT_SEQ(i) ((i) << 4)
#define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */
#define FC_FC_RES2 (1 << 2) /* reserved */
#define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */
/*
* BA_ACC payload.
*/
struct fc_ba_acc {
__u8 ba_seq_id_val; /* SEQ_ID validity */
#define FC_BA_SEQ_ID_VAL 0x80
__u8 ba_seq_id; /* SEQ_ID of seq last deliverable */
__u8 ba_resvd[2]; /* reserved */
__be16 ba_ox_id; /* OX_ID for aborted seq or exch */
__be16 ba_rx_id; /* RX_ID for aborted seq or exch */
__be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */
__be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */
};
/*
* BA_RJT: Basic Reject payload.
*/
struct fc_ba_rjt {
__u8 br_resvd; /* reserved */
__u8 br_reason; /* reason code */
__u8 br_explan; /* reason explanation */
__u8 br_vendor; /* vendor unique code */
};
/*
* BA_RJT reason codes.
* From FS-2.
*/
enum fc_ba_rjt_reason {
FC_BA_RJT_NONE = 0, /* in software this means no reject */
FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */
FC_BA_RJT_LOG_ERR = 0x03, /* logical error */
FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */
FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */
FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */
FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */
};
/*
* BA_RJT reason code explanations.
*/
enum fc_ba_rjt_explan {
FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */
FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */
FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */
};
/*
* P_RJT or F_RJT: Port Reject or Fabric Reject parameter field.
*/
struct fc_pf_rjt {
__u8 rj_action; /* reserved */
__u8 rj_reason; /* reason code */
__u8 rj_resvd; /* reserved */
__u8 rj_vendor; /* vendor unique code */
};
/*
* P_RJT and F_RJT reject reason codes.
*/
enum fc_pf_rjt_reason {
FC_RJT_NONE = 0, /* non-reject (reserved by standard) */
FC_RJT_INVL_DID = 0x01, /* invalid destination ID */
FC_RJT_INVL_SID = 0x02, /* invalid source ID */
FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */
FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */
FC_RJT_CLS_UNSUP = 0x05, /* class not supported */
FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */
FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */
FC_RJT_LINK_CTL = 0x08, /* invalid link control */
FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */
FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */
FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */
FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */
FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */
FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */
FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */
FC_RJT_PARAM = 0x10, /* invalid parameter field */
FC_RJT_EXCH_ERR = 0x11, /* exchange error */
FC_RJT_PROTO = 0x12, /* protocol error */
FC_RJT_LEN = 0x13, /* incorrect length */
FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */
FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */
FC_RJT_LOGI_REQ = 0x16, /* login required */
FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */
FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */
FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */
FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */
FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */
FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */
FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */
FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */
FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */
FC_RJT_MCAST_ERR = 0x22, /* multicast error */
FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */
FC_RJT_PRLI_REQ = 0x24, /* process login required */
FC_RJT_INVL_ATT = 0x25, /* invalid attachment */
FC_RJT_VENDOR = 0xff, /* vendor specific reject */
};
/* default timeout values */
#define FC_DEF_E_D_TOV 2000UL
#define FC_DEF_R_A_TOV 10000UL
#endif /* _FC_FS_H_ */
/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
/*
* Driver for Broadcom MPI3 Storage Controllers
*
* Copyright (C) 2017-2022 Broadcom Inc.
* (mailto: mpi3mr-linuxdrv.pdl@broadcom.com)
*
*/
#ifndef SCSI_BSG_MPI3MR_H_INCLUDED
#define SCSI_BSG_MPI3MR_H_INCLUDED
#include <linux/types.h>
/* Definitions for BSG commands */
#define MPI3MR_IOCTL_VERSION 0x06
#define MPI3MR_APP_DEFAULT_TIMEOUT (60) /*seconds*/
#define MPI3MR_BSG_ADPTYPE_UNKNOWN 0
#define MPI3MR_BSG_ADPTYPE_AVGFAMILY 1
#define MPI3MR_BSG_ADPSTATE_UNKNOWN 0
#define MPI3MR_BSG_ADPSTATE_OPERATIONAL 1
#define MPI3MR_BSG_ADPSTATE_FAULT 2
#define MPI3MR_BSG_ADPSTATE_IN_RESET 3
#define MPI3MR_BSG_ADPSTATE_UNRECOVERABLE 4
#define MPI3MR_BSG_ADPRESET_UNKNOWN 0
#define MPI3MR_BSG_ADPRESET_SOFT 1
#define MPI3MR_BSG_ADPRESET_DIAG_FAULT 2
#define MPI3MR_BSG_LOGDATA_MAX_ENTRIES 400
#define MPI3MR_BSG_LOGDATA_ENTRY_HEADER_SZ 4
#define MPI3MR_DRVBSG_OPCODE_UNKNOWN 0
#define MPI3MR_DRVBSG_OPCODE_ADPINFO 1
#define MPI3MR_DRVBSG_OPCODE_ADPRESET 2
#define MPI3MR_DRVBSG_OPCODE_ALLTGTDEVINFO 4
#define MPI3MR_DRVBSG_OPCODE_GETCHGCNT 5
#define MPI3MR_DRVBSG_OPCODE_LOGDATAENABLE 6
#define MPI3MR_DRVBSG_OPCODE_PELENABLE 7
#define MPI3MR_DRVBSG_OPCODE_GETLOGDATA 8
#define MPI3MR_DRVBSG_OPCODE_QUERY_HDB 9
#define MPI3MR_DRVBSG_OPCODE_REPOST_HDB 10
#define MPI3MR_DRVBSG_OPCODE_UPLOAD_HDB 11
#define MPI3MR_DRVBSG_OPCODE_REFRESH_HDB_TRIGGERS 12
#define MPI3MR_BSG_BUFTYPE_UNKNOWN 0
#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_CMD 1
#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_RESP 2
#define MPI3MR_BSG_BUFTYPE_DATA_IN 3
#define MPI3MR_BSG_BUFTYPE_DATA_OUT 4
#define MPI3MR_BSG_BUFTYPE_MPI_REPLY 5
#define MPI3MR_BSG_BUFTYPE_ERR_RESPONSE 6
#define MPI3MR_BSG_BUFTYPE_MPI_REQUEST 0xFE
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_UNKNOWN 0
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_STATUS 1
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_ADDRESS 2
#define MPI3MR_HDB_BUFTYPE_UNKNOWN 0
#define MPI3MR_HDB_BUFTYPE_TRACE 1
#define MPI3MR_HDB_BUFTYPE_FIRMWARE 2
#define MPI3MR_HDB_BUFTYPE_RESERVED 3
#define MPI3MR_HDB_BUFSTATUS_UNKNOWN 0
#define MPI3MR_HDB_BUFSTATUS_NOT_ALLOCATED 1
#define MPI3MR_HDB_BUFSTATUS_POSTED_UNPAUSED 2
#define MPI3MR_HDB_BUFSTATUS_POSTED_PAUSED 3
#define MPI3MR_HDB_BUFSTATUS_RELEASED 4
#define MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN 0
#define MPI3MR_HDB_TRIGGER_TYPE_DIAGFAULT 1
#define MPI3MR_HDB_TRIGGER_TYPE_ELEMENT 2
#define MPI3MR_HDB_TRIGGER_TYPE_MASTER 3
/* Supported BSG commands */
enum command {
MPI3MR_DRV_CMD = 1,
MPI3MR_MPT_CMD = 2,
};
/**
* struct mpi3_driver_info_layout - Information about driver
*
* @information_length: Length of this structure in bytes
* @driver_signature: Driver Vendor name
* @os_name: Operating System Name
* @driver_name: Driver name
* @driver_version: Driver version
* @driver_release_date: Driver release date
* @driver_capabilities: Driver capabilities
*/
struct mpi3_driver_info_layout {
__le32 information_length;
__u8 driver_signature[12];
__u8 os_name[16];
__u8 os_version[12];
__u8 driver_name[20];
__u8 driver_version[32];
__u8 driver_release_date[20];
__le32 driver_capabilities;
};
/**
* struct mpi3mr_bsg_in_adpinfo - Adapter information request
* data returned by the driver.
*
* @adp_type: Adapter type
* @rsvd1: Reserved
* @pci_dev_id: PCI device ID of the adapter
* @pci_dev_hw_rev: PCI revision of the adapter
* @pci_subsys_dev_id: PCI subsystem device ID of the adapter
* @pci_subsys_ven_id: PCI subsystem vendor ID of the adapter
* @pci_dev: PCI device
* @pci_func: PCI function
* @pci_bus: PCI bus
* @rsvd2: Reserved
* @pci_seg_id: PCI segment ID
* @app_intfc_ver: version of the application interface definition
* @rsvd3: Reserved
* @rsvd4: Reserved
* @rsvd5: Reserved
* @driver_info: Driver Information (Version/Name)
*/
struct mpi3mr_bsg_in_adpinfo {
__u32 adp_type;
__u32 rsvd1;
__u32 pci_dev_id;
__u32 pci_dev_hw_rev;
__u32 pci_subsys_dev_id;
__u32 pci_subsys_ven_id;
__u32 pci_dev:5;
__u32 pci_func:3;
__u32 pci_bus:8;
__u16 rsvd2;
__u32 pci_seg_id;
__u32 app_intfc_ver;
__u8 adp_state;
__u8 rsvd3;
__u16 rsvd4;
__u32 rsvd5[2];
struct mpi3_driver_info_layout driver_info;
};
/**
* struct mpi3mr_bsg_adp_reset - Adapter reset request
* payload data to the driver.
*
* @reset_type: Reset type
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_adp_reset {
__u8 reset_type;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_change_count - Topology change count
* returned by the driver.
*
* @change_count: Topology change count
* @rsvd: Reserved
*/
struct mpi3mr_change_count {
__u16 change_count;
__u16 rsvd;
};
/**
* struct mpi3mr_device_map_info - Target device mapping
* information
*
* @handle: Firmware device handle
* @perst_id: Persistent ID assigned by the firmware
* @target_id: Target ID assigned by the driver
* @bus_id: Bus ID assigned by the driver
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_device_map_info {
__u16 handle;
__u16 perst_id;
__u32 target_id;
__u8 bus_id;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_all_tgt_info - Target device mapping
* information returned by the driver
*
* @num_devices: The number of devices in driver's inventory
* @rsvd1: Reserved
* @rsvd2: Reserved
* @dmi: Variable length array of mapping information of targets
*/
struct mpi3mr_all_tgt_info {
__u16 num_devices;
__u16 rsvd1;
__u32 rsvd2;
struct mpi3mr_device_map_info dmi[1];
};
/**
* struct mpi3mr_logdata_enable - Number of log data
* entries saved by the driver returned as payload data for
* enable logdata BSG request by the driver.
*
* @max_entries: Number of log data entries cached by the driver
* @rsvd: Reserved
*/
struct mpi3mr_logdata_enable {
__u16 max_entries;
__u16 rsvd;
};
/**
* struct mpi3mr_bsg_out_pel_enable - PEL enable request payload
* data to the driver.
*
* @pel_locale: PEL locale to the firmware
* @pel_class: PEL class to the firmware
* @rsvd: Reserved
*/
struct mpi3mr_bsg_out_pel_enable {
__u16 pel_locale;
__u8 pel_class;
__u8 rsvd;
};
/**
* struct mpi3mr_logdata_entry - Log data entry cached by the
* driver.
*
* @valid_entry: Is the entry valid
* @rsvd1: Reserved
* @rsvd2: Reserved
* @data: Variable length Log entry data
*/
struct mpi3mr_logdata_entry {
__u8 valid_entry;
__u8 rsvd1;
__u16 rsvd2;
__u8 data[1]; /* Variable length Array */
};
/**
* struct mpi3mr_bsg_in_log_data - Log data entries saved by
* the driver returned as payload data for Get logdata request
* by the driver.
*
* @entry: Variable length Log data entry array
*/
struct mpi3mr_bsg_in_log_data {
struct mpi3mr_logdata_entry entry[1];
};
/**
* struct mpi3mr_hdb_entry - host diag buffer entry.
*
* @buf_type: Buffer type
* @status: Buffer status
* @trigger_type: Trigger type
* @rsvd1: Reserved
* @size: Buffer size
* @rsvd2: Reserved
* @trigger_data: Trigger specific data
* @rsvd3: Reserved
* @rsvd4: Reserved
*/
struct mpi3mr_hdb_entry {
__u8 buf_type;
__u8 status;
__u8 trigger_type;
__u8 rsvd1;
__u16 size;
__u16 rsvd2;
__u64 trigger_data;
__u32 rsvd3;
__u32 rsvd4;
};
/**
* struct mpi3mr_bsg_in_hdb_status - This structure contains
* return data for the BSG request to retrieve the number of host
* diagnostic buffers supported by the driver and their current
* status and additional status specific data if any in forms of
* multiple hdb entries.
*
* @num_hdb_types: Number of host diag buffer types supported
* @rsvd1: Reserved
* @rsvd2: Reserved
* @rsvd3: Reserved
* @entry: Variable length Diag buffer status entry array
*/
struct mpi3mr_bsg_in_hdb_status {
__u8 num_hdb_types;
__u8 rsvd1;
__u16 rsvd2;
__u32 rsvd3;
struct mpi3mr_hdb_entry entry[1];
};
/**
* struct mpi3mr_bsg_out_repost_hdb - Repost host diagnostic
* buffer request payload data to the driver.
*
* @buf_type: Buffer type
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_out_repost_hdb {
__u8 buf_type;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_bsg_out_upload_hdb - Upload host diagnostic
* buffer request payload data to the driver.
*
* @buf_type: Buffer type
* @rsvd1: Reserved
* @rsvd2: Reserved
* @start_offset: Start offset of the buffer from where to copy
* @length: Length of the buffer to copy
*/
struct mpi3mr_bsg_out_upload_hdb {
__u8 buf_type;
__u8 rsvd1;
__u16 rsvd2;
__u32 start_offset;
__u32 length;
};
/**
* struct mpi3mr_bsg_out_refresh_hdb_triggers - Refresh host
* diagnostic buffer triggers request payload data to the driver.
*
* @page_type: Page type
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_out_refresh_hdb_triggers {
__u8 page_type;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_bsg_drv_cmd - Generic bsg data
* structure for all driver specific requests.
*
* @mrioc_id: Controller ID
* @opcode: Driver specific opcode
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_drv_cmd {
__u8 mrioc_id;
__u8 opcode;
__u16 rsvd1;
__u32 rsvd2[4];
};
/**
* struct mpi3mr_bsg_in_reply_buf - MPI reply buffer returned
* for MPI Passthrough request .
*
* @mpi_reply_type: Type of MPI reply
* @rsvd1: Reserved
* @rsvd2: Reserved
* @reply_buf: Variable Length buffer based on mpirep type
*/
struct mpi3mr_bsg_in_reply_buf {
__u8 mpi_reply_type;
__u8 rsvd1;
__u16 rsvd2;
__u8 reply_buf[];
};
/**
* struct mpi3mr_buf_entry - User buffer descriptor for MPI
* Passthrough requests.
*
* @buf_type: Buffer type
* @rsvd1: Reserved
* @rsvd2: Reserved
* @buf_len: Buffer length
*/
struct mpi3mr_buf_entry {
__u8 buf_type;
__u8 rsvd1;
__u16 rsvd2;
__u32 buf_len;
};
/**
* struct mpi3mr_bsg_buf_entry_list - list of user buffer
* descriptor for MPI Passthrough requests.
*
* @num_of_entries: Number of buffer descriptors
* @rsvd1: Reserved
* @rsvd2: Reserved
* @rsvd3: Reserved
* @buf_entry: Variable length array of buffer descriptors
*/
struct mpi3mr_buf_entry_list {
__u8 num_of_entries;
__u8 rsvd1;
__u16 rsvd2;
__u32 rsvd3;
struct mpi3mr_buf_entry buf_entry[1];
};
/**
* struct mpi3mr_bsg_mptcmd - Generic bsg data
* structure for all MPI Passthrough requests .
*
* @mrioc_id: Controller ID
* @rsvd1: Reserved
* @timeout: MPI request timeout
* @buf_entry_list: Buffer descriptor list
*/
struct mpi3mr_bsg_mptcmd {
__u8 mrioc_id;
__u8 rsvd1;
__u16 timeout;
__u32 rsvd2;
struct mpi3mr_buf_entry_list buf_entry_list;
};
/**
* struct mpi3mr_bsg_packet - Generic bsg data
* structure for all supported requests .
*
* @cmd_type: represents drvrcmd or mptcmd
* @rsvd1: Reserved
* @rsvd2: Reserved
* @drvrcmd: driver request structure
* @mptcmd: mpt request structure
*/
struct mpi3mr_bsg_packet {
__u8 cmd_type;
__u8 rsvd1;
__u16 rsvd2;
__u32 rsvd3;
union {
struct mpi3mr_bsg_drv_cmd drvrcmd;
struct mpi3mr_bsg_mptcmd mptcmd;
} cmd;
};
/* MPI3: NVMe Encasulation related definitions */
#ifndef MPI3_NVME_ENCAP_CMD_MAX
#define MPI3_NVME_ENCAP_CMD_MAX (1)
#endif
struct mpi3_nvme_encapsulated_request {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 change_count;
__le16 dev_handle;
__le16 encapsulated_command_length;
__le16 flags;
__le32 data_length;
__le32 reserved14[3];
__le32 command[MPI3_NVME_ENCAP_CMD_MAX];
};
struct mpi3_nvme_encapsulated_error_reply {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 ioc_use_only08;
__le16 ioc_status;
__le32 ioc_log_info;
__le32 nvme_completion_entry[4];
};
#define MPI3MR_NVME_PRP_SIZE 8 /* PRP size */
#define MPI3MR_NVME_CMD_PRP1_OFFSET 24 /* PRP1 offset in NVMe cmd */
#define MPI3MR_NVME_CMD_PRP2_OFFSET 32 /* PRP2 offset in NVMe cmd */
#define MPI3MR_NVME_CMD_SGL_OFFSET 24 /* SGL offset in NVMe cmd */
#define MPI3MR_NVME_DATA_FORMAT_PRP 0
#define MPI3MR_NVME_DATA_FORMAT_SGL1 1
#define MPI3MR_NVME_DATA_FORMAT_SGL2 2
/* MPI3: task management related definitions */
struct mpi3_scsi_task_mgmt_request {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 change_count;
__le16 dev_handle;
__le16 task_host_tag;
__u8 task_type;
__u8 reserved0f;
__le16 task_request_queue_id;
__le16 reserved12;
__le32 reserved14;
__u8 lun[8];
};
#define MPI3_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU (0x08)
#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01)
#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK_SET (0x02)
#define MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03)
#define MPI3_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05)
#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06)
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07)
#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_ACA (0x08)
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK_SET (0x09)
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_ASYNC_EVENT (0x0a)
#define MPI3_SCSITASKMGMT_TASKTYPE_I_T_NEXUS_RESET (0x0b)
struct mpi3_scsi_task_mgmt_reply {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 ioc_use_only08;
__le16 ioc_status;
__le32 ioc_log_info;
__le32 termination_count;
__le32 response_data;
__le32 reserved18;
};
#define MPI3_SCSITASKMGMT_RSPCODE_TM_COMPLETE (0x00)
#define MPI3_SCSITASKMGMT_RSPCODE_INVALID_FRAME (0x02)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_FUNCTION_NOT_SUPPORTED (0x04)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_FAILED (0x05)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_SUCCEEDED (0x08)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_INVALID_LUN (0x09)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_OVERLAPPED_TAG (0x0a)
#define MPI3_SCSITASKMGMT_RSPCODE_IO_QUEUED_ON_IOC (0x80)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_NVME_DENIED (0x81)
/* MPI3: PEL related definitions */
#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200)
#define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100)
#define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080)
#define MPI3_PEL_LOCALE_FLAGS_CONFIGURATION (0x0040)
#define MPI3_PEL_LOCALE_FLAGS_CONTROLER (0x0020)
#define MPI3_PEL_LOCALE_FLAGS_SAS (0x0010)
#define MPI3_PEL_LOCALE_FLAGS_EPACK (0x0008)
#define MPI3_PEL_LOCALE_FLAGS_ENCLOSURE (0x0004)
#define MPI3_PEL_LOCALE_FLAGS_PD (0x0002)
#define MPI3_PEL_LOCALE_FLAGS_VD (0x0001)
#define MPI3_PEL_CLASS_DEBUG (0x00)
#define MPI3_PEL_CLASS_PROGRESS (0x01)
#define MPI3_PEL_CLASS_INFORMATIONAL (0x02)
#define MPI3_PEL_CLASS_WARNING (0x03)
#define MPI3_PEL_CLASS_CRITICAL (0x04)
#define MPI3_PEL_CLASS_FATAL (0x05)
#define MPI3_PEL_CLASS_FAULT (0x06)
/* MPI3: Function definitions */
#define MPI3_BSG_FUNCTION_MGMT_PASSTHROUGH (0x0a)
#define MPI3_BSG_FUNCTION_SCSI_IO (0x20)
#define MPI3_BSG_FUNCTION_SCSI_TASK_MGMT (0x21)
#define MPI3_BSG_FUNCTION_SMP_PASSTHROUGH (0x22)
#define MPI3_BSG_FUNCTION_NVME_ENCAPSULATED (0x24)
#endif
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* SCSI Transport Netlink Interface
* Used for the posting of outbound SCSI transport events
*
* Copyright (C) 2006 James Smart, Emulex Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef SCSI_NETLINK_H
#define SCSI_NETLINK_H
#include <linux/netlink.h>
#include <linux/types.h>
/*
* This file intended to be included by both kernel and user space
*/
/* Single Netlink Message type to send all SCSI Transport messages */
#define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
/* SCSI Transport Broadcast Groups */
/* leaving groups 0 and 1 unassigned */
#define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
#define SCSI_NL_GRP_CNT 3
/* SCSI_TRANSPORT_MSG event message header */
struct scsi_nl_hdr {
uint8_t version;
uint8_t transport;
uint16_t magic;
uint16_t msgtype;
uint16_t msglen;
} __attribute__((aligned(sizeof(uint64_t))));
/* scsi_nl_hdr->version value */
#define SCSI_NL_VERSION 1
/* scsi_nl_hdr->magic value */
#define SCSI_NL_MAGIC 0xA1B2
/* scsi_nl_hdr->transport value */
#define SCSI_NL_TRANSPORT 0
#define SCSI_NL_TRANSPORT_FC 1
#define SCSI_NL_MAX_TRANSPORTS 2
/* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */
/*
* GENERIC SCSI scsi_nl_hdr->msgtype Values
*/
/* kernel -> user */
#define SCSI_NL_SHOST_VENDOR 0x0001
/* user -> kernel */
/* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */
/*
* Message Structures :
*/
/* macro to round up message lengths to 8byte boundary */
#define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7)
/*
* SCSI HOST Vendor Unique messages :
* SCSI_NL_SHOST_VENDOR
*
* Note: The Vendor Unique message payload will begin directly after
* this structure, with the length of the payload per vmsg_datalen.
*
* Note: When specifying vendor_id, be sure to read the Vendor Type and ID
* formatting requirements specified below
*/
struct scsi_nl_host_vendor_msg {
struct scsi_nl_hdr snlh; /* must be 1st element ! */
uint64_t vendor_id;
uint16_t host_no;
uint16_t vmsg_datalen;
} __attribute__((aligned(sizeof(uint64_t))));
/*
* Vendor ID:
* If transports post vendor-unique events, they must pass a well-known
* 32-bit vendor identifier. This identifier consists of 8 bits indicating
* the "type" of identifier contained, and 24 bits of id data.
*
* Identifiers for each type:
* PCI : ID data is the 16 bit PCI Registered Vendor ID
*/
#define SCSI_NL_VID_TYPE_SHIFT 56
#define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
#define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
#define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
{ \
(hdr)->version = SCSI_NL_VERSION; \
(hdr)->transport = t; \
(hdr)->magic = SCSI_NL_MAGIC; \
(hdr)->msgtype = mtype; \
(hdr)->msglen = mlen; \
}
#endif /* SCSI_NETLINK_H */
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* CXL Flash Device Driver
*
* Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation
* Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
*
* Copyright (C) 2015 IBM Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _CXLFLASH_IOCTL_H
#define _CXLFLASH_IOCTL_H
#include <linux/types.h>
/*
* Structure and definitions for all CXL Flash ioctls
*/
#define CXLFLASH_WWID_LEN 16
/*
* Structure and flag definitions CXL Flash superpipe ioctls
*/
#define DK_CXLFLASH_VERSION_0 0
struct dk_cxlflash_hdr {
__u16 version; /* Version data */
__u16 rsvd[3]; /* Reserved for future use */
__u64 flags; /* Input flags */
__u64 return_flags; /* Returned flags */
};
/*
* Return flag definitions available to all superpipe ioctls
*
* Similar to the input flags, these are grown from the bottom-up with the
* intention that ioctl-specific return flag definitions would grow from the
* top-down, allowing the two sets to co-exist. While not required/enforced
* at this time, this provides future flexibility.
*/
#define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
#define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
#define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
/*
* General Notes:
* -------------
* The 'context_id' field of all ioctl structures contains the context
* identifier for a context in the lower 32-bits (upper 32-bits are not
* to be used when identifying a context to the AFU). That said, the value
* in its entirety (all 64-bits) is to be treated as an opaque cookie and
* should be presented as such when issuing ioctls.
*/
/*
* DK_CXLFLASH_ATTACH Notes:
* ------------------------
* Read/write access permissions are specified via the O_RDONLY, O_WRONLY,
* and O_RDWR flags defined in the fcntl.h header file.
*
* A valid adapter file descriptor (fd >= 0) is only returned on the initial
* attach (successful) of a context. When a context is shared(reused), the user
* is expected to already 'know' the adapter file descriptor associated with the
* context.
*/
#define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
struct dk_cxlflash_attach {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 num_interrupts; /* Requested number of interrupts */
__u64 context_id; /* Returned context */
__u64 mmio_size; /* Returned size of MMIO area */
__u64 block_size; /* Returned block size, in bytes */
__u64 adap_fd; /* Returned adapter file descriptor */
__u64 last_lba; /* Returned last LBA on the device */
__u64 max_xfer; /* Returned max transfer size, blocks */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_detach {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context to detach */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_udirect {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context to own physical resources */
__u64 rsrc_handle; /* Returned resource handle */
__u64 last_lba; /* Returned last LBA on the device */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
struct dk_cxlflash_uvirtual {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context to own virtual resources */
__u64 lun_size; /* Requested size, in 4K blocks */
__u64 rsrc_handle; /* Returned resource handle */
__u64 last_lba; /* Returned last LBA of LUN */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_release {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context owning resources */
__u64 rsrc_handle; /* Resource handle to release */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_resize {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context owning resources */
__u64 rsrc_handle; /* Resource handle of LUN to resize */
__u64 req_size; /* New requested size, in 4K blocks */
__u64 last_lba; /* Returned last LBA of LUN */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_clone {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id_src; /* Context to clone from */
__u64 context_id_dst; /* Context to clone to */
__u64 adap_fd_src; /* Source context adapter fd */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_VERIFY_SENSE_LEN 18
#define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
struct dk_cxlflash_verify {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context owning resources to verify */
__u64 rsrc_handle; /* Resource handle of LUN */
__u64 hint; /* Reasons for verify */
__u64 last_lba; /* Returned last LBA of device */
__u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN]; /* SCSI sense data */
__u8 pad[6]; /* Pad to next 8-byte boundary */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
struct dk_cxlflash_recover_afu {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 reason; /* Reason for recovery request */
__u64 context_id; /* Context to recover / updated ID */
__u64 mmio_size; /* Returned size of MMIO area */
__u64 adap_fd; /* Returned adapter file descriptor */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
#define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
#define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
#define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
struct dk_cxlflash_manage_lun {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN]; /* Page83 WWID, NAA-6 */
__u64 reserved[8]; /* Rsvd, future use */
};
union cxlflash_ioctls {
struct dk_cxlflash_attach attach;
struct dk_cxlflash_detach detach;
struct dk_cxlflash_udirect udirect;
struct dk_cxlflash_uvirtual uvirtual;
struct dk_cxlflash_release release;
struct dk_cxlflash_resize resize;
struct dk_cxlflash_clone clone;
struct dk_cxlflash_verify verify;
struct dk_cxlflash_recover_afu recover_afu;
struct dk_cxlflash_manage_lun manage_lun;
};
#define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
#define CXL_MAGIC 0xCA
#define CXL_IOWR(_n, _s) _IOWR(CXL_MAGIC, _n, struct _s)
/*
* CXL Flash superpipe ioctls start at base of the reserved CXL_MAGIC
* region (0x80) and grow upwards.
*/
#define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
#define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
#define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
#define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
#define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
#define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
#define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
#define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
#define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
#define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
/*
* Structure and flag definitions CXL Flash host ioctls
*/
#define HT_CXLFLASH_VERSION_0 0
struct ht_cxlflash_hdr {
__u16 version; /* Version data */
__u16 subcmd; /* Sub-command */
__u16 rsvd[2]; /* Reserved for future use */
__u64 flags; /* Input flags */
__u64 return_flags; /* Returned flags */
};
/*
* Input flag definitions available to all host ioctls
*
* These are grown from the bottom-up with the intention that ioctl-specific
* input flag definitions would grow from the top-down, allowing the two sets
* to co-exist. While not required/enforced at this time, this provides future
* flexibility.
*/
#define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL
#define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL
#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001
#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002
#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003
struct ht_cxlflash_lun_provision {
struct ht_cxlflash_hdr hdr; /* Common fields */
__u16 port; /* Target port for provision request */
__u16 reserved16[3]; /* Reserved for future use */
__u64 size; /* Size of LUN (4K blocks) */
__u64 lun_id; /* SCSI LUN ID */
__u8 wwid[CXLFLASH_WWID_LEN];/* Page83 WWID, NAA-6 */
__u64 max_num_luns; /* Maximum number of LUNs provisioned */
__u64 cur_num_luns; /* Current number of LUNs provisioned */
__u64 max_cap_port; /* Total capacity for port (4K blocks) */
__u64 cur_cap_port; /* Current capacity for port (4K blocks) */
__u64 reserved[8]; /* Reserved for future use */
};
#define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144 /* 256K */
#define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12
struct ht_cxlflash_afu_debug {
struct ht_cxlflash_hdr hdr; /* Common fields */
__u8 reserved8[4]; /* Reserved for future use */
__u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN]; /* AFU subcommand,
* (pass through)
*/
__u64 data_ea; /* Data buffer effective address */
__u32 data_len; /* Data buffer length */
__u32 reserved32; /* Reserved for future use */
__u64 reserved[8]; /* Reserved for future use */
};
union cxlflash_ht_ioctls {
struct ht_cxlflash_lun_provision lun_provision;
struct ht_cxlflash_afu_debug afu_debug;
};
#define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls))
/*
* CXL Flash host ioctls start at the top of the reserved CXL_MAGIC
* region (0xBF) and grow downwards.
*/
#define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision)
#define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug)
#endif /* ifndef _CXLFLASH_IOCTL_H */
/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SCSI_IOCTL_H
#define _SCSI_IOCTL_H
/* IOCTLs for SCSI. */
#define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */
#define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */
#define SCSI_IOCTL_BENCHMARK_COMMAND 3
#define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */
#define SCSI_IOCTL_START_UNIT 5
#define SCSI_IOCTL_STOP_UNIT 6
#define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */
#define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */
#endif
/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* This header file contains public constants and structures used by
* the scsi code for linux.
*/
#ifndef _SCSI_SCSI_H
#define _SCSI_SCSI_H 1
#include <features.h>
/*
* SCSI opcodes
*/
#define TEST_UNIT_READY 0x00
#define REZERO_UNIT 0x01
#define REQUEST_SENSE 0x03
#define FORMAT_UNIT 0x04
#define READ_BLOCK_LIMITS 0x05
#define REASSIGN_BLOCKS 0x07
#define READ_6 0x08
#define WRITE_6 0x0a
#define SEEK_6 0x0b
#define READ_REVERSE 0x0f
#define WRITE_FILEMARKS 0x10
#define SPACE 0x11
#define INQUIRY 0x12
#define RECOVER_BUFFERED_DATA 0x14
#define MODE_SELECT 0x15
#define RESERVE 0x16
#define RELEASE 0x17
#define COPY 0x18
#define ERASE 0x19
#define MODE_SENSE 0x1a
#define START_STOP 0x1b
#define RECEIVE_DIAGNOSTIC 0x1c
#define SEND_DIAGNOSTIC 0x1d
#define ALLOW_MEDIUM_REMOVAL 0x1e
#define SET_WINDOW 0x24
#define READ_CAPACITY 0x25
#define READ_10 0x28
#define WRITE_10 0x2a
#define SEEK_10 0x2b
#define WRITE_VERIFY 0x2e
#define VERIFY 0x2f
#define SEARCH_HIGH 0x30
#define SEARCH_EQUAL 0x31
#define SEARCH_LOW 0x32
#define SET_LIMITS 0x33
#define PRE_FETCH 0x34
#define READ_POSITION 0x34
#define SYNCHRONIZE_CACHE 0x35
#define LOCK_UNLOCK_CACHE 0x36
#define READ_DEFECT_DATA 0x37
#define MEDIUM_SCAN 0x38
#define COMPARE 0x39
#define COPY_VERIFY 0x3a
#define WRITE_BUFFER 0x3b
#define READ_BUFFER 0x3c
#define UPDATE_BLOCK 0x3d
#define READ_LONG 0x3e
#define WRITE_LONG 0x3f
#define CHANGE_DEFINITION 0x40
#define WRITE_SAME 0x41
#define READ_TOC 0x43
#define LOG_SELECT 0x4c
#define LOG_SENSE 0x4d
#define MODE_SELECT_10 0x55
#define RESERVE_10 0x56
#define RELEASE_10 0x57
#define MODE_SENSE_10 0x5a
#define PERSISTENT_RESERVE_IN 0x5e
#define PERSISTENT_RESERVE_OUT 0x5f
#define MOVE_MEDIUM 0xa5
#define READ_12 0xa8
#define WRITE_12 0xaa
#define WRITE_VERIFY_12 0xae
#define SEARCH_HIGH_12 0xb0
#define SEARCH_EQUAL_12 0xb1
#define SEARCH_LOW_12 0xb2
#define READ_ELEMENT_STATUS 0xb8
#define SEND_VOLUME_TAG 0xb6
#define WRITE_LONG_2 0xea
/*
* Status codes
*/
#define GOOD 0x00
#define CHECK_CONDITION 0x01
#define CONDITION_GOOD 0x02
#define BUSY 0x04
#define INTERMEDIATE_GOOD 0x08
#define INTERMEDIATE_C_GOOD 0x0a
#define RESERVATION_CONFLICT 0x0c
#define COMMAND_TERMINATED 0x11
#define QUEUE_FULL 0x14
#define STATUS_MASK 0x3e
/*
* SENSE KEYS
*/
#define NO_SENSE 0x00
#define RECOVERED_ERROR 0x01
#define NOT_READY 0x02
#define MEDIUM_ERROR 0x03
#define HARDWARE_ERROR 0x04
#define ILLEGAL_REQUEST 0x05
#define UNIT_ATTENTION 0x06
#define DATA_PROTECT 0x07
#define BLANK_CHECK 0x08
#define COPY_ABORTED 0x0a
#define ABORTED_COMMAND 0x0b
#define VOLUME_OVERFLOW 0x0d
#define MISCOMPARE 0x0e
/*
* DEVICE TYPES
*/
#define TYPE_DISK 0x00
#define TYPE_TAPE 0x01
#define TYPE_PROCESSOR 0x03 /* HP scanners use this */
#define TYPE_WORM 0x04 /* Treated as ROM by our system */
#define TYPE_ROM 0x05
#define TYPE_SCANNER 0x06
#define TYPE_MOD 0x07 /* Magneto-optical disk -
* - treated as TYPE_DISK */
#define TYPE_MEDIUM_CHANGER 0x08
#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
#define TYPE_NO_LUN 0x7f
/*
* standard mode-select header prepended to all mode-select commands
*
* moved here from cdrom.h -- kraxel
*/
struct ccs_modesel_head
{
unsigned char _r1; /* reserved. */
unsigned char medium; /* device-specific medium type. */
unsigned char _r2; /* reserved. */
unsigned char block_desc_length; /* block descriptor length. */
unsigned char density; /* device-specific density code. */
unsigned char number_blocks_hi; /* number of blocks in this block
desc. */
unsigned char number_blocks_med;
unsigned char number_blocks_lo;
unsigned char _r3;
unsigned char block_length_hi; /* block length for blocks in this
desc. */
unsigned char block_length_med;
unsigned char block_length_lo;
};
/*
* MESSAGE CODES
*/
#define COMMAND_COMPLETE 0x00
#define EXTENDED_MESSAGE 0x01
#define EXTENDED_MODIFY_DATA_POINTER 0x00
#define EXTENDED_SDTR 0x01
#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
#define EXTENDED_WDTR 0x03
#define SAVE_POINTERS 0x02
#define RESTORE_POINTERS 0x03
#define DISCONNECT 0x04
#define INITIATOR_ERROR 0x05
#define ABORT 0x06
#define MESSAGE_REJECT 0x07
#define NOP 0x08
#define MSG_PARITY_ERROR 0x09
#define LINKED_CMD_COMPLETE 0x0a
#define LINKED_FLG_CMD_COMPLETE 0x0b
#define BUS_DEVICE_RESET 0x0c
#define INITIATE_RECOVERY 0x0f /* SCSI-II only */
#define RELEASE_RECOVERY 0x10 /* SCSI-II only */
#define SIMPLE_QUEUE_TAG 0x20
#define HEAD_OF_QUEUE_TAG 0x21
#define ORDERED_QUEUE_TAG 0x22
/*
* Here are some scsi specific ioctl commands which are sometimes useful.
*/
/* These are a few other constants only used by scsi devices. */
#define SCSI_IOCTL_GET_IDLUN 0x5382
/* Used to turn on and off tagged queuing for scsi devices. */
#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
/* Used to obtain the host number of a device. */
#define SCSI_IOCTL_PROBE_HOST 0x5385
/* Used to get the bus number for a device. */
#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
#endif /* scsi/scsi.h */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
History:
Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user
process control of SCSI devices.
Development Sponsored by Killy Corp. NY NY
*/
#ifndef _SCSI_SG_H
#define _SCSI_SG_H 1
#include <features.h>
#define __need_size_t
#include <stddef.h>
/* New interface introduced in the 3.x SG drivers follows */
/* Same structure as used by readv() Linux system call. It defines one
scatter-gather element. */
typedef struct sg_iovec
{
void * iov_base; /* Starting address */
size_t iov_len; /* Length in bytes */
} sg_iovec_t;
typedef struct sg_io_hdr
{
int interface_id; /* [i] 'S' for SCSI generic (required) */
int dxfer_direction; /* [i] data transfer direction */
unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */
unsigned char mx_sb_len; /* [i] max length to write to sbp */
unsigned short int iovec_count; /* [i] 0 implies no scatter gather */
unsigned int dxfer_len; /* [i] byte count of data transfer */
void * dxferp; /* [i], [*io] points to data transfer memory
or scatter gather list */
unsigned char * cmdp; /* [i], [*i] points to command to perform */
unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */
unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */
unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */
int pack_id; /* [i->o] unused internally (normally) */
void * usr_ptr; /* [i->o] unused internally */
unsigned char status; /* [o] scsi status */
unsigned char masked_status;/* [o] shifted, masked scsi status */
unsigned char msg_status; /* [o] messaging level data (optional) */
unsigned char sb_len_wr; /* [o] byte count actually written to sbp */
unsigned short int host_status; /* [o] errors from host adapter */
unsigned short int driver_status;/* [o] errors from software driver */
int resid; /* [o] dxfer_len - actual_transferred */
unsigned int duration; /* [o] time taken by cmd (unit: millisec) */
unsigned int info; /* [o] auxiliary information */
} sg_io_hdr_t;
/* Use negative values to flag difference from original sg_header structure. */
#define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */
#define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */
#define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */
#define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the
additional property than during indirect
IO the user buffer is copied into the
kernel buffers before the transfer */
/* following flag values can be "or"-ed together */
#define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */
#define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */
/* the 2nd byte of SCSI command */
#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */
/* user space (debug indirect IO) */
/* The following 'info' values are "or"-ed together. */
#define SG_INFO_OK_MASK 0x1
#define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */
#define SG_INFO_CHECK 0x1 /* something abnormal happened */
#define SG_INFO_DIRECT_IO_MASK 0x6
#define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */
#define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */
#define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */
/* Request information about a specific SG device, used by
SG_GET_SCSI_ID ioctl (). */
struct sg_scsi_id {
/* Host number as in "scsi<n>" where 'n' is one of 0, 1, 2 etc. */
int host_no;
int channel;
/* SCSI id of target device. */
int scsi_id;
int lun;
/* TYPE_... defined in <scsi/scsi.h>. */
int scsi_type;
/* Host (adapter) maximum commands per lun. */
short int h_cmd_per_lun;
/* Device (or adapter) maximum queue length. */
short int d_queue_depth;
/* Unused, set to 0 for now. */
int unused[2];
};
/* Used by SG_GET_REQUEST_TABLE ioctl(). */
typedef struct sg_req_info {
char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */
char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */
char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */
char problem; /* 0 -> no problem detected, 1 -> error to report */
int pack_id; /* pack_id associated with request */
void * usr_ptr; /* user provided pointer (in new interface) */
unsigned int duration; /* millisecs elapsed since written (req_state==1)
or request duration (req_state==2) */
int unused;
} sg_req_info_t;
/* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow.
[Those that only apply to the SG 2.x drivers are at the end of the file.]
(_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */
#define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */
/* Used to configure SCSI command transformation layer for ATAPI devices */
/* Only supported by the ide-scsi driver */
#define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */
/* 3rd arg = 0 to disable transform, 1 to enable it */
#define SG_GET_TRANSFORM 0x2205
#define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */
#define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */
/* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */
#define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */
/* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */
/* Override host setting and always DMA using low memory ( <16MB on i386) */
#define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */
#define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */
/* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which
tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN.
If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0
then pack_id ignored by read() and oldest readable fetched. */
#define SG_SET_FORCE_PACK_ID 0x227b
#define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */
#define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */
/* Yields max scatter gather tablesize allowed by current host adapter */
#define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */
#define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */
/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */
#define SG_SCSI_RESET 0x2284
/* Associated values that can be given to SG_SCSI_RESET follow */
#define SG_SCSI_RESET_NOTHING 0
#define SG_SCSI_RESET_DEVICE 1
#define SG_SCSI_RESET_BUS 2
#define SG_SCSI_RESET_HOST 3
/* synchronous SCSI command ioctl, (only in version 3 interface) */
#define SG_IO 0x2285 /* similar effect as write() followed by read() */
#define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */
/* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */
#define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */
#define SG_GET_KEEP_ORPHAN 0x2288
#define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */
/* Largest size (in bytes) a single scatter-gather list element can have.
The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on
i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported
by adapter then this value is the largest data block that can be
read/written by a single scsi command. The user can find the value of
PAGE_SIZE by calling getpagesize() defined in unistd.h . */
#define SG_DEFAULT_RETRIES 1
/* Defaults, commented if they differ from original sg driver */
#define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */
#define SG_DEF_FORCE_PACK_ID 0
#define SG_DEF_KEEP_ORPHAN 0
#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */
/* maximum outstanding requests, write() yields EDOM if exceeded */
#define SG_MAX_QUEUE 16
#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */
/* Alternate style type names, "..._t" variants preferred */
typedef struct sg_io_hdr Sg_io_hdr;
typedef struct sg_io_vec Sg_io_vec;
typedef struct sg_scsi_id Sg_scsi_id;
typedef struct sg_req_info Sg_req_info;
/* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
/* The older SG interface based on the 'sg_header' structure follows. */
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
#define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */
struct sg_header
{
/* Length of incoming packet (including header). */
int pack_len;
/* Maximal length of expected reply. */
int reply_len;
/* Id number of packet. */
int pack_id;
/* 0==ok, otherwise error number. */
int result;
/* Force 12 byte command length for group 6 & 7 commands. */
unsigned int twelve_byte:1;
/* SCSI status from target. */
unsigned int target_status:5;
/* Host status (see "DID" codes). */
unsigned int host_status:8;
/* Driver status+suggestion. */
unsigned int driver_status:8;
/* Unused. */
unsigned int other_flags:10;
/* Output in 3 cases:
when target_status is CHECK_CONDITION or
when target_status is COMMAND_TERMINATED or
when (driver_status & DRIVER_SENSE) is true. */
unsigned char sense_buffer[SG_MAX_SENSE];
};
/* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t
interface is used. They are kept for backward compatibility with
the original and version 2 drivers. */
#define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */
#define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */
/* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */
#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */
#define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */
/* Turn on error sense trace (1..8), dump this device to log/console (9)
or dump all sg device states ( >9 ) to log/console. */
#define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */
#define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given
number on the next write() on this file
descriptor. */
/* Defaults, commented if they differ from original sg driver */
#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */
#define SG_DEF_COMMAND_Q 0 /* command queuing is always on when
the new interface is used */
#define SG_DEF_UNDERRUN_FLAG 0
#endif /* scsi/sg.h */
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* FC Transport Netlink Interface
*
* Copyright (C) 2006 James Smart, Emulex Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef SCSI_NETLINK_FC_H
#define SCSI_NETLINK_FC_H
#include <scsi/scsi_netlink.h>
/*
* This file intended to be included by both kernel and user space
*/
/*
* FC Transport Message Types
*/
/* kernel -> user */
#define FC_NL_ASYNC_EVENT 0x0100
/* user -> kernel */
/* none */
/*
* Message Structures :
*/
/* macro to round up message lengths to 8byte boundary */
#define FC_NL_MSGALIGN(len) (((len) + 7) & ~7)
/*
* FC Transport Broadcast Event Message :
* FC_NL_ASYNC_EVENT
*
* Note: if Vendor Unique message, &event_data will be start of
* vendor unique payload, and the length of the payload is
* per event_datalen
*
* Note: When specifying vendor_id, be sure to read the Vendor Type and ID
* formatting requirements specified in scsi_netlink.h
*/
struct fc_nl_event {
struct scsi_nl_hdr snlh; /* must be 1st element ! */
uint64_t seconds;
uint64_t vendor_id;
uint16_t host_no;
uint16_t event_datalen;
uint32_t event_num;
uint32_t event_code;
uint32_t event_data;
} __attribute__((aligned(sizeof(uint64_t))));
#endif /* SCSI_NETLINK_FC_H */
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* FC Transport BSG Interface
*
* Copyright (C) 2008 James Smart, Emulex Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef SCSI_BSG_FC_H
#define SCSI_BSG_FC_H
/*
* This file intended to be included by both kernel and user space
*/
/*
* FC Transport SGIO v4 BSG Message Support
*/
/* Default BSG request timeout (in seconds) */
#define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
/*
* Request Message Codes supported by the FC Transport
*/
/* define the class masks for the message codes */
#define FC_BSG_CLS_MASK 0xF0000000 /* find object class */
#define FC_BSG_HST_MASK 0x80000000 /* fc host class */
#define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */
/* fc_host Message Codes */
#define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
#define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
#define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
#define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
#define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
/* fc_rport Message Codes */
#define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
#define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
/*
* FC Address Identifiers in Message Structures :
*
* Whenever a command payload contains a FC Address Identifier
* (aka port_id), the value is effectively in big-endian
* order, thus the array elements are decoded as follows:
* element [0] is bits 23:16 of the FC Address Identifier
* element [1] is bits 15:8 of the FC Address Identifier
* element [2] is bits 7:0 of the FC Address Identifier
*/
/*
* FC Host Messages
*/
/* FC_BSG_HST_ADDR_PORT : */
/* Request:
* This message requests the FC host to login to the remote port
* at the specified N_Port_Id. The remote port is to be enumerated
* with the transport upon completion of the login.
*/
struct fc_bsg_host_add_rport {
uint8_t reserved;
/* FC Address Identier of the remote port to login to */
uint8_t port_id[3];
};
/* Response:
* There is no additional response data - fc_bsg_reply->result is sufficient
*/
/* FC_BSG_HST_DEL_RPORT : */
/* Request:
* This message requests the FC host to remove an enumerated
* remote port and to terminate the login to it.
*
* Note: The driver is free to reject this request if it desires to
* remain logged in with the remote port.
*/
struct fc_bsg_host_del_rport {
uint8_t reserved;
/* FC Address Identier of the remote port to logout of */
uint8_t port_id[3];
};
/* Response:
* There is no additional response data - fc_bsg_reply->result is sufficient
*/
/* FC_BSG_HST_ELS_NOLOGIN : */
/* Request:
* This message requests the FC_Host to send an ELS to a specific
* N_Port_ID. The host does not need to log into the remote port,
* nor does it need to enumerate the rport for further traffic
* (although, the FC host is free to do so if it desires).
*/
struct fc_bsg_host_els {
/*
* ELS Command Code being sent (must be the same as byte 0
* of the payload)
*/
uint8_t command_code;
/* FC Address Identier of the remote port to send the ELS to */
uint8_t port_id[3];
};
/* Response:
*/
/* fc_bsg_ctels_reply->status values */
#define FC_CTELS_STATUS_OK 0x00000000
#define FC_CTELS_STATUS_REJECT 0x00000001
#define FC_CTELS_STATUS_P_RJT 0x00000002
#define FC_CTELS_STATUS_F_RJT 0x00000003
#define FC_CTELS_STATUS_P_BSY 0x00000004
#define FC_CTELS_STATUS_F_BSY 0x00000006
struct fc_bsg_ctels_reply {
/*
* Note: An ELS LS_RJT may be reported in 2 ways:
* a) A status of FC_CTELS_STATUS_OK is returned. The caller
* is to look into the ELS receive payload to determine
* LS_ACC or LS_RJT (by contents of word 0). The reject
* data will be in word 1.
* b) A status of FC_CTELS_STATUS_REJECT is returned, The
* rjt_data field will contain valid data.
*
* Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and
* the receive payload word 0 indicates LS_ACC
* (e.g. value is 0x02xxxxxx).
*
* Note: Similarly, a CT Reject may be reported in 2 ways:
* a) A status of FC_CTELS_STATUS_OK is returned. The caller
* is to look into the CT receive payload to determine
* Accept or Reject (by contents of word 2). The reject
* data will be in word 3.
* b) A status of FC_CTELS_STATUS_REJECT is returned, The
* rjt_data field will contain valid data.
*
* Note: x_RJT/BSY status will indicae that the rjt_data field
* is valid and contains the reason/explanation values.
*/
uint32_t status; /* See FC_CTELS_STATUS_xxx */
/* valid if status is not FC_CTELS_STATUS_OK */
struct {
uint8_t action; /* fragment_id for CT REJECT */
uint8_t reason_code;
uint8_t reason_explanation;
uint8_t vendor_unique;
} rjt_data;
};
/* FC_BSG_HST_CT : */
/* Request:
* This message requests that a CT Request be performed with the
* indicated N_Port_ID. The driver is responsible for logging in with
* the fabric and/or N_Port_ID, etc as per FC rules. This request does
* not mandate that the driver must enumerate the destination in the
* transport. The driver is allowed to decide whether to enumerate it,
* and whether to tear it down after the request.
*/
struct fc_bsg_host_ct {
uint8_t reserved;
/* FC Address Identier of the remote port to send the ELS to */
uint8_t port_id[3];
/*
* We need words 0-2 of the generic preamble for the LLD's
*/
uint32_t preamble_word0; /* revision & IN_ID */
uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
uint32_t preamble_word2; /* Cmd Code, Max Size */
};
/* Response:
*
* The reply structure is an fc_bsg_ctels_reply structure
*/
/* FC_BSG_HST_VENDOR : */
/* Request:
* Note: When specifying vendor_id, be sure to read the Vendor Type and ID
* formatting requirements specified in scsi_netlink.h
*/
struct fc_bsg_host_vendor {
/*
* Identifies the vendor that the message is formatted for. This
* should be the recipient of the message.
*/
uint64_t vendor_id;
/* start of vendor command area */
uint32_t vendor_cmd[0];
};
/* Response:
*/
struct fc_bsg_host_vendor_reply {
/* start of vendor response area */
uint32_t vendor_rsp[0];
};
/*
* FC Remote Port Messages
*/
/* FC_BSG_RPT_ELS : */
/* Request:
* This message requests that an ELS be performed with the rport.
*/
struct fc_bsg_rport_els {
/*
* ELS Command Code being sent (must be the same as
* byte 0 of the payload)
*/
uint8_t els_code;
};
/* Response:
*
* The reply structure is an fc_bsg_ctels_reply structure
*/
/* FC_BSG_RPT_CT : */
/* Request:
* This message requests that a CT Request be performed with the rport.
*/
struct fc_bsg_rport_ct {
/*
* We need words 0-2 of the generic preamble for the LLD's
*/
uint32_t preamble_word0; /* revision & IN_ID */
uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
uint32_t preamble_word2; /* Cmd Code, Max Size */
};
/* Response:
*
* The reply structure is an fc_bsg_ctels_reply structure
*/
/* request (CDB) structure of the sg_io_v4 */
struct fc_bsg_request {
uint32_t msgcode;
union {
struct fc_bsg_host_add_rport h_addrport;
struct fc_bsg_host_del_rport h_delrport;
struct fc_bsg_host_els h_els;
struct fc_bsg_host_ct h_ct;
struct fc_bsg_host_vendor h_vendor;
struct fc_bsg_rport_els r_els;
struct fc_bsg_rport_ct r_ct;
} rqst_data;
} __attribute__((packed));
/* response (request sense data) structure of the sg_io_v4 */
struct fc_bsg_reply {
/*
* The completion result. Result exists in two forms:
* if negative, it is an -Exxx system errno value. There will
* be no further reply information supplied.
* else, it's the 4-byte scsi error result, with driver, host,
* msg and status fields. The per-msgcode reply structure
* will contain valid data.
*/
uint32_t result;
/* If there was reply_payload, how much was recevied ? */
uint32_t reply_payload_rcv_len;
union {
struct fc_bsg_host_vendor_reply vendor_reply;
struct fc_bsg_ctels_reply ctels_reply;
} reply_data;
};
#endif /* SCSI_BSG_FC_H */
/*
** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
#ifndef luaconf_h
#define luaconf_h
#include <limits.h>
#include <stddef.h>
#define LUA_USE_LINUX
#define LUA_DL_DLOPEN
#undef LUA_BUILD_AS_DLL
#define LUA_USE_READLINE
#define LUA_COMPAT_5_1
#define LUA_COMPAT_5_2
/*
** ===================================================================
** Search for "@@" to find all configurable definitions.
** ===================================================================
*/
/*
** {====================================================================
** System Configuration: macros to adapt (if needed) Lua to some
** particular platform, for instance compiling it with 32-bit numbers or
** restricting it to C89.
** =====================================================================
*/
/*
@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You
** can also define LUA_32BITS in the make file, but changing here you
** ensure that all software connected to Lua will be compiled with the
** same configuration.
*/
/* #define LUA_32BITS */
/*
@@ LUA_USE_C89 controls the use of non-ISO-C89 features.
** Define it if you want Lua to avoid the use of a few C99 features
** or Windows-specific features on Windows.
*/
/* #define LUA_USE_C89 */
/*
** By default, Lua on Windows use (some) specific Windows features
*/
#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
#define LUA_USE_WINDOWS /* enable goodies for regular Windows */
#endif
#if defined(LUA_USE_WINDOWS)
#define LUA_DL_DLL /* enable support for DLL */
#define LUA_USE_C89 /* broadly, Windows is C89 */
#endif
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
#define LUA_USE_READLINE /* needs some extra libraries */
#endif
#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* MacOS does not need -ldl */
#define LUA_USE_READLINE /* needs an extra library: -lreadline */
#endif
/*
@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
** C89 ('long' and 'double'); Windows always has '__int64', so it does
** not need to use this case.
*/
#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
#define LUA_C89_NUMBERS
#endif
/*
@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'.
*/
/* avoid undefined shifts */
#if ((INT_MAX >> 15) >> 15) >= 1
#define LUAI_BITSINT 32
#else
/* 'int' always must have at least 16 bits */
#define LUAI_BITSINT 16
#endif
/*
@@ LUA_INT_TYPE defines the type for Lua integers.
@@ LUA_FLOAT_TYPE defines the type for Lua floats.
** Lua should work fine with any mix of these options (if supported
** by your C compiler). The usual configurations are 64-bit integers
** and 'double' (the default), 32-bit integers and 'float' (for
** restricted platforms), and 'long'/'double' (for C compilers not
** compliant with C99, which may not have support for 'long long').
*/
/* predefined options for LUA_INT_TYPE */
#define LUA_INT_INT 1
#define LUA_INT_LONG 2
#define LUA_INT_LONGLONG 3
/* predefined options for LUA_FLOAT_TYPE */
#define LUA_FLOAT_FLOAT 1
#define LUA_FLOAT_DOUBLE 2
#define LUA_FLOAT_LONGDOUBLE 3
#if defined(LUA_32BITS) /* { */
/*
** 32-bit integers and 'float'
*/
#if LUAI_BITSINT >= 32 /* use 'int' if big enough */
#define LUA_INT_TYPE LUA_INT_INT
#else /* otherwise use 'long' */
#define LUA_INT_TYPE LUA_INT_LONG
#endif
#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
#elif defined(LUA_C89_NUMBERS) /* }{ */
/*
** largest types available for C89 ('long' and 'double')
*/
#define LUA_INT_TYPE LUA_INT_LONG
#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
#endif /* } */
/*
** default configuration for 64-bit Lua ('long long' and 'double')
*/
#if !defined(LUA_INT_TYPE)
#define LUA_INT_TYPE LUA_INT_LONGLONG
#endif
#if !defined(LUA_FLOAT_TYPE)
#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
#endif
/* }================================================================== */
/*
** {==================================================================
** Configuration for Paths.
** ===================================================================
*/
/*
** LUA_PATH_SEP is the character that separates templates in a path.
** LUA_PATH_MARK is the string that marks the substitution points in a
** template.
** LUA_EXEC_DIR in a Windows path is replaced by the executable's
** directory.
*/
#define LUA_PATH_SEP ";"
#define LUA_PATH_MARK "?"
#define LUA_EXEC_DIR "!"
/*
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
** Lua libraries.
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
** C libraries.
** CHANGE them if your machine has a non-conventional directory
** hierarchy or if you want to install your libraries in
** non-conventional directories.
*/
#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#if defined(_WIN32) /* { */
/*
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
#define LUA_LDIR "!\\lua\\"
#define LUA_CDIR "!\\"
#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\"
#define LUA_PATH_DEFAULT \
LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
".\\?.lua;" ".\\?\\init.lua"
#define LUA_CPATH_DEFAULT \
LUA_CDIR"?.dll;" \
LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
LUA_CDIR"loadall.dll;" ".\\?.dll"
#else /* }{ */
#define LUA_ROOT "/usr/"
#define LUA_LDIR "/usr/share/lua/" LUA_VDIR "/"
#define LUA_CDIR "/usr/lib64/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \
LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
"./?.lua;" "./?/init.lua"
#define LUA_CPATH_DEFAULT \
LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
#endif /* } */
/*
@@ LUA_DIRSEP is the directory separator (for submodules).
** CHANGE it if your machine does not use "/" as the directory separator
** and is not Windows. (On Windows Lua automatically uses "\".)
*/
#if defined(_WIN32)
#define LUA_DIRSEP "\\"
#else
#define LUA_DIRSEP "/"
#endif
/* }================================================================== */
/*
** {==================================================================
** Marks for exported symbols in the C code
** ===================================================================
*/
/*
@@ LUA_API is a mark for all core API functions.
@@ LUALIB_API is a mark for all auxiliary library functions.
@@ LUAMOD_API is a mark for all standard library opening functions.
** CHANGE them if you need to define those functions in some special way.
** For instance, if you want to create one Windows DLL with the core and
** the libraries, you may want to use the following definition (define
** LUA_BUILD_AS_DLL to get it).
*/
#if defined(LUA_BUILD_AS_DLL) /* { */
#if defined(LUA_CORE) || defined(LUA_LIB) /* { */
#define LUA_API __declspec(dllexport)
#else /* }{ */
#define LUA_API __declspec(dllimport)
#endif /* } */
#else /* }{ */
#define LUA_API extern
#endif /* } */
/* more often than not the libs go together with the core */
#define LUALIB_API LUA_API
#define LUAMOD_API LUALIB_API
/*
@@ LUAI_FUNC is a mark for all extern functions that are not to be
** exported to outside modules.
@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
** that are not to be exported to outside modules (LUAI_DDEF for
** definitions and LUAI_DDEC for declarations).
** CHANGE them if you need to mark them in some special way. Elf/gcc
** (versions 3.2 and later) mark them as "hidden" to optimize access
** when Lua is compiled as a shared library. Not all elf targets support
** this attribute. Unfortunately, gcc does not offer a way to check
** whether the target offers that support, and those without support
** give a warning about it. To avoid these warnings, change to the
** default definition.
*/
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
defined(__ELF__) /* { */
#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
#else /* }{ */
#define LUAI_FUNC extern
#endif /* } */
#define LUAI_DDEC LUAI_FUNC
#define LUAI_DDEF /* empty */
/* }================================================================== */
/*
** {==================================================================
** Compatibility with previous versions
** ===================================================================
*/
/*
@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2.
@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1.
** You can define it to get all options, or change specific options
** to fit your specific needs.
*/
#if defined(LUA_COMPAT_5_2) /* { */
/*
@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
** functions in the mathematical library.
*/
#define LUA_COMPAT_MATHLIB
/*
@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'.
*/
#define LUA_COMPAT_BITLIB
/*
@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod.
*/
#define LUA_COMPAT_IPAIRS
/*
@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
** luaL_checkint, luaL_checklong, etc.)
*/
#define LUA_COMPAT_APIINTCASTS
#endif /* } */
#if defined(LUA_COMPAT_5_1) /* { */
/* Incompatibilities from 5.2 -> 5.3 */
#define LUA_COMPAT_MATHLIB
#define LUA_COMPAT_APIINTCASTS
/*
@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
** You can replace it with 'table.unpack'.
*/
#define LUA_COMPAT_UNPACK
/*
@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
** You can replace it with 'package.searchers'.
*/
#define LUA_COMPAT_LOADERS
/*
@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
** You can call your C function directly (with light C functions).
*/
#define lua_cpcall(L,f,u) \
(lua_pushcfunction(L, (f)), \
lua_pushlightuserdata(L,(u)), \
lua_pcall(L,1,0,0))
/*
@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
** You can rewrite 'log10(x)' as 'log(x, 10)'.
*/
#define LUA_COMPAT_LOG10
/*
@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
** library. You can rewrite 'loadstring(s)' as 'load(s)'.
*/
#define LUA_COMPAT_LOADSTRING
/*
@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
*/
#define LUA_COMPAT_MAXN
/*
@@ The following macros supply trivial compatibility for some
** changes in the API. The macros themselves document how to
** change your code to avoid using them.
*/
#define lua_strlen(L,i) lua_rawlen(L, (i))
#define lua_objlen(L,i) lua_rawlen(L, (i))
#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
/*
@@ LUA_COMPAT_MODULE controls compatibility with previous
** module functions 'module' (Lua) and 'luaL_register' (C).
*/
#define LUA_COMPAT_MODULE
#endif /* } */
/*
@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a
@@ a float mark ('.0').
** This macro is not on by default even in compatibility mode,
** because this is not really an incompatibility.
*/
/* #define LUA_COMPAT_FLOATSTRING */
/* }================================================================== */
/*
** {==================================================================
** Configuration for Numbers.
** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
** satisfy your needs.
** ===================================================================
*/
/*
@@ LUA_NUMBER is the floating-point type used by Lua.
@@ LUAI_UACNUMBER is the result of a 'default argument promotion'
@@ over a floating number.
@@ l_mathlim(x) corrects limit name 'x' to the proper float type
** by prefixing it with one of FLT/DBL/LDBL.
@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
@@ LUA_NUMBER_FMT is the format for writing floats.
@@ lua_number2str converts a float to a string.
@@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
@@ l_floor takes the floor of a float.
@@ lua_str2number converts a decimal numeric string to a number.
*/
/* The following definitions are good for most cases here */
#define l_floor(x) (l_mathop(floor)(x))
#define lua_number2str(s,sz,n) \
l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))
/*
@@ lua_numbertointeger converts a float number to an integer, or
** returns 0 if float is not within the range of a lua_Integer.
** (The range comparisons are tricky because of rounding. The tests
** here assume a two-complement representation, where MININTEGER always
** has an exact representation as a float; MAXINTEGER may not have one,
** and therefore its conversion to float may have an ill-defined value.)
*/
#define lua_numbertointeger(n,p) \
((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
(n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
(*(p) = (LUA_INTEGER)(n), 1))
/* now the variable definitions */
#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */
#define LUA_NUMBER float
#define l_mathlim(n) (FLT_##n)
#define LUAI_UACNUMBER double
#define LUA_NUMBER_FRMLEN ""
#define LUA_NUMBER_FMT "%.7g"
#define l_mathop(op) op##f
#define lua_str2number(s,p) strtof((s), (p))
#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */
#define LUA_NUMBER long double
#define l_mathlim(n) (LDBL_##n)
#define LUAI_UACNUMBER long double
#define LUA_NUMBER_FRMLEN "L"
#define LUA_NUMBER_FMT "%.19Lg"
#define l_mathop(op) op##l
#define lua_str2number(s,p) strtold((s), (p))
#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */
#define LUA_NUMBER double
#define l_mathlim(n) (DBL_##n)
#define LUAI_UACNUMBER double
#define LUA_NUMBER_FRMLEN ""
#define LUA_NUMBER_FMT "%.14g"
#define l_mathop(op) op
#define lua_str2number(s,p) strtod((s), (p))
#else /* }{ */
#error "numeric float type not defined"
#endif /* } */
/*
@@ LUA_INTEGER is the integer type used by Lua.
**
@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
**
@@ LUAI_UACINT is the result of a 'default argument promotion'
@@ over a lUA_INTEGER.
@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
@@ LUA_INTEGER_FMT is the format for writing integers.
@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
@@ lua_integer2str converts an integer to a string.
*/
/* The following definitions are good for most cases here */
#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d"
#define LUAI_UACINT LUA_INTEGER
#define lua_integer2str(s,sz,n) \
l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
/*
** use LUAI_UACINT here to avoid problems with promotions (which
** can turn a comparison between unsigneds into a signed comparison)
*/
#define LUA_UNSIGNED unsigned LUAI_UACINT
/* now the variable definitions */
#if LUA_INT_TYPE == LUA_INT_INT /* { int */
#define LUA_INTEGER int
#define LUA_INTEGER_FRMLEN ""
#define LUA_MAXINTEGER INT_MAX
#define LUA_MININTEGER INT_MIN
#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */
#define LUA_INTEGER long
#define LUA_INTEGER_FRMLEN "l"
#define LUA_MAXINTEGER LONG_MAX
#define LUA_MININTEGER LONG_MIN
#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */
/* use presence of macro LLONG_MAX as proxy for C99 compliance */
#if defined(LLONG_MAX) /* { */
/* use ISO C99 stuff */
#define LUA_INTEGER long long
#define LUA_INTEGER_FRMLEN "ll"
#define LUA_MAXINTEGER LLONG_MAX
#define LUA_MININTEGER LLONG_MIN
#elif defined(LUA_USE_WINDOWS) /* }{ */
/* in Windows, can use specific Windows types */
#define LUA_INTEGER __int64
#define LUA_INTEGER_FRMLEN "I64"
#define LUA_MAXINTEGER _I64_MAX
#define LUA_MININTEGER _I64_MIN
#else /* }{ */
#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
#endif /* } */
#else /* }{ */
#error "numeric integer type not defined"
#endif /* } */
/* }================================================================== */
/*
** {==================================================================
** Dependencies with C99 and other C details
** ===================================================================
*/
/*
@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
** (All uses in Lua have only one format item.)
*/
#if !defined(LUA_USE_C89)
#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
#else
#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
#endif
/*
@@ lua_strx2number converts an hexadecimal numeric string to a number.
** In C99, 'strtod' does that conversion. Otherwise, you can
** leave 'lua_strx2number' undefined and Lua will provide its own
** implementation.
*/
#if !defined(LUA_USE_C89)
#define lua_strx2number(s,p) lua_str2number(s,p)
#endif
/*
@@ lua_number2strx converts a float to an hexadecimal numeric string.
** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
** provide its own implementation.
*/
#if !defined(LUA_USE_C89)
#define lua_number2strx(L,b,sz,f,n) \
((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))
#endif
/*
** 'strtof' and 'opf' variants for math functions are not valid in
** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
** availability of these variants. ('math.h' is already included in
** all files that use these macros.)
*/
#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
#undef l_mathop /* variants not available */
#undef lua_str2number
#define l_mathop(op) (lua_Number)op /* no variant */
#define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
#endif
/*
@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
** functions. It must be a numerical type; Lua will use 'intptr_t' if
** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
** 'intptr_t' in C89)
*/
#define LUA_KCONTEXT ptrdiff_t
#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
__STDC_VERSION__ >= 199901L
#include <stdint.h>
#if defined(INTPTR_MAX) /* even in C99 this type is optional */
#undef LUA_KCONTEXT
#define LUA_KCONTEXT intptr_t
#endif
#endif
/*
@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
** Change that if you do not want to use C locales. (Code using this
** macro must include header 'locale.h'.)
*/
#if !defined(lua_getlocaledecpoint)
#define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
#endif
/* }================================================================== */
/*
** {==================================================================
** Language Variations
** =====================================================================
*/
/*
@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
** coercion from strings to numbers.
*/
/* #define LUA_NOCVTN2S */
/* #define LUA_NOCVTS2N */
/*
@@ LUA_USE_APICHECK turns on several consistency checks on the C API.
** Define it as a help when debugging C code.
*/
#if defined(LUA_USE_APICHECK)
#include <assert.h>
#define luai_apicheck(l,e) assert(e)
#endif
/* }================================================================== */
/*
** {==================================================================
** Macros that affect the API and must be stable (that is, must be the
** same when you compile Lua and when you compile code that links to
** Lua). You probably do not want/need to change them.
** =====================================================================
*/
/*
@@ LUAI_MAXSTACK limits the size of the Lua stack.
** CHANGE it if you need a different limit. This limit is arbitrary;
** its only purpose is to stop Lua from consuming unlimited stack
** space (and to reserve some numbers for pseudo-indices).
*/
#if LUAI_BITSINT >= 32
#define LUAI_MAXSTACK 1000000
#else
#define LUAI_MAXSTACK 15000
#endif
/*
@@ LUA_EXTRASPACE defines the size of a raw memory area associated with
** a Lua state with very fast access.
** CHANGE it if you need a different size.
*/
#define LUA_EXTRASPACE (sizeof(void *))
/*
@@ LUA_IDSIZE gives the maximum size for the description of the source
@@ of a function in debug information.
** CHANGE it if you want a different size.
*/
#define LUA_IDSIZE 512
/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
** CHANGE it if it uses too much C-stack space. (For long double,
** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a
** smaller buffer would force a memory allocation for each call to
** 'string.format'.)
*/
#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
#define LUAL_BUFFERSIZE 8192
#else
#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
#endif
/* }================================================================== */
/*
@@ LUA_QL describes how error messages quote program elements.
** Lua does not use these macros anymore; they are here for
** compatibility only.
*/
#define LUA_QL(x) "'" x "'"
#define LUA_QS LUA_QL("%s")
/* =================================================================== */
/*
** Local configuration. You can use this space to add your redefinitions
** without modifying the main part of the file.
*/
#endif
/*
* Kluge to support multilib installation of both 32- and 64-bit RPMS:
* we need to arrange that header files that appear in both RPMs are
* identical. Hence, this file is architecture-independent and calls
* in an arch-dependent file that will appear in just one RPM.
*
* To avoid breaking arches not explicitly supported by Red Hat, we
* use this indirection file *only* on known multilib arches.
*
* We pay attention to include _only_ the original multilib-unclean
* header file. Including any other system-header file could cause
* unpredictable include-ordering issues (rhbz#1412274, comment #16).
*
* Note: this may well fail if user tries to use gcc's -I- option.
* But that option is deprecated anyway.
*/
#if defined(__x86_64__)
#include "pg_config_ext-x86_64.h"
#elif defined(__i386__)
#include "pg_config_ext-i386.h"
#elif defined(__ppc64__) || defined(__powerpc64__)
#include "pg_config_ext-ppc64.h"
#elif defined(__ppc__) || defined(__powerpc__)
#include "pg_config_ext-ppc.h"
#elif defined(__s390x__)
#include "pg_config_ext-s390x.h"
#elif defined(__s390__)
#include "pg_config_ext-s390.h"
#elif defined(__sparc__) && defined(__arch64__)
#include "pg_config_ext-sparc64.h"
#elif defined(__sparc__)
#include "pg_config_ext-sparc.h"
#endif
/*
Copyright 1985, 1986, 1987, 1988, 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _VarargsI_h_
#define _VarargsI_h_
#include <stdarg.h>
/* private routines */
_XFUNCPROTOBEGIN
extern void _XtCountVaList(
va_list /*var*/, int* /*total_count*/, int* /*typed_count*/
);
extern void _XtVaToArgList(
Widget /*widget*/, va_list /*var*/, int /*max_count*/, ArgList* /*args_return*/, Cardinal* /*num_args_return*/
);
extern void _XtVaToTypedArgList(
va_list /*var*/, int /*count*/, XtTypedArgList* /*args_return*/, Cardinal* /*num_args_return*/
);
extern XtTypedArgList _XtVaCreateTypedArgList(
va_list /*var*/, int /*count*/
);
extern void _XtFreeArgList(
ArgList /*args*/, int /*total_count*/, int /*typed_count*/
);
extern void _XtGetApplicationResources(
Widget /*w*/, XtPointer /*base*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/
);
extern void _XtGetSubresources(
Widget /*w*/, XtPointer /*base*/, const char* /*name*/, const char* /*class*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/
);
_XFUNCPROTOEND
#endif /* _VarargsI_h_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtConstraintP_h
#define _XtConstraintP_h
#include <X11/Constraint.h>
_XFUNCPROTOBEGIN
typedef struct _ConstraintPart {
XtPointer mumble; /* No new fields, keep C compiler happy */
} ConstraintPart;
typedef struct _ConstraintRec {
CorePart core;
CompositePart composite;
ConstraintPart constraint;
} ConstraintRec, *ConstraintWidget;
typedef struct _ConstraintClassPart {
XtResourceList resources; /* constraint resource list */
Cardinal num_resources; /* number of constraints in list */
Cardinal constraint_size; /* size of constraint record */
XtInitProc initialize; /* constraint initialization */
XtWidgetProc destroy; /* constraint destroy proc */
XtSetValuesFunc set_values; /* constraint set_values proc */
XtPointer extension; /* pointer to extension record */
} ConstraintClassPart;
typedef struct {
XtPointer next_extension; /* 1st 4 mandated for all extension records */
XrmQuark record_type; /* NULLQUARK; on ConstraintClassPart */
long version; /* must be XtConstraintExtensionVersion */
Cardinal record_size; /* sizeof(ConstraintClassExtensionRec) */
XtArgsProc get_values_hook;
} ConstraintClassExtensionRec, *ConstraintClassExtension;
typedef struct _ConstraintClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
} ConstraintClassRec;
externalref ConstraintClassRec constraintClassRec;
_XFUNCPROTOEND
#define XtConstraintExtensionVersion 1L
#endif /* _XtConstraintP_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/*
Copyright 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XtHookObjI_h
#define _XtHookObjI_h
_XFUNCPROTOBEGIN
/* This object is implementation-dependent and private to the library. */
typedef struct _HookObjRec *HookObject;
typedef struct _HookObjClassRec *HookObjectClass;
externalref WidgetClass hookObjectClass;
typedef struct _HookObjPart {
/* resources */
XtCallbackList createhook_callbacks;
XtCallbackList changehook_callbacks;
XtCallbackList confighook_callbacks;
XtCallbackList geometryhook_callbacks;
XtCallbackList destroyhook_callbacks;
WidgetList shells;
Cardinal num_shells;
/* private data */
Cardinal max_shells;
Screen* screen;
}HookObjPart;
typedef struct _HookObjRec {
ObjectPart object;
HookObjPart hooks;
} HookObjRec;
typedef struct _HookObjClassPart {
int unused;
} HookObjClassPart;
typedef struct _HookObjClassRec {
ObjectClassPart object_class;
HookObjClassPart hook_class;
} HookObjClassRec;
externalref HookObjClassRec hookObjClassRec;
_XFUNCPROTOEND
#endif /* ifndef _Xt_HookObjI_h */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/****************************************************************
*
* Callbacks
*
****************************************************************/
typedef XrmResource **CallbackTable;
#define _XtCBCalling 1
#define _XtCBFreeAfterCalling 2
_XFUNCPROTOBEGIN
typedef struct internalCallbackRec {
unsigned short count;
char is_padded; /* contains NULL padding for external form */
char call_state; /* combination of _XtCB{FreeAfter}Calling */
#ifdef LONG64
unsigned int align_pad; /* padding to align callback list */
#endif
/* XtCallbackList */
} InternalCallbackRec, *InternalCallbackList;
typedef Boolean (*_XtConditionProc)(
XtPointer /* data */
);
extern void _XtAddCallback(
InternalCallbackList* /* callbacks */,
XtCallbackProc /* callback */,
XtPointer /* closure */
);
extern void _XtAddCallbackOnce(
InternalCallbackList* /* callbacks */,
XtCallbackProc /* callback */,
XtPointer /* closure */
);
extern InternalCallbackList _XtCompileCallbackList(
XtCallbackList /* xtcallbacks */
);
extern XtCallbackList _XtGetCallbackList(
InternalCallbackList* /* callbacks */
);
extern void _XtRemoveAllCallbacks(
InternalCallbackList* /* callbacks */
);
extern void _XtRemoveCallback(
InternalCallbackList* /* callbacks */,
XtCallbackProc /* callback */,
XtPointer /* closure */
);
extern void _XtPeekCallback(
Widget /* widget */,
XtCallbackList /* callbacks */,
XtCallbackProc * /* callback */,
XtPointer * /* closure */
);
extern void _XtCallConditionalCallbackList(
Widget /* widget */,
XtCallbackList /* callbacks */,
XtPointer /* call_data */,
_XtConditionProc /* cond_proc */
);
_XFUNCPROTOEND
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtShell_h
#define _XtShell_h
#include <X11/SM/SMlib.h>
#include <X11/Intrinsic.h>
/***********************************************************************
*
* Shell Widget
*
***********************************************************************/
/*
* Shell-specific resources names, classes, and a representation type.
*/
#ifndef XTSTRINGDEFINES
#define _XtShell_h_Const const
#endif
/* $Xorg: makestrs.c,v 1.6 2001/02/09 02:03:17 xorgcvs Exp $ */
/* This file is automatically generated. */
/* Default ABI version -- Do not edit */
#ifdef XTSTRINGDEFINES
#define XtNiconName "iconName"
#define XtCIconName "IconName"
#define XtNiconPixmap "iconPixmap"
#define XtCIconPixmap "IconPixmap"
#define XtNiconWindow "iconWindow"
#define XtCIconWindow "IconWindow"
#define XtNiconMask "iconMask"
#define XtCIconMask "IconMask"
#define XtNwindowGroup "windowGroup"
#define XtCWindowGroup "WindowGroup"
#define XtNvisual "visual"
#define XtCVisual "Visual"
#define XtNtitleEncoding "titleEncoding"
#define XtCTitleEncoding "TitleEncoding"
#define XtNsaveUnder "saveUnder"
#define XtCSaveUnder "SaveUnder"
#define XtNtransient "transient"
#define XtCTransient "Transient"
#define XtNoverrideRedirect "overrideRedirect"
#define XtCOverrideRedirect "OverrideRedirect"
#define XtNtransientFor "transientFor"
#define XtCTransientFor "TransientFor"
#define XtNiconNameEncoding "iconNameEncoding"
#define XtCIconNameEncoding "IconNameEncoding"
#define XtNallowShellResize "allowShellResize"
#define XtCAllowShellResize "AllowShellResize"
#define XtNcreatePopupChildProc "createPopupChildProc"
#define XtCCreatePopupChildProc "CreatePopupChildProc"
#define XtNtitle "title"
#define XtCTitle "Title"
#ifndef XtRAtom
#define XtRAtom "Atom"
#endif
#define XtNargc "argc"
#define XtCArgc "Argc"
#define XtNargv "argv"
#define XtCArgv "Argv"
#define XtNiconX "iconX"
#define XtCIconX "IconX"
#define XtNiconY "iconY"
#define XtCIconY "IconY"
#define XtNinput "input"
#define XtCInput "Input"
#define XtNiconic "iconic"
#define XtCIconic "Iconic"
#define XtNinitialState "initialState"
#define XtCInitialState "InitialState"
#define XtNgeometry "geometry"
#define XtCGeometry "Geometry"
#define XtNbaseWidth "baseWidth"
#define XtCBaseWidth "BaseWidth"
#define XtNbaseHeight "baseHeight"
#define XtCBaseHeight "BaseHeight"
#define XtNwinGravity "winGravity"
#define XtCWinGravity "WinGravity"
#define XtNminWidth "minWidth"
#define XtCMinWidth "MinWidth"
#define XtNminHeight "minHeight"
#define XtCMinHeight "MinHeight"
#define XtNmaxWidth "maxWidth"
#define XtCMaxWidth "MaxWidth"
#define XtNmaxHeight "maxHeight"
#define XtCMaxHeight "MaxHeight"
#define XtNwidthInc "widthInc"
#define XtCWidthInc "WidthInc"
#define XtNheightInc "heightInc"
#define XtCHeightInc "HeightInc"
#define XtNminAspectY "minAspectY"
#define XtCMinAspectY "MinAspectY"
#define XtNmaxAspectY "maxAspectY"
#define XtCMaxAspectY "MaxAspectY"
#define XtNminAspectX "minAspectX"
#define XtCMinAspectX "MinAspectX"
#define XtNmaxAspectX "maxAspectX"
#define XtCMaxAspectX "MaxAspectX"
#define XtNwmTimeout "wmTimeout"
#define XtCWmTimeout "WmTimeout"
#define XtNwaitForWm "waitforwm"
#define XtCWaitForWm "Waitforwm"
#define XtNwaitforwm "waitforwm"
#define XtCWaitforwm "Waitforwm"
#define XtNclientLeader "clientLeader"
#define XtCClientLeader "ClientLeader"
#define XtNwindowRole "windowRole"
#define XtCWindowRole "WindowRole"
#define XtNurgency "urgency"
#define XtCUrgency "Urgency"
#define XtNcancelCallback "cancelCallback"
#define XtNcloneCommand "cloneCommand"
#define XtCCloneCommand "CloneCommand"
#define XtNconnection "connection"
#define XtCConnection "Connection"
#define XtNcurrentDirectory "currentDirectory"
#define XtCCurrentDirectory "CurrentDirectory"
#define XtNdieCallback "dieCallback"
#define XtNdiscardCommand "discardCommand"
#define XtCDiscardCommand "DiscardCommand"
#define XtNenvironment "environment"
#define XtCEnvironment "Environment"
#define XtNinteractCallback "interactCallback"
#define XtNjoinSession "joinSession"
#define XtCJoinSession "JoinSession"
#define XtNprogramPath "programPath"
#define XtCProgramPath "ProgramPath"
#define XtNresignCommand "resignCommand"
#define XtCResignCommand "ResignCommand"
#define XtNrestartCommand "restartCommand"
#define XtCRestartCommand "RestartCommand"
#define XtNrestartStyle "restartStyle"
#define XtCRestartStyle "RestartStyle"
#define XtNsaveCallback "saveCallback"
#define XtNsaveCompleteCallback "saveCompleteCallback"
#define XtNsessionID "sessionID"
#define XtCSessionID "SessionID"
#define XtNshutdownCommand "shutdownCommand"
#define XtCShutdownCommand "ShutdownCommand"
#define XtNerrorCallback "errorCallback"
#else
extern _XtShell_h_Const char XtShellStrings[];
#ifndef XtNiconName
#define XtNiconName ((char*)&XtShellStrings[0])
#endif
#ifndef XtCIconName
#define XtCIconName ((char*)&XtShellStrings[9])
#endif
#ifndef XtNiconPixmap
#define XtNiconPixmap ((char*)&XtShellStrings[18])
#endif
#ifndef XtCIconPixmap
#define XtCIconPixmap ((char*)&XtShellStrings[29])
#endif
#ifndef XtNiconWindow
#define XtNiconWindow ((char*)&XtShellStrings[40])
#endif
#ifndef XtCIconWindow
#define XtCIconWindow ((char*)&XtShellStrings[51])
#endif
#ifndef XtNiconMask
#define XtNiconMask ((char*)&XtShellStrings[62])
#endif
#ifndef XtCIconMask
#define XtCIconMask ((char*)&XtShellStrings[71])
#endif
#ifndef XtNwindowGroup
#define XtNwindowGroup ((char*)&XtShellStrings[80])
#endif
#ifndef XtCWindowGroup
#define XtCWindowGroup ((char*)&XtShellStrings[92])
#endif
#ifndef XtNvisual
#define XtNvisual ((char*)&XtShellStrings[104])
#endif
#ifndef XtCVisual
#define XtCVisual ((char*)&XtShellStrings[111])
#endif
#ifndef XtNtitleEncoding
#define XtNtitleEncoding ((char*)&XtShellStrings[118])
#endif
#ifndef XtCTitleEncoding
#define XtCTitleEncoding ((char*)&XtShellStrings[132])
#endif
#ifndef XtNsaveUnder
#define XtNsaveUnder ((char*)&XtShellStrings[146])
#endif
#ifndef XtCSaveUnder
#define XtCSaveUnder ((char*)&XtShellStrings[156])
#endif
#ifndef XtNtransient
#define XtNtransient ((char*)&XtShellStrings[166])
#endif
#ifndef XtCTransient
#define XtCTransient ((char*)&XtShellStrings[176])
#endif
#ifndef XtNoverrideRedirect
#define XtNoverrideRedirect ((char*)&XtShellStrings[186])
#endif
#ifndef XtCOverrideRedirect
#define XtCOverrideRedirect ((char*)&XtShellStrings[203])
#endif
#ifndef XtNtransientFor
#define XtNtransientFor ((char*)&XtShellStrings[220])
#endif
#ifndef XtCTransientFor
#define XtCTransientFor ((char*)&XtShellStrings[233])
#endif
#ifndef XtNiconNameEncoding
#define XtNiconNameEncoding ((char*)&XtShellStrings[246])
#endif
#ifndef XtCIconNameEncoding
#define XtCIconNameEncoding ((char*)&XtShellStrings[263])
#endif
#ifndef XtNallowShellResize
#define XtNallowShellResize ((char*)&XtShellStrings[280])
#endif
#ifndef XtCAllowShellResize
#define XtCAllowShellResize ((char*)&XtShellStrings[297])
#endif
#ifndef XtNcreatePopupChildProc
#define XtNcreatePopupChildProc ((char*)&XtShellStrings[314])
#endif
#ifndef XtCCreatePopupChildProc
#define XtCCreatePopupChildProc ((char*)&XtShellStrings[335])
#endif
#ifndef XtNtitle
#define XtNtitle ((char*)&XtShellStrings[356])
#endif
#ifndef XtCTitle
#define XtCTitle ((char*)&XtShellStrings[362])
#endif
#ifndef XtRAtom
#define XtRAtom ((char*)&XtShellStrings[368])
#endif
#ifndef XtNargc
#define XtNargc ((char*)&XtShellStrings[373])
#endif
#ifndef XtCArgc
#define XtCArgc ((char*)&XtShellStrings[378])
#endif
#ifndef XtNargv
#define XtNargv ((char*)&XtShellStrings[383])
#endif
#ifndef XtCArgv
#define XtCArgv ((char*)&XtShellStrings[388])
#endif
#ifndef XtNiconX
#define XtNiconX ((char*)&XtShellStrings[393])
#endif
#ifndef XtCIconX
#define XtCIconX ((char*)&XtShellStrings[399])
#endif
#ifndef XtNiconY
#define XtNiconY ((char*)&XtShellStrings[405])
#endif
#ifndef XtCIconY
#define XtCIconY ((char*)&XtShellStrings[411])
#endif
#ifndef XtNinput
#define XtNinput ((char*)&XtShellStrings[417])
#endif
#ifndef XtCInput
#define XtCInput ((char*)&XtShellStrings[423])
#endif
#ifndef XtNiconic
#define XtNiconic ((char*)&XtShellStrings[429])
#endif
#ifndef XtCIconic
#define XtCIconic ((char*)&XtShellStrings[436])
#endif
#ifndef XtNinitialState
#define XtNinitialState ((char*)&XtShellStrings[443])
#endif
#ifndef XtCInitialState
#define XtCInitialState ((char*)&XtShellStrings[456])
#endif
#ifndef XtNgeometry
#define XtNgeometry ((char*)&XtShellStrings[469])
#endif
#ifndef XtCGeometry
#define XtCGeometry ((char*)&XtShellStrings[478])
#endif
#ifndef XtNbaseWidth
#define XtNbaseWidth ((char*)&XtShellStrings[487])
#endif
#ifndef XtCBaseWidth
#define XtCBaseWidth ((char*)&XtShellStrings[497])
#endif
#ifndef XtNbaseHeight
#define XtNbaseHeight ((char*)&XtShellStrings[507])
#endif
#ifndef XtCBaseHeight
#define XtCBaseHeight ((char*)&XtShellStrings[518])
#endif
#ifndef XtNwinGravity
#define XtNwinGravity ((char*)&XtShellStrings[529])
#endif
#ifndef XtCWinGravity
#define XtCWinGravity ((char*)&XtShellStrings[540])
#endif
#ifndef XtNminWidth
#define XtNminWidth ((char*)&XtShellStrings[551])
#endif
#ifndef XtCMinWidth
#define XtCMinWidth ((char*)&XtShellStrings[560])
#endif
#ifndef XtNminHeight
#define XtNminHeight ((char*)&XtShellStrings[569])
#endif
#ifndef XtCMinHeight
#define XtCMinHeight ((char*)&XtShellStrings[579])
#endif
#ifndef XtNmaxWidth
#define XtNmaxWidth ((char*)&XtShellStrings[589])
#endif
#ifndef XtCMaxWidth
#define XtCMaxWidth ((char*)&XtShellStrings[598])
#endif
#ifndef XtNmaxHeight
#define XtNmaxHeight ((char*)&XtShellStrings[607])
#endif
#ifndef XtCMaxHeight
#define XtCMaxHeight ((char*)&XtShellStrings[617])
#endif
#ifndef XtNwidthInc
#define XtNwidthInc ((char*)&XtShellStrings[627])
#endif
#ifndef XtCWidthInc
#define XtCWidthInc ((char*)&XtShellStrings[636])
#endif
#ifndef XtNheightInc
#define XtNheightInc ((char*)&XtShellStrings[645])
#endif
#ifndef XtCHeightInc
#define XtCHeightInc ((char*)&XtShellStrings[655])
#endif
#ifndef XtNminAspectY
#define XtNminAspectY ((char*)&XtShellStrings[665])
#endif
#ifndef XtCMinAspectY
#define XtCMinAspectY ((char*)&XtShellStrings[676])
#endif
#ifndef XtNmaxAspectY
#define XtNmaxAspectY ((char*)&XtShellStrings[687])
#endif
#ifndef XtCMaxAspectY
#define XtCMaxAspectY ((char*)&XtShellStrings[698])
#endif
#ifndef XtNminAspectX
#define XtNminAspectX ((char*)&XtShellStrings[709])
#endif
#ifndef XtCMinAspectX
#define XtCMinAspectX ((char*)&XtShellStrings[720])
#endif
#ifndef XtNmaxAspectX
#define XtNmaxAspectX ((char*)&XtShellStrings[731])
#endif
#ifndef XtCMaxAspectX
#define XtCMaxAspectX ((char*)&XtShellStrings[742])
#endif
#ifndef XtNwmTimeout
#define XtNwmTimeout ((char*)&XtShellStrings[753])
#endif
#ifndef XtCWmTimeout
#define XtCWmTimeout ((char*)&XtShellStrings[763])
#endif
#ifndef XtNwaitForWm
#define XtNwaitForWm ((char*)&XtShellStrings[773])
#endif
#ifndef XtCWaitForWm
#define XtCWaitForWm ((char*)&XtShellStrings[783])
#endif
#ifndef XtNwaitforwm
#define XtNwaitforwm ((char*)&XtShellStrings[793])
#endif
#ifndef XtCWaitforwm
#define XtCWaitforwm ((char*)&XtShellStrings[803])
#endif
#ifndef XtNclientLeader
#define XtNclientLeader ((char*)&XtShellStrings[813])
#endif
#ifndef XtCClientLeader
#define XtCClientLeader ((char*)&XtShellStrings[826])
#endif
#ifndef XtNwindowRole
#define XtNwindowRole ((char*)&XtShellStrings[839])
#endif
#ifndef XtCWindowRole
#define XtCWindowRole ((char*)&XtShellStrings[850])
#endif
#ifndef XtNurgency
#define XtNurgency ((char*)&XtShellStrings[861])
#endif
#ifndef XtCUrgency
#define XtCUrgency ((char*)&XtShellStrings[869])
#endif
#ifndef XtNcancelCallback
#define XtNcancelCallback ((char*)&XtShellStrings[877])
#endif
#ifndef XtNcloneCommand
#define XtNcloneCommand ((char*)&XtShellStrings[892])
#endif
#ifndef XtCCloneCommand
#define XtCCloneCommand ((char*)&XtShellStrings[905])
#endif
#ifndef XtNconnection
#define XtNconnection ((char*)&XtShellStrings[918])
#endif
#ifndef XtCConnection
#define XtCConnection ((char*)&XtShellStrings[929])
#endif
#ifndef XtNcurrentDirectory
#define XtNcurrentDirectory ((char*)&XtShellStrings[940])
#endif
#ifndef XtCCurrentDirectory
#define XtCCurrentDirectory ((char*)&XtShellStrings[957])
#endif
#ifndef XtNdieCallback
#define XtNdieCallback ((char*)&XtShellStrings[974])
#endif
#ifndef XtNdiscardCommand
#define XtNdiscardCommand ((char*)&XtShellStrings[986])
#endif
#ifndef XtCDiscardCommand
#define XtCDiscardCommand ((char*)&XtShellStrings[1001])
#endif
#ifndef XtNenvironment
#define XtNenvironment ((char*)&XtShellStrings[1016])
#endif
#ifndef XtCEnvironment
#define XtCEnvironment ((char*)&XtShellStrings[1028])
#endif
#ifndef XtNinteractCallback
#define XtNinteractCallback ((char*)&XtShellStrings[1040])
#endif
#ifndef XtNjoinSession
#define XtNjoinSession ((char*)&XtShellStrings[1057])
#endif
#ifndef XtCJoinSession
#define XtCJoinSession ((char*)&XtShellStrings[1069])
#endif
#ifndef XtNprogramPath
#define XtNprogramPath ((char*)&XtShellStrings[1081])
#endif
#ifndef XtCProgramPath
#define XtCProgramPath ((char*)&XtShellStrings[1093])
#endif
#ifndef XtNresignCommand
#define XtNresignCommand ((char*)&XtShellStrings[1105])
#endif
#ifndef XtCResignCommand
#define XtCResignCommand ((char*)&XtShellStrings[1119])
#endif
#ifndef XtNrestartCommand
#define XtNrestartCommand ((char*)&XtShellStrings[1133])
#endif
#ifndef XtCRestartCommand
#define XtCRestartCommand ((char*)&XtShellStrings[1148])
#endif
#ifndef XtNrestartStyle
#define XtNrestartStyle ((char*)&XtShellStrings[1163])
#endif
#ifndef XtCRestartStyle
#define XtCRestartStyle ((char*)&XtShellStrings[1176])
#endif
#ifndef XtNsaveCallback
#define XtNsaveCallback ((char*)&XtShellStrings[1189])
#endif
#ifndef XtNsaveCompleteCallback
#define XtNsaveCompleteCallback ((char*)&XtShellStrings[1202])
#endif
#ifndef XtNsessionID
#define XtNsessionID ((char*)&XtShellStrings[1223])
#endif
#ifndef XtCSessionID
#define XtCSessionID ((char*)&XtShellStrings[1233])
#endif
#ifndef XtNshutdownCommand
#define XtNshutdownCommand ((char*)&XtShellStrings[1243])
#endif
#ifndef XtCShutdownCommand
#define XtCShutdownCommand ((char*)&XtShellStrings[1259])
#endif
#ifndef XtNerrorCallback
#define XtNerrorCallback ((char*)&XtShellStrings[1275])
#endif
#endif /* XTSTRINGDEFINES */
#ifndef XTSTRINGDEFINES
#undef _XtShell_h_Const
#endif
/* Class record constants */
typedef struct _ShellClassRec *ShellWidgetClass;
typedef struct _OverrideShellClassRec *OverrideShellWidgetClass;
typedef struct _WMShellClassRec *WMShellWidgetClass;
typedef struct _TransientShellClassRec *TransientShellWidgetClass;
typedef struct _TopLevelShellClassRec *TopLevelShellWidgetClass;
typedef struct _ApplicationShellClassRec *ApplicationShellWidgetClass;
typedef struct _SessionShellClassRec *SessionShellWidgetClass;
#ifndef SHELL
externalref WidgetClass shellWidgetClass;
externalref WidgetClass overrideShellWidgetClass;
externalref WidgetClass wmShellWidgetClass;
externalref WidgetClass transientShellWidgetClass;
externalref WidgetClass topLevelShellWidgetClass;
externalref WidgetClass applicationShellWidgetClass;
externalref WidgetClass sessionShellWidgetClass;
#endif
#endif /* _XtShell_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/********************************************************
Copyright 1988 by Hewlett-Packard Company
Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the names of
Hewlett-Packard or Digital not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
/*
Copyright 1987, 1988, 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _PDI_h_
#define _PDI_h_
#define KEYBOARD TRUE
#define POINTER FALSE
_XFUNCPROTOBEGIN
typedef enum {
XtNoServerGrab,
XtPassiveServerGrab,
XtActiveServerGrab,
XtPseudoPassiveServerGrab,
XtPseudoActiveServerGrab
}XtServerGrabType;
typedef struct _XtServerGrabRec {
struct _XtServerGrabRec *next;
Widget widget;
unsigned int ownerEvents:1;
unsigned int pointerMode:1;
unsigned int keyboardMode:1;
unsigned int hasExt:1;
unsigned int confineToIsWidgetWin:1;
KeyCode keybut;
unsigned short modifiers;
unsigned short eventMask;
} XtServerGrabRec, *XtServerGrabPtr;
typedef struct _XtGrabExtRec {
Mask *pKeyButMask;
Mask *pModifiersMask;
Window confineTo;
Cursor cursor;
} XtServerGrabExtRec, *XtServerGrabExtPtr;
#define GRABEXT(p) ((XtServerGrabExtPtr)((p)+1))
typedef struct _XtDeviceRec{
XtServerGrabRec grab; /* need copy in order to protect
during grab */
XtServerGrabType grabType;
}XtDeviceRec, *XtDevice;
#define XtMyAncestor 0
#define XtMyDescendant 1
#define XtMyCousin 2
#define XtMySelf 3
#define XtUnrelated 4
typedef char XtGeneology; /* do not use an enum makes PerWidgetInput larger */
typedef struct {
Widget focusKid;
XtServerGrabPtr keyList, ptrList;
Widget queryEventDescendant;
unsigned int map_handler_added:1;
unsigned int realize_handler_added:1;
unsigned int active_handler_added:1;
unsigned int haveFocus:1;
XtGeneology focalPoint;
}XtPerWidgetInputRec, *XtPerWidgetInput;
typedef struct XtPerDisplayInputRec{
XtGrabList grabList;
XtDeviceRec keyboard, pointer;
KeyCode activatingKey;
Widget *trace;
int traceDepth, traceMax;
Widget focusWidget;
}XtPerDisplayInputRec, *XtPerDisplayInput;
#define IsServerGrab(g) ((g == XtPassiveServerGrab) ||\
(g == XtActiveServerGrab))
#define IsAnyGrab(g) ((g == XtPassiveServerGrab) ||\
(g == XtActiveServerGrab) ||\
(g == XtPseudoPassiveServerGrab))
#define IsEitherPassiveGrab(g) ((g == XtPassiveServerGrab) ||\
(g == XtPseudoPassiveServerGrab))
#define IsPseudoGrab(g) ((g == XtPseudoPassiveServerGrab))
extern void _XtDestroyServerGrabs(
Widget /* w */,
XtPointer /* pwi */, /*XtPerWidgetInput*/
XtPointer /* call_data */
);
extern XtPerWidgetInput _XtGetPerWidgetInput(
Widget /* widget */,
_XtBoolean /* create */
);
extern XtServerGrabPtr _XtCheckServerGrabsOnWidget(
XEvent* /* event */,
Widget /* widget */,
_XtBoolean /* isKeyboard */
);
/*
extern XtGrabList* _XtGetGrabList( XtPerDisplayInput );
*/
#define _XtGetGrabList(pdi) (&(pdi)->grabList)
extern void _XtFreePerWidgetInput(
Widget /* w */,
XtPerWidgetInput /* pwi */
);
extern Widget _XtProcessKeyboardEvent(
XKeyEvent* /* event */,
Widget /* widget */,
XtPerDisplayInput /* pdi */
);
extern Widget _XtProcessPointerEvent(
XButtonEvent* /* event */,
Widget /* widget */,
XtPerDisplayInput /* pdi */
);
extern void _XtRegisterPassiveGrabs(
Widget /* widget */
);
extern void _XtClearAncestorCache(
Widget /* widget */
);
_XFUNCPROTOEND
#endif /* _PDI_h_ */
/************************************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
************************************************************************/
#ifndef _X11_XREGION_H_
#define _X11_XREGION_H_
typedef struct {
short x1, x2, y1, y2;
} Box, BOX, BoxRec, *BoxPtr;
typedef struct {
short x, y, width, height;
}RECTANGLE, RectangleRec, *RectanglePtr;
#define TRUE 1
#define FALSE 0
#define MAXSHORT 32767
#define MINSHORT -MAXSHORT
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
/*
* clip region
*/
typedef struct _XRegion {
long size;
long numRects;
BOX *rects;
BOX extents;
} REGION;
/* Xutil.h contains the declaration:
* typedef struct _XRegion *Region;
*/
/* 1 if two BOXs overlap.
* 0 if two BOXs do not overlap.
* Remember, x2 and y2 are not in the region
*/
#define EXTENTCHECK(r1, r2) \
((r1)->x2 > (r2)->x1 && \
(r1)->x1 < (r2)->x2 && \
(r1)->y2 > (r2)->y1 && \
(r1)->y1 < (r2)->y2)
/*
* update region extents
*/
#define EXTENTS(r,idRect){\
if((r)->x1 < (idRect)->extents.x1)\
(idRect)->extents.x1 = (r)->x1;\
if((r)->y1 < (idRect)->extents.y1)\
(idRect)->extents.y1 = (r)->y1;\
if((r)->x2 > (idRect)->extents.x2)\
(idRect)->extents.x2 = (r)->x2;\
if((r)->y2 > (idRect)->extents.y2)\
(idRect)->extents.y2 = (r)->y2;\
}
/*
* Check to see if there is enough memory in the present region.
*/
#define MEMCHECK(reg, rect, firstrect){\
if ((reg)->numRects >= ((reg)->size - 1)){\
BoxPtr tmpRect = Xrealloc ((firstrect), \
(2 * (sizeof(BOX)) * ((reg)->size))); \
if (tmpRect == NULL) \
return(0);\
(firstrect) = tmpRect; \
(reg)->size *= 2;\
(rect) = &(firstrect)[(reg)->numRects];\
}\
}
/* this routine checks to see if the previous rectangle is the same
* or subsumes the new rectangle to add.
*/
#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
(!(((Reg)->numRects > 0)&&\
((R-1)->y1 == (Ry1)) &&\
((R-1)->y2 == (Ry2)) &&\
((R-1)->x1 <= (Rx1)) &&\
((R-1)->x2 >= (Rx2))))
/* add a rectangle to the given Region */
#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
(r)->x1 = (rx1);\
(r)->y1 = (ry1);\
(r)->x2 = (rx2);\
(r)->y2 = (ry2);\
EXTENTS((r), (reg));\
(reg)->numRects++;\
(r)++;\
}\
}
/* add a rectangle to the given Region */
#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
if ((rx1 < rx2) && (ry1 < ry2) &&\
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
(r)->x1 = (rx1);\
(r)->y1 = (ry1);\
(r)->x2 = (rx2);\
(r)->y2 = (ry2);\
(reg)->numRects++;\
(r)++;\
}\
}
#define EMPTY_REGION(pReg) pReg->numRects = 0
#define REGION_NOT_EMPTY(pReg) pReg->numRects
#define INBOX(r, x, y) \
( ( ((r).x2 > x)) && \
( ((r).x1 <= x)) && \
( ((r).y2 > y)) && \
( ((r).y1 <= y)) )
/*
* number of points to buffer before sending them off
* to scanlines() : Must be an even number
*/
#define NUMPTSTOBUFFER 200
/*
* used to allocate buffers for points and link
* the buffers together
*/
typedef struct _POINTBLOCK {
XPoint pts[NUMPTSTOBUFFER];
struct _POINTBLOCK *next;
} POINTBLOCK;
#endif /* _X11_XREGION_H_ */
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/* default keysyms */
#define XK_MISCELLANY
#define XK_XKB_KEYS
#define XK_LATIN1
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
#define XK_LATIN8
#define XK_LATIN9
#define XK_CAUCASUS
#define XK_GREEK
#define XK_KATAKANA
#define XK_ARABIC
#define XK_CYRILLIC
#define XK_HEBREW
#define XK_THAI
#define XK_KOREAN
#define XK_ARMENIAN
#define XK_GEORGIAN
#define XK_VIETNAMESE
#define XK_CURRENCY
#define XK_MATHEMATICAL
#define XK_BRAILLE
#define XK_SINHALA
#include <X11/keysymdef.h>
/*
* Copyright (C) 1989-95 GROUPE BULL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of GROUPE BULL shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from GROUPE BULL.
*/
/*****************************************************************************\
* xpm.h: *
* *
* XPM library *
* Include file *
* *
* Developed by Arnaud Le Hors *
\*****************************************************************************/
/*
* The code related to FOR_MSW has been added by
* HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
*/
/*
* The code related to AMIGA has been added by
* Lorens Younes (d93-hyo@nada.kth.se) 4/96
*/
#ifndef XPM_h
#define XPM_h
/*
* first some identification numbers:
* the version and revision numbers are determined with the following rule:
* SO Major number = LIB minor version number.
* SO Minor number = LIB sub-minor version number.
* e.g: Xpm version 3.2f
* we forget the 3 which is the format number, 2 gives 2, and f gives 6.
* thus we have XpmVersion = 2 and XpmRevision = 6
* which gives SOXPMLIBREV = 2.6
*
* Then the XpmIncludeVersion number is built from these numbers.
*/
#define XpmFormat 3
#define XpmVersion 4
#define XpmRevision 11
#define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision)
#ifndef XPM_NUMBERS
#ifdef FOR_MSW
# define SYSV /* uses memcpy string.h etc. */
# include <malloc.h>
# include "simx.h" /* defines some X stuff using MSW types */
#define NEED_STRCASECMP /* at least for MSVC++ */
#else /* FOR_MSW */
# ifdef AMIGA
# include "amigax.h"
# else /* not AMIGA */
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif /* not AMIGA */
#endif /* FOR_MSW */
/* let's define Pixel if it is not done yet */
#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
typedef unsigned long Pixel; /* Index into colormap */
# define PIXEL_ALREADY_TYPEDEFED
#endif
/* Return ErrorStatus codes:
* null if full success
* positive if partial success
* negative if failure
*/
#define XpmColorError 1
#define XpmSuccess 0
#define XpmOpenFailed -1
#define XpmFileInvalid -2
#define XpmNoMemory -3
#define XpmColorFailed -4
typedef struct {
char *name; /* Symbolic color name */
char *value; /* Color value */
Pixel pixel; /* Color pixel */
} XpmColorSymbol;
typedef struct {
char *name; /* name of the extension */
unsigned int nlines; /* number of lines in this extension */
char **lines; /* pointer to the extension array of strings */
} XpmExtension;
typedef struct {
char *string; /* characters string */
char *symbolic; /* symbolic name */
char *m_color; /* monochrom default */
char *g4_color; /* 4 level grayscale default */
char *g_color; /* other level grayscale default */
char *c_color; /* color default */
} XpmColor;
typedef struct {
unsigned int width; /* image width */
unsigned int height; /* image height */
unsigned int cpp; /* number of characters per pixel */
unsigned int ncolors; /* number of colors */
XpmColor *colorTable; /* list of related colors */
unsigned int *data; /* image data */
} XpmImage;
typedef struct {
unsigned long valuemask; /* Specifies which attributes are defined */
char *hints_cmt; /* Comment of the hints section */
char *colors_cmt; /* Comment of the colors section */
char *pixels_cmt; /* Comment of the pixels section */
unsigned int x_hotspot; /* Returns the x hotspot's coordinate */
unsigned int y_hotspot; /* Returns the y hotspot's coordinate */
unsigned int nextensions; /* number of extensions */
XpmExtension *extensions; /* pointer to array of extensions */
} XpmInfo;
typedef int (*XpmAllocColorFunc)(
Display* /* display */,
Colormap /* colormap */,
char* /* colorname */,
XColor* /* xcolor */,
void* /* closure */
);
typedef int (*XpmFreeColorsFunc)(
Display* /* display */,
Colormap /* colormap */,
Pixel* /* pixels */,
int /* npixels */,
void* /* closure */
);
typedef struct {
unsigned long valuemask; /* Specifies which attributes are
defined */
Visual *visual; /* Specifies the visual to use */
Colormap colormap; /* Specifies the colormap to use */
unsigned int depth; /* Specifies the depth */
unsigned int width; /* Returns the width of the created
pixmap */
unsigned int height; /* Returns the height of the created
pixmap */
unsigned int x_hotspot; /* Returns the x hotspot's
coordinate */
unsigned int y_hotspot; /* Returns the y hotspot's
coordinate */
unsigned int cpp; /* Specifies the number of char per
pixel */
Pixel *pixels; /* List of used color pixels */
unsigned int npixels; /* Number of used pixels */
XpmColorSymbol *colorsymbols; /* List of color symbols to override */
unsigned int numsymbols; /* Number of symbols */
char *rgb_fname; /* RGB text file name */
unsigned int nextensions; /* Number of extensions */
XpmExtension *extensions; /* List of extensions */
unsigned int ncolors; /* Number of colors */
XpmColor *colorTable; /* List of colors */
/* 3.2 backward compatibility code */
char *hints_cmt; /* Comment of the hints section */
char *colors_cmt; /* Comment of the colors section */
char *pixels_cmt; /* Comment of the pixels section */
/* end 3.2 bc */
unsigned int mask_pixel; /* Color table index of transparent
color */
/* Color Allocation Directives */
Bool exactColors; /* Only use exact colors for visual */
unsigned int closeness; /* Allowable RGB deviation */
unsigned int red_closeness; /* Allowable red deviation */
unsigned int green_closeness; /* Allowable green deviation */
unsigned int blue_closeness; /* Allowable blue deviation */
int color_key; /* Use colors from this color set */
Pixel *alloc_pixels; /* Returns the list of alloc'ed color
pixels */
int nalloc_pixels; /* Returns the number of alloc'ed
color pixels */
Bool alloc_close_colors; /* Specify whether close colors should
be allocated using XAllocColor
or not */
int bitmap_format; /* Specify the format of 1bit depth
images: ZPixmap or XYBitmap */
/* Color functions */
XpmAllocColorFunc alloc_color; /* Application color allocator */
XpmFreeColorsFunc free_colors; /* Application color de-allocator */
void *color_closure; /* Application private data to pass to
alloc_color and free_colors */
} XpmAttributes;
/* XpmAttributes value masks bits */
#define XpmVisual (1L<<0)
#define XpmColormap (1L<<1)
#define XpmDepth (1L<<2)
#define XpmSize (1L<<3) /* width & height */
#define XpmHotspot (1L<<4) /* x_hotspot & y_hotspot */
#define XpmCharsPerPixel (1L<<5)
#define XpmColorSymbols (1L<<6)
#define XpmRgbFilename (1L<<7)
/* 3.2 backward compatibility code */
#define XpmInfos (1L<<8)
#define XpmReturnInfos XpmInfos
/* end 3.2 bc */
#define XpmReturnPixels (1L<<9)
#define XpmExtensions (1L<<10)
#define XpmReturnExtensions XpmExtensions
#define XpmExactColors (1L<<11)
#define XpmCloseness (1L<<12)
#define XpmRGBCloseness (1L<<13)
#define XpmColorKey (1L<<14)
#define XpmColorTable (1L<<15)
#define XpmReturnColorTable XpmColorTable
#define XpmReturnAllocPixels (1L<<16)
#define XpmAllocCloseColors (1L<<17)
#define XpmBitmapFormat (1L<<18)
#define XpmAllocColor (1L<<19)
#define XpmFreeColors (1L<<20)
#define XpmColorClosure (1L<<21)
/* XpmInfo value masks bits */
#define XpmComments XpmInfos
#define XpmReturnComments XpmComments
/* XpmAttributes mask_pixel value when there is no mask */
#ifndef FOR_MSW
#define XpmUndefPixel 0x80000000
#else
/* int is only 16 bit for MSW */
#define XpmUndefPixel 0x8000
#endif
/*
* color keys for visual type, they must fit along with the number key of
* each related element in xpmColorKeys[] defined in XpmI.h
*/
#define XPM_MONO 2
#define XPM_GREY4 3
#define XPM_GRAY4 3
#define XPM_GREY 4
#define XPM_GRAY 4
#define XPM_COLOR 5
/* macros for forward declarations of functions with prototypes */
#define FUNC(f, t, p) extern t f p
#define LFUNC(f, t, p) static t f p
/*
* functions declarations
*/
_XFUNCPROTOBEGIN
/* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */
/* Same for Amiga! */
#if !defined(FOR_MSW) && !defined(AMIGA)
FUNC(XpmCreatePixmapFromData, int, (Display *display,
Drawable d,
char **data,
Pixmap *pixmap_return,
Pixmap *shapemask_return,
XpmAttributes *attributes));
FUNC(XpmCreateDataFromPixmap, int, (Display *display,
char ***data_return,
Pixmap pixmap,
Pixmap shapemask,
XpmAttributes *attributes));
FUNC(XpmReadFileToPixmap, int, (Display *display,
Drawable d,
const char *filename,
Pixmap *pixmap_return,
Pixmap *shapemask_return,
XpmAttributes *attributes));
FUNC(XpmWriteFileFromPixmap, int, (Display *display,
const char *filename,
Pixmap pixmap,
Pixmap shapemask,
XpmAttributes *attributes));
#endif
FUNC(XpmCreateImageFromData, int, (Display *display,
char **data,
XImage **image_return,
XImage **shapemask_return,
XpmAttributes *attributes));
FUNC(XpmCreateDataFromImage, int, (Display *display,
char ***data_return,
XImage *image,
XImage *shapeimage,
XpmAttributes *attributes));
FUNC(XpmReadFileToImage, int, (Display *display,
const char *filename,
XImage **image_return,
XImage **shapeimage_return,
XpmAttributes *attributes));
FUNC(XpmWriteFileFromImage, int, (Display *display,
const char *filename,
XImage *image,
XImage *shapeimage,
XpmAttributes *attributes));
FUNC(XpmCreateImageFromBuffer, int, (Display *display,
char *buffer,
XImage **image_return,
XImage **shapemask_return,
XpmAttributes *attributes));
#if !defined(FOR_MSW) && !defined(AMIGA)
FUNC(XpmCreatePixmapFromBuffer, int, (Display *display,
Drawable d,
char *buffer,
Pixmap *pixmap_return,
Pixmap *shapemask_return,
XpmAttributes *attributes));
FUNC(XpmCreateBufferFromImage, int, (Display *display,
char **buffer_return,
XImage *image,
XImage *shapeimage,
XpmAttributes *attributes));
FUNC(XpmCreateBufferFromPixmap, int, (Display *display,
char **buffer_return,
Pixmap pixmap,
Pixmap shapemask,
XpmAttributes *attributes));
#endif
FUNC(XpmReadFileToBuffer, int, (const char *filename, char **buffer_return));
FUNC(XpmWriteFileFromBuffer, int, (const char *filename, char *buffer));
FUNC(XpmReadFileToData, int, (const char *filename, char ***data_return));
FUNC(XpmWriteFileFromData, int, (const char *filename, char **data));
FUNC(XpmAttributesSize, int, (void));
FUNC(XpmFreeAttributes, void, (XpmAttributes *attributes));
FUNC(XpmFreeExtensions, void, (XpmExtension *extensions,
int nextensions));
FUNC(XpmFreeXpmImage, void, (XpmImage *image));
FUNC(XpmFreeXpmInfo, void, (XpmInfo *info));
FUNC(XpmGetErrorString, char *, (int errcode));
FUNC(XpmLibraryVersion, int, (void));
/* XpmImage functions */
FUNC(XpmReadFileToXpmImage, int, (const char *filename,
XpmImage *image,
XpmInfo *info));
FUNC(XpmWriteFileFromXpmImage, int, (const char *filename,
XpmImage *image,
XpmInfo *info));
#if !defined(FOR_MSW) && !defined(AMIGA)
FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display,
Drawable d,
XpmImage *image,
Pixmap *pixmap_return,
Pixmap *shapemask_return,
XpmAttributes *attributes));
#endif
FUNC(XpmCreateImageFromXpmImage, int, (Display *display,
XpmImage *image,
XImage **image_return,
XImage **shapeimage_return,
XpmAttributes *attributes));
FUNC(XpmCreateXpmImageFromImage, int, (Display *display,
XImage *image,
XImage *shapeimage,
XpmImage *xpmimage,
XpmAttributes *attributes));
#if !defined(FOR_MSW) && !defined(AMIGA)
FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display,
Pixmap pixmap,
Pixmap shapemask,
XpmImage *xpmimage,
XpmAttributes *attributes));
#endif
FUNC(XpmCreateDataFromXpmImage, int, (char ***data_return,
XpmImage *image,
XpmInfo *info));
FUNC(XpmCreateXpmImageFromData, int, (char **data,
XpmImage *image,
XpmInfo *info));
FUNC(XpmCreateXpmImageFromBuffer, int, (char *buffer,
XpmImage *image,
XpmInfo *info));
FUNC(XpmCreateBufferFromXpmImage, int, (char **buffer_return,
XpmImage *image,
XpmInfo *info));
FUNC(XpmGetParseError, int, (char *filename,
int *linenum_return,
int *charnum_return));
FUNC(XpmFree, void, (void *ptr));
_XFUNCPROTOEND
/* backward compatibility */
/* for version 3.0c */
#define XpmPixmapColorError XpmColorError
#define XpmPixmapSuccess XpmSuccess
#define XpmPixmapOpenFailed XpmOpenFailed
#define XpmPixmapFileInvalid XpmFileInvalid
#define XpmPixmapNoMemory XpmNoMemory
#define XpmPixmapColorFailed XpmColorFailed
#define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \
XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
#define XpmWritePixmapFile(dpy, file, pix, mask, att) \
XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
/* for version 3.0b */
#define PixmapColorError XpmColorError
#define PixmapSuccess XpmSuccess
#define PixmapOpenFailed XpmOpenFailed
#define PixmapFileInvalid XpmFileInvalid
#define PixmapNoMemory XpmNoMemory
#define PixmapColorFailed XpmColorFailed
#define ColorSymbol XpmColorSymbol
#define XReadPixmapFile(dpy, d, file, pix, mask, att) \
XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
#define XWritePixmapFile(dpy, file, pix, mask, att) \
XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
#define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \
XpmCreatePixmapFromData(dpy, d, data, pix, mask, att)
#define XCreateDataFromPixmap(dpy, data, pix, mask, att) \
XpmCreateDataFromPixmap(dpy, data, pix, mask, att)
#endif /* XPM_NUMBERS */
#endif
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef XMD_H
# define XMD_H 1
/*
* Xmd.h: MACHINE DEPENDENT DECLARATIONS.
*/
/*
* Special per-machine configuration flags.
*/
# if defined(__sun) && defined(__SVR4)
# include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */
# endif
# if defined (_LP64) || defined(__LP64__) || \
defined(__alpha) || defined(__alpha__) || \
defined(__ia64__) || defined(ia64) || \
defined(__sparc64__) || \
defined(__s390x__) || \
defined(__amd64__) || defined(amd64) || \
defined(__powerpc64__)
# if !defined(__ILP32__) /* amd64-x32 is 32bit */
# define LONG64 /* 32/64-bit architecture */
# endif /* !__ILP32__ */
# endif
/*
* Definition of macro used to set constants for size of network structures;
* machines with preprocessors that can't handle all of the sz_ symbols
* can define this macro to be sizeof(x) if and only if their compiler doesn't
* pad out structures (esp. the xTextElt structure which contains only two
* one-byte fields). Network structures should always define sz_symbols.
*
* The sz_ prefix is used instead of something more descriptive so that the
* symbols are no more than 32 characters long (which causes problems for some
* compilers and preprocessors).
*
* The extra indirection is to get macro arguments to expand correctly before
* the concatenation, rather than afterward.
*/
# define _SIZEOF(x) sz_##x
# define SIZEOF(x) _SIZEOF(x)
/*
* Bitfield suffixes for the protocol structure elements, if you
* need them. Note that bitfields are not guaranteed to be signed
* (or even unsigned) according to ANSI C.
*/
# define B32 /* bitfield not needed on architectures with native 32-bit type */
# define B16 /* bitfield not needed on architectures with native 16-bit type */
# ifdef LONG64
typedef long INT64;
typedef int INT32;
# else
typedef long INT32;
# endif
typedef short INT16;
typedef signed char INT8;
# ifdef LONG64
typedef unsigned long CARD64;
typedef unsigned int CARD32;
# else
typedef unsigned long long CARD64;
typedef unsigned long CARD32;
# endif
typedef unsigned short CARD16;
typedef unsigned char CARD8;
typedef CARD32 BITS32;
typedef CARD16 BITS16;
typedef CARD8 BYTE;
typedef CARD8 BOOL;
/*
* was definitions for sign-extending bitfields on architectures without
* native types smaller than 64-bit, now just backwards compatibility
*/
# define cvtINT8toInt(val) (val)
# define cvtINT16toInt(val) (val)
# define cvtINT32toInt(val) (val)
# define cvtINT8toShort(val) (val)
# define cvtINT16toShort(val) (val)
# define cvtINT32toShort(val) (val)
# define cvtINT8toLong(val) (val)
# define cvtINT16toLong(val) (val)
# define cvtINT32toLong(val) (val)
/*
* this version should leave result of type (t *), but that should only be
* used when not in MUSTCOPY
*/
# define NEXTPTR(p,t) (((t *)(p)) + 1)
#endif /* XMD_H */
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _X11_XUTIL_H_
#define _X11_XUTIL_H_
/* You must include <X11/Xlib.h> before including this file */
#include <X11/Xlib.h>
#include <X11/keysym.h>
/* The Xlib structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
/*
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string.
*/
#define NoValue 0x0000
#define XValue 0x0001
#define YValue 0x0002
#define WidthValue 0x0004
#define HeightValue 0x0008
#define AllValues 0x000F
#define XNegative 0x0010
#define YNegative 0x0020
/*
* new version containing base_width, base_height, and win_gravity fields;
* used with WM_NORMAL_HINTS.
*/
typedef struct {
long flags; /* marks which fields in this structure are defined */
int x, y; /* obsolete for new window mgrs, but clients */
int width, height; /* should set so old wm's don't mess up */
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct {
int x; /* numerator */
int y; /* denominator */
} min_aspect, max_aspect;
int base_width, base_height; /* added by ICCCM version 1 */
int win_gravity; /* added by ICCCM version 1 */
} XSizeHints;
/*
* The next block of definitions are for window manager properties that
* clients and applications use for communication.
*/
/* flags argument in size hints */
#define USPosition (1L << 0) /* user specified x, y */
#define USSize (1L << 1) /* user specified width, height */
#define PPosition (1L << 2) /* program specified position */
#define PSize (1L << 3) /* program specified size */
#define PMinSize (1L << 4) /* program specified minimum size */
#define PMaxSize (1L << 5) /* program specified maximum size */
#define PResizeInc (1L << 6) /* program specified resize increments */
#define PAspect (1L << 7) /* program specified min and max aspect ratios */
#define PBaseSize (1L << 8) /* program specified base for incrementing */
#define PWinGravity (1L << 9) /* program specified window gravity */
/* obsolete */
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
typedef struct {
long flags; /* marks which fields in this structure are defined */
Bool input; /* does this application rely on the window manager to
get keyboard input? */
int initial_state; /* see below */
Pixmap icon_pixmap; /* pixmap to be used as icon */
Window icon_window; /* window to be used as icon */
int icon_x, icon_y; /* initial position of icon */
Pixmap icon_mask; /* icon mask bitmap */
XID window_group; /* id of related window group */
/* this structure may be extended in the future */
} XWMHints;
/* definition for flags of XWMHints */
#define InputHint (1L << 0)
#define StateHint (1L << 1)
#define IconPixmapHint (1L << 2)
#define IconWindowHint (1L << 3)
#define IconPositionHint (1L << 4)
#define IconMaskHint (1L << 5)
#define WindowGroupHint (1L << 6)
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
IconPositionHint|IconMaskHint|WindowGroupHint)
#define XUrgencyHint (1L << 8)
/* definitions for initial window state */
#define WithdrawnState 0 /* for windows that are not mapped */
#define NormalState 1 /* most applications want to start this way */
#define IconicState 3 /* application wants to start as an icon */
/*
* Obsolete states no longer defined by ICCCM
*/
#define DontCareState 0 /* don't know or care */
#define ZoomState 2 /* application wants to start zoomed */
#define InactiveState 4 /* application believes it is seldom used; */
/* some wm's may put it on inactive menu */
/*
* new structure for manipulating TEXT properties; used with WM_NAME,
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
*/
typedef struct {
unsigned char *value; /* same as Property routines */
Atom encoding; /* prop type */
int format; /* prop data format: 8, 16, or 32 */
unsigned long nitems; /* number of data items in value */
} XTextProperty;
#define XNoMemory -1
#define XLocaleNotSupported -2
#define XConverterNotFound -3
typedef enum {
XStringStyle, /* STRING */
XCompoundTextStyle, /* COMPOUND_TEXT */
XTextStyle, /* text in owner's encoding (current locale)*/
XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
/* The following is an XFree86 extension, introduced in November 2000 */
XUTF8StringStyle /* UTF8_STRING */
} XICCEncodingStyle;
typedef struct {
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
} XIconSize;
typedef struct {
char *res_name;
char *res_class;
} XClassHint;
#ifdef XUTIL_DEFINE_FUNCTIONS
extern int XDestroyImage(
XImage *ximage);
extern unsigned long XGetPixel(
XImage *ximage,
int x, int y);
extern int XPutPixel(
XImage *ximage,
int x, int y,
unsigned long pixel);
extern XImage *XSubImage(
XImage *ximage,
int x, int y,
unsigned int width, unsigned int height);
extern int XAddPixel(
XImage *ximage,
long value);
#else
/*
* These macros are used to give some sugar to the image routines so that
* naive people are more comfortable with them.
*/
#define XDestroyImage(ximage) \
((*((ximage)->f.destroy_image))((ximage)))
#define XGetPixel(ximage, x, y) \
((*((ximage)->f.get_pixel))((ximage), (x), (y)))
#define XPutPixel(ximage, x, y, pixel) \
((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
#define XSubImage(ximage, x, y, width, height) \
((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
#define XAddPixel(ximage, value) \
((*((ximage)->f.add_pixel))((ximage), (value)))
#endif
/*
* Compose sequence status structure, used in calling XLookupString.
*/
typedef struct _XComposeStatus {
XPointer compose_ptr; /* state table pointer */
int chars_matched; /* match state */
} XComposeStatus;
/*
* Keysym macros, used on Keysyms to test for classes of symbols
*/
#define IsKeypadKey(keysym) \
(((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
#define IsPrivateKeypadKey(keysym) \
(((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
#define IsCursorKey(keysym) \
(((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
#define IsPFKey(keysym) \
(((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
#define IsFunctionKey(keysym) \
(((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
#define IsMiscFunctionKey(keysym) \
(((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
#ifdef XK_XKB_KEYS
#define IsModifierKey(keysym) \
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
|| (((KeySym)(keysym) >= XK_ISO_Lock) && \
((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
|| ((KeySym)(keysym) == XK_Mode_switch) \
|| ((KeySym)(keysym) == XK_Num_Lock))
#else
#define IsModifierKey(keysym) \
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
|| ((KeySym)(keysym) == XK_Mode_switch) \
|| ((KeySym)(keysym) == XK_Num_Lock))
#endif
/*
* opaque reference to Region data type
*/
typedef struct _XRegion *Region;
/* Return values from XRectInRegion() */
#define RectangleOut 0
#define RectangleIn 1
#define RectanglePart 2
/*
* Information used by the visual utility routines to find desired visual
* type from the many visuals a display may support.
*/
typedef struct {
Visual *visual;
VisualID visualid;
int screen;
int depth;
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ */
#else
int class;
#endif
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
int colormap_size;
int bits_per_rgb;
} XVisualInfo;
#define VisualNoMask 0x0
#define VisualIDMask 0x1
#define VisualScreenMask 0x2
#define VisualDepthMask 0x4
#define VisualClassMask 0x8
#define VisualRedMaskMask 0x10
#define VisualGreenMaskMask 0x20
#define VisualBlueMaskMask 0x40
#define VisualColormapSizeMask 0x80
#define VisualBitsPerRGBMask 0x100
#define VisualAllMask 0x1FF
/*
* This defines a window manager property that clients may use to
* share standard color maps of type RGB_COLOR_MAP:
*/
typedef struct {
Colormap colormap;
unsigned long red_max;
unsigned long red_mult;
unsigned long green_max;
unsigned long green_mult;
unsigned long blue_max;
unsigned long blue_mult;
unsigned long base_pixel;
VisualID visualid; /* added by ICCCM version 1 */
XID killid; /* added by ICCCM version 1 */
} XStandardColormap;
#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
/*
* return codes for XReadBitmapFile and XWriteBitmapFile
*/
#define BitmapSuccess 0
#define BitmapOpenFailed 1
#define BitmapFileInvalid 2
#define BitmapNoMemory 3
/****************************************************************
*
* Context Management
*
****************************************************************/
/* Associative lookup table return codes */
#define XCSUCCESS 0 /* No error. */
#define XCNOMEM 1 /* Out of memory */
#define XCNOENT 2 /* No entry in table */
typedef int XContext;
#define XUniqueContext() ((XContext) XrmUniqueQuark())
#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
_XFUNCPROTOBEGIN
/* The following declarations are alphabetized. */
extern XClassHint *XAllocClassHint (
void
);
extern XIconSize *XAllocIconSize (
void
);
extern XSizeHints *XAllocSizeHints (
void
);
extern XStandardColormap *XAllocStandardColormap (
void
);
extern XWMHints *XAllocWMHints (
void
);
extern int XClipBox(
Region /* r */,
XRectangle* /* rect_return */
);
extern Region XCreateRegion(
void
);
extern const char *XDefaultString (void);
extern int XDeleteContext(
Display* /* display */,
XID /* rid */,
XContext /* context */
);
extern int XDestroyRegion(
Region /* r */
);
extern int XEmptyRegion(
Region /* r */
);
extern int XEqualRegion(
Region /* r1 */,
Region /* r2 */
);
extern int XFindContext(
Display* /* display */,
XID /* rid */,
XContext /* context */,
XPointer* /* data_return */
);
extern Status XGetClassHint(
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints_return */
);
extern Status XGetIconSizes(
Display* /* display */,
Window /* w */,
XIconSize** /* size_list_return */,
int* /* count_return */
);
extern Status XGetNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */
);
extern Status XGetRGBColormaps(
Display* /* display */,
Window /* w */,
XStandardColormap** /* stdcmap_return */,
int* /* count_return */,
Atom /* property */
);
extern Status XGetSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
Atom /* property */
);
extern Status XGetStandardColormap(
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap_return */,
Atom /* property */
);
extern Status XGetTextProperty(
Display* /* display */,
Window /* window */,
XTextProperty* /* text_prop_return */,
Atom /* property */
);
extern XVisualInfo *XGetVisualInfo(
Display* /* display */,
long /* vinfo_mask */,
XVisualInfo* /* vinfo_template */,
int* /* nitems_return */
);
extern Status XGetWMClientMachine(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
);
extern XWMHints *XGetWMHints(
Display* /* display */,
Window /* w */
);
extern Status XGetWMIconName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
);
extern Status XGetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
);
extern Status XGetWMNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */
);
extern Status XGetWMSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */,
Atom /* property */
);
extern Status XGetZoomHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints_return */
);
extern int XIntersectRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
extern void XConvertCase(
KeySym /* sym */,
KeySym* /* lower */,
KeySym* /* upper */
);
extern int XLookupString(
XKeyEvent* /* event_struct */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
XComposeStatus* /* status_in_out */
);
extern Status XMatchVisualInfo(
Display* /* display */,
int /* screen */,
int /* depth */,
int /* class */,
XVisualInfo* /* vinfo_return */
);
extern int XOffsetRegion(
Region /* r */,
int /* dx */,
int /* dy */
);
extern Bool XPointInRegion(
Region /* r */,
int /* x */,
int /* y */
);
extern Region XPolygonRegion(
XPoint* /* points */,
int /* n */,
int /* fill_rule */
);
extern int XRectInRegion(
Region /* r */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XSaveContext(
Display* /* display */,
XID /* rid */,
XContext /* context */,
_Xconst char* /* data */
);
extern int XSetClassHint(
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints */
);
extern int XSetIconSizes(
Display* /* display */,
Window /* w */,
XIconSize* /* size_list */,
int /* count */
);
extern int XSetNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
);
extern void XSetRGBColormaps(
Display* /* display */,
Window /* w */,
XStandardColormap* /* stdcmaps */,
int /* count */,
Atom /* property */
);
extern int XSetSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
);
extern int XSetStandardProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
Pixmap /* icon_pixmap */,
char** /* argv */,
int /* argc */,
XSizeHints* /* hints */
);
extern void XSetTextProperty(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */,
Atom /* property */
);
extern void XSetWMClientMachine(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
extern int XSetWMHints(
Display* /* display */,
Window /* w */,
XWMHints* /* wm_hints */
);
extern void XSetWMIconName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
extern void XSetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
extern void XSetWMNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
);
extern void XSetWMProperties(
Display* /* display */,
Window /* w */,
XTextProperty* /* window_name */,
XTextProperty* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
);
extern void XmbSetWMProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
);
extern void Xutf8SetWMProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
);
extern void XSetWMSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
);
extern int XSetRegion(
Display* /* display */,
GC /* gc */,
Region /* r */
);
extern void XSetStandardColormap(
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap */,
Atom /* property */
);
extern int XSetZoomHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints */
);
extern int XShrinkRegion(
Region /* r */,
int /* dx */,
int /* dy */
);
extern Status XStringListToTextProperty(
char** /* list */,
int /* count */,
XTextProperty* /* text_prop_return */
);
extern int XSubtractRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
extern int XmbTextListToTextProperty(
Display* display,
char** list,
int count,
XICCEncodingStyle style,
XTextProperty* text_prop_return
);
extern int XwcTextListToTextProperty(
Display* display,
wchar_t** list,
int count,
XICCEncodingStyle style,
XTextProperty* text_prop_return
);
extern int Xutf8TextListToTextProperty(
Display* display,
char** list,
int count,
XICCEncodingStyle style,
XTextProperty* text_prop_return
);
extern void XwcFreeStringList(
wchar_t** list
);
extern Status XTextPropertyToStringList(
XTextProperty* /* text_prop */,
char*** /* list_return */,
int* /* count_return */
);
extern int XmbTextPropertyToTextList(
Display* display,
const XTextProperty* text_prop,
char*** list_return,
int* count_return
);
extern int XwcTextPropertyToTextList(
Display* display,
const XTextProperty* text_prop,
wchar_t*** list_return,
int* count_return
);
extern int Xutf8TextPropertyToTextList(
Display* display,
const XTextProperty* text_prop,
char*** list_return,
int* count_return
);
extern int XUnionRectWithRegion(
XRectangle* /* rectangle */,
Region /* src_region */,
Region /* dest_region_return */
);
extern int XUnionRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
extern int XWMGeometry(
Display* /* display */,
int /* screen_number */,
_Xconst char* /* user_geometry */,
_Xconst char* /* default_geometry */,
unsigned int /* border_width */,
XSizeHints* /* hints */,
int* /* x_return */,
int* /* y_return */,
int* /* width_return */,
int* /* height_return */,
int* /* gravity_return */
);
extern int XXorRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
_XFUNCPROTOEND
#endif /* _X11_XUTIL_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtComposite_h
#define _XtComposite_h
typedef struct _CompositeClassRec *CompositeWidgetClass;
typedef Cardinal (*XtOrderProc)(
Widget /* child */
);
_XFUNCPROTOBEGIN
extern void XtManageChildren(
WidgetList /* children */,
Cardinal /* num_children */
);
extern void XtManageChild(
Widget /* child */
);
extern void XtUnmanageChildren(
WidgetList /* children */,
Cardinal /* num_children */
);
extern void XtUnmanageChild(
Widget /* child */
);
typedef void (*XtDoChangeProc)(
Widget /* composite_parent */,
WidgetList /* unmanage_children */,
Cardinal * /* num_unmanage_children */,
WidgetList /* manage_children */,
Cardinal * /* num_manage_children */,
XtPointer /* client_data */
);
extern void XtChangeManagedSet(
WidgetList /* unmanage_children */,
Cardinal /* num_unmanage_children */,
XtDoChangeProc /* do_change_proc */,
XtPointer /* client_data */,
WidgetList /* manage_children */,
Cardinal /* num_manage_children */
);
_XFUNCPROTOEND
#ifndef VMS
externalref WidgetClass compositeWidgetClass;
#endif
#endif /* _XtComposite_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _Xt_RectObjP_h_
#define _Xt_RectObjP_h_
#include <X11/RectObj.h>
#include <X11/ObjectP.h>
_XFUNCPROTOBEGIN
/**********************************************************
* Rectangle Object Instance Data Structures
*
**********************************************************/
/* these fields match CorePart and can not be changed */
typedef struct _RectObjPart {
Position x, y; /* rectangle position */
Dimension width, height; /* rectangle dimensions */
Dimension border_width; /* rectangle border width */
Boolean managed; /* is widget geometry managed? */
Boolean sensitive; /* is widget sensitive to user events*/
Boolean ancestor_sensitive; /* are all ancestors sensitive? */
}RectObjPart;
typedef struct _RectObjRec {
ObjectPart object;
RectObjPart rectangle;
} RectObjRec;
/********************************************************
* Rectangle Object Class Data Structures
*
********************************************************/
/* these fields match CoreClassPart and can not be changed */
/* ideally these structures would only contain the fields required;
but because the CoreClassPart cannot be changed at this late date
extraneous fields are necessary to make the field offsets match */
typedef struct _RectObjClassPart {
WidgetClass superclass; /* pointer to superclass ClassRec */
String class_name; /* widget resource class name */
Cardinal widget_size; /* size in bytes of widget record */
XtProc class_initialize; /* class initialization proc */
XtWidgetClassProc class_part_initialize; /* dynamic initialization */
XtEnum class_inited; /* has class been initialized? */
XtInitProc initialize; /* initialize subclass fields */
XtArgsProc initialize_hook; /* notify that initialize called */
XtProc rect1; /* NULL */
XtPointer rect2; /* NULL */
Cardinal rect3; /* NULL */
XtResourceList resources; /* resources for subclass fields */
Cardinal num_resources; /* number of entries in resources */
XrmClass xrm_class; /* resource class quarkified */
Boolean rect4; /* NULL */
XtEnum rect5; /* NULL */
Boolean rect6; /* NULL */
Boolean rect7; /* NULL */
XtWidgetProc destroy; /* free data for subclass pointers */
XtWidgetProc resize; /* geom manager changed widget size */
XtExposeProc expose; /* rediplay rectangle */
XtSetValuesFunc set_values; /* set subclass resource values */
XtArgsFunc set_values_hook; /* notify that set_values called */
XtAlmostProc set_values_almost; /* set values almost for geometry */
XtArgsProc get_values_hook; /* notify that get_values called */
XtProc rect9; /* NULL */
XtVersionType version; /* version of intrinsics used */
XtPointer callback_private; /* list of callback offsets */
String rect10; /* NULL */
XtGeometryHandler query_geometry; /* return preferred geometry */
XtProc rect11; /* NULL */
XtPointer extension; /* pointer to extension record */
} RectObjClassPart;
typedef struct _RectObjClassRec {
RectObjClassPart rect_class;
} RectObjClassRec;
externalref RectObjClassRec rectObjClassRec;
_XFUNCPROTOEND
#endif /*_Xt_RectObjP_h_*/
/*
*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
* The X Window System is a Trademark of The Open Group.
*
*/
/* This is a collection of things to try and minimize system dependencies
* in a "significant" number of source files.
*/
#ifndef _XOS_H_
# define _XOS_H_
# include <X11/Xosdefs.h>
/*
* Get major data types (esp. caddr_t)
*/
# include <sys/types.h>
# if defined(__SCO__) || defined(__UNIXWARE__)
# include <stdint.h>
# endif
/*
* Just about everyone needs the strings routines. We provide both forms here,
* index/rindex and strchr/strrchr, so any systems that don't provide them all
* need to have #defines here.
*
* These macros are defined this way, rather than, e.g.:
* #defined index(s,c) strchr(s,c)
* because someone might be using them as function pointers, and such
* a change would break compatibility for anyone who's relying on them
* being the way they currently are. So we're stuck with them this way,
* which can be really inconvenient. :-(
*/
# include <string.h>
# if defined(__SCO__) || defined(__UNIXWARE__) || defined(__sun) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__)
# include <strings.h>
# else
# ifndef index
# define index(s,c) (strchr((s),(c)))
# endif
# ifndef rindex
# define rindex(s,c) (strrchr((s),(c)))
# endif
# endif
/*
* Get open(2) constants
*/
# if defined(X_NOT_POSIX)
# include <fcntl.h>
# if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4))
# include <unistd.h>
# endif
# ifdef WIN32
# include <X11/Xw32defs.h>
# else
# include <sys/file.h>
# endif
# else /* X_NOT_POSIX */
# include <fcntl.h>
# include <unistd.h>
# endif /* X_NOT_POSIX else */
/*
* Get struct timeval and struct tm
*/
# if defined(_POSIX_SOURCE) && defined(SVR4)
/* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
# undef _POSIX_SOURCE
# include <sys/time.h>
# define _POSIX_SOURCE
# elif defined(WIN32)
# include <time.h>
# if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL)
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
# define _TIMEVAL_DEFINED
# endif
# include <sys/timeb.h>
# define gettimeofday(t) \
{ \
struct _timeb _gtodtmp; \
_ftime (&_gtodtmp); \
(t)->tv_sec = _gtodtmp.time; \
(t)->tv_usec = _gtodtmp.millitm * 1000; \
}
# else
# include <sys/time.h>
# include <time.h>
# endif /* defined(_POSIX_SOURCE) && defined(SVR4) */
/* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
# if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */
# define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
# else
# if defined(SVR4) || defined(__SVR4) || defined(WIN32)
# define X_GETTIMEOFDAY(t) gettimeofday(t)
# else
# define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
# endif
# endif /* XPG4 else */
# ifdef __GNU__
# define PATH_MAX 4096
# define MAXPATHLEN 4096
# define OPEN_MAX 256 /* We define a reasonable limit. */
# endif
/* use POSIX name for signal */
# if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD)
# define SIGCHLD SIGCLD
# endif
# include <X11/Xarch.h>
#endif /* _XOS_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization from
The Open Group.
*/
/*
* This header file has for sole purpose to allow to include winsock.h
* without getting any name conflicts with our code.
* Conflicts come from the fact that including winsock.h actually pulls
* in the whole Windows API...
*/
#undef _XFree86Server
#ifdef XFree86Server
# define _XFree86Server
# undef XFree86Server
#endif
/*
* mingw-w64 headers define BOOL as a typedef, protecting against macros
* mingw.org headers define BOOL in terms of WINBOOL
* ... so try to come up with something which works with both :-)
*/
#define _NO_BOOL_TYPEDEF
#define BOOL WINBOOL
#define INT32 wINT32
#undef Status
#define Status wStatus
#define ATOM wATOM
#define BYTE wBYTE
#define FreeResource wFreeResource
#include <winsock2.h>
#undef Status
#define Status int
#undef BYTE
#undef BOOL
#undef INT32
#undef ATOM
#undef FreeResource
#undef CreateWindowA
#undef RT_FONT
#undef RT_CURSOR
/*
* Older version of this header used to name the windows API bool type wBOOL,
* rather than more standard name WINBOOL
*/
#define wBOOL WINBOOL
#ifdef _XFree86Server
# define XFree86Server
# undef _XFree86Server
#endif
/******************************************************************
Copyright 1987 by Apollo Computer Inc., Chelmsford, Massachusetts.
Copyright 1989 by Hewlett-Packard Company.
All Rights Reserved
Permission to use, duplicate, change, and distribute this software and
its documentation for any purpose and without fee is granted, provided
that the above copyright notice appear in such copy and that this
copyright notice appear in all supporting documentation, and that the
names of Apollo Computer Inc., the Hewlett-Packard Company, or the X
Consortium not be used in advertising or publicity pertaining to
distribution of the software without written prior permission.
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. Hewlett-Packard shall not be liable for errors
contained herein or direct, indirect, special, incidental or
consequential damages in connection with the furnishing,
performance, or use of this material.
This software is not subject to any license of the American
Telephone and Telegraph Company or of the Regents of the
University of California.
******************************************************************/
#define apXK_LineDel 0x1000FF00
#define apXK_CharDel 0x1000FF01
#define apXK_Copy 0x1000FF02
#define apXK_Cut 0x1000FF03
#define apXK_Paste 0x1000FF04
#define apXK_Move 0x1000FF05
#define apXK_Grow 0x1000FF06
#define apXK_Cmd 0x1000FF07
#define apXK_Shell 0x1000FF08
#define apXK_LeftBar 0x1000FF09
#define apXK_RightBar 0x1000FF0A
#define apXK_LeftBox 0x1000FF0B
#define apXK_RightBox 0x1000FF0C
#define apXK_UpBox 0x1000FF0D
#define apXK_DownBox 0x1000FF0E
#define apXK_Pop 0x1000FF0F
#define apXK_Read 0x1000FF10
#define apXK_Edit 0x1000FF11
#define apXK_Save 0x1000FF12
#define apXK_Exit 0x1000FF13
#define apXK_Repeat 0x1000FF14
#define apXK_KP_parenleft 0x1000FFA8
#define apXK_KP_parenright 0x1000FFA9
#ifndef _X11_IMUTIL_H_
#define _X11_IMUTIL_H_
extern int
_XGetScanlinePad(
Display *dpy,
int depth);
extern int
_XGetBitsPerPixel(
Display *dpy,
int depth);
extern int
_XSetImage(
XImage *srcimg,
register XImage *dstimg,
register int x,
register int y);
extern int
_XReverse_Bytes(
register unsigned char *bpt,
register int nb);
extern void
_XInitImageFuncPtrs(
register XImage *image);
#endif /* _X11_IMUTIL_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* VendorP.h - Private definitions for VendorShell widget
*
* Author: Paul Asente
* Digital Equipment Corporation
* Western Software Laboratory
* Date: Thu Dec 3, 1987
*/
/***********************************************************************
*
* VendorShell Widget Private Data
*
***********************************************************************/
#ifndef _XtVendorPrivate_h
#define _XtVendorPrivate_h
#include <X11/Vendor.h>
/* New fields for the VendorShell widget class record */
_XFUNCPROTOBEGIN
typedef struct {
XtPointer extension; /* pointer to extension record */
} VendorShellClassPart;
typedef struct _VendorShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
WMShellClassPart wm_shell_class;
VendorShellClassPart vendor_shell_class;
} VendorShellClassRec;
externalref VendorShellClassRec vendorShellClassRec;
/* New fields for the vendor shell widget. */
typedef struct {
int vendor_specific;
} VendorShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
WMShellPart wm;
VendorShellPart vendor;
} VendorShellRec, *VendorShellWidget;
_XFUNCPROTOEND
#endif /* _XtVendorPrivate_h */
/*
*
Copyright 1990, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
*/
#ifndef _XFUNCS_H_
# define _XFUNCS_H_
# include <X11/Xosdefs.h>
/* the old Xfuncs.h, for pre-R6 */
# if !(defined(XFree86LOADER) && defined(IN_MODULE))
# ifdef X_USEBFUNCS
void bcopy();
void bzero();
int bcmp();
# else
# if defined(SYSV) && !defined(__SCO__) && !defined(__sun) && !defined(__UNIXWARE__) && !defined(_AIX)
# include <memory.h>
void bcopy();
# define bzero(b,len) memset(b, 0, len)
# define bcmp(b1,b2,len) memcmp(b1, b2, len)
# else
# include <string.h>
# if defined(__SCO__) || defined(__sun) || defined(__UNIXWARE__) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__)
# include <strings.h>
# endif
# define _XFUNCS_H_INCLUDED_STRING_H
# endif
# endif /* X_USEBFUNCS */
/* the new Xfuncs.h */
/* the ANSI C way */
# ifndef _XFUNCS_H_INCLUDED_STRING_H
# include <string.h>
# endif
# undef bzero
# define bzero(b,len) memset(b,0,len)
# if defined WIN32 && defined __MINGW32__
# define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len))
# endif
# endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */
#endif /* _XFUNCS_H_ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/**
* \file xf86dri.h
* Protocol numbers and function prototypes for DRI X protocol.
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Jens Owen <jens@tungstengraphics.com>
* \author Rickard E. (Rik) Faith <faith@valinux.com>
*/
#ifndef _XF86DRI_H_
#define _XF86DRI_H_
#include <xf86drm.h>
#define X_XF86DRIQueryVersion 0
#define X_XF86DRIQueryDirectRenderingCapable 1
#define X_XF86DRIOpenConnection 2
#define X_XF86DRICloseConnection 3
#define X_XF86DRIGetClientDriverName 4
#define X_XF86DRICreateContext 5
#define X_XF86DRIDestroyContext 6
#define X_XF86DRICreateDrawable 7
#define X_XF86DRIDestroyDrawable 8
#define X_XF86DRIGetDrawableInfo 9
#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
#define X_XF86DRICloseFullScreen 13 /* Deprecated */
#define XF86DRINumberEvents 0
#define XF86DRIClientNotLocal 0
#define XF86DRIOperationNotSupported 1
#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
#endif /* _XF86DRI_H_ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Jens Owen <jens@tungstengraphics.com>
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#ifndef _XF86DRISTR_H_
#define _XF86DRISTR_H_
#include "xf86dri.h"
#define XF86DRINAME "XFree86-DRI"
/* The DRI version number. This was originally set to be the same of the
* XFree86 version number. However, this version is really independent of
* the XFree86 version.
*
* Version History:
* 4.0.0: Original
* 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
* 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
*/
#define XF86DRI_MAJOR_VERSION 4
#define XF86DRI_MINOR_VERSION 1
#define XF86DRI_PATCH_VERSION 0
typedef struct _XF86DRIQueryVersion {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIQueryVersion */
CARD16 length;
} xXF86DRIQueryVersionReq;
#define sz_xXF86DRIQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of DRI protocol */
CARD16 minorVersion; /* minor version of DRI protocol */
CARD32 patchVersion; /* patch version of DRI protocol */
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86DRIQueryVersionReply;
#define sz_xXF86DRIQueryVersionReply 32
typedef struct _XF86DRIQueryDirectRenderingCapable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
CARD16 length;
CARD32 screen;
} xXF86DRIQueryDirectRenderingCapableReq;
#define sz_xXF86DRIQueryDirectRenderingCapableReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
BOOL isCapable;
BOOL pad2;
BOOL pad3;
BOOL pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
CARD32 pad8;
CARD32 pad9;
} xXF86DRIQueryDirectRenderingCapableReply;
#define sz_xXF86DRIQueryDirectRenderingCapableReply 32
typedef struct _XF86DRIOpenConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIOpenConnection */
CARD16 length;
CARD32 screen;
} xXF86DRIOpenConnectionReq;
#define sz_xXF86DRIOpenConnectionReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 hSAREALow;
CARD32 hSAREAHigh;
CARD32 busIdStringLength;
CARD32 pad6;
CARD32 pad7;
CARD32 pad8;
} xXF86DRIOpenConnectionReply;
#define sz_xXF86DRIOpenConnectionReply 32
typedef struct _XF86DRIAuthConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseConnection */
CARD16 length;
CARD32 screen;
CARD32 magic;
} xXF86DRIAuthConnectionReq;
#define sz_xXF86DRIAuthConnectionReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 authenticated;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86DRIAuthConnectionReply;
#define zx_xXF86DRIAuthConnectionReply 32
typedef struct _XF86DRICloseConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseConnection */
CARD16 length;
CARD32 screen;
} xXF86DRICloseConnectionReq;
#define sz_xXF86DRICloseConnectionReq 8
typedef struct _XF86DRIGetClientDriverName {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIGetClientDriverName */
CARD16 length;
CARD32 screen;
} xXF86DRIGetClientDriverNameReq;
#define sz_xXF86DRIGetClientDriverNameReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 ddxDriverMajorVersion;
CARD32 ddxDriverMinorVersion;
CARD32 ddxDriverPatchVersion;
CARD32 clientDriverNameLength;
CARD32 pad5;
CARD32 pad6;
} xXF86DRIGetClientDriverNameReply;
#define sz_xXF86DRIGetClientDriverNameReply 32
typedef struct _XF86DRICreateContext {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICreateContext */
CARD16 length;
CARD32 screen;
CARD32 visual;
CARD32 context;
} xXF86DRICreateContextReq;
#define sz_xXF86DRICreateContextReq 16
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 hHWContext;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86DRICreateContextReply;
#define sz_xXF86DRICreateContextReply 32
typedef struct _XF86DRIDestroyContext {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIDestroyContext */
CARD16 length;
CARD32 screen;
CARD32 context;
} xXF86DRIDestroyContextReq;
#define sz_xXF86DRIDestroyContextReq 12
typedef struct _XF86DRICreateDrawable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICreateDrawable */
CARD16 length;
CARD32 screen;
CARD32 drawable;
} xXF86DRICreateDrawableReq;
#define sz_xXF86DRICreateDrawableReq 12
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 hHWDrawable;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86DRICreateDrawableReply;
#define sz_xXF86DRICreateDrawableReply 32
typedef struct _XF86DRIDestroyDrawable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIDestroyDrawable */
CARD16 length;
CARD32 screen;
CARD32 drawable;
} xXF86DRIDestroyDrawableReq;
#define sz_xXF86DRIDestroyDrawableReq 12
typedef struct _XF86DRIGetDrawableInfo {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIGetDrawableInfo */
CARD16 length;
CARD32 screen;
CARD32 drawable;
} xXF86DRIGetDrawableInfoReq;
#define sz_xXF86DRIGetDrawableInfoReq 12
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 drawableTableIndex;
CARD32 drawableTableStamp;
INT16 drawableX;
INT16 drawableY;
INT16 drawableWidth;
INT16 drawableHeight;
CARD32 numClipRects;
INT16 backX;
INT16 backY;
CARD32 numBackClipRects;
} xXF86DRIGetDrawableInfoReply;
#define sz_xXF86DRIGetDrawableInfoReply 36
typedef struct _XF86DRIGetDeviceInfo {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIGetDeviceInfo */
CARD16 length;
CARD32 screen;
} xXF86DRIGetDeviceInfoReq;
#define sz_xXF86DRIGetDeviceInfoReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 hFrameBufferLow;
CARD32 hFrameBufferHigh;
CARD32 framebufferOrigin;
CARD32 framebufferSize;
CARD32 framebufferStride;
CARD32 devPrivateSize;
} xXF86DRIGetDeviceInfoReply;
#define sz_xXF86DRIGetDeviceInfoReply 32
typedef struct _XF86DRIOpenFullScreen {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIOpenFullScreen */
CARD16 length;
CARD32 screen;
CARD32 drawable;
} xXF86DRIOpenFullScreenReq;
#define sz_xXF86DRIOpenFullScreenReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 isFullScreen;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86DRIOpenFullScreenReply;
#define sz_xXF86DRIOpenFullScreenReply 32
typedef struct _XF86DRICloseFullScreen {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseFullScreen */
CARD16 length;
CARD32 screen;
CARD32 drawable;
} xXF86DRICloseFullScreenReq;
#define sz_xXF86DRICloseFullScreenReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xXF86DRICloseFullScreenReply;
#define sz_xXF86DRICloseFullScreenReply 32
#endif /* _XF86DRISTR_H_ */
#warning "xf86dristr.h is obsolete and may be removed in the future."
#warning "include <X11/dri/xf86driproto.h> for the protocol defines."
#include <X11/dri/xf86driproto.h>
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _Xt_ObjectP_h_
#define _Xt_ObjectP_h_
#include <X11/Object.h>
_XFUNCPROTOBEGIN
/**********************************************************
* Object Instance Data Structures
*
**********************************************************/
/* these fields match CorePart and can not be changed */
typedef struct _ObjectPart {
Widget self; /* pointer to widget itself */
WidgetClass widget_class; /* pointer to Widget's ClassRec */
Widget parent; /* parent widget */
XrmName xrm_name; /* widget resource name quarkified */
Boolean being_destroyed; /* marked for destroy */
XtCallbackList destroy_callbacks; /* who to call when widget destroyed */
XtPointer constraints; /* constraint record */
} ObjectPart;
typedef struct _ObjectRec {
ObjectPart object;
} ObjectRec;
/********************************************************
* Object Class Data Structures
*
********************************************************/
/* these fields match CoreClassPart and can not be changed */
/* ideally these structures would only contain the fields required;
but because the CoreClassPart cannot be changed at this late date
extraneous fields are necessary to make the field offsets match */
typedef struct _ObjectClassPart {
WidgetClass superclass; /* pointer to superclass ClassRec */
String class_name; /* widget resource class name */
Cardinal widget_size; /* size in bytes of widget record */
XtProc class_initialize; /* class initialization proc */
XtWidgetClassProc class_part_initialize; /* dynamic initialization */
XtEnum class_inited; /* has class been initialized? */
XtInitProc initialize; /* initialize subclass fields */
XtArgsProc initialize_hook; /* notify that initialize called */
XtProc obj1; /* NULL */
XtPointer obj2; /* NULL */
Cardinal obj3; /* NULL */
XtResourceList resources; /* resources for subclass fields */
Cardinal num_resources; /* number of entries in resources */
XrmClass xrm_class; /* resource class quarkified */
Boolean obj4; /* NULL */
XtEnum obj5; /* NULL */
Boolean obj6; /* NULL */
Boolean obj7; /* NULL */
XtWidgetProc destroy; /* free data for subclass pointers */
XtProc obj8; /* NULL */
XtProc obj9; /* NULL */
XtSetValuesFunc set_values; /* set subclass resource values */
XtArgsFunc set_values_hook; /* notify that set_values called */
XtProc obj10; /* NULL */
XtArgsProc get_values_hook; /* notify that get_values called */
XtProc obj11; /* NULL */
XtVersionType version; /* version of intrinsics used */
XtPointer callback_private; /* list of callback offsets */
String obj12; /* NULL */
XtProc obj13; /* NULL */
XtProc obj14; /* NULL */
XtPointer extension; /* pointer to extension record */
}ObjectClassPart;
typedef struct {
XtPointer next_extension; /* 1st 4 required for all extension records */
XrmQuark record_type; /* NULLQUARK; when on ObjectClassPart */
long version; /* must be XtObjectExtensionVersion */
Cardinal record_size; /* sizeof(ObjectClassExtensionRec) */
XtAllocateProc allocate;
XtDeallocateProc deallocate;
} ObjectClassExtensionRec, *ObjectClassExtension;
typedef struct _ObjectClassRec {
ObjectClassPart object_class;
} ObjectClassRec;
externalref ObjectClassRec objectClassRec;
_XFUNCPROTOEND
#define XtObjectExtensionVersion 1L
#define XtInheritAllocate ((XtAllocateProc) _XtInherit)
#define XtInheritDeallocate ((XtDeallocateProc) _XtInherit)
#endif /*_Xt_ObjectP_h_*/
/*
*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
* *
*/
#ifndef _XTHREADS_H_
# define _XTHREADS_H_
/* Redefine these to XtMalloc/XtFree or whatever you want before including
* this header file.
*/
# ifndef xmalloc
# define xmalloc malloc
# endif
# ifndef xfree
# define xfree free
# endif
# ifdef CTHREADS
# include <cthreads.h>
typedef cthread_t xthread_t;
typedef struct condition xcondition_rec;
typedef struct mutex xmutex_rec;
# define xthread_init() cthread_init()
# define xthread_self cthread_self
# define xthread_fork(func,closure) cthread_fork(func,closure)
# define xthread_yield() cthread_yield()
# define xthread_exit(v) cthread_exit(v)
# define xthread_set_name(t,str) cthread_set_name(t,str)
# define xmutex_init(m) mutex_init(m)
# define xmutex_clear(m) mutex_clear(m)
# define xmutex_lock(m) mutex_lock(m)
# define xmutex_unlock(m) mutex_unlock(m)
# define xmutex_set_name(m,str) mutex_set_name(m,str)
# define xcondition_init(cv) condition_init(cv)
# define xcondition_clear(cv) condition_clear(cv)
# define xcondition_wait(cv,m) condition_wait(cv,m)
# define xcondition_signal(cv) condition_signal(cv)
# define xcondition_broadcast(cv) condition_broadcast(cv)
# define xcondition_set_name(cv,str) condition_set_name(cv,str)
# else /* !CTHREADS */
# if defined(SVR4)
# include <thread.h>
# include <synch.h>
typedef thread_t xthread_t;
typedef thread_key_t xthread_key_t;
typedef cond_t xcondition_rec;
typedef mutex_t xmutex_rec;
# if defined(__UNIXWARE__)
extern xthread_t (*_x11_thr_self)();
# define xthread_self (_x11_thr_self)
# else
# define xthread_self thr_self
# endif
# define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL)
# define xthread_yield() thr_yield()
# define xthread_exit(v) thr_exit(v)
# define xthread_key_create(kp,d) thr_keycreate(kp,d)
# ifdef __sun
# define xthread_key_delete(k) 0
# else
# define xthread_key_delete(k) thr_keydelete(k)
# endif
# define xthread_set_specific(k,v) thr_setspecific(k,v)
# define xthread_get_specific(k,vp) thr_getspecific(k,vp)
# define xmutex_init(m) mutex_init(m,USYNC_THREAD,0)
# define xmutex_clear(m) mutex_destroy(m)
# define xmutex_lock(m) mutex_lock(m)
# define xmutex_unlock(m) mutex_unlock(m)
# define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0)
# define xcondition_clear(cv) cond_destroy(cv)
# define xcondition_wait(cv,m) cond_wait(cv,m)
# define xcondition_signal(cv) cond_signal(cv)
# define xcondition_broadcast(cv) cond_broadcast(cv)
# else /* !SVR4 */
# ifdef WIN32
# include <X11/Xwindows.h>
typedef DWORD xthread_t;
typedef DWORD xthread_key_t;
struct _xthread_waiter {
HANDLE sem;
struct _xthread_waiter *next;
};
typedef struct {
CRITICAL_SECTION cs;
struct _xthread_waiter *waiters;
} xcondition_rec;
typedef CRITICAL_SECTION xmutex_rec;
extern void _Xthread_init(void);
# define xthread_init() _Xthread_init()
# define xthread_self GetCurrentThreadId
# define xthread_fork(func,closure) { \
DWORD _tmptid; \
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \
&_tmptid); \
}
# define xthread_yield() Sleep(0)
# define xthread_exit(v) ExitThread((DWORD)(v))
# define xthread_key_create(kp,d) *(kp) = TlsAlloc()
# define xthread_key_delete(k) TlsFree(k)
# define xthread_set_specific(k,v) TlsSetValue(k,v)
# define xthread_get_specific(k,vp) TlsGetValue(k)
# define xmutex_init(m) InitializeCriticalSection(m)
# define xmutex_clear(m) DeleteCriticalSection(m)
# define _XMUTEX_NESTS
# define xmutex_lock(m) EnterCriticalSection(m)
# define xmutex_unlock(m) LeaveCriticalSection(m)
# define xcondition_init(cv) { \
InitializeCriticalSection(&(cv)->cs); \
(cv)->waiters = NULL; \
}
# define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs)
extern struct _xthread_waiter *_Xthread_waiter();
# define xcondition_wait(cv,m) { \
struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \
EnterCriticalSection(&(cv)->cs); \
_tmpthr->next = (cv)->waiters; \
(cv)->waiters = _tmpthr; \
LeaveCriticalSection(&(cv)->cs); \
LeaveCriticalSection(m); \
WaitForSingleObject(_tmpthr->sem, INFINITE); \
EnterCriticalSection(m); \
}
# define xcondition_signal(cv) { \
EnterCriticalSection(&(cv)->cs); \
if ((cv)->waiters) { \
ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \
(cv)->waiters = (cv)->waiters->next; \
} \
LeaveCriticalSection(&(cv)->cs); \
}
# define xcondition_broadcast(cv) { \
struct _xthread_waiter *_tmpthr; \
EnterCriticalSection(&(cv)->cs); \
for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \
ReleaseSemaphore(_tmpthr->sem, 1, NULL); \
(cv)->waiters = NULL; \
LeaveCriticalSection(&(cv)->cs); \
}
# else /* !WIN32 */
# ifdef USE_TIS_SUPPORT
/*
* TIS support is intended for thread safe libraries.
* This should not be used for general client programming.
*/
# include <tis.h>
typedef pthread_t xthread_t;
typedef pthread_key_t xthread_key_t;
typedef pthread_cond_t xcondition_rec;
typedef pthread_mutex_t xmutex_rec;
# define xthread_self tis_self
# define xthread_fork(func,closure) { pthread_t _tmpxthr; \
pthread_create(&_tmpxthr,NULL,func,closure); }
# define xthread_yield() pthread_yield_np()
# define xthread_exit(v) pthread_exit(v)
# define xthread_key_create(kp,d) tis_key_create(kp,d)
# define xthread_key_delete(k) tis_key_delete(k)
# define xthread_set_specific(k,v) tis_setspecific(k,v)
# define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k)
# define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
# define xmutex_init(m) tis_mutex_init(m)
# define xmutex_clear(m) tis_mutex_destroy(m)
# define xmutex_lock(m) tis_mutex_lock(m)
# define xmutex_unlock(m) tis_mutex_unlock(m)
# define xcondition_init(c) tis_cond_init(c)
# define xcondition_clear(c) tis_cond_destroy(c)
# define xcondition_wait(c,m) tis_cond_wait(c,m)
# define xcondition_signal(c) tis_cond_signal(c)
# define xcondition_broadcast(c) tis_cond_broadcast(c)
# else
# ifdef USE_NBSD_THREADLIB
/*
* NetBSD threadlib support is intended for thread safe libraries.
* This should not be used for general client programming.
*/
# include <threadlib.h>
typedef thr_t xthread_t;
typedef thread_key_t xthread_key_t;
typedef cond_t xcondition_rec;
typedef mutex_t xmutex_rec;
# define xthread_self thr_self
# define xthread_fork(func,closure) { thr_t _tmpxthr; \
/* XXX Create it detached? --thorpej */ \
thr_create(&_tmpxthr,NULL,func,closure); }
# define xthread_yield() thr_yield()
# define xthread_exit(v) thr_exit(v)
# define xthread_key_create(kp,d) thr_keycreate(kp,d)
# define xthread_key_delete(k) thr_keydelete(k)
# define xthread_set_specific(k,v) thr_setspecific(k,v)
# define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k)
# define XMUTEX_INITIALIZER MUTEX_INITIALIZER
# define xmutex_init(m) mutex_init(m, 0)
# define xmutex_clear(m) mutex_destroy(m)
# define xmutex_lock(m) mutex_lock(m)
# define xmutex_unlock(m) mutex_unlock(m)
# define xcondition_init(c) cond_init(c, 0, 0)
# define xcondition_clear(c) cond_destroy(c)
# define xcondition_wait(c,m) cond_wait(c,m)
# define xcondition_signal(c) cond_signal(c)
# define xcondition_broadcast(c) cond_broadcast(c)
# else
# include <pthread.h>
typedef pthread_t xthread_t;
typedef pthread_key_t xthread_key_t;
typedef pthread_cond_t xcondition_rec;
typedef pthread_mutex_t xmutex_rec;
# define xthread_self pthread_self
# define xthread_yield() pthread_yield()
# define xthread_exit(v) pthread_exit(v)
# define xthread_set_specific(k,v) pthread_setspecific(k,v)
# define xmutex_clear(m) pthread_mutex_destroy(m)
# define xmutex_lock(m) pthread_mutex_lock(m)
# define xmutex_unlock(m) pthread_mutex_unlock(m)
# ifndef XPRE_STANDARD_API
# define xthread_key_create(kp,d) pthread_key_create(kp,d)
# define xthread_key_delete(k) pthread_key_delete(k)
# define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k)
# define xthread_fork(func,closure) { pthread_t _tmpxthr; \
pthread_create(&_tmpxthr,NULL,func,closure); }
# define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
# define xmutex_init(m) pthread_mutex_init(m, NULL)
# define xcondition_init(c) pthread_cond_init(c, NULL)
# else /* XPRE_STANDARD_API */
# define xthread_key_create(kp,d) pthread_keycreate(kp,d)
# define xthread_key_delete(k) 0
# define xthread_get_specific(k,vp) pthread_getspecific(k,vp)
# define xthread_fork(func,closure) { pthread_t _tmpxthr; \
pthread_create(&_tmpxthr,pthread_attr_default,func,closure); }
# define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default)
# define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default)
# endif /* XPRE_STANDARD_API */
# define xcondition_clear(c) pthread_cond_destroy(c)
# define xcondition_wait(c,m) pthread_cond_wait(c,m)
# define xcondition_signal(c) pthread_cond_signal(c)
# define xcondition_broadcast(c) pthread_cond_broadcast(c)
# if defined(_DECTHREADS_)
static xthread_t _X_no_thread_id;
# define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id)
# define xthread_clear_id(id) id = _X_no_thread_id
# define xthread_equal(id1,id2) pthread_equal(id1, id2)
# endif /* _DECTHREADS_ */
# if defined(__linux__)
# define xthread_have_id(id) !pthread_equal(id, 0)
# define xthread_clear_id(id) id = 0
# define xthread_equal(id1,id2) pthread_equal(id1, id2)
# endif /* linux */
# if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM)
# ifdef DEBUG /* too much of a hack to enable normally */
/* see also cma__obj_set_name() */
# define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str)
# define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str)
# endif /* DEBUG */
# endif /* _CMA_VENDOR_ == _CMA__IBM */
# endif /* USE_NBSD_THREADLIB */
# endif /* USE_TIS_SUPPORT */
# endif /* WIN32 */
# endif /* SVR4 */
# endif /* CTHREADS */
typedef xcondition_rec *xcondition_t;
typedef xmutex_rec *xmutex_t;
# ifndef xcondition_malloc
# define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec))
# endif
# ifndef xcondition_free
# define xcondition_free(c) xfree((char *)c)
# endif
# ifndef xmutex_malloc
# define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec))
# endif
# ifndef xmutex_free
# define xmutex_free(m) xfree((char *)m)
# endif
# ifndef xthread_have_id
# define xthread_have_id(id) id
# endif
# ifndef xthread_clear_id
# define xthread_clear_id(id) id = 0
# endif
# ifndef xthread_equal
# define xthread_equal(id1,id2) ((id1) == (id2))
# endif
/* aids understood by some debuggers */
# ifndef xthread_set_name
# define xthread_set_name(t,str)
# endif
# ifndef xmutex_set_name
# define xmutex_set_name(m,str)
# endif
# ifndef xcondition_set_name
# define xcondition_set_name(cv,str)
# endif
#endif /* _XTHREADS_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtCore_h
#define _XtCore_h
_XFUNCPROTOBEGIN
typedef struct _WidgetClassRec *CoreWidgetClass;
typedef struct _WidgetRec *CoreWidget;
externalref WidgetClass coreWidgetClass;
#ifndef VMS
externalref WidgetClass widgetClass;
#endif
_XFUNCPROTOEND
#endif /* _XtCore_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/*
Copyright 1985, 1986, 1987, 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* Xlib.h - Header definition and support file for the C subroutine
* interface library (Xlib) to the X Window System Protocol (V11).
* Structures and symbols starting with "_" are private to the library.
*/
#ifndef _X11_XLIB_H_
#define _X11_XLIB_H_
#define XlibSpecificationRelease 6
#include <sys/types.h>
#if defined(__SCO__) || defined(__UNIXWARE__)
#include <stdint.h>
#endif
#include <X11/X.h>
/* applications should not depend on these two headers being included! */
#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>
#ifndef X_WCHAR
#include <stddef.h>
#else
#ifdef __UNIXOS2__
#include <stdlib.h>
#else
/* replace this with #include or typedef appropriate for your system */
typedef unsigned long wchar_t;
#endif
#endif
extern int
_Xmblen(
char *str,
int len
);
/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in
November 2000. Its presence is indicated through the following macro. */
#define X_HAVE_UTF8_STRING 1
/* The Xlib structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
typedef char *XPointer;
#define Bool int
#define Status int
#define True 1
#define False 0
#define QueuedAlready 0
#define QueuedAfterReading 1
#define QueuedAfterFlush 2
#define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd)
#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root)
#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen)
#define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual)
#define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc)
#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel)
#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel)
#define AllPlanes ((unsigned long)~0L)
#define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen)
#define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width)
#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height)
#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth)
#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight)
#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
#define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries)
#define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens)
#define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor)
#define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version)
#define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version)
#define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release)
#define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name)
#define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap)
#define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit)
#define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order)
#define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad)
#define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order)
#define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1)
#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read)
/* macros for screen oriented applications (toolkit) */
#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr])
#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy))
#define DisplayOfScreen(s) ((s)->display)
#define RootWindowOfScreen(s) ((s)->root)
#define BlackPixelOfScreen(s) ((s)->black_pixel)
#define WhitePixelOfScreen(s) ((s)->white_pixel)
#define DefaultColormapOfScreen(s)((s)->cmap)
#define DefaultDepthOfScreen(s) ((s)->root_depth)
#define DefaultGCOfScreen(s) ((s)->default_gc)
#define DefaultVisualOfScreen(s)((s)->root_visual)
#define WidthOfScreen(s) ((s)->width)
#define HeightOfScreen(s) ((s)->height)
#define WidthMMOfScreen(s) ((s)->mwidth)
#define HeightMMOfScreen(s) ((s)->mheight)
#define PlanesOfScreen(s) ((s)->root_depth)
#define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries)
#define MinCmapsOfScreen(s) ((s)->min_maps)
#define MaxCmapsOfScreen(s) ((s)->max_maps)
#define DoesSaveUnders(s) ((s)->save_unders)
#define DoesBackingStore(s) ((s)->backing_store)
#define EventMaskOfScreen(s) ((s)->root_input_mask)
/*
* Extensions need a way to hang private data on some structures.
*/
typedef struct _XExtData {
int number; /* number returned by XRegisterExtension */
struct _XExtData *next; /* next item on list of data for structure */
int (*free_private)( /* called to free private storage */
struct _XExtData *extension
);
XPointer private_data; /* data private to this extension. */
} XExtData;
/*
* This file contains structures used by the extension mechanism.
*/
typedef struct { /* public to extension, cannot be changed */
int extension; /* extension number */
int major_opcode; /* major op-code assigned by server */
int first_event; /* first event number for the extension */
int first_error; /* first error number for the extension */
} XExtCodes;
/*
* Data structure for retrieving info about pixmap formats.
*/
typedef struct {
int depth;
int bits_per_pixel;
int scanline_pad;
} XPixmapFormatValues;
/*
* Data structure for setting graphics context.
*/
typedef struct {
int function; /* logical operation */
unsigned long plane_mask;/* plane mask */
unsigned long foreground;/* foreground pixel */
unsigned long background;/* background pixel */
int line_width; /* line width */
int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
int cap_style; /* CapNotLast, CapButt,
CapRound, CapProjecting */
int join_style; /* JoinMiter, JoinRound, JoinBevel */
int fill_style; /* FillSolid, FillTiled,
FillStippled, FillOpaeueStippled */
int fill_rule; /* EvenOddRule, WindingRule */
int arc_mode; /* ArcChord, ArcPieSlice */
Pixmap tile; /* tile pixmap for tiling operations */
Pixmap stipple; /* stipple 1 plane pixmap for stipping */
int ts_x_origin; /* offset for tile or stipple operations */
int ts_y_origin;
Font font; /* default text font for text operations */
int subwindow_mode; /* ClipByChildren, IncludeInferiors */
Bool graphics_exposures;/* boolean, should exposures be generated */
int clip_x_origin; /* origin for clipping */
int clip_y_origin;
Pixmap clip_mask; /* bitmap clipping; other calls for rects */
int dash_offset; /* patterned/dashed line information */
char dashes;
} XGCValues;
/*
* Graphics context. The contents of this structure are implementation
* dependent. A GC should be treated as opaque by application code.
*/
typedef struct _XGC
#ifdef XLIB_ILLEGAL_ACCESS
{
XExtData *ext_data; /* hook for extension to hang data */
GContext gid; /* protocol ID for graphics context */
/* there is more to this structure, but it is private to Xlib */
}
#endif
*GC;
/*
* Visual structure; contains information about colormapping possible.
*/
typedef struct {
XExtData *ext_data; /* hook for extension to hang data */
VisualID visualid; /* visual id of this visual */
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ class of screen (monochrome, etc.) */
#else
int class; /* class of screen (monochrome, etc.) */
#endif
unsigned long red_mask, green_mask, blue_mask; /* mask values */
int bits_per_rgb; /* log base 2 of distinct color values */
int map_entries; /* color map entries */
} Visual;
/*
* Depth structure; contains information for each possible depth.
*/
typedef struct {
int depth; /* this depth (Z) of the depth */
int nvisuals; /* number of Visual types at this depth */
Visual *visuals; /* list of visuals possible at this depth */
} Depth;
/*
* Information about the screen. The contents of this structure are
* implementation dependent. A Screen should be treated as opaque
* by application code.
*/
struct _XDisplay; /* Forward declare before use for C++ */
typedef struct {
XExtData *ext_data; /* hook for extension to hang data */
struct _XDisplay *display;/* back pointer to display structure */
Window root; /* Root window id. */
int width, height; /* width and height of screen */
int mwidth, mheight; /* width and height of in millimeters */
int ndepths; /* number of depths possible */
Depth *depths; /* list of allowable depths on the screen */
int root_depth; /* bits per pixel */
Visual *root_visual; /* root visual */
GC default_gc; /* GC for the root root visual */
Colormap cmap; /* default color map */
unsigned long white_pixel;
unsigned long black_pixel; /* White and Black pixel values */
int max_maps, min_maps; /* max and min color maps */
int backing_store; /* Never, WhenMapped, Always */
Bool save_unders;
long root_input_mask; /* initial root input mask */
} Screen;
/*
* Format structure; describes ZFormat data the screen will understand.
*/
typedef struct {
XExtData *ext_data; /* hook for extension to hang data */
int depth; /* depth of this image format */
int bits_per_pixel; /* bits/pixel at this depth */
int scanline_pad; /* scanline must padded to this multiple */
} ScreenFormat;
/*
* Data structure for setting window attributes.
*/
typedef struct {
Pixmap background_pixmap; /* background or None or ParentRelative */
unsigned long background_pixel; /* background pixel */
Pixmap border_pixmap; /* border of the window */
unsigned long border_pixel; /* border pixel value */
int bit_gravity; /* one of bit gravity values */
int win_gravity; /* one of the window gravity values */
int backing_store; /* NotUseful, WhenMapped, Always */
unsigned long backing_planes;/* planes to be preseved if possible */
unsigned long backing_pixel;/* value to use in restoring planes */
Bool save_under; /* should bits under be saved? (popups) */
long event_mask; /* set of events that should be saved */
long do_not_propagate_mask; /* set of events that should not propagate */
Bool override_redirect; /* boolean value for override-redirect */
Colormap colormap; /* color map to be associated with window */
Cursor cursor; /* cursor to be displayed (or None) */
} XSetWindowAttributes;
typedef struct {
int x, y; /* location of window */
int width, height; /* width and height of window */
int border_width; /* border width of window */
int depth; /* depth of window */
Visual *visual; /* the associated visual structure */
Window root; /* root of screen containing window */
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ InputOutput, InputOnly*/
#else
int class; /* InputOutput, InputOnly*/
#endif
int bit_gravity; /* one of bit gravity values */
int win_gravity; /* one of the window gravity values */
int backing_store; /* NotUseful, WhenMapped, Always */
unsigned long backing_planes;/* planes to be preserved if possible */
unsigned long backing_pixel;/* value to be used when restoring planes */
Bool save_under; /* boolean, should bits under be saved? */
Colormap colormap; /* color map to be associated with window */
Bool map_installed; /* boolean, is color map currently installed*/
int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
long all_event_masks; /* set of events all people have interest in*/
long your_event_mask; /* my event mask */
long do_not_propagate_mask; /* set of events that should not propagate */
Bool override_redirect; /* boolean value for override-redirect */
Screen *screen; /* back pointer to correct screen */
} XWindowAttributes;
/*
* Data structure for host setting; getting routines.
*
*/
typedef struct {
int family; /* for example FamilyInternet */
int length; /* length of address, in bytes */
char *address; /* pointer to where to find the bytes */
} XHostAddress;
/*
* Data structure for ServerFamilyInterpreted addresses in host routines
*/
typedef struct {
int typelength; /* length of type string, in bytes */
int valuelength; /* length of value string, in bytes */
char *type; /* pointer to where to find the type string */
char *value; /* pointer to where to find the address */
} XServerInterpretedAddress;
/*
* Data structure for "image" data, used by image manipulation routines.
*/
typedef struct _XImage {
int width, height; /* size of image */
int xoffset; /* number of pixels offset in X direction */
int format; /* XYBitmap, XYPixmap, ZPixmap */
char *data; /* pointer to image data */
int byte_order; /* data byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* quant. of scanline 8, 16, 32 */
int bitmap_bit_order; /* LSBFirst, MSBFirst */
int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */
int depth; /* depth of image */
int bytes_per_line; /* accelarator to next line */
int bits_per_pixel; /* bits per pixel (ZPixmap) */
unsigned long red_mask; /* bits in z arrangment */
unsigned long green_mask;
unsigned long blue_mask;
XPointer obdata; /* hook for the object routines to hang on */
struct funcs { /* image manipulation routines */
struct _XImage *(*create_image)(
struct _XDisplay* /* display */,
Visual* /* visual */,
unsigned int /* depth */,
int /* format */,
int /* offset */,
char* /* data */,
unsigned int /* width */,
unsigned int /* height */,
int /* bitmap_pad */,
int /* bytes_per_line */);
int (*destroy_image) (struct _XImage *);
unsigned long (*get_pixel) (struct _XImage *, int, int);
int (*put_pixel) (struct _XImage *, int, int, unsigned long);
struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
int (*add_pixel) (struct _XImage *, long);
} f;
} XImage;
/*
* Data structure for XReconfigureWindow
*/
typedef struct {
int x, y;
int width, height;
int border_width;
Window sibling;
int stack_mode;
} XWindowChanges;
/*
* Data structure used by color operations
*/
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
char flags; /* do_red, do_green, do_blue */
char pad;
} XColor;
/*
* Data structures for graphics operations. On most machines, these are
* congruent with the wire protocol structures, so reformatting the data
* can be avoided on these architectures.
*/
typedef struct {
short x1, y1, x2, y2;
} XSegment;
typedef struct {
short x, y;
} XPoint;
typedef struct {
short x, y;
unsigned short width, height;
} XRectangle;
typedef struct {
short x, y;
unsigned short width, height;
short angle1, angle2;
} XArc;
/* Data structure for XChangeKeyboardControl */
typedef struct {
int key_click_percent;
int bell_percent;
int bell_pitch;
int bell_duration;
int led;
int led_mode;
int key;
int auto_repeat_mode; /* On, Off, Default */
} XKeyboardControl;
/* Data structure for XGetKeyboardControl */
typedef struct {
int key_click_percent;
int bell_percent;
unsigned int bell_pitch, bell_duration;
unsigned long led_mask;
int global_auto_repeat;
char auto_repeats[32];
} XKeyboardState;
/* Data structure for XGetMotionEvents. */
typedef struct {
Time time;
short x, y;
} XTimeCoord;
/* Data structure for X{Set,Get}ModifierMapping */
typedef struct {
int max_keypermod; /* The server's max # of keys per modifier */
KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */
} XModifierKeymap;
/*
* Display datatype maintaining display specific data.
* The contents of this structure are implementation dependent.
* A Display should be treated as opaque by application code.
*/
#ifndef XLIB_ILLEGAL_ACCESS
typedef struct _XDisplay Display;
#endif
struct _XPrivate; /* Forward declare before use for C++ */
struct _XrmHashBucketRec;
typedef struct
#ifdef XLIB_ILLEGAL_ACCESS
_XDisplay
#endif
{
XExtData *ext_data; /* hook for extension to hang data */
struct _XPrivate *private1;
int fd; /* Network socket. */
int private2;
int proto_major_version;/* major version of server's X protocol */
int proto_minor_version;/* minor version of servers X protocol */
char *vendor; /* vendor of the server hardware */
XID private3;
XID private4;
XID private5;
int private6;
XID (*resource_alloc)( /* allocator function */
struct _XDisplay*
);
int byte_order; /* screen byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* padding and data requirements */
int bitmap_pad; /* padding requirements on bitmaps */
int bitmap_bit_order; /* LeastSignificant or MostSignificant */
int nformats; /* number of pixmap formats in list */
ScreenFormat *pixmap_format; /* pixmap format list */
int private8;
int release; /* release of the server */
struct _XPrivate *private9, *private10;
int qlen; /* Length of input event queue */
unsigned long last_request_read; /* seq number of last event read */
unsigned long request; /* sequence number of last request. */
XPointer private11;
XPointer private12;
XPointer private13;
XPointer private14;
unsigned max_request_size; /* maximum number 32 bit words in request*/
struct _XrmHashBucketRec *db;
int (*private15)(
struct _XDisplay*
);
char *display_name; /* "host:display" string used on this connect*/
int default_screen; /* default screen for operations */
int nscreens; /* number of screens on this server*/
Screen *screens; /* pointer to list of screens */
unsigned long motion_buffer; /* size of motion buffer */
unsigned long private16;
int min_keycode; /* minimum defined keycode */
int max_keycode; /* maximum defined keycode */
XPointer private17;
XPointer private18;
int private19;
char *xdefaults; /* contents of defaults from server */
/* there is more to this structure, but it is private to Xlib */
}
#ifdef XLIB_ILLEGAL_ACCESS
Display,
#endif
*_XPrivDisplay;
#undef _XEVENT_
#ifndef _XEVENT_
/*
* Definitions of specific events.
*/
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int keycode; /* detail */
Bool same_screen; /* same screen flag */
} XKeyEvent;
typedef XKeyEvent XKeyPressedEvent;
typedef XKeyEvent XKeyReleasedEvent;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int button; /* detail */
Bool same_screen; /* same screen flag */
} XButtonEvent;
typedef XButtonEvent XButtonPressedEvent;
typedef XButtonEvent XButtonReleasedEvent;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
char is_hint; /* detail */
Bool same_screen; /* same screen flag */
} XMotionEvent;
typedef XMotionEvent XPointerMovedEvent;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
int detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonlinear,NotifyNonlinearVirtual
*/
Bool same_screen; /* same screen flag */
Bool focus; /* boolean focus */
unsigned int state; /* key or button mask */
} XCrossingEvent;
typedef XCrossingEvent XEnterWindowEvent;
typedef XCrossingEvent XLeaveWindowEvent;
typedef struct {
int type; /* FocusIn or FocusOut */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window of event */
int mode; /* NotifyNormal, NotifyWhileGrabbed,
NotifyGrab, NotifyUngrab */
int detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
* NotifyPointerRoot, NotifyDetailNone
*/
} XFocusChangeEvent;
typedef XFocusChangeEvent XFocusInEvent;
typedef XFocusChangeEvent XFocusOutEvent;
/* generated on EnterWindow and FocusIn when KeyMapState selected */
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
char key_vector[32];
} XKeymapEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
int x, y;
int width, height;
int count; /* if non-zero, at least this many more */
} XExposeEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Drawable drawable;
int x, y;
int width, height;
int count; /* if non-zero, at least this many more */
int major_code; /* core is CopyArea or CopyPlane */
int minor_code; /* not defined in the core */
} XGraphicsExposeEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Drawable drawable;
int major_code; /* core is CopyArea or CopyPlane */
int minor_code; /* not defined in the core */
} XNoExposeEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
int state; /* Visibility state */
} XVisibilityEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent; /* parent of the window */
Window window; /* window id of window created */
int x, y; /* window location */
int width, height; /* size of window */
int border_width; /* border width */
Bool override_redirect; /* creation should be overridden */
} XCreateWindowEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
} XDestroyWindowEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
Bool from_configure;
} XUnmapEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
Bool override_redirect; /* boolean, is override set... */
} XMapEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent;
Window window;
} XMapRequestEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
Window parent;
int x, y;
Bool override_redirect;
} XReparentEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
Bool override_redirect;
} XConfigureEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
int x, y;
} XGravityEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
int width, height;
} XResizeRequestEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
int detail; /* Above, Below, TopIf, BottomIf, Opposite */
unsigned long value_mask;
} XConfigureRequestEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
int place; /* PlaceOnTop, PlaceOnBottom */
} XCirculateEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window parent;
Window window;
int place; /* PlaceOnTop, PlaceOnBottom */
} XCirculateRequestEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Atom atom;
Time time;
int state; /* NewValue, Deleted */
} XPropertyEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Atom selection;
Time time;
} XSelectionClearEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window owner;
Window requestor;
Atom selection;
Atom target;
Atom property;
Time time;
} XSelectionRequestEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window requestor;
Atom selection;
Atom target;
Atom property; /* ATOM or None */
Time time;
} XSelectionEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Colormap colormap; /* COLORMAP or None */
#if defined(__cplusplus) || defined(c_plusplus)
Bool c_new; /* C++ */
#else
Bool new;
#endif
int state; /* ColormapInstalled, ColormapUninstalled */
} XColormapEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Atom message_type;
int format;
union {
char b[20];
short s[10];
long l[5];
} data;
} XClientMessageEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* unused */
int request; /* one of MappingModifier, MappingKeyboard,
MappingPointer */
int first_keycode; /* first keycode */
int count; /* defines range of change w. first_keycode*/
} XMappingEvent;
typedef struct {
int type;
Display *display; /* Display the event was read from */
XID resourceid; /* resource id */
unsigned long serial; /* serial number of failed request */
unsigned char error_code; /* error code of failed request */
unsigned char request_code; /* Major op-code of failed request */
unsigned char minor_code; /* Minor op-code of failed request */
} XErrorEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display;/* Display the event was read from */
Window window; /* window on which event was requested in event mask */
} XAnyEvent;
/***************************************************************
*
* GenericEvent. This event is the standard event for all newer extensions.
*/
typedef struct
{
int type; /* of event. Always GenericEvent */
unsigned long serial; /* # of last request processed */
Bool send_event; /* true if from SendEvent request */
Display *display; /* Display the event was read from */
int extension; /* major opcode of extension that caused the event */
int evtype; /* actual event type. */
} XGenericEvent;
typedef struct {
int type; /* of event. Always GenericEvent */
unsigned long serial; /* # of last request processed */
Bool send_event; /* true if from SendEvent request */
Display *display; /* Display the event was read from */
int extension; /* major opcode of extension that caused the event */
int evtype; /* actual event type. */
unsigned int cookie;
void *data;
} XGenericEventCookie;
/*
* this union is defined so Xlib can always use the same sized
* event structure internally, to avoid memory fragmentation.
*/
typedef union _XEvent {
int type; /* must not be changed; first element */
XAnyEvent xany;
XKeyEvent xkey;
XButtonEvent xbutton;
XMotionEvent xmotion;
XCrossingEvent xcrossing;
XFocusChangeEvent xfocus;
XExposeEvent xexpose;
XGraphicsExposeEvent xgraphicsexpose;
XNoExposeEvent xnoexpose;
XVisibilityEvent xvisibility;
XCreateWindowEvent xcreatewindow;
XDestroyWindowEvent xdestroywindow;
XUnmapEvent xunmap;
XMapEvent xmap;
XMapRequestEvent xmaprequest;
XReparentEvent xreparent;
XConfigureEvent xconfigure;
XGravityEvent xgravity;
XResizeRequestEvent xresizerequest;
XConfigureRequestEvent xconfigurerequest;
XCirculateEvent xcirculate;
XCirculateRequestEvent xcirculaterequest;
XPropertyEvent xproperty;
XSelectionClearEvent xselectionclear;
XSelectionRequestEvent xselectionrequest;
XSelectionEvent xselection;
XColormapEvent xcolormap;
XClientMessageEvent xclient;
XMappingEvent xmapping;
XErrorEvent xerror;
XKeymapEvent xkeymap;
XGenericEvent xgeneric;
XGenericEventCookie xcookie;
long pad[24];
} XEvent;
#endif
#define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy)))
/*
* per character font metric information.
*/
typedef struct {
short lbearing; /* origin to left edge of raster */
short rbearing; /* origin to right edge of raster */
short width; /* advance to next char's origin */
short ascent; /* baseline to top edge of raster */
short descent; /* baseline to bottom edge of raster */
unsigned short attributes; /* per char flags (not predefined) */
} XCharStruct;
/*
* To allow arbitrary information with fonts, there are additional properties
* returned.
*/
typedef struct {
Atom name;
unsigned long card32;
} XFontProp;
typedef struct {
XExtData *ext_data; /* hook for extension to hang data */
Font fid; /* Font id for this font */
unsigned direction; /* hint about direction the font is painted */
unsigned min_char_or_byte2;/* first character */
unsigned max_char_or_byte2;/* last character */
unsigned min_byte1; /* first row that exists */
unsigned max_byte1; /* last row that exists */
Bool all_chars_exist;/* flag if all characters have non-zero size*/
unsigned default_char; /* char to print for undefined character */
int n_properties; /* how many properties there are */
XFontProp *properties; /* pointer to array of additional properties*/
XCharStruct min_bounds; /* minimum bounds over all existing char*/
XCharStruct max_bounds; /* maximum bounds over all existing char*/
XCharStruct *per_char; /* first_char to last_char information */
int ascent; /* log. extent above baseline for spacing */
int descent; /* log. descent below baseline for spacing */
} XFontStruct;
/*
* PolyText routines take these as arguments.
*/
typedef struct {
char *chars; /* pointer to string */
int nchars; /* number of characters */
int delta; /* delta between strings */
Font font; /* font to print it in, None don't change */
} XTextItem;
typedef struct { /* normal 16 bit characters are two bytes */
unsigned char byte1;
unsigned char byte2;
} XChar2b;
typedef struct {
XChar2b *chars; /* two byte characters */
int nchars; /* number of characters */
int delta; /* delta between strings */
Font font; /* font to print it in, None don't change */
} XTextItem16;
typedef union { Display *display;
GC gc;
Visual *visual;
Screen *screen;
ScreenFormat *pixmap_format;
XFontStruct *font; } XEDataObject;
typedef struct {
XRectangle max_ink_extent;
XRectangle max_logical_extent;
} XFontSetExtents;
/* unused:
typedef void (*XOMProc)();
*/
typedef struct _XOM *XOM;
typedef struct _XOC *XOC, *XFontSet;
typedef struct {
char *chars;
int nchars;
int delta;
XFontSet font_set;
} XmbTextItem;
typedef struct {
wchar_t *chars;
int nchars;
int delta;
XFontSet font_set;
} XwcTextItem;
#define XNRequiredCharSet "requiredCharSet"
#define XNQueryOrientation "queryOrientation"
#define XNBaseFontName "baseFontName"
#define XNOMAutomatic "omAutomatic"
#define XNMissingCharSet "missingCharSet"
#define XNDefaultString "defaultString"
#define XNOrientation "orientation"
#define XNDirectionalDependentDrawing "directionalDependentDrawing"
#define XNContextualDrawing "contextualDrawing"
#define XNFontInfo "fontInfo"
typedef struct {
int charset_count;
char **charset_list;
} XOMCharSetList;
typedef enum {
XOMOrientation_LTR_TTB,
XOMOrientation_RTL_TTB,
XOMOrientation_TTB_LTR,
XOMOrientation_TTB_RTL,
XOMOrientation_Context
} XOrientation;
typedef struct {
int num_orientation;
XOrientation *orientation; /* Input Text description */
} XOMOrientation;
typedef struct {
int num_font;
XFontStruct **font_struct_list;
char **font_name_list;
} XOMFontInfo;
typedef struct _XIM *XIM;
typedef struct _XIC *XIC;
typedef void (*XIMProc)(
XIM,
XPointer,
XPointer
);
typedef Bool (*XICProc)(
XIC,
XPointer,
XPointer
);
typedef void (*XIDProc)(
Display*,
XPointer,
XPointer
);
typedef unsigned long XIMStyle;
typedef struct {
unsigned short count_styles;
XIMStyle *supported_styles;
} XIMStyles;
#define XIMPreeditArea 0x0001L
#define XIMPreeditCallbacks 0x0002L
#define XIMPreeditPosition 0x0004L
#define XIMPreeditNothing 0x0008L
#define XIMPreeditNone 0x0010L
#define XIMStatusArea 0x0100L
#define XIMStatusCallbacks 0x0200L
#define XIMStatusNothing 0x0400L
#define XIMStatusNone 0x0800L
#define XNVaNestedList "XNVaNestedList"
#define XNQueryInputStyle "queryInputStyle"
#define XNClientWindow "clientWindow"
#define XNInputStyle "inputStyle"
#define XNFocusWindow "focusWindow"
#define XNResourceName "resourceName"
#define XNResourceClass "resourceClass"
#define XNGeometryCallback "geometryCallback"
#define XNDestroyCallback "destroyCallback"
#define XNFilterEvents "filterEvents"
#define XNPreeditStartCallback "preeditStartCallback"
#define XNPreeditDoneCallback "preeditDoneCallback"
#define XNPreeditDrawCallback "preeditDrawCallback"
#define XNPreeditCaretCallback "preeditCaretCallback"
#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
#define XNPreeditAttributes "preeditAttributes"
#define XNStatusStartCallback "statusStartCallback"
#define XNStatusDoneCallback "statusDoneCallback"
#define XNStatusDrawCallback "statusDrawCallback"
#define XNStatusAttributes "statusAttributes"
#define XNArea "area"
#define XNAreaNeeded "areaNeeded"
#define XNSpotLocation "spotLocation"
#define XNColormap "colorMap"
#define XNStdColormap "stdColorMap"
#define XNForeground "foreground"
#define XNBackground "background"
#define XNBackgroundPixmap "backgroundPixmap"
#define XNFontSet "fontSet"
#define XNLineSpace "lineSpace"
#define XNCursor "cursor"
#define XNQueryIMValuesList "queryIMValuesList"
#define XNQueryICValuesList "queryICValuesList"
#define XNVisiblePosition "visiblePosition"
#define XNR6PreeditCallback "r6PreeditCallback"
#define XNStringConversionCallback "stringConversionCallback"
#define XNStringConversion "stringConversion"
#define XNResetState "resetState"
#define XNHotKey "hotKey"
#define XNHotKeyState "hotKeyState"
#define XNPreeditState "preeditState"
#define XNSeparatorofNestedList "separatorofNestedList"
#define XBufferOverflow -1
#define XLookupNone 1
#define XLookupChars 2
#define XLookupKeySym 3
#define XLookupBoth 4
typedef void *XVaNestedList;
typedef struct {
XPointer client_data;
XIMProc callback;
} XIMCallback;
typedef struct {
XPointer client_data;
XICProc callback;
} XICCallback;
typedef unsigned long XIMFeedback;
#define XIMReverse 1L
#define XIMUnderline (1L<<1)
#define XIMHighlight (1L<<2)
#define XIMPrimary (1L<<5)
#define XIMSecondary (1L<<6)
#define XIMTertiary (1L<<7)
#define XIMVisibleToForward (1L<<8)
#define XIMVisibleToBackword (1L<<9)
#define XIMVisibleToCenter (1L<<10)
typedef struct _XIMText {
unsigned short length;
XIMFeedback *feedback;
Bool encoding_is_wchar;
union {
char *multi_byte;
wchar_t *wide_char;
} string;
} XIMText;
typedef unsigned long XIMPreeditState;
#define XIMPreeditUnKnown 0L
#define XIMPreeditEnable 1L
#define XIMPreeditDisable (1L<<1)
typedef struct _XIMPreeditStateNotifyCallbackStruct {
XIMPreeditState state;
} XIMPreeditStateNotifyCallbackStruct;
typedef unsigned long XIMResetState;
#define XIMInitialState 1L
#define XIMPreserveState (1L<<1)
typedef unsigned long XIMStringConversionFeedback;
#define XIMStringConversionLeftEdge (0x00000001)
#define XIMStringConversionRightEdge (0x00000002)
#define XIMStringConversionTopEdge (0x00000004)
#define XIMStringConversionBottomEdge (0x00000008)
#define XIMStringConversionConcealed (0x00000010)
#define XIMStringConversionWrapped (0x00000020)
typedef struct _XIMStringConversionText {
unsigned short length;
XIMStringConversionFeedback *feedback;
Bool encoding_is_wchar;
union {
char *mbs;
wchar_t *wcs;
} string;
} XIMStringConversionText;
typedef unsigned short XIMStringConversionPosition;
typedef unsigned short XIMStringConversionType;
#define XIMStringConversionBuffer (0x0001)
#define XIMStringConversionLine (0x0002)
#define XIMStringConversionWord (0x0003)
#define XIMStringConversionChar (0x0004)
typedef unsigned short XIMStringConversionOperation;
#define XIMStringConversionSubstitution (0x0001)
#define XIMStringConversionRetrieval (0x0002)
typedef enum {
XIMForwardChar, XIMBackwardChar,
XIMForwardWord, XIMBackwardWord,
XIMCaretUp, XIMCaretDown,
XIMNextLine, XIMPreviousLine,
XIMLineStart, XIMLineEnd,
XIMAbsolutePosition,
XIMDontChange
} XIMCaretDirection;
typedef struct _XIMStringConversionCallbackStruct {
XIMStringConversionPosition position;
XIMCaretDirection direction;
XIMStringConversionOperation operation;
unsigned short factor;
XIMStringConversionText *text;
} XIMStringConversionCallbackStruct;
typedef struct _XIMPreeditDrawCallbackStruct {
int caret; /* Cursor offset within pre-edit string */
int chg_first; /* Starting change position */
int chg_length; /* Length of the change in character count */
XIMText *text;
} XIMPreeditDrawCallbackStruct;
typedef enum {
XIMIsInvisible, /* Disable caret feedback */
XIMIsPrimary, /* UI defined caret feedback */
XIMIsSecondary /* UI defined caret feedback */
} XIMCaretStyle;
typedef struct _XIMPreeditCaretCallbackStruct {
int position; /* Caret offset within pre-edit string */
XIMCaretDirection direction; /* Caret moves direction */
XIMCaretStyle style; /* Feedback of the caret */
} XIMPreeditCaretCallbackStruct;
typedef enum {
XIMTextType,
XIMBitmapType
} XIMStatusDataType;
typedef struct _XIMStatusDrawCallbackStruct {
XIMStatusDataType type;
union {
XIMText *text;
Pixmap bitmap;
} data;
} XIMStatusDrawCallbackStruct;
typedef struct _XIMHotKeyTrigger {
KeySym keysym;
int modifier;
int modifier_mask;
} XIMHotKeyTrigger;
typedef struct _XIMHotKeyTriggers {
int num_hot_key;
XIMHotKeyTrigger *key;
} XIMHotKeyTriggers;
typedef unsigned long XIMHotKeyState;
#define XIMHotKeyStateON (0x0001L)
#define XIMHotKeyStateOFF (0x0002L)
typedef struct {
unsigned short count_values;
char **supported_values;
} XIMValuesList;
_XFUNCPROTOBEGIN
#if defined(WIN32) && !defined(_XLIBINT_)
#define _Xdebug (*_Xdebug_p)
#endif
extern int _Xdebug;
extern XFontStruct *XLoadQueryFont(
Display* /* display */,
_Xconst char* /* name */
);
extern XFontStruct *XQueryFont(
Display* /* display */,
XID /* font_ID */
);
extern XTimeCoord *XGetMotionEvents(
Display* /* display */,
Window /* w */,
Time /* start */,
Time /* stop */,
int* /* nevents_return */
);
extern XModifierKeymap *XDeleteModifiermapEntry(
XModifierKeymap* /* modmap */,
#if NeedWidePrototypes
unsigned int /* keycode_entry */,
#else
KeyCode /* keycode_entry */,
#endif
int /* modifier */
);
extern XModifierKeymap *XGetModifierMapping(
Display* /* display */
);
extern XModifierKeymap *XInsertModifiermapEntry(
XModifierKeymap* /* modmap */,
#if NeedWidePrototypes
unsigned int /* keycode_entry */,
#else
KeyCode /* keycode_entry */,
#endif
int /* modifier */
);
extern XModifierKeymap *XNewModifiermap(
int /* max_keys_per_mod */
);
extern XImage *XCreateImage(
Display* /* display */,
Visual* /* visual */,
unsigned int /* depth */,
int /* format */,
int /* offset */,
char* /* data */,
unsigned int /* width */,
unsigned int /* height */,
int /* bitmap_pad */,
int /* bytes_per_line */
);
extern Status XInitImage(
XImage* /* image */
);
extern XImage *XGetImage(
Display* /* display */,
Drawable /* d */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned long /* plane_mask */,
int /* format */
);
extern XImage *XGetSubImage(
Display* /* display */,
Drawable /* d */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned long /* plane_mask */,
int /* format */,
XImage* /* dest_image */,
int /* dest_x */,
int /* dest_y */
);
/*
* X function declarations.
*/
extern Display *XOpenDisplay(
_Xconst char* /* display_name */
);
extern void XrmInitialize(
void
);
extern char *XFetchBytes(
Display* /* display */,
int* /* nbytes_return */
);
extern char *XFetchBuffer(
Display* /* display */,
int* /* nbytes_return */,
int /* buffer */
);
extern char *XGetAtomName(
Display* /* display */,
Atom /* atom */
);
extern Status XGetAtomNames(
Display* /* dpy */,
Atom* /* atoms */,
int /* count */,
char** /* names_return */
);
extern char *XGetDefault(
Display* /* display */,
_Xconst char* /* program */,
_Xconst char* /* option */
);
extern char *XDisplayName(
_Xconst char* /* string */
);
extern char *XKeysymToString(
KeySym /* keysym */
);
extern int (*XSynchronize(
Display* /* display */,
Bool /* onoff */
))(
Display* /* display */
);
extern int (*XSetAfterFunction(
Display* /* display */,
int (*) (
Display* /* display */
) /* procedure */
))(
Display* /* display */
);
extern Atom XInternAtom(
Display* /* display */,
_Xconst char* /* atom_name */,
Bool /* only_if_exists */
);
extern Status XInternAtoms(
Display* /* dpy */,
char** /* names */,
int /* count */,
Bool /* onlyIfExists */,
Atom* /* atoms_return */
);
extern Colormap XCopyColormapAndFree(
Display* /* display */,
Colormap /* colormap */
);
extern Colormap XCreateColormap(
Display* /* display */,
Window /* w */,
Visual* /* visual */,
int /* alloc */
);
extern Cursor XCreatePixmapCursor(
Display* /* display */,
Pixmap /* source */,
Pixmap /* mask */,
XColor* /* foreground_color */,
XColor* /* background_color */,
unsigned int /* x */,
unsigned int /* y */
);
extern Cursor XCreateGlyphCursor(
Display* /* display */,
Font /* source_font */,
Font /* mask_font */,
unsigned int /* source_char */,
unsigned int /* mask_char */,
XColor _Xconst * /* foreground_color */,
XColor _Xconst * /* background_color */
);
extern Cursor XCreateFontCursor(
Display* /* display */,
unsigned int /* shape */
);
extern Font XLoadFont(
Display* /* display */,
_Xconst char* /* name */
);
extern GC XCreateGC(
Display* /* display */,
Drawable /* d */,
unsigned long /* valuemask */,
XGCValues* /* values */
);
extern GContext XGContextFromGC(
GC /* gc */
);
extern void XFlushGC(
Display* /* display */,
GC /* gc */
);
extern Pixmap XCreatePixmap(
Display* /* display */,
Drawable /* d */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* depth */
);
extern Pixmap XCreateBitmapFromData(
Display* /* display */,
Drawable /* d */,
_Xconst char* /* data */,
unsigned int /* width */,
unsigned int /* height */
);
extern Pixmap XCreatePixmapFromBitmapData(
Display* /* display */,
Drawable /* d */,
char* /* data */,
unsigned int /* width */,
unsigned int /* height */,
unsigned long /* fg */,
unsigned long /* bg */,
unsigned int /* depth */
);
extern Window XCreateSimpleWindow(
Display* /* display */,
Window /* parent */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* border_width */,
unsigned long /* border */,
unsigned long /* background */
);
extern Window XGetSelectionOwner(
Display* /* display */,
Atom /* selection */
);
extern Window XCreateWindow(
Display* /* display */,
Window /* parent */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* border_width */,
int /* depth */,
unsigned int /* class */,
Visual* /* visual */,
unsigned long /* valuemask */,
XSetWindowAttributes* /* attributes */
);
extern Colormap *XListInstalledColormaps(
Display* /* display */,
Window /* w */,
int* /* num_return */
);
extern char **XListFonts(
Display* /* display */,
_Xconst char* /* pattern */,
int /* maxnames */,
int* /* actual_count_return */
);
extern char **XListFontsWithInfo(
Display* /* display */,
_Xconst char* /* pattern */,
int /* maxnames */,
int* /* count_return */,
XFontStruct** /* info_return */
);
extern char **XGetFontPath(
Display* /* display */,
int* /* npaths_return */
);
extern char **XListExtensions(
Display* /* display */,
int* /* nextensions_return */
);
extern Atom *XListProperties(
Display* /* display */,
Window /* w */,
int* /* num_prop_return */
);
extern XHostAddress *XListHosts(
Display* /* display */,
int* /* nhosts_return */,
Bool* /* state_return */
);
_X_DEPRECATED
extern KeySym XKeycodeToKeysym(
Display* /* display */,
#if NeedWidePrototypes
unsigned int /* keycode */,
#else
KeyCode /* keycode */,
#endif
int /* index */
);
extern KeySym XLookupKeysym(
XKeyEvent* /* key_event */,
int /* index */
);
extern KeySym *XGetKeyboardMapping(
Display* /* display */,
#if NeedWidePrototypes
unsigned int /* first_keycode */,
#else
KeyCode /* first_keycode */,
#endif
int /* keycode_count */,
int* /* keysyms_per_keycode_return */
);
extern KeySym XStringToKeysym(
_Xconst char* /* string */
);
extern long XMaxRequestSize(
Display* /* display */
);
extern long XExtendedMaxRequestSize(
Display* /* display */
);
extern char *XResourceManagerString(
Display* /* display */
);
extern char *XScreenResourceString(
Screen* /* screen */
);
extern unsigned long XDisplayMotionBufferSize(
Display* /* display */
);
extern VisualID XVisualIDFromVisual(
Visual* /* visual */
);
/* multithread routines */
extern Status XInitThreads(
void
);
extern void XLockDisplay(
Display* /* display */
);
extern void XUnlockDisplay(
Display* /* display */
);
/* routines for dealing with extensions */
extern XExtCodes *XInitExtension(
Display* /* display */,
_Xconst char* /* name */
);
extern XExtCodes *XAddExtension(
Display* /* display */
);
extern XExtData *XFindOnExtensionList(
XExtData** /* structure */,
int /* number */
);
extern XExtData **XEHeadOfExtensionList(
XEDataObject /* object */
);
/* these are routines for which there are also macros */
extern Window XRootWindow(
Display* /* display */,
int /* screen_number */
);
extern Window XDefaultRootWindow(
Display* /* display */
);
extern Window XRootWindowOfScreen(
Screen* /* screen */
);
extern Visual *XDefaultVisual(
Display* /* display */,
int /* screen_number */
);
extern Visual *XDefaultVisualOfScreen(
Screen* /* screen */
);
extern GC XDefaultGC(
Display* /* display */,
int /* screen_number */
);
extern GC XDefaultGCOfScreen(
Screen* /* screen */
);
extern unsigned long XBlackPixel(
Display* /* display */,
int /* screen_number */
);
extern unsigned long XWhitePixel(
Display* /* display */,
int /* screen_number */
);
extern unsigned long XAllPlanes(
void
);
extern unsigned long XBlackPixelOfScreen(
Screen* /* screen */
);
extern unsigned long XWhitePixelOfScreen(
Screen* /* screen */
);
extern unsigned long XNextRequest(
Display* /* display */
);
extern unsigned long XLastKnownRequestProcessed(
Display* /* display */
);
extern char *XServerVendor(
Display* /* display */
);
extern char *XDisplayString(
Display* /* display */
);
extern Colormap XDefaultColormap(
Display* /* display */,
int /* screen_number */
);
extern Colormap XDefaultColormapOfScreen(
Screen* /* screen */
);
extern Display *XDisplayOfScreen(
Screen* /* screen */
);
extern Screen *XScreenOfDisplay(
Display* /* display */,
int /* screen_number */
);
extern Screen *XDefaultScreenOfDisplay(
Display* /* display */
);
extern long XEventMaskOfScreen(
Screen* /* screen */
);
extern int XScreenNumberOfScreen(
Screen* /* screen */
);
typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
Display* /* display */,
XErrorEvent* /* error_event */
);
extern XErrorHandler XSetErrorHandler (
XErrorHandler /* handler */
);
typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */
Display* /* display */
);
extern XIOErrorHandler XSetIOErrorHandler (
XIOErrorHandler /* handler */
);
extern XPixmapFormatValues *XListPixmapFormats(
Display* /* display */,
int* /* count_return */
);
extern int *XListDepths(
Display* /* display */,
int /* screen_number */,
int* /* count_return */
);
/* ICCCM routines for things that don't require special include files; */
/* other declarations are given in Xutil.h */
extern Status XReconfigureWMWindow(
Display* /* display */,
Window /* w */,
int /* screen_number */,
unsigned int /* mask */,
XWindowChanges* /* changes */
);
extern Status XGetWMProtocols(
Display* /* display */,
Window /* w */,
Atom** /* protocols_return */,
int* /* count_return */
);
extern Status XSetWMProtocols(
Display* /* display */,
Window /* w */,
Atom* /* protocols */,
int /* count */
);
extern Status XIconifyWindow(
Display* /* display */,
Window /* w */,
int /* screen_number */
);
extern Status XWithdrawWindow(
Display* /* display */,
Window /* w */,
int /* screen_number */
);
extern Status XGetCommand(
Display* /* display */,
Window /* w */,
char*** /* argv_return */,
int* /* argc_return */
);
extern Status XGetWMColormapWindows(
Display* /* display */,
Window /* w */,
Window** /* windows_return */,
int* /* count_return */
);
extern Status XSetWMColormapWindows(
Display* /* display */,
Window /* w */,
Window* /* colormap_windows */,
int /* count */
);
extern void XFreeStringList(
char** /* list */
);
extern int XSetTransientForHint(
Display* /* display */,
Window /* w */,
Window /* prop_window */
);
/* The following are given in alphabetical order */
extern int XActivateScreenSaver(
Display* /* display */
);
extern int XAddHost(
Display* /* display */,
XHostAddress* /* host */
);
extern int XAddHosts(
Display* /* display */,
XHostAddress* /* hosts */,
int /* num_hosts */
);
extern int XAddToExtensionList(
struct _XExtData** /* structure */,
XExtData* /* ext_data */
);
extern int XAddToSaveSet(
Display* /* display */,
Window /* w */
);
extern Status XAllocColor(
Display* /* display */,
Colormap /* colormap */,
XColor* /* screen_in_out */
);
extern Status XAllocColorCells(
Display* /* display */,
Colormap /* colormap */,
Bool /* contig */,
unsigned long* /* plane_masks_return */,
unsigned int /* nplanes */,
unsigned long* /* pixels_return */,
unsigned int /* npixels */
);
extern Status XAllocColorPlanes(
Display* /* display */,
Colormap /* colormap */,
Bool /* contig */,
unsigned long* /* pixels_return */,
int /* ncolors */,
int /* nreds */,
int /* ngreens */,
int /* nblues */,
unsigned long* /* rmask_return */,
unsigned long* /* gmask_return */,
unsigned long* /* bmask_return */
);
extern Status XAllocNamedColor(
Display* /* display */,
Colormap /* colormap */,
_Xconst char* /* color_name */,
XColor* /* screen_def_return */,
XColor* /* exact_def_return */
);
extern int XAllowEvents(
Display* /* display */,
int /* event_mode */,
Time /* time */
);
extern int XAutoRepeatOff(
Display* /* display */
);
extern int XAutoRepeatOn(
Display* /* display */
);
extern int XBell(
Display* /* display */,
int /* percent */
);
extern int XBitmapBitOrder(
Display* /* display */
);
extern int XBitmapPad(
Display* /* display */
);
extern int XBitmapUnit(
Display* /* display */
);
extern int XCellsOfScreen(
Screen* /* screen */
);
extern int XChangeActivePointerGrab(
Display* /* display */,
unsigned int /* event_mask */,
Cursor /* cursor */,
Time /* time */
);
extern int XChangeGC(
Display* /* display */,
GC /* gc */,
unsigned long /* valuemask */,
XGCValues* /* values */
);
extern int XChangeKeyboardControl(
Display* /* display */,
unsigned long /* value_mask */,
XKeyboardControl* /* values */
);
extern int XChangeKeyboardMapping(
Display* /* display */,
int /* first_keycode */,
int /* keysyms_per_keycode */,
KeySym* /* keysyms */,
int /* num_codes */
);
extern int XChangePointerControl(
Display* /* display */,
Bool /* do_accel */,
Bool /* do_threshold */,
int /* accel_numerator */,
int /* accel_denominator */,
int /* threshold */
);
extern int XChangeProperty(
Display* /* display */,
Window /* w */,
Atom /* property */,
Atom /* type */,
int /* format */,
int /* mode */,
_Xconst unsigned char* /* data */,
int /* nelements */
);
extern int XChangeSaveSet(
Display* /* display */,
Window /* w */,
int /* change_mode */
);
extern int XChangeWindowAttributes(
Display* /* display */,
Window /* w */,
unsigned long /* valuemask */,
XSetWindowAttributes* /* attributes */
);
extern Bool XCheckIfEvent(
Display* /* display */,
XEvent* /* event_return */,
Bool (*) (
Display* /* display */,
XEvent* /* event */,
XPointer /* arg */
) /* predicate */,
XPointer /* arg */
);
extern Bool XCheckMaskEvent(
Display* /* display */,
long /* event_mask */,
XEvent* /* event_return */
);
extern Bool XCheckTypedEvent(
Display* /* display */,
int /* event_type */,
XEvent* /* event_return */
);
extern Bool XCheckTypedWindowEvent(
Display* /* display */,
Window /* w */,
int /* event_type */,
XEvent* /* event_return */
);
extern Bool XCheckWindowEvent(
Display* /* display */,
Window /* w */,
long /* event_mask */,
XEvent* /* event_return */
);
extern int XCirculateSubwindows(
Display* /* display */,
Window /* w */,
int /* direction */
);
extern int XCirculateSubwindowsDown(
Display* /* display */,
Window /* w */
);
extern int XCirculateSubwindowsUp(
Display* /* display */,
Window /* w */
);
extern int XClearArea(
Display* /* display */,
Window /* w */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
Bool /* exposures */
);
extern int XClearWindow(
Display* /* display */,
Window /* w */
);
extern int XCloseDisplay(
Display* /* display */
);
extern int XConfigureWindow(
Display* /* display */,
Window /* w */,
unsigned int /* value_mask */,
XWindowChanges* /* values */
);
extern int XConnectionNumber(
Display* /* display */
);
extern int XConvertSelection(
Display* /* display */,
Atom /* selection */,
Atom /* target */,
Atom /* property */,
Window /* requestor */,
Time /* time */
);
extern int XCopyArea(
Display* /* display */,
Drawable /* src */,
Drawable /* dest */,
GC /* gc */,
int /* src_x */,
int /* src_y */,
unsigned int /* width */,
unsigned int /* height */,
int /* dest_x */,
int /* dest_y */
);
extern int XCopyGC(
Display* /* display */,
GC /* src */,
unsigned long /* valuemask */,
GC /* dest */
);
extern int XCopyPlane(
Display* /* display */,
Drawable /* src */,
Drawable /* dest */,
GC /* gc */,
int /* src_x */,
int /* src_y */,
unsigned int /* width */,
unsigned int /* height */,
int /* dest_x */,
int /* dest_y */,
unsigned long /* plane */
);
extern int XDefaultDepth(
Display* /* display */,
int /* screen_number */
);
extern int XDefaultDepthOfScreen(
Screen* /* screen */
);
extern int XDefaultScreen(
Display* /* display */
);
extern int XDefineCursor(
Display* /* display */,
Window /* w */,
Cursor /* cursor */
);
extern int XDeleteProperty(
Display* /* display */,
Window /* w */,
Atom /* property */
);
extern int XDestroyWindow(
Display* /* display */,
Window /* w */
);
extern int XDestroySubwindows(
Display* /* display */,
Window /* w */
);
extern int XDoesBackingStore(
Screen* /* screen */
);
extern Bool XDoesSaveUnders(
Screen* /* screen */
);
extern int XDisableAccessControl(
Display* /* display */
);
extern int XDisplayCells(
Display* /* display */,
int /* screen_number */
);
extern int XDisplayHeight(
Display* /* display */,
int /* screen_number */
);
extern int XDisplayHeightMM(
Display* /* display */,
int /* screen_number */
);
extern int XDisplayKeycodes(
Display* /* display */,
int* /* min_keycodes_return */,
int* /* max_keycodes_return */
);
extern int XDisplayPlanes(
Display* /* display */,
int /* screen_number */
);
extern int XDisplayWidth(
Display* /* display */,
int /* screen_number */
);
extern int XDisplayWidthMM(
Display* /* display */,
int /* screen_number */
);
extern int XDrawArc(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
int /* angle1 */,
int /* angle2 */
);
extern int XDrawArcs(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XArc* /* arcs */,
int /* narcs */
);
extern int XDrawImageString(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst char* /* string */,
int /* length */
);
extern int XDrawImageString16(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst XChar2b* /* string */,
int /* length */
);
extern int XDrawLine(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x1 */,
int /* y1 */,
int /* x2 */,
int /* y2 */
);
extern int XDrawLines(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XPoint* /* points */,
int /* npoints */,
int /* mode */
);
extern int XDrawPoint(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */
);
extern int XDrawPoints(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XPoint* /* points */,
int /* npoints */,
int /* mode */
);
extern int XDrawRectangle(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XDrawRectangles(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XRectangle* /* rectangles */,
int /* nrectangles */
);
extern int XDrawSegments(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XSegment* /* segments */,
int /* nsegments */
);
extern int XDrawString(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst char* /* string */,
int /* length */
);
extern int XDrawString16(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst XChar2b* /* string */,
int /* length */
);
extern int XDrawText(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
XTextItem* /* items */,
int /* nitems */
);
extern int XDrawText16(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
XTextItem16* /* items */,
int /* nitems */
);
extern int XEnableAccessControl(
Display* /* display */
);
extern int XEventsQueued(
Display* /* display */,
int /* mode */
);
extern Status XFetchName(
Display* /* display */,
Window /* w */,
char** /* window_name_return */
);
extern int XFillArc(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
int /* angle1 */,
int /* angle2 */
);
extern int XFillArcs(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XArc* /* arcs */,
int /* narcs */
);
extern int XFillPolygon(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XPoint* /* points */,
int /* npoints */,
int /* shape */,
int /* mode */
);
extern int XFillRectangle(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XFillRectangles(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XRectangle* /* rectangles */,
int /* nrectangles */
);
extern int XFlush(
Display* /* display */
);
extern int XForceScreenSaver(
Display* /* display */,
int /* mode */
);
extern int XFree(
void* /* data */
);
extern int XFreeColormap(
Display* /* display */,
Colormap /* colormap */
);
extern int XFreeColors(
Display* /* display */,
Colormap /* colormap */,
unsigned long* /* pixels */,
int /* npixels */,
unsigned long /* planes */
);
extern int XFreeCursor(
Display* /* display */,
Cursor /* cursor */
);
extern int XFreeExtensionList(
char** /* list */
);
extern int XFreeFont(
Display* /* display */,
XFontStruct* /* font_struct */
);
extern int XFreeFontInfo(
char** /* names */,
XFontStruct* /* free_info */,
int /* actual_count */
);
extern int XFreeFontNames(
char** /* list */
);
extern int XFreeFontPath(
char** /* list */
);
extern int XFreeGC(
Display* /* display */,
GC /* gc */
);
extern int XFreeModifiermap(
XModifierKeymap* /* modmap */
);
extern int XFreePixmap(
Display* /* display */,
Pixmap /* pixmap */
);
extern int XGeometry(
Display* /* display */,
int /* screen */,
_Xconst char* /* position */,
_Xconst char* /* default_position */,
unsigned int /* bwidth */,
unsigned int /* fwidth */,
unsigned int /* fheight */,
int /* xadder */,
int /* yadder */,
int* /* x_return */,
int* /* y_return */,
int* /* width_return */,
int* /* height_return */
);
extern int XGetErrorDatabaseText(
Display* /* display */,
_Xconst char* /* name */,
_Xconst char* /* message */,
_Xconst char* /* default_string */,
char* /* buffer_return */,
int /* length */
);
extern int XGetErrorText(
Display* /* display */,
int /* code */,
char* /* buffer_return */,
int /* length */
);
extern Bool XGetFontProperty(
XFontStruct* /* font_struct */,
Atom /* atom */,
unsigned long* /* value_return */
);
extern Status XGetGCValues(
Display* /* display */,
GC /* gc */,
unsigned long /* valuemask */,
XGCValues* /* values_return */
);
extern Status XGetGeometry(
Display* /* display */,
Drawable /* d */,
Window* /* root_return */,
int* /* x_return */,
int* /* y_return */,
unsigned int* /* width_return */,
unsigned int* /* height_return */,
unsigned int* /* border_width_return */,
unsigned int* /* depth_return */
);
extern Status XGetIconName(
Display* /* display */,
Window /* w */,
char** /* icon_name_return */
);
extern int XGetInputFocus(
Display* /* display */,
Window* /* focus_return */,
int* /* revert_to_return */
);
extern int XGetKeyboardControl(
Display* /* display */,
XKeyboardState* /* values_return */
);
extern int XGetPointerControl(
Display* /* display */,
int* /* accel_numerator_return */,
int* /* accel_denominator_return */,
int* /* threshold_return */
);
extern int XGetPointerMapping(
Display* /* display */,
unsigned char* /* map_return */,
int /* nmap */
);
extern int XGetScreenSaver(
Display* /* display */,
int* /* timeout_return */,
int* /* interval_return */,
int* /* prefer_blanking_return */,
int* /* allow_exposures_return */
);
extern Status XGetTransientForHint(
Display* /* display */,
Window /* w */,
Window* /* prop_window_return */
);
extern int XGetWindowProperty(
Display* /* display */,
Window /* w */,
Atom /* property */,
long /* long_offset */,
long /* long_length */,
Bool /* delete */,
Atom /* req_type */,
Atom* /* actual_type_return */,
int* /* actual_format_return */,
unsigned long* /* nitems_return */,
unsigned long* /* bytes_after_return */,
unsigned char** /* prop_return */
);
extern Status XGetWindowAttributes(
Display* /* display */,
Window /* w */,
XWindowAttributes* /* window_attributes_return */
);
extern int XGrabButton(
Display* /* display */,
unsigned int /* button */,
unsigned int /* modifiers */,
Window /* grab_window */,
Bool /* owner_events */,
unsigned int /* event_mask */,
int /* pointer_mode */,
int /* keyboard_mode */,
Window /* confine_to */,
Cursor /* cursor */
);
extern int XGrabKey(
Display* /* display */,
int /* keycode */,
unsigned int /* modifiers */,
Window /* grab_window */,
Bool /* owner_events */,
int /* pointer_mode */,
int /* keyboard_mode */
);
extern int XGrabKeyboard(
Display* /* display */,
Window /* grab_window */,
Bool /* owner_events */,
int /* pointer_mode */,
int /* keyboard_mode */,
Time /* time */
);
extern int XGrabPointer(
Display* /* display */,
Window /* grab_window */,
Bool /* owner_events */,
unsigned int /* event_mask */,
int /* pointer_mode */,
int /* keyboard_mode */,
Window /* confine_to */,
Cursor /* cursor */,
Time /* time */
);
extern int XGrabServer(
Display* /* display */
);
extern int XHeightMMOfScreen(
Screen* /* screen */
);
extern int XHeightOfScreen(
Screen* /* screen */
);
extern int XIfEvent(
Display* /* display */,
XEvent* /* event_return */,
Bool (*) (
Display* /* display */,
XEvent* /* event */,
XPointer /* arg */
) /* predicate */,
XPointer /* arg */
);
extern int XImageByteOrder(
Display* /* display */
);
extern int XInstallColormap(
Display* /* display */,
Colormap /* colormap */
);
extern KeyCode XKeysymToKeycode(
Display* /* display */,
KeySym /* keysym */
);
extern int XKillClient(
Display* /* display */,
XID /* resource */
);
extern Status XLookupColor(
Display* /* display */,
Colormap /* colormap */,
_Xconst char* /* color_name */,
XColor* /* exact_def_return */,
XColor* /* screen_def_return */
);
extern int XLowerWindow(
Display* /* display */,
Window /* w */
);
extern int XMapRaised(
Display* /* display */,
Window /* w */
);
extern int XMapSubwindows(
Display* /* display */,
Window /* w */
);
extern int XMapWindow(
Display* /* display */,
Window /* w */
);
extern int XMaskEvent(
Display* /* display */,
long /* event_mask */,
XEvent* /* event_return */
);
extern int XMaxCmapsOfScreen(
Screen* /* screen */
);
extern int XMinCmapsOfScreen(
Screen* /* screen */
);
extern int XMoveResizeWindow(
Display* /* display */,
Window /* w */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XMoveWindow(
Display* /* display */,
Window /* w */,
int /* x */,
int /* y */
);
extern int XNextEvent(
Display* /* display */,
XEvent* /* event_return */
);
extern int XNoOp(
Display* /* display */
);
extern Status XParseColor(
Display* /* display */,
Colormap /* colormap */,
_Xconst char* /* spec */,
XColor* /* exact_def_return */
);
extern int XParseGeometry(
_Xconst char* /* parsestring */,
int* /* x_return */,
int* /* y_return */,
unsigned int* /* width_return */,
unsigned int* /* height_return */
);
extern int XPeekEvent(
Display* /* display */,
XEvent* /* event_return */
);
extern int XPeekIfEvent(
Display* /* display */,
XEvent* /* event_return */,
Bool (*) (
Display* /* display */,
XEvent* /* event */,
XPointer /* arg */
) /* predicate */,
XPointer /* arg */
);
extern int XPending(
Display* /* display */
);
extern int XPlanesOfScreen(
Screen* /* screen */
);
extern int XProtocolRevision(
Display* /* display */
);
extern int XProtocolVersion(
Display* /* display */
);
extern int XPutBackEvent(
Display* /* display */,
XEvent* /* event */
);
extern int XPutImage(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
XImage* /* image */,
int /* src_x */,
int /* src_y */,
int /* dest_x */,
int /* dest_y */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XQLength(
Display* /* display */
);
extern Status XQueryBestCursor(
Display* /* display */,
Drawable /* d */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int* /* width_return */,
unsigned int* /* height_return */
);
extern Status XQueryBestSize(
Display* /* display */,
int /* class */,
Drawable /* which_screen */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int* /* width_return */,
unsigned int* /* height_return */
);
extern Status XQueryBestStipple(
Display* /* display */,
Drawable /* which_screen */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int* /* width_return */,
unsigned int* /* height_return */
);
extern Status XQueryBestTile(
Display* /* display */,
Drawable /* which_screen */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int* /* width_return */,
unsigned int* /* height_return */
);
extern int XQueryColor(
Display* /* display */,
Colormap /* colormap */,
XColor* /* def_in_out */
);
extern int XQueryColors(
Display* /* display */,
Colormap /* colormap */,
XColor* /* defs_in_out */,
int /* ncolors */
);
extern Bool XQueryExtension(
Display* /* display */,
_Xconst char* /* name */,
int* /* major_opcode_return */,
int* /* first_event_return */,
int* /* first_error_return */
);
extern int XQueryKeymap(
Display* /* display */,
char [32] /* keys_return */
);
extern Bool XQueryPointer(
Display* /* display */,
Window /* w */,
Window* /* root_return */,
Window* /* child_return */,
int* /* root_x_return */,
int* /* root_y_return */,
int* /* win_x_return */,
int* /* win_y_return */,
unsigned int* /* mask_return */
);
extern int XQueryTextExtents(
Display* /* display */,
XID /* font_ID */,
_Xconst char* /* string */,
int /* nchars */,
int* /* direction_return */,
int* /* font_ascent_return */,
int* /* font_descent_return */,
XCharStruct* /* overall_return */
);
extern int XQueryTextExtents16(
Display* /* display */,
XID /* font_ID */,
_Xconst XChar2b* /* string */,
int /* nchars */,
int* /* direction_return */,
int* /* font_ascent_return */,
int* /* font_descent_return */,
XCharStruct* /* overall_return */
);
extern Status XQueryTree(
Display* /* display */,
Window /* w */,
Window* /* root_return */,
Window* /* parent_return */,
Window** /* children_return */,
unsigned int* /* nchildren_return */
);
extern int XRaiseWindow(
Display* /* display */,
Window /* w */
);
extern int XReadBitmapFile(
Display* /* display */,
Drawable /* d */,
_Xconst char* /* filename */,
unsigned int* /* width_return */,
unsigned int* /* height_return */,
Pixmap* /* bitmap_return */,
int* /* x_hot_return */,
int* /* y_hot_return */
);
extern int XReadBitmapFileData(
_Xconst char* /* filename */,
unsigned int* /* width_return */,
unsigned int* /* height_return */,
unsigned char** /* data_return */,
int* /* x_hot_return */,
int* /* y_hot_return */
);
extern int XRebindKeysym(
Display* /* display */,
KeySym /* keysym */,
KeySym* /* list */,
int /* mod_count */,
_Xconst unsigned char* /* string */,
int /* bytes_string */
);
extern int XRecolorCursor(
Display* /* display */,
Cursor /* cursor */,
XColor* /* foreground_color */,
XColor* /* background_color */
);
extern int XRefreshKeyboardMapping(
XMappingEvent* /* event_map */
);
extern int XRemoveFromSaveSet(
Display* /* display */,
Window /* w */
);
extern int XRemoveHost(
Display* /* display */,
XHostAddress* /* host */
);
extern int XRemoveHosts(
Display* /* display */,
XHostAddress* /* hosts */,
int /* num_hosts */
);
extern int XReparentWindow(
Display* /* display */,
Window /* w */,
Window /* parent */,
int /* x */,
int /* y */
);
extern int XResetScreenSaver(
Display* /* display */
);
extern int XResizeWindow(
Display* /* display */,
Window /* w */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XRestackWindows(
Display* /* display */,
Window* /* windows */,
int /* nwindows */
);
extern int XRotateBuffers(
Display* /* display */,
int /* rotate */
);
extern int XRotateWindowProperties(
Display* /* display */,
Window /* w */,
Atom* /* properties */,
int /* num_prop */,
int /* npositions */
);
extern int XScreenCount(
Display* /* display */
);
extern int XSelectInput(
Display* /* display */,
Window /* w */,
long /* event_mask */
);
extern Status XSendEvent(
Display* /* display */,
Window /* w */,
Bool /* propagate */,
long /* event_mask */,
XEvent* /* event_send */
);
extern int XSetAccessControl(
Display* /* display */,
int /* mode */
);
extern int XSetArcMode(
Display* /* display */,
GC /* gc */,
int /* arc_mode */
);
extern int XSetBackground(
Display* /* display */,
GC /* gc */,
unsigned long /* background */
);
extern int XSetClipMask(
Display* /* display */,
GC /* gc */,
Pixmap /* pixmap */
);
extern int XSetClipOrigin(
Display* /* display */,
GC /* gc */,
int /* clip_x_origin */,
int /* clip_y_origin */
);
extern int XSetClipRectangles(
Display* /* display */,
GC /* gc */,
int /* clip_x_origin */,
int /* clip_y_origin */,
XRectangle* /* rectangles */,
int /* n */,
int /* ordering */
);
extern int XSetCloseDownMode(
Display* /* display */,
int /* close_mode */
);
extern int XSetCommand(
Display* /* display */,
Window /* w */,
char** /* argv */,
int /* argc */
);
extern int XSetDashes(
Display* /* display */,
GC /* gc */,
int /* dash_offset */,
_Xconst char* /* dash_list */,
int /* n */
);
extern int XSetFillRule(
Display* /* display */,
GC /* gc */,
int /* fill_rule */
);
extern int XSetFillStyle(
Display* /* display */,
GC /* gc */,
int /* fill_style */
);
extern int XSetFont(
Display* /* display */,
GC /* gc */,
Font /* font */
);
extern int XSetFontPath(
Display* /* display */,
char** /* directories */,
int /* ndirs */
);
extern int XSetForeground(
Display* /* display */,
GC /* gc */,
unsigned long /* foreground */
);
extern int XSetFunction(
Display* /* display */,
GC /* gc */,
int /* function */
);
extern int XSetGraphicsExposures(
Display* /* display */,
GC /* gc */,
Bool /* graphics_exposures */
);
extern int XSetIconName(
Display* /* display */,
Window /* w */,
_Xconst char* /* icon_name */
);
extern int XSetInputFocus(
Display* /* display */,
Window /* focus */,
int /* revert_to */,
Time /* time */
);
extern int XSetLineAttributes(
Display* /* display */,
GC /* gc */,
unsigned int /* line_width */,
int /* line_style */,
int /* cap_style */,
int /* join_style */
);
extern int XSetModifierMapping(
Display* /* display */,
XModifierKeymap* /* modmap */
);
extern int XSetPlaneMask(
Display* /* display */,
GC /* gc */,
unsigned long /* plane_mask */
);
extern int XSetPointerMapping(
Display* /* display */,
_Xconst unsigned char* /* map */,
int /* nmap */
);
extern int XSetScreenSaver(
Display* /* display */,
int /* timeout */,
int /* interval */,
int /* prefer_blanking */,
int /* allow_exposures */
);
extern int XSetSelectionOwner(
Display* /* display */,
Atom /* selection */,
Window /* owner */,
Time /* time */
);
extern int XSetState(
Display* /* display */,
GC /* gc */,
unsigned long /* foreground */,
unsigned long /* background */,
int /* function */,
unsigned long /* plane_mask */
);
extern int XSetStipple(
Display* /* display */,
GC /* gc */,
Pixmap /* stipple */
);
extern int XSetSubwindowMode(
Display* /* display */,
GC /* gc */,
int /* subwindow_mode */
);
extern int XSetTSOrigin(
Display* /* display */,
GC /* gc */,
int /* ts_x_origin */,
int /* ts_y_origin */
);
extern int XSetTile(
Display* /* display */,
GC /* gc */,
Pixmap /* tile */
);
extern int XSetWindowBackground(
Display* /* display */,
Window /* w */,
unsigned long /* background_pixel */
);
extern int XSetWindowBackgroundPixmap(
Display* /* display */,
Window /* w */,
Pixmap /* background_pixmap */
);
extern int XSetWindowBorder(
Display* /* display */,
Window /* w */,
unsigned long /* border_pixel */
);
extern int XSetWindowBorderPixmap(
Display* /* display */,
Window /* w */,
Pixmap /* border_pixmap */
);
extern int XSetWindowBorderWidth(
Display* /* display */,
Window /* w */,
unsigned int /* width */
);
extern int XSetWindowColormap(
Display* /* display */,
Window /* w */,
Colormap /* colormap */
);
extern int XStoreBuffer(
Display* /* display */,
_Xconst char* /* bytes */,
int /* nbytes */,
int /* buffer */
);
extern int XStoreBytes(
Display* /* display */,
_Xconst char* /* bytes */,
int /* nbytes */
);
extern int XStoreColor(
Display* /* display */,
Colormap /* colormap */,
XColor* /* color */
);
extern int XStoreColors(
Display* /* display */,
Colormap /* colormap */,
XColor* /* color */,
int /* ncolors */
);
extern int XStoreName(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */
);
extern int XStoreNamedColor(
Display* /* display */,
Colormap /* colormap */,
_Xconst char* /* color */,
unsigned long /* pixel */,
int /* flags */
);
extern int XSync(
Display* /* display */,
Bool /* discard */
);
extern int XTextExtents(
XFontStruct* /* font_struct */,
_Xconst char* /* string */,
int /* nchars */,
int* /* direction_return */,
int* /* font_ascent_return */,
int* /* font_descent_return */,
XCharStruct* /* overall_return */
);
extern int XTextExtents16(
XFontStruct* /* font_struct */,
_Xconst XChar2b* /* string */,
int /* nchars */,
int* /* direction_return */,
int* /* font_ascent_return */,
int* /* font_descent_return */,
XCharStruct* /* overall_return */
);
extern int XTextWidth(
XFontStruct* /* font_struct */,
_Xconst char* /* string */,
int /* count */
);
extern int XTextWidth16(
XFontStruct* /* font_struct */,
_Xconst XChar2b* /* string */,
int /* count */
);
extern Bool XTranslateCoordinates(
Display* /* display */,
Window /* src_w */,
Window /* dest_w */,
int /* src_x */,
int /* src_y */,
int* /* dest_x_return */,
int* /* dest_y_return */,
Window* /* child_return */
);
extern int XUndefineCursor(
Display* /* display */,
Window /* w */
);
extern int XUngrabButton(
Display* /* display */,
unsigned int /* button */,
unsigned int /* modifiers */,
Window /* grab_window */
);
extern int XUngrabKey(
Display* /* display */,
int /* keycode */,
unsigned int /* modifiers */,
Window /* grab_window */
);
extern int XUngrabKeyboard(
Display* /* display */,
Time /* time */
);
extern int XUngrabPointer(
Display* /* display */,
Time /* time */
);
extern int XUngrabServer(
Display* /* display */
);
extern int XUninstallColormap(
Display* /* display */,
Colormap /* colormap */
);
extern int XUnloadFont(
Display* /* display */,
Font /* font */
);
extern int XUnmapSubwindows(
Display* /* display */,
Window /* w */
);
extern int XUnmapWindow(
Display* /* display */,
Window /* w */
);
extern int XVendorRelease(
Display* /* display */
);
extern int XWarpPointer(
Display* /* display */,
Window /* src_w */,
Window /* dest_w */,
int /* src_x */,
int /* src_y */,
unsigned int /* src_width */,
unsigned int /* src_height */,
int /* dest_x */,
int /* dest_y */
);
extern int XWidthMMOfScreen(
Screen* /* screen */
);
extern int XWidthOfScreen(
Screen* /* screen */
);
extern int XWindowEvent(
Display* /* display */,
Window /* w */,
long /* event_mask */,
XEvent* /* event_return */
);
extern int XWriteBitmapFile(
Display* /* display */,
_Xconst char* /* filename */,
Pixmap /* bitmap */,
unsigned int /* width */,
unsigned int /* height */,
int /* x_hot */,
int /* y_hot */
);
extern Bool XSupportsLocale (void);
extern char *XSetLocaleModifiers(
const char* /* modifier_list */
);
extern XOM XOpenOM(
Display* /* display */,
struct _XrmHashBucketRec* /* rdb */,
_Xconst char* /* res_name */,
_Xconst char* /* res_class */
);
extern Status XCloseOM(
XOM /* om */
);
extern char *XSetOMValues(
XOM /* om */,
...
) _X_SENTINEL(0);
extern char *XGetOMValues(
XOM /* om */,
...
) _X_SENTINEL(0);
extern Display *XDisplayOfOM(
XOM /* om */
);
extern char *XLocaleOfOM(
XOM /* om */
);
extern XOC XCreateOC(
XOM /* om */,
...
) _X_SENTINEL(0);
extern void XDestroyOC(
XOC /* oc */
);
extern XOM XOMOfOC(
XOC /* oc */
);
extern char *XSetOCValues(
XOC /* oc */,
...
) _X_SENTINEL(0);
extern char *XGetOCValues(
XOC /* oc */,
...
) _X_SENTINEL(0);
extern XFontSet XCreateFontSet(
Display* /* display */,
_Xconst char* /* base_font_name_list */,
char*** /* missing_charset_list */,
int* /* missing_charset_count */,
char** /* def_string */
);
extern void XFreeFontSet(
Display* /* display */,
XFontSet /* font_set */
);
extern int XFontsOfFontSet(
XFontSet /* font_set */,
XFontStruct*** /* font_struct_list */,
char*** /* font_name_list */
);
extern char *XBaseFontNameListOfFontSet(
XFontSet /* font_set */
);
extern char *XLocaleOfFontSet(
XFontSet /* font_set */
);
extern Bool XContextDependentDrawing(
XFontSet /* font_set */
);
extern Bool XDirectionalDependentDrawing(
XFontSet /* font_set */
);
extern Bool XContextualDrawing(
XFontSet /* font_set */
);
extern XFontSetExtents *XExtentsOfFontSet(
XFontSet /* font_set */
);
extern int XmbTextEscapement(
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* bytes_text */
);
extern int XwcTextEscapement(
XFontSet /* font_set */,
_Xconst wchar_t* /* text */,
int /* num_wchars */
);
extern int Xutf8TextEscapement(
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* bytes_text */
);
extern int XmbTextExtents(
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* bytes_text */,
XRectangle* /* overall_ink_return */,
XRectangle* /* overall_logical_return */
);
extern int XwcTextExtents(
XFontSet /* font_set */,
_Xconst wchar_t* /* text */,
int /* num_wchars */,
XRectangle* /* overall_ink_return */,
XRectangle* /* overall_logical_return */
);
extern int Xutf8TextExtents(
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* bytes_text */,
XRectangle* /* overall_ink_return */,
XRectangle* /* overall_logical_return */
);
extern Status XmbTextPerCharExtents(
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* bytes_text */,
XRectangle* /* ink_extents_buffer */,
XRectangle* /* logical_extents_buffer */,
int /* buffer_size */,
int* /* num_chars */,
XRectangle* /* overall_ink_return */,
XRectangle* /* overall_logical_return */
);
extern Status XwcTextPerCharExtents(
XFontSet /* font_set */,
_Xconst wchar_t* /* text */,
int /* num_wchars */,
XRectangle* /* ink_extents_buffer */,
XRectangle* /* logical_extents_buffer */,
int /* buffer_size */,
int* /* num_chars */,
XRectangle* /* overall_ink_return */,
XRectangle* /* overall_logical_return */
);
extern Status Xutf8TextPerCharExtents(
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* bytes_text */,
XRectangle* /* ink_extents_buffer */,
XRectangle* /* logical_extents_buffer */,
int /* buffer_size */,
int* /* num_chars */,
XRectangle* /* overall_ink_return */,
XRectangle* /* overall_logical_return */
);
extern void XmbDrawText(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
XmbTextItem* /* text_items */,
int /* nitems */
);
extern void XwcDrawText(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
XwcTextItem* /* text_items */,
int /* nitems */
);
extern void Xutf8DrawText(
Display* /* display */,
Drawable /* d */,
GC /* gc */,
int /* x */,
int /* y */,
XmbTextItem* /* text_items */,
int /* nitems */
);
extern void XmbDrawString(
Display* /* display */,
Drawable /* d */,
XFontSet /* font_set */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst char* /* text */,
int /* bytes_text */
);
extern void XwcDrawString(
Display* /* display */,
Drawable /* d */,
XFontSet /* font_set */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst wchar_t* /* text */,
int /* num_wchars */
);
extern void Xutf8DrawString(
Display* /* display */,
Drawable /* d */,
XFontSet /* font_set */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst char* /* text */,
int /* bytes_text */
);
extern void XmbDrawImageString(
Display* /* display */,
Drawable /* d */,
XFontSet /* font_set */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst char* /* text */,
int /* bytes_text */
);
extern void XwcDrawImageString(
Display* /* display */,
Drawable /* d */,
XFontSet /* font_set */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst wchar_t* /* text */,
int /* num_wchars */
);
extern void Xutf8DrawImageString(
Display* /* display */,
Drawable /* d */,
XFontSet /* font_set */,
GC /* gc */,
int /* x */,
int /* y */,
_Xconst char* /* text */,
int /* bytes_text */
);
extern XIM XOpenIM(
Display* /* dpy */,
struct _XrmHashBucketRec* /* rdb */,
char* /* res_name */,
char* /* res_class */
);
extern Status XCloseIM(
XIM /* im */
);
extern char *XGetIMValues(
XIM /* im */, ...
) _X_SENTINEL(0);
extern char *XSetIMValues(
XIM /* im */, ...
) _X_SENTINEL(0);
extern Display *XDisplayOfIM(
XIM /* im */
);
extern char *XLocaleOfIM(
XIM /* im*/
);
extern XIC XCreateIC(
XIM /* im */, ...
) _X_SENTINEL(0);
extern void XDestroyIC(
XIC /* ic */
);
extern void XSetICFocus(
XIC /* ic */
);
extern void XUnsetICFocus(
XIC /* ic */
);
extern wchar_t *XwcResetIC(
XIC /* ic */
);
extern char *XmbResetIC(
XIC /* ic */
);
extern char *Xutf8ResetIC(
XIC /* ic */
);
extern char *XSetICValues(
XIC /* ic */, ...
) _X_SENTINEL(0);
extern char *XGetICValues(
XIC /* ic */, ...
) _X_SENTINEL(0);
extern XIM XIMOfIC(
XIC /* ic */
);
extern Bool XFilterEvent(
XEvent* /* event */,
Window /* window */
);
extern int XmbLookupString(
XIC /* ic */,
XKeyPressedEvent* /* event */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
Status* /* status_return */
);
extern int XwcLookupString(
XIC /* ic */,
XKeyPressedEvent* /* event */,
wchar_t* /* buffer_return */,
int /* wchars_buffer */,
KeySym* /* keysym_return */,
Status* /* status_return */
);
extern int Xutf8LookupString(
XIC /* ic */,
XKeyPressedEvent* /* event */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
Status* /* status_return */
);
extern XVaNestedList XVaCreateNestedList(
int /*unused*/, ...
) _X_SENTINEL(0);
/* internal connections for IMs */
extern Bool XRegisterIMInstantiateCallback(
Display* /* dpy */,
struct _XrmHashBucketRec* /* rdb */,
char* /* res_name */,
char* /* res_class */,
XIDProc /* callback */,
XPointer /* client_data */
);
extern Bool XUnregisterIMInstantiateCallback(
Display* /* dpy */,
struct _XrmHashBucketRec* /* rdb */,
char* /* res_name */,
char* /* res_class */,
XIDProc /* callback */,
XPointer /* client_data */
);
typedef void (*XConnectionWatchProc)(
Display* /* dpy */,
XPointer /* client_data */,
int /* fd */,
Bool /* opening */, /* open or close flag */
XPointer* /* watch_data */ /* open sets, close uses */
);
extern Status XInternalConnectionNumbers(
Display* /* dpy */,
int** /* fd_return */,
int* /* count_return */
);
extern void XProcessInternalConnection(
Display* /* dpy */,
int /* fd */
);
extern Status XAddConnectionWatch(
Display* /* dpy */,
XConnectionWatchProc /* callback */,
XPointer /* client_data */
);
extern void XRemoveConnectionWatch(
Display* /* dpy */,
XConnectionWatchProc /* callback */,
XPointer /* client_data */
);
extern void XSetAuthorization(
char * /* name */,
int /* namelen */,
char * /* data */,
int /* datalen */
);
extern int _Xmbtowc(
wchar_t * /* wstr */,
char * /* str */,
int /* len */
);
extern int _Xwctomb(
char * /* str */,
wchar_t /* wc */
);
extern Bool XGetEventData(
Display* /* dpy */,
XGenericEventCookie* /* cookie*/
);
extern void XFreeEventData(
Display* /* dpy */,
XGenericEventCookie* /* cookie*/
);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
_XFUNCPROTOEND
#endif /* _X11_XLIB_H_ */
/*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* Author: Ralph Mor, X Consortium
*/
#ifndef _SM_H_
#define _SM_H_
/*
* Protocol Version
*/
#define SmProtoMajor 1
#define SmProtoMinor 0
/*
* Interact Style
*/
#define SmInteractStyleNone 0
#define SmInteractStyleErrors 1
#define SmInteractStyleAny 2
/*
* Dialog Type
*/
#define SmDialogError 0
#define SmDialogNormal 1
/*
* Save Type
*/
#define SmSaveGlobal 0
#define SmSaveLocal 1
#define SmSaveBoth 2
/*
* Restart Style Hints
*/
#define SmRestartIfRunning 0
#define SmRestartAnyway 1
#define SmRestartImmediately 2
#define SmRestartNever 3
/*
* Property names
*/
#define SmCloneCommand "CloneCommand"
#define SmCurrentDirectory "CurrentDirectory"
#define SmDiscardCommand "DiscardCommand"
#define SmEnvironment "Environment"
#define SmProcessID "ProcessID"
#define SmProgram "Program"
#define SmRestartCommand "RestartCommand"
#define SmResignCommand "ResignCommand"
#define SmRestartStyleHint "RestartStyleHint"
#define SmShutdownCommand "ShutdownCommand"
#define SmUserID "UserID"
/*
* Property types
*/
#define SmCARD8 "CARD8"
#define SmARRAY8 "ARRAY8"
#define SmLISTofARRAY8 "LISTofARRAY8"
/*
* SM minor opcodes
*/
#define SM_Error 0
#define SM_RegisterClient 1
#define SM_RegisterClientReply 2
#define SM_SaveYourself 3
#define SM_SaveYourselfRequest 4
#define SM_InteractRequest 5
#define SM_Interact 6
#define SM_InteractDone 7
#define SM_SaveYourselfDone 8
#define SM_Die 9
#define SM_ShutdownCancelled 10
#define SM_CloseConnection 11
#define SM_SetProperties 12
#define SM_DeleteProperties 13
#define SM_GetProperties 14
#define SM_PropertiesReply 15
#define SM_SaveYourselfPhase2Request 16
#define SM_SaveYourselfPhase2 17
#define SM_SaveComplete 18
#endif /* _SM_H_ */
/*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* Author: Ralph Mor, X Consortium
*/
#ifndef _SMPROTO_H_
#define _SMPROTO_H_
#include <X11/Xmd.h>
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
/* n ARRAY8 previousId */
} smRegisterClientMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
/* n ARRAY8 clientId */
} smRegisterClientReplyMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused1[2];
CARD32 length B32;
CARD8 saveType;
CARD8 shutdown;
CARD8 interactStyle;
CARD8 fast;
CARD8 unused2[4];
} smSaveYourselfMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused1[2];
CARD32 length B32;
CARD8 saveType;
CARD8 shutdown;
CARD8 interactStyle;
CARD8 fast;
CARD8 global;
CARD8 unused2[3];
} smSaveYourselfRequestMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 dialogType;
CARD8 unused;
CARD32 length B32;
} smInteractRequestMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smInteractMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 cancelShutdown;
CARD8 unused;
CARD32 length B32;
} smInteractDoneMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 success;
CARD8 unused;
CARD32 length B32;
} smSaveYourselfDoneMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smDieMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smShutdownCancelledMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
/* b LISTofARRAY8 reasons */
} smCloseConnectionMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
/* a LISTofPROPERTY properties */
} smSetPropertiesMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
/* a LISTofARRAY8 property names */
} smDeletePropertiesMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smGetPropertiesMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
/* a LISTofPROPERTY properties */
} smPropertiesReplyMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smSaveYourselfPhase2RequestMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smSaveYourselfPhase2Msg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused[2];
CARD32 length B32;
} smSaveCompleteMsg;
/*
* SIZEOF values. These better be multiples of 8.
*/
#define sz_smRegisterClientMsg 8
#define sz_smRegisterClientReplyMsg 8
#define sz_smSaveYourselfMsg 16
#define sz_smSaveYourselfRequestMsg 16
#define sz_smInteractRequestMsg 8
#define sz_smInteractMsg 8
#define sz_smInteractDoneMsg 8
#define sz_smSaveYourselfDoneMsg 8
#define sz_smDieMsg 8
#define sz_smShutdownCancelledMsg 8
#define sz_smCloseConnectionMsg 8
#define sz_smSetPropertiesMsg 8
#define sz_smDeletePropertiesMsg 8
#define sz_smGetPropertiesMsg 8
#define sz_smPropertiesReplyMsg 8
#define sz_smSaveYourselfPhase2RequestMsg 8
#define sz_smSaveYourselfPhase2Msg 8
#define sz_smSaveCompleteMsg 8
#endif /* _SMPROTO_H_ */
/*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* Author: Ralph Mor, X Consortium
*/
#ifndef _SMLIB_H_
#define _SMLIB_H_
#include <X11/SM/SM.h>
#include <X11/ICE/ICElib.h>
/*
* Generic SM pointer
*/
typedef IcePointer SmPointer;
/*
* Connection objects. Defined in SMlibint.h
*/
typedef struct _SmcConn *SmcConn;
typedef struct _SmsConn *SmsConn;
/*
* Session Management property
*/
typedef struct {
int length; /* length (in bytes) of the value */
SmPointer value; /* the value */
} SmPropValue;
typedef struct {
char *name; /* name of property */
char *type; /* type of property */
int num_vals; /* number of values in property */
SmPropValue *vals; /* the values */
} SmProp;
/*
* SmcCloseConnection status return
*/
typedef enum {
SmcClosedNow,
SmcClosedASAP,
SmcConnectionInUse
} SmcCloseStatus;
/*
* Client callbacks
*/
typedef void (*SmcSaveYourselfProc) (
SmcConn /* smcConn */,
SmPointer /* clientData */,
int /* saveType */,
Bool /* shutdown */,
int /* interactStyle */,
Bool /* fast */
);
typedef void (*SmcSaveYourselfPhase2Proc) (
SmcConn /* smcConn */,
SmPointer /* clientData */
);
typedef void (*SmcInteractProc) (
SmcConn /* smcConn */,
SmPointer /* clientData */
);
typedef void (*SmcDieProc) (
SmcConn /* smcConn */,
SmPointer /* clientData */
);
typedef void (*SmcShutdownCancelledProc) (
SmcConn /* smcConn */,
SmPointer /* clientData */
);
typedef void (*SmcSaveCompleteProc) (
SmcConn /* smcConn */,
SmPointer /* clientData */
);
typedef void (*SmcPropReplyProc) (
SmcConn /* smcConn */,
SmPointer /* clientData */,
int /* numProps */,
SmProp ** /* props */
);
/*
* Callbacks set up at SmcOpenConnection time
*/
typedef struct {
struct {
SmcSaveYourselfProc callback;
SmPointer client_data;
} save_yourself;
struct {
SmcDieProc callback;
SmPointer client_data;
} die;
struct {
SmcSaveCompleteProc callback;
SmPointer client_data;
} save_complete;
struct {
SmcShutdownCancelledProc callback;
SmPointer client_data;
} shutdown_cancelled;
} SmcCallbacks;
#define SmcSaveYourselfProcMask (1L << 0)
#define SmcDieProcMask (1L << 1)
#define SmcSaveCompleteProcMask (1L << 2)
#define SmcShutdownCancelledProcMask (1L << 3)
/*
* Session manager callbacks
*/
typedef Status (*SmsRegisterClientProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
char * /* previousId */
);
typedef void (*SmsInteractRequestProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
int /* dialogType */
);
typedef void (*SmsInteractDoneProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
Bool /* cancelShutdown */
);
typedef void (*SmsSaveYourselfRequestProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
int /* saveType */,
Bool /* shutdown */,
int /* interactStyle */,
Bool /* fast */,
Bool /* global */
);
typedef void (*SmsSaveYourselfPhase2RequestProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */
);
typedef void (*SmsSaveYourselfDoneProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
Bool /* success */
);
typedef void (*SmsCloseConnectionProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
int /* count */,
char ** /* reasonMsgs */
);
typedef void (*SmsSetPropertiesProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
int /* numProps */,
SmProp ** /* props */
);
typedef void (*SmsDeletePropertiesProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
int /* numProps */,
char ** /* propNames */
);
typedef void (*SmsGetPropertiesProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */
);
/*
* Callbacks set up by a session manager when a new client connects.
*/
typedef struct {
struct {
SmsRegisterClientProc callback;
SmPointer manager_data;
} register_client;
struct {
SmsInteractRequestProc callback;
SmPointer manager_data;
} interact_request;
struct {
SmsInteractDoneProc callback;
SmPointer manager_data;
} interact_done;
struct {
SmsSaveYourselfRequestProc callback;
SmPointer manager_data;
} save_yourself_request;
struct {
SmsSaveYourselfPhase2RequestProc callback;
SmPointer manager_data;
} save_yourself_phase2_request;
struct {
SmsSaveYourselfDoneProc callback;
SmPointer manager_data;
} save_yourself_done;
struct {
SmsCloseConnectionProc callback;
SmPointer manager_data;
} close_connection;
struct {
SmsSetPropertiesProc callback;
SmPointer manager_data;
} set_properties;
struct {
SmsDeletePropertiesProc callback;
SmPointer manager_data;
} delete_properties;
struct {
SmsGetPropertiesProc callback;
SmPointer manager_data;
} get_properties;
} SmsCallbacks;
#define SmsRegisterClientProcMask (1L << 0)
#define SmsInteractRequestProcMask (1L << 1)
#define SmsInteractDoneProcMask (1L << 2)
#define SmsSaveYourselfRequestProcMask (1L << 3)
#define SmsSaveYourselfP2RequestProcMask (1L << 4)
#define SmsSaveYourselfDoneProcMask (1L << 5)
#define SmsCloseConnectionProcMask (1L << 6)
#define SmsSetPropertiesProcMask (1L << 7)
#define SmsDeletePropertiesProcMask (1L << 8)
#define SmsGetPropertiesProcMask (1L << 9)
typedef Status (*SmsNewClientProc) (
SmsConn /* smsConn */,
SmPointer /* managerData */,
unsigned long * /* maskRet */,
SmsCallbacks * /* callbacksRet */,
char ** /* failureReasonRet */
);
/*
* Error handlers
*/
typedef void (*SmcErrorHandler) (
SmcConn /* smcConn */,
Bool /* swap */,
int /* offendingMinorOpcode */,
unsigned long /* offendingSequence */,
int /* errorClass */,
int /* severity */,
SmPointer /* values */
);
typedef void (*SmsErrorHandler) (
SmsConn /* smsConn */,
Bool /* swap */,
int /* offendingMinorOpcode */,
unsigned long /* offendingSequence */,
int /* errorClass */,
int /* severity */,
SmPointer /* values */
);
/*
* Function Prototypes
*/
_XFUNCPROTOBEGIN
extern SmcConn SmcOpenConnection (
char * /* networkIdsList */,
SmPointer /* context */,
int /* xsmpMajorRev */,
int /* xsmpMinorRev */,
unsigned long /* mask */,
SmcCallbacks * /* callbacks */,
const char * /* previousId */,
char ** /* clientIdRet */,
int /* errorLength */,
char * /* errorStringRet */
);
extern SmcCloseStatus SmcCloseConnection (
SmcConn /* smcConn */,
int /* count */,
char ** /* reasonMsgs */
);
extern void SmcModifyCallbacks (
SmcConn /* smcConn */,
unsigned long /* mask */,
SmcCallbacks * /* callbacks */
);
extern void SmcSetProperties (
SmcConn /* smcConn */,
int /* numProps */,
SmProp ** /* props */
);
extern void SmcDeleteProperties (
SmcConn /* smcConn */,
int /* numProps */,
char ** /* propNames */
);
extern Status SmcGetProperties (
SmcConn /* smcConn */,
SmcPropReplyProc /* propReplyProc */,
SmPointer /* clientData */
);
extern Status SmcInteractRequest (
SmcConn /* smcConn */,
int /* dialogType */,
SmcInteractProc /* interactProc */,
SmPointer /* clientData */
);
extern void SmcInteractDone (
SmcConn /* smcConn */,
Bool /* cancelShutdown */
);
extern void SmcRequestSaveYourself (
SmcConn /* smcConn */,
int /* saveType */,
Bool /* shutdown */,
int /* interactStyle */,
Bool /* fast */,
Bool /* global */
);
extern Status SmcRequestSaveYourselfPhase2 (
SmcConn /* smcConn */,
SmcSaveYourselfPhase2Proc /* saveYourselfPhase2Proc */,
SmPointer /* clientData */
);
extern void SmcSaveYourselfDone (
SmcConn /* smcConn */,
Bool /* success */
);
extern int SmcProtocolVersion (
SmcConn /* smcConn */
);
extern int SmcProtocolRevision (
SmcConn /* smcConn */
);
extern char *SmcVendor (
SmcConn /* smcConn */
);
extern char *SmcRelease (
SmcConn /* smcConn */
);
extern char *SmcClientID (
SmcConn /* smcConn */
);
extern IceConn SmcGetIceConnection (
SmcConn /* smcConn */
);
extern Status SmsInitialize (
const char * /* vendor */,
const char * /* release */,
SmsNewClientProc /* newClientProc */,
SmPointer /* managerData */,
IceHostBasedAuthProc /* hostBasedAuthProc */,
int /* errorLength */,
char * /* errorStringRet */
);
extern char *SmsClientHostName (
SmsConn /* smsConn */
);
extern char *SmsGenerateClientID (
SmsConn /* smsConn */
);
extern Status SmsRegisterClientReply (
SmsConn /* smsConn */,
char * /* clientId */
);
extern void SmsSaveYourself (
SmsConn /* smsConn */,
int /* saveType */,
Bool /* shutdown */,
int /* interactStyle */,
Bool /* fast */
);
extern void SmsSaveYourselfPhase2 (
SmsConn /* smsConn */
);
extern void SmsInteract (
SmsConn /* smsConn */
);
extern void SmsDie (
SmsConn /* smsConn */
);
extern void SmsSaveComplete (
SmsConn /* smsConn */
);
extern void SmsShutdownCancelled (
SmsConn /* smsConn */
);
extern void SmsReturnProperties (
SmsConn /* smsConn */,
int /* numProps */,
SmProp ** /* props */
);
extern void SmsCleanUp (
SmsConn /* smsConn */
);
extern int SmsProtocolVersion (
SmsConn /* smsConn */
);
extern int SmsProtocolRevision (
SmsConn /* smsConn */
);
extern char *SmsClientID (
SmsConn /* smsConn */
);
extern IceConn SmsGetIceConnection (
SmsConn /* smsConn */
);
extern SmcErrorHandler SmcSetErrorHandler (
SmcErrorHandler /* handler */
);
extern SmsErrorHandler SmsSetErrorHandler (
SmsErrorHandler /* handler */
);
extern void SmFreeProperty (
SmProp * /* prop */
);
extern void SmFreeReasons (
int /* count */,
char ** /* reasonMsgs */
);
_XFUNCPROTOEND
#endif /* _SMLIB_H_ */
/*
* Copyright 1990, 1991 Network Computing Devices;
* Portions Copyright 1987 by Digital Equipment Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Network Computing Devices or Digital
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
* Network Computing Devices and Digital make no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
* OR DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
*/
/*
Portions Copyright 1987, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* masks & values used by the font lib and the font server
*/
#ifndef _FSMASKS_H_
#define _FSMASKS_H_
#include <X11/Xmd.h>
/* font format macros */
#define BitmapFormatByteOrderMask (1L << 0)
#define BitmapFormatBitOrderMask (1L << 1)
#define BitmapFormatImageRectMask (3L << 2)
#define BitmapFormatScanlinePadMask (3L << 8)
#define BitmapFormatScanlineUnitMask (3L << 12)
#define BitmapFormatByteOrderLSB (0)
#define BitmapFormatByteOrderMSB (1L << 0)
#define BitmapFormatBitOrderLSB (0)
#define BitmapFormatBitOrderMSB (1L << 1)
#define BitmapFormatImageRectMin (0L << 2)
#define BitmapFormatImageRectMaxWidth (1L << 2)
#define BitmapFormatImageRectMax (2L << 2)
#define BitmapFormatScanlinePad8 (0L << 8)
#define BitmapFormatScanlinePad16 (1L << 8)
#define BitmapFormatScanlinePad32 (2L << 8)
#define BitmapFormatScanlinePad64 (3L << 8)
#define BitmapFormatScanlineUnit8 (0L << 12)
#define BitmapFormatScanlineUnit16 (1L << 12)
#define BitmapFormatScanlineUnit32 (2L << 12)
#define BitmapFormatScanlineUnit64 (3L << 12)
#define BitmapFormatMaskByte (1L << 0)
#define BitmapFormatMaskBit (1L << 1)
#define BitmapFormatMaskImageRectangle (1L << 2)
#define BitmapFormatMaskScanLinePad (1L << 3)
#define BitmapFormatMaskScanLineUnit (1L << 4)
typedef CARD32 fsBitmapFormat;
typedef CARD32 fsBitmapFormatMask;
#endif /* _FSMASKS_H_ */
/*
Copyright 1990, 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
* Copyright 1990, 1991 Network Computing Devices;
* Portions Copyright 1987 by Digital Equipment Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Network Computing Devices, or Digital
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
*
* NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES,
* OR DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _FS_PROTO_H_
#define _FS_PROTO_H_
#include <X11/fonts/FS.h>
#define sz_fsPropOffset 20
#define sz_fsPropInfo 8
#define sz_fsResolution 6
#define sz_fsChar2b 2
#define sz_fsChar2b_version1 2
#define sz_fsOffset32 8
#define sz_fsRange 4
#define sz_fsXCharInfo 12
#define sz_fsXFontInfoHeader 40
#define sz_fsConnClientPrefix 8
#define sz_fsConnSetup 12
#define sz_fsConnSetupExtra 8
#define sz_fsConnSetupAccept 12
/* request sizes */
#define sz_fsReq 4
#define sz_fsListExtensionsReq 4
#define sz_fsResourceReq 8
#define sz_fsNoopReq 4
#define sz_fsListExtensionReq 4
#define sz_fsQueryExtensionReq 4
#define sz_fsListCataloguesReq 12
#define sz_fsSetCataloguesReq 4
#define sz_fsGetCataloguesReq 4
#define sz_fsSetEventMaskReq 8
#define sz_fsGetEventMaskReq 4
#define sz_fsCreateACReq 8
#define sz_fsFreeACReq 8
#define sz_fsSetAuthorizationReq 8
#define sz_fsSetResolutionReq 4
#define sz_fsGetResolutionReq 4
#define sz_fsListFontsReq 12
#define sz_fsListFontsWithXInfoReq 12
#define sz_fsOpenBitmapFontReq 16
#define sz_fsQueryXInfoReq 8
#define sz_fsQueryXExtents8Req 12
#define sz_fsQueryXExtents16Req 12
#define sz_fsQueryXBitmaps8Req 16
#define sz_fsQueryXBitmaps16Req 16
#define sz_fsCloseReq 8
/* reply sizes */
#define sz_fsReply 8
#define sz_fsGenericReply 8
#define sz_fsListExtensionsReply 8
#define sz_fsQueryExtensionReply 20
#define sz_fsListCataloguesReply 16
#define sz_fsGetCataloguesReply 8
#define sz_fsGetEventMaskReply 12
#define sz_fsCreateACReply 12
#define sz_fsGetResolutionReply 8
#define sz_fsListFontsReply 16
#define sz_fsListFontsWithXInfoReply (12 + sz_fsXFontInfoHeader)
#define sz_fsOpenBitmapFontReply 16
#define sz_fsQueryXInfoReply (8 + sz_fsXFontInfoHeader)
#define sz_fsQueryXExtents8Reply 12
#define sz_fsQueryXExtents16Reply 12
#define sz_fsQueryXBitmaps8Reply 20
#define sz_fsQueryXBitmaps16Reply 20
#define sz_fsError 16
#define sz_fsEvent 12
#define sz_fsKeepAliveEvent 12
#define fsTrue 1
#define fsFalse 0
/* temp decls */
#define Mask CARD32
#define Font CARD32
#define AccContext CARD32
typedef CARD32 fsTimestamp;
#ifdef NOTDEF /* in fsmasks.h */
typedef CARD32 fsBitmapFormat;
typedef CARD32 fsBitmapFormatMask;
#endif
#define sz_fsBitmapFormat 4
typedef struct {
INT16 left,
right;
INT16 width;
INT16 ascent,
descent;
CARD16 attributes;
} fsXCharInfo;
typedef struct {
CARD8 high;
CARD8 low;
} fsChar2b;
typedef struct {
CARD8 low;
CARD8 high;
} fsChar2b_version1;
typedef struct {
CARD8 min_char_high;
CARD8 min_char_low;
CARD8 max_char_high;
CARD8 max_char_low;
} fsRange;
typedef struct {
CARD32 position;
CARD32 length;
} fsOffset32;
typedef struct {
fsOffset32 name;
fsOffset32 value;
CARD8 type;
BYTE pad0;
CARD16 pad1;
} fsPropOffset;
typedef struct {
CARD32 num_offsets;
CARD32 data_len;
/* offsets */
/* data */
} fsPropInfo;
typedef struct {
CARD16 x_resolution;
CARD16 y_resolution;
CARD16 point_size;
} fsResolution;
typedef struct {
CARD32 flags;
CARD8 char_range_min_char_high;
CARD8 char_range_min_char_low;
CARD8 char_range_max_char_high;
CARD8 char_range_max_char_low;
CARD8 draw_direction;
CARD8 pad;
CARD8 default_char_high;
CARD8 default_char_low;
INT16 min_bounds_left;
INT16 min_bounds_right;
INT16 min_bounds_width;
INT16 min_bounds_ascent;
INT16 min_bounds_descent;
CARD16 min_bounds_attributes;
INT16 max_bounds_left;
INT16 max_bounds_right;
INT16 max_bounds_width;
INT16 max_bounds_ascent;
INT16 max_bounds_descent;
CARD16 max_bounds_attributes;
INT16 font_ascent;
INT16 font_descent;
/* propinfo */
} fsXFontInfoHeader;
/* requests */
typedef struct {
BYTE byteOrder;
CARD8 num_auths;
CARD16 major_version;
CARD16 minor_version;
CARD16 auth_len;
/* auth data */
} fsConnClientPrefix;
typedef struct {
CARD16 status;
CARD16 major_version;
CARD16 minor_version;
CARD8 num_alternates;
CARD8 auth_index;
CARD16 alternate_len;
CARD16 auth_len;
/* alternates */
/* auth data */
} fsConnSetup;
typedef struct {
CARD32 length;
CARD16 status;
CARD16 pad;
/* more auth data */
} fsConnSetupExtra;
typedef struct {
CARD32 length;
CARD16 max_request_len;
CARD16 vendor_len;
CARD32 release_number;
/* vendor string */
} fsConnSetupAccept;
typedef struct {
CARD8 reqType;
CARD8 data;
CARD16 length;
} fsReq;
/*
* The fsFakeReq structure is never used in the protocol; it is prepended
* to incoming packets when setting up a connection so we can index
* through InitialVector. To avoid alignment problems, it is padded
* to the size of a word on the largest machine this code runs on.
* Hence no sz_fsFakeReq constant is necessary.
*/
typedef struct {
CARD8 reqType;
CARD8 data;
CARD16 length;
CARD32 pad; /* to fill out to multiple of 64 bits */
} fsFakeReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Font id;
} fsResourceReq;
typedef fsReq fsNoopReq;
typedef fsReq fsListExtensionsReq;
typedef struct {
CARD8 reqType;
BYTE nbytes;
CARD16 length;
/* name */
} fsQueryExtensionReq;
typedef struct {
CARD8 reqType;
CARD8 data;
CARD16 length;
CARD32 maxNames;
CARD16 nbytes;
CARD16 pad2;
/* pattern */
} fsListCataloguesReq;
typedef struct {
CARD8 reqType;
BYTE num_catalogues;
CARD16 length;
/* catalogues */
} fsSetCataloguesReq;
typedef fsReq fsGetCataloguesReq;
typedef struct {
CARD8 reqType;
CARD8 ext_opcode;
CARD16 length;
Mask event_mask;
} fsSetEventMaskReq;
typedef struct {
CARD8 reqType;
CARD8 ext_opcode;
CARD16 length;
} fsGetEventMaskReq;
typedef struct {
CARD8 reqType;
BYTE num_auths;
CARD16 length;
AccContext acid;
/* auth protocols */
} fsCreateACReq;
typedef fsResourceReq fsFreeACReq;
typedef fsResourceReq fsSetAuthorizationReq;
typedef struct {
CARD8 reqType;
BYTE num_resolutions;
CARD16 length;
/* resolutions */
} fsSetResolutionReq;
typedef fsReq fsGetResolutionReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
CARD32 maxNames;
CARD16 nbytes;
CARD16 pad2;
/* pattern */
} fsListFontsReq;
typedef fsListFontsReq fsListFontsWithXInfoReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Font fid;
fsBitmapFormatMask format_mask;
fsBitmapFormat format_hint;
/* pattern */
} fsOpenBitmapFontReq;
typedef fsResourceReq fsQueryXInfoReq;
typedef struct {
CARD8 reqType;
BOOL range;
CARD16 length;
Font fid;
CARD32 num_ranges;
/* list of chars */
} fsQueryXExtents8Req;
typedef fsQueryXExtents8Req fsQueryXExtents16Req;
typedef struct {
CARD8 reqType;
BOOL range;
CARD16 length;
Font fid;
fsBitmapFormat format;
CARD32 num_ranges;
/* list of chars */
} fsQueryXBitmaps8Req;
typedef fsQueryXBitmaps8Req fsQueryXBitmaps16Req;
typedef fsResourceReq fsCloseReq;
/* replies */
typedef struct {
BYTE type;
BYTE data1;
CARD16 sequenceNumber;
CARD32 length;
} fsGenericReply;
typedef struct {
BYTE type;
CARD8 nExtensions;
CARD16 sequenceNumber;
CARD32 length;
/* extension names */
} fsListExtensionsReply;
typedef struct {
BYTE type;
CARD8 present;
CARD16 sequenceNumber;
CARD32 length;
CARD16 major_version;
CARD16 minor_version;
CARD8 major_opcode;
CARD8 first_event;
CARD8 num_events;
CARD8 first_error;
CARD8 num_errors;
CARD8 pad1;
CARD16 pad2;
} fsQueryExtensionReply;
typedef struct {
BYTE type;
BYTE pad;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_replies;
CARD32 num_catalogues;
/* catalog names */
} fsListCataloguesReply;
typedef struct {
BYTE type;
CARD8 num_catalogues;
CARD16 sequenceNumber;
CARD32 length;
/* catalogue names */
} fsGetCataloguesReply;
typedef struct {
BYTE type;
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 event_mask;
} fsGetEventMaskReply;
typedef struct {
BYTE type;
CARD8 auth_index;
CARD16 sequenceNumber;
CARD32 length;
CARD16 status;
CARD16 pad;
/* auth data */
} fsCreateACReply;
typedef struct {
CARD32 length;
CARD16 status;
CARD16 pad;
/* auth data */
} fsCreateACExtraReply;
typedef struct {
BYTE type;
CARD8 num_resolutions;
CARD16 sequenceNumber;
CARD32 length;
/* resolutions */
} fsGetResolutionReply;
typedef struct {
BYTE type;
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 following;
CARD32 nFonts;
/* font names */
} fsListFontsReply;
/*
* this one is messy. the reply itself is variable length (unknown
* number of replies) and the contents of each is variable (unknown
* number of properties)
*
*/
typedef struct {
BYTE type;
CARD8 nameLength; /* 0 is end-of-reply */
CARD16 sequenceNumber;
CARD32 length;
CARD32 nReplies;
CARD32 font_header_flags;
CARD8 font_hdr_char_range_min_char_high;
CARD8 font_hdr_char_range_min_char_low;
CARD8 font_hdr_char_range_max_char_high;
CARD8 font_hdr_char_range_max_char_low;
CARD8 font_header_draw_direction;
CARD8 font_header_pad;
CARD8 font_header_default_char_high;
CARD8 font_header_default_char_low;
INT16 font_header_min_bounds_left;
INT16 font_header_min_bounds_right;
INT16 font_header_min_bounds_width;
INT16 font_header_min_bounds_ascent;
INT16 font_header_min_bounds_descent;
CARD16 font_header_min_bounds_attributes;
INT16 font_header_max_bounds_left;
INT16 font_header_max_bounds_right;
INT16 font_header_max_bounds_width;
INT16 font_header_max_bounds_ascent;
INT16 font_header_max_bounds_descent;
CARD16 font_header_max_bounds_attributes;
INT16 font_header_font_ascent;
INT16 font_header_font_descent;
/* propinfo */
/* name */
} fsListFontsWithXInfoReply;
typedef struct {
BYTE type;
CARD8 otherid_valid;
CARD16 sequenceNumber;
CARD32 length;
CARD32 otherid;
BYTE cachable;
BYTE pad1;
CARD16 pad2;
} fsOpenBitmapFontReply;
typedef struct {
BYTE type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 font_header_flags;
CARD8 font_hdr_char_range_min_char_high;
CARD8 font_hdr_char_range_min_char_low;
CARD8 font_hdr_char_range_max_char_high;
CARD8 font_hdr_char_range_max_char_low;
CARD8 font_header_draw_direction;
CARD8 font_header_pad;
CARD8 font_header_default_char_high;
CARD8 font_header_default_char_low;
INT16 font_header_min_bounds_left;
INT16 font_header_min_bounds_right;
INT16 font_header_min_bounds_width;
INT16 font_header_min_bounds_ascent;
INT16 font_header_min_bounds_descent;
CARD16 font_header_min_bounds_attributes;
INT16 font_header_max_bounds_left;
INT16 font_header_max_bounds_right;
INT16 font_header_max_bounds_width;
INT16 font_header_max_bounds_ascent;
INT16 font_header_max_bounds_descent;
CARD16 font_header_max_bounds_attributes;
INT16 font_header_font_ascent;
INT16 font_header_font_descent;
/* propinfo */
} fsQueryXInfoReply;
typedef struct {
BYTE type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_extents;
/* extents */
} fsQueryXExtents8Reply;
typedef fsQueryXExtents8Reply fsQueryXExtents16Reply;
typedef struct {
BYTE type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 replies_hint;
CARD32 num_chars;
CARD32 nbytes;
/* offsets */
/* glyphs */
} fsQueryXBitmaps8Reply;
typedef fsQueryXBitmaps8Reply fsQueryXBitmaps16Reply;
typedef union {
fsGenericReply generic;
fsListExtensionsReply extensions;
fsGetResolutionReply getres;
} fsReply;
/* errors */
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
} fsError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
} fsRequestError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
fsBitmapFormat format;
} fsFormatError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
Font fontid;
} fsFontError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
fsRange range;
} fsRangeError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
Mask event_mask;
} fsEventMaskError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
AccContext acid;
} fsAccessContextError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
Font fontid;
} fsIDChoiceError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
} fsNameError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
fsResolution resolution;
} fsResolutionError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
} fsAllocError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
CARD32 bad_length;
} fsLengthError;
typedef struct {
BYTE type;
BYTE request;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
CARD8 major_opcode;
CARD8 minor_opcode;
CARD16 pad;
} fsImplementationError;
/* events */
typedef struct {
BYTE type;
BYTE event_code;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
} fsKeepAliveEvent;
typedef struct {
BYTE type;
BYTE event_code;
CARD16 sequenceNumber;
CARD32 length;
fsTimestamp timestamp;
BOOL added;
BOOL deleted;
CARD16 pad;
} fsCatalogueChangeNotifyEvent;
typedef fsCatalogueChangeNotifyEvent fsFontChangeNotifyEvent;
typedef fsCatalogueChangeNotifyEvent fsEvent;
/* reply codes */
#define FS_Reply 0 /* normal reply */
#define FS_Error 1 /* error */
#define FS_Event 2
/* request codes */
#define FS_Noop 0
#define FS_ListExtensions 1
#define FS_QueryExtension 2
#define FS_ListCatalogues 3
#define FS_SetCatalogues 4
#define FS_GetCatalogues 5
#define FS_SetEventMask 6
#define FS_GetEventMask 7
#define FS_CreateAC 8
#define FS_FreeAC 9
#define FS_SetAuthorization 10
#define FS_SetResolution 11
#define FS_GetResolution 12
#define FS_ListFonts 13
#define FS_ListFontsWithXInfo 14
#define FS_OpenBitmapFont 15
#define FS_QueryXInfo 16
#define FS_QueryXExtents8 17
#define FS_QueryXExtents16 18
#define FS_QueryXBitmaps8 19
#define FS_QueryXBitmaps16 20
#define FS_CloseFont 21
/* restore decls */
#undef Mask
#undef Font
#undef AccContext
#endif /* _FS_PROTO_H_ */
/*
* Copyright 1990, 1991 Network Computing Devices;
* Portions Copyright 1987 by Digital Equipment Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Network Computing Devices or Digital
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
* Network Computing Devices and Digital make no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
* OR DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
*/
/*
Portions Copyright 1987, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _FS_H_
#define _FS_H_
#include <X11/Xdefs.h>
#include <X11/fonts/fsmasks.h>
#define FS_PROTOCOL 2
#define FS_PROTOCOL_MINOR 0
#ifndef X_PROTOCOL
/* protocol familes */
#define FamilyInternet 0
#define FamilyDECnet 1
#define FamilyChaos 2
#define FamilyInternet6 6
typedef unsigned int FSDrawDirection;
#endif
#ifndef None
#define None 0L
#endif
#define LeftToRightDrawDirection 0
#define RightToLeftDrawDirection 1
/* font info flags */
#define FontInfoAllCharsExist (1L << 0)
#define FontInfoInkInside (1L << 1)
#define FontInfoHorizontalOverlap (1L << 2)
/* auth status flags */
#define AuthSuccess 0
#define AuthContinue 1
#define AuthBusy 2
#define AuthDenied 3
/* property types */
#define PropTypeString 0
#define PropTypeUnsigned 1
#define PropTypeSigned 2
#ifndef LSBFirst
/* byte order */
#define LSBFirst 0
#define MSBFirst 1
#endif
/* event masks */
#define CatalogueChangeNotifyMask (1L << 0)
#define FontChangeNotifyMask (1L << 1)
/* errors */
#define FSSuccess -1
#define FSBadRequest 0
#define FSBadFormat 1
#define FSBadFont 2
#define FSBadRange 3
#define FSBadEventMask 4
#define FSBadAccessContext 5
#define FSBadIDChoice 6
#define FSBadName 7
#define FSBadResolution 8
#define FSBadAlloc 9
#define FSBadLength 10
#define FSBadImplementation 11
#define FirstExtensionError 128
#define LastExtensionError 255
/* events */
#define KeepAlive 0
#define CatalogueChangeNotify 1
#define FontChangeNotify 2
#define FSLASTEvent 3
#endif /* _FS_H_ */
/***********************************************************
Copyright (c) 1999 The XFree86 Project Inc.
All Rights Reserved.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The XFree86 Project
Inc. shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from The XFree86 Project Inc..
*/
#ifndef _FONTPROTO_H
#define _FONTPROTO_H
#include <X11/Xfuncproto.h>
/* Externally provided functions required by libXfont */
extern _X_EXPORT int RegisterFPEFunctions (
NameCheckFunc name_func,
InitFpeFunc init_func,
FreeFpeFunc free_func,
ResetFpeFunc reset_func,
OpenFontFunc open_func,
CloseFontFunc close_func,
ListFontsFunc list_func,
StartLfwiFunc start_lfwi_func,
NextLfwiFunc next_lfwi_func,
WakeupFpeFunc wakeup_func,
ClientDiedFunc client_died,
LoadGlyphsFunc load_glyphs,
StartLaFunc start_list_alias_func,
NextLaFunc next_list_alias_func,
SetPathFunc set_path_func);
extern _X_EXPORT int GetDefaultPointSize ( void );
extern _X_EXPORT int init_fs_handlers ( FontPathElementPtr fpe,
BlockHandlerProcPtr block_handler);
extern _X_EXPORT void remove_fs_handlers ( FontPathElementPtr fpe,
BlockHandlerProcPtr block_handler,
Bool all );
extern _X_EXPORT int client_auth_generation ( ClientPtr client );
#ifndef ___CLIENTSIGNAL_DEFINED___
#define ___CLIENTSIGNAL_DEFINED___
extern Bool ClientSignal ( ClientPtr client );
#endif /* ___CLIENTSIGNAL_DEFINED___ */
extern _X_EXPORT void DeleteFontClientID ( Font id );
extern _X_EXPORT Font GetNewFontClientID ( void );
extern _X_EXPORT int StoreFontClientFont ( FontPtr pfont, Font id );
extern _X_EXPORT void FontFileRegisterFpeFunctions ( void );
extern _X_EXPORT void FontFileCheckRegisterFpeFunctions ( void );
extern Bool XpClientIsBitmapClient ( ClientPtr client );
extern Bool XpClientIsPrintClient( ClientPtr client, FontPathElementPtr fpe );
extern void PrinterFontRegisterFpeFunctions ( void );
extern void fs_register_fpe_functions ( void );
extern void check_fs_register_fpe_functions ( void );
/* util/private.c */
extern FontPtr CreateFontRec (void);
extern void DestroyFontRec (FontPtr font);
extern Bool _FontSetNewPrivate (FontPtr /* pFont */,
int /* n */,
void * /* ptr */);
extern int AllocateFontPrivateIndex (void);
extern void ResetFontPrivateIndex (void);
/* Type1/t1funcs.c */
extern void Type1RegisterFontFileFunctions(void);
extern void CIDRegisterFontFileFunctions(void);
/* Speedo/spfuncs.c */
extern void SpeedoRegisterFontFileFunctions(void);
/* FreeType/ftfuncs.c */
extern void FreeTypeRegisterFontFileFunctions(void);
#endif
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef FONTSTR_H
#define FONTSTR_H
#include <X11/Xproto.h>
#include "font.h"
#include <X11/Xfuncproto.h>
#include <X11/Xdefs.h>
/*
* This version of the server font data structure is only for describing
* the in memory data structure. The file structure is not necessarily a
* copy of this. That is up to the compiler and the OS layer font loading
* machinery.
*/
#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */
typedef struct _FontProp {
long name;
long value; /* assumes ATOM is not larger than INT32 */
} FontPropRec;
typedef struct _FontResolution {
unsigned short x_resolution;
unsigned short y_resolution;
unsigned short point_size;
} FontResolutionRec;
typedef struct _ExtentInfo {
DrawDirection drawDirection;
int fontAscent;
int fontDescent;
int overallAscent;
int overallDescent;
int overallWidth;
int overallLeft;
int overallRight;
} ExtentInfoRec;
typedef struct _CharInfo {
xCharInfo metrics; /* info preformatted for Queries */
char *bits; /* pointer to glyph image */
} CharInfoRec;
/*
* Font is created at font load time. It is specific to a single encoding.
* e.g. not all of the glyphs in a font may be part of a single encoding.
*/
typedef struct _FontInfo {
unsigned short firstCol;
unsigned short lastCol;
unsigned short firstRow;
unsigned short lastRow;
unsigned short defaultCh;
unsigned int noOverlap:1;
unsigned int terminalFont:1;
unsigned int constantMetrics:1;
unsigned int constantWidth:1;
unsigned int inkInside:1;
unsigned int inkMetrics:1;
unsigned int allExist:1;
unsigned int drawDirection:2;
unsigned int cachable:1;
unsigned int anamorphic:1;
short maxOverlap;
short pad;
xCharInfo maxbounds;
xCharInfo minbounds;
xCharInfo ink_maxbounds;
xCharInfo ink_minbounds;
short fontAscent;
short fontDescent;
int nprops;
FontPropPtr props;
char *isStringProp;
} FontInfoRec;
typedef struct _Font {
int refcnt;
FontInfoRec info;
char bit;
char byte;
char glyph;
char scan;
fsBitmapFormat format;
int (*get_glyphs) (FontPtr /* font */,
unsigned long /* count */,
unsigned char * /* chars */,
FontEncoding /* encoding */,
unsigned long * /* count */,
CharInfoPtr * /* glyphs */);
int (*get_metrics) (FontPtr /* font */,
unsigned long /* count */,
unsigned char * /* chars */,
FontEncoding /* encoding */,
unsigned long * /* count */,
xCharInfo ** /* glyphs */);
void (*unload_font) (FontPtr /* font */);
void (*unload_glyphs) (FontPtr /* font */);
FontPathElementPtr fpe;
void *svrPrivate;
void *fontPrivate;
void *fpePrivate;
int maxPrivate;
void **devPrivates;
} FontRec;
#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (void *) 0 : \
(pFont)->devPrivates[n])
#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \
_FontSetNewPrivate (pFont, n, ptr) : \
((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE))
typedef struct _FontNames {
int nnames;
int size;
int *length;
char **names;
} FontNamesRec;
/* External view of font paths */
typedef struct _FontPathElement {
int name_length;
#if FONT_PATH_ELEMENT_NAME_CONST
const
#endif
char *name;
int type;
int refcount;
void *private;
} FontPathElementRec;
typedef Bool (*NameCheckFunc) (const char *name);
typedef int (*InitFpeFunc) (FontPathElementPtr fpe);
typedef int (*FreeFpeFunc) (FontPathElementPtr fpe);
typedef int (*ResetFpeFunc) (FontPathElementPtr fpe);
typedef int (*OpenFontFunc) ( void *client,
FontPathElementPtr fpe,
Mask flags,
const char* name,
int namelen,
fsBitmapFormat format,
fsBitmapFormatMask fmask,
XID id,
FontPtr* pFont,
char** aliasName,
FontPtr non_cachable_font);
typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont);
typedef int (*ListFontsFunc) (void *client,
FontPathElementPtr fpe,
const char* pat,
int len,
int max,
FontNamesPtr names);
typedef int (*StartLfwiFunc) (void *client,
FontPathElementPtr fpe,
const char* pat,
int len,
int max,
void ** privatep);
typedef int (*NextLfwiFunc) (void *client,
FontPathElementPtr fpe,
char** name,
int* namelen,
FontInfoPtr* info,
int* numFonts,
void *private);
typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe,
unsigned long* LastSelectMask);
typedef void (*ClientDiedFunc) (void *client,
FontPathElementPtr fpe);
typedef int (*LoadGlyphsFunc) (void *client,
FontPtr pfont,
Bool range_flag,
unsigned int nchars,
int item_size,
unsigned char* data);
typedef int (*StartLaFunc) (void *client,
FontPathElementPtr fpe,
const char* pat,
int len,
int max,
void ** privatep);
typedef int (*NextLaFunc) (void *client,
FontPathElementPtr fpe,
char** namep,
int* namelenp,
char** resolvedp,
int* resolvedlenp,
void *private);
typedef void (*SetPathFunc)(void);
typedef struct _FPEFunctions {
NameCheckFunc name_check;
InitFpeFunc init_fpe;
ResetFpeFunc reset_fpe;
FreeFpeFunc free_fpe;
OpenFontFunc open_font;
CloseFontFunc close_font;
ListFontsFunc list_fonts;
StartLaFunc start_list_fonts_and_aliases;
NextLaFunc list_next_font_or_alias;
StartLfwiFunc start_list_fonts_with_info;
NextLfwiFunc list_next_font_with_info;
WakeupFpeFunc wakeup_fpe;
ClientDiedFunc client_died;
/* for load_glyphs, range_flag = 0 ->
nchars = # of characters in data
item_size = bytes/char
data = list of characters
range_flag = 1 ->
nchars = # of fsChar2b's in data
item_size is ignored
data = list of fsChar2b's */
LoadGlyphsFunc load_glyphs;
SetPathFunc set_path_hook;
} FPEFunctionsRec, FPEFunctions;
/*
* Various macros for computing values based on contents of
* the above structures
*/
#define GLYPHWIDTHPIXELS(pci) \
((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
#define GLYPHHEIGHTPIXELS(pci) \
((pci)->metrics.ascent + (pci)->metrics.descent)
#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7)
#define BYTES_PER_ROW(bits, nbytes) \
((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
:(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
:(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
:(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
: 0)
#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \
BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad))
/*
* Macros for computing different bounding boxes for fonts; from
* the font protocol
*/
#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \
(pi)->fontAscent : (pi)->ink_maxbounds.ascent)
#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \
(pi)->fontDescent : (pi)->ink_maxbounds.descent)
#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi))
#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \
(pi)->ink_minbounds.leftSideBearing : 0)
#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \
(pi)->ink_maxbounds.characterWidth ? \
(pi)->ink_maxbounds.rightSideBearing : \
(pi)->ink_maxbounds.characterWidth)
#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi))
#include "fontproto.h"
#endif /* FONTSTR_H */
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef FONT_H
#define FONT_H
#include <X11/Xfuncproto.h>
#ifndef BitmapFormatByteOrderMask
#include "fsmasks.h"
#endif
/* data structures */
#ifndef _XTYPEDEF_FONTPTR
typedef struct _Font *FontPtr;
#define _XTYPEDEF_FONTPTR
#endif
typedef struct _FontInfo *FontInfoPtr;
typedef struct _FontProp *FontPropPtr;
typedef struct _ExtentInfo *ExtentInfoPtr;
typedef struct _FontPathElement *FontPathElementPtr;
#ifndef _XTYPEDEF_CHARINFOPTR
typedef struct _CharInfo *CharInfoPtr;
#define _XTYPEDEF_CHARINFOPTR
#endif
typedef struct _FontNames *FontNamesPtr;
typedef struct _FontResolution *FontResolutionPtr;
#define NullCharInfo ((CharInfoPtr) 0)
#define NullFont ((FontPtr) 0)
#define NullFontInfo ((FontInfoPtr) 0)
/* draw direction */
#define LeftToRight 0
#define RightToLeft 1
#define BottomToTop 2
#define TopToBottom 3
typedef int DrawDirection;
#define NO_SUCH_CHAR -1
#define FontAliasType 0x1000
#define AllocError 80
#define StillWorking 81
#define FontNameAlias 82
#define BadFontName 83
#define Suspended 84
#define Successful 85
#define BadFontPath 86
#define BadCharRange 87
#define BadFontFormat 88
#define FPEResetFailed 89 /* for when an FPE reset won't work */
/* OpenFont flags */
#define FontLoadInfo 0x0001
#define FontLoadProps 0x0002
#define FontLoadMetrics 0x0004
#define FontLoadBitmaps 0x0008
#define FontLoadAll 0x000f
#define FontOpenSync 0x0010
#define FontReopen 0x0020
/* Query flags */
#define LoadAll 0x1
#define FinishRamge 0x2
#define EightBitFont 0x4
#define SixteenBitFont 0x8
/* Glyph Caching Modes */
#define CACHING_OFF 0
#define CACHE_16_BIT_GLYPHS 1
#define CACHE_ALL_GLYPHS 2
#define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS
extern int glyphCachingMode;
struct _Client;
extern int StartListFontsWithInfo(
struct _Client * /*client*/,
int /*length*/,
unsigned char * /*pattern*/,
int /*max_names*/
);
extern FontNamesPtr MakeFontNamesRecord(
unsigned /* size */
);
extern void FreeFontNames(
FontNamesPtr /* pFN*/
);
extern int AddFontNamesName(
FontNamesPtr /* names */,
char * /* name */,
int /* length */
);
#if 0 /* unused */
extern int FontToFSError();
extern FontResolutionPtr GetClientResolution();
#endif
typedef struct _FontPatternCache *FontPatternCachePtr;
extern FontPatternCachePtr MakeFontPatternCache (
void
);
extern void FreeFontPatternCache (
FontPatternCachePtr /* cache */
);
extern void EmptyFontPatternCache (
FontPatternCachePtr /* cache */
);
extern void CacheFontPattern (
FontPatternCachePtr /* cache */,
const char * /* pattern */,
int /* patlen */,
FontPtr /* pFont */
);
extern _X_EXPORT FontResolutionPtr GetClientResolutions(
int * /* num */
);
extern FontPtr FindCachedFontPattern (
FontPatternCachePtr /* cache */,
const char * /* pattern */,
int /* patlen */
);
extern void RemoveCachedFontPattern (
FontPatternCachePtr /* cache */,
FontPtr /* pFont */
);
typedef enum {
Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
} FontEncoding;
#endif /* FONT_H */
#ifndef _XtShellInternal_h
#define _XtShellInternal_h
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
extern void _XtShellGetCoordinates(Widget widget, Position *x, Position *y);
#endif /* _XtShellInternal_h */
/* Definitions for the X window system used by server and c bindings */
/*
* This packet-construction scheme makes the following assumptions:
*
* 1. The compiler is able
* to generate code which addresses one- and two-byte quantities.
* In the worst case, this would be done with bit-fields. If bit-fields
* are used it may be necessary to reorder the request fields in this file,
* depending on the order in which the machine assigns bit fields to
* machine words. There may also be a problem with sign extension,
* as K+R specify that bitfields are always unsigned.
*
* 2. 2- and 4-byte fields in packet structures must be ordered by hand
* such that they are naturally-aligned, so that no compiler will ever
* insert padding bytes.
*
* 3. All packets are hand-padded to a multiple of 4 bytes, for
* the same reason.
*/
#ifndef XPROTO_H
#define XPROTO_H
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#include <X11/Xmd.h>
#include <X11/Xprotostr.h>
/*
* Define constants for the sizes of the network packets. The sz_ prefix is
* used instead of something more descriptive so that the symbols are no more
* than 32 characters in length (which causes problems for some compilers).
*/
#define sz_xSegment 8
#define sz_xPoint 4
#define sz_xRectangle 8
#define sz_xArc 12
#define sz_xConnClientPrefix 12
#define sz_xConnSetupPrefix 8
#define sz_xConnSetup 32
#define sz_xPixmapFormat 8
#define sz_xDepth 8
#define sz_xVisualType 24
#define sz_xWindowRoot 40
#define sz_xTimecoord 8
#define sz_xHostEntry 4
#define sz_xCharInfo 12
#define sz_xFontProp 8
#define sz_xTextElt 2
#define sz_xColorItem 12
#define sz_xrgb 8
#define sz_xGenericReply 32
#define sz_xGetWindowAttributesReply 44
#define sz_xGetGeometryReply 32
#define sz_xQueryTreeReply 32
#define sz_xInternAtomReply 32
#define sz_xGetAtomNameReply 32
#define sz_xGetPropertyReply 32
#define sz_xListPropertiesReply 32
#define sz_xGetSelectionOwnerReply 32
#define sz_xGrabPointerReply 32
#define sz_xQueryPointerReply 32
#define sz_xGetMotionEventsReply 32
#define sz_xTranslateCoordsReply 32
#define sz_xGetInputFocusReply 32
#define sz_xQueryKeymapReply 40
#define sz_xQueryFontReply 60
#define sz_xQueryTextExtentsReply 32
#define sz_xListFontsReply 32
#define sz_xGetFontPathReply 32
#define sz_xGetImageReply 32
#define sz_xListInstalledColormapsReply 32
#define sz_xAllocColorReply 32
#define sz_xAllocNamedColorReply 32
#define sz_xAllocColorCellsReply 32
#define sz_xAllocColorPlanesReply 32
#define sz_xQueryColorsReply 32
#define sz_xLookupColorReply 32
#define sz_xQueryBestSizeReply 32
#define sz_xQueryExtensionReply 32
#define sz_xListExtensionsReply 32
#define sz_xSetMappingReply 32
#define sz_xGetKeyboardControlReply 52
#define sz_xGetPointerControlReply 32
#define sz_xGetScreenSaverReply 32
#define sz_xListHostsReply 32
#define sz_xSetModifierMappingReply 32
#define sz_xError 32
#define sz_xEvent 32
#define sz_xKeymapEvent 32
#define sz_xReq 4
#define sz_xResourceReq 8
#define sz_xCreateWindowReq 32
#define sz_xChangeWindowAttributesReq 12
#define sz_xChangeSaveSetReq 8
#define sz_xReparentWindowReq 16
#define sz_xConfigureWindowReq 12
#define sz_xCirculateWindowReq 8
#define sz_xInternAtomReq 8
#define sz_xChangePropertyReq 24
#define sz_xDeletePropertyReq 12
#define sz_xGetPropertyReq 24
#define sz_xSetSelectionOwnerReq 16
#define sz_xConvertSelectionReq 24
#define sz_xSendEventReq 44
#define sz_xGrabPointerReq 24
#define sz_xGrabButtonReq 24
#define sz_xUngrabButtonReq 12
#define sz_xChangeActivePointerGrabReq 16
#define sz_xGrabKeyboardReq 16
#define sz_xGrabKeyReq 16
#define sz_xUngrabKeyReq 12
#define sz_xAllowEventsReq 8
#define sz_xGetMotionEventsReq 16
#define sz_xTranslateCoordsReq 16
#define sz_xWarpPointerReq 24
#define sz_xSetInputFocusReq 12
#define sz_xOpenFontReq 12
#define sz_xQueryTextExtentsReq 8
#define sz_xListFontsReq 8
#define sz_xSetFontPathReq 8
#define sz_xCreatePixmapReq 16
#define sz_xCreateGCReq 16
#define sz_xChangeGCReq 12
#define sz_xCopyGCReq 16
#define sz_xSetDashesReq 12
#define sz_xSetClipRectanglesReq 12
#define sz_xCopyAreaReq 28
#define sz_xCopyPlaneReq 32
#define sz_xPolyPointReq 12
#define sz_xPolySegmentReq 12
#define sz_xFillPolyReq 16
#define sz_xPutImageReq 24
#define sz_xGetImageReq 20
#define sz_xPolyTextReq 16
#define sz_xImageTextReq 16
#define sz_xCreateColormapReq 16
#define sz_xCopyColormapAndFreeReq 12
#define sz_xAllocColorReq 16
#define sz_xAllocNamedColorReq 12
#define sz_xAllocColorCellsReq 12
#define sz_xAllocColorPlanesReq 16
#define sz_xFreeColorsReq 12
#define sz_xStoreColorsReq 8
#define sz_xStoreNamedColorReq 16
#define sz_xQueryColorsReq 8
#define sz_xLookupColorReq 12
#define sz_xCreateCursorReq 32
#define sz_xCreateGlyphCursorReq 32
#define sz_xRecolorCursorReq 20
#define sz_xQueryBestSizeReq 12
#define sz_xQueryExtensionReq 8
#define sz_xChangeKeyboardControlReq 8
#define sz_xBellReq 4
#define sz_xChangePointerControlReq 12
#define sz_xSetScreenSaverReq 12
#define sz_xChangeHostsReq 8
#define sz_xListHostsReq 4
#define sz_xChangeModeReq 4
#define sz_xRotatePropertiesReq 12
#define sz_xReply 32
#define sz_xGrabKeyboardReply 32
#define sz_xListFontsWithInfoReply 60
#define sz_xSetPointerMappingReply 32
#define sz_xGetKeyboardMappingReply 32
#define sz_xGetPointerMappingReply 32
#define sz_xGetModifierMappingReply 32
#define sz_xListFontsWithInfoReq 8
#define sz_xPolyLineReq 12
#define sz_xPolyArcReq 12
#define sz_xPolyRectangleReq 12
#define sz_xPolyFillRectangleReq 12
#define sz_xPolyFillArcReq 12
#define sz_xPolyText8Req 16
#define sz_xPolyText16Req 16
#define sz_xImageText8Req 16
#define sz_xImageText16Req 16
#define sz_xSetPointerMappingReq 4
#define sz_xForceScreenSaverReq 4
#define sz_xSetCloseDownModeReq 4
#define sz_xClearAreaReq 16
#define sz_xSetAccessControlReq 4
#define sz_xGetKeyboardMappingReq 8
#define sz_xSetModifierMappingReq 4
#define sz_xPropIconSize 24
#define sz_xChangeKeyboardMappingReq 8
/* For the purpose of the structure definitions in this file,
we must redefine the following types in terms of Xmd.h's types, which may
include bit fields. All of these are #undef'd at the end of this file,
restoring the definitions in X.h. */
#define Window CARD32
#define Drawable CARD32
#define Font CARD32
#define Pixmap CARD32
#define Cursor CARD32
#define Colormap CARD32
#define GContext CARD32
#define Atom CARD32
#define VisualID CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define X_TCP_PORT 6000 /* add display number */
#define xTrue 1
#define xFalse 0
typedef CARD16 KeyButMask;
/*****************
Connection setup structures. See Chapter 8: Connection Setup
of the X Window System Protocol specification for details.
*****************/
/* Client initiates handshake with this data, followed by the strings
* for the auth protocol & data.
*/
typedef struct {
CARD8 byteOrder;
BYTE pad;
CARD16 majorVersion, minorVersion;
CARD16 nbytesAuthProto; /* Authorization protocol */
CARD16 nbytesAuthString; /* Authorization string */
CARD16 pad2;
} xConnClientPrefix;
/* Server response to xConnClientPrefix.
*
* If success == Success, this is followed by xConnSetup and
* numRoots xWindowRoot structs.
*
* If success == Failure, this is followed by a reason string.
*
* The protocol also defines a case of success == Authenticate, but
* that doesn't seem to have ever been implemented by the X Consortium.
*/
typedef struct {
CARD8 success;
BYTE lengthReason; /*num bytes in string following if failure */
CARD16 majorVersion,
minorVersion;
CARD16 length; /* 1/4 additional bytes in setup info */
} xConnSetupPrefix;
typedef struct {
CARD32 release;
CARD32 ridBase,
ridMask;
CARD32 motionBufferSize;
CARD16 nbytesVendor; /* number of bytes in vendor string */
CARD16 maxRequestSize;
CARD8 numRoots; /* number of roots structs to follow */
CARD8 numFormats; /* number of pixmap formats */
CARD8 imageByteOrder; /* LSBFirst, MSBFirst */
CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/
CARD8 bitmapScanlineUnit, /* 8, 16, 32 */
bitmapScanlinePad; /* 8, 16, 32 */
KeyCode minKeyCode, maxKeyCode;
CARD32 pad2;
} xConnSetup;
typedef struct {
CARD8 depth;
CARD8 bitsPerPixel;
CARD8 scanLinePad;
CARD8 pad1;
CARD32 pad2;
} xPixmapFormat;
/* window root */
typedef struct {
CARD8 depth;
CARD8 pad1;
CARD16 nVisuals; /* number of xVisualType structures following */
CARD32 pad2;
} xDepth;
typedef struct {
VisualID visualID;
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 bitsPerRGB;
CARD16 colormapEntries;
CARD32 redMask, greenMask, blueMask;
CARD32 pad;
} xVisualType;
typedef struct {
Window windowId;
Colormap defaultColormap;
CARD32 whitePixel, blackPixel;
CARD32 currentInputMask;
CARD16 pixWidth, pixHeight;
CARD16 mmWidth, mmHeight;
CARD16 minInstalledMaps, maxInstalledMaps;
VisualID rootVisualID;
CARD8 backingStore;
BOOL saveUnders;
CARD8 rootDepth;
CARD8 nDepths; /* number of xDepth structures following */
} xWindowRoot;
/*****************************************************************
* Structure Defns
* Structures needed for replies
*****************************************************************/
/* Used in GetMotionEvents */
typedef struct {
CARD32 time;
INT16 x, y;
} xTimecoord;
typedef struct {
CARD8 family;
BYTE pad;
CARD16 length;
} xHostEntry;
typedef struct {
INT16 leftSideBearing,
rightSideBearing,
characterWidth,
ascent,
descent;
CARD16 attributes;
} xCharInfo;
typedef struct {
Atom name;
CARD32 value;
} xFontProp;
/*
* non-aligned big-endian font ID follows this struct
*/
typedef struct { /* followed by string */
CARD8 len; /* number of *characters* in string, or FontChange (255)
for font change, or 0 if just delta given */
INT8 delta;
} xTextElt;
typedef struct {
CARD32 pixel;
CARD16 red, green, blue;
CARD8 flags; /* DoRed, DoGreen, DoBlue booleans */
CARD8 pad;
} xColorItem;
typedef struct {
CARD16 red, green, blue, pad;
} xrgb;
typedef CARD8 KEYCODE;
/*****************
* XRep:
* meant to be 32 byte quantity
*****************/
/* GenericReply is the common format of all replies. The "data" items
are specific to each individual reply type. */
typedef struct {
BYTE type; /* X_Reply */
BYTE data1; /* depends on reply type */
CARD16 sequenceNumber; /* of last request received by server */
CARD32 length; /* 4 byte quantities beyond size of GenericReply */
CARD32 data00;
CARD32 data01;
CARD32 data02;
CARD32 data03;
CARD32 data04;
CARD32 data05;
} xGenericReply;
/* Individual reply formats. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 backingStore;
CARD16 sequenceNumber;
CARD32 length; /* NOT 0; this is an extra-large reply */
VisualID visualID;
#if defined(__cplusplus) || defined(c_plusplus)
CARD16 c_class;
#else
CARD16 class;
#endif
CARD8 bitGravity;
CARD8 winGravity;
CARD32 backingBitPlanes;
CARD32 backingPixel;
BOOL saveUnder;
BOOL mapInstalled;
CARD8 mapState;
BOOL override;
Colormap colormap;
CARD32 allEventMasks;
CARD32 yourEventMask;
CARD16 doNotPropagateMask;
CARD16 pad;
} xGetWindowAttributesReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 depth;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
Window root;
INT16 x, y;
CARD16 width, height;
CARD16 borderWidth;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
} xGetGeometryReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
Window root, parent;
CARD16 nChildren;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xQueryTreeReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
Atom atom;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xInternAtomReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* of additional bytes */
CARD16 nameLength; /* # of characters in name */
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xGetAtomNameReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 format;
CARD16 sequenceNumber;
CARD32 length; /* of additional bytes */
Atom propertyType;
CARD32 bytesAfter;
CARD32 nItems; /* # of 8, 16, or 32-bit entities in reply */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xGetPropertyReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nProperties;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xListPropertiesReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
Window owner;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetSelectionOwnerReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE status;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGrabPointerReply;
typedef xGrabPointerReply xGrabKeyboardReply;
typedef struct {
BYTE type; /* X_Reply */
BOOL sameScreen;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
Window root, child;
INT16 rootX, rootY, winX, winY;
CARD16 mask;
CARD16 pad1;
CARD32 pad;
} xQueryPointerReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 nEvents;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetMotionEventsReply;
typedef struct {
BYTE type; /* X_Reply */
BOOL sameScreen;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
Window child;
INT16 dstX, dstY;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xTranslateCoordsReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 revertTo;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
Window focus;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xGetInputFocusReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 2, NOT 0; this is an extra-large reply */
BYTE map[32];
} xQueryKeymapReply;
/* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */
typedef struct _xQueryFontReply {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* definitely > 0, even if "nCharInfos" is 0 */
xCharInfo minBounds;
CARD32 walign1;
xCharInfo maxBounds;
CARD32 walign2;
CARD16 minCharOrByte2, maxCharOrByte2;
CARD16 defaultChar;
CARD16 nFontProps; /* followed by this many xFontProp structures */
CARD8 drawDirection;
CARD8 minByte1, maxByte1;
BOOL allCharsExist;
INT16 fontAscent, fontDescent;
CARD32 nCharInfos; /* followed by this many xCharInfo structures */
} xQueryFontReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 drawDirection;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
INT16 fontAscent, fontDescent;
INT16 overallAscent, overallDescent;
INT32 overallWidth, overallLeft, overallRight;
CARD32 pad;
} xQueryTextExtentsReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nFonts;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xListFontsReply;
/* Warning: this MUST match (up to component renaming) xQueryFontReply */
typedef struct {
BYTE type; /* X_Reply */
CARD8 nameLength; /* 0 indicates end-of-reply-sequence */
CARD16 sequenceNumber;
CARD32 length; /* definitely > 0, even if "nameLength" is 0 */
xCharInfo minBounds;
CARD32 walign1;
xCharInfo maxBounds;
CARD32 walign2;
CARD16 minCharOrByte2, maxCharOrByte2;
CARD16 defaultChar;
CARD16 nFontProps; /* followed by this many xFontProp structures */
CARD8 drawDirection;
CARD8 minByte1, maxByte1;
BOOL allCharsExist;
INT16 fontAscent, fontDescent;
CARD32 nReplies; /* hint as to how many more replies might be coming */
} xListFontsWithInfoReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nPaths;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xGetFontPathReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 depth;
CARD16 sequenceNumber;
CARD32 length;
VisualID visual;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xGetImageReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nColormaps;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xListInstalledColormapsReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD16 red, green, blue;
CARD16 pad2;
CARD32 pixel;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xAllocColorReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD32 pixel;
CARD16 exactRed, exactGreen, exactBlue;
CARD16 screenRed, screenGreen, screenBlue;
CARD32 pad2;
CARD32 pad3;
} xAllocNamedColorReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nPixels, nMasks;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xAllocColorCellsReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nPixels;
CARD16 pad2;
CARD32 redMask, greenMask, blueMask;
CARD32 pad3;
CARD32 pad4;
} xAllocColorPlanesReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nColors;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xQueryColorsReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD16 exactRed, exactGreen, exactBlue;
CARD16 screenRed, screenGreen, screenBlue;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xLookupColorReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD16 width, height;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xQueryBestSizeReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
BOOL present;
CARD8 major_opcode;
CARD8 first_event;
CARD8 first_error;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xQueryExtensionReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 nExtensions;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xListExtensionsReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 success;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xSetMappingReply;
typedef xSetMappingReply xSetPointerMappingReply;
typedef xSetMappingReply xSetModifierMappingReply;
typedef struct {
BYTE type; /* X_Reply */
CARD8 nElts; /* how many elements does the map have */
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xGetPointerMappingReply;
typedef struct {
BYTE type;
CARD8 keySymsPerKeyCode;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xGetKeyboardMappingReply;
typedef struct {
BYTE type;
CARD8 numKeyPerModifier;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetModifierMappingReply;
typedef struct {
BYTE type; /* X_Reply */
BOOL globalAutoRepeat;
CARD16 sequenceNumber;
CARD32 length; /* 5 */
CARD32 ledMask;
CARD8 keyClickPercent, bellPercent;
CARD16 bellPitch, bellDuration;
CARD16 pad;
BYTE map[32]; /* bit masks start here */
} xGetKeyboardControlReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD16 accelNumerator, accelDenominator;
CARD16 threshold;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetPointerControlReply;
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD16 timeout, interval;
BOOL preferBlanking;
BOOL allowExposures;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetScreenSaverReply;
typedef struct {
BYTE type; /* X_Reply */
BOOL enabled;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nHosts;
CARD16 pad1;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xListHostsReply;
/*****************************************************************
* Xerror
* All errors are 32 bytes
*****************************************************************/
typedef struct {
BYTE type; /* X_Error */
BYTE errorCode;
CARD16 sequenceNumber; /* the nth request from this client */
CARD32 resourceID;
CARD16 minorCode;
CARD8 majorCode;
BYTE pad1;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xError;
/*****************************************************************
* xEvent
* All events are 32 bytes
*****************************************************************/
typedef struct _xEvent {
union {
struct {
BYTE type;
BYTE detail;
CARD16 sequenceNumber;
} u;
struct {
CARD32 pad00;
Time time;
Window root, event, child;
INT16 rootX, rootY, eventX, eventY;
KeyButMask state;
BOOL sameScreen;
BYTE pad1;
} keyButtonPointer;
struct {
CARD32 pad00;
Time time;
Window root, event, child;
INT16 rootX, rootY, eventX, eventY;
KeyButMask state;
BYTE mode; /* really XMode */
BYTE flags; /* sameScreen and focus booleans, packed together */
#define ELFlagFocus (1<<0)
#define ELFlagSameScreen (1<<1)
} enterLeave;
struct {
CARD32 pad00;
Window window;
BYTE mode; /* really XMode */
BYTE pad1, pad2, pad3;
} focus;
struct {
CARD32 pad00;
Window window;
CARD16 x, y, width, height;
CARD16 count;
CARD16 pad2;
} expose;
struct {
CARD32 pad00;
Drawable drawable;
CARD16 x, y, width, height;
CARD16 minorEvent;
CARD16 count;
BYTE majorEvent;
BYTE pad1, pad2, pad3;
} graphicsExposure;
struct {
CARD32 pad00;
Drawable drawable;
CARD16 minorEvent;
BYTE majorEvent;
BYTE bpad;
} noExposure;
struct {
CARD32 pad00;
Window window;
CARD8 state;
BYTE pad1, pad2, pad3;
} visibility;
struct {
CARD32 pad00;
Window parent, window;
INT16 x, y;
CARD16 width, height, borderWidth;
BOOL override;
BYTE bpad;
} createNotify;
/*
* The event fields in the structures for DestroyNotify, UnmapNotify,
* MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify,
* must be at the same offset because server internal code is depending upon
* this to patch up the events before they are delivered.
* Also note that MapRequest, ConfigureRequest and CirculateRequest have
* the same offset for the event window.
*/
struct {
CARD32 pad00;
Window event, window;
} destroyNotify;
struct {
CARD32 pad00;
Window event, window;
BOOL fromConfigure;
BYTE pad1, pad2, pad3;
} unmapNotify;
struct {
CARD32 pad00;
Window event, window;
BOOL override;
BYTE pad1, pad2, pad3;
} mapNotify;
struct {
CARD32 pad00;
Window parent, window;
} mapRequest;
struct {
CARD32 pad00;
Window event, window, parent;
INT16 x, y;
BOOL override;
BYTE pad1, pad2, pad3;
} reparent;
struct {
CARD32 pad00;
Window event, window, aboveSibling;
INT16 x, y;
CARD16 width, height, borderWidth;
BOOL override;
BYTE bpad;
} configureNotify;
struct {
CARD32 pad00;
Window parent, window, sibling;
INT16 x, y;
CARD16 width, height, borderWidth;
CARD16 valueMask;
CARD32 pad1;
} configureRequest;
struct {
CARD32 pad00;
Window event, window;
INT16 x, y;
CARD32 pad1, pad2, pad3, pad4;
} gravity;
struct {
CARD32 pad00;
Window window;
CARD16 width, height;
} resizeRequest;
struct {
/* The event field in the circulate record is really the parent when this
is used as a CirculateRequest instead of a CirculateNotify */
CARD32 pad00;
Window event, window, parent;
BYTE place; /* Top or Bottom */
BYTE pad1, pad2, pad3;
} circulate;
struct {
CARD32 pad00;
Window window;
Atom atom;
Time time;
BYTE state; /* NewValue or Deleted */
BYTE pad1;
CARD16 pad2;
} property;
struct {
CARD32 pad00;
Time time;
Window window;
Atom atom;
} selectionClear;
struct {
CARD32 pad00;
Time time;
Window owner, requestor;
Atom selection, target, property;
} selectionRequest;
struct {
CARD32 pad00;
Time time;
Window requestor;
Atom selection, target, property;
} selectionNotify;
struct {
CARD32 pad00;
Window window;
Colormap colormap;
#if defined(__cplusplus) || defined(c_plusplus)
BOOL c_new;
#else
BOOL new;
#endif
BYTE state; /* Installed or UnInstalled */
BYTE pad1, pad2;
} colormap;
struct {
CARD32 pad00;
CARD8 request;
KeyCode firstKeyCode;
CARD8 count;
BYTE pad1;
} mappingNotify;
struct {
CARD32 pad00;
Window window;
union {
struct {
Atom type;
INT32 longs0;
INT32 longs1;
INT32 longs2;
INT32 longs3;
INT32 longs4;
} l;
struct {
Atom type;
INT16 shorts0;
INT16 shorts1;
INT16 shorts2;
INT16 shorts3;
INT16 shorts4;
INT16 shorts5;
INT16 shorts6;
INT16 shorts7;
INT16 shorts8;
INT16 shorts9;
} s;
struct {
Atom type;
INT8 bytes[20];
} b;
} u;
} clientMessage;
} u;
} xEvent;
/*********************************************************
*
* Generic event
*
* Those events are not part of the core protocol spec and can be used by
* various extensions.
* type is always GenericEvent
* extension is the minor opcode of the extension the event belongs to.
* evtype is the actual event type, unique __per extension__.
*
* GenericEvents can be longer than 32 bytes, with the length field
* specifying the number of 4 byte blocks after the first 32 bytes.
*
*
*/
typedef struct
{
BYTE type;
CARD8 extension;
CARD16 sequenceNumber;
CARD32 length;
CARD16 evtype;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xGenericEvent;
/* KeymapNotify events are not included in the above union because they
are different from all other events: they do not have a "detail"
or "sequenceNumber", so there is room for a 248-bit key mask. */
typedef struct {
BYTE type;
BYTE map[31];
} xKeymapEvent;
#define XEventSize (sizeof(xEvent))
/* XReply is the union of all the replies above whose "fixed part"
fits in 32 bytes. It does NOT include GetWindowAttributesReply,
QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply
ListFontsWithInfoReply */
typedef union {
xGenericReply generic;
xGetGeometryReply geom;
xQueryTreeReply tree;
xInternAtomReply atom;
xGetAtomNameReply atomName;
xGetPropertyReply property;
xListPropertiesReply listProperties;
xGetSelectionOwnerReply selection;
xGrabPointerReply grabPointer;
xGrabKeyboardReply grabKeyboard;
xQueryPointerReply pointer;
xGetMotionEventsReply motionEvents;
xTranslateCoordsReply coords;
xGetInputFocusReply inputFocus;
xQueryTextExtentsReply textExtents;
xListFontsReply fonts;
xGetFontPathReply fontPath;
xGetImageReply image;
xListInstalledColormapsReply colormaps;
xAllocColorReply allocColor;
xAllocNamedColorReply allocNamedColor;
xAllocColorCellsReply colorCells;
xAllocColorPlanesReply colorPlanes;
xQueryColorsReply colors;
xLookupColorReply lookupColor;
xQueryBestSizeReply bestSize;
xQueryExtensionReply extension;
xListExtensionsReply extensions;
xSetModifierMappingReply setModifierMapping;
xGetModifierMappingReply getModifierMapping;
xSetPointerMappingReply setPointerMapping;
xGetKeyboardMappingReply getKeyboardMapping;
xGetPointerMappingReply getPointerMapping;
xGetPointerControlReply pointerControl;
xGetScreenSaverReply screenSaver;
xListHostsReply hosts;
xError error;
xEvent event;
} xReply;
/*****************************************************************
* REQUESTS
*****************************************************************/
/* Request structure */
typedef struct _xReq {
CARD8 reqType;
CARD8 data; /* meaning depends on request type */
CARD16 length; /* length in 4 bytes quantities
of whole request, including this header */
} xReq;
/*****************************************************************
* structures that follow request.
*****************************************************************/
/* ResourceReq is used for any request which has a resource ID
(or Atom or Time) as its one and only argument. */
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
CARD32 id; /* a Window, Drawable, Font, GContext, Pixmap, etc. */
} xResourceReq;
typedef struct {
CARD8 reqType;
CARD8 depth;
CARD16 length;
Window wid, parent;
INT16 x, y;
CARD16 width, height, borderWidth;
#if defined(__cplusplus) || defined(c_plusplus)
CARD16 c_class;
#else
CARD16 class;
#endif
VisualID visual;
CARD32 mask;
} xCreateWindowReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window window;
CARD32 valueMask;
} xChangeWindowAttributesReq;
typedef struct {
CARD8 reqType;
BYTE mode;
CARD16 length;
Window window;
} xChangeSaveSetReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window window, parent;
INT16 x, y;
} xReparentWindowReq;
typedef struct {
CARD8 reqType;
CARD8 pad;
CARD16 length;
Window window;
CARD16 mask;
CARD16 pad2;
} xConfigureWindowReq;
typedef struct {
CARD8 reqType;
CARD8 direction;
CARD16 length;
Window window;
} xCirculateWindowReq;
typedef struct { /* followed by padded string */
CARD8 reqType;
BOOL onlyIfExists;
CARD16 length;
CARD16 nbytes; /* number of bytes in string */
CARD16 pad;
} xInternAtomReq;
typedef struct {
CARD8 reqType;
CARD8 mode;
CARD16 length;
Window window;
Atom property, type;
CARD8 format;
BYTE pad[3];
CARD32 nUnits; /* length of stuff following, depends on format */
} xChangePropertyReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window window;
Atom property;
} xDeletePropertyReq;
typedef struct {
CARD8 reqType;
#if defined(__cplusplus) || defined(c_plusplus)
BOOL c_delete;
#else
BOOL delete;
#endif
CARD16 length;
Window window;
Atom property, type;
CARD32 longOffset;
CARD32 longLength;
} xGetPropertyReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window window;
Atom selection;
Time time;
} xSetSelectionOwnerReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window requestor;
Atom selection, target, property;
Time time;
} xConvertSelectionReq;
typedef struct {
CARD8 reqType;
BOOL propagate;
CARD16 length;
Window destination;
CARD32 eventMask;
xEvent event;
} xSendEventReq;
typedef struct {
CARD8 reqType;
BOOL ownerEvents;
CARD16 length;
Window grabWindow;
CARD16 eventMask;
BYTE pointerMode, keyboardMode;
Window confineTo;
Cursor cursor;
Time time;
} xGrabPointerReq;
typedef struct {
CARD8 reqType;
BOOL ownerEvents;
CARD16 length;
Window grabWindow;
CARD16 eventMask;
BYTE pointerMode, keyboardMode;
Window confineTo;
Cursor cursor;
CARD8 button;
BYTE pad;
CARD16 modifiers;
} xGrabButtonReq;
typedef struct {
CARD8 reqType;
CARD8 button;
CARD16 length;
Window grabWindow;
CARD16 modifiers;
CARD16 pad;
} xUngrabButtonReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Cursor cursor;
Time time;
CARD16 eventMask;
CARD16 pad2;
} xChangeActivePointerGrabReq;
typedef struct {
CARD8 reqType;
BOOL ownerEvents;
CARD16 length;
Window grabWindow;
Time time;
BYTE pointerMode, keyboardMode;
CARD16 pad;
} xGrabKeyboardReq;
typedef struct {
CARD8 reqType;
BOOL ownerEvents;
CARD16 length;
Window grabWindow;
CARD16 modifiers;
CARD8 key;
BYTE pointerMode, keyboardMode;
BYTE pad1, pad2, pad3;
} xGrabKeyReq;
typedef struct {
CARD8 reqType;
CARD8 key;
CARD16 length;
Window grabWindow;
CARD16 modifiers;
CARD16 pad;
} xUngrabKeyReq;
typedef struct {
CARD8 reqType;
CARD8 mode;
CARD16 length;
Time time;
} xAllowEventsReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window window;
Time start, stop;
} xGetMotionEventsReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window srcWid, dstWid;
INT16 srcX, srcY;
} xTranslateCoordsReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Window srcWid, dstWid;
INT16 srcX, srcY;
CARD16 srcWidth, srcHeight;
INT16 dstX, dstY;
} xWarpPointerReq;
typedef struct {
CARD8 reqType;
CARD8 revertTo;
CARD16 length;
Window focus;
Time time;
} xSetInputFocusReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Font fid;
CARD16 nbytes;
BYTE pad1, pad2; /* string follows on word boundary */
} xOpenFontReq;
typedef struct {
CARD8 reqType;
BOOL oddLength;
CARD16 length;
Font fid;
} xQueryTextExtentsReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
CARD16 maxNames;
CARD16 nbytes; /* followed immediately by string bytes */
} xListFontsReq;
typedef xListFontsReq xListFontsWithInfoReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
CARD16 nFonts;
BYTE pad1, pad2; /* LISTofSTRING8 follows on word boundary */
} xSetFontPathReq;
typedef struct {
CARD8 reqType;
CARD8 depth;
CARD16 length;
Pixmap pid;
Drawable drawable;
CARD16 width, height;
} xCreatePixmapReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
GContext gc;
Drawable drawable;
CARD32 mask;
} xCreateGCReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
GContext gc;
CARD32 mask;
} xChangeGCReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
GContext srcGC, dstGC;
CARD32 mask;
} xCopyGCReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
GContext gc;
CARD16 dashOffset;
CARD16 nDashes; /* length LISTofCARD8 of values following */
} xSetDashesReq;
typedef struct {
CARD8 reqType;
BYTE ordering;
CARD16 length;
GContext gc;
INT16 xOrigin, yOrigin;
} xSetClipRectanglesReq;
typedef struct {
CARD8 reqType;
BOOL exposures;
CARD16 length;
Window window;
INT16 x, y;
CARD16 width, height;
} xClearAreaReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Drawable srcDrawable, dstDrawable;
GContext gc;
INT16 srcX, srcY, dstX, dstY;
CARD16 width, height;
} xCopyAreaReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Drawable srcDrawable, dstDrawable;
GContext gc;
INT16 srcX, srcY, dstX, dstY;
CARD16 width, height;
CARD32 bitPlane;
} xCopyPlaneReq;
typedef struct {
CARD8 reqType;
BYTE coordMode;
CARD16 length;
Drawable drawable;
GContext gc;
} xPolyPointReq;
typedef xPolyPointReq xPolyLineReq; /* same request structure */
/* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Drawable drawable;
GContext gc;
} xPolySegmentReq;
typedef xPolySegmentReq xPolyArcReq;
typedef xPolySegmentReq xPolyRectangleReq;
typedef xPolySegmentReq xPolyFillRectangleReq;
typedef xPolySegmentReq xPolyFillArcReq;
typedef struct _FillPolyReq {
CARD8 reqType;
BYTE pad;
CARD16 length;
Drawable drawable;
GContext gc;
BYTE shape;
BYTE coordMode;
CARD16 pad1;
} xFillPolyReq;
typedef struct _PutImageReq {
CARD8 reqType;
CARD8 format;
CARD16 length;
Drawable drawable;
GContext gc;
CARD16 width, height;
INT16 dstX, dstY;
CARD8 leftPad;
CARD8 depth;
CARD16 pad;
} xPutImageReq;
typedef struct {
CARD8 reqType;
CARD8 format;
CARD16 length;
Drawable drawable;
INT16 x, y;
CARD16 width, height;
CARD32 planeMask;
} xGetImageReq;
/* the following used by PolyText8 and PolyText16 */
typedef struct {
CARD8 reqType;
CARD8 pad;
CARD16 length;
Drawable drawable;
GContext gc;
INT16 x, y; /* items (xTextElt) start after struct */
} xPolyTextReq;
typedef xPolyTextReq xPolyText8Req;
typedef xPolyTextReq xPolyText16Req;
typedef struct {
CARD8 reqType;
BYTE nChars;
CARD16 length;
Drawable drawable;
GContext gc;
INT16 x, y;
} xImageTextReq;
typedef xImageTextReq xImageText8Req;
typedef xImageTextReq xImageText16Req;
typedef struct {
CARD8 reqType;
BYTE alloc;
CARD16 length;
Colormap mid;
Window window;
VisualID visual;
} xCreateColormapReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap mid;
Colormap srcCmap;
} xCopyColormapAndFreeReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap cmap;
CARD16 red, green, blue;
CARD16 pad2;
} xAllocColorReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap cmap;
CARD16 nbytes; /* followed by structure */
BYTE pad1, pad2;
} xAllocNamedColorReq;
typedef struct {
CARD8 reqType;
BOOL contiguous;
CARD16 length;
Colormap cmap;
CARD16 colors, planes;
} xAllocColorCellsReq;
typedef struct {
CARD8 reqType;
BOOL contiguous;
CARD16 length;
Colormap cmap;
CARD16 colors, red, green, blue;
} xAllocColorPlanesReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap cmap;
CARD32 planeMask;
} xFreeColorsReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap cmap;
} xStoreColorsReq;
typedef struct {
CARD8 reqType;
CARD8 flags; /* DoRed, DoGreen, DoBlue, as in xColorItem */
CARD16 length;
Colormap cmap;
CARD32 pixel;
CARD16 nbytes; /* number of name string bytes following structure */
BYTE pad1, pad2;
} xStoreNamedColorReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap cmap;
} xQueryColorsReq;
typedef struct { /* followed by string of length len */
CARD8 reqType;
BYTE pad;
CARD16 length;
Colormap cmap;
CARD16 nbytes; /* number of string bytes following structure*/
BYTE pad1, pad2;
} xLookupColorReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Cursor cid;
Pixmap source, mask;
CARD16 foreRed, foreGreen, foreBlue;
CARD16 backRed, backGreen, backBlue;
CARD16 x, y;
} xCreateCursorReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Cursor cid;
Font source, mask;
CARD16 sourceChar, maskChar;
CARD16 foreRed, foreGreen, foreBlue;
CARD16 backRed, backGreen, backBlue;
} xCreateGlyphCursorReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
Cursor cursor;
CARD16 foreRed, foreGreen, foreBlue;
CARD16 backRed, backGreen, backBlue;
} xRecolorCursorReq;
typedef struct {
CARD8 reqType;
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD16 length;
Drawable drawable;
CARD16 width, height;
} xQueryBestSizeReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
CARD16 nbytes; /* number of string bytes following structure */
BYTE pad1, pad2;
} xQueryExtensionReq;
typedef struct {
CARD8 reqType;
CARD8 numKeyPerModifier;
CARD16 length;
} xSetModifierMappingReq;
typedef struct {
CARD8 reqType;
CARD8 nElts; /* how many elements in the map */
CARD16 length;
} xSetPointerMappingReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
KeyCode firstKeyCode;
CARD8 count;
CARD16 pad1;
} xGetKeyboardMappingReq;
typedef struct {
CARD8 reqType;
CARD8 keyCodes;
CARD16 length;
KeyCode firstKeyCode;
CARD8 keySymsPerKeyCode;
CARD16 pad1;
} xChangeKeyboardMappingReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
CARD32 mask;
} xChangeKeyboardControlReq;
typedef struct {
CARD8 reqType;
INT8 percent; /* -100 to 100 */
CARD16 length;
} xBellReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
INT16 accelNum, accelDenum;
INT16 threshold;
BOOL doAccel, doThresh;
} xChangePointerControlReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
INT16 timeout, interval;
BYTE preferBlank, allowExpose;
CARD16 pad2;
} xSetScreenSaverReq;
typedef struct {
CARD8 reqType;
BYTE mode;
CARD16 length;
CARD8 hostFamily;
BYTE pad;
CARD16 hostLength;
} xChangeHostsReq;
typedef struct {
CARD8 reqType;
BYTE pad;
CARD16 length;
} xListHostsReq;
typedef struct {
CARD8 reqType;
BYTE mode;
CARD16 length;
} xChangeModeReq;
typedef xChangeModeReq xSetAccessControlReq;
typedef xChangeModeReq xSetCloseDownModeReq;
typedef xChangeModeReq xForceScreenSaverReq;
typedef struct { /* followed by LIST of ATOM */
CARD8 reqType;
BYTE pad;
CARD16 length;
Window window;
CARD16 nAtoms;
INT16 nPositions;
} xRotatePropertiesReq;
/* Reply codes */
#define X_Reply 1 /* Normal reply */
#define X_Error 0 /* Error */
/* Request codes */
#define X_CreateWindow 1
#define X_ChangeWindowAttributes 2
#define X_GetWindowAttributes 3
#define X_DestroyWindow 4
#define X_DestroySubwindows 5
#define X_ChangeSaveSet 6
#define X_ReparentWindow 7
#define X_MapWindow 8
#define X_MapSubwindows 9
#define X_UnmapWindow 10
#define X_UnmapSubwindows 11
#define X_ConfigureWindow 12
#define X_CirculateWindow 13
#define X_GetGeometry 14
#define X_QueryTree 15
#define X_InternAtom 16
#define X_GetAtomName 17
#define X_ChangeProperty 18
#define X_DeleteProperty 19
#define X_GetProperty 20
#define X_ListProperties 21
#define X_SetSelectionOwner 22
#define X_GetSelectionOwner 23
#define X_ConvertSelection 24
#define X_SendEvent 25
#define X_GrabPointer 26
#define X_UngrabPointer 27
#define X_GrabButton 28
#define X_UngrabButton 29
#define X_ChangeActivePointerGrab 30
#define X_GrabKeyboard 31
#define X_UngrabKeyboard 32
#define X_GrabKey 33
#define X_UngrabKey 34
#define X_AllowEvents 35
#define X_GrabServer 36
#define X_UngrabServer 37
#define X_QueryPointer 38
#define X_GetMotionEvents 39
#define X_TranslateCoords 40
#define X_WarpPointer 41
#define X_SetInputFocus 42
#define X_GetInputFocus 43
#define X_QueryKeymap 44
#define X_OpenFont 45
#define X_CloseFont 46
#define X_QueryFont 47
#define X_QueryTextExtents 48
#define X_ListFonts 49
#define X_ListFontsWithInfo 50
#define X_SetFontPath 51
#define X_GetFontPath 52
#define X_CreatePixmap 53
#define X_FreePixmap 54
#define X_CreateGC 55
#define X_ChangeGC 56
#define X_CopyGC 57
#define X_SetDashes 58
#define X_SetClipRectangles 59
#define X_FreeGC 60
#define X_ClearArea 61
#define X_CopyArea 62
#define X_CopyPlane 63
#define X_PolyPoint 64
#define X_PolyLine 65
#define X_PolySegment 66
#define X_PolyRectangle 67
#define X_PolyArc 68
#define X_FillPoly 69
#define X_PolyFillRectangle 70
#define X_PolyFillArc 71
#define X_PutImage 72
#define X_GetImage 73
#define X_PolyText8 74
#define X_PolyText16 75
#define X_ImageText8 76
#define X_ImageText16 77
#define X_CreateColormap 78
#define X_FreeColormap 79
#define X_CopyColormapAndFree 80
#define X_InstallColormap 81
#define X_UninstallColormap 82
#define X_ListInstalledColormaps 83
#define X_AllocColor 84
#define X_AllocNamedColor 85
#define X_AllocColorCells 86
#define X_AllocColorPlanes 87
#define X_FreeColors 88
#define X_StoreColors 89
#define X_StoreNamedColor 90
#define X_QueryColors 91
#define X_LookupColor 92
#define X_CreateCursor 93
#define X_CreateGlyphCursor 94
#define X_FreeCursor 95
#define X_RecolorCursor 96
#define X_QueryBestSize 97
#define X_QueryExtension 98
#define X_ListExtensions 99
#define X_ChangeKeyboardMapping 100
#define X_GetKeyboardMapping 101
#define X_ChangeKeyboardControl 102
#define X_GetKeyboardControl 103
#define X_Bell 104
#define X_ChangePointerControl 105
#define X_GetPointerControl 106
#define X_SetScreenSaver 107
#define X_GetScreenSaver 108
#define X_ChangeHosts 109
#define X_ListHosts 110
#define X_SetAccessControl 111
#define X_SetCloseDownMode 112
#define X_KillClient 113
#define X_RotateProperties 114
#define X_ForceScreenSaver 115
#define X_SetPointerMapping 116
#define X_GetPointerMapping 117
#define X_SetModifierMapping 118
#define X_GetModifierMapping 119
#define X_NoOperation 127
/* restore these definitions back to the typedefs in X.h */
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef Atom
#undef VisualID
#undef Time
#undef KeyCode
#undef KeySym
#endif /* XPROTO_H */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _X11_XRESOURCE_H_
#define _X11_XRESOURCE_H_
#ifndef _XP_PRINT_SERVER_
#include <X11/Xlib.h>
#endif
/****************************************************************
****************************************************************
*** ***
*** ***
*** X Resource Manager Intrinsics ***
*** ***
*** ***
****************************************************************
****************************************************************/
_XFUNCPROTOBEGIN
/****************************************************************
*
* Memory Management
*
****************************************************************/
extern char *Xpermalloc(
unsigned int /* size */
);
/****************************************************************
*
* Quark Management
*
****************************************************************/
typedef int XrmQuark, *XrmQuarkList;
#define NULLQUARK ((XrmQuark) 0)
typedef char *XrmString;
#define NULLSTRING ((XrmString) 0)
/* find quark for string, create new quark if none already exists */
extern XrmQuark XrmStringToQuark(
_Xconst char* /* string */
);
extern XrmQuark XrmPermStringToQuark(
_Xconst char* /* string */
);
/* find string for quark */
extern XrmString XrmQuarkToString(
XrmQuark /* quark */
);
extern XrmQuark XrmUniqueQuark(
void
);
#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
/****************************************************************
*
* Conversion of Strings to Lists
*
****************************************************************/
typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
extern void XrmStringToQuarkList(
_Xconst char* /* string */,
XrmQuarkList /* quarks_return */
);
extern void XrmStringToBindingQuarkList(
_Xconst char* /* string */,
XrmBindingList /* bindings_return */,
XrmQuarkList /* quarks_return */
);
/****************************************************************
*
* Name and Class lists.
*
****************************************************************/
typedef XrmQuark XrmName;
typedef XrmQuarkList XrmNameList;
#define XrmNameToString(name) XrmQuarkToString(name)
#define XrmStringToName(string) XrmStringToQuark(string)
#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name)
typedef XrmQuark XrmClass;
typedef XrmQuarkList XrmClassList;
#define XrmClassToString(c_class) XrmQuarkToString(c_class)
#define XrmStringToClass(c_class) XrmStringToQuark(c_class)
#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class)
/****************************************************************
*
* Resource Representation Types and Values
*
****************************************************************/
typedef XrmQuark XrmRepresentation;
#define XrmStringToRepresentation(string) XrmStringToQuark(string)
#define XrmRepresentationToString(type) XrmQuarkToString(type)
typedef struct {
unsigned int size;
XPointer addr;
} XrmValue, *XrmValuePtr;
/****************************************************************
*
* Resource Manager Functions
*
****************************************************************/
typedef struct _XrmHashBucketRec *XrmHashBucket;
typedef XrmHashBucket *XrmHashTable;
typedef XrmHashTable XrmSearchList[];
typedef struct _XrmHashBucketRec *XrmDatabase;
extern void XrmDestroyDatabase(
XrmDatabase /* database */
);
extern void XrmQPutResource(
XrmDatabase* /* database */,
XrmBindingList /* bindings */,
XrmQuarkList /* quarks */,
XrmRepresentation /* type */,
XrmValue* /* value */
);
extern void XrmPutResource(
XrmDatabase* /* database */,
_Xconst char* /* specifier */,
_Xconst char* /* type */,
XrmValue* /* value */
);
extern void XrmQPutStringResource(
XrmDatabase* /* database */,
XrmBindingList /* bindings */,
XrmQuarkList /* quarks */,
_Xconst char* /* value */
);
extern void XrmPutStringResource(
XrmDatabase* /* database */,
_Xconst char* /* specifier */,
_Xconst char* /* value */
);
extern void XrmPutLineResource(
XrmDatabase* /* database */,
_Xconst char* /* line */
);
extern Bool XrmQGetResource(
XrmDatabase /* database */,
XrmNameList /* quark_name */,
XrmClassList /* quark_class */,
XrmRepresentation* /* quark_type_return */,
XrmValue* /* value_return */
);
extern Bool XrmGetResource(
XrmDatabase /* database */,
_Xconst char* /* str_name */,
_Xconst char* /* str_class */,
char** /* str_type_return */,
XrmValue* /* value_return */
);
extern Bool XrmQGetSearchList(
XrmDatabase /* database */,
XrmNameList /* names */,
XrmClassList /* classes */,
XrmSearchList /* list_return */,
int /* list_length */
);
extern Bool XrmQGetSearchResource(
XrmSearchList /* list */,
XrmName /* name */,
XrmClass /* class */,
XrmRepresentation* /* type_return */,
XrmValue* /* value_return */
);
/****************************************************************
*
* Resource Database Management
*
****************************************************************/
#ifndef _XP_PRINT_SERVER_
extern void XrmSetDatabase(
Display* /* display */,
XrmDatabase /* database */
);
extern XrmDatabase XrmGetDatabase(
Display* /* display */
);
#endif /* !_XP_PRINT_SERVER_ */
extern XrmDatabase XrmGetFileDatabase(
_Xconst char* /* filename */
);
extern Status XrmCombineFileDatabase(
_Xconst char* /* filename */,
XrmDatabase* /* target */,
Bool /* override */
);
extern XrmDatabase XrmGetStringDatabase(
_Xconst char* /* data */ /* null terminated string */
);
extern void XrmPutFileDatabase(
XrmDatabase /* database */,
_Xconst char* /* filename */
);
extern void XrmMergeDatabases(
XrmDatabase /* source_db */,
XrmDatabase* /* target_db */
);
extern void XrmCombineDatabase(
XrmDatabase /* source_db */,
XrmDatabase* /* target_db */,
Bool /* override */
);
#define XrmEnumAllLevels 0
#define XrmEnumOneLevel 1
extern Bool XrmEnumerateDatabase(
XrmDatabase /* db */,
XrmNameList /* name_prefix */,
XrmClassList /* class_prefix */,
int /* mode */,
Bool (*)(
XrmDatabase* /* db */,
XrmBindingList /* bindings */,
XrmQuarkList /* quarks */,
XrmRepresentation* /* type */,
XrmValue* /* value */,
XPointer /* closure */
) /* proc */,
XPointer /* closure */
);
extern const char *XrmLocaleOfDatabase(
XrmDatabase /* database */
);
/****************************************************************
*
* Command line option mapping to resource entries
*
****************************************************************/
typedef enum {
XrmoptionNoArg, /* Value is specified in OptionDescRec.value */
XrmoptionIsArg, /* Value is the option string itself */
XrmoptionStickyArg, /* Value is characters immediately following option */
XrmoptionSepArg, /* Value is next argument in argv */
XrmoptionResArg, /* Resource and value in next argument in argv */
XrmoptionSkipArg, /* Ignore this option and the next argument in argv */
XrmoptionSkipLine, /* Ignore this option and the rest of argv */
XrmoptionSkipNArgs /* Ignore this option and the next
OptionDescRes.value arguments in argv */
} XrmOptionKind;
typedef struct {
char *option; /* Option abbreviation in argv */
char *specifier; /* Resource specifier */
XrmOptionKind argKind; /* Which style of option it is */
XPointer value; /* Value to provide if XrmoptionNoArg */
} XrmOptionDescRec, *XrmOptionDescList;
extern void XrmParseCommand(
XrmDatabase* /* database */,
XrmOptionDescList /* table */,
int /* table_count */,
_Xconst char* /* name */,
int* /* argc_in_out */,
char** /* argv_in_out */
);
_XFUNCPROTOEND
#endif /* _X11_XRESOURCE_H_ */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* DEC private keysyms
* (29th bit set)
*/
/* two-key compose sequence initiators, chosen to map to Latin1 characters */
#define DXK_ring_accent 0x1000FEB0
#define DXK_circumflex_accent 0x1000FE5E
#define DXK_cedilla_accent 0x1000FE2C
#define DXK_acute_accent 0x1000FE27
#define DXK_grave_accent 0x1000FE60
#define DXK_tilde 0x1000FE7E
#define DXK_diaeresis 0x1000FE22
/* special keysym for LK2** "Remove" key on editing keypad */
#define DXK_Remove 0x1000FF00 /* Remove */
#ifndef _XtcreateI_h
#define _XtcreateI_h
_XFUNCPROTOBEGIN
extern Widget _XtCreateWidget(String name, WidgetClass widget_class,
Widget parent, ArgList args, Cardinal num_args,
XtTypedArgList typed_args,
Cardinal num_typed_args);
extern Widget _XtCreatePopupShell(String name, WidgetClass widget_class,
Widget parent, ArgList args,
Cardinal num_args, XtTypedArgList typed_args,
Cardinal num_typed_args);
extern Widget _XtAppCreateShell(String name, String class,
WidgetClass widget_class, Display *display,
ArgList args, Cardinal num_args,
XtTypedArgList typed_args,
Cardinal num_typed_args);
extern Widget _XtCreateHookObj(Screen *screen);
_XFUNCPROTOEND
#include <stdarg.h>
_XFUNCPROTOBEGIN
/* VarCreate.c */
extern Widget _XtVaOpenApplication(XtAppContext *app_context_return,
_Xconst char* application_class,
XrmOptionDescList options, Cardinal num_options,
int *argc_in_out, String *argv_in_out,
String *fallback_resources, WidgetClass widget_class,
va_list var_args);
extern Widget _XtVaAppInitialize(XtAppContext *app_context_return,
_Xconst char* application_class,
XrmOptionDescList options, Cardinal num_options,
int *argc_in_out, String *argv_in_out,
String *fallback_resources, va_list var_args);
_XFUNCPROTOEND
#endif /* _XtcreateI_h */
/*
Copyright 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _X11_XLOCALE_H_
#define _X11_XLOCALE_H_
#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>
#include <locale.h>
#endif /* _X11_XLOCALE_H_ */
#ifndef _XW32DEFS_H
# define _XW32DEFS_H
# ifdef __GNUC__ /* mingw is more close to unix than msvc */
# if !defined(__daddr_t_defined)
typedef char *caddr_t;
# endif
# define lstat stat
# else
typedef char *caddr_t;
# define access _access
# define alloca _alloca
# define chdir _chdir
# define chmod _chmod
# define close _close
# define creat _creat
# define dup _dup
# define dup2 _dup2
# define environ _environ
# define execl _execl
# define execle _execle
# define execlp _execlp
# define execlpe _execlpe
# define execv _execv
# define execve _execve
# define execvp _execvp
# define execvpe _execvpe
# define fdopen _fdopen
# define fileno _fileno
# define fstat _fstat
# define getcwd _getcwd
# define getpid _getpid
# define hypot _hypot
# define isascii __isascii
# define isatty _isatty
# define lseek _lseek
# define mkdir _mkdir
# define mktemp _mktemp
# define open _open
# define putenv _putenv
# define read _read
# define rmdir _rmdir
# define sleep(x) Sleep((x) * 1000)
# define stat _stat
# define sys_errlist _sys_errlist
# define sys_nerr _sys_nerr
# define umask _umask
# define unlink _unlink
# define write _write
# define random rand
# define srandom srand
# define O_RDONLY _O_RDONLY
# define O_WRONLY _O_WRONLY
# define O_RDWR _O_RDWR
# define O_APPEND _O_APPEND
# define O_CREAT _O_CREAT
# define O_TRUNC _O_TRUNC
# define O_EXCL _O_EXCL
# define O_TEXT _O_TEXT
# define O_BINARY _O_BINARY
# define O_RAW _O_BINARY
# define S_IFMT _S_IFMT
# define S_IFDIR _S_IFDIR
# define S_IFCHR _S_IFCHR
# define S_IFREG _S_IFREG
# define S_IREAD _S_IREAD
# define S_IWRITE _S_IWRITE
# define S_IEXEC _S_IEXEC
# define F_OK 0
# define X_OK 1
# define W_OK 2
# define R_OK 4
# endif /* __GNUC__ */
#endif
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtselectionI_h
#define _XtselectionI_h
#include "Intrinsic.h"
typedef struct _RequestRec *Request;
typedef struct _SelectRec *Select;
typedef struct _RequestRec {
Select ctx; /* logical owner */
Widget widget; /* widget actually receiving Selection events */
Window requestor;
Atom property;
Atom target;
Atom type;
int format;
XtPointer value;
unsigned long bytelength;
unsigned long offset;
XtIntervalId timeout;
XSelectionRequestEvent event; /* for XtGetSelectionRequest */
Boolean allSent;
} RequestRec;
typedef struct {
Atom prop;
Boolean avail;
} SelectionPropRec, *SelectionProp;
typedef struct {
Display *dpy;
Atom incr_atom, indirect_atom, timestamp_atom;
int propCount;
SelectionProp list;
} PropListRec, *PropList;
typedef struct _SelectRec {
Atom selection; /* constant */
Display *dpy; /* constant */
Widget widget;
Time time;
unsigned long serial;
XtConvertSelectionProc convert;
XtLoseSelectionProc loses;
XtSelectionDoneProc notify;
XtCancelConvertSelectionProc owner_cancel;
XtPointer owner_closure;
PropList prop_list;
Request req; /* state for local non-incr xfer */
int ref_count; /* of active transfers */
unsigned int incremental:1;
unsigned int free_when_done:1;
unsigned int was_disowned:1;
} SelectRec;
typedef struct _ParamRec {
Atom selection;
Atom param;
} ParamRec, *Param;
typedef struct _ParamInfoRec {
unsigned int count;
Param paramlist;
} ParamInfoRec, *ParamInfo;
typedef struct _QueuedRequestRec {
Atom selection;
Atom target;
Atom param;
XtSelectionCallbackProc callback;
XtPointer closure;
Time time;
Boolean incremental;
} QueuedRequestRec, *QueuedRequest;
typedef struct _QueuedRequestInfoRec {
int count;
Atom *selections;
QueuedRequest *requests;
} QueuedRequestInfoRec, *QueuedRequestInfo;
typedef struct {
XtSelectionCallbackProc *callbacks;
XtPointer *req_closure;
Atom property;
Atom *target;
Atom type;
int format;
char *value;
int bytelength;
int offset;
XtIntervalId timeout;
XtEventHandler proc;
Widget widget;
Time time;
Select ctx;
Boolean *incremental;
int current;
} CallBackInfoRec, *CallBackInfo;
typedef struct {
Atom target;
Atom property;
} IndirectPair;
#define IndirectPairWordSize 2
typedef struct {
int active_transfer_count;
} RequestWindowRec;
#define MAX_SELECTION_INCR(dpy) (((65536 < XMaxRequestSize(dpy)) ? \
(65536 << 2) : (XMaxRequestSize(dpy) << 2))-100)
#define MATCH_SELECT(event, info) ((event->time == info->time) && \
(event->requestor == XtWindow(info->widget)) && \
(event->selection == info->ctx->selection) && \
(event->target == *info->target))
#endif /* _XtselectionI_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _X11_CURSORFONT_H_
#define _X11_CURSORFONT_H_
#define XC_num_glyphs 154
#define XC_X_cursor 0
#define XC_arrow 2
#define XC_based_arrow_down 4
#define XC_based_arrow_up 6
#define XC_boat 8
#define XC_bogosity 10
#define XC_bottom_left_corner 12
#define XC_bottom_right_corner 14
#define XC_bottom_side 16
#define XC_bottom_tee 18
#define XC_box_spiral 20
#define XC_center_ptr 22
#define XC_circle 24
#define XC_clock 26
#define XC_coffee_mug 28
#define XC_cross 30
#define XC_cross_reverse 32
#define XC_crosshair 34
#define XC_diamond_cross 36
#define XC_dot 38
#define XC_dotbox 40
#define XC_double_arrow 42
#define XC_draft_large 44
#define XC_draft_small 46
#define XC_draped_box 48
#define XC_exchange 50
#define XC_fleur 52
#define XC_gobbler 54
#define XC_gumby 56
#define XC_hand1 58
#define XC_hand2 60
#define XC_heart 62
#define XC_icon 64
#define XC_iron_cross 66
#define XC_left_ptr 68
#define XC_left_side 70
#define XC_left_tee 72
#define XC_leftbutton 74
#define XC_ll_angle 76
#define XC_lr_angle 78
#define XC_man 80
#define XC_middlebutton 82
#define XC_mouse 84
#define XC_pencil 86
#define XC_pirate 88
#define XC_plus 90
#define XC_question_arrow 92
#define XC_right_ptr 94
#define XC_right_side 96
#define XC_right_tee 98
#define XC_rightbutton 100
#define XC_rtl_logo 102
#define XC_sailboat 104
#define XC_sb_down_arrow 106
#define XC_sb_h_double_arrow 108
#define XC_sb_left_arrow 110
#define XC_sb_right_arrow 112
#define XC_sb_up_arrow 114
#define XC_sb_v_double_arrow 116
#define XC_shuttle 118
#define XC_sizing 120
#define XC_spider 122
#define XC_spraycan 124
#define XC_star 126
#define XC_target 128
#define XC_tcross 130
#define XC_top_left_arrow 132
#define XC_top_left_corner 134
#define XC_top_right_corner 136
#define XC_top_side 138
#define XC_top_tee 140
#define XC_trek 142
#define XC_ul_angle 144
#define XC_umbrella 146
#define XC_ur_angle 148
#define XC_watch 150
#define XC_xterm 152
#endif /* _X11_CURSORFONT_H_ */
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
* software and its documentation for any purpose and without fee, provided
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, 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 THE PERFORMANCE OF THIS SOFTWARE.
*
*
* DESCRIPTION
* Public include file for X Color Management System
*/
#ifndef _X11_XCMS_H_
#define _X11_XCMS_H_
#include <X11/Xlib.h>
/* The Xcms structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
/*
* XCMS Status Values
*/
#define XcmsFailure 0
#define XcmsSuccess 1
#define XcmsSuccessWithCompression 2
/*
* Color Space Format ID's
* Color Space ID's are of XcmsColorFormat type.
*
* bit 31
* 0 == Device-Independent
* 1 == Device-Dependent
*
* bit 30:
* 0 == Registered with X Consortium
* 1 == Unregistered
*/
#define XcmsUndefinedFormat (XcmsColorFormat)0x00000000
#define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001
#define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002
#define XcmsCIExyYFormat (XcmsColorFormat)0x00000003
#define XcmsCIELabFormat (XcmsColorFormat)0x00000004
#define XcmsCIELuvFormat (XcmsColorFormat)0x00000005
#define XcmsTekHVCFormat (XcmsColorFormat)0x00000006
#define XcmsRGBFormat (XcmsColorFormat)0x80000000
#define XcmsRGBiFormat (XcmsColorFormat)0x80000001
/*
* State of XcmsPerScrnInfo
*/
#define XcmsInitNone 0x00 /* no initialization attempted */
#define XcmsInitSuccess 0x01 /* initialization successful */
#define XcmsInitFailure 0xff /* failure, use defaults */
#define DisplayOfCCC(ccc) ((ccc)->dpy)
#define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber)
#define VisualOfCCC(ccc) ((ccc)->visual)
#define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt)
#define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt)
#define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet)
typedef unsigned long XcmsColorFormat; /* Color Space Format ID */
typedef double XcmsFloat;
/*
* Device RGB
*/
typedef struct {
unsigned short red; /* scaled from 0x0000 to 0xffff */
unsigned short green; /* scaled from 0x0000 to 0xffff */
unsigned short blue; /* scaled from 0x0000 to 0xffff */
} XcmsRGB;
/*
* RGB Intensity
*/
typedef struct {
XcmsFloat red; /* 0.0 - 1.0 */
XcmsFloat green; /* 0.0 - 1.0 */
XcmsFloat blue; /* 0.0 - 1.0 */
} XcmsRGBi;
/*
* CIE XYZ
*/
typedef struct {
XcmsFloat X;
XcmsFloat Y;
XcmsFloat Z;
} XcmsCIEXYZ;
/*
* CIE u'v'Y
*/
typedef struct {
XcmsFloat u_prime; /* 0.0 - 1.0 */
XcmsFloat v_prime; /* 0.0 - 1.0 */
XcmsFloat Y; /* 0.0 - 1.0 */
} XcmsCIEuvY;
/*
* CIE xyY
*/
typedef struct {
XcmsFloat x; /* 0.0 - 1.0 */
XcmsFloat y; /* 0.0 - 1.0 */
XcmsFloat Y; /* 0.0 - 1.0 */
} XcmsCIExyY;
/*
* CIE L*a*b*
*/
typedef struct {
XcmsFloat L_star; /* 0.0 - 100.0 */
XcmsFloat a_star;
XcmsFloat b_star;
} XcmsCIELab;
/*
* CIE L*u*v*
*/
typedef struct {
XcmsFloat L_star; /* 0.0 - 100.0 */
XcmsFloat u_star;
XcmsFloat v_star;
} XcmsCIELuv;
/*
* TekHVC
*/
typedef struct {
XcmsFloat H; /* 0.0 - 360.0 */
XcmsFloat V; /* 0.0 - 100.0 */
XcmsFloat C; /* 0.0 - 100.0 */
} XcmsTekHVC;
/*
* PAD
*/
typedef struct {
XcmsFloat pad0;
XcmsFloat pad1;
XcmsFloat pad2;
XcmsFloat pad3;
} XcmsPad;
/*
* XCMS Color Structure
*/
typedef struct {
union {
XcmsRGB RGB;
XcmsRGBi RGBi;
XcmsCIEXYZ CIEXYZ;
XcmsCIEuvY CIEuvY;
XcmsCIExyY CIExyY;
XcmsCIELab CIELab;
XcmsCIELuv CIELuv;
XcmsTekHVC TekHVC;
XcmsPad Pad;
} spec; /* the color specification */
unsigned long pixel; /* pixel value (as needed) */
XcmsColorFormat format; /* the specification format */
} XcmsColor;
/*
* XCMS Per Screen related data
*/
typedef struct _XcmsPerScrnInfo {
XcmsColor screenWhitePt; /* Screen White point */
XPointer functionSet; /* pointer to Screen Color Characterization */
/* Function Set structure */
XPointer screenData; /* pointer to corresponding Screen Color*/
/* Characterization Data */
unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */
char pad[3];
} XcmsPerScrnInfo;
typedef struct _XcmsCCC *XcmsCCC;
typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */
XcmsCCC /* ccc */,
XcmsColor* /* initial_white_point*/,
XcmsColor* /* target_white_point*/,
XcmsColorFormat /* target_format */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
/*
* XCMS Color Conversion Context
*/
typedef struct _XcmsCCC {
Display *dpy; /* X Display */
int screenNumber; /* X screen number */
Visual *visual; /* X Visual */
XcmsColor clientWhitePt; /* Client White Point */
XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */
XPointer gamutCompClientData; /* Gamut Comp Func Client Data */
XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */
XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */
XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */
/* associated with the above display */
/* screenNumber */
} XcmsCCCRec;
typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */
Display* /* dpy */,
int /* screen_number */,
XcmsPerScrnInfo* /* screen_info */
);
typedef void (*XcmsScreenFreeProc)(
XPointer /* screenData */
);
/*
* Function List Pointer -- pointer to an array of function pointers.
* The end of list is indicated by a NULL pointer.
*/
/*
* XXX: The use of the XcmsConversionProc type is broken. The
* device-independent colour conversion code uses it as:
typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *,
unsigned int);
* while the device-dependent code uses it as:
typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int,
Bool *);
* Until this is reworked, it's probably best to leave it unprotoized.
* The code works regardless.
*/
typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */
XcmsCCC /* ccc */,
XcmsColor* /* pcolors_in_out */,
unsigned int /* ncolors */,
Bool* /* pCompressed */
);
typedef Status (*XcmsDIConversionProc)( /* using device-independent version */
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* pcolors_in_out */,
unsigned int /* ncolors */
);
typedef XcmsDIConversionProc XcmsConversionProc;
typedef XcmsConversionProc *XcmsFuncListPtr;
typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */
char* /* color_string */,
XcmsColor* /* color_return */
);
/*
* Color Space -- per Color Space related data (Device-Independent
* or Device-Dependent)
*/
typedef struct _XcmsColorSpace {
const char *prefix; /* Prefix of string format. */
XcmsColorFormat id; /* Format ID number. */
XcmsParseStringProc parseString;
/* String format parsing function */
XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */
/* pointers such that when the */
/* functions are executed in sequence */
/* will convert a XcmsColor structure */
/* from this color space to CIEXYZ */
/* space. */
XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */
/* pointers such that when the */
/* functions are executed in sequence */
/* will convert a XcmsColor structure */
/* from CIEXYZ space to this color */
/* space. */
int inverse_flag; /* If 1, indicates that for 0 <= i < n */
/* where n is the number of function */
/* pointers in the lists to_CIEXYZ */
/* and from_CIEXYZ; for each function */
/* to_CIEXYZ[i] its inverse function */
/* is from_CIEXYZ[n - i]. */
} XcmsColorSpace;
/*
* Screen Color Characterization Function Set -- per device class
* color space conversion functions.
*/
typedef struct _XcmsFunctionSet {
XcmsColorSpace **DDColorSpaces;
/* Pointer to an array of pointers to */
/* Device-DEPENDENT color spaces */
/* understood by this SCCFuncSet. */
XcmsScreenInitProc screenInitProc;
/* Screen initialization function that */
/* reads Screen Color Characterization*/
/* Data off properties on the screen's*/
/* root window. */
XcmsScreenFreeProc screenFreeProc;
/* Function that frees the SCCData */
/* structures. */
} XcmsFunctionSet;
_XFUNCPROTOBEGIN
extern Status XcmsAddColorSpace (
XcmsColorSpace* /* pColorSpace */
);
extern Status XcmsAddFunctionSet (
XcmsFunctionSet* /* functionSet */
);
extern Status XcmsAllocColor (
Display* /* dpy */,
Colormap /* colormap */,
XcmsColor* /* color_in_out */,
XcmsColorFormat /* result_format */
);
extern Status XcmsAllocNamedColor (
Display* /* dpy */,
Colormap /* colormap */,
_Xconst char* /* color_string */,
XcmsColor* /* color_scrn_return */,
XcmsColor* /* color_exact_return */,
XcmsColorFormat /* result_format */
);
extern XcmsCCC XcmsCCCOfColormap (
Display* /* dpy */,
Colormap /* colormap */
);
extern Status XcmsCIELabClipab(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELabClipL(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELabClipLab(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELabQueryMaxC (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsFloat /* L_star */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELabQueryMaxL (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsFloat /* chroma */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELabQueryMaxLC (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELabQueryMinL (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsFloat /* chroma */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELabToCIEXYZ (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIELabWhiteShiftColors(
XcmsCCC /* ccc */,
XcmsColor* /* initial_white_point*/,
XcmsColor* /* target_white_point*/,
XcmsColorFormat /* target_format */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELuvClipL(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELuvClipLuv(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELuvClipuv(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIELuvQueryMaxC (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsFloat /* L_star */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELuvQueryMaxL (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsFloat /* chroma */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELuvQueryMaxLC (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELuvQueryMinL (
XcmsCCC /* ccc */,
XcmsFloat /* hue_angle */,
XcmsFloat /* chroma */,
XcmsColor* /* color_return */
);
extern Status XcmsCIELuvToCIEuvY (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIELuvWhiteShiftColors(
XcmsCCC /* ccc */,
XcmsColor* /* initial_white_point*/,
XcmsColor* /* target_white_point*/,
XcmsColorFormat /* target_format */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIEXYZToCIELab (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIEXYZToCIEuvY (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIEXYZToCIExyY (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIEXYZToRGBi (
XcmsCCC /* ccc */,
XcmsColor* /* colors */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern Status XcmsCIEuvYToCIELuv (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIEuvYToCIEXYZ (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIEuvYToTekHVC (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsCIExyYToCIEXYZ (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern XcmsColor *XcmsClientWhitePointOfCCC (
XcmsCCC /* ccc */
);
extern Status XcmsConvertColors (
XcmsCCC /* ccc */,
XcmsColor* /* colorArry_in_out */,
unsigned int /* nColors */,
XcmsColorFormat /* targetFormat */,
Bool* /* compArry_return */
);
extern XcmsCCC XcmsCreateCCC (
Display* /* dpy */,
int /* screenNumber */,
Visual* /* visual */,
XcmsColor* /* clientWhitePt */,
XcmsCompressionProc /* gamutCompProc */,
XPointer /* gamutCompClientData */,
XcmsWhiteAdjustProc /* whitePtAdjProc */,
XPointer /* whitePtAdjClientData */
);
extern XcmsCCC XcmsDefaultCCC (
Display* /* dpy */,
int /* screenNumber */
);
extern Display *XcmsDisplayOfCCC (
XcmsCCC /* ccc */
);
extern XcmsColorFormat XcmsFormatOfPrefix (
char* /* prefix */
);
extern void XcmsFreeCCC (
XcmsCCC /* ccc */
);
extern Status XcmsLookupColor (
Display* /* dpy */,
Colormap /* colormap */,
_Xconst char* /* color_string */,
XcmsColor* /* pColor_exact_in_out */,
XcmsColor* /* pColor_scrn_in_out */,
XcmsColorFormat /* result_format */
);
extern char *XcmsPrefixOfFormat (
XcmsColorFormat /* id */
);
extern Status XcmsQueryBlack (
XcmsCCC /* ccc */,
XcmsColorFormat /* target_format */,
XcmsColor* /* color_return */
);
extern Status XcmsQueryBlue (
XcmsCCC /* ccc */,
XcmsColorFormat /* target_format */,
XcmsColor* /* color_return */
);
extern Status XcmsQueryColor (
Display* /* dpy */,
Colormap /* colormap */,
XcmsColor* /* pColor_in_out */,
XcmsColorFormat /* result_format */
);
extern Status XcmsQueryColors (
Display* /* dpy */,
Colormap /* colormap */,
XcmsColor* /* colorArry_in_out */,
unsigned int /* nColors */,
XcmsColorFormat /* result_format */
);
extern Status XcmsQueryGreen (
XcmsCCC /* ccc */,
XcmsColorFormat /* target_format */,
XcmsColor* /* color_return */
);
extern Status XcmsQueryRed (
XcmsCCC /* ccc */,
XcmsColorFormat /* target_format */,
XcmsColor* /* color_return */
);
extern Status XcmsQueryWhite (
XcmsCCC /* ccc */,
XcmsColorFormat /* target_format */,
XcmsColor* /* color_return */
);
extern Status XcmsRGBiToCIEXYZ (
XcmsCCC /* ccc */,
XcmsColor* /* colors */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern Status XcmsRGBiToRGB (
XcmsCCC /* ccc */,
XcmsColor* /* colors */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern Status XcmsRGBToRGBi (
XcmsCCC /* ccc */,
XcmsColor* /* colors */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern int XcmsScreenNumberOfCCC (
XcmsCCC /* ccc */
);
extern XcmsColor *XcmsScreenWhitePointOfCCC (
XcmsCCC /* ccc */
);
extern XcmsCCC XcmsSetCCCOfColormap(
Display* /* dpy */,
Colormap /* colormap */,
XcmsCCC /* ccc */
);
extern XcmsCompressionProc XcmsSetCompressionProc (
XcmsCCC /* ccc */,
XcmsCompressionProc /* compression_proc */,
XPointer /* client_data */
);
extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc (
XcmsCCC /* ccc */,
XcmsWhiteAdjustProc /* white_adjust_proc */,
XPointer /* client_data */
);
extern Status XcmsSetWhitePoint (
XcmsCCC /* ccc */,
XcmsColor* /* color */
);
extern Status XcmsStoreColor (
Display* /* dpy */,
Colormap /* colormap */,
XcmsColor* /* pColor_in */
);
extern Status XcmsStoreColors (
Display* /* dpy */,
Colormap /* colormap */,
XcmsColor* /* colorArry_in */,
unsigned int /* nColors */,
Bool* /* compArry_return */
);
extern Status XcmsTekHVCClipC(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsTekHVCClipV(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsTekHVCClipVC(
XcmsCCC /* ccc */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
unsigned int /* index */,
Bool* /* compression_flags_return */
);
extern Status XcmsTekHVCQueryMaxC (
XcmsCCC /* ccc */,
XcmsFloat /* hue */,
XcmsFloat /* value */,
XcmsColor* /* color_return */
);
extern Status XcmsTekHVCQueryMaxV (
XcmsCCC /* ccc */,
XcmsFloat /* hue */,
XcmsFloat /* chroma */,
XcmsColor* /* color_return */
);
extern Status XcmsTekHVCQueryMaxVC (
XcmsCCC /* ccc */,
XcmsFloat /* hue */,
XcmsColor* /* color_return */
);
extern Status XcmsTekHVCQueryMaxVSamples (
XcmsCCC /* ccc */,
XcmsFloat /* hue */,
XcmsColor* /* colors_return */,
unsigned int /* nsamples */
);
extern Status XcmsTekHVCQueryMinV (
XcmsCCC /* ccc */,
XcmsFloat /* hue */,
XcmsFloat /* chroma */,
XcmsColor* /* color_return */
);
extern Status XcmsTekHVCToCIEuvY (
XcmsCCC /* ccc */,
XcmsColor* /* white_point */,
XcmsColor* /* colors */,
unsigned int /* ncolors */
);
extern Status XcmsTekHVCWhiteShiftColors(
XcmsCCC /* ccc */,
XcmsColor* /* initial_white_point*/,
XcmsColor* /* target_white_point*/,
XcmsColorFormat /* target_format */,
XcmsColor* /* colors_in_out */,
unsigned int /* ncolors */,
Bool* /* compression_flags_return */
);
extern Visual *XcmsVisualOfCCC (
XcmsCCC /* ccc */
);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
_XFUNCPROTOEND
#endif /* _X11_XCMS_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef XtCoreP_h
#define XtCoreP_h
#include <X11/Core.h>
_XFUNCPROTOBEGIN
externalref int _XtInheritTranslations;
#define XtInheritTranslations ((String) &_XtInheritTranslations)
#define XtInheritRealize ((XtRealizeProc) _XtInherit)
#define XtInheritResize ((XtWidgetProc) _XtInherit)
#define XtInheritExpose ((XtExposeProc) _XtInherit)
#define XtInheritSetValuesAlmost ((XtAlmostProc) _XtInherit)
#define XtInheritAcceptFocus ((XtAcceptFocusProc) _XtInherit)
#define XtInheritQueryGeometry ((XtGeometryHandler) _XtInherit)
#define XtInheritDisplayAccelerator ((XtStringProc) _XtInherit)
/***************************************************************
* Widget Core Data Structures
*
*
**************************************************************/
typedef struct _CorePart {
Widget self; /* pointer to widget itself */
WidgetClass widget_class; /* pointer to Widget's ClassRec */
Widget parent; /* parent widget */
XrmName xrm_name; /* widget resource name quarkified */
Boolean being_destroyed; /* marked for destroy */
XtCallbackList destroy_callbacks; /* who to call when widget destroyed */
XtPointer constraints; /* constraint record */
Position x, y; /* window position */
Dimension width, height; /* window dimensions */
Dimension border_width; /* window border width */
Boolean managed; /* is widget geometry managed? */
Boolean sensitive; /* is widget sensitive to user events*/
Boolean ancestor_sensitive; /* are all ancestors sensitive? */
XtEventTable event_table; /* private to event dispatcher */
XtTMRec tm; /* translation management */
XtTranslations accelerators; /* accelerator translations */
Pixel border_pixel; /* window border pixel */
Pixmap border_pixmap; /* window border pixmap or NULL */
WidgetList popup_list; /* list of popups */
Cardinal num_popups; /* how many popups */
String name; /* widget resource name */
Screen *screen; /* window's screen */
Colormap colormap; /* colormap */
Window window; /* window ID */
Cardinal depth; /* number of planes in window */
Pixel background_pixel; /* window background pixel */
Pixmap background_pixmap; /* window background pixmap or NULL */
Boolean visible; /* is window mapped and not occluded?*/
Boolean mapped_when_managed;/* map window if it's managed? */
} CorePart;
typedef struct _WidgetRec {
CorePart core;
} WidgetRec, CoreRec;
/******************************************************************
*
* Core Class Structure. Widgets, regardless of their class, will have
* these fields. All widgets of a given class will have the same values
* for these fields. Widgets of a given class may also have additional
* common fields. These additional fields are included in incremental
* class structures, such as CommandClass.
*
* The fields that are specific to this subclass, as opposed to fields that
* are part of the superclass, are called "subclass fields" below. Many
* procedures are responsible only for the subclass fields, and not for
* any superclass fields.
*
********************************************************************/
typedef struct _CoreClassPart {
WidgetClass superclass; /* pointer to superclass ClassRec */
String class_name; /* widget resource class name */
Cardinal widget_size; /* size in bytes of widget record */
XtProc class_initialize; /* class initialization proc */
XtWidgetClassProc class_part_initialize; /* dynamic initialization */
XtEnum class_inited; /* has class been initialized? */
XtInitProc initialize; /* initialize subclass fields */
XtArgsProc initialize_hook; /* notify that initialize called */
XtRealizeProc realize; /* XCreateWindow for widget */
XtActionList actions; /* widget semantics name to proc map */
Cardinal num_actions; /* number of entries in actions */
XtResourceList resources; /* resources for subclass fields */
Cardinal num_resources; /* number of entries in resources */
XrmClass xrm_class; /* resource class quarkified */
Boolean compress_motion; /* compress MotionNotify for widget */
XtEnum compress_exposure; /* compress Expose events for widget*/
Boolean compress_enterleave;/* compress enter and leave events */
Boolean visible_interest; /* select for VisibilityNotify */
XtWidgetProc destroy; /* free data for subclass pointers */
XtWidgetProc resize; /* geom manager changed widget size */
XtExposeProc expose; /* rediplay window */
XtSetValuesFunc set_values; /* set subclass resource values */
XtArgsFunc set_values_hook; /* notify that set_values called */
XtAlmostProc set_values_almost; /* set_values got "Almost" geo reply */
XtArgsProc get_values_hook; /* notify that get_values called */
XtAcceptFocusProc accept_focus; /* assign input focus to widget */
XtVersionType version; /* version of intrinsics used */
XtPointer callback_private; /* list of callback offsets */
String tm_table; /* state machine */
XtGeometryHandler query_geometry; /* return preferred geometry */
XtStringProc display_accelerator;/* display your accelerator */
XtPointer extension; /* pointer to extension record */
} CoreClassPart;
typedef struct _WidgetClassRec {
CoreClassPart core_class;
} WidgetClassRec, CoreClassRec;
externalref WidgetClassRec widgetClassRec;
#define coreClassRec widgetClassRec
_XFUNCPROTOEND
#endif /* _XtCoreP_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtConstraint_h
#define _XtConstraint_h
_XFUNCPROTOBEGIN
typedef struct _ConstraintClassRec *ConstraintWidgetClass;
#ifndef VMS
externalref WidgetClass constraintWidgetClass;
#endif
_XFUNCPROTOEND
#endif /* _XtConstraint_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/*
*
Copyright 1989, 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
*/
/* Definitions to make function prototypes manageable */
#ifndef _XFUNCPROTO_H_
#define _XFUNCPROTO_H_
#ifndef NeedFunctionPrototypes
#define NeedFunctionPrototypes 1
#endif /* NeedFunctionPrototypes */
#ifndef NeedVarargsPrototypes
#define NeedVarargsPrototypes 1
#endif /* NeedVarargsPrototypes */
#if NeedFunctionPrototypes
#ifndef NeedNestedPrototypes
#define NeedNestedPrototypes 1
#endif /* NeedNestedPrototypes */
#ifndef _Xconst
#define _Xconst const
#endif /* _Xconst */
/* Function prototype configuration (see configure for more info) */
#if !defined(NARROWPROTO) && \
(defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
#define NARROWPROTO
#endif
#ifndef FUNCPROTO
#define FUNCPROTO 15
#endif
#ifndef NeedWidePrototypes
#ifdef NARROWPROTO
#define NeedWidePrototypes 0
#else
#define NeedWidePrototypes 1 /* default to make interropt. easier */
#endif
#endif /* NeedWidePrototypes */
#endif /* NeedFunctionPrototypes */
#ifndef _XFUNCPROTOBEGIN
#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
#define _XFUNCPROTOEND }
#else
#define _XFUNCPROTOBEGIN
#define _XFUNCPROTOEND
#endif
#endif /* _XFUNCPROTOBEGIN */
/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */
#ifndef __has_attribute
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
#endif
#ifndef __has_feature
# define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
#endif
#ifndef __has_extension
# define __has_extension(x) 0 /* Compatibility with non-clang compilers. */
#endif
/* Added in X11R6.9, so available in any version of modular xproto */
#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
#else
# define _X_SENTINEL(x)
#endif /* GNUC >= 4 */
/* Added in X11R6.9, so available in any version of modular xproto */
#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \
&& !defined(__CYGWIN__) && !defined(__MINGW32__)
# define _X_EXPORT __attribute__((visibility("default")))
# define _X_HIDDEN __attribute__((visibility("hidden")))
# define _X_INTERNAL __attribute__((visibility("internal")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define _X_EXPORT __global
# define _X_HIDDEN __hidden
# define _X_INTERNAL __hidden
#else /* not gcc >= 4 and not Sun Studio >= 8 */
# define _X_EXPORT
# define _X_HIDDEN
# define _X_INTERNAL
#endif /* GNUC >= 4 */
/* Branch prediction hints for individual conditionals */
/* requires xproto >= 7.0.9 */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
#else /* not gcc >= 3.3 */
# define _X_LIKELY(x) (x)
# define _X_UNLIKELY(x) (x)
#endif
/* Bulk branch prediction hints via marking error path functions as "cold" */
/* requires xproto >= 7.0.25 */
#if __has_attribute(__cold__) || \
(defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */
# define _X_COLD __attribute__((__cold__))
#else
# define _X_COLD /* nothing */
#endif
/* Added in X11R6.9, so available in any version of modular xproto */
#if __has_attribute(deprecated) \
|| (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \
|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130))
# define _X_DEPRECATED __attribute__((deprecated))
#else /* not gcc >= 3.1 */
# define _X_DEPRECATED
#endif
/* requires xproto >= 7.0.30 */
#if __has_extension(attribute_deprecated_with_message) || \
(defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg)))
#else
# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED
#endif
/* requires xproto >= 7.0.17 */
#if __has_attribute(noreturn) \
|| (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define _X_NORETURN __attribute((noreturn))
#else
# define _X_NORETURN
#endif /* GNUC */
/* Added in X11R6.9, so available in any version of modular xproto */
#if __has_attribute(__format__) \
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
#else /* not gcc >= 2.3 */
# define _X_ATTRIBUTE_PRINTF(x,y)
#endif
/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
argument macros, must be only used inside #ifdef _X_NONNULL guards, as
many legacy X clients are compiled in C89 mode still. */
#if __has_attribute(nonnull) \
&& defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
#define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
#elif __has_attribute(nonnull) \
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
#define _X_NONNULL(args...) __attribute__((nonnull(args)))
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
#define _X_NONNULL(...) /* */
#endif
/* requires xproto >= 7.0.22 */
#if __has_attribute(__unused__) \
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
#define _X_UNUSED __attribute__((__unused__))
#else
#define _X_UNUSED /* */
#endif
/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
/* requires xproto >= 7.0.9
(introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
#if defined(inline) /* assume autoconf set it correctly */ || \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
# define _X_INLINE inline
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
# define _X_INLINE __inline__
#else
# define _X_INLINE
#endif
/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
/* requires xproto >= 7.0.21 */
#ifndef _X_RESTRICT_KYWD
# if defined(restrict) /* assume autoconf set it correctly */ || \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
&& !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
# define _X_RESTRICT_KYWD restrict
# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
# define _X_RESTRICT_KYWD __restrict__
# else
# define _X_RESTRICT_KYWD
# endif
#endif
/* requires xproto >= 7.0.30 */
#if __has_attribute(no_sanitize_thread)
# define _X_NOTSAN __attribute__((no_sanitize_thread))
#else
# define _X_NOTSAN
#endif
#endif /* _XFUNCPROTO_H_ */
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtintrinsicI_h
#define _XtintrinsicI_h
#include "Xtos.h"
#include "IntrinsicP.h"
#ifdef WIN32
#define _WILLWINSOCK_
#endif
#include <X11/Xos.h>
#include "Object.h"
#include "RectObj.h"
#include "ObjectP.h"
#include "RectObjP.h"
#include "ConvertI.h"
#include "TranslateI.h"
#define RectObjClassFlag 0x02
#define WidgetClassFlag 0x04
#define CompositeClassFlag 0x08
#define ConstraintClassFlag 0x10
#define ShellClassFlag 0x20
#define WMShellClassFlag 0x40
#define TopLevelClassFlag 0x80
/*
* The following macros, though very handy, are not suitable for
* IntrinsicP.h as they violate the rule that arguments are to
* be evaluated exactly once.
*/
#define XtDisplayOfObject(object) \
(XtIsWidget(object) ? (object)->core.screen->display : \
_XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \
_XtWindowedAncestor(object)->core.screen->display)
#define XtScreenOfObject(object) \
(XtIsWidget(object) ? (object)->core.screen : \
_XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \
_XtWindowedAncestor(object)->core.screen)
#define XtWindowOfObject(object) \
((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
->core.window)
#define XtIsManaged(object) \
(XtIsRectObj(object) ? (object)->core.managed : False)
#define XtIsSensitive(object) \
(XtIsRectObj(object) ? ((object)->core.sensitive && \
(object)->core.ancestor_sensitive) : False)
/****************************************************************
*
* Byte utilities
*
****************************************************************/
#define _XBCOPYFUNC _XtBcopy
#include <X11/Xfuncs.h>
#define XtMemmove(dst, src, size) \
if ((char *)(dst) != (char *)(src)) { \
(void) memcpy((char *) (dst), (char *) (src), (size_t) (size)); \
}
#define XtBZero(dst, size) \
bzero((char *) (dst), (size_t) (size))
#define XtMemcmp(b1, b2, size) \
memcmp((char *) (b1), (char *) (b2), (size_t) (size))
/****************************************************************
*
* Stack cache allocation/free
*
****************************************************************/
#define XtStackAlloc(size, stack_cache_array) \
((size) <= sizeof(stack_cache_array) \
? (XtPointer)(stack_cache_array) \
: XtMalloc((unsigned)(size)))
#define XtStackFree(pointer, stack_cache_array) \
{ if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); }
/***************************************************************
*
* Filename defines
*
**************************************************************/
/* used by XtResolvePathname */
#ifndef XFILESEARCHPATHDEFAULT
#define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
#endif
/* the following two were both "X Toolkit " prior to R4 */
#ifndef XTERROR_PREFIX
#define XTERROR_PREFIX ""
#endif
#ifndef XTWARNING_PREFIX
#define XTWARNING_PREFIX ""
#endif
#ifndef ERRORDB
#define ERRORDB "/usr/lib/X11/XtErrorDB"
#endif
_XFUNCPROTOBEGIN
extern String XtCXtToolkitError;
extern void _XtAllocError(
String /* alloc_type */
);
extern void _XtCompileResourceList(
XtResourceList /* resources */,
Cardinal /* num_resources */
);
extern XtGeometryResult _XtMakeGeometryRequest(
Widget /* widget */,
XtWidgetGeometry* /* request */,
XtWidgetGeometry* /* reply_return */,
Boolean* /* clear_rect_obj */
);
extern Boolean _XtIsHookObject(
Widget /* widget */
);
extern void _XtAddShellToHookObj(
Widget /* widget */
);
/* GCManager.c */
extern void _XtGClistFree(Display *dpy, XtPerDisplay pd);
/** GeoTattler stuff */
#ifdef XT_GEO_TATTLER
extern void _XtGeoTab (int);
extern void _XtGeoTrace (
Widget widget,
const char *,
...
) _X_ATTRIBUTE_PRINTF(2,3);
#define CALLGEOTAT(f) f
#else /* XT_GEO_TATTLER */
#define CALLGEOTAT(f)
#endif /* XT_GEO_TATTLER */
#ifndef XTTRACEMEMORY
extern char* __XtMalloc (
unsigned /* size */
);
extern char* __XtCalloc (
unsigned /* num */,
unsigned /* size */
);
#else
#define __XtMalloc XtMalloc
#define __XtCalloc XtCalloc
#endif
_XFUNCPROTOEND
#endif /* _XtintrinsicI_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* Event.h - exported types and functions for toolkit event handler
*
* Author: Charles Haynes
* Digital Equipment Corporation
* Western Software Laboratory
* Date: Sun Dec 6 1987
*/
#ifndef _Event_h_
#define _Event_h_
typedef struct _XtGrabRec *XtGrabList;
#include "PassivGraI.h"
_XFUNCPROTOBEGIN
extern void _XtEventInitialize(
void
);
typedef struct _XtEventRec {
XtEventTable next;
EventMask mask; /* also select_data count for RecExt */
XtEventHandler proc;
XtPointer closure;
unsigned int select:1;
unsigned int has_type_specifier:1;
unsigned int async:1; /* not used, here for Digital extension? */
} XtEventRec;
typedef struct _XtGrabRec {
XtGrabList next;
Widget widget;
unsigned int exclusive:1;
unsigned int spring_loaded:1;
}XtGrabRec;
typedef struct _BlockHookRec {
struct _BlockHookRec* next;
XtAppContext app;
XtBlockHookProc proc;
XtPointer closure;
} BlockHookRec, *BlockHook;
extern void _XtFreeEventTable(
XtEventTable* /* event_table */
);
extern Boolean _XtOnGrabList(
Widget /* widget */,
XtGrabRec* /* grabList */
);
extern void _XtRemoveAllInputs(
XtAppContext /* app */
);
extern void _XtRefreshMapping(
XEvent* /* event */,
_XtBoolean /* dispatch */
);
extern void _XtSendFocusEvent(
Widget /* child */,
int /* type */);
extern EventMask _XtConvertTypeToMask(
int /* eventType */
);
/* EventUtil.c */
extern Widget _XtFindRemapWidget(XEvent *event, Widget widget,
EventMask mask, XtPerDisplayInput pdi);
extern void _XtUngrabBadGrabs(XEvent *event, Widget widget,
EventMask mask, XtPerDisplayInput pdi);
extern void _XtFillAncestorList(Widget **listPtr, int *maxElemsPtr,
int *numElemsPtr, Widget start,
Widget breakWidget);
/* NextEvent.c */
extern Boolean XtAppPeekEvent_SkipTimer;
_XFUNCPROTOEND
#endif /* _Event_h_ */
/* Definitions for the X window system likely to be used by applications */
#ifndef X_H
#define X_H
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#define X_PROTOCOL 11 /* current protocol version */
#define X_PROTOCOL_REVISION 0 /* current minor version */
/* Resources */
/*
* _XSERVER64 must ONLY be defined when compiling X server sources on
* systems where unsigned long is not 32 bits, must NOT be used in
* client or library code.
*/
#ifndef _XSERVER64
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
typedef unsigned long XID;
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
typedef unsigned long Mask;
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
typedef unsigned long Atom; /* Also in Xdefs.h */
# endif
typedef unsigned long VisualID;
typedef unsigned long Time;
#else
# include <X11/Xmd.h>
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
typedef CARD32 XID;
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
typedef CARD32 Mask;
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
typedef CARD32 Atom;
# endif
typedef CARD32 VisualID;
typedef CARD32 Time;
#endif
typedef XID Window;
typedef XID Drawable;
#ifndef _XTYPEDEF_FONT
# define _XTYPEDEF_FONT
typedef XID Font;
#endif
typedef XID Pixmap;
typedef XID Cursor;
typedef XID Colormap;
typedef XID GContext;
typedef XID KeySym;
typedef unsigned char KeyCode;
/*****************************************************************
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
*****************************************************************/
#ifndef None
#define None 0L /* universal null resource or null atom */
#endif
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
#define CopyFromParent 0L /* border pixmap in CreateWindow
and ChangeWindowAttributes
special VisualID and special window
class passed to CreateWindow */
#define PointerWindow 0L /* destination window in SendEvent */
#define InputFocus 1L /* destination window in SendEvent */
#define PointerRoot 1L /* focus window in SetInputFocus */
#define AnyPropertyType 0L /* special Atom, passed to GetProperty */
#define AnyKey 0L /* special Key Code, passed to GrabKey */
#define AnyButton 0L /* special Button Code, passed to GrabButton */
#define AllTemporary 0L /* special Resource ID passed to KillClient */
#define CurrentTime 0L /* special Time */
#define NoSymbol 0L /* special KeySym */
/*****************************************************************
* EVENT DEFINITIONS
*****************************************************************/
/* Input Event Masks. Used as event-mask window attribute and as arguments
to Grab requests. Not to be confused with event names. */
#define NoEventMask 0L
#define KeyPressMask (1L<<0)
#define KeyReleaseMask (1L<<1)
#define ButtonPressMask (1L<<2)
#define ButtonReleaseMask (1L<<3)
#define EnterWindowMask (1L<<4)
#define LeaveWindowMask (1L<<5)
#define PointerMotionMask (1L<<6)
#define PointerMotionHintMask (1L<<7)
#define Button1MotionMask (1L<<8)
#define Button2MotionMask (1L<<9)
#define Button3MotionMask (1L<<10)
#define Button4MotionMask (1L<<11)
#define Button5MotionMask (1L<<12)
#define ButtonMotionMask (1L<<13)
#define KeymapStateMask (1L<<14)
#define ExposureMask (1L<<15)
#define VisibilityChangeMask (1L<<16)
#define StructureNotifyMask (1L<<17)
#define ResizeRedirectMask (1L<<18)
#define SubstructureNotifyMask (1L<<19)
#define SubstructureRedirectMask (1L<<20)
#define FocusChangeMask (1L<<21)
#define PropertyChangeMask (1L<<22)
#define ColormapChangeMask (1L<<23)
#define OwnerGrabButtonMask (1L<<24)
/* Event names. Used in "type" field in XEvent structures. Not to be
confused with event masks above. They start from 2 because 0 and 1
are reserved in the protocol for errors and replies. */
#define KeyPress 2
#define KeyRelease 3
#define ButtonPress 4
#define ButtonRelease 5
#define MotionNotify 6
#define EnterNotify 7
#define LeaveNotify 8
#define FocusIn 9
#define FocusOut 10
#define KeymapNotify 11
#define Expose 12
#define GraphicsExpose 13
#define NoExpose 14
#define VisibilityNotify 15
#define CreateNotify 16
#define DestroyNotify 17
#define UnmapNotify 18
#define MapNotify 19
#define MapRequest 20
#define ReparentNotify 21
#define ConfigureNotify 22
#define ConfigureRequest 23
#define GravityNotify 24
#define ResizeRequest 25
#define CirculateNotify 26
#define CirculateRequest 27
#define PropertyNotify 28
#define SelectionClear 29
#define SelectionRequest 30
#define SelectionNotify 31
#define ColormapNotify 32
#define ClientMessage 33
#define MappingNotify 34
#define GenericEvent 35
#define LASTEvent 36 /* must be bigger than any event # */
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
state in various key-, mouse-, and button-related events. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
#define ControlMask (1<<2)
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
#define Mod4Mask (1<<6)
#define Mod5Mask (1<<7)
/* modifier names. Used to build a SetModifierMapping request or
to read a GetModifierMapping request. These correspond to the
masks defined above. */
#define ShiftMapIndex 0
#define LockMapIndex 1
#define ControlMapIndex 2
#define Mod1MapIndex 3
#define Mod2MapIndex 4
#define Mod3MapIndex 5
#define Mod4MapIndex 6
#define Mod5MapIndex 7
/* button masks. Used in same manner as Key masks above. Not to be confused
with button names below. */
#define Button1Mask (1<<8)
#define Button2Mask (1<<9)
#define Button3Mask (1<<10)
#define Button4Mask (1<<11)
#define Button5Mask (1<<12)
#define AnyModifier (1<<15) /* used in GrabButton, GrabKey */
/* button names. Used as arguments to GrabButton and as detail in ButtonPress
and ButtonRelease events. Not to be confused with button masks above.
Note that 0 is already defined above as "AnyButton". */
#define Button1 1
#define Button2 2
#define Button3 3
#define Button4 4
#define Button5 5
/* Notify modes */
#define NotifyNormal 0
#define NotifyGrab 1
#define NotifyUngrab 2
#define NotifyWhileGrabbed 3
#define NotifyHint 1 /* for MotionNotify events */
/* Notify detail */
#define NotifyAncestor 0
#define NotifyVirtual 1
#define NotifyInferior 2
#define NotifyNonlinear 3
#define NotifyNonlinearVirtual 4
#define NotifyPointer 5
#define NotifyPointerRoot 6
#define NotifyDetailNone 7
/* Visibility notify */
#define VisibilityUnobscured 0
#define VisibilityPartiallyObscured 1
#define VisibilityFullyObscured 2
/* Circulation request */
#define PlaceOnTop 0
#define PlaceOnBottom 1
/* protocol families */
#define FamilyInternet 0 /* IPv4 */
#define FamilyDECnet 1
#define FamilyChaos 2
#define FamilyInternet6 6 /* IPv6 */
/* authentication families not tied to a specific protocol */
#define FamilyServerInterpreted 5
/* Property notification */
#define PropertyNewValue 0
#define PropertyDelete 1
/* Color Map notification */
#define ColormapUninstalled 0
#define ColormapInstalled 1
/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
#define GrabModeSync 0
#define GrabModeAsync 1
/* GrabPointer, GrabKeyboard reply status */
#define GrabSuccess 0
#define AlreadyGrabbed 1
#define GrabInvalidTime 2
#define GrabNotViewable 3
#define GrabFrozen 4
/* AllowEvents modes */
#define AsyncPointer 0
#define SyncPointer 1
#define ReplayPointer 2
#define AsyncKeyboard 3
#define SyncKeyboard 4
#define ReplayKeyboard 5
#define AsyncBoth 6
#define SyncBoth 7
/* Used in SetInputFocus, GetInputFocus */
#define RevertToNone (int)None
#define RevertToPointerRoot (int)PointerRoot
#define RevertToParent 2
/*****************************************************************
* ERROR CODES
*****************************************************************/
#define Success 0 /* everything's okay */
#define BadRequest 1 /* bad request code */
#define BadValue 2 /* int parameter out of range */
#define BadWindow 3 /* parameter not a Window */
#define BadPixmap 4 /* parameter not a Pixmap */
#define BadAtom 5 /* parameter not an Atom */
#define BadCursor 6 /* parameter not a Cursor */
#define BadFont 7 /* parameter not a Font */
#define BadMatch 8 /* parameter mismatch */
#define BadDrawable 9 /* parameter not a Pixmap or Window */
#define BadAccess 10 /* depending on context:
- key/button already grabbed
- attempt to free an illegal
cmap entry
- attempt to store into a read-only
color map entry.
- attempt to modify the access control
list from other than the local host.
*/
#define BadAlloc 11 /* insufficient resources */
#define BadColor 12 /* no such colormap */
#define BadGC 13 /* parameter not a GC */
#define BadIDChoice 14 /* choice not in range or already used */
#define BadName 15 /* font or color name doesn't exist */
#define BadLength 16 /* Request length incorrect */
#define BadImplementation 17 /* server is defective */
#define FirstExtensionError 128
#define LastExtensionError 255
/*****************************************************************
* WINDOW DEFINITIONS
*****************************************************************/
/* Window classes used by CreateWindow */
/* Note that CopyFromParent is already defined as 0 above */
#define InputOutput 1
#define InputOnly 2
/* Window attributes for CreateWindow and ChangeWindowAttributes */
#define CWBackPixmap (1L<<0)
#define CWBackPixel (1L<<1)
#define CWBorderPixmap (1L<<2)
#define CWBorderPixel (1L<<3)
#define CWBitGravity (1L<<4)
#define CWWinGravity (1L<<5)
#define CWBackingStore (1L<<6)
#define CWBackingPlanes (1L<<7)
#define CWBackingPixel (1L<<8)
#define CWOverrideRedirect (1L<<9)
#define CWSaveUnder (1L<<10)
#define CWEventMask (1L<<11)
#define CWDontPropagate (1L<<12)
#define CWColormap (1L<<13)
#define CWCursor (1L<<14)
/* ConfigureWindow structure */
#define CWX (1<<0)
#define CWY (1<<1)
#define CWWidth (1<<2)
#define CWHeight (1<<3)
#define CWBorderWidth (1<<4)
#define CWSibling (1<<5)
#define CWStackMode (1<<6)
/* Bit Gravity */
#define ForgetGravity 0
#define NorthWestGravity 1
#define NorthGravity 2
#define NorthEastGravity 3
#define WestGravity 4
#define CenterGravity 5
#define EastGravity 6
#define SouthWestGravity 7
#define SouthGravity 8
#define SouthEastGravity 9
#define StaticGravity 10
/* Window gravity + bit gravity above */
#define UnmapGravity 0
/* Used in CreateWindow for backing-store hint */
#define NotUseful 0
#define WhenMapped 1
#define Always 2
/* Used in GetWindowAttributes reply */
#define IsUnmapped 0
#define IsUnviewable 1
#define IsViewable 2
/* Used in ChangeSaveSet */
#define SetModeInsert 0
#define SetModeDelete 1
/* Used in ChangeCloseDownMode */
#define DestroyAll 0
#define RetainPermanent 1
#define RetainTemporary 2
/* Window stacking method (in configureWindow) */
#define Above 0
#define Below 1
#define TopIf 2
#define BottomIf 3
#define Opposite 4
/* Circulation direction */
#define RaiseLowest 0
#define LowerHighest 1
/* Property modes */
#define PropModeReplace 0
#define PropModePrepend 1
#define PropModeAppend 2
/*****************************************************************
* GRAPHICS DEFINITIONS
*****************************************************************/
/* graphics functions, as in GC.alu */
#define GXclear 0x0 /* 0 */
#define GXand 0x1 /* src AND dst */
#define GXandReverse 0x2 /* src AND NOT dst */
#define GXcopy 0x3 /* src */
#define GXandInverted 0x4 /* NOT src AND dst */
#define GXnoop 0x5 /* dst */
#define GXxor 0x6 /* src XOR dst */
#define GXor 0x7 /* src OR dst */
#define GXnor 0x8 /* NOT src AND NOT dst */
#define GXequiv 0x9 /* NOT src XOR dst */
#define GXinvert 0xa /* NOT dst */
#define GXorReverse 0xb /* src OR NOT dst */
#define GXcopyInverted 0xc /* NOT src */
#define GXorInverted 0xd /* NOT src OR dst */
#define GXnand 0xe /* NOT src OR NOT dst */
#define GXset 0xf /* 1 */
/* LineStyle */
#define LineSolid 0
#define LineOnOffDash 1
#define LineDoubleDash 2
/* capStyle */
#define CapNotLast 0
#define CapButt 1
#define CapRound 2
#define CapProjecting 3
/* joinStyle */
#define JoinMiter 0
#define JoinRound 1
#define JoinBevel 2
/* fillStyle */
#define FillSolid 0
#define FillTiled 1
#define FillStippled 2
#define FillOpaqueStippled 3
/* fillRule */
#define EvenOddRule 0
#define WindingRule 1
/* subwindow mode */
#define ClipByChildren 0
#define IncludeInferiors 1
/* SetClipRectangles ordering */
#define Unsorted 0
#define YSorted 1
#define YXSorted 2
#define YXBanded 3
/* CoordinateMode for drawing routines */
#define CoordModeOrigin 0 /* relative to the origin */
#define CoordModePrevious 1 /* relative to previous point */
/* Polygon shapes */
#define Complex 0 /* paths may intersect */
#define Nonconvex 1 /* no paths intersect, but not convex */
#define Convex 2 /* wholly convex */
/* Arc modes for PolyFillArc */
#define ArcChord 0 /* join endpoints of arc */
#define ArcPieSlice 1 /* join endpoints to center of arc */
/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
GC.stateChanges */
#define GCFunction (1L<<0)
#define GCPlaneMask (1L<<1)
#define GCForeground (1L<<2)
#define GCBackground (1L<<3)
#define GCLineWidth (1L<<4)
#define GCLineStyle (1L<<5)
#define GCCapStyle (1L<<6)
#define GCJoinStyle (1L<<7)
#define GCFillStyle (1L<<8)
#define GCFillRule (1L<<9)
#define GCTile (1L<<10)
#define GCStipple (1L<<11)
#define GCTileStipXOrigin (1L<<12)
#define GCTileStipYOrigin (1L<<13)
#define GCFont (1L<<14)
#define GCSubwindowMode (1L<<15)
#define GCGraphicsExposures (1L<<16)
#define GCClipXOrigin (1L<<17)
#define GCClipYOrigin (1L<<18)
#define GCClipMask (1L<<19)
#define GCDashOffset (1L<<20)
#define GCDashList (1L<<21)
#define GCArcMode (1L<<22)
#define GCLastBit 22
/*****************************************************************
* FONTS
*****************************************************************/
/* used in QueryFont -- draw direction */
#define FontLeftToRight 0
#define FontRightToLeft 1
#define FontChange 255
/*****************************************************************
* IMAGING
*****************************************************************/
/* ImageFormat -- PutImage, GetImage */
#define XYBitmap 0 /* depth 1, XYFormat */
#define XYPixmap 1 /* depth == drawable depth */
#define ZPixmap 2 /* depth == drawable depth */
/*****************************************************************
* COLOR MAP STUFF
*****************************************************************/
/* For CreateColormap */
#define AllocNone 0 /* create map with no entries */
#define AllocAll 1 /* allocate entire map writeable */
/* Flags used in StoreNamedColor, StoreColors */
#define DoRed (1<<0)
#define DoGreen (1<<1)
#define DoBlue (1<<2)
/*****************************************************************
* CURSOR STUFF
*****************************************************************/
/* QueryBestSize Class */
#define CursorShape 0 /* largest size that can be displayed */
#define TileShape 1 /* size tiled fastest */
#define StippleShape 2 /* size stippled fastest */
/*****************************************************************
* KEYBOARD/POINTER STUFF
*****************************************************************/
#define AutoRepeatModeOff 0
#define AutoRepeatModeOn 1
#define AutoRepeatModeDefault 2
#define LedModeOff 0
#define LedModeOn 1
/* masks for ChangeKeyboardControl */
#define KBKeyClickPercent (1L<<0)
#define KBBellPercent (1L<<1)
#define KBBellPitch (1L<<2)
#define KBBellDuration (1L<<3)
#define KBLed (1L<<4)
#define KBLedMode (1L<<5)
#define KBKey (1L<<6)
#define KBAutoRepeatMode (1L<<7)
#define MappingSuccess 0
#define MappingBusy 1
#define MappingFailed 2
#define MappingModifier 0
#define MappingKeyboard 1
#define MappingPointer 2
/*****************************************************************
* SCREEN SAVER STUFF
*****************************************************************/
#define DontPreferBlanking 0
#define PreferBlanking 1
#define DefaultBlanking 2
#define DisableScreenSaver 0
#define DisableScreenInterval 0
#define DontAllowExposures 0
#define AllowExposures 1
#define DefaultExposures 2
/* for ForceScreenSaver */
#define ScreenSaverReset 0
#define ScreenSaverActive 1
/*****************************************************************
* HOSTS AND CONNECTIONS
*****************************************************************/
/* for ChangeHosts */
#define HostInsert 0
#define HostDelete 1
/* for ChangeAccessControl */
#define EnableAccess 1
#define DisableAccess 0
/* Display classes used in opening the connection
* Note that the statically allocated ones are even numbered and the
* dynamically changeable ones are odd numbered */
#define StaticGray 0
#define GrayScale 1
#define StaticColor 2
#define PseudoColor 3
#define TrueColor 4
#define DirectColor 5
/* Byte order used in imageByteOrder and bitmapBitOrder */
#define LSBFirst 0
#define MSBFirst 1
#endif /* X_H */
/*
Copyright 1984, 1985, 1987, 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _X11_XLIBINT_H_
#define _X11_XLIBINT_H_ 1
/*
* Xlibint.h - Header definition and support file for the internal
* support routines used by the C subroutine interface
* library (Xlib) to the X Window System.
*
* Warning, there be dragons here....
*/
#include <stdint.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h> /* to declare xEvent */
#include <X11/XlibConf.h> /* for configured options like XTHREADS */
/* The Xlib structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
#ifdef WIN32
#define _XFlush _XFlushIt
#endif
struct _XGC
{
XExtData *ext_data; /* hook for extension to hang data */
GContext gid; /* protocol ID for graphics context */
Bool rects; /* boolean: TRUE if clipmask is list of rectangles */
Bool dashes; /* boolean: TRUE if dash-list is really a list */
unsigned long dirty;/* cache dirty bits */
XGCValues values; /* shadow structure of values */
};
struct _XDisplay
{
XExtData *ext_data; /* hook for extension to hang data */
struct _XFreeFuncs *free_funcs; /* internal free functions */
int fd; /* Network socket. */
int conn_checker; /* ugly thing used by _XEventsQueued */
int proto_major_version;/* maj. version of server's X protocol */
int proto_minor_version;/* minor version of server's X protocol */
char *vendor; /* vendor of the server hardware */
XID resource_base; /* resource ID base */
XID resource_mask; /* resource ID mask bits */
XID resource_id; /* allocator current ID */
int resource_shift; /* allocator shift to correct bits */
XID (*resource_alloc)( /* allocator function */
struct _XDisplay*
);
int byte_order; /* screen byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* padding and data requirements */
int bitmap_pad; /* padding requirements on bitmaps */
int bitmap_bit_order; /* LeastSignificant or MostSignificant */
int nformats; /* number of pixmap formats in list */
ScreenFormat *pixmap_format; /* pixmap format list */
int vnumber; /* Xlib's X protocol version number. */
int release; /* release of the server */
struct _XSQEvent *head, *tail; /* Input event queue. */
int qlen; /* Length of input event queue */
unsigned long last_request_read; /* seq number of last event read */
unsigned long request; /* sequence number of last request. */
char *last_req; /* beginning of last request, or dummy */
char *buffer; /* Output buffer starting address. */
char *bufptr; /* Output buffer index pointer. */
char *bufmax; /* Output buffer maximum+1 address. */
unsigned max_request_size; /* maximum number 32 bit words in request*/
struct _XrmHashBucketRec *db;
int (*synchandler)( /* Synchronization handler */
struct _XDisplay*
);
char *display_name; /* "host:display" string used on this connect*/
int default_screen; /* default screen for operations */
int nscreens; /* number of screens on this server*/
Screen *screens; /* pointer to list of screens */
unsigned long motion_buffer; /* size of motion buffer */
volatile unsigned long flags; /* internal connection flags */
int min_keycode; /* minimum defined keycode */
int max_keycode; /* maximum defined keycode */
KeySym *keysyms; /* This server's keysyms */
XModifierKeymap *modifiermap; /* This server's modifier keymap */
int keysyms_per_keycode;/* number of rows */
char *xdefaults; /* contents of defaults from server */
char *scratch_buffer; /* place to hang scratch buffer */
unsigned long scratch_length; /* length of scratch buffer */
int ext_number; /* extension number on this display */
struct _XExten *ext_procs; /* extensions initialized on this display */
/*
* the following can be fixed size, as the protocol defines how
* much address space is available.
* While this could be done using the extension vector, there
* may be MANY events processed, so a search through the extension
* list to find the right procedure for each event might be
* expensive if many extensions are being used.
*/
Bool (*event_vec[128])( /* vector for wire to event */
Display * /* dpy */,
XEvent * /* re */,
xEvent * /* event */
);
Status (*wire_vec[128])( /* vector for event to wire */
Display * /* dpy */,
XEvent * /* re */,
xEvent * /* event */
);
KeySym lock_meaning; /* for XLookupString */
struct _XLockInfo *lock; /* multi-thread state, display lock */
struct _XInternalAsync *async_handlers; /* for internal async */
unsigned long bigreq_size; /* max size of big requests */
struct _XLockPtrs *lock_fns; /* pointers to threads functions */
void (*idlist_alloc)( /* XID list allocator function */
Display * /* dpy */,
XID * /* ids */,
int /* count */
);
/* things above this line should not move, for binary compatibility */
struct _XKeytrans *key_bindings; /* for XLookupString */
Font cursor_font; /* for XCreateFontCursor */
struct _XDisplayAtoms *atoms; /* for XInternAtom */
unsigned int mode_switch; /* keyboard group modifiers */
unsigned int num_lock; /* keyboard numlock modifiers */
struct _XContextDB *context_db; /* context database */
Bool (**error_vec)( /* vector for wire to error */
Display * /* display */,
XErrorEvent * /* he */,
xError * /* we */
);
/*
* Xcms information
*/
struct {
XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
XPointer perVisualIntensityMaps;
/* linked list of XcmsIntensityMap */
} cms;
struct _XIMFilter *im_filters;
struct _XSQEvent *qfree; /* unallocated event queue elements */
unsigned long next_event_serial_num; /* inserted into next queue elt */
struct _XExten *flushes; /* Flush hooks */
struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
int im_fd_length; /* number of im_fd_info */
struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
int watcher_count; /* number of conn_watchers */
XPointer filedes; /* struct pollfd cache for _XWaitForReadable */
int (*savedsynchandler)( /* user synchandler when Xlib usurps */
Display * /* dpy */
);
XID resource_max; /* allocator max ID */
int xcmisc_opcode; /* major opcode for XC-MISC */
struct _XkbInfoRec *xkb_info; /* XKB info */
struct _XtransConnInfo *trans_conn; /* transport connection object */
struct _X11XCBPrivate *xcb; /* XCB glue private data */
/* Generic event cookie handling */
unsigned int next_cookie; /* next event cookie */
/* vector for wire to generic event, index is (extension - 128) */
Bool (*generic_event_vec[128])(
Display * /* dpy */,
XGenericEventCookie * /* Xlib event */,
xEvent * /* wire event */);
/* vector for event copy, index is (extension - 128) */
Bool (*generic_event_copy_vec[128])(
Display * /* dpy */,
XGenericEventCookie * /* in */,
XGenericEventCookie * /* out*/);
void *cookiejar; /* cookie events returned but not claimed */
#ifndef LONG64
unsigned long last_request_read_upper32bit;
unsigned long request_upper32bit;
#endif
struct _XErrorThreadInfo *error_threads;
};
#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
/*
* access "last_request_read" and "request" with 64bit
* warning: the value argument of the SET-macros must not
* have any side-effects because it may get called twice.
*/
#ifndef LONG64
/* accessors for 32-bit unsigned long */
#define X_DPY_GET_REQUEST(dpy) \
( \
((uint64_t)(((struct _XDisplay*)dpy)->request)) \
+ (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \
)
#define X_DPY_SET_REQUEST(dpy, value) \
( \
(((struct _XDisplay*)dpy)->request = \
(value) & 0xFFFFFFFFUL), \
(((struct _XDisplay*)dpy)->request_upper32bit = \
((uint64_t)(value)) >> 32), \
(void)0 /* don't use the result */ \
)
#define X_DPY_GET_LAST_REQUEST_READ(dpy) \
( \
((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \
+ ( \
((uint64_t)( \
((struct _XDisplay*)dpy)->last_request_read_upper32bit \
)) << 32 \
) \
)
#define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
( \
(((struct _XDisplay*)dpy)->last_request_read = \
(value) & 0xFFFFFFFFUL), \
(((struct _XDisplay*)dpy)->last_request_read_upper32bit = \
((uint64_t)(value)) >> 32), \
(void)0 /* don't use the result */ \
)
/*
* widen a 32-bit sequence number to a 64 sequence number.
* This macro makes the following assumptions:
* - ulseq refers to a sequence that has already been sent
* - ulseq means the most recent possible sequence number
* with these lower 32 bits.
*
* The following optimization is used:
* The comparison result is taken a 0 or 1 to avoid a branch.
*/
#define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \
( \
((uint64_t)ulseq) \
+ \
(( \
((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \
- (uint64_t)( \
(ulseq) > (((struct _XDisplay*)dpy)->request) \
) \
) << 32) \
)
#define X_DPY_REQUEST_INCREMENT(dpy) \
( \
((struct _XDisplay*)dpy)->request++, \
( \
(((struct _XDisplay*)dpy)->request == 0) ? ( \
((struct _XDisplay*)dpy)->request_upper32bit++ \
) : 0 \
), \
(void)0 /* don't use the result */ \
)
#define X_DPY_REQUEST_DECREMENT(dpy) \
( \
( \
(((struct _XDisplay*)dpy)->request == 0) ? (\
((struct _XDisplay*)dpy)->request--, /* wrap */ \
((struct _XDisplay*)dpy)->request_upper32bit-- \
) : ( \
((struct _XDisplay*)dpy)->request-- \
) \
), \
(void)0 /* don't use the result */ \
)
#else
/* accessors for 64-bit unsigned long */
#define X_DPY_GET_REQUEST(dpy) \
(((struct _XDisplay*)dpy)->request)
#define X_DPY_SET_REQUEST(dpy, value) \
((struct _XDisplay*)dpy)->request = (value)
#define X_DPY_GET_LAST_REQUEST_READ(dpy) \
(((struct _XDisplay*)dpy)->last_request_read)
#define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
((struct _XDisplay*)dpy)->last_request_read = (value)
#define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq
#define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++
#define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request--
#endif
#ifndef _XEVENT_
/*
* _QEvent datatype for use in input queueing.
*/
typedef struct _XSQEvent
{
struct _XSQEvent *next;
XEvent event;
unsigned long qserial_num; /* so multi-threaded code can find new ones */
} _XQEvent;
#endif
#include <X11/Xproto.h>
#ifdef __sgi
#define _SGI_MP_SOURCE /* turn this on to get MP safe errno */
#endif
#include <errno.h>
#define _XBCOPYFUNC _Xbcopy
#include <X11/Xfuncs.h>
#include <X11/Xosdefs.h>
/* Utek leaves kernel macros around in include files (bleah) */
#ifdef dirty
#undef dirty
#endif
#include <stdlib.h>
#include <string.h>
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
/*
* The following definitions can be used for locking requests in multi-threaded
* address spaces.
*/
#ifdef XTHREADS
/* Author: Stephen Gildea, MIT X Consortium
*
* declarations for C Threads locking
*/
typedef struct _LockInfoRec *LockInfoPtr;
/* interfaces for locking.c */
struct _XLockPtrs {
/* used by all, including extensions; do not move */
void (*lock_display)(
Display *dpy
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char *file
, int line
#endif
);
void (*unlock_display)(
Display *dpy
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char *file
, int line
#endif
);
};
#if defined(WIN32) && !defined(_XLIBINT_)
#define _XCreateMutex_fn (*_XCreateMutex_fn_p)
#define _XFreeMutex_fn (*_XFreeMutex_fn_p)
#define _XLockMutex_fn (*_XLockMutex_fn_p)
#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
#define _Xglobal_lock (*_Xglobal_lock_p)
#endif
/* in XlibInt.c */
extern void (*_XCreateMutex_fn)(
LockInfoPtr /* lock */
);
extern void (*_XFreeMutex_fn)(
LockInfoPtr /* lock */
);
extern void (*_XLockMutex_fn)(
LockInfoPtr /* lock */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char * /* file */
, int /* line */
#endif
);
extern void (*_XUnlockMutex_fn)(
LockInfoPtr /* lock */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char * /* file */
, int /* line */
#endif
);
extern LockInfoPtr _Xglobal_lock;
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
#else
/* used everywhere, so must be fast if not using threads */
#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
#endif
#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
#else /* XTHREADS */
#define LockDisplay(dis)
#define _XLockMutex(lock)
#define _XUnlockMutex(lock)
#define UnlockDisplay(dis)
#define _XCreateMutex(lock)
#define _XFreeMutex(lock)
#endif
#define Xfree(ptr) free((ptr))
/*
* Note that some machines do not return a valid pointer for malloc(0), in
* which case we provide an alternate under the control of the
* define MALLOC_0_RETURNS_NULL. This is necessary because some
* Xlib code expects malloc(0) to return a valid pointer to storage.
*/
#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
#else
# define Xmalloc(size) malloc((size))
# define Xrealloc(ptr, size) realloc((ptr), (size))
# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
#endif
#include <stddef.h>
#define LOCKED 1
#define UNLOCKED 0
#ifndef BUFSIZE
#define BUFSIZE 2048 /* X output buffer size. */
#endif
#ifndef PTSPERBATCH
#define PTSPERBATCH 1024 /* point batching */
#endif
#ifndef WLNSPERBATCH
#define WLNSPERBATCH 50 /* wide line batching */
#endif
#ifndef ZLNSPERBATCH
#define ZLNSPERBATCH 1024 /* thin line batching */
#endif
#ifndef WRCTSPERBATCH
#define WRCTSPERBATCH 10 /* wide line rectangle batching */
#endif
#ifndef ZRCTSPERBATCH
#define ZRCTSPERBATCH 256 /* thin line rectangle batching */
#endif
#ifndef FRCTSPERBATCH
#define FRCTSPERBATCH 256 /* filled rectangle batching */
#endif
#ifndef FARCSPERBATCH
#define FARCSPERBATCH 256 /* filled arc batching */
#endif
#ifndef CURSORFONT
#define CURSORFONT "cursor" /* standard cursor fonts */
#endif
/*
* Display flags
*/
#define XlibDisplayIOError (1L << 0)
#define XlibDisplayClosing (1L << 1)
#define XlibDisplayNoXkb (1L << 2)
#define XlibDisplayPrivSync (1L << 3)
#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */
#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */
#define XlibDisplayReply (1L << 5) /* in _XReply */
#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */
#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */
/*
* X Protocol packetizing macros.
*/
/* Leftover from CRAY support - was defined empty on all non-Cray systems */
#define WORD64ALIGN
/**
* Return a len-sized request buffer for the request type. This function may
* flush the output queue.
*
* @param dpy The display connection
* @param type The request type
* @param len Length of the request in bytes
*
* @returns A pointer to the request buffer with a few default values
* initialized.
*/
extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
/* GetReqSized is the same as GetReq but allows the caller to specify the
* size in bytes. 'sz' must be a multiple of 4! */
#define GetReqSized(name, sz, req) \
req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz)
/*
* GetReq - Get the next available X request packet in the buffer and
* return it.
*
* "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
* "req" is the name of the request pointer.
*
*/
#define GetReq(name, req) \
GetReqSized(name, SIZEOF(x##name##Req), req)
/* GetReqExtra is the same as GetReq, but allocates "n" additional
bytes after the request. "n" must be a multiple of 4! */
#define GetReqExtra(name, n, req) \
GetReqSized(name, SIZEOF(x##name##Req) + n, req)
/*
* GetResReq is for those requests that have a resource ID
* (Window, Pixmap, GContext, etc.) as their single argument.
* "rid" is the name of the resource.
*/
#define GetResReq(name, rid, req) \
req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \
req->id = (rid)
/*
* GetEmptyReq is for those requests that have no arguments
* at all.
*/
#define GetEmptyReq(name, req) \
req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
/*
* MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32
* length, after req->length, before the data in the request. The new length
* includes the "n" extra 32-bit words.
*
* Do not use MakeBigReq if there is no data already in the request.
* req->length must already be >= 2.
*/
#ifdef LONG64
#define MakeBigReq(req,n) \
{ \
CARD64 _BRdat; \
CARD32 _BRlen = req->length - 1; \
req->length = 0; \
_BRdat = ((CARD32 *)req)[_BRlen]; \
memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \
((CARD32 *)req)[1] = _BRlen + n + 2; \
Data32(dpy, &_BRdat, 4); \
}
#else
#define MakeBigReq(req,n) \
{ \
CARD32 _BRdat; \
CARD32 _BRlen = req->length - 1; \
req->length = 0; \
_BRdat = ((CARD32 *)req)[_BRlen]; \
memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \
((CARD32 *)req)[1] = _BRlen + n + 2; \
Data32(dpy, &_BRdat, 4); \
}
#endif
/*
* SetReqLen increases the count of 32-bit words in the request by "n",
* or by "badlen" if "n" is too large.
*
* Do not use SetReqLen if "req" does not already have data after the
* xReq header. req->length must already be >= 2.
*/
#ifndef __clang_analyzer__
#define SetReqLen(req,n,badlen) \
if ((req->length + n) > (unsigned)65535) { \
if (dpy->bigreq_size) { \
MakeBigReq(req,n) \
} else { \
n = badlen; \
req->length += n; \
} \
} else \
req->length += n
#else
#define SetReqLen(req,n,badlen) \
req->length += n
#endif
#define SyncHandle() \
if (dpy->synchandler) (*dpy->synchandler)(dpy)
extern void _XFlushGCCache(Display *dpy, GC gc);
#define FlushGC(dpy, gc) \
if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
/*
* Data - Place data in the buffer and pad the end to provide
* 32 bit word alignment. Transmit if the buffer fills.
*
* "dpy" is a pointer to a Display.
* "data" is a pointer to a data buffer.
* "len" is the length of the data buffer.
*/
#ifndef DataRoutineIsProcedure
#define Data(dpy, data, len) {\
if (dpy->bufptr + (len) <= dpy->bufmax) {\
memcpy(dpy->bufptr, data, (int)len);\
dpy->bufptr += ((len) + 3) & ~3;\
} else\
_XSend(dpy, data, len);\
}
#endif /* DataRoutineIsProcedure */
/* Allocate bytes from the buffer. No padding is done, so if
* the length is not a multiple of 4, the caller must be
* careful to leave the buffer aligned after sending the
* current request.
*
* "type" is the type of the pointer being assigned to.
* "ptr" is the pointer being assigned to.
* "n" is the number of bytes to allocate.
*
* Example:
* xTextElt *elt;
* BufAlloc (xTextElt *, elt, nbytes)
*/
#define BufAlloc(type, ptr, n) \
if (dpy->bufptr + (n) > dpy->bufmax) \
_XFlush (dpy); \
ptr = (type) dpy->bufptr; \
memset(ptr, '\0', n); \
dpy->bufptr += (n);
#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
#ifdef LONG64
#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len)
extern int _XData32(
Display *dpy,
register _Xconst long *data,
unsigned len
);
extern void _XRead32(
Display *dpy,
register long *data,
long len
);
#else
#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
#endif
#define PackData16(dpy,data,len) Data16 (dpy, data, len)
#define PackData32(dpy,data,len) Data32 (dpy, data, len)
/* Xlib manual is bogus */
#define PackData(dpy,data,len) PackData16 (dpy, data, len)
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
(((cs)->rbearing|(cs)->lbearing| \
(cs)->ascent|(cs)->descent) == 0))
/*
* CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
* character. If the character is in the column and exists, then return the
* appropriate metrics (note that fonts with common per-character metrics will
* return min_bounds). If none of these hold true, try again with the default
* char.
*/
#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
{ \
cs = def; \
if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
if (fs->per_char == NULL) { \
cs = &fs->min_bounds; \
} else { \
cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
if (CI_NONEXISTCHAR(cs)) cs = def; \
} \
} \
}
#define CI_GET_DEFAULT_INFO_1D(fs,cs) \
CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
/*
* CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
* column. This is used for fonts that have more than row zero.
*/
#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
{ \
cs = def; \
if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
if (fs->per_char == NULL) { \
cs = &fs->min_bounds; \
} else { \
cs = &fs->per_char[((row - fs->min_byte1) * \
(fs->max_char_or_byte2 - \
fs->min_char_or_byte2 + 1)) + \
(col - fs->min_char_or_byte2)]; \
if (CI_NONEXISTCHAR(cs)) cs = def; \
} \
} \
}
#define CI_GET_DEFAULT_INFO_2D(fs,cs) \
{ \
unsigned int r = (fs->default_char >> 8); \
unsigned int c = (fs->default_char & 0xff); \
CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
}
/* srcvar must be a variable for large architecture version */
#define OneDataCard32(dpy,dstaddr,srcvar) \
{ *(CARD32 *)(dstaddr) = (srcvar); }
typedef struct _XInternalAsync {
struct _XInternalAsync *next;
/*
* handler arguments:
* rep is the generic reply that caused this handler
* to be invoked. It must also be passed to _XGetAsyncReply.
* buf and len are opaque values that must be passed to
* _XGetAsyncReply or _XGetAsyncData.
* data is the closure stored in this struct.
* The handler returns True iff it handled this reply.
*/
Bool (*handler)(
Display* /* dpy */,
xReply* /* rep */,
char* /* buf */,
int /* len */,
XPointer /* data */
);
XPointer data;
} _XAsyncHandler;
/*
* This struct is part of the ABI and is defined by value
* in user-code. This means that we cannot make
* the sequence-numbers 64bit.
*/
typedef struct _XAsyncEState {
unsigned long min_sequence_number;
unsigned long max_sequence_number;
unsigned char error_code;
unsigned char major_opcode;
unsigned short minor_opcode;
unsigned char last_error_received;
int error_count;
} _XAsyncErrorState;
extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
#define DeqAsyncHandler(dpy,handler) { \
if (dpy->async_handlers == (handler)) \
dpy->async_handlers = (handler)->next; \
else \
_XDeqAsyncHandler(dpy, handler); \
}
typedef void (*FreeFuncType) (
Display* /* display */
);
typedef int (*FreeModmapType) (
XModifierKeymap* /* modmap */
);
/*
* This structure is private to the library.
*/
typedef struct _XFreeFuncs {
FreeFuncType atoms; /* _XFreeAtomTable */
FreeModmapType modifiermap; /* XFreeModifiermap */
FreeFuncType key_bindings; /* _XFreeKeyBindings */
FreeFuncType context_db; /* _XFreeContextDB */
FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */
FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */
FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */
FreeFuncType im_filters; /* _XFreeIMFilters */
FreeFuncType xkb; /* _XkbFreeInfo */
} _XFreeFuncRec;
/* types for InitExt.c */
typedef int (*CreateGCType) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
typedef int (*CopyGCType)(
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
typedef int (*FlushGCType) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
typedef int (*FreeGCType) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
typedef int (*CreateFontType) (
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
);
typedef int (*FreeFontType) (
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
);
typedef int (*CloseDisplayType) (
Display* /* display */,
XExtCodes* /* codes */
);
typedef int (*ErrorType) (
Display* /* display */,
xError* /* err */,
XExtCodes* /* codes */,
int* /* ret_code */
);
typedef char* (*ErrorStringType) (
Display* /* display */,
int /* code */,
XExtCodes* /* codes */,
char* /* buffer */,
int /* nbytes */
);
typedef void (*PrintErrorType)(
Display* /* display */,
XErrorEvent* /* ev */,
void* /* fp */
);
typedef void (*BeforeFlushType)(
Display* /* display */,
XExtCodes* /* codes */,
_Xconst char* /* data */,
long /* len */
);
/*
* This structure is private to the library.
*/
typedef struct _XExten { /* private to extension mechanism */
struct _XExten *next; /* next in list */
XExtCodes codes; /* public information, all extension told */
CreateGCType create_GC; /* routine to call when GC created */
CopyGCType copy_GC; /* routine to call when GC copied */
FlushGCType flush_GC; /* routine to call when GC flushed */
FreeGCType free_GC; /* routine to call when GC freed */
CreateFontType create_Font; /* routine to call when Font created */
FreeFontType free_Font; /* routine to call when Font freed */
CloseDisplayType close_display; /* routine to call when connection closed */
ErrorType error; /* who to call when an error occurs */
ErrorStringType error_string; /* routine to supply error string */
char *name; /* name of this extension */
PrintErrorType error_values; /* routine to supply error values */
BeforeFlushType before_flush; /* routine to call when sending data */
struct _XExten *next_flush; /* next in list of those with flushes */
} _XExtension;
/* Temporary definition until we can depend on an xproto release with it */
#ifdef _X_COLD
# define _XLIB_COLD _X_COLD
#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */
# define _XLIB_COLD __attribute__((__cold__))
#else
# define _XLIB_COLD /* nothing */
#endif
/* extension hooks */
#ifdef DataRoutineIsProcedure
extern void Data(Display *dpy, char *data, long len);
#endif
extern int _XError(
Display* /* dpy */,
xError* /* rep */
);
extern int _XIOError(
Display* /* dpy */
) _X_NORETURN;
extern int (*_XIOErrorFunction)(
Display* /* dpy */
);
extern int (*_XErrorFunction)(
Display* /* dpy */,
XErrorEvent* /* error_event */
);
extern void _XEatData(
Display* /* dpy */,
unsigned long /* n */
) _XLIB_COLD;
extern void _XEatDataWords(
Display* /* dpy */,
unsigned long /* n */
) _XLIB_COLD;
#if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */
# pragma rarely_called(_XEatData, _XEatDataWords)
#endif
extern char *_XAllocScratch(
Display* /* dpy */,
unsigned long /* nbytes */
);
extern char *_XAllocTemp(
Display* /* dpy */,
unsigned long /* nbytes */
);
extern void _XFreeTemp(
Display* /* dpy */,
char* /* buf */,
unsigned long /* nbytes */
);
extern Visual *_XVIDtoVisual(
Display* /* dpy */,
VisualID /* id */
);
extern unsigned long _XSetLastRequestRead(
Display* /* dpy */,
xGenericReply* /* rep */
);
extern int _XGetHostname(
char* /* buf */,
int /* maxlen */
);
extern Screen *_XScreenOfWindow(
Display* /* dpy */,
Window /* w */
);
extern Bool _XAsyncErrorHandler(
Display* /* dpy */,
xReply* /* rep */,
char* /* buf */,
int /* len */,
XPointer /* data */
);
extern char *_XGetAsyncReply(
Display* /* dpy */,
char* /* replbuf */,
xReply* /* rep */,
char* /* buf */,
int /* len */,
int /* extra */,
Bool /* discard */
);
extern void _XGetAsyncData(
Display* /* dpy */,
char * /* data */,
char * /* buf */,
int /* len */,
int /* skip */,
int /* datalen */,
int /* discardtotal */
);
extern void _XFlush(
Display* /* dpy */
);
extern int _XEventsQueued(
Display* /* dpy */,
int /* mode */
);
extern void _XReadEvents(
Display* /* dpy */
);
extern int _XRead(
Display* /* dpy */,
char* /* data */,
long /* size */
);
extern void _XReadPad(
Display* /* dpy */,
char* /* data */,
long /* size */
);
extern void _XSend(
Display* /* dpy */,
_Xconst char* /* data */,
long /* size */
);
extern Status _XReply(
Display* /* dpy */,
xReply* /* rep */,
int /* extra */,
Bool /* discard */
);
extern void _XEnq(
Display* /* dpy */,
xEvent* /* event */
);
extern void _XDeq(
Display* /* dpy */,
_XQEvent* /* prev */,
_XQEvent* /* qelt */
);
extern Bool _XUnknownWireEvent(
Display* /* dpy */,
XEvent* /* re */,
xEvent* /* event */
);
extern Bool _XUnknownWireEventCookie(
Display* /* dpy */,
XGenericEventCookie* /* re */,
xEvent* /* event */
);
extern Bool _XUnknownCopyEventCookie(
Display* /* dpy */,
XGenericEventCookie* /* in */,
XGenericEventCookie* /* out */
);
extern Status _XUnknownNativeEvent(
Display* /* dpy */,
XEvent* /* re */,
xEvent* /* event */
);
extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
extern Bool _XPollfdCacheInit(Display *dpy);
extern void _XPollfdCacheAdd(Display *dpy, int fd);
extern void _XPollfdCacheDel(Display *dpy, int fd);
extern XID _XAllocID(Display *dpy);
extern void _XAllocIDs(Display *dpy, XID *ids, int count);
extern int _XFreeExtData(
XExtData* /* extension */
);
extern int (*XESetCreateGC(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, GC, XExtCodes*
);
extern int (*XESetCopyGC(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, GC, XExtCodes*
);
extern int (*XESetFlushGC(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, GC, XExtCodes*
);
extern int (*XESetFreeGC(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, GC, XExtCodes*
);
extern int (*XESetCreateFont(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, XFontStruct*, XExtCodes*
);
extern int (*XESetFreeFont(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, XFontStruct*, XExtCodes*
);
extern int (*XESetCloseDisplay(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
XExtCodes* /* codes */
) /* proc */
))(
Display*, XExtCodes*
);
extern int (*XESetError(
Display* /* display */,
int /* extension */,
int (*) (
Display* /* display */,
xError* /* err */,
XExtCodes* /* codes */,
int* /* ret_code */
) /* proc */
))(
Display*, xError*, XExtCodes*, int*
);
extern char* (*XESetErrorString(
Display* /* display */,
int /* extension */,
char* (*) (
Display* /* display */,
int /* code */,
XExtCodes* /* codes */,
char* /* buffer */,
int /* nbytes */
) /* proc */
))(
Display*, int, XExtCodes*, char*, int
);
extern void (*XESetPrintErrorValues (
Display* /* display */,
int /* extension */,
void (*)(
Display* /* display */,
XErrorEvent* /* ev */,
void* /* fp */
) /* proc */
))(
Display*, XErrorEvent*, void*
);
extern Bool (*XESetWireToEvent(
Display* /* display */,
int /* event_number */,
Bool (*) (
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
) /* proc */
))(
Display*, XEvent*, xEvent*
);
extern Bool (*XESetWireToEventCookie(
Display* /* display */,
int /* extension */,
Bool (*) (
Display* /* display */,
XGenericEventCookie* /* re */,
xEvent* /* event */
) /* proc */
))(
Display*, XGenericEventCookie*, xEvent*
);
extern Bool (*XESetCopyEventCookie(
Display* /* display */,
int /* extension */,
Bool (*) (
Display* /* display */,
XGenericEventCookie* /* in */,
XGenericEventCookie* /* out */
) /* proc */
))(
Display*, XGenericEventCookie*, XGenericEventCookie*
);
extern Status (*XESetEventToWire(
Display* /* display */,
int /* event_number */,
Status (*) (
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
) /* proc */
))(
Display*, XEvent*, xEvent*
);
extern Bool (*XESetWireToError(
Display* /* display */,
int /* error_number */,
Bool (*) (
Display* /* display */,
XErrorEvent* /* he */,
xError* /* we */
) /* proc */
))(
Display*, XErrorEvent*, xError*
);
extern void (*XESetBeforeFlush(
Display* /* display */,
int /* error_number */,
void (*) (
Display* /* display */,
XExtCodes* /* codes */,
_Xconst char* /* data */,
long /* len */
) /* proc */
))(
Display*, XExtCodes*, _Xconst char*, long
);
/* internal connections for IMs */
typedef void (*_XInternalConnectionProc)(
Display* /* dpy */,
int /* fd */,
XPointer /* call_data */
);
extern Status _XRegisterInternalConnection(
Display* /* dpy */,
int /* fd */,
_XInternalConnectionProc /* callback */,
XPointer /* call_data */
);
extern void _XUnregisterInternalConnection(
Display* /* dpy */,
int /* fd */
);
extern void _XProcessInternalConnection(
Display* /* dpy */,
struct _XConnectionInfo* /* conn_info */
);
/* Display structure has pointers to these */
struct _XConnectionInfo { /* info from _XRegisterInternalConnection */
int fd;
_XInternalConnectionProc read_callback;
XPointer call_data;
XPointer *watch_data; /* set/used by XConnectionWatchProc */
struct _XConnectionInfo *next;
};
struct _XConnWatchInfo { /* info from XAddConnectionWatch */
XConnectionWatchProc fn;
XPointer client_data;
struct _XConnWatchInfo *next;
};
#ifdef __UNIXOS2__
extern char* __XOS2RedirRoot(
char*
);
#endif
extern int _XTextHeight(
XFontStruct* /* font_struct */,
_Xconst char* /* string */,
int /* count */
);
extern int _XTextHeight16(
XFontStruct* /* font_struct */,
_Xconst XChar2b* /* string */,
int /* count */
);
#if defined(WIN32)
extern int _XOpenFile(
_Xconst char* /* path */,
int /* flags */
);
extern int _XOpenFileMode(
_Xconst char* /* path */,
int /* flags */,
mode_t /* mode */
);
extern void* _XFopenFile(
_Xconst char* /* path */,
_Xconst char* /* mode */
);
extern int _XAccessFile(
_Xconst char* /* path */
);
#else
#define _XOpenFile(path,flags) open(path,flags)
#define _XOpenFileMode(path,flags,mode) open(path,flags,mode)
#define _XFopenFile(path,mode) fopen(path,mode)
#endif
/* EvToWire.c */
extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
extern int _XF86LoadQueryLocaleFont(
Display* /* dpy */,
_Xconst char* /* name*/,
XFontStruct** /* xfp*/,
Font* /* fidp */
);
extern void _XProcessWindowAttributes (
register Display *dpy,
xChangeWindowAttributesReq *req,
register unsigned long valuemask,
register XSetWindowAttributes *attributes);
extern int _XDefaultError(
Display *dpy,
XErrorEvent *event);
extern int _XDefaultIOError(
Display *dpy);
extern void _XSetClipRectangles (
register Display *dpy,
GC gc,
int clip_x_origin, int clip_y_origin,
XRectangle *rectangles,
int n,
int ordering);
Status _XGetWindowAttributes(
register Display *dpy,
Window w,
XWindowAttributes *attr);
int _XPutBackEvent (
register Display *dpy,
register XEvent *event);
extern Bool _XIsEventCookie(
Display *dpy,
XEvent *ev);
extern void _XFreeEventCookies(
Display *dpy);
extern void _XStoreEventCookie(
Display *dpy,
XEvent *ev);
extern Bool _XFetchEventCookie(
Display *dpy,
XGenericEventCookie *ev);
extern Bool _XCopyEventCookie(
Display *dpy,
XGenericEventCookie *in,
XGenericEventCookie *out);
/* lcFile.c */
extern void xlocaledir(
char *buf,
int buf_len
);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
_XFUNCPROTOEND
#endif /* _X11_XLIBINT_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtVendor_h
#define _XtVendor_h
#include <X11/Intrinsic.h>
/***********************************************************************
*
* VendorShell Widget
*
***********************************************************************/
/* Class record constants */
typedef struct _VendorShellClassRec *VendorShellWidgetClass;
_XFUNCPROTOBEGIN
externalref WidgetClass vendorShellWidgetClass;
_XFUNCPROTOEND
#endif /* _XtVendor_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright (c) 1999 The XFree86 Project Inc.
All Rights Reserved.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The XFree86 Project
Inc. shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from The XFree86 Project Inc..
*/
/**
** Types definitions shared between server and clients
**/
#ifndef _XDEFS_H
#define _XDEFS_H
#ifdef _XSERVER64
#include <X11/Xmd.h>
#endif
#ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
# ifndef _XSERVER64
typedef unsigned long Atom;
# else
typedef CARD32 Atom;
# endif
#endif
#ifndef Bool
# ifndef _XTYPEDEF_BOOL
# define _XTYPEDEF_BOOL
typedef int Bool;
# endif
#endif
#ifndef _XTYPEDEF_POINTER
# define _XTYPEDEF_POINTER
typedef void *pointer;
#endif
#ifndef _XTYPEDEF_CLIENTPTR
typedef struct _Client *ClientPtr;
# define _XTYPEDEF_CLIENTPTR
#endif
#ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
# ifndef _XSERVER64
typedef unsigned long XID;
# else
typedef CARD32 XID;
# endif
#endif
#ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
# ifndef _XSERVER64
typedef unsigned long Mask;
# else
typedef CARD32 Mask;
# endif
#endif
#ifndef _XTYPEDEF_FONTPTR
# define _XTYPEDEF_FONTPTR
typedef struct _Font *FontPtr; /* also in fonts/include/font.h */
#endif
#ifndef _XTYPEDEF_FONT
# define _XTYPEDEF_FONT
typedef XID Font;
#endif
#ifndef _XTYPEDEF_FSID
# ifndef _XSERVER64
typedef unsigned long FSID;
# else
typedef CARD32 FSID;
# endif
#endif
typedef FSID AccContext;
/* OS independent time value
XXX Should probably go in Xos.h */
typedef struct timeval **OSTimePtr;
typedef void (* BlockHandlerProcPtr)(void * /* blockData */,
OSTimePtr /* pTimeout */,
void * /* pReadmask */);
#endif
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/****************************************************************
*
* Resources
*
****************************************************************/
#ifndef _XtresourceI_h
#define _XtresourceI_h
#define StringToQuark(string) XrmStringToQuark(string)
#define StringToName(string) XrmStringToName(string)
#define StringToClass(string) XrmStringToClass(string)
_XFUNCPROTOBEGIN
extern void _XtDependencies(
XtResourceList * /* class_resp */,
Cardinal * /* class_num_resp */,
XrmResourceList * /* super_res */,
Cardinal /* super_num_res */,
Cardinal /* super_widget_size */);
extern void _XtResourceDependencies(
WidgetClass /* wc */
);
extern void _XtConstraintResDependencies(
ConstraintWidgetClass /* wc */
);
extern XtCacheRef* _XtGetResources(
Widget /* w */,
ArgList /* args */,
Cardinal /* num_args */,
XtTypedArgList /* typed_args */,
Cardinal* /* num_typed_args */
);
extern void _XtCopyFromParent(
Widget /* widget */,
int /* offset */,
XrmValue* /* value */
);
extern void _XtCopyToArg(char *src, XtArgVal *dst, unsigned int size);
extern void _XtCopyFromArg(XtArgVal src, char *dst, unsigned int size);
extern XrmResourceList* _XtCreateIndirectionTable(XtResourceList resources,
Cardinal num_resources);
extern void _XtResourceListInitialize(void);
_XFUNCPROTOEND
#endif /* _XtresourceI_h */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization from
The Open Group.
*/
/*
* This header file has the sole purpose of allowing the inclusion of
* windows.h without getting any name conflicts with X headers code, by
* renaming or disabling the conflicting definitions from windows.h
*/
/*
* Mingw.org versions of the Windows API headers actually avoid
* making the conflicting definitions if XFree86Server is defined, so we
* need to remember if that was defined and undefine it during including
* windows.h (so the conflicting definitions get wrapped correctly), and
* then redefine it afterwards. (This was never the correct thing to
* do as it's no help at all to X11 clients which also need to use the
* Win32 API)
*/
#undef _XFree86Server
#ifdef XFree86Server
# define _XFree86Server
# undef XFree86Server
#endif
/*
* There doesn't seem to be a good way to wrap the min/max macros from
* windows.h, so we simply avoid defining them completely, allowing any
* pre-existing definition to stand.
*
*/
#define NOMINMAX
/*
* mingw-w64 headers define BOOL as a typedef, protecting against macros
* mingw.org headers define BOOL in terms of WINBOOL
* ... so try to come up with something which works with both :-)
*/
#define _NO_BOOL_TYPEDEF
#define BOOL WINBOOL
#define INT32 wINT32
#ifdef __x86_64__
#define INT64 wINT64
#define LONG64 wLONG64
#endif
#undef Status
#define Status wStatus
#define ATOM wATOM
#define BYTE wBYTE
#define FreeResource wFreeResource
#include <windows.h>
#undef NOMINMAX
#undef Status
#define Status int
#undef BYTE
#undef BOOL
#undef INT32
#undef INT64
#undef LONG64
#undef ATOM
#undef FreeResource
#undef CreateWindowA
/*
* Older version of this header used to name the windows API bool type wBOOL,
* rather than more standard name WINBOOL
*/
#define wBOOL WINBOOL
#ifdef RESOURCE_H
# undef RT_FONT
# undef RT_CURSOR
# define RT_FONT ((RESTYPE)4)
# define RT_CURSOR ((RESTYPE)5)
#endif
#ifndef __CYGWIN__
#define sleep(x) Sleep((x) * 1000)
#endif
#if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024)
# undef PATH_MAX
# define PATH_MAX 1024
#endif
#ifdef _XFree86Server
# define XFree86Server
# undef _XFree86Server
#endif
/*
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _Xauth_h
#define _Xauth_h
/* struct xauth is full of implicit padding to properly align the pointers
after the length fields. We can't clean that up without breaking ABI,
so tell clang not to bother complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
typedef struct xauth {
unsigned short family;
unsigned short address_length;
char *address;
unsigned short number_length;
char *number;
unsigned short name_length;
char *name;
unsigned short data_length;
char *data;
} Xauth;
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifndef _XAUTH_STRUCT_ONLY
# include <X11/Xfuncproto.h>
# include <X11/Xfuncs.h>
# include <stdio.h>
# define FamilyLocal (256) /* not part of X standard (i.e. X.h) */
# define FamilyWild (65535)
# define FamilyNetname (254) /* not part of X standard */
# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */
# define FamilyLocalHost (252) /* for local non-net authentication */
_XFUNCPROTOBEGIN
char *XauFileName(void);
Xauth *XauReadAuth(
FILE* /* auth_file */
);
int XauLockAuth(
_Xconst char* /* file_name */,
int /* retries */,
int /* timeout */,
long /* dead */
);
int XauUnlockAuth(
_Xconst char* /* file_name */
);
int XauWriteAuth(
FILE* /* auth_file */,
Xauth* /* auth */
);
Xauth *XauGetAuthByAddr(
#if NeedWidePrototypes
unsigned int /* family */,
unsigned int /* address_length */,
#else
unsigned short /* family */,
unsigned short /* address_length */,
#endif
_Xconst char* /* address */,
#if NeedWidePrototypes
unsigned int /* number_length */,
#else
unsigned short /* number_length */,
#endif
_Xconst char* /* number */,
#if NeedWidePrototypes
unsigned int /* name_length */,
#else
unsigned short /* name_length */,
#endif
_Xconst char* /* name */
);
Xauth *XauGetBestAuthByAddr(
#if NeedWidePrototypes
unsigned int /* family */,
unsigned int /* address_length */,
#else
unsigned short /* family */,
unsigned short /* address_length */,
#endif
_Xconst char* /* address */,
#if NeedWidePrototypes
unsigned int /* number_length */,
#else
unsigned short /* number_length */,
#endif
_Xconst char* /* number */,
int /* types_length */,
char** /* type_names */,
_Xconst int* /* type_lengths */
);
void XauDisposeAuth(
Xauth* /* auth */
);
_XFUNCPROTOEND
/* Return values from XauLockAuth */
# define LOCK_SUCCESS 0 /* lock succeeded */
# define LOCK_ERROR 1 /* lock unexpectely failed, check errno */
# define LOCK_TIMEOUT 2 /* lock failed, timeouts expired */
#endif /* _XAUTH_STRUCT_ONLY */
#endif /* _Xauth_h */
/*
* O/S-dependent (mis)feature macro definitions
*
Copyright 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XOSDEFS_H_
# define _XOSDEFS_H_
/*
* X_NOT_POSIX means does not have POSIX header files. Lack of this
* symbol does NOT mean that the POSIX environment is the default.
* You may still have to define _POSIX_SOURCE to get it.
*/
# ifdef _SCO_DS
# ifndef __SCO__
# define __SCO__
# endif
# endif
# ifdef __i386__
# ifdef SYSV
# if !defined(__SCO__) && \
!defined(__UNIXWARE__) && !defined(__sun)
# if !defined(_POSIX_SOURCE)
# define X_NOT_POSIX
# endif
# endif
# endif
# endif
# ifdef __sun
/* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4
* This check allows non-Imake configured programs to build correctly.
*/
# if defined(__SVR4) && !defined(SVR4)
# define SVR4 1
# endif
# ifdef SVR4
/* define this to whatever it needs to be */
# define X_POSIX_C_SOURCE 199300L
# endif
# endif
# ifdef WIN32
# ifndef _POSIX_
# define X_NOT_POSIX
# endif
# endif
# ifdef __APPLE__
# define NULL_NOT_ZERO
/* Defining any of these will sanitize the namespace to JUST want is defined by
* that particular standard. If that happens, we don't get some expected
* prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to
* loosen our belts a tad.
*/
# if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE)
# ifndef _DARWIN_C_SOURCE
# define _DARWIN_C_SOURCE
# endif
# endif
# endif
# ifdef __GNU__
# ifndef PATH_MAX
# define PATH_MAX 4096
# endif
# ifndef MAXPATHLEN
# define MAXPATHLEN 4096
# endif
# endif
# if defined(__SCO__) || defined(__UNIXWARE__)
# ifndef PATH_MAX
# define PATH_MAX 1024
# endif
# ifndef MAXPATHLEN
# define MAXPATHLEN 1024
# endif
# endif
# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
|| defined(__APPLE__) || defined(__DragonFly__)
# ifndef CSRG_BASED
# define CSRG_BASED
# endif
# endif
#endif /* _XOSDEFS_H_ */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XtIntrinsic_h
#define _XtIntrinsic_h
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/Xfuncproto.h>
#ifdef XT_BC
#include <X11/Xos.h> /* for R4 compatibility */
#else
#include <X11/Xosdefs.h>
#include <string.h> /* for XtNewString */
#endif /* XT_BC else */
#define XtSpecificationRelease 6
typedef char *String;
/* We do this in order to get "const" declarations to work right. We
* use _XtString instead of String so that C++ applications can
* #define String to something else if they choose, to avoid conflicts
* with other C++ libraries.
*/
#define _XtString char*
/* _Xt names are private to Xt implementation, do not use in client code */
#if NeedWidePrototypes
#define _XtBoolean int
#define _XtDimension unsigned int
#define _XtKeyCode unsigned int
#define _XtPosition int
#define _XtXtEnum unsigned int
#else
#define _XtBoolean Boolean
#define _XtDimension Dimension
#define _XtKeyCode KeyCode
#define _XtPosition Position
#define _XtXtEnum XtEnum
#endif /* NeedWidePrototypes */
#include <stddef.h>
#ifdef VMS
#define externalref globalref
#define externaldef(psect) globaldef {"psect"} noshare
#else
#define externalref extern
#define externaldef(psect)
#endif /* VMS */
#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif
#define XtNumber(arr) ((Cardinal) (sizeof(arr) / sizeof(arr[0])))
typedef struct _WidgetRec *Widget;
typedef Widget *WidgetList;
typedef struct _WidgetClassRec *WidgetClass;
typedef struct _CompositeRec *CompositeWidget;
typedef struct _XtActionsRec *XtActionList;
typedef struct _XtEventRec *XtEventTable;
typedef struct _XtAppStruct *XtAppContext;
typedef unsigned long XtValueMask;
typedef unsigned long XtIntervalId;
typedef unsigned long XtInputId;
typedef unsigned long XtWorkProcId;
typedef unsigned long XtSignalId;
typedef unsigned int XtGeometryMask;
typedef unsigned long XtGCMask; /* Mask of values that are used by widget*/
typedef unsigned long Pixel; /* Index into colormap */
typedef int XtCacheType;
#define XtCacheNone 0x001
#define XtCacheAll 0x002
#define XtCacheByDisplay 0x003
#define XtCacheRefCount 0x100
/****************************************************************
*
* System Dependent Definitions; see spec for specific range
* requirements. Do not assume every implementation uses the
* same base types!
*
*
* XtArgVal ought to be a union of XtPointer, char *, long, int *, and proc *
* but casting to union types is not really supported.
*
* So the typedef for XtArgVal should be chosen such that
*
* sizeof (XtArgVal) >= sizeof(XtPointer)
* sizeof(char *)
* sizeof(long)
* sizeof(int *)
* sizeof(proc *)
*
* ArgLists rely heavily on the above typedef.
*
****************************************************************/
typedef char Boolean;
typedef long XtArgVal;
typedef unsigned char XtEnum;
typedef unsigned int Cardinal;
typedef unsigned short Dimension; /* Size in pixels */
typedef short Position; /* Offset from 0 coordinate */
typedef void* XtPointer;
/* The type Opaque is NOT part of the Xt standard, do NOT use it. */
/* (It remains here only for backward compatibility.) */
typedef XtPointer Opaque;
#include <X11/Core.h>
#include <X11/Composite.h>
#include <X11/Constraint.h>
#include <X11/Object.h>
#include <X11/RectObj.h>
typedef struct _TranslationData *XtTranslations;
typedef struct _TranslationData *XtAccelerators;
typedef unsigned int Modifiers;
typedef void (*XtActionProc)(
Widget /* widget */,
XEvent* /* event */,
String* /* params */,
Cardinal* /* num_params */
);
typedef XtActionProc* XtBoundActions;
typedef struct _XtActionsRec{
String string;
XtActionProc proc;
} XtActionsRec;
typedef enum {
/* address mode parameter representation */
/* ------------ ------------------------ */
XtAddress, /* address */
XtBaseOffset, /* offset */
XtImmediate, /* constant */
XtResourceString, /* resource name string */
XtResourceQuark, /* resource name quark */
XtWidgetBaseOffset, /* offset from ancestor */
XtProcedureArg /* procedure to invoke */
} XtAddressMode;
typedef struct {
XtAddressMode address_mode;
XtPointer address_id;
Cardinal size;
} XtConvertArgRec, *XtConvertArgList;
typedef void (*XtConvertArgProc)(
Widget /* widget */,
Cardinal* /* size */,
XrmValue* /* value */
);
typedef struct {
XtGeometryMask request_mode;
Position x, y;
Dimension width, height, border_width;
Widget sibling;
int stack_mode; /* Above, Below, TopIf, BottomIf, Opposite, DontChange */
} XtWidgetGeometry;
/* Additions to Xlib geometry requests: ask what would happen, don't do it */
#define XtCWQueryOnly (1 << 7)
/* Additions to Xlib stack modes: don't change stack order */
#define XtSMDontChange 5
typedef void (*XtConverter)( /* obsolete */
XrmValue* /* args */,
Cardinal* /* num_args */,
XrmValue* /* from */,
XrmValue* /* to */
);
typedef Boolean (*XtTypeConverter)(
Display* /* dpy */,
XrmValue* /* args */,
Cardinal* /* num_args */,
XrmValue* /* from */,
XrmValue* /* to */,
XtPointer* /* converter_data */
);
typedef void (*XtDestructor)(
XtAppContext /* app */,
XrmValue* /* to */,
XtPointer /* converter_data */,
XrmValue* /* args */,
Cardinal* /* num_args */
);
typedef Opaque XtCacheRef;
typedef Opaque XtActionHookId;
typedef void (*XtActionHookProc)(
Widget /* w */,
XtPointer /* client_data */,
String /* action_name */,
XEvent* /* event */,
String* /* params */,
Cardinal* /* num_params */
);
typedef unsigned long XtBlockHookId;
typedef void (*XtBlockHookProc)(
XtPointer /* client_data */
);
typedef void (*XtKeyProc)(
Display* /* dpy */,
_XtKeyCode /* keycode */,
Modifiers /* modifiers */,
Modifiers* /* modifiers_return */,
KeySym* /* keysym_return */
);
typedef void (*XtCaseProc)(
Display* /* display */,
KeySym /* keysym */,
KeySym* /* lower_return */,
KeySym* /* upper_return */
);
typedef void (*XtEventHandler)(
Widget /* widget */,
XtPointer /* closure */,
XEvent* /* event */,
Boolean* /* continue_to_dispatch */
);
typedef unsigned long EventMask;
typedef enum {XtListHead, XtListTail } XtListPosition;
typedef unsigned long XtInputMask;
#define XtInputNoneMask 0L
#define XtInputReadMask (1L<<0)
#define XtInputWriteMask (1L<<1)
#define XtInputExceptMask (1L<<2)
typedef void (*XtTimerCallbackProc)(
XtPointer /* closure */,
XtIntervalId* /* id */
);
typedef void (*XtInputCallbackProc)(
XtPointer /* closure */,
int* /* source */,
XtInputId* /* id */
);
typedef void (*XtSignalCallbackProc)(
XtPointer /* closure */,
XtSignalId* /* id */
);
typedef struct {
String name;
XtArgVal value;
} Arg, *ArgList;
typedef XtPointer XtVarArgsList;
typedef void (*XtCallbackProc)(
Widget /* widget */,
XtPointer /* closure */, /* data the application registered */
XtPointer /* call_data */ /* callback specific data */
);
typedef struct _XtCallbackRec {
XtCallbackProc callback;
XtPointer closure;
} XtCallbackRec, *XtCallbackList;
typedef enum {
XtCallbackNoList,
XtCallbackHasNone,
XtCallbackHasSome
} XtCallbackStatus;
typedef enum {
XtGeometryYes, /* Request accepted. */
XtGeometryNo, /* Request denied. */
XtGeometryAlmost, /* Request denied, but willing to take replyBox. */
XtGeometryDone /* Request accepted and done. */
} XtGeometryResult;
typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;
typedef struct {
Widget shell_widget;
Widget enable_widget;
} XtPopdownIDRec, *XtPopdownID;
typedef struct _XtResource {
String resource_name; /* Resource name */
String resource_class; /* Resource class */
String resource_type; /* Representation type desired */
Cardinal resource_size; /* Size in bytes of representation */
Cardinal resource_offset;/* Offset from base to put resource value */
String default_type; /* representation type of specified default */
XtPointer default_addr; /* Address of default resource */
} XtResource, *XtResourceList;
typedef void (*XtResourceDefaultProc)(
Widget /* widget */,
int /* offset */,
XrmValue* /* value */
);
typedef String (*XtLanguageProc)(
Display* /* dpy */,
String /* xnl */,
XtPointer /* client_data */
);
typedef void (*XtErrorMsgHandler)(
String /* name */,
String /* type */,
String /* class */,
String /* default */,
String* /* params */,
Cardinal* /* num_params */
);
typedef void (*XtErrorHandler)(
String /* msg */
);
typedef void (*XtCreatePopupChildProc)(
Widget /* shell */
);
typedef Boolean (*XtWorkProc)(
XtPointer /* closure */ /* data the application registered */
);
typedef struct {
char match;
String substitution;
} SubstitutionRec, *Substitution;
typedef Boolean (*XtFilePredicate)(
String /* filename */
);
typedef XtPointer XtRequestId;
typedef Boolean (*XtConvertSelectionProc)(
Widget /* widget */,
Atom* /* selection */,
Atom* /* target */,
Atom* /* type_return */,
XtPointer* /* value_return */,
unsigned long* /* length_return */,
int* /* format_return */
);
typedef void (*XtLoseSelectionProc)(
Widget /* widget */,
Atom* /* selection */
);
typedef void (*XtSelectionDoneProc)(
Widget /* widget */,
Atom* /* selection */,
Atom* /* target */
);
typedef void (*XtSelectionCallbackProc)(
Widget /* widget */,
XtPointer /* closure */,
Atom* /* selection */,
Atom* /* type */,
XtPointer /* value */,
unsigned long* /* length */,
int* /* format */
);
typedef void (*XtLoseSelectionIncrProc)(
Widget /* widget */,
Atom* /* selection */,
XtPointer /* client_data */
);
typedef void (*XtSelectionDoneIncrProc)(
Widget /* widget */,
Atom* /* selection */,
Atom* /* target */,
XtRequestId* /* receiver_id */,
XtPointer /* client_data */
);
typedef Boolean (*XtConvertSelectionIncrProc)(
Widget /* widget */,
Atom* /* selection */,
Atom* /* target */,
Atom* /* type */,
XtPointer* /* value */,
unsigned long* /* length */,
int* /* format */,
unsigned long* /* max_length */,
XtPointer /* client_data */,
XtRequestId* /* receiver_id */
);
typedef void (*XtCancelConvertSelectionProc)(
Widget /* widget */,
Atom* /* selection */,
Atom* /* target */,
XtRequestId* /* receiver_id */,
XtPointer /* client_data */
);
typedef Boolean (*XtEventDispatchProc)(
XEvent* /* event */
);
typedef void (*XtExtensionSelectProc)(
Widget /* widget */,
int* /* event_types */,
XtPointer* /* select_data */,
int /* count */,
XtPointer /* client_data */
);
/***************************************************************
*
* Exported Interfaces
*
****************************************************************/
_XFUNCPROTOBEGIN
extern Boolean XtConvertAndStore(
Widget /* widget */,
_Xconst _XtString /* from_type */,
XrmValue* /* from */,
_Xconst _XtString /* to_type */,
XrmValue* /* to_in_out */
);
extern Boolean XtCallConverter(
Display* /* dpy */,
XtTypeConverter /* converter */,
XrmValuePtr /* args */,
Cardinal /* num_args */,
XrmValuePtr /* from */,
XrmValue* /* to_in_out */,
XtCacheRef* /* cache_ref_return */
);
extern Boolean XtDispatchEvent(
XEvent* /* event */
);
extern Boolean XtCallAcceptFocus(
Widget /* widget */,
Time* /* time */
);
extern Boolean XtPeekEvent( /* obsolete */
XEvent* /* event_return */
);
extern Boolean XtAppPeekEvent(
XtAppContext /* app_context */,
XEvent* /* event_return */
);
extern Boolean XtIsSubclass(
Widget /* widget */,
WidgetClass /* widgetClass */
);
extern Boolean XtIsObject(
Widget /* object */
);
extern Boolean _XtCheckSubclassFlag( /* implementation-private */
Widget /* object */,
_XtXtEnum /* type_flag */
);
extern Boolean _XtIsSubclassOf( /* implementation-private */
Widget /* object */,
WidgetClass /* widget_class */,
WidgetClass /* flag_class */,
_XtXtEnum /* type_flag */
);
extern Boolean XtIsManaged(
Widget /* rectobj */
);
extern Boolean XtIsRealized(
Widget /* widget */
);
extern Boolean XtIsSensitive(
Widget /* widget */
);
extern Boolean XtOwnSelection(
Widget /* widget */,
Atom /* selection */,
Time /* time */,
XtConvertSelectionProc /* convert */,
XtLoseSelectionProc /* lose */,
XtSelectionDoneProc /* done */
);
extern Boolean XtOwnSelectionIncremental(
Widget /* widget */,
Atom /* selection */,
Time /* time */,
XtConvertSelectionIncrProc /* convert_callback */,
XtLoseSelectionIncrProc /* lose_callback */,
XtSelectionDoneIncrProc /* done_callback */,
XtCancelConvertSelectionProc /* cancel_callback */,
XtPointer /* client_data */
);
extern XtGeometryResult XtMakeResizeRequest(
Widget /* widget */,
_XtDimension /* width */,
_XtDimension /* height */,
Dimension* /* width_return */,
Dimension* /* height_return */
);
extern void XtTranslateCoords(
Widget /* widget */,
_XtPosition /* x */,
_XtPosition /* y */,
Position* /* rootx_return */,
Position* /* rooty_return */
);
extern KeySym* XtGetKeysymTable(
Display* /* dpy */,
KeyCode* /* min_keycode_return */,
int* /* keysyms_per_keycode_return */
);
extern void XtKeysymToKeycodeList(
Display* /* dpy */,
KeySym /* keysym */,
KeyCode** /* keycodes_return */,
Cardinal* /* keycount_return */
);
extern void XtStringConversionWarning( /* obsolete */
_Xconst _XtString /* from_value */,
_Xconst _XtString /* to_type */
);
extern void XtDisplayStringConversionWarning(
Display* /* dpy */,
_Xconst _XtString /* from_value */,
_Xconst _XtString /* to_type */
);
externalref XtConvertArgRec const colorConvertArgs[];
externalref XtConvertArgRec const screenConvertArg[];
extern void XtAppAddConverter( /* obsolete */
XtAppContext /* app_context */,
_Xconst _XtString /* from_type */,
_Xconst _XtString /* to_type */,
XtConverter /* converter */,
XtConvertArgList /* convert_args */,
Cardinal /* num_args */
);
extern void XtAddConverter( /* obsolete */
_Xconst _XtString /* from_type */,
_Xconst _XtString /* to_type */,
XtConverter /* converter */,
XtConvertArgList /* convert_args */,
Cardinal /* num_args */
);
extern void XtSetTypeConverter(
_Xconst _XtString /* from_type */,
_Xconst _XtString /* to_type */,
XtTypeConverter /* converter */,
XtConvertArgList /* convert_args */,
Cardinal /* num_args */,
XtCacheType /* cache_type */,
XtDestructor /* destructor */
);
extern void XtAppSetTypeConverter(
XtAppContext /* app_context */,
_Xconst _XtString /* from_type */,
_Xconst _XtString /* to_type */,
XtTypeConverter /* converter */,
XtConvertArgList /* convert_args */,
Cardinal /* num_args */,
XtCacheType /* cache_type */,
XtDestructor /* destructor */
);
extern void XtConvert( /* obsolete */
Widget /* widget */,
_Xconst _XtString /* from_type */,
XrmValue* /* from */,
_Xconst _XtString /* to_type */,
XrmValue* /* to_return */
);
extern void XtDirectConvert( /* obsolete */
XtConverter /* converter */,
XrmValuePtr /* args */,
Cardinal /* num_args */,
XrmValuePtr /* from */,
XrmValue* /* to_return */
);
/****************************************************************
*
* Translation Management
*
****************************************************************/
extern XtTranslations XtParseTranslationTable(
_Xconst _XtString /* table */
);
extern XtAccelerators XtParseAcceleratorTable(
_Xconst _XtString /* source */
);
extern void XtOverrideTranslations(
Widget /* widget */,
XtTranslations /* translations */
);
extern void XtAugmentTranslations(
Widget /* widget */,
XtTranslations /* translations */
);
extern void XtInstallAccelerators(
Widget /* destination */,
Widget /* source */
);
extern void XtInstallAllAccelerators(
Widget /* destination */,
Widget /* source */
);
extern void XtUninstallTranslations(
Widget /* widget */
);
extern void XtAppAddActions(
XtAppContext /* app_context */,
XtActionList /* actions */,
Cardinal /* num_actions */
);
extern void XtAddActions( /* obsolete */
XtActionList /* actions */,
Cardinal /* num_actions */
);
extern XtActionHookId XtAppAddActionHook(
XtAppContext /* app_context */,
XtActionHookProc /* proc */,
XtPointer /* client_data */
);
extern void XtRemoveActionHook(
XtActionHookId /* id */
);
extern void XtGetActionList(
WidgetClass /* widget_class */,
XtActionList* /* actions_return */,
Cardinal* /* num_actions_return */
);
extern void XtCallActionProc(
Widget /* widget */,
_Xconst _XtString /* action */,
XEvent* /* event */,
String* /* params */,
Cardinal /* num_params */
);
extern void XtRegisterGrabAction(
XtActionProc /* action_proc */,
_XtBoolean /* owner_events */,
unsigned int /* event_mask */,
int /* pointer_mode */,
int /* keyboard_mode */
);
extern void XtSetMultiClickTime(
Display* /* dpy */,
int /* milliseconds */
);
extern int XtGetMultiClickTime(
Display* /* dpy */
);
extern KeySym XtGetActionKeysym(
XEvent* /* event */,
Modifiers* /* modifiers_return */
);
/***************************************************************
*
* Keycode and Keysym procedures for translation management
*
****************************************************************/
extern void XtTranslateKeycode(
Display* /* dpy */,
_XtKeyCode /* keycode */,
Modifiers /* modifiers */,
Modifiers* /* modifiers_return */,
KeySym* /* keysym_return */
);
extern void XtTranslateKey(
Display* /* dpy */,
_XtKeyCode /* keycode */,
Modifiers /* modifiers */,
Modifiers* /* modifiers_return */,
KeySym* /* keysym_return */
);
extern void XtSetKeyTranslator(
Display* /* dpy */,
XtKeyProc /* proc */
);
extern void XtRegisterCaseConverter(
Display* /* dpy */,
XtCaseProc /* proc */,
KeySym /* start */,
KeySym /* stop */
);
extern void XtConvertCase(
Display* /* dpy */,
KeySym /* keysym */,
KeySym* /* lower_return */,
KeySym* /* upper_return */
);
/****************************************************************
*
* Event Management
*
****************************************************************/
/* XtAllEvents is valid only for XtRemoveEventHandler and
* XtRemoveRawEventHandler; don't use it to select events!
*/
#define XtAllEvents ((EventMask) -1L)
extern void XtAddEventHandler(
Widget /* widget */,
EventMask /* event_mask */,
_XtBoolean /* nonmaskable */,
XtEventHandler /* proc */,
XtPointer /* closure */
);
extern void XtRemoveEventHandler(
Widget /* widget */,
EventMask /* event_mask */,
_XtBoolean /* nonmaskable */,
XtEventHandler /* proc */,
XtPointer /* closure */
);
extern void XtAddRawEventHandler(
Widget /* widget */,
EventMask /* event_mask */,
_XtBoolean /* nonmaskable */,
XtEventHandler /* proc */,
XtPointer /* closure */
);
extern void XtRemoveRawEventHandler(
Widget /* widget */,
EventMask /* event_mask */,
_XtBoolean /* nonmaskable */,
XtEventHandler /* proc */,
XtPointer /* closure */
);
extern void XtInsertEventHandler(
Widget /* widget */,
EventMask /* event_mask */,
_XtBoolean /* nonmaskable */,
XtEventHandler /* proc */,
XtPointer /* closure */,
XtListPosition /* position */
);
extern void XtInsertRawEventHandler(
Widget /* widget */,
EventMask /* event_mask */,
_XtBoolean /* nonmaskable */,
XtEventHandler /* proc */,
XtPointer /* closure */,
XtListPosition /* position */
);
extern XtEventDispatchProc XtSetEventDispatcher(
Display* /* dpy */,
int /* event_type */,
XtEventDispatchProc /* proc */
);
extern Boolean XtDispatchEventToWidget(
Widget /* widget */,
XEvent* /* event */
);
extern void XtInsertEventTypeHandler(
Widget /* widget */,
int /* type */,
XtPointer /* select_data */,
XtEventHandler /* proc */,
XtPointer /* closure */,
XtListPosition /* position */
);
extern void XtRemoveEventTypeHandler(
Widget /* widget */,
int /* type */,
XtPointer /* select_data */,
XtEventHandler /* proc */,
XtPointer /* closure */
);
extern EventMask XtBuildEventMask(
Widget /* widget */
);
extern void XtRegisterExtensionSelector(
Display* /* dpy */,
int /* min_event_type */,
int /* max_event_type */,
XtExtensionSelectProc /* proc */,
XtPointer /* client_data */
);
extern void XtAddGrab(
Widget /* widget */,
_XtBoolean /* exclusive */,
_XtBoolean /* spring_loaded */
);
extern void XtRemoveGrab(
Widget /* widget */
);
extern void XtProcessEvent( /* obsolete */
XtInputMask /* mask */
);
extern void XtAppProcessEvent(
XtAppContext /* app_context */,
XtInputMask /* mask */
);
extern void XtMainLoop( /* obsolete */
void
);
extern void XtAppMainLoop(
XtAppContext /* app_context */
);
extern void XtAddExposureToRegion(
XEvent* /* event */,
Region /* region */
);
extern void XtSetKeyboardFocus(
Widget /* subtree */,
Widget /* descendent */
);
extern Widget XtGetKeyboardFocusWidget(
Widget /* widget */
);
extern XEvent* XtLastEventProcessed(
Display* /* dpy */
);
extern Time XtLastTimestampProcessed(
Display* /* dpy */
);
/****************************************************************
*
* Event Gathering Routines
*
****************************************************************/
extern XtIntervalId XtAddTimeOut( /* obsolete */
unsigned long /* interval */,
XtTimerCallbackProc /* proc */,
XtPointer /* closure */
);
extern XtIntervalId XtAppAddTimeOut(
XtAppContext /* app_context */,
unsigned long /* interval */,
XtTimerCallbackProc /* proc */,
XtPointer /* closure */
);
extern void XtRemoveTimeOut(
XtIntervalId /* timer */
);
extern XtInputId XtAddInput( /* obsolete */
int /* source */,
XtPointer /* condition */,
XtInputCallbackProc /* proc */,
XtPointer /* closure */
);
extern XtInputId XtAppAddInput(
XtAppContext /* app_context */,
int /* source */,
XtPointer /* condition */,
XtInputCallbackProc /* proc */,
XtPointer /* closure */
);
extern void XtRemoveInput(
XtInputId /* id */
);
extern XtSignalId XtAddSignal(
XtSignalCallbackProc /* proc */,
XtPointer /* closure */);
extern XtSignalId XtAppAddSignal(
XtAppContext /* app_context */,
XtSignalCallbackProc /* proc */,
XtPointer /* closure */
);
extern void XtRemoveSignal(
XtSignalId /* id */
);
extern void XtNoticeSignal(
XtSignalId /* id */
);
extern void XtNextEvent( /* obsolete */
XEvent* /* event */
);
extern void XtAppNextEvent(
XtAppContext /* app_context */,
XEvent* /* event_return */
);
#define XtIMXEvent 1
#define XtIMTimer 2
#define XtIMAlternateInput 4
#define XtIMSignal 8
#define XtIMAll (XtIMXEvent | XtIMTimer | XtIMAlternateInput | XtIMSignal)
extern Boolean XtPending( /* obsolete */
void
);
extern XtInputMask XtAppPending(
XtAppContext /* app_context */
);
extern XtBlockHookId XtAppAddBlockHook(
XtAppContext /* app_context */,
XtBlockHookProc /* proc */,
XtPointer /* client_data */
);
extern void XtRemoveBlockHook(
XtBlockHookId /* id */
);
/****************************************************************
*
* Random utility routines
*
****************************************************************/
#define XtIsRectObj(object) (_XtCheckSubclassFlag(object, (XtEnum)0x02))
#define XtIsWidget(object) (_XtCheckSubclassFlag(object, (XtEnum)0x04))
#define XtIsComposite(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x08))
#define XtIsConstraint(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x10))
#define XtIsShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x20))
#undef XtIsOverrideShell
extern Boolean XtIsOverrideShell(Widget /* object */);
#define XtIsOverrideShell(widget) \
(_XtIsSubclassOf(widget, (WidgetClass)overrideShellWidgetClass, \
(WidgetClass)shellWidgetClass, (XtEnum)0x20))
#define XtIsWMShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x40))
#undef XtIsVendorShell
extern Boolean XtIsVendorShell(Widget /* object */);
#define XtIsVendorShell(widget) \
(_XtIsSubclassOf(widget, (WidgetClass)vendorShellWidgetClass, \
(WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
#undef XtIsTransientShell
extern Boolean XtIsTransientShell(Widget /* object */);
#define XtIsTransientShell(widget) \
(_XtIsSubclassOf(widget, (WidgetClass)transientShellWidgetClass, \
(WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
#define XtIsTopLevelShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x80))
#undef XtIsApplicationShell
extern Boolean XtIsApplicationShell(Widget /* object */);
#define XtIsApplicationShell(widget) \
(_XtIsSubclassOf(widget, (WidgetClass)applicationShellWidgetClass, \
(WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80))
#undef XtIsSessionShell
extern Boolean XtIsSessionShell(Widget /* object */);
#define XtIsSessionShell(widget) \
(_XtIsSubclassOf(widget, (WidgetClass)sessionShellWidgetClass, \
(WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80))
extern void XtRealizeWidget(
Widget /* widget */
);
void XtUnrealizeWidget(
Widget /* widget */
);
extern void XtDestroyWidget(
Widget /* widget */
);
extern void XtSetSensitive(
Widget /* widget */,
_XtBoolean /* sensitive */
);
extern void XtSetMappedWhenManaged(
Widget /* widget */,
_XtBoolean /* mapped_when_managed */
);
extern Widget XtNameToWidget(
Widget /* reference */,
_Xconst _XtString /* names */
);
extern Widget XtWindowToWidget(
Display* /* display */,
Window /* window */
);
extern XtPointer XtGetClassExtension(
WidgetClass /* object_class */,
Cardinal /* byte_offset */,
XrmQuark /* type */,
long /* version */,
Cardinal /* record_size */
);
/***************************************************************
*
* Arg lists
*
****************************************************************/
#define XtSetArg(arg, n, d) \
((void)( (arg).name = (n), (arg).value = (XtArgVal)(d) ))
extern ArgList XtMergeArgLists(
ArgList /* args1 */,
Cardinal /* num_args1 */,
ArgList /* args2 */,
Cardinal /* num_args2 */
);
/***************************************************************
*
* Vararg lists
*
****************************************************************/
#define XtVaNestedList "XtVaNestedList"
#define XtVaTypedArg "XtVaTypedArg"
extern XtVarArgsList XtVaCreateArgsList(
XtPointer /*unused*/, ...
) _X_SENTINEL(0);
/*************************************************************
*
* Information routines
*
************************************************************/
#ifndef _XtIntrinsicP_h
/* We're not included from the private file, so define these */
extern Display *XtDisplay(
Widget /* widget */
);
extern Display *XtDisplayOfObject(
Widget /* object */
);
extern Screen *XtScreen(
Widget /* widget */
);
extern Screen *XtScreenOfObject(
Widget /* object */
);
extern Window XtWindow(
Widget /* widget */
);
extern Window XtWindowOfObject(
Widget /* object */
);
extern String XtName(
Widget /* object */
);
extern WidgetClass XtSuperclass(
Widget /* object */
);
extern WidgetClass XtClass(
Widget /* object */
);
extern Widget XtParent(
Widget /* widget */
);
#endif /*_XtIntrinsicP_h*/
#undef XtMapWidget
extern void XtMapWidget(Widget /* w */);
#define XtMapWidget(widget) XMapWindow(XtDisplay(widget), XtWindow(widget))
#undef XtUnmapWidget
extern void XtUnmapWidget(Widget /* w */);
#define XtUnmapWidget(widget) \
XUnmapWindow(XtDisplay(widget), XtWindow(widget))
extern void XtAddCallback(
Widget /* widget */,
_Xconst _XtString /* callback_name */,
XtCallbackProc /* callback */,
XtPointer /* closure */
);
extern void XtRemoveCallback(
Widget /* widget */,
_Xconst _XtString /* callback_name */,
XtCallbackProc /* callback */,
XtPointer /* closure */
);
extern void XtAddCallbacks(
Widget /* widget */,
_Xconst _XtString /* callback_name */,
XtCallbackList /* callbacks */
);
extern void XtRemoveCallbacks(
Widget /* widget */,
_Xconst _XtString /* callback_name */,
XtCallbackList /* callbacks */
);
extern void XtRemoveAllCallbacks(
Widget /* widget */,
_Xconst _XtString /* callback_name */
);
extern void XtCallCallbacks(
Widget /* widget */,
_Xconst _XtString /* callback_name */,
XtPointer /* call_data */
);
extern void XtCallCallbackList(
Widget /* widget */,
XtCallbackList /* callbacks */,
XtPointer /* call_data */
);
extern XtCallbackStatus XtHasCallbacks(
Widget /* widget */,
_Xconst _XtString /* callback_name */
);
/****************************************************************
*
* Geometry Management
*
****************************************************************/
extern XtGeometryResult XtMakeGeometryRequest(
Widget /* widget */,
XtWidgetGeometry* /* request */,
XtWidgetGeometry* /* reply_return */
);
extern XtGeometryResult XtQueryGeometry(
Widget /* widget */,
XtWidgetGeometry* /* intended */,
XtWidgetGeometry* /* preferred_return */
);
extern Widget XtCreatePopupShell(
_Xconst _XtString /* name */,
WidgetClass /* widgetClass */,
Widget /* parent */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtVaCreatePopupShell(
_Xconst _XtString /* name */,
WidgetClass /* widgetClass */,
Widget /* parent */,
...
) _X_SENTINEL(0);
extern void XtPopup(
Widget /* popup_shell */,
XtGrabKind /* grab_kind */
);
extern void XtPopupSpringLoaded(
Widget /* popup_shell */
);
extern void XtCallbackNone(
Widget /* widget */,
XtPointer /* closure */,
XtPointer /* call_data */
);
extern void XtCallbackNonexclusive(
Widget /* widget */,
XtPointer /* closure */,
XtPointer /* call_data */
);
extern void XtCallbackExclusive(
Widget /* widget */,
XtPointer /* closure */,
XtPointer /* call_data */
);
extern void XtPopdown(
Widget /* popup_shell */
);
extern void XtCallbackPopdown(
Widget /* widget */,
XtPointer /* closure */,
XtPointer /* call_data */
);
extern void XtMenuPopupAction(
Widget /* widget */,
XEvent* /* event */,
String* /* params */,
Cardinal* /* num_params */
);
extern Widget XtCreateWidget(
_Xconst _XtString /* name */,
WidgetClass /* widget_class */,
Widget /* parent */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtCreateManagedWidget(
_Xconst _XtString /* name */,
WidgetClass /* widget_class */,
Widget /* parent */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtVaCreateWidget(
_Xconst _XtString /* name */,
WidgetClass /* widget */,
Widget /* parent */,
...
) _X_SENTINEL(0);
extern Widget XtVaCreateManagedWidget(
_Xconst _XtString /* name */,
WidgetClass /* widget_class */,
Widget /* parent */,
...
) _X_SENTINEL(0);
extern Widget XtCreateApplicationShell( /* obsolete */
_Xconst _XtString /* name */,
WidgetClass /* widget_class */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtAppCreateShell(
_Xconst _XtString /* application_name */,
_Xconst _XtString /* application_class */,
WidgetClass /* widget_class */,
Display* /* display */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtVaAppCreateShell(
_Xconst _XtString /* application_name */,
_Xconst _XtString /* application_class */,
WidgetClass /* widget_class */,
Display* /* display */,
...
) _X_SENTINEL(0);
/****************************************************************
*
* Toolkit initialization
*
****************************************************************/
extern void XtToolkitInitialize(
void
);
extern XtLanguageProc XtSetLanguageProc(
XtAppContext /* app_context */,
XtLanguageProc /* proc */,
XtPointer /* client_data */
);
extern void XtDisplayInitialize(
XtAppContext /* app_context */,
Display* /* dpy */,
_Xconst _XtString /* application_name */,
_Xconst _XtString /* application_class */,
XrmOptionDescRec* /* options */,
Cardinal /* num_options */,
int* /* argc */,
char** /* argv */
);
extern Widget XtOpenApplication(
XtAppContext* /* app_context_return */,
_Xconst _XtString /* application_class */,
XrmOptionDescList /* options */,
Cardinal /* num_options */,
int* /* argc_in_out */,
String* /* argv_in_out */,
String* /* fallback_resources */,
WidgetClass /* widget_class */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtVaOpenApplication(
XtAppContext* /* app_context_return */,
_Xconst _XtString /* application_class */,
XrmOptionDescList /* options */,
Cardinal /* num_options */,
int* /* argc_in_out */,
String* /* argv_in_out */,
String* /* fallback_resources */,
WidgetClass /* widget_class */,
...
) _X_SENTINEL(0);
extern Widget XtAppInitialize( /* obsolete */
XtAppContext* /* app_context_return */,
_Xconst _XtString /* application_class */,
XrmOptionDescList /* options */,
Cardinal /* num_options */,
int* /* argc_in_out */,
String* /* argv_in_out */,
String* /* fallback_resources */,
ArgList /* args */,
Cardinal /* num_args */
);
extern Widget XtVaAppInitialize( /* obsolete */
XtAppContext* /* app_context_return */,
_Xconst _XtString /* application_class */,
XrmOptionDescList /* options */,
Cardinal /* num_options */,
int* /* argc_in_out */,
String* /* argv_in_out */,
String* /* fallback_resources */,
...
) _X_SENTINEL(0);
extern Widget XtInitialize( /* obsolete */
_Xconst _XtString /* shell_name */,
_Xconst _XtString /* application_class */,
XrmOptionDescRec* /* options */,
Cardinal /* num_options */,
int* /* argc */,
char** /* argv */
);
extern Display *XtOpenDisplay(
XtAppContext /* app_context */,
_Xconst _XtString /* display_string */,
_Xconst _XtString /* application_name */,
_Xconst _XtString /* application_class */,
XrmOptionDescRec* /* options */,
Cardinal /* num_options */,
int* /* argc */,
char** /* argv */
);
extern XtAppContext XtCreateApplicationContext(
void
);
extern void XtAppSetFallbackResources(
XtAppContext /* app_context */,
String* /* specification_list */
);
extern void XtDestroyApplicationContext(
XtAppContext /* app_context */
);
extern void XtInitializeWidgetClass(
WidgetClass /* widget_class */
);
extern XtAppContext XtWidgetToApplicationContext(
Widget /* widget */
);
extern XtAppContext XtDisplayToApplicationContext(
Display* /* dpy */
);
extern XrmDatabase XtDatabase(
Display* /* dpy */
);
extern XrmDatabase XtScreenDatabase(
Screen* /* screen */
);
extern void XtCloseDisplay(
Display* /* dpy */
);
extern void XtGetApplicationResources(
Widget /* widget */,
XtPointer /* base */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
ArgList /* args */,
Cardinal /* num_args */
);
extern void XtVaGetApplicationResources(
Widget /* widget */,
XtPointer /* base */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
...
) _X_SENTINEL(0);
extern void XtGetSubresources(
Widget /* widget */,
XtPointer /* base */,
_Xconst _XtString /* name */,
_Xconst _XtString /* class */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
ArgList /* args */,
Cardinal /* num_args */
);
extern void XtVaGetSubresources(
Widget /* widget */,
XtPointer /* base */,
_Xconst _XtString /* name */,
_Xconst _XtString /* class */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
...
) _X_SENTINEL(0);
extern void XtSetValues(
Widget /* widget */,
ArgList /* args */,
Cardinal /* num_args */
);
extern void XtVaSetValues(
Widget /* widget */,
...
) _X_SENTINEL(0);
extern void XtGetValues(
Widget /* widget */,
ArgList /* args */,
Cardinal /* num_args */
);
extern void XtVaGetValues(
Widget /* widget */,
...
) _X_SENTINEL(0);
extern void XtSetSubvalues(
XtPointer /* base */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
ArgList /* args */,
Cardinal /* num_args */
);
extern void XtVaSetSubvalues(
XtPointer /* base */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
...
) _X_SENTINEL(0);
extern void XtGetSubvalues(
XtPointer /* base */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
ArgList /* args */,
Cardinal /* num_args */
);
extern void XtVaGetSubvalues(
XtPointer /* base */,
XtResourceList /* resources */,
Cardinal /* num_resources */,
...
) _X_SENTINEL(0);
extern void XtGetResourceList(
WidgetClass /* widget_class */,
XtResourceList* /* resources_return */,
Cardinal* /* num_resources_return */
);
extern void XtGetConstraintResourceList(
WidgetClass /* widget_class */,
XtResourceList* /* resources_return */,
Cardinal* /* num_resources_return */
);
#define XtUnspecifiedPixmap ((Pixmap)2)
#define XtUnspecifiedShellInt (-1)
#define XtUnspecifiedWindow ((Window)2)
#define XtUnspecifiedWindowGroup ((Window)3)
#define XtCurrentDirectory "XtCurrentDirectory"
#define XtDefaultForeground "XtDefaultForeground"
#define XtDefaultBackground "XtDefaultBackground"
#define XtDefaultFont "XtDefaultFont"
#define XtDefaultFontSet "XtDefaultFontSet"
#define XtOffset(p_type,field) \
((Cardinal) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
#ifdef offsetof
#define XtOffsetOf(s_type,field) offsetof(s_type,field)
#else
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
#endif
/*************************************************************
*
* Session Management
*
************************************************************/
typedef struct _XtCheckpointTokenRec {
int save_type;
int interact_style;
Boolean shutdown;
Boolean fast;
Boolean cancel_shutdown;
int phase;
int interact_dialog_type; /* return */
Boolean request_cancel; /* return */
Boolean request_next_phase; /* return */
Boolean save_success; /* return */
int type; /* implementation private */
Widget widget; /* implementation private */
} XtCheckpointTokenRec, *XtCheckpointToken;
XtCheckpointToken XtSessionGetToken(
Widget /* widget */
);
void XtSessionReturnToken(
XtCheckpointToken /* token */
);
/*************************************************************
*
* Error Handling
*
************************************************************/
extern XtErrorMsgHandler XtAppSetErrorMsgHandler(
XtAppContext /* app_context */,
XtErrorMsgHandler /* handler */
);
extern void XtSetErrorMsgHandler( /* obsolete */
XtErrorMsgHandler /* handler */
);
extern XtErrorMsgHandler XtAppSetWarningMsgHandler(
XtAppContext /* app_context */,
XtErrorMsgHandler /* handler */
);
extern void XtSetWarningMsgHandler( /* obsolete */
XtErrorMsgHandler /* handler */
);
extern void XtAppErrorMsg(
XtAppContext /* app_context */,
_Xconst _XtString /* name */,
_Xconst _XtString /* type */,
_Xconst _XtString /* class */,
_Xconst _XtString /* default */,
String* /* params */,
Cardinal* /* num_params */
);
extern void XtErrorMsg( /* obsolete */
_Xconst _XtString /* name */,
_Xconst _XtString /* type */,
_Xconst _XtString /* class */,
_Xconst _XtString /* default */,
String* /* params */,
Cardinal* /* num_params */
);
extern void XtAppWarningMsg(
XtAppContext /* app_context */,
_Xconst _XtString /* name */,
_Xconst _XtString /* type */,
_Xconst _XtString /* class */,
_Xconst _XtString /* default */,
String* /* params */,
Cardinal* /* num_params */
);
extern void XtWarningMsg( /* obsolete */
_Xconst _XtString /* name */,
_Xconst _XtString /* type */,
_Xconst _XtString /* class */,
_Xconst _XtString /* default */,
String* /* params */,
Cardinal* /* num_params */
);
extern XtErrorHandler XtAppSetErrorHandler(
XtAppContext /* app_context */,
XtErrorHandler /* handler */
);
extern void XtSetErrorHandler( /* obsolete */
XtErrorHandler /* handler */
);
extern XtErrorHandler XtAppSetWarningHandler(
XtAppContext /* app_context */,
XtErrorHandler /* handler */
);
extern void XtSetWarningHandler( /* obsolete */
XtErrorHandler /* handler */
);
extern void XtAppError(
XtAppContext /* app_context */,
_Xconst _XtString /* message */
);
extern void XtError( /* obsolete */
_Xconst _XtString /* message */
);
extern void XtAppWarning(
XtAppContext /* app_context */,
_Xconst _XtString /* message */
);
extern void XtWarning( /* obsolete */
_Xconst _XtString /* message */
);
extern XrmDatabase *XtAppGetErrorDatabase(
XtAppContext /* app_context */
);
extern XrmDatabase *XtGetErrorDatabase( /* obsolete */
void
);
extern void XtAppGetErrorDatabaseText(
XtAppContext /* app_context */,
_Xconst _XtString /* name */,
_Xconst _XtString /* type */,
_Xconst _XtString /* class */,
_Xconst _XtString /* default */,
String /* buffer_return */,
int /* nbytes */,
XrmDatabase /* database */
);
extern void XtGetErrorDatabaseText( /* obsolete */
_Xconst _XtString /* name */,
_Xconst _XtString /* type */,
_Xconst _XtString /* class */,
_Xconst _XtString /* default */,
String /* buffer_return */,
int /* nbytes */
);
/****************************************************************
*
* Memory Management
*
****************************************************************/
extern char *XtMalloc(
Cardinal /* size */
);
extern char *XtCalloc(
Cardinal /* num */,
Cardinal /* size */
);
extern char *XtRealloc(
char* /* ptr */,
Cardinal /* num */
);
extern void XtFree(
char* /* ptr */
);
#ifndef _X_RESTRICT_KYWD
# define _X_RESTRICT_KYWD
#endif
extern Cardinal XtAsprintf(
String *new_string,
_Xconst char * _X_RESTRICT_KYWD format,
...
) _X_ATTRIBUTE_PRINTF(2,3);
#ifdef XTTRACEMEMORY
extern char *_XtMalloc( /* implementation-private */
Cardinal /* size */,
char * /* file */,
int /* line */
);
extern char *_XtRealloc( /* implementation-private */
char * /* ptr */,
Cardinal /* size */,
char * /* file */,
int /* line */
);
extern char *_XtCalloc( /* implementation-private */
Cardinal /* num */,
Cardinal /* size */,
char * /* file */,
int /* line */
);
extern void _XtFree( /* implementation-private */
char * /* ptr */
);
#define XtMalloc(size) _XtMalloc(size, __FILE__, __LINE__)
#define XtRealloc(ptr,size) _XtRealloc(ptr, size, __FILE__, __LINE__)
#define XtCalloc(num,size) _XtCalloc(num, size, __FILE__, __LINE__)
#define XtFree(ptr) _XtFree(ptr)
#endif /* ifdef XTTRACEMEMORY */
#define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type)))
#undef XtNewString
extern String XtNewString(String /* str */);
#define XtNewString(str) \
((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : NULL)
/*************************************************************
*
* Work procs
*
**************************************************************/
extern XtWorkProcId XtAddWorkProc( /* obsolete */
XtWorkProc /* proc */,
XtPointer /* closure */
);
extern XtWorkProcId XtAppAddWorkProc(
XtAppContext /* app_context */,
XtWorkProc /* proc */,
XtPointer /* closure */
);
extern void XtRemoveWorkProc(
XtWorkProcId /* id */
);
/****************************************************************
*
* Graphic Context Management
*****************************************************************/
extern GC XtGetGC(
Widget /* widget */,
XtGCMask /* valueMask */,
XGCValues* /* values */
);
extern GC XtAllocateGC(
Widget /* widget */,
Cardinal /* depth */,
XtGCMask /* valueMask */,
XGCValues* /* values */,
XtGCMask /* dynamicMask */,
XtGCMask /* unusedMask */
);
/* This implementation of XtDestroyGC differs from the formal specification
* for historic backwards compatibility reasons. As other implementations
* may conform to the spec, use of XtReleaseGC is strongly encouraged.
*/
extern void XtDestroyGC( /* obsolete */
GC /* gc */
);
extern void XtReleaseGC(
Widget /* object */,
GC /* gc */
);
extern void XtAppReleaseCacheRefs(
XtAppContext /* app_context */,
XtCacheRef* /* cache_ref */
);
extern void XtCallbackReleaseCacheRef(
Widget /* widget */,
XtPointer /* closure */, /* XtCacheRef */
XtPointer /* call_data */
);
extern void XtCallbackReleaseCacheRefList(
Widget /* widget */,
XtPointer /* closure */, /* XtCacheRef* */
XtPointer /* call_data */
);
extern void XtSetWMColormapWindows(
Widget /* widget */,
Widget* /* list */,
Cardinal /* count */
);
extern String XtFindFile(
_Xconst _XtString /* path */,
Substitution /* substitutions */,
Cardinal /* num_substitutions */,
XtFilePredicate /* predicate */
);
extern String XtResolvePathname(
Display* /* dpy */,
_Xconst _XtString /* type */,
_Xconst _XtString /* filename */,
_Xconst _XtString /* suffix */,
_Xconst _XtString /* path */,
Substitution /* substitutions */,
Cardinal /* num_substitutions */,
XtFilePredicate /* predicate */
);
/****************************************************************
*
* Selections
*
*****************************************************************/
#define XT_CONVERT_FAIL (Atom)0x80000001
extern void XtDisownSelection(
Widget /* widget */,
Atom /* selection */,
Time /* time */
);
extern void XtGetSelectionValue(
Widget /* widget */,
Atom /* selection */,
Atom /* target */,
XtSelectionCallbackProc /* callback */,
XtPointer /* closure */,
Time /* time */
);
extern void XtGetSelectionValues(
Widget /* widget */,
Atom /* selection */,
Atom* /* targets */,
int /* count */,
XtSelectionCallbackProc /* callback */,
XtPointer* /* closures */,
Time /* time */
);
extern void XtAppSetSelectionTimeout(
XtAppContext /* app_context */,
unsigned long /* timeout */
);
extern void XtSetSelectionTimeout( /* obsolete */
unsigned long /* timeout */
);
extern unsigned long XtAppGetSelectionTimeout(
XtAppContext /* app_context */
);
extern unsigned long XtGetSelectionTimeout( /* obsolete */
void
);
extern XSelectionRequestEvent *XtGetSelectionRequest(
Widget /* widget */,
Atom /* selection */,
XtRequestId /* request_id */
);
extern void XtGetSelectionValueIncremental(
Widget /* widget */,
Atom /* selection */,
Atom /* target */,
XtSelectionCallbackProc /* selection_callback */,
XtPointer /* client_data */,
Time /* time */
);
extern void XtGetSelectionValuesIncremental(
Widget /* widget */,
Atom /* selection */,
Atom* /* targets */,
int /* count */,
XtSelectionCallbackProc /* callback */,
XtPointer* /* client_data */,
Time /* time */
);
extern void XtSetSelectionParameters(
Widget /* requestor */,
Atom /* selection */,
Atom /* type */,
XtPointer /* value */,
unsigned long /* length */,
int /* format */
);
extern void XtGetSelectionParameters(
Widget /* owner */,
Atom /* selection */,
XtRequestId /* request_id */,
Atom* /* type_return */,
XtPointer* /* value_return */,
unsigned long* /* length_return */,
int* /* format_return */
);
extern void XtCreateSelectionRequest(
Widget /* requestor */,
Atom /* selection */
);
extern void XtSendSelectionRequest(
Widget /* requestor */,
Atom /* selection */,
Time /* time */
);
extern void XtCancelSelectionRequest(
Widget /* requestor */,
Atom /* selection */
);
extern Atom XtReservePropertyAtom(
Widget /* widget */
);
extern void XtReleasePropertyAtom(
Widget /* widget */,
Atom /* selection */
);
extern void XtGrabKey(
Widget /* widget */,
_XtKeyCode /* keycode */,
Modifiers /* modifiers */,
_XtBoolean /* owner_events */,
int /* pointer_mode */,
int /* keyboard_mode */
);
extern void XtUngrabKey(
Widget /* widget */,
_XtKeyCode /* keycode */,
Modifiers /* modifiers */
);
extern int XtGrabKeyboard(
Widget /* widget */,
_XtBoolean /* owner_events */,
int /* pointer_mode */,
int /* keyboard_mode */,
Time /* time */
);
extern void XtUngrabKeyboard(
Widget /* widget */,
Time /* time */
);
extern void XtGrabButton(
Widget /* widget */,
int /* button */,
Modifiers /* modifiers */,
_XtBoolean /* owner_events */,
unsigned int /* event_mask */,
int /* pointer_mode */,
int /* keyboard_mode */,
Window /* confine_to */,
Cursor /* cursor */
);
extern void XtUngrabButton(
Widget /* widget */,
unsigned int /* button */,
Modifiers /* modifiers */
);
extern int XtGrabPointer(
Widget /* widget */,
_XtBoolean /* owner_events */,
unsigned int /* event_mask */,
int /* pointer_mode */,
int /* keyboard_mode */,
Window /* confine_to */,
Cursor /* cursor */,
Time /* time */
);
extern void XtUngrabPointer(
Widget /* widget */,
Time /* time */
);
extern void XtGetApplicationNameAndClass(
Display* /* dpy */,
String* /* name_return */,
String* /* class_return */
);
extern void XtRegisterDrawable(
Display* /* dpy */,
Drawable /* drawable */,
Widget /* widget */
);
extern void XtUnregisterDrawable(
Display* /* dpy */,
Drawable /* drawable */
);
extern Widget XtHooksOfDisplay(
Display* /* dpy */
);
typedef struct {
String type;
Widget widget;
ArgList args;
Cardinal num_args;
} XtCreateHookDataRec, *XtCreateHookData;
typedef struct {
String type;
Widget widget;
XtPointer event_data;
Cardinal num_event_data;
} XtChangeHookDataRec, *XtChangeHookData;
typedef struct {
Widget old, req;
ArgList args;
Cardinal num_args;
} XtChangeHookSetValuesDataRec, *XtChangeHookSetValuesData;
typedef struct {
String type;
Widget widget;
XtGeometryMask changeMask;
XWindowChanges changes;
} XtConfigureHookDataRec, *XtConfigureHookData;
typedef struct {
String type;
Widget widget;
XtWidgetGeometry* request;
XtWidgetGeometry* reply;
XtGeometryResult result;
} XtGeometryHookDataRec, *XtGeometryHookData;
typedef struct {
String type;
Widget widget;
} XtDestroyHookDataRec, *XtDestroyHookData;
extern void XtGetDisplays(
XtAppContext /* app_context */,
Display*** /* dpy_return */,
Cardinal* /* num_dpy_return */
);
extern Boolean XtToolkitThreadInitialize(
void
);
extern void XtAppSetExitFlag(
XtAppContext /* app_context */
);
extern Boolean XtAppGetExitFlag(
XtAppContext /* app_context */
);
extern void XtAppLock(
XtAppContext /* app_context */
);
extern void XtAppUnlock(
XtAppContext /* app_context */
);
/*
* Predefined Resource Converters
*/
/* String converters */
extern Boolean XtCvtStringToAcceleratorTable(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToAtom(
Display* /* dpy */,
XrmValuePtr /* args */, /* Display */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToBool(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToBoolean(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToCommandArgArray(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToCursor(
Display* /* dpy */,
XrmValuePtr /* args */, /* Display */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToDimension(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToDirectoryString(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToDisplay(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToFile(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToFloat(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToFont(
Display* /* dpy */,
XrmValuePtr /* args */, /* Display */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToFontSet(
Display* /* dpy */,
XrmValuePtr /* args */, /* Display, locale */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToFontStruct(
Display* /* dpy */,
XrmValuePtr /* args */, /* Display */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToGravity(
Display* /* dpy */,
XrmValuePtr /* args */,
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToInitialState(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToInt(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToPixel(
Display* /* dpy */,
XrmValuePtr /* args */, /* Screen, Colormap */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
#define XtCvtStringToPosition XtCvtStringToShort
extern Boolean XtCvtStringToRestartStyle(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToShort(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToTranslationTable(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToUnsignedChar(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtStringToVisual(
Display* /* dpy */,
XrmValuePtr /* args */, /* Screen, depth */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
/* int converters */
extern Boolean XtCvtIntToBool(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtIntToBoolean(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtIntToColor(
Display* /* dpy */,
XrmValuePtr /* args */, /* Screen, Colormap */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
#define XtCvtIntToDimension XtCvtIntToShort
extern Boolean XtCvtIntToFloat(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtIntToFont(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtIntToPixel(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtIntToPixmap(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
#define XtCvtIntToPosition XtCvtIntToShort
extern Boolean XtCvtIntToShort(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
extern Boolean XtCvtIntToUnsignedChar(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
/* Color converter */
extern Boolean XtCvtColorToPixel(
Display* /* dpy */,
XrmValuePtr /* args */, /* none */
Cardinal* /* num_args */,
XrmValuePtr /* fromVal */,
XrmValuePtr /* toVal */,
XtPointer* /* closure_ret */
);
/* Pixel converter */
#define XtCvtPixelToColor XtCvtIntToColor
_XFUNCPROTOEND
#endif /*_XtIntrinsic_h*/
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* The "X11 Window System Protocol" standard defines in Appendix A the
* keysym codes. These 29-bit integer values identify characters or
* functions associated with each key (e.g., via the visible
* engraving) of a keyboard layout. This file assigns mnemonic macro
* names for these keysyms.
*
* This file is also compiled (by src/util/makekeys.c in libX11) into
* hash tables that can be accessed with X11 library functions such as
* XStringToKeysym() and XKeysymToString().
*
* Where a keysym corresponds one-to-one to an ISO 10646 / Unicode
* character, this is noted in a comment that provides both the U+xxxx
* Unicode position, as well as the official Unicode name of the
* character.
*
* Where the correspondence is either not one-to-one or semantically
* unclear, the Unicode position and name are enclosed in
* parentheses. Such legacy keysyms should be considered deprecated
* and are not recommended for use in future keyboard mappings.
*
* For any future extension of the keysyms with characters already
* found in ISO 10646 / Unicode, the following algorithm shall be
* used. The new keysym code position will simply be the character's
* Unicode number plus 0x01000000. The keysym values in the range
* 0x01000100 to 0x0110ffff are reserved to represent Unicode
* characters in the range U+0100 to U+10FFFF.
*
* While most newer Unicode-based X11 clients do already accept
* Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it
* will remain necessary for clients -- in the interest of
* compatibility with existing servers -- to also understand the
* existing legacy keysym values in the range 0x0100 to 0x20ff.
*
* Where several mnemonic names are defined for the same keysym in this
* file, all but the first one listed should be considered deprecated.
*
* Mnemonic names for keysyms are defined in this file with lines
* that match one of these Perl regular expressions:
*
* /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/
* /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/
* /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/
*
* Before adding new keysyms, please do consider the following: In
* addition to the keysym names defined in this file, the
* XStringToKeysym() and XKeysymToString() functions will also handle
* any keysym string of the form "U0020" to "U007E" and "U00A0" to
* "U10FFFF" for all possible Unicode characters. In other words,
* every possible Unicode character has already a keysym string
* defined algorithmically, even if it is not listed here. Therefore,
* defining an additional keysym macro is only necessary where a
* non-hexadecimal mnemonic name is needed, or where the new keysym
* does not represent any existing Unicode character.
*
* When adding new keysyms to this file, do not forget to also update the
* following as needed:
*
* - the mappings in src/KeyBind.c in the libX11 repo
* https://gitlab.freedesktop.org/xorg/lib/libx11
*
* - the protocol specification in specs/keysyms.xml in this repo
* https://gitlab.freedesktop.org/xorg/proto/xorgproto
*
*/
#define XK_VoidSymbol 0xffffff /* Void symbol */
#ifdef XK_MISCELLANY
/*
* TTY function keys, cleverly chosen to map to ASCII, for convenience of
* programming, but could have been arbitrary (at the cost of lookup
* tables in client code).
*/
#define XK_BackSpace 0xff08 /* Back space, back char */
#define XK_Tab 0xff09
#define XK_Linefeed 0xff0a /* Linefeed, LF */
#define XK_Clear 0xff0b
#define XK_Return 0xff0d /* Return, enter */
#define XK_Pause 0xff13 /* Pause, hold */
#define XK_Scroll_Lock 0xff14
#define XK_Sys_Req 0xff15
#define XK_Escape 0xff1b
#define XK_Delete 0xffff /* Delete, rubout */
/* International & multi-key character composition */
#define XK_Multi_key 0xff20 /* Multi-key character compose */
#define XK_Codeinput 0xff37
#define XK_SingleCandidate 0xff3c
#define XK_MultipleCandidate 0xff3d
#define XK_PreviousCandidate 0xff3e
/* Japanese keyboard support */
#define XK_Kanji 0xff21 /* Kanji, Kanji convert */
#define XK_Muhenkan 0xff22 /* Cancel Conversion */
#define XK_Henkan_Mode 0xff23 /* Start/Stop Conversion */
#define XK_Henkan 0xff23 /* Alias for Henkan_Mode */
#define XK_Romaji 0xff24 /* to Romaji */
#define XK_Hiragana 0xff25 /* to Hiragana */
#define XK_Katakana 0xff26 /* to Katakana */
#define XK_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */
#define XK_Zenkaku 0xff28 /* to Zenkaku */
#define XK_Hankaku 0xff29 /* to Hankaku */
#define XK_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */
#define XK_Touroku 0xff2b /* Add to Dictionary */
#define XK_Massyo 0xff2c /* Delete from Dictionary */
#define XK_Kana_Lock 0xff2d /* Kana Lock */
#define XK_Kana_Shift 0xff2e /* Kana Shift */
#define XK_Eisu_Shift 0xff2f /* Alphanumeric Shift */
#define XK_Eisu_toggle 0xff30 /* Alphanumeric toggle */
#define XK_Kanji_Bangou 0xff37 /* Codeinput */
#define XK_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */
#define XK_Mae_Koho 0xff3e /* Previous Candidate */
/* 0xff31 thru 0xff3f are under XK_KOREAN */
/* Cursor control & motion */
#define XK_Home 0xff50
#define XK_Left 0xff51 /* Move left, left arrow */
#define XK_Up 0xff52 /* Move up, up arrow */
#define XK_Right 0xff53 /* Move right, right arrow */
#define XK_Down 0xff54 /* Move down, down arrow */
#define XK_Prior 0xff55 /* Prior, previous */
#define XK_Page_Up 0xff55
#define XK_Next 0xff56 /* Next */
#define XK_Page_Down 0xff56
#define XK_End 0xff57 /* EOL */
#define XK_Begin 0xff58 /* BOL */
/* Misc functions */
#define XK_Select 0xff60 /* Select, mark */
#define XK_Print 0xff61
#define XK_Execute 0xff62 /* Execute, run, do */
#define XK_Insert 0xff63 /* Insert, insert here */
#define XK_Undo 0xff65
#define XK_Redo 0xff66 /* Redo, again */
#define XK_Menu 0xff67
#define XK_Find 0xff68 /* Find, search */
#define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */
#define XK_Help 0xff6a /* Help */
#define XK_Break 0xff6b
#define XK_Mode_switch 0xff7e /* Character set switch */
#define XK_script_switch 0xff7e /* Alias for mode_switch */
#define XK_Num_Lock 0xff7f
/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
#define XK_KP_Space 0xff80 /* Space */
#define XK_KP_Tab 0xff89
#define XK_KP_Enter 0xff8d /* Enter */
#define XK_KP_F1 0xff91 /* PF1, KP_A, ... */
#define XK_KP_F2 0xff92
#define XK_KP_F3 0xff93
#define XK_KP_F4 0xff94
#define XK_KP_Home 0xff95
#define XK_KP_Left 0xff96
#define XK_KP_Up 0xff97
#define XK_KP_Right 0xff98
#define XK_KP_Down 0xff99
#define XK_KP_Prior 0xff9a
#define XK_KP_Page_Up 0xff9a
#define XK_KP_Next 0xff9b
#define XK_KP_Page_Down 0xff9b
#define XK_KP_End 0xff9c
#define XK_KP_Begin 0xff9d
#define XK_KP_Insert 0xff9e
#define XK_KP_Delete 0xff9f
#define XK_KP_Equal 0xffbd /* Equals */
#define XK_KP_Multiply 0xffaa
#define XK_KP_Add 0xffab
#define XK_KP_Separator 0xffac /* Separator, often comma */
#define XK_KP_Subtract 0xffad
#define XK_KP_Decimal 0xffae
#define XK_KP_Divide 0xffaf
#define XK_KP_0 0xffb0
#define XK_KP_1 0xffb1
#define XK_KP_2 0xffb2
#define XK_KP_3 0xffb3
#define XK_KP_4 0xffb4
#define XK_KP_5 0xffb5
#define XK_KP_6 0xffb6
#define XK_KP_7 0xffb7
#define XK_KP_8 0xffb8
#define XK_KP_9 0xffb9
/*
* Auxiliary functions; note the duplicate definitions for left and right
* function keys; Sun keyboards and a few other manufacturers have such
* function key groups on the left and/or right sides of the keyboard.
* We've not found a keyboard with more than 35 function keys total.
*/
#define XK_F1 0xffbe
#define XK_F2 0xffbf
#define XK_F3 0xffc0
#define XK_F4 0xffc1
#define XK_F5 0xffc2
#define XK_F6 0xffc3
#define XK_F7 0xffc4
#define XK_F8 0xffc5
#define XK_F9 0xffc6
#define XK_F10 0xffc7
#define XK_F11 0xffc8
#define XK_L1 0xffc8
#define XK_F12 0xffc9
#define XK_L2 0xffc9
#define XK_F13 0xffca
#define XK_L3 0xffca
#define XK_F14 0xffcb
#define XK_L4 0xffcb
#define XK_F15 0xffcc
#define XK_L5 0xffcc
#define XK_F16 0xffcd
#define XK_L6 0xffcd
#define XK_F17 0xffce
#define XK_L7 0xffce
#define XK_F18 0xffcf
#define XK_L8 0xffcf
#define XK_F19 0xffd0
#define XK_L9 0xffd0
#define XK_F20 0xffd1
#define XK_L10 0xffd1
#define XK_F21 0xffd2
#define XK_R1 0xffd2
#define XK_F22 0xffd3
#define XK_R2 0xffd3
#define XK_F23 0xffd4
#define XK_R3 0xffd4
#define XK_F24 0xffd5
#define XK_R4 0xffd5
#define XK_F25 0xffd6
#define XK_R5 0xffd6
#define XK_F26 0xffd7
#define XK_R6 0xffd7
#define XK_F27 0xffd8
#define XK_R7 0xffd8
#define XK_F28 0xffd9
#define XK_R8 0xffd9
#define XK_F29 0xffda
#define XK_R9 0xffda
#define XK_F30 0xffdb
#define XK_R10 0xffdb
#define XK_F31 0xffdc
#define XK_R11 0xffdc
#define XK_F32 0xffdd
#define XK_R12 0xffdd
#define XK_F33 0xffde
#define XK_R13 0xffde
#define XK_F34 0xffdf
#define XK_R14 0xffdf
#define XK_F35 0xffe0
#define XK_R15 0xffe0
/* Modifiers */
#define XK_Shift_L 0xffe1 /* Left shift */
#define XK_Shift_R 0xffe2 /* Right shift */
#define XK_Control_L 0xffe3 /* Left control */
#define XK_Control_R 0xffe4 /* Right control */
#define XK_Caps_Lock 0xffe5 /* Caps lock */
#define XK_Shift_Lock 0xffe6 /* Shift lock */
#define XK_Meta_L 0xffe7 /* Left meta */
#define XK_Meta_R 0xffe8 /* Right meta */
#define XK_Alt_L 0xffe9 /* Left alt */
#define XK_Alt_R 0xffea /* Right alt */
#define XK_Super_L 0xffeb /* Left super */
#define XK_Super_R 0xffec /* Right super */
#define XK_Hyper_L 0xffed /* Left hyper */
#define XK_Hyper_R 0xffee /* Right hyper */
#endif /* XK_MISCELLANY */
/*
* Keyboard (XKB) Extension function and modifier keys
* (from Appendix C of "The X Keyboard Extension: Protocol Specification")
* Byte 3 = 0xfe
*/
#ifdef XK_XKB_KEYS
#define XK_ISO_Lock 0xfe01
#define XK_ISO_Level2_Latch 0xfe02
#define XK_ISO_Level3_Shift 0xfe03
#define XK_ISO_Level3_Latch 0xfe04
#define XK_ISO_Level3_Lock 0xfe05
#define XK_ISO_Level5_Shift 0xfe11
#define XK_ISO_Level5_Latch 0xfe12
#define XK_ISO_Level5_Lock 0xfe13
#define XK_ISO_Group_Shift 0xff7e /* Alias for mode_switch */
#define XK_ISO_Group_Latch 0xfe06
#define XK_ISO_Group_Lock 0xfe07
#define XK_ISO_Next_Group 0xfe08
#define XK_ISO_Next_Group_Lock 0xfe09
#define XK_ISO_Prev_Group 0xfe0a
#define XK_ISO_Prev_Group_Lock 0xfe0b
#define XK_ISO_First_Group 0xfe0c
#define XK_ISO_First_Group_Lock 0xfe0d
#define XK_ISO_Last_Group 0xfe0e
#define XK_ISO_Last_Group_Lock 0xfe0f
#define XK_ISO_Left_Tab 0xfe20
#define XK_ISO_Move_Line_Up 0xfe21
#define XK_ISO_Move_Line_Down 0xfe22
#define XK_ISO_Partial_Line_Up 0xfe23
#define XK_ISO_Partial_Line_Down 0xfe24
#define XK_ISO_Partial_Space_Left 0xfe25
#define XK_ISO_Partial_Space_Right 0xfe26
#define XK_ISO_Set_Margin_Left 0xfe27
#define XK_ISO_Set_Margin_Right 0xfe28
#define XK_ISO_Release_Margin_Left 0xfe29
#define XK_ISO_Release_Margin_Right 0xfe2a
#define XK_ISO_Release_Both_Margins 0xfe2b
#define XK_ISO_Fast_Cursor_Left 0xfe2c
#define XK_ISO_Fast_Cursor_Right 0xfe2d
#define XK_ISO_Fast_Cursor_Up 0xfe2e
#define XK_ISO_Fast_Cursor_Down 0xfe2f
#define XK_ISO_Continuous_Underline 0xfe30
#define XK_ISO_Discontinuous_Underline 0xfe31
#define XK_ISO_Emphasize 0xfe32
#define XK_ISO_Center_Object 0xfe33
#define XK_ISO_Enter 0xfe34
#define XK_dead_grave 0xfe50
#define XK_dead_acute 0xfe51
#define XK_dead_circumflex 0xfe52
#define XK_dead_tilde 0xfe53
#define XK_dead_perispomeni 0xfe53 /* alias for dead_tilde */
#define XK_dead_macron 0xfe54
#define XK_dead_breve 0xfe55
#define XK_dead_abovedot 0xfe56
#define XK_dead_diaeresis 0xfe57
#define XK_dead_abovering 0xfe58
#define XK_dead_doubleacute 0xfe59
#define XK_dead_caron 0xfe5a
#define XK_dead_cedilla 0xfe5b
#define XK_dead_ogonek 0xfe5c
#define XK_dead_iota 0xfe5d
#define XK_dead_voiced_sound 0xfe5e
#define XK_dead_semivoiced_sound 0xfe5f
#define XK_dead_belowdot 0xfe60
#define XK_dead_hook 0xfe61
#define XK_dead_horn 0xfe62
#define XK_dead_stroke 0xfe63
#define XK_dead_abovecomma 0xfe64
#define XK_dead_psili 0xfe64 /* alias for dead_abovecomma */
#define XK_dead_abovereversedcomma 0xfe65
#define XK_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */
#define XK_dead_doublegrave 0xfe66
#define XK_dead_belowring 0xfe67
#define XK_dead_belowmacron 0xfe68
#define XK_dead_belowcircumflex 0xfe69
#define XK_dead_belowtilde 0xfe6a
#define XK_dead_belowbreve 0xfe6b
#define XK_dead_belowdiaeresis 0xfe6c
#define XK_dead_invertedbreve 0xfe6d
#define XK_dead_belowcomma 0xfe6e
#define XK_dead_currency 0xfe6f
/* extra dead elements for German T3 layout */
#define XK_dead_lowline 0xfe90
#define XK_dead_aboveverticalline 0xfe91
#define XK_dead_belowverticalline 0xfe92
#define XK_dead_longsolidusoverlay 0xfe93
/* dead vowels for universal syllable entry */
#define XK_dead_a 0xfe80
#define XK_dead_A 0xfe81
#define XK_dead_e 0xfe82
#define XK_dead_E 0xfe83
#define XK_dead_i 0xfe84
#define XK_dead_I 0xfe85
#define XK_dead_o 0xfe86
#define XK_dead_O 0xfe87
#define XK_dead_u 0xfe88
#define XK_dead_U 0xfe89
#define XK_dead_small_schwa 0xfe8a
#define XK_dead_capital_schwa 0xfe8b
#define XK_dead_greek 0xfe8c
#define XK_First_Virtual_Screen 0xfed0
#define XK_Prev_Virtual_Screen 0xfed1
#define XK_Next_Virtual_Screen 0xfed2
#define XK_Last_Virtual_Screen 0xfed4
#define XK_Terminate_Server 0xfed5
#define XK_AccessX_Enable 0xfe70
#define XK_AccessX_Feedback_Enable 0xfe71
#define XK_RepeatKeys_Enable 0xfe72
#define XK_SlowKeys_Enable 0xfe73
#define XK_BounceKeys_Enable 0xfe74
#define XK_StickyKeys_Enable 0xfe75
#define XK_MouseKeys_Enable 0xfe76
#define XK_MouseKeys_Accel_Enable 0xfe77
#define XK_Overlay1_Enable 0xfe78
#define XK_Overlay2_Enable 0xfe79
#define XK_AudibleBell_Enable 0xfe7a
#define XK_Pointer_Left 0xfee0
#define XK_Pointer_Right 0xfee1
#define XK_Pointer_Up 0xfee2
#define XK_Pointer_Down 0xfee3
#define XK_Pointer_UpLeft 0xfee4
#define XK_Pointer_UpRight 0xfee5
#define XK_Pointer_DownLeft 0xfee6
#define XK_Pointer_DownRight 0xfee7
#define XK_Pointer_Button_Dflt 0xfee8
#define XK_Pointer_Button1 0xfee9
#define XK_Pointer_Button2 0xfeea
#define XK_Pointer_Button3 0xfeeb
#define XK_Pointer_Button4 0xfeec
#define XK_Pointer_Button5 0xfeed
#define XK_Pointer_DblClick_Dflt 0xfeee
#define XK_Pointer_DblClick1 0xfeef
#define XK_Pointer_DblClick2 0xfef0
#define XK_Pointer_DblClick3 0xfef1
#define XK_Pointer_DblClick4 0xfef2
#define XK_Pointer_DblClick5 0xfef3
#define XK_Pointer_Drag_Dflt 0xfef4
#define XK_Pointer_Drag1 0xfef5
#define XK_Pointer_Drag2 0xfef6
#define XK_Pointer_Drag3 0xfef7
#define XK_Pointer_Drag4 0xfef8
#define XK_Pointer_Drag5 0xfefd
#define XK_Pointer_EnableKeys 0xfef9
#define XK_Pointer_Accelerate 0xfefa
#define XK_Pointer_DfltBtnNext 0xfefb
#define XK_Pointer_DfltBtnPrev 0xfefc
/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */
#define XK_ch 0xfea0
#define XK_Ch 0xfea1
#define XK_CH 0xfea2
#define XK_c_h 0xfea3
#define XK_C_h 0xfea4
#define XK_C_H 0xfea5
#endif /* XK_XKB_KEYS */
/*
* 3270 Terminal Keys
* Byte 3 = 0xfd
*/
#ifdef XK_3270
#define XK_3270_Duplicate 0xfd01
#define XK_3270_FieldMark 0xfd02
#define XK_3270_Right2 0xfd03
#define XK_3270_Left2 0xfd04
#define XK_3270_BackTab 0xfd05
#define XK_3270_EraseEOF 0xfd06
#define XK_3270_EraseInput 0xfd07
#define XK_3270_Reset 0xfd08
#define XK_3270_Quit 0xfd09
#define XK_3270_PA1 0xfd0a
#define XK_3270_PA2 0xfd0b
#define XK_3270_PA3 0xfd0c
#define XK_3270_Test 0xfd0d
#define XK_3270_Attn 0xfd0e
#define XK_3270_CursorBlink 0xfd0f
#define XK_3270_AltCursor 0xfd10
#define XK_3270_KeyClick 0xfd11
#define XK_3270_Jump 0xfd12
#define XK_3270_Ident 0xfd13
#define XK_3270_Rule 0xfd14
#define XK_3270_Copy 0xfd15
#define XK_3270_Play 0xfd16
#define XK_3270_Setup 0xfd17
#define XK_3270_Record 0xfd18
#define XK_3270_ChangeScreen 0xfd19
#define XK_3270_DeleteWord 0xfd1a
#define XK_3270_ExSelect 0xfd1b
#define XK_3270_CursorSelect 0xfd1c
#define XK_3270_PrintScreen 0xfd1d
#define XK_3270_Enter 0xfd1e
#endif /* XK_3270 */
/*
* Latin 1
* (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
* Byte 3 = 0
*/
#ifdef XK_LATIN1
#define XK_space 0x0020 /* U+0020 SPACE */
#define XK_exclam 0x0021 /* U+0021 EXCLAMATION MARK */
#define XK_quotedbl 0x0022 /* U+0022 QUOTATION MARK */
#define XK_numbersign 0x0023 /* U+0023 NUMBER SIGN */
#define XK_dollar 0x0024 /* U+0024 DOLLAR SIGN */
#define XK_percent 0x0025 /* U+0025 PERCENT SIGN */
#define XK_ampersand 0x0026 /* U+0026 AMPERSAND */
#define XK_apostrophe 0x0027 /* U+0027 APOSTROPHE */
#define XK_quoteright 0x0027 /* deprecated */
#define XK_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */
#define XK_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */
#define XK_asterisk 0x002a /* U+002A ASTERISK */
#define XK_plus 0x002b /* U+002B PLUS SIGN */
#define XK_comma 0x002c /* U+002C COMMA */
#define XK_minus 0x002d /* U+002D HYPHEN-MINUS */
#define XK_period 0x002e /* U+002E FULL STOP */
#define XK_slash 0x002f /* U+002F SOLIDUS */
#define XK_0 0x0030 /* U+0030 DIGIT ZERO */
#define XK_1 0x0031 /* U+0031 DIGIT ONE */
#define XK_2 0x0032 /* U+0032 DIGIT TWO */
#define XK_3 0x0033 /* U+0033 DIGIT THREE */
#define XK_4 0x0034 /* U+0034 DIGIT FOUR */
#define XK_5 0x0035 /* U+0035 DIGIT FIVE */
#define XK_6 0x0036 /* U+0036 DIGIT SIX */
#define XK_7 0x0037 /* U+0037 DIGIT SEVEN */
#define XK_8 0x0038 /* U+0038 DIGIT EIGHT */
#define XK_9 0x0039 /* U+0039 DIGIT NINE */
#define XK_colon 0x003a /* U+003A COLON */
#define XK_semicolon 0x003b /* U+003B SEMICOLON */
#define XK_less 0x003c /* U+003C LESS-THAN SIGN */
#define XK_equal 0x003d /* U+003D EQUALS SIGN */
#define XK_greater 0x003e /* U+003E GREATER-THAN SIGN */
#define XK_question 0x003f /* U+003F QUESTION MARK */
#define XK_at 0x0040 /* U+0040 COMMERCIAL AT */
#define XK_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */
#define XK_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */
#define XK_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */
#define XK_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */
#define XK_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */
#define XK_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */
#define XK_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */
#define XK_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */
#define XK_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */
#define XK_J 0x004a /* U+004A LATIN CAPITAL LETTER J */
#define XK_K 0x004b /* U+004B LATIN CAPITAL LETTER K */
#define XK_L 0x004c /* U+004C LATIN CAPITAL LETTER L */
#define XK_M 0x004d /* U+004D LATIN CAPITAL LETTER M */
#define XK_N 0x004e /* U+004E LATIN CAPITAL LETTER N */
#define XK_O 0x004f /* U+004F LATIN CAPITAL LETTER O */
#define XK_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */
#define XK_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */
#define XK_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */
#define XK_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */
#define XK_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */
#define XK_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */
#define XK_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */
#define XK_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */
#define XK_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */
#define XK_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */
#define XK_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */
#define XK_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */
#define XK_backslash 0x005c /* U+005C REVERSE SOLIDUS */
#define XK_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */
#define XK_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */
#define XK_underscore 0x005f /* U+005F LOW LINE */
#define XK_grave 0x0060 /* U+0060 GRAVE ACCENT */
#define XK_quoteleft 0x0060 /* deprecated */
#define XK_a 0x0061 /* U+0061 LATIN SMALL LETTER A */
#define XK_b 0x0062 /* U+0062 LATIN SMALL LETTER B */
#define XK_c 0x0063 /* U+0063 LATIN SMALL LETTER C */
#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */
#define XK_e 0x0065 /* U+0065 LATIN SMALL LETTER E */
#define XK_f 0x0066 /* U+0066 LATIN SMALL LETTER F */
#define XK_g 0x0067 /* U+0067 LATIN SMALL LETTER G */
#define XK_h 0x0068 /* U+0068 LATIN SMALL LETTER H */
#define XK_i 0x0069 /* U+0069 LATIN SMALL LETTER I */
#define XK_j 0x006a /* U+006A LATIN SMALL LETTER J */
#define XK_k 0x006b /* U+006B LATIN SMALL LETTER K */
#define XK_l 0x006c /* U+006C LATIN SMALL LETTER L */
#define XK_m 0x006d /* U+006D LATIN SMALL LETTER M */
#define XK_n 0x006e /* U+006E LATIN SMALL LETTER N */
#define XK_o 0x006f /* U+006F LATIN SMALL LETTER O */
#define XK_p 0x0070 /* U+0070 LATIN SMALL LETTER P */
#define XK_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */
#define XK_r 0x0072 /* U+0072 LATIN SMALL LETTER R */
#define XK_s 0x0073 /* U+0073 LATIN SMALL LETTER S */
#define XK_t 0x0074 /* U+0074 LATIN SMALL LETTER T */
#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */
#define XK_v 0x0076 /* U+0076 LATIN SMALL LETTER V */
#define XK_w 0x0077 /* U+0077 LATIN SMALL LETTER W */
#define XK_x 0x0078 /* U+0078 LATIN SMALL LETTER X */
#define XK_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */
#define XK_z 0x007a /* U+007A LATIN SMALL LETTER Z */
#define XK_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */
#define XK_bar 0x007c /* U+007C VERTICAL LINE */
#define XK_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */
#define XK_asciitilde 0x007e /* U+007E TILDE */
#define XK_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */
#define XK_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */
#define XK_cent 0x00a2 /* U+00A2 CENT SIGN */
#define XK_sterling 0x00a3 /* U+00A3 POUND SIGN */
#define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */
#define XK_yen 0x00a5 /* U+00A5 YEN SIGN */
#define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */
#define XK_section 0x00a7 /* U+00A7 SECTION SIGN */
#define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */
#define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */
#define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */
#define XK_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
#define XK_notsign 0x00ac /* U+00AC NOT SIGN */
#define XK_hyphen 0x00ad /* U+00AD SOFT HYPHEN */
#define XK_registered 0x00ae /* U+00AE REGISTERED SIGN */
#define XK_macron 0x00af /* U+00AF MACRON */
#define XK_degree 0x00b0 /* U+00B0 DEGREE SIGN */
#define XK_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */
#define XK_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */
#define XK_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */
#define XK_acute 0x00b4 /* U+00B4 ACUTE ACCENT */
#define XK_mu 0x00b5 /* U+00B5 MICRO SIGN */
#define XK_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */
#define XK_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */
#define XK_cedilla 0x00b8 /* U+00B8 CEDILLA */
#define XK_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */
#define XK_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */
#define XK_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
#define XK_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */
#define XK_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */
#define XK_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */
#define XK_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */
#define XK_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */
#define XK_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */
#define XK_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
#define XK_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */
#define XK_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */
#define XK_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */
#define XK_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */
#define XK_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */
#define XK_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */
#define XK_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
#define XK_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
#define XK_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */
#define XK_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */
#define XK_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */
#define XK_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
#define XK_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */
#define XK_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */
#define XK_Eth 0x00d0 /* deprecated */
#define XK_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */
#define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */
#define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */
#define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
#define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */
#define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */
#define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */
#define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
#define XK_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
#define XK_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */
#define XK_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */
#define XK_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
#define XK_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */
#define XK_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */
#define XK_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */
#define XK_Thorn 0x00de /* deprecated */
#define XK_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */
#define XK_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */
#define XK_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */
#define XK_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */
#define XK_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */
#define XK_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */
#define XK_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */
#define XK_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */
#define XK_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */
#define XK_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */
#define XK_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
#define XK_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */
#define XK_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */
#define XK_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */
#define XK_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */
#define XK_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */
#define XK_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */
#define XK_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */
#define XK_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */
#define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */
#define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */
#define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */
#define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */
#define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */
#define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */
#define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
#define XK_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
#define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */
#define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */
#define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */
#define XK_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */
#define XK_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */
#define XK_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */
#define XK_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
#endif /* XK_LATIN1 */
/*
* Latin 2
* Byte 3 = 1
*/
#ifdef XK_LATIN2
#define XK_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */
#define XK_breve 0x01a2 /* U+02D8 BREVE */
#define XK_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
#define XK_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */
#define XK_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */
#define XK_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */
#define XK_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */
#define XK_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */
#define XK_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */
#define XK_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */
#define XK_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */
#define XK_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */
#define XK_ogonek 0x01b2 /* U+02DB OGONEK */
#define XK_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */
#define XK_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */
#define XK_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */
#define XK_caron 0x01b7 /* U+02C7 CARON */
#define XK_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */
#define XK_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */
#define XK_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */
#define XK_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */
#define XK_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */
#define XK_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */
#define XK_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */
#define XK_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */
#define XK_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */
#define XK_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */
#define XK_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */
#define XK_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */
#define XK_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */
#define XK_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */
#define XK_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */
#define XK_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */
#define XK_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */
#define XK_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */
#define XK_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
#define XK_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */
#define XK_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */
#define XK_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
#define XK_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */
#define XK_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */
#define XK_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */
#define XK_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */
#define XK_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */
#define XK_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */
#define XK_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */
#define XK_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */
#define XK_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */
#define XK_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */
#define XK_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */
#define XK_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */
#define XK_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */
#define XK_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */
#define XK_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */
#define XK_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */
#define XK_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */
#define XK_abovedot 0x01ff /* U+02D9 DOT ABOVE */
#endif /* XK_LATIN2 */
/*
* Latin 3
* Byte 3 = 2
*/
#ifdef XK_LATIN3
#define XK_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */
#define XK_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
#define XK_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */
#define XK_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */
#define XK_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
#define XK_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */
#define XK_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */
#define XK_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */
#define XK_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */
#define XK_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */
#define XK_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */
#define XK_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
#define XK_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */
#define XK_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
#define XK_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */
#define XK_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
#define XK_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */
#define XK_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */
#define XK_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */
#define XK_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */
#define XK_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */
#define XK_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */
#endif /* XK_LATIN3 */
/*
* Latin 4
* Byte 3 = 3
*/
#ifdef XK_LATIN4
#define XK_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */
#define XK_kappa 0x03a2 /* deprecated */
#define XK_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */
#define XK_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */
#define XK_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */
#define XK_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */
#define XK_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */
#define XK_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */
#define XK_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */
#define XK_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */
#define XK_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */
#define XK_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */
#define XK_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */
#define XK_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */
#define XK_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */
#define XK_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */
#define XK_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */
#define XK_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */
#define XK_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */
#define XK_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */
#define XK_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */
#define XK_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */
#define XK_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */
#define XK_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */
#define XK_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */
#define XK_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */
#define XK_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */
#define XK_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */
#define XK_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */
#define XK_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */
#define XK_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */
#define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */
#define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */
#define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */
#define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */
#define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */
#endif /* XK_LATIN4 */
/*
* Latin 8
*/
#ifdef XK_LATIN8
#define XK_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */
#define XK_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */
#define XK_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */
#define XK_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */
#define XK_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */
#define XK_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */
#define XK_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */
#define XK_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */
#define XK_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */
#define XK_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */
#define XK_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */
#define XK_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */
#define XK_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */
#define XK_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */
#define XK_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */
#define XK_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */
#define XK_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */
#define XK_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */
#define XK_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */
#define XK_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */
#define XK_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */
#define XK_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */
#define XK_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */
#define XK_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */
#define XK_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */
#define XK_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */
#endif /* XK_LATIN8 */
/*
* Latin 9
* Byte 3 = 0x13
*/
#ifdef XK_LATIN9
#define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */
#define XK_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */
#define XK_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */
#endif /* XK_LATIN9 */
/*
* Katakana
* Byte 3 = 4
*/
#ifdef XK_KATAKANA
#define XK_overline 0x047e /* U+203E OVERLINE */
#define XK_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */
#define XK_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */
#define XK_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */
#define XK_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */
#define XK_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */
#define XK_kana_middledot 0x04a5 /* deprecated */
#define XK_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */
#define XK_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */
#define XK_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */
#define XK_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */
#define XK_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */
#define XK_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */
#define XK_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */
#define XK_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */
#define XK_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */
#define XK_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */
#define XK_kana_tu 0x04af /* deprecated */
#define XK_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */
#define XK_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */
#define XK_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */
#define XK_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */
#define XK_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */
#define XK_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */
#define XK_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */
#define XK_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */
#define XK_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */
#define XK_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */
#define XK_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */
#define XK_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */
#define XK_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */
#define XK_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */
#define XK_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */
#define XK_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */
#define XK_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */
#define XK_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */
#define XK_kana_TI 0x04c1 /* deprecated */
#define XK_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */
#define XK_kana_TU 0x04c2 /* deprecated */
#define XK_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */
#define XK_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */
#define XK_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */
#define XK_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */
#define XK_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */
#define XK_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */
#define XK_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */
#define XK_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */
#define XK_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */
#define XK_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */
#define XK_kana_HU 0x04cc /* deprecated */
#define XK_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */
#define XK_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */
#define XK_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */
#define XK_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */
#define XK_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */
#define XK_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */
#define XK_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */
#define XK_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */
#define XK_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */
#define XK_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */
#define XK_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */
#define XK_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */
#define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */
#define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */
#define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */
#define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */
#define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */
#define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */
#define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
#define XK_kana_switch 0xff7e /* Alias for mode_switch */
#endif /* XK_KATAKANA */
/*
* Arabic
* Byte 3 = 5
*/
#ifdef XK_ARABIC
#define XK_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */
#define XK_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */
#define XK_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */
#define XK_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */
#define XK_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */
#define XK_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */
#define XK_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */
#define XK_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */
#define XK_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */
#define XK_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */
#define XK_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */
#define XK_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */
#define XK_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */
#define XK_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */
#define XK_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */
#define XK_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */
#define XK_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */
#define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */
#define XK_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */
#define XK_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */
#define XK_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */
#define XK_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */
#define XK_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */
#define XK_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */
#define XK_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */
#define XK_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */
#define XK_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */
#define XK_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */
#define XK_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */
#define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */
#define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */
#define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */
#define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */
#define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */
#define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */
#define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */
#define XK_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */
#define XK_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */
#define XK_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */
#define XK_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */
#define XK_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */
#define XK_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */
#define XK_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */
#define XK_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */
#define XK_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */
#define XK_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */
#define XK_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */
#define XK_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */
#define XK_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */
#define XK_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */
#define XK_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */
#define XK_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */
#define XK_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */
#define XK_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */
#define XK_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */
#define XK_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */
#define XK_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */
#define XK_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */
#define XK_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */
#define XK_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */
#define XK_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */
#define XK_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */
#define XK_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */
#define XK_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */
#define XK_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */
#define XK_Arabic_heh 0x05e7 /* deprecated */
#define XK_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */
#define XK_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */
#define XK_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */
#define XK_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */
#define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */
#define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */
#define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */
#define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */
#define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */
#define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */
#define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */
#define XK_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */
#define XK_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */
#define XK_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */
#define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */
#define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */
#define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */
#define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */
#define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */
#define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */
#define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */
#define XK_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */
#define XK_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */
#define XK_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */
#define XK_Arabic_switch 0xff7e /* Alias for mode_switch */
#endif /* XK_ARABIC */
/*
* Cyrillic
* Byte 3 = 6
*/
#ifdef XK_CYRILLIC
#define XK_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */
#define XK_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */
#define XK_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */
#define XK_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */
#define XK_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */
#define XK_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */
#define XK_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */
#define XK_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */
#define XK_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */
#define XK_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */
#define XK_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */
#define XK_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */
#define XK_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */
#define XK_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */
#define XK_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */
#define XK_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */
#define XK_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */
#define XK_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */
#define XK_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */
#define XK_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */
#define XK_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */
#define XK_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */
#define XK_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */
#define XK_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */
#define XK_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */
#define XK_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */
#define XK_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */
#define XK_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */
#define XK_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */
#define XK_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */
#define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */
#define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */
#define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */
#define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */
#define XK_Ukranian_je 0x06a4 /* deprecated */
#define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */
#define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
#define XK_Ukranian_i 0x06a6 /* deprecated */
#define XK_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */
#define XK_Ukranian_yi 0x06a7 /* deprecated */
#define XK_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */
#define XK_Serbian_je 0x06a8 /* deprecated */
#define XK_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */
#define XK_Serbian_lje 0x06a9 /* deprecated */
#define XK_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */
#define XK_Serbian_nje 0x06aa /* deprecated */
#define XK_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */
#define XK_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */
#define XK_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */
#define XK_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */
#define XK_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */
#define XK_Serbian_dze 0x06af /* deprecated */
#define XK_numerosign 0x06b0 /* U+2116 NUMERO SIGN */
#define XK_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */
#define XK_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */
#define XK_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */
#define XK_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */
#define XK_Ukranian_JE 0x06b4 /* deprecated */
#define XK_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */
#define XK_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
#define XK_Ukranian_I 0x06b6 /* deprecated */
#define XK_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */
#define XK_Ukranian_YI 0x06b7 /* deprecated */
#define XK_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */
#define XK_Serbian_JE 0x06b8 /* deprecated */
#define XK_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */
#define XK_Serbian_LJE 0x06b9 /* deprecated */
#define XK_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */
#define XK_Serbian_NJE 0x06ba /* deprecated */
#define XK_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */
#define XK_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */
#define XK_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
#define XK_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */
#define XK_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */
#define XK_Serbian_DZE 0x06bf /* deprecated */
#define XK_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */
#define XK_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */
#define XK_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */
#define XK_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */
#define XK_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */
#define XK_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */
#define XK_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */
#define XK_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */
#define XK_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */
#define XK_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */
#define XK_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */
#define XK_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */
#define XK_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */
#define XK_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */
#define XK_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */
#define XK_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */
#define XK_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */
#define XK_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */
#define XK_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */
#define XK_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */
#define XK_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */
#define XK_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */
#define XK_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */
#define XK_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */
#define XK_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */
#define XK_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */
#define XK_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */
#define XK_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */
#define XK_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */
#define XK_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */
#define XK_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */
#define XK_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */
#define XK_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */
#define XK_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */
#define XK_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */
#define XK_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */
#define XK_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */
#define XK_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */
#define XK_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */
#define XK_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */
#define XK_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */
#define XK_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */
#define XK_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */
#define XK_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */
#define XK_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */
#define XK_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */
#define XK_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */
#define XK_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */
#define XK_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */
#define XK_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */
#define XK_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */
#define XK_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */
#define XK_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */
#define XK_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */
#define XK_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */
#define XK_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */
#define XK_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */
#define XK_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */
#define XK_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */
#define XK_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */
#define XK_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */
#define XK_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
#define XK_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */
#define XK_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */
#endif /* XK_CYRILLIC */
/*
* Greek
* (based on an early draft of, and not quite identical to, ISO/IEC 8859-7)
* Byte 3 = 7
*/
#ifdef XK_GREEK
#define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */
#define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */
#define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */
#define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */
#define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
#define XK_Greek_IOTAdiaeresis 0x07a5 /* old typo */
#define XK_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */
#define XK_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */
#define XK_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
#define XK_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */
#define XK_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */
#define XK_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */
#define XK_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */
#define XK_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */
#define XK_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */
#define XK_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */
#define XK_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */
#define XK_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
#define XK_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */
#define XK_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */
#define XK_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
#define XK_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
#define XK_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */
#define XK_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */
#define XK_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */
#define XK_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */
#define XK_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */
#define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */
#define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */
#define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */
#define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */
#define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */
#define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */
#define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */
#define XK_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */
#define XK_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */
#define XK_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */
#define XK_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */
#define XK_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */
#define XK_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */
#define XK_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */
#define XK_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */
#define XK_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */
#define XK_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */
#define XK_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */
#define XK_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */
#define XK_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */
#define XK_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */
#define XK_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */
#define XK_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */
#define XK_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */
#define XK_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */
#define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */
#define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */
#define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */
#define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */
#define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */
#define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */
#define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */
#define XK_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */
#define XK_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */
#define XK_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */
#define XK_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */
#define XK_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */
#define XK_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */
#define XK_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */
#define XK_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */
#define XK_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */
#define XK_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */
#define XK_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */
#define XK_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */
#define XK_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */
#define XK_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */
#define XK_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */
#define XK_Greek_switch 0xff7e /* Alias for mode_switch */
#endif /* XK_GREEK */
/*
* Technical
* (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html)
* Byte 3 = 8
*/
#ifdef XK_TECHNICAL
#define XK_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */
#define XK_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/
#define XK_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/
#define XK_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */
#define XK_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */
#define XK_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/
#define XK_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */
#define XK_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */
#define XK_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */
#define XK_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */
#define XK_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */
#define XK_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */
#define XK_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */
#define XK_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */
#define XK_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */
#define XK_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */
#define XK_topleftsummation 0x08b1
#define XK_botleftsummation 0x08b2
#define XK_topvertsummationconnector 0x08b3
#define XK_botvertsummationconnector 0x08b4
#define XK_toprightsummation 0x08b5
#define XK_botrightsummation 0x08b6
#define XK_rightmiddlesummation 0x08b7
#define XK_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */
#define XK_notequal 0x08bd /* U+2260 NOT EQUAL TO */
#define XK_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */
#define XK_integral 0x08bf /* U+222B INTEGRAL */
#define XK_therefore 0x08c0 /* U+2234 THEREFORE */
#define XK_variation 0x08c1 /* U+221D PROPORTIONAL TO */
#define XK_infinity 0x08c2 /* U+221E INFINITY */
#define XK_nabla 0x08c5 /* U+2207 NABLA */
#define XK_approximate 0x08c8 /* U+223C TILDE OPERATOR */
#define XK_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */
#define XK_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */
#define XK_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */
#define XK_identical 0x08cf /* U+2261 IDENTICAL TO */
#define XK_radical 0x08d6 /* U+221A SQUARE ROOT */
#define XK_includedin 0x08da /* U+2282 SUBSET OF */
#define XK_includes 0x08db /* U+2283 SUPERSET OF */
#define XK_intersection 0x08dc /* U+2229 INTERSECTION */
#define XK_union 0x08dd /* U+222A UNION */
#define XK_logicaland 0x08de /* U+2227 LOGICAL AND */
#define XK_logicalor 0x08df /* U+2228 LOGICAL OR */
#define XK_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */
#define XK_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */
#define XK_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */
#define XK_uparrow 0x08fc /* U+2191 UPWARDS ARROW */
#define XK_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */
#define XK_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */
#endif /* XK_TECHNICAL */
/*
* Special
* (from the DEC VT100 Special Graphics Character Set)
* Byte 3 = 9
*/
#ifdef XK_SPECIAL
#define XK_blank 0x09df
#define XK_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */
#define XK_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */
#define XK_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */
#define XK_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */
#define XK_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */
#define XK_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */
#define XK_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */
#define XK_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */
#define XK_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */
#define XK_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */
#define XK_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */
#define XK_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */
#define XK_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
#define XK_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */
#define XK_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */
#define XK_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */
#define XK_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */
#define XK_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */
#define XK_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
#define XK_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */
#define XK_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */
#define XK_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
#define XK_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
#endif /* XK_SPECIAL */
/*
* Publishing
* (these are probably from a long forgotten DEC Publishing
* font that once shipped with DECwrite)
* Byte 3 = 0x0a
*/
#ifdef XK_PUBLISHING
#define XK_emspace 0x0aa1 /* U+2003 EM SPACE */
#define XK_enspace 0x0aa2 /* U+2002 EN SPACE */
#define XK_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */
#define XK_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */
#define XK_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */
#define XK_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */
#define XK_thinspace 0x0aa7 /* U+2009 THIN SPACE */
#define XK_hairspace 0x0aa8 /* U+200A HAIR SPACE */
#define XK_emdash 0x0aa9 /* U+2014 EM DASH */
#define XK_endash 0x0aaa /* U+2013 EN DASH */
#define XK_signifblank 0x0aac /*(U+2423 OPEN BOX)*/
#define XK_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */
#define XK_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */
#define XK_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */
#define XK_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */
#define XK_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */
#define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */
#define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */
#define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */
#define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */
#define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */
#define XK_careof 0x0ab8 /* U+2105 CARE OF */
#define XK_figdash 0x0abb /* U+2012 FIGURE DASH */
#define XK_leftanglebracket 0x0abc /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/
#define XK_decimalpoint 0x0abd /*(U+002E FULL STOP)*/
#define XK_rightanglebracket 0x0abe /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/
#define XK_marker 0x0abf
#define XK_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */
#define XK_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */
#define XK_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */
#define XK_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */
#define XK_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */
#define XK_signaturemark 0x0aca /*(U+2613 SALTIRE)*/
#define XK_trademarkincircle 0x0acb
#define XK_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/
#define XK_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/
#define XK_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/
#define XK_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/
#define XK_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */
#define XK_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */
#define XK_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */
#define XK_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */
#define XK_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */
#define XK_permille 0x0ad5 /* U+2030 PER MILLE SIGN */
#define XK_minutes 0x0ad6 /* U+2032 PRIME */
#define XK_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */
#define XK_latincross 0x0ad9 /* U+271D LATIN CROSS */
#define XK_hexagram 0x0ada
#define XK_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/
#define XK_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/
#define XK_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/
#define XK_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/
#define XK_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/
#define XK_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/
#define XK_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/
#define XK_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/
#define XK_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/
#define XK_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/
#define XK_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/
#define XK_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/
#define XK_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/
#define XK_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/
#define XK_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/
#define XK_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/
#define XK_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/
#define XK_club 0x0aec /* U+2663 BLACK CLUB SUIT */
#define XK_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */
#define XK_heart 0x0aee /* U+2665 BLACK HEART SUIT */
#define XK_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */
#define XK_dagger 0x0af1 /* U+2020 DAGGER */
#define XK_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */
#define XK_checkmark 0x0af3 /* U+2713 CHECK MARK */
#define XK_ballotcross 0x0af4 /* U+2717 BALLOT X */
#define XK_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */
#define XK_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */
#define XK_malesymbol 0x0af7 /* U+2642 MALE SIGN */
#define XK_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */
#define XK_telephone 0x0af9 /* U+260E BLACK TELEPHONE */
#define XK_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */
#define XK_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */
#define XK_caret 0x0afc /* U+2038 CARET */
#define XK_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */
#define XK_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */
#define XK_cursor 0x0aff
#endif /* XK_PUBLISHING */
/*
* APL
* Byte 3 = 0x0b
*/
#ifdef XK_APL
#define XK_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/
#define XK_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/
#define XK_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/
#define XK_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/
#define XK_overbar 0x0bc0 /*(U+00AF MACRON)*/
#define XK_downtack 0x0bc2 /* U+22A4 DOWN TACK */
#define XK_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/
#define XK_downstile 0x0bc4 /* U+230A LEFT FLOOR */
#define XK_underbar 0x0bc6 /*(U+005F LOW LINE)*/
#define XK_jot 0x0bca /* U+2218 RING OPERATOR */
#define XK_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */
#define XK_uptack 0x0bce /* U+22A5 UP TACK */
#define XK_circle 0x0bcf /* U+25CB WHITE CIRCLE */
#define XK_upstile 0x0bd3 /* U+2308 LEFT CEILING */
#define XK_downshoe 0x0bd6 /*(U+222A UNION)*/
#define XK_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/
#define XK_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/
#define XK_lefttack 0x0bdc /* U+22A3 LEFT TACK */
#define XK_righttack 0x0bfc /* U+22A2 RIGHT TACK */
#endif /* XK_APL */
/*
* Hebrew
* Byte 3 = 0x0c
*/
#ifdef XK_HEBREW
#define XK_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */
#define XK_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */
#define XK_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */
#define XK_hebrew_beth 0x0ce1 /* deprecated */
#define XK_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */
#define XK_hebrew_gimmel 0x0ce2 /* deprecated */
#define XK_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */
#define XK_hebrew_daleth 0x0ce3 /* deprecated */
#define XK_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */
#define XK_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */
#define XK_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */
#define XK_hebrew_zayin 0x0ce6 /* deprecated */
#define XK_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */
#define XK_hebrew_het 0x0ce7 /* deprecated */
#define XK_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */
#define XK_hebrew_teth 0x0ce8 /* deprecated */
#define XK_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */
#define XK_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */
#define XK_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */
#define XK_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */
#define XK_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */
#define XK_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */
#define XK_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */
#define XK_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */
#define XK_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */
#define XK_hebrew_samekh 0x0cf1 /* deprecated */
#define XK_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */
#define XK_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */
#define XK_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */
#define XK_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */
#define XK_hebrew_finalzadi 0x0cf5 /* deprecated */
#define XK_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */
#define XK_hebrew_zadi 0x0cf6 /* deprecated */
#define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */
#define XK_hebrew_kuf 0x0cf7 /* deprecated */
#define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */
#define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */
#define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */
#define XK_hebrew_taf 0x0cfa /* deprecated */
#define XK_Hebrew_switch 0xff7e /* Alias for mode_switch */
#endif /* XK_HEBREW */
/*
* Thai
* Byte 3 = 0x0d
*/
#ifdef XK_THAI
#define XK_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */
#define XK_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */
#define XK_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */
#define XK_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */
#define XK_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */
#define XK_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */
#define XK_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */
#define XK_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */
#define XK_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */
#define XK_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */
#define XK_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */
#define XK_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */
#define XK_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */
#define XK_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */
#define XK_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */
#define XK_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */
#define XK_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */
#define XK_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */
#define XK_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */
#define XK_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */
#define XK_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */
#define XK_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */
#define XK_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */
#define XK_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */
#define XK_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */
#define XK_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */
#define XK_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */
#define XK_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */
#define XK_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */
#define XK_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */
#define XK_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */
#define XK_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */
#define XK_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */
#define XK_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */
#define XK_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */
#define XK_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */
#define XK_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */
#define XK_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */
#define XK_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */
#define XK_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */
#define XK_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */
#define XK_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */
#define XK_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */
#define XK_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */
#define XK_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */
#define XK_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */
#define XK_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */
#define XK_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */
#define XK_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */
#define XK_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */
#define XK_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */
#define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */
#define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */
#define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */
#define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */
#define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */
#define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */
#define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */
#define XK_Thai_maihanakat_maitho 0x0dde
#define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */
#define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */
#define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */
#define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */
#define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */
#define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */
#define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */
#define XK_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */
#define XK_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */
#define XK_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */
#define XK_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */
#define XK_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */
#define XK_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */
#define XK_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */
#define XK_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */
#define XK_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */
#define XK_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */
#define XK_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */
#define XK_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */
#define XK_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */
#define XK_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */
#define XK_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */
#define XK_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */
#define XK_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */
#define XK_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */
#endif /* XK_THAI */
/*
* Korean
* Byte 3 = 0x0e
*/
#ifdef XK_KOREAN
#define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */
#define XK_Hangul_Start 0xff32 /* Hangul start */
#define XK_Hangul_End 0xff33 /* Hangul end, English start */
#define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */
#define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */
#define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */
#define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */
#define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */
#define XK_Hangul_Banja 0xff39 /* Banja mode */
#define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */
#define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */
#define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */
#define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */
#define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */
#define XK_Hangul_Special 0xff3f /* Special symbols */
#define XK_Hangul_switch 0xff7e /* Alias for mode_switch */
/* Hangul Consonant Characters */
#define XK_Hangul_Kiyeog 0x0ea1
#define XK_Hangul_SsangKiyeog 0x0ea2
#define XK_Hangul_KiyeogSios 0x0ea3
#define XK_Hangul_Nieun 0x0ea4
#define XK_Hangul_NieunJieuj 0x0ea5
#define XK_Hangul_NieunHieuh 0x0ea6
#define XK_Hangul_Dikeud 0x0ea7
#define XK_Hangul_SsangDikeud 0x0ea8
#define XK_Hangul_Rieul 0x0ea9
#define XK_Hangul_RieulKiyeog 0x0eaa
#define XK_Hangul_RieulMieum 0x0eab
#define XK_Hangul_RieulPieub 0x0eac
#define XK_Hangul_RieulSios 0x0ead
#define XK_Hangul_RieulTieut 0x0eae
#define XK_Hangul_RieulPhieuf 0x0eaf
#define XK_Hangul_RieulHieuh 0x0eb0
#define XK_Hangul_Mieum 0x0eb1
#define XK_Hangul_Pieub 0x0eb2
#define XK_Hangul_SsangPieub 0x0eb3
#define XK_Hangul_PieubSios 0x0eb4
#define XK_Hangul_Sios 0x0eb5
#define XK_Hangul_SsangSios 0x0eb6
#define XK_Hangul_Ieung 0x0eb7
#define XK_Hangul_Jieuj 0x0eb8
#define XK_Hangul_SsangJieuj 0x0eb9
#define XK_Hangul_Cieuc 0x0eba
#define XK_Hangul_Khieuq 0x0ebb
#define XK_Hangul_Tieut 0x0ebc
#define XK_Hangul_Phieuf 0x0ebd
#define XK_Hangul_Hieuh 0x0ebe
/* Hangul Vowel Characters */
#define XK_Hangul_A 0x0ebf
#define XK_Hangul_AE 0x0ec0
#define XK_Hangul_YA 0x0ec1
#define XK_Hangul_YAE 0x0ec2
#define XK_Hangul_EO 0x0ec3
#define XK_Hangul_E 0x0ec4
#define XK_Hangul_YEO 0x0ec5
#define XK_Hangul_YE 0x0ec6
#define XK_Hangul_O 0x0ec7
#define XK_Hangul_WA 0x0ec8
#define XK_Hangul_WAE 0x0ec9
#define XK_Hangul_OE 0x0eca
#define XK_Hangul_YO 0x0ecb
#define XK_Hangul_U 0x0ecc
#define XK_Hangul_WEO 0x0ecd
#define XK_Hangul_WE 0x0ece
#define XK_Hangul_WI 0x0ecf
#define XK_Hangul_YU 0x0ed0
#define XK_Hangul_EU 0x0ed1
#define XK_Hangul_YI 0x0ed2
#define XK_Hangul_I 0x0ed3
/* Hangul syllable-final (JongSeong) Characters */
#define XK_Hangul_J_Kiyeog 0x0ed4
#define XK_Hangul_J_SsangKiyeog 0x0ed5
#define XK_Hangul_J_KiyeogSios 0x0ed6
#define XK_Hangul_J_Nieun 0x0ed7
#define XK_Hangul_J_NieunJieuj 0x0ed8
#define XK_Hangul_J_NieunHieuh 0x0ed9
#define XK_Hangul_J_Dikeud 0x0eda
#define XK_Hangul_J_Rieul 0x0edb
#define XK_Hangul_J_RieulKiyeog 0x0edc
#define XK_Hangul_J_RieulMieum 0x0edd
#define XK_Hangul_J_RieulPieub 0x0ede
#define XK_Hangul_J_RieulSios 0x0edf
#define XK_Hangul_J_RieulTieut 0x0ee0
#define XK_Hangul_J_RieulPhieuf 0x0ee1
#define XK_Hangul_J_RieulHieuh 0x0ee2
#define XK_Hangul_J_Mieum 0x0ee3
#define XK_Hangul_J_Pieub 0x0ee4
#define XK_Hangul_J_PieubSios 0x0ee5
#define XK_Hangul_J_Sios 0x0ee6
#define XK_Hangul_J_SsangSios 0x0ee7
#define XK_Hangul_J_Ieung 0x0ee8
#define XK_Hangul_J_Jieuj 0x0ee9
#define XK_Hangul_J_Cieuc 0x0eea
#define XK_Hangul_J_Khieuq 0x0eeb
#define XK_Hangul_J_Tieut 0x0eec
#define XK_Hangul_J_Phieuf 0x0eed
#define XK_Hangul_J_Hieuh 0x0eee
/* Ancient Hangul Consonant Characters */
#define XK_Hangul_RieulYeorinHieuh 0x0eef
#define XK_Hangul_SunkyeongeumMieum 0x0ef0
#define XK_Hangul_SunkyeongeumPieub 0x0ef1
#define XK_Hangul_PanSios 0x0ef2
#define XK_Hangul_KkogjiDalrinIeung 0x0ef3
#define XK_Hangul_SunkyeongeumPhieuf 0x0ef4
#define XK_Hangul_YeorinHieuh 0x0ef5
/* Ancient Hangul Vowel Characters */
#define XK_Hangul_AraeA 0x0ef6
#define XK_Hangul_AraeAE 0x0ef7
/* Ancient Hangul syllable-final (JongSeong) Characters */
#define XK_Hangul_J_PanSios 0x0ef8
#define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9
#define XK_Hangul_J_YeorinHieuh 0x0efa
/* Korean currency symbol */
#define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/
#endif /* XK_KOREAN */
/*
* Armenian
*/
#ifdef XK_ARMENIAN
#define XK_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */
#define XK_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */
#define XK_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */
#define XK_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */
#define XK_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */
#define XK_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */
#define XK_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */
#define XK_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */
#define XK_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */
#define XK_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */
#define XK_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */
#define XK_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */
#define XK_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */
#define XK_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */
#define XK_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */
#define XK_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */
#define XK_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */
#define XK_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */
#define XK_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */
#define XK_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */
#define XK_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */
#define XK_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */
#define XK_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */
#define XK_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */
#define XK_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */
#define XK_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */
#define XK_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */
#define XK_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */
#define XK_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */
#define XK_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */
#define XK_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */
#define XK_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */
#define XK_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */
#define XK_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */
#define XK_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */
#define XK_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */
#define XK_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */
#define XK_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */
#define XK_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */
#define XK_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */
#define XK_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */
#define XK_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */
#define XK_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */
#define XK_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */
#define XK_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */
#define XK_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */
#define XK_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */
#define XK_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */
#define XK_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */
#define XK_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */
#define XK_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */
#define XK_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */
#define XK_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */
#define XK_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */
#define XK_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */
#define XK_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */
#define XK_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */
#define XK_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */
#define XK_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */
#define XK_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */
#define XK_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */
#define XK_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */
#define XK_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */
#define XK_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */
#define XK_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */
#define XK_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */
#define XK_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */
#define XK_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */
#define XK_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */
#define XK_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */
#define XK_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */
#define XK_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */
#define XK_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */
#define XK_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */
#define XK_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */
#define XK_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */
#define XK_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */
#define XK_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */
#define XK_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */
#define XK_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */
#define XK_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */
#define XK_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */
#define XK_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */
#define XK_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */
#define XK_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */
#define XK_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */
#define XK_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */
#define XK_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */
#define XK_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */
#define XK_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */
#endif /* XK_ARMENIAN */
/*
* Georgian
*/
#ifdef XK_GEORGIAN
#define XK_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */
#define XK_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */
#define XK_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */
#define XK_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */
#define XK_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */
#define XK_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */
#define XK_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */
#define XK_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */
#define XK_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */
#define XK_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */
#define XK_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */
#define XK_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */
#define XK_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */
#define XK_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */
#define XK_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */
#define XK_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */
#define XK_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */
#define XK_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */
#define XK_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */
#define XK_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */
#define XK_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */
#define XK_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */
#define XK_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */
#define XK_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */
#define XK_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */
#define XK_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */
#define XK_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */
#define XK_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */
#define XK_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */
#define XK_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */
#define XK_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */
#define XK_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */
#define XK_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */
#define XK_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */
#define XK_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */
#define XK_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */
#define XK_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */
#define XK_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */
#define XK_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */
#endif /* XK_GEORGIAN */
/*
* Azeri (and other Turkic or Caucasian languages)
*/
#ifdef XK_CAUCASUS
/* latin */
#define XK_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */
#define XK_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */
#define XK_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */
#define XK_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */
#define XK_Ocaron 0x10001d1 /* U+01D1 LATIN CAPITAL LETTER O WITH CARON */
#define XK_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */
#define XK_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */
#define XK_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */
#define XK_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */
#define XK_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */
#define XK_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */
#define XK_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */
#define XK_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */
#define XK_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */
#define XK_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */
#define XK_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */
/* those are not really Caucasus */
/* For Inupiak */
#define XK_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */
#define XK_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */
#endif /* XK_CAUCASUS */
/*
* Vietnamese
*/
#ifdef XK_VIETNAMESE
#define XK_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */
#define XK_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */
#define XK_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */
#define XK_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */
#define XK_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */
#define XK_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */
#define XK_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */
#define XK_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */
#define XK_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
#define XK_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
#define XK_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */
#define XK_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */
#define XK_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
#define XK_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
#define XK_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */
#define XK_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */
#define XK_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */
#define XK_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */
#define XK_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */
#define XK_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */
#define XK_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */
#define XK_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */
#define XK_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */
#define XK_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */
#define XK_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */
#define XK_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */
#define XK_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */
#define XK_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */
#define XK_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */
#define XK_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */
#define XK_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */
#define XK_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */
#define XK_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */
#define XK_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */
#define XK_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
#define XK_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
#define XK_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */
#define XK_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */
#define XK_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
#define XK_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
#define XK_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */
#define XK_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */
#define XK_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */
#define XK_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */
#define XK_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */
#define XK_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */
#define XK_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */
#define XK_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */
#define XK_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */
#define XK_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */
#define XK_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */
#define XK_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */
#define XK_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
#define XK_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
#define XK_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */
#define XK_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */
#define XK_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
#define XK_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
#define XK_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */
#define XK_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */
#define XK_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */
#define XK_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */
#define XK_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */
#define XK_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */
#define XK_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */
#define XK_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */
#define XK_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */
#define XK_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */
#define XK_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */
#define XK_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */
#define XK_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */
#define XK_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */
#define XK_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */
#define XK_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */
#define XK_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */
#define XK_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */
#define XK_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */
#define XK_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */
#define XK_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */
#define XK_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */
#define XK_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */
#define XK_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */
#define XK_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */
#define XK_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */
#define XK_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */
#define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */
#define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */
#define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */
#define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */
#define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */
#define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */
#define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */
#endif /* XK_VIETNAMESE */
#ifdef XK_CURRENCY
#define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */
#define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */
#define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */
#define XK_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */
#define XK_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */
#define XK_MillSign 0x10020a5 /* U+20A5 MILL SIGN */
#define XK_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */
#define XK_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */
#define XK_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */
#define XK_WonSign 0x10020a9 /* U+20A9 WON SIGN */
#define XK_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */
#define XK_DongSign 0x10020ab /* U+20AB DONG SIGN */
#define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */
#endif /* XK_CURRENCY */
#ifdef XK_MATHEMATICAL
/* one, two and three are defined above. */
#define XK_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */
#define XK_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */
#define XK_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */
#define XK_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */
#define XK_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */
#define XK_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */
#define XK_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */
#define XK_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */
#define XK_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */
#define XK_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */
#define XK_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */
#define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */
#define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */
#define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */
#define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */
#define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */
#define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */
#define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */
#define XK_emptyset 0x1002205 /* U+2205 NULL SET */
#define XK_elementof 0x1002208 /* U+2208 ELEMENT OF */
#define XK_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */
#define XK_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */
#define XK_squareroot 0x100221A /* U+221A SQUARE ROOT */
#define XK_cuberoot 0x100221B /* U+221B CUBE ROOT */
#define XK_fourthroot 0x100221C /* U+221C FOURTH ROOT */
#define XK_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */
#define XK_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */
#define XK_because 0x1002235 /* U+2235 BECAUSE */
#define XK_approxeq 0x1002248 /* U+2245 ALMOST EQUAL TO */
#define XK_notapproxeq 0x1002247 /* U+2247 NOT ALMOST EQUAL TO */
#define XK_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */
#define XK_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */
#endif /* XK_MATHEMATICAL */
#ifdef XK_BRAILLE
#define XK_braille_dot_1 0xfff1
#define XK_braille_dot_2 0xfff2
#define XK_braille_dot_3 0xfff3
#define XK_braille_dot_4 0xfff4
#define XK_braille_dot_5 0xfff5
#define XK_braille_dot_6 0xfff6
#define XK_braille_dot_7 0xfff7
#define XK_braille_dot_8 0xfff8
#define XK_braille_dot_9 0xfff9
#define XK_braille_dot_10 0xfffa
#define XK_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */
#define XK_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */
#define XK_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */
#define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */
#define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */
#define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */
#define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */
#define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */
#define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */
#define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */
#define XK_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */
#define XK_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */
#define XK_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */
#define XK_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */
#define XK_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */
#define XK_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */
#define XK_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */
#define XK_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */
#define XK_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */
#define XK_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */
#define XK_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */
#define XK_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */
#define XK_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */
#define XK_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */
#define XK_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */
#define XK_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */
#define XK_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */
#define XK_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */
#define XK_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */
#define XK_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */
#define XK_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */
#define XK_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */
#define XK_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */
#define XK_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */
#define XK_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */
#define XK_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */
#define XK_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */
#define XK_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */
#define XK_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */
#define XK_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */
#define XK_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */
#define XK_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */
#define XK_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */
#define XK_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */
#define XK_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */
#define XK_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */
#define XK_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */
#define XK_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */
#define XK_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */
#define XK_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */
#define XK_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */
#define XK_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */
#define XK_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */
#define XK_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */
#define XK_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */
#define XK_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */
#define XK_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */
#define XK_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */
#define XK_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */
#define XK_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */
#define XK_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */
#define XK_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */
#define XK_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */
#define XK_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */
#define XK_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */
#define XK_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */
#define XK_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */
#define XK_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */
#define XK_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */
#define XK_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */
#define XK_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */
#define XK_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */
#define XK_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */
#define XK_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */
#define XK_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */
#define XK_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */
#define XK_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */
#define XK_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */
#define XK_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */
#define XK_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */
#define XK_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */
#define XK_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */
#define XK_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */
#define XK_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */
#define XK_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */
#define XK_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */
#define XK_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */
#define XK_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */
#define XK_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */
#define XK_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */
#define XK_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */
#define XK_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */
#define XK_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */
#define XK_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */
#define XK_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */
#define XK_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */
#define XK_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */
#define XK_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */
#define XK_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */
#define XK_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */
#define XK_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */
#define XK_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */
#define XK_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */
#define XK_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */
#define XK_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */
#define XK_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */
#define XK_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */
#define XK_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */
#define XK_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */
#define XK_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */
#define XK_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */
#define XK_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */
#define XK_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */
#define XK_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */
#define XK_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */
#define XK_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */
#define XK_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */
#define XK_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */
#define XK_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */
#define XK_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */
#define XK_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */
#define XK_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */
#define XK_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */
#define XK_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */
#define XK_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */
#define XK_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */
#define XK_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */
#define XK_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */
#define XK_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */
#define XK_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */
#define XK_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */
#define XK_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */
#define XK_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */
#define XK_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */
#define XK_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */
#define XK_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */
#define XK_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */
#define XK_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */
#define XK_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */
#define XK_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */
#define XK_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */
#define XK_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */
#define XK_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */
#define XK_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */
#define XK_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */
#define XK_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */
#define XK_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */
#define XK_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */
#define XK_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */
#define XK_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */
#define XK_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */
#define XK_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */
#define XK_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */
#define XK_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */
#define XK_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */
#define XK_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */
#define XK_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */
#define XK_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */
#define XK_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */
#define XK_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */
#define XK_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */
#define XK_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */
#define XK_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */
#define XK_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */
#define XK_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */
#define XK_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */
#define XK_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */
#define XK_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */
#define XK_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */
#define XK_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */
#define XK_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */
#define XK_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */
#define XK_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */
#define XK_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */
#define XK_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */
#define XK_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */
#define XK_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */
#define XK_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */
#define XK_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */
#define XK_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */
#define XK_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */
#define XK_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */
#define XK_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */
#define XK_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */
#define XK_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */
#define XK_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */
#define XK_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */
#define XK_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */
#define XK_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */
#define XK_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */
#define XK_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */
#define XK_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */
#define XK_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */
#define XK_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */
#define XK_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */
#define XK_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */
#define XK_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */
#define XK_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */
#define XK_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */
#define XK_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */
#define XK_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */
#define XK_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */
#define XK_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */
#define XK_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */
#define XK_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */
#define XK_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */
#define XK_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */
#define XK_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */
#define XK_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */
#define XK_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */
#define XK_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */
#define XK_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */
#define XK_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */
#define XK_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */
#define XK_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */
#define XK_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */
#define XK_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */
#define XK_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */
#define XK_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */
#define XK_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */
#define XK_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */
#define XK_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */
#define XK_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */
#define XK_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */
#define XK_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */
#define XK_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */
#define XK_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */
#define XK_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */
#define XK_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */
#define XK_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */
#define XK_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */
#define XK_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */
#define XK_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */
#define XK_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */
#define XK_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */
#define XK_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */
#define XK_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */
#define XK_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */
#define XK_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */
#define XK_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */
#define XK_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */
#define XK_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */
#define XK_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */
#define XK_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */
#define XK_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */
#define XK_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */
#define XK_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */
#define XK_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */
#define XK_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */
#define XK_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */
#define XK_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */
#define XK_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */
#define XK_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */
#define XK_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */
#define XK_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */
#define XK_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */
#endif /* XK_BRAILLE */
/*
* Sinhala (http://unicode.org/charts/PDF/U0D80.pdf)
* http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html
*/
#ifdef XK_SINHALA
#define XK_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */
#define XK_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */
#define XK_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */
#define XK_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */
#define XK_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */
#define XK_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */
#define XK_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */
#define XK_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */
#define XK_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */
#define XK_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */
#define XK_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */
#define XK_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */
#define XK_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */
#define XK_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */
#define XK_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */
#define XK_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */
#define XK_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */
#define XK_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */
#define XK_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */
#define XK_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */
#define XK_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */
#define XK_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */
#define XK_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */
#define XK_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */
#define XK_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */
#define XK_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */
#define XK_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */
#define XK_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */
#define XK_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */
#define XK_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */
#define XK_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */
#define XK_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */
#define XK_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */
#define XK_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */
#define XK_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */
#define XK_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */
#define XK_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */
#define XK_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */
#define XK_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */
#define XK_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */
#define XK_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */
#define XK_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */
#define XK_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */
#define XK_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */
#define XK_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */
#define XK_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */
#define XK_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */
#define XK_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */
#define XK_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */
#define XK_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */
#define XK_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */
#define XK_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */
#define XK_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */
#define XK_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */
#define XK_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */
#define XK_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */
#define XK_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */
#define XK_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */
#define XK_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */
#define XK_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */
#define XK_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */
#define XK_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */
#define XK_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */
#define XK_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */
#define XK_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */
#define XK_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */
#define XK_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */
#define XK_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */
#define XK_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */
#define XK_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */
#define XK_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */
#define XK_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */
#define XK_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */
#define XK_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/
#define XK_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/
#define XK_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */
#define XK_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */
#define XK_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */
#define XK_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */
#define XK_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */
#endif /* XK_SINHALA */
/*
Copyright 1995, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/*
* The purpose of this header is to define the macros ALLOCATE_LOCAL and
* DEALLOCATE_LOCAL appropriately for the platform being compiled on.
* These macros are used to make fast, function-local memory allocations.
* Their characteristics are as follows:
*
* void *ALLOCATE_LOCAL(size_t size)
* Returns a pointer to size bytes of memory, or NULL if the allocation
* failed. The memory must be freed with DEALLOCATE_LOCAL before the
* function that made the allocation returns. You should not ask for
* large blocks of memory with this function, since on many platforms
* the memory comes from the stack, which may have limited size.
*
* void DEALLOCATE_LOCAL(void *)
* Frees the memory allocated by ALLOCATE_LOCAL. Omission of this
* step may be harmless on some platforms, but will result in
* memory leaks or worse on others.
*
* Before including this file, you should define two macros,
* ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the
* same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The
* header uses the fallbacks if it doesn't know a "better" way to define
* ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be:
*
* #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size)
* #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr)
* #include "Xalloca.h"
*/
#ifndef XALLOCA_H
#define XALLOCA_H 1
#ifndef INCLUDE_ALLOCA_H
/* Need to add more here to match Imake *.cf's */
# if defined(HAVE_ALLOCA_H) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# define INCLUDE_ALLOCA_H
# endif
#endif
#ifdef INCLUDE_ALLOCA_H
# include <alloca.h>
#endif
#ifndef NO_ALLOCA
/*
* os-dependent definition of local allocation and deallocation
* If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK
* for ALLOCATE/DEALLOCATE_LOCAL then you add that in here.
*/
# ifdef __GNUC__
# ifndef alloca
# define alloca __builtin_alloca
# endif /* !alloca */
# define ALLOCATE_LOCAL(size) alloca((size_t)(size))
# else /* ! __GNUC__ */
/*
* warning: old mips alloca (pre 2.10) is unusable, new one is built in
* Test is easy, the new one is named __builtin_alloca and comes
* from alloca.h which #defines alloca.
*/
# if defined(__sun) || defined(alloca)
/*
* Some System V boxes extract alloca.o from /lib/libPW.a; if you
* decide that you don't want to use alloca, you might want to fix it here.
*/
/* alloca might be a macro taking one arg (hi, Sun!), so give it one. */
# if !defined(__cplusplus)
# define __Xnullarg /* as nothing */
extern void *alloca(__Xnullarg);
# endif
# define ALLOCATE_LOCAL(size) alloca((size_t)(size))
# endif /* who does alloca */
# endif /* __GNUC__ */
#endif /* NO_ALLOCA */
#if !defined(ALLOCATE_LOCAL)
# if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK)
# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size)
# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr)
# else /* no fallbacks supplied; error */
# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined!
# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined!
# endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */
#else
# if !defined(DEALLOCATE_LOCAL)
# define DEALLOCATE_LOCAL(_ptr) do {} while(0)
# endif
#endif /* defined(ALLOCATE_LOCAL) */
#endif /* XALLOCA_H */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtRect_h
#define _XtRect_h
_XFUNCPROTOBEGIN
typedef struct _RectObjRec *RectObj;
typedef struct _RectObjClassRec *RectObjClass;
#ifndef VMS
externalref WidgetClass rectObjClass;
#endif
_XFUNCPROTOEND
#endif /* _XtRect_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/*
Copyright 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/*
* Copyright © 2005 Daniel Stone
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Daniel Stone not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. Daniel Stone makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* DANIEL STONE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DANIEL STONE BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _XPOLL_H_
#define _XPOLL_H_
#if !defined(WIN32) || defined(__CYGWIN__)
#ifndef USE_POLL
#include <X11/Xos.h>
#include <sys/select.h> /* Get the FD_* macros. */
#include <X11/Xmd.h>
#ifdef CSRG_BASED
#include <sys/param.h>
# if BSD < 199103
typedef long fd_mask;
# endif
#endif
#if defined(FD_SETSIZE) && FD_SETSIZE < 512
# define XFD_SETSIZE FD_SETSIZE
#else
# define XFD_SETSIZE 512
# ifndef FD_SETSIZE
# define FD_SETSIZE XFD_SETSIZE
# endif
#endif
#ifndef NBBY
#define NBBY 8 /* number of bits in a byte */
#endif
#ifndef NFDBITS
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
#endif
#ifndef howmany
#define howmany(x,y) (((x)+((y)-1))/(y))
#endif
#if defined(BSD) && BSD < 198911
typedef struct fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} fd_set;
#endif
# define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
#define __X_FDS_BITS __fds_bits
#ifndef __FDS_BITS
# define __FDS_BITS(p) ((p)->__X_FDS_BITS)
#endif
#define __XFDS_BITS(p, n) (__FDS_BITS(p))[n]
#ifndef FD_SET
#define FD_SET(n, p) (__XFDS_BITS(p, ((n)/NFDBITS)) |= ((fd_mask)1 << ((n) % NFDBITS)))
#endif
#ifndef FD_CLR
#define FD_CLR(n, p) (__XFDS_BITS((p), ((n)/NFDBITS)) &= ~((fd_mask)1 << ((n) % NFDBITS)))
#endif
#ifndef FD_ISSET
#define FD_ISSET(n, p) ((__XFDS_BITS((p), ((n)/NFDBITS))) & ((fd_mask)1 << ((n) % NFDBITS)))
#endif
#ifndef FD_ZERO
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
#endif
/*
* The howmany(FD_SETSIZE, NFDBITS) computes the number of elements in the
* array. before accessing an element in the array we check it exists.
* If it does not exist then the compiler discards the code to access it.
*/
#define XFD_ANYSET(p) \
((howmany(FD_SETSIZE, NFDBITS) > 0 && (__XFDS_BITS(p, 0))) || \
(howmany(FD_SETSIZE, NFDBITS) > 1 && (__XFDS_BITS(p, 1))) || \
(howmany(FD_SETSIZE, NFDBITS) > 2 && (__XFDS_BITS(p, 2))) || \
(howmany(FD_SETSIZE, NFDBITS) > 3 && (__XFDS_BITS(p, 3))) || \
(howmany(FD_SETSIZE, NFDBITS) > 4 && (__XFDS_BITS(p, 4))) || \
(howmany(FD_SETSIZE, NFDBITS) > 5 && (__XFDS_BITS(p, 5))) || \
(howmany(FD_SETSIZE, NFDBITS) > 6 && (__XFDS_BITS(p, 6))) || \
(howmany(FD_SETSIZE, NFDBITS) > 7 && (__XFDS_BITS(p, 7))) || \
(howmany(FD_SETSIZE, NFDBITS) > 8 && (__XFDS_BITS(p, 8))) || \
(howmany(FD_SETSIZE, NFDBITS) > 9 && (__XFDS_BITS(p, 9))) || \
(howmany(FD_SETSIZE, NFDBITS) > 10 && (__XFDS_BITS(p, 10))) || \
(howmany(FD_SETSIZE, NFDBITS) > 11 && (__XFDS_BITS(p, 11))) || \
(howmany(FD_SETSIZE, NFDBITS) > 12 && (__XFDS_BITS(p, 12))) || \
(howmany(FD_SETSIZE, NFDBITS) > 13 && (__XFDS_BITS(p, 13))) || \
(howmany(FD_SETSIZE, NFDBITS) > 14 && (__XFDS_BITS(p, 14))) || \
(howmany(FD_SETSIZE, NFDBITS) > 15 && (__XFDS_BITS(p, 15))))
#define XFD_COPYSET(src,dst) { \
int __i__; \
for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
__XFDS_BITS((dst), __i__) = __XFDS_BITS((src), __i__); \
}
#define XFD_ANDSET(dst,b1,b2) { \
int __i__; \
for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
__XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) & (__XFDS_BITS((b2), __i__))); \
}
#define XFD_ORSET(dst,b1,b2) { \
int __i__; \
for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
__XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) | (__XFDS_BITS((b2), __i__))); \
}
#define XFD_UNSET(dst,b1) { \
int __i__; \
for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \
__XFDS_BITS((dst), __i__) &= ~(__XFDS_BITS((b1), __i__)); \
}
#else /* USE_POLL */
#include <sys/poll.h>
#endif /* USE_POLL */
#else /* WIN32 */
#define XFD_SETSIZE 512
#ifndef FD_SETSIZE
#define FD_SETSIZE XFD_SETSIZE
#endif
#include <X11/Xwinsock.h>
#define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
#define XFD_SETCOUNT(p) (((fd_set FAR *)(p))->fd_count)
#define XFD_FD(p,i) (((fd_set FAR *)(p))->fd_array[i])
#define XFD_ANYSET(p) XFD_SETCOUNT(p)
#define XFD_COPYSET(src,dst) { \
u_int __i; \
FD_ZERO(dst); \
for (__i = 0; __i < XFD_SETCOUNT(src) ; __i++) { \
XFD_FD(dst,__i) = XFD_FD(src,__i); \
} \
XFD_SETCOUNT(dst) = XFD_SETCOUNT(src); \
}
#define XFD_ANDSET(dst,b1,b2) { \
u_int __i; \
FD_ZERO(dst); \
for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \
if (FD_ISSET(XFD_FD(b1,__i), b2)) \
FD_SET(XFD_FD(b1,__i), dst); \
} \
}
#define XFD_ORSET(dst,b1,b2) { \
u_int __i; \
if (dst != b1) XFD_COPYSET(b1,dst); \
for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \
if (!FD_ISSET(XFD_FD(b2,__i), dst)) \
FD_SET(XFD_FD(b2,__i), dst); \
} \
}
/* this one is really sub-optimal */
#define XFD_UNSET(dst,b1) { \
u_int __i; \
for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \
FD_CLR(XFD_FD(b1,__i), dst); \
} \
}
/* we have to pay the price of having an array here, unlike with bitmasks
calling twice FD_SET with the same fd is not transparent, so be careful */
#undef FD_SET
#define FD_SET(fd,set) do { \
if (XFD_SETCOUNT(set) < FD_SETSIZE && !FD_ISSET(fd,set)) \
XFD_FD(set,XFD_SETCOUNT(set)++)=(fd); \
} while(0)
#define getdtablesize() FD_SETSIZE
#endif /* WIN32 */
#endif /* _XPOLL_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
_XFUNCPROTOBEGIN
/* Representation types */
extern XrmQuark _XtQString;
/*
* Resource conversions
*/
typedef struct _ConverterRec **ConverterTable;
extern void _XtAddDefaultConverters(
ConverterTable /* table */
);
extern void _XtSetDefaultConverterTable(
ConverterTable* /* table */
);
extern void _XtFreeConverterTable(
ConverterTable /* table */
);
extern void _XtTableAddConverter(
ConverterTable /* table */,
XrmRepresentation /* from_type */,
XrmRepresentation /* to_type */,
XtTypeConverter /* converter */,
XtConvertArgList /* convert_args */,
Cardinal /* num_args */,
_XtBoolean /* new_style */,
XtCacheType /* cache_type */,
XtDestructor /* destructor */,
_XtBoolean /* global */
);
extern Boolean _XtConvert(
Widget /* widget */,
XrmRepresentation /* from_type */,
XrmValuePtr /* from */,
XrmRepresentation /* to_type */,
XrmValuePtr /* to */,
XtCacheRef* /* cache_ref_return */
);
void _XtConvertInitialize(void);
_XFUNCPROTOEND
/*
* Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/************************************************************
Copyright 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
***********************************************************/
/*
* Floating Accent
*/
#define SunXK_FA_Grave 0x1005FF00
#define SunXK_FA_Circum 0x1005FF01
#define SunXK_FA_Tilde 0x1005FF02
#define SunXK_FA_Acute 0x1005FF03
#define SunXK_FA_Diaeresis 0x1005FF04
#define SunXK_FA_Cedilla 0x1005FF05
/*
* Miscellaneous Functions
*/
#define SunXK_F36 0x1005FF10 /* Labeled F11 */
#define SunXK_F37 0x1005FF11 /* Labeled F12 */
#define SunXK_Sys_Req 0x1005FF60
#define SunXK_Print_Screen 0x0000FF61 /* Same as XK_Print */
/*
* International & Multi-Key Character Composition
*/
#define SunXK_Compose 0x0000FF20 /* Same as XK_Multi_key */
#define SunXK_AltGraph 0x0000FF7E /* Same as XK_Mode_switch */
/*
* Cursor Control
*/
#define SunXK_PageUp 0x0000FF55 /* Same as XK_Prior */
#define SunXK_PageDown 0x0000FF56 /* Same as XK_Next */
/*
* Open Look Functions
*/
#define SunXK_Undo 0x0000FF65 /* Same as XK_Undo */
#define SunXK_Again 0x0000FF66 /* Same as XK_Redo */
#define SunXK_Find 0x0000FF68 /* Same as XK_Find */
#define SunXK_Stop 0x0000FF69 /* Same as XK_Cancel */
#define SunXK_Props 0x1005FF70
#define SunXK_Front 0x1005FF71
#define SunXK_Copy 0x1005FF72
#define SunXK_Open 0x1005FF73
#define SunXK_Paste 0x1005FF74
#define SunXK_Cut 0x1005FF75
#define SunXK_PowerSwitch 0x1005FF76
#define SunXK_AudioLowerVolume 0x1005FF77
#define SunXK_AudioMute 0x1005FF78
#define SunXK_AudioRaiseVolume 0x1005FF79
#define SunXK_VideoDegauss 0x1005FF7A
#define SunXK_VideoLowerBrightness 0x1005FF7B
#define SunXK_VideoRaiseBrightness 0x1005FF7C
#define SunXK_PowerSwitchShift 0x1005FF7D
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Hewlett Packard
or Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. Hewlett-Packard shall not be liable for errors
contained herein or direct, indirect, special, incidental or
consequential damages in connection with the furnishing,
performance, or use of this material.
*/
#ifndef _HPKEYSYM_H
#define _HPKEYSYM_H
#define hpXK_ClearLine 0x1000FF6F
#define hpXK_InsertLine 0x1000FF70
#define hpXK_DeleteLine 0x1000FF71
#define hpXK_InsertChar 0x1000FF72
#define hpXK_DeleteChar 0x1000FF73
#define hpXK_BackTab 0x1000FF74
#define hpXK_KP_BackTab 0x1000FF75
#define hpXK_Modelock1 0x1000FF48
#define hpXK_Modelock2 0x1000FF49
#define hpXK_Reset 0x1000FF6C
#define hpXK_System 0x1000FF6D
#define hpXK_User 0x1000FF6E
#define hpXK_mute_acute 0x100000A8
#define hpXK_mute_grave 0x100000A9
#define hpXK_mute_asciicircum 0x100000AA
#define hpXK_mute_diaeresis 0x100000AB
#define hpXK_mute_asciitilde 0x100000AC
#define hpXK_lira 0x100000AF
#define hpXK_guilder 0x100000BE
#define hpXK_Ydiaeresis 0x100000EE
#define hpXK_IO 0x100000EE
#define hpXK_longminus 0x100000F6
#define hpXK_block 0x100000FC
#ifndef _OSF_Keysyms
#define _OSF_Keysyms
#define osfXK_Copy 0x1004FF02
#define osfXK_Cut 0x1004FF03
#define osfXK_Paste 0x1004FF04
#define osfXK_BackTab 0x1004FF07
#define osfXK_BackSpace 0x1004FF08
#define osfXK_Clear 0x1004FF0B
#define osfXK_Escape 0x1004FF1B
#define osfXK_AddMode 0x1004FF31
#define osfXK_PrimaryPaste 0x1004FF32
#define osfXK_QuickPaste 0x1004FF33
#define osfXK_PageLeft 0x1004FF40
#define osfXK_PageUp 0x1004FF41
#define osfXK_PageDown 0x1004FF42
#define osfXK_PageRight 0x1004FF43
#define osfXK_Activate 0x1004FF44
#define osfXK_MenuBar 0x1004FF45
#define osfXK_Left 0x1004FF51
#define osfXK_Up 0x1004FF52
#define osfXK_Right 0x1004FF53
#define osfXK_Down 0x1004FF54
#define osfXK_EndLine 0x1004FF57
#define osfXK_BeginLine 0x1004FF58
#define osfXK_EndData 0x1004FF59
#define osfXK_BeginData 0x1004FF5A
#define osfXK_PrevMenu 0x1004FF5B
#define osfXK_NextMenu 0x1004FF5C
#define osfXK_PrevField 0x1004FF5D
#define osfXK_NextField 0x1004FF5E
#define osfXK_Select 0x1004FF60
#define osfXK_Insert 0x1004FF63
#define osfXK_Undo 0x1004FF65
#define osfXK_Menu 0x1004FF67
#define osfXK_Cancel 0x1004FF69
#define osfXK_Help 0x1004FF6A
#define osfXK_SelectAll 0x1004FF71
#define osfXK_DeselectAll 0x1004FF72
#define osfXK_Reselect 0x1004FF73
#define osfXK_Extend 0x1004FF74
#define osfXK_Restore 0x1004FF78
#define osfXK_Delete 0x1004FFFF
#endif /* _OSF_Keysyms */
/**************************************************************
* The use of the following macros is deprecated.
* They are listed below only for backwards compatibility.
*/
#define XK_Reset 0x1000FF6C
#define XK_System 0x1000FF6D
#define XK_User 0x1000FF6E
#define XK_ClearLine 0x1000FF6F
#define XK_InsertLine 0x1000FF70
#define XK_DeleteLine 0x1000FF71
#define XK_InsertChar 0x1000FF72
#define XK_DeleteChar 0x1000FF73
#define XK_BackTab 0x1000FF74
#define XK_KP_BackTab 0x1000FF75
#define XK_Ext16bit_L 0x1000FF76
#define XK_Ext16bit_R 0x1000FF77
#define XK_mute_acute 0x100000a8
#define XK_mute_grave 0x100000a9
#define XK_mute_asciicircum 0x100000aa
#define XK_mute_diaeresis 0x100000ab
#define XK_mute_asciitilde 0x100000ac
#define XK_lira 0x100000af
#define XK_guilder 0x100000be
#ifndef XK_Ydiaeresis
#define XK_Ydiaeresis 0x100000ee
#endif
#define XK_IO 0x100000ee
#define XK_longminus 0x100000f6
#define XK_block 0x100000fc
#endif /* _HPKEYSYM_H */
/*
Copyright 1985, 1986, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* XWDFile.h MIT Project Athena, X Window system window raster
* image dumper, dump file format header file.
*
* Author: Tony Della Fera, DEC
* 27-Jun-85
*
* Modifier: William F. Wyatt, SAO
* 18-Nov-86 - version 6 for saving/restoring color maps
*/
#ifndef XWDFILE_H
#define XWDFILE_H
#include <X11/Xmd.h>
#define XWD_FILE_VERSION 7
#define sz_XWDheader 100
#define sz_XWDColor 12
typedef CARD32 xwdval; /* for old broken programs */
/* Values in the file are most significant byte first. */
typedef struct _xwd_file_header {
/* header_size = SIZEOF(XWDheader) + length of null-terminated
* window name. */
CARD32 header_size;
CARD32 file_version; /* = XWD_FILE_VERSION above */
CARD32 pixmap_format; /* ZPixmap or XYPixmap */
CARD32 pixmap_depth; /* Pixmap depth */
CARD32 pixmap_width; /* Pixmap width */
CARD32 pixmap_height; /* Pixmap height */
CARD32 xoffset; /* Bitmap x offset, normally 0 */
CARD32 byte_order; /* of image data: MSBFirst, LSBFirst */
/* bitmap_unit applies to bitmaps (depth 1 format XY) only.
* It is the number of bits that each scanline is padded to. */
CARD32 bitmap_unit;
CARD32 bitmap_bit_order; /* bitmaps only: MSBFirst, LSBFirst */
/* bitmap_pad applies to pixmaps (non-bitmaps) only.
* It is the number of bits that each scanline is padded to. */
CARD32 bitmap_pad;
CARD32 bits_per_pixel; /* Bits per pixel */
/* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps)
* or bitmap_pad (pixmaps). It is the delta (in bytes) to get
* to the same x position on an adjacent row. */
CARD32 bytes_per_line;
CARD32 visual_class; /* Class of colormap */
CARD32 red_mask; /* Z red mask */
CARD32 green_mask; /* Z green mask */
CARD32 blue_mask; /* Z blue mask */
CARD32 bits_per_rgb; /* Log2 of distinct color values */
CARD32 colormap_entries; /* Number of entries in colormap; not used? */
CARD32 ncolors; /* Number of XWDColor structures */
CARD32 window_width; /* Window width */
CARD32 window_height; /* Window height */
CARD32 window_x; /* Window upper left X coordinate */
CARD32 window_y; /* Window upper left Y coordinate */
CARD32 window_bdrwidth; /* Window border width */
} XWDFileHeader;
/* Null-terminated window name follows the above structure. */
/* Next comes XWDColor structures, at offset XWDFileHeader.header_size in
* the file. XWDFileHeader.ncolors tells how many XWDColor structures
* there are.
*/
typedef struct {
CARD32 pixel;
CARD16 red;
CARD16 green;
CARD16 blue;
CARD8 flags;
CARD8 pad;
} XWDColor;
/* Last comes the image data in the format described by XWDFileHeader. */
#endif /* XWDFILE_H */
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _Xtos_h
#define _Xtos_h
#define ALLOCATE_LOCAL_FALLBACK(_size) XtMalloc((unsigned long)(_size))
#define DEALLOCATE_LOCAL_FALLBACK(_ptr) XtFree((XtPointer)(_ptr))
#include <X11/Xalloca.h>
#if defined (_LP64) || \
defined(__alpha) || defined(__alpha__) || \
defined(__ia64__) || defined(ia64) || \
defined(__sparc64__) || \
defined(__s390x__) || \
(defined(__hppa__) && defined(__LP64__)) || \
defined(__amd64__) || defined(amd64) || \
defined(__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
#define LONG64
#endif
#endif /* _Xtos_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtintrinsicP_h
#define _XtintrinsicP_h
#include <X11/Intrinsic.h>
/*
* Field sizes and offsets of XrmResource must match those of XtResource.
* Type long is used instead of XrmQuark here because XrmQuark and String
* are not the same size on all systems.
*/
typedef struct {
long xrm_name; /* Resource name quark */
long xrm_class; /* Resource class quark */
long xrm_type; /* Resource representation type quark */
Cardinal xrm_size; /* Size in bytes of representation */
int xrm_offset; /* -offset-1 */
long xrm_default_type; /* Default representation type quark */
XtPointer xrm_default_addr; /* Default resource address */
} XrmResource, *XrmResourceList;
typedef unsigned long XtVersionType;
#define XT_VERSION 11
#ifndef XT_REVISION
#define XT_REVISION 6
#endif
#define XtVersion (XT_VERSION * 1000 + XT_REVISION)
#define XtVersionDontCheck 0
typedef void (*XtProc)(
void
);
typedef void (*XtWidgetClassProc)(
WidgetClass /* class */
);
typedef void (*XtWidgetProc)(
Widget /* widget */
);
typedef Boolean (*XtAcceptFocusProc)(
Widget /* widget */,
Time* /* time */
);
typedef void (*XtArgsProc)(
Widget /* widget */,
ArgList /* args */,
Cardinal* /* num_args */
);
typedef void (*XtInitProc)(
Widget /* request */,
Widget /* new */,
ArgList /* args */,
Cardinal* /* num_args */
);
typedef Boolean (*XtSetValuesFunc)(
Widget /* old */,
Widget /* request */,
Widget /* new */,
ArgList /* args */,
Cardinal* /* num_args */
);
typedef Boolean (*XtArgsFunc)(
Widget /* widget */,
ArgList /* args */,
Cardinal* /* num_args */
);
typedef void (*XtAlmostProc)(
Widget /* old */,
Widget /* new */,
XtWidgetGeometry* /* request */,
XtWidgetGeometry* /* reply */
);
typedef void (*XtExposeProc)(
Widget /* widget */,
XEvent* /* event */,
Region /* region */
);
/* compress_exposure options*/
#define XtExposeNoCompress ((XtEnum)False)
#define XtExposeCompressSeries ((XtEnum)True)
#define XtExposeCompressMultiple 2
#define XtExposeCompressMaximal 3
/* modifiers */
#define XtExposeGraphicsExpose 0x10
#define XtExposeGraphicsExposeMerged 0x20
#define XtExposeNoExpose 0x40
#define XtExposeNoRegion 0x80
typedef void (*XtRealizeProc)(
Widget /* widget */,
XtValueMask* /* mask */,
XSetWindowAttributes* /* attributes */
);
typedef XtGeometryResult (*XtGeometryHandler)(
Widget /* widget */,
XtWidgetGeometry* /* request */,
XtWidgetGeometry* /* reply */
);
typedef void (*XtStringProc)(
Widget /* widget */,
String /* str */
);
typedef struct {
String name; /* resource name */
String type; /* representation type name */
XtArgVal value; /* representation */
int size; /* size of representation */
} XtTypedArg, *XtTypedArgList;
typedef void (*XtAllocateProc)(
WidgetClass /* widget_class */,
Cardinal * /* constraint_size */,
Cardinal * /* more_bytes */,
ArgList /* args */,
Cardinal * /* num_args */,
XtTypedArgList /* typed_args */,
Cardinal * /* num_typed_args */,
Widget * /* widget_return */,
XtPointer * /* more_bytes_return */
);
typedef void (*XtDeallocateProc)(
Widget /* widget */,
XtPointer /* more_bytes */
);
struct _XtStateRec; /* Forward declare before use for C++ */
typedef struct _XtTMRec {
XtTranslations translations; /* private to Translation Manager */
XtBoundActions proc_table; /* procedure bindings for actions */
struct _XtStateRec *current_state; /* Translation Manager state ptr */
unsigned long lastEventTime;
} XtTMRec, *XtTM;
#include <X11/CoreP.h>
#include <X11/CompositeP.h>
#include <X11/ConstrainP.h>
#include <X11/ObjectP.h>
#include <X11/RectObjP.h>
#define XtDisplay(widget) DisplayOfScreen((widget)->core.screen)
#define XtScreen(widget) ((widget)->core.screen)
#define XtWindow(widget) ((widget)->core.window)
#define XtClass(widget) ((widget)->core.widget_class)
#define XtSuperclass(widget) (XtClass(widget)->core_class.superclass)
#define XtIsRealized(object) (XtWindowOfObject(object) != None)
#define XtParent(widget) ((widget)->core.parent)
#undef XtIsRectObj
extern Boolean XtIsRectObj(Widget);
#define XtIsRectObj(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x02)
#undef XtIsWidget
extern Boolean XtIsWidget(Widget);
#define XtIsWidget(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x04)
#undef XtIsComposite
extern Boolean XtIsComposite(Widget);
#define XtIsComposite(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x08)
#undef XtIsConstraint
extern Boolean XtIsConstraint(Widget);
#define XtIsConstraint(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x10)
#undef XtIsShell
extern Boolean XtIsShell(Widget);
#define XtIsShell(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x20)
#undef XtIsWMShell
extern Boolean XtIsWMShell(Widget);
#define XtIsWMShell(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x40)
#undef XtIsTopLevelShell
extern Boolean XtIsTopLevelShell(Widget);
#define XtIsTopLevelShell(obj) \
(((Object)(obj))->object.widget_class->core_class.class_inited & 0x80)
#ifdef DEBUG
#define XtCheckSubclass(w, widget_class_ptr, message) \
if (!XtIsSubclass(((Widget)(w)), (widget_class_ptr))) { \
String params[3]; \
Cardinal num_params = 3; \
params[0] = ((Widget)(w))->core.widget_class->core_class.class_name;\
params[1] = (widget_class_ptr)->core_class.class_name; \
params[2] = (message); \
XtAppErrorMsg(XtWidgetToApplicationContext((Widget)(w)), \
"subclassMismatch", "xtCheckSubclass", "XtToolkitError", \
"Widget class %s found when subclass of %s expected: %s",\
params, &num_params); \
}
#else
#define XtCheckSubclass(w, widget_class, message) /* nothing */
#endif
_XFUNCPROTOBEGIN
extern Widget _XtWindowedAncestor( /* internal; implementation-dependent */
Widget /* object */
);
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(LIBXT_COMPILATION)
__declspec(dllimport)
#else
extern
#endif
void _XtInherit(
void
);
extern void _XtHandleFocus(
Widget /* widget */,
XtPointer /* client_data */,
XEvent * /* event */,
Boolean * /* cont */);
extern void XtCreateWindow(
Widget /* widget */,
unsigned int /* window_class */,
Visual* /* visual */,
XtValueMask /* value_mask */,
XSetWindowAttributes* /* attributes */
);
extern void XtResizeWidget(
Widget /* widget */,
_XtDimension /* width */,
_XtDimension /* height */,
_XtDimension /* border_width */
);
extern void XtMoveWidget(
Widget /* widget */,
_XtPosition /* x */,
_XtPosition /* y */
);
extern void XtConfigureWidget(
Widget /* widget */,
_XtPosition /* x */,
_XtPosition /* y */,
_XtDimension /* width */,
_XtDimension /* height */,
_XtDimension /* border_width */
);
extern void XtResizeWindow(
Widget /* widget */
);
extern void XtProcessLock(
void
);
extern void XtProcessUnlock(
void
);
_XFUNCPROTOEND
#endif /* _XtIntrinsicP_h */
/* DON'T ADD STUFF AFTER THIS #endif */
#ifndef _XARCH_H_
# define _XARCH_H_
/*
* Copyright 1997 Metro Link Incorporated
*
* All Rights Reserved
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of the above listed copyright holder(s)
* not be used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. The above listed
* copyright holder(s) make(s) no representations about the suitability of
* this software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
* LIABLE FOR ANY SPECIAL, 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.
*/
/*
* Determine the machine's byte order.
*/
/* See if it is set in the imake config first */
# ifdef X_BYTE_ORDER
# define X_BIG_ENDIAN 4321
# define X_LITTLE_ENDIAN 1234
# else
# if defined(SVR4) || defined(__SVR4)
# include <sys/types.h>
# include <sys/byteorder.h>
# elif defined(CSRG_BASED)
# if defined(__NetBSD__) || defined(__OpenBSD__)
# include <sys/types.h>
# endif
# include <machine/endian.h>
# elif defined(linux)
# if defined __STRICT_ANSI__
# undef __STRICT_ANSI__
# include <endian.h>
# define __STRICT_ANSI__
# else
# include <endian.h>
# endif
/* 'endian.h' might have been included before 'Xarch.h' */
# if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN)
# define LITTLE_ENDIAN __LITTLE_ENDIAN
# endif
# if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN)
# define BIG_ENDIAN __BIG_ENDIAN
# endif
# if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN)
# define PDP_ENDIAN __PDP_ENDIAN
# endif
# if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
# define BYTE_ORDER __BYTE_ORDER
# endif
# endif
# ifndef BYTE_ORDER
# define LITTLE_ENDIAN 1234
# define BIG_ENDIAN 4321
# if defined(__sun) && defined(__SVR4)
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
# define BYTE_ORDER LITTLE_ENDIAN
# endif
# ifdef _BIG_ENDIAN
# define BYTE_ORDER BIG_ENDIAN
# endif
# endif /* sun */
# endif /* BYTE_ORDER */
# define X_BYTE_ORDER BYTE_ORDER
# define X_BIG_ENDIAN BIG_ENDIAN
# define X_LITTLE_ENDIAN LITTLE_ENDIAN
# endif /* not in imake config */
#endif /* _XARCH_H_ */
/*
* XFree86 vendor specific keysyms.
*
* The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
*
* X.Org will not be adding to the XF86 set of keysyms, though they have
* been adopted and are considered a "standard" part of X keysym definitions.
* XFree86 never properly commented these keysyms, so we have done our
* best to explain the semantic meaning of these keys.
*
* XFree86 has removed their mail archives of the period, that might have
* shed more light on some of these definitions. Until/unless we resurrect
* these archives, these are from memory and usage.
*/
/*
* ModeLock
*
* This one is old, and not really used any more since XKB offers this
* functionality.
*/
#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */
/* Backlight controls. */
#define XF86XK_MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */
#define XF86XK_MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */
#define XF86XK_KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */
#define XF86XK_KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */
#define XF86XK_KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */
#define XF86XK_MonBrightnessCycle 0x1008FF07 /* Monitor/panel brightness */
/*
* Keys found on some "Internet" keyboards.
*/
#define XF86XK_Standby 0x1008FF10 /* System into standby mode */
#define XF86XK_AudioLowerVolume 0x1008FF11 /* Volume control down */
#define XF86XK_AudioMute 0x1008FF12 /* Mute sound from the system */
#define XF86XK_AudioRaiseVolume 0x1008FF13 /* Volume control up */
#define XF86XK_AudioPlay 0x1008FF14 /* Start playing of audio > */
#define XF86XK_AudioStop 0x1008FF15 /* Stop playing audio */
#define XF86XK_AudioPrev 0x1008FF16 /* Previous track */
#define XF86XK_AudioNext 0x1008FF17 /* Next track */
#define XF86XK_HomePage 0x1008FF18 /* Display user's home page */
#define XF86XK_Mail 0x1008FF19 /* Invoke user's mail program */
#define XF86XK_Start 0x1008FF1A /* Start application */
#define XF86XK_Search 0x1008FF1B /* Search */
#define XF86XK_AudioRecord 0x1008FF1C /* Record audio application */
/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */
#define XF86XK_Calculator 0x1008FF1D /* Invoke calculator program */
#define XF86XK_Memo 0x1008FF1E /* Invoke Memo taking program */
#define XF86XK_ToDoList 0x1008FF1F /* Invoke To Do List program */
#define XF86XK_Calendar 0x1008FF20 /* Invoke Calendar program */
#define XF86XK_PowerDown 0x1008FF21 /* Deep sleep the system */
#define XF86XK_ContrastAdjust 0x1008FF22 /* Adjust screen contrast */
#define XF86XK_RockerUp 0x1008FF23 /* Rocker switches exist up */
#define XF86XK_RockerDown 0x1008FF24 /* and down */
#define XF86XK_RockerEnter 0x1008FF25 /* and let you press them */
/* Some more "Internet" keyboard symbols */
#define XF86XK_Back 0x1008FF26 /* Like back on a browser */
#define XF86XK_Forward 0x1008FF27 /* Like forward on a browser */
#define XF86XK_Stop 0x1008FF28 /* Stop current operation */
#define XF86XK_Refresh 0x1008FF29 /* Refresh the page */
#define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */
#define XF86XK_WakeUp 0x1008FF2B /* Wake up system from sleep */
#define XF86XK_Eject 0x1008FF2C /* Eject device (e.g. DVD) */
#define XF86XK_ScreenSaver 0x1008FF2D /* Invoke screensaver */
#define XF86XK_WWW 0x1008FF2E /* Invoke web browser */
#define XF86XK_Sleep 0x1008FF2F /* Put system to sleep */
#define XF86XK_Favorites 0x1008FF30 /* Show favorite locations */
#define XF86XK_AudioPause 0x1008FF31 /* Pause audio playing */
#define XF86XK_AudioMedia 0x1008FF32 /* Launch media collection app */
#define XF86XK_MyComputer 0x1008FF33 /* Display "My Computer" window */
#define XF86XK_VendorHome 0x1008FF34 /* Display vendor home web site */
#define XF86XK_LightBulb 0x1008FF35 /* Light bulb keys exist */
#define XF86XK_Shop 0x1008FF36 /* Display shopping web site */
#define XF86XK_History 0x1008FF37 /* Show history of web surfing */
#define XF86XK_OpenURL 0x1008FF38 /* Open selected URL */
#define XF86XK_AddFavorite 0x1008FF39 /* Add URL to favorites list */
#define XF86XK_HotLinks 0x1008FF3A /* Show "hot" links */
#define XF86XK_BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */
#define XF86XK_Finance 0x1008FF3C /* Display financial site */
#define XF86XK_Community 0x1008FF3D /* Display user's community */
#define XF86XK_AudioRewind 0x1008FF3E /* "rewind" audio track */
#define XF86XK_BackForward 0x1008FF3F /* ??? */
#define XF86XK_Launch0 0x1008FF40 /* Launch Application */
#define XF86XK_Launch1 0x1008FF41 /* Launch Application */
#define XF86XK_Launch2 0x1008FF42 /* Launch Application */
#define XF86XK_Launch3 0x1008FF43 /* Launch Application */
#define XF86XK_Launch4 0x1008FF44 /* Launch Application */
#define XF86XK_Launch5 0x1008FF45 /* Launch Application */
#define XF86XK_Launch6 0x1008FF46 /* Launch Application */
#define XF86XK_Launch7 0x1008FF47 /* Launch Application */
#define XF86XK_Launch8 0x1008FF48 /* Launch Application */
#define XF86XK_Launch9 0x1008FF49 /* Launch Application */
#define XF86XK_LaunchA 0x1008FF4A /* Launch Application */
#define XF86XK_LaunchB 0x1008FF4B /* Launch Application */
#define XF86XK_LaunchC 0x1008FF4C /* Launch Application */
#define XF86XK_LaunchD 0x1008FF4D /* Launch Application */
#define XF86XK_LaunchE 0x1008FF4E /* Launch Application */
#define XF86XK_LaunchF 0x1008FF4F /* Launch Application */
#define XF86XK_ApplicationLeft 0x1008FF50 /* switch to application, left */
#define XF86XK_ApplicationRight 0x1008FF51 /* switch to application, right*/
#define XF86XK_Book 0x1008FF52 /* Launch bookreader */
#define XF86XK_CD 0x1008FF53 /* Launch CD/DVD player */
#define XF86XK_Calculater 0x1008FF54 /* Launch Calculater */
#define XF86XK_Clear 0x1008FF55 /* Clear window, screen */
#define XF86XK_Close 0x1008FF56 /* Close window */
#define XF86XK_Copy 0x1008FF57 /* Copy selection */
#define XF86XK_Cut 0x1008FF58 /* Cut selection */
#define XF86XK_Display 0x1008FF59 /* Output switch key */
#define XF86XK_DOS 0x1008FF5A /* Launch DOS (emulation) */
#define XF86XK_Documents 0x1008FF5B /* Open documents window */
#define XF86XK_Excel 0x1008FF5C /* Launch spread sheet */
#define XF86XK_Explorer 0x1008FF5D /* Launch file explorer */
#define XF86XK_Game 0x1008FF5E /* Launch game */
#define XF86XK_Go 0x1008FF5F /* Go to URL */
#define XF86XK_iTouch 0x1008FF60 /* Logitech iTouch- don't use */
#define XF86XK_LogOff 0x1008FF61 /* Log off system */
#define XF86XK_Market 0x1008FF62 /* ?? */
#define XF86XK_Meeting 0x1008FF63 /* enter meeting in calendar */
#define XF86XK_MenuKB 0x1008FF65 /* distinguish keyboard from PB */
#define XF86XK_MenuPB 0x1008FF66 /* distinguish PB from keyboard */
#define XF86XK_MySites 0x1008FF67 /* Favourites */
#define XF86XK_New 0x1008FF68 /* New (folder, document... */
#define XF86XK_News 0x1008FF69 /* News */
#define XF86XK_OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/
#define XF86XK_Open 0x1008FF6B /* Open */
#define XF86XK_Option 0x1008FF6C /* ?? */
#define XF86XK_Paste 0x1008FF6D /* Paste */
#define XF86XK_Phone 0x1008FF6E /* Launch phone; dial number */
#define XF86XK_Q 0x1008FF70 /* Compaq's Q - don't use */
#define XF86XK_Reply 0x1008FF72 /* Reply e.g., mail */
#define XF86XK_Reload 0x1008FF73 /* Reload web page, file, etc. */
#define XF86XK_RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */
#define XF86XK_RotationPB 0x1008FF75 /* don't use */
#define XF86XK_RotationKB 0x1008FF76 /* don't use */
#define XF86XK_Save 0x1008FF77 /* Save (file, document, state */
#define XF86XK_ScrollUp 0x1008FF78 /* Scroll window/contents up */
#define XF86XK_ScrollDown 0x1008FF79 /* Scrool window/contentd down */
#define XF86XK_ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */
#define XF86XK_Send 0x1008FF7B /* Send mail, file, object */
#define XF86XK_Spell 0x1008FF7C /* Spell checker */
#define XF86XK_SplitScreen 0x1008FF7D /* Split window or screen */
#define XF86XK_Support 0x1008FF7E /* Get support (??) */
#define XF86XK_TaskPane 0x1008FF7F /* Show tasks */
#define XF86XK_Terminal 0x1008FF80 /* Launch terminal emulator */
#define XF86XK_Tools 0x1008FF81 /* toolbox of desktop/app. */
#define XF86XK_Travel 0x1008FF82 /* ?? */
#define XF86XK_UserPB 0x1008FF84 /* ?? */
#define XF86XK_User1KB 0x1008FF85 /* ?? */
#define XF86XK_User2KB 0x1008FF86 /* ?? */
#define XF86XK_Video 0x1008FF87 /* Launch video player */
#define XF86XK_WheelButton 0x1008FF88 /* button from a mouse wheel */
#define XF86XK_Word 0x1008FF89 /* Launch word processor */
#define XF86XK_Xfer 0x1008FF8A
#define XF86XK_ZoomIn 0x1008FF8B /* zoom in view, map, etc. */
#define XF86XK_ZoomOut 0x1008FF8C /* zoom out view, map, etc. */
#define XF86XK_Away 0x1008FF8D /* mark yourself as away */
#define XF86XK_Messenger 0x1008FF8E /* as in instant messaging */
#define XF86XK_WebCam 0x1008FF8F /* Launch web camera app. */
#define XF86XK_MailForward 0x1008FF90 /* Forward in mail */
#define XF86XK_Pictures 0x1008FF91 /* Show pictures */
#define XF86XK_Music 0x1008FF92 /* Launch music application */
#define XF86XK_Battery 0x1008FF93 /* Display battery information */
#define XF86XK_Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */
#define XF86XK_WLAN 0x1008FF95 /* Enable/disable WLAN */
#define XF86XK_UWB 0x1008FF96 /* Enable/disable UWB */
#define XF86XK_AudioForward 0x1008FF97 /* fast-forward audio track */
#define XF86XK_AudioRepeat 0x1008FF98 /* toggle repeat mode */
#define XF86XK_AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */
#define XF86XK_Subtitle 0x1008FF9A /* cycle through subtitle */
#define XF86XK_AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */
#define XF86XK_CycleAngle 0x1008FF9C /* cycle through angles */
#define XF86XK_FrameBack 0x1008FF9D /* video: go one frame back */
#define XF86XK_FrameForward 0x1008FF9E /* video: go one frame forward */
#define XF86XK_Time 0x1008FF9F /* display, or shows an entry for time seeking */
#define XF86XK_Select 0x1008FFA0 /* Select button on joypads and remotes */
#define XF86XK_View 0x1008FFA1 /* Show a view options/properties */
#define XF86XK_TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */
#define XF86XK_Red 0x1008FFA3 /* Red button */
#define XF86XK_Green 0x1008FFA4 /* Green button */
#define XF86XK_Yellow 0x1008FFA5 /* Yellow button */
#define XF86XK_Blue 0x1008FFA6 /* Blue button */
#define XF86XK_Suspend 0x1008FFA7 /* Sleep to RAM */
#define XF86XK_Hibernate 0x1008FFA8 /* Sleep to disk */
#define XF86XK_TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */
#define XF86XK_TouchpadOn 0x1008FFB0 /* The touchpad got switched on */
#define XF86XK_TouchpadOff 0x1008FFB1 /* The touchpad got switched off */
#define XF86XK_AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */
#define XF86XK_Keyboard 0x1008FFB3 /* User defined keyboard related action */
#define XF86XK_WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */
#define XF86XK_RFKill 0x1008FFB5 /* Toggle radios on/off */
#define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */
#define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock on/off */
#define XF86XK_FullScreen 0x1008FFB8 /* Toggle fullscreen */
/* Keys for special action keys (hot keys) */
/* Virtual terminals on some operating systems */
#define XF86XK_Switch_VT_1 0x1008FE01
#define XF86XK_Switch_VT_2 0x1008FE02
#define XF86XK_Switch_VT_3 0x1008FE03
#define XF86XK_Switch_VT_4 0x1008FE04
#define XF86XK_Switch_VT_5 0x1008FE05
#define XF86XK_Switch_VT_6 0x1008FE06
#define XF86XK_Switch_VT_7 0x1008FE07
#define XF86XK_Switch_VT_8 0x1008FE08
#define XF86XK_Switch_VT_9 0x1008FE09
#define XF86XK_Switch_VT_10 0x1008FE0A
#define XF86XK_Switch_VT_11 0x1008FE0B
#define XF86XK_Switch_VT_12 0x1008FE0C
#define XF86XK_Ungrab 0x1008FE20 /* force ungrab */
#define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */
#define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */
#define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */
#define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */
#define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* ShellP.h - Private definitions for Shell widget
*
* Author: Paul Asente
* Digital Equipment Corporation
* Western Software Laboratory
* Date: Thu Dec 3, 1987
*/
#ifndef _XtShellPrivate_h
#define _XtShellPrivate_h
#include <X11/Shell.h>
/* *****
* ***** VendorP.h is included later on; it needs fields defined in the first
* ***** part of this header file
* *****
*/
_XFUNCPROTOBEGIN
/***********************************************************************
*
* Shell Widget Private Data
*
***********************************************************************/
/* New fields for the Shell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} ShellClassPart;
typedef struct {
XtPointer next_extension; /* 1st 4 mandated for all extension records */
XrmQuark record_type; /* NULLQUARK; on ShellClassPart */
long version; /* must be XtShellExtensionVersion */
Cardinal record_size; /* sizeof(ShellClassExtensionRec) */
XtGeometryHandler root_geometry_manager;
} ShellClassExtensionRec, *ShellClassExtension;
#define XtShellExtensionVersion 1L
#define XtInheritRootGeometryManager ((XtGeometryHandler)_XtInherit)
typedef struct _ShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
} ShellClassRec;
externalref ShellClassRec shellClassRec;
/* New fields for the shell widget */
typedef struct {
char *geometry;
XtCreatePopupChildProc create_popup_child_proc;
XtGrabKind grab_kind;
Boolean spring_loaded;
Boolean popped_up;
Boolean allow_shell_resize;
Boolean client_specified; /* re-using old name */
#define _XtShellPositionValid ((Boolean)(1<<0))
#define _XtShellNotReparented ((Boolean)(1<<1))
#define _XtShellPPositionOK ((Boolean)(1<<2))
#define _XtShellGeometryParsed ((Boolean)(1<<3))
Boolean save_under;
Boolean override_redirect;
XtCallbackList popup_callback;
XtCallbackList popdown_callback;
Visual* visual;
} ShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
} ShellRec, *ShellWidget;
/***********************************************************************
*
* OverrideShell Widget Private Data
*
***********************************************************************/
/* New fields for the OverrideShell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} OverrideShellClassPart;
typedef struct _OverrideShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
OverrideShellClassPart override_shell_class;
} OverrideShellClassRec;
externalref OverrideShellClassRec overrideShellClassRec;
/* No new fields for the override shell widget */
typedef struct {int frabjous;} OverrideShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
OverrideShellPart override;
} OverrideShellRec, *OverrideShellWidget;
/***********************************************************************
*
* WMShell Widget Private Data
*
***********************************************************************/
/* New fields for the WMShell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} WMShellClassPart;
typedef struct _WMShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
WMShellClassPart wm_shell_class;
} WMShellClassRec;
externalref WMShellClassRec wmShellClassRec;
/* New fields for the WM shell widget */
typedef struct {
char *title;
int wm_timeout;
Boolean wait_for_wm;
Boolean transient;
Boolean urgency;
Widget client_leader;
String window_role;
struct _OldXSizeHints { /* pre-R4 Xlib structure */
long flags;
int x, y;
int width, height;
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct {
int x;
int y;
} min_aspect, max_aspect;
} size_hints;
XWMHints wm_hints;
int base_width, base_height;
int win_gravity;
Atom title_encoding;
} WMShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
WMShellPart wm;
} WMShellRec, *WMShellWidget;
_XFUNCPROTOEND
#include <X11/VendorP.h>
_XFUNCPROTOBEGIN
/***********************************************************************
*
* TransientShell Widget Private Data
*
***********************************************************************/
/* New fields for the TransientShell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} TransientShellClassPart;
typedef struct _TransientShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
WMShellClassPart wm_shell_class;
VendorShellClassPart vendor_shell_class;
TransientShellClassPart transient_shell_class;
} TransientShellClassRec;
externalref TransientShellClassRec transientShellClassRec;
/* New fields for the transient shell widget */
typedef struct {
Widget transient_for;
} TransientShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
WMShellPart wm;
VendorShellPart vendor;
TransientShellPart transient;
} TransientShellRec, *TransientShellWidget;
/***********************************************************************
*
* TopLevelShell Widget Private Data
*
***********************************************************************/
/* New fields for the TopLevelShell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} TopLevelShellClassPart;
typedef struct _TopLevelShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
WMShellClassPart wm_shell_class;
VendorShellClassPart vendor_shell_class;
TopLevelShellClassPart top_level_shell_class;
} TopLevelShellClassRec;
externalref TopLevelShellClassRec topLevelShellClassRec;
/* New fields for the top level shell widget */
typedef struct {
char *icon_name;
Boolean iconic;
Atom icon_name_encoding;
} TopLevelShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
WMShellPart wm;
VendorShellPart vendor;
TopLevelShellPart topLevel;
} TopLevelShellRec, *TopLevelShellWidget;
/***********************************************************************
*
* ApplicationShell Widget Private Data
*
***********************************************************************/
/* New fields for the ApplicationShell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} ApplicationShellClassPart;
typedef struct _ApplicationShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
WMShellClassPart wm_shell_class;
VendorShellClassPart vendor_shell_class;
TopLevelShellClassPart top_level_shell_class;
ApplicationShellClassPart application_shell_class;
} ApplicationShellClassRec;
externalref ApplicationShellClassRec applicationShellClassRec;
/* New fields for the application shell widget */
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
char *c_class;
#else
char *class;
#endif
XrmClass xrm_class;
int argc;
char **argv;
} ApplicationShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
WMShellPart wm;
VendorShellPart vendor;
TopLevelShellPart topLevel;
ApplicationShellPart application;
} ApplicationShellRec, *ApplicationShellWidget;
/***********************************************************************
*
* SessionShell Widget Private Data
*
***********************************************************************/
/* New fields for the SessionShell widget class record */
typedef struct {
XtPointer extension; /* pointer to extension record */
} SessionShellClassPart;
typedef struct _SessionShellClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ShellClassPart shell_class;
WMShellClassPart wm_shell_class;
VendorShellClassPart vendor_shell_class;
TopLevelShellClassPart top_level_shell_class;
ApplicationShellClassPart application_shell_class;
SessionShellClassPart session_shell_class;
} SessionShellClassRec;
externalref SessionShellClassRec sessionShellClassRec;
typedef struct _XtSaveYourselfRec *XtSaveYourself; /* implementation-private */
/* New fields for the session shell widget */
typedef struct {
SmcConn connection;
String session_id;
String* restart_command;
String* clone_command;
String* discard_command;
String* resign_command;
String* shutdown_command;
String* environment;
String current_dir;
String program_path;
unsigned char restart_style;
unsigned char checkpoint_state;
Boolean join_session;
XtCallbackList save_callbacks;
XtCallbackList interact_callbacks;
XtCallbackList cancel_callbacks;
XtCallbackList save_complete_callbacks;
XtCallbackList die_callbacks;
XtCallbackList error_callbacks;
XtSaveYourself save;
XtInputId input_id;
XtPointer ses20;
XtPointer ses19;
XtPointer ses18;
XtPointer ses17;
XtPointer ses16;
XtPointer ses15;
XtPointer ses14;
XtPointer ses13;
XtPointer ses12;
XtPointer ses11;
XtPointer ses10;
XtPointer ses9;
XtPointer ses8;
XtPointer ses7;
XtPointer ses6;
XtPointer ses5;
XtPointer ses4;
XtPointer ses3;
XtPointer ses2;
XtPointer ses1;
} SessionShellPart;
typedef struct {
CorePart core;
CompositePart composite;
ShellPart shell;
WMShellPart wm;
VendorShellPart vendor;
TopLevelShellPart topLevel;
ApplicationShellPart application;
SessionShellPart session;
} SessionShellRec, *SessionShellWidget;
_XFUNCPROTOEND
#endif /* _XtShellPrivate_h */
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtinitialI_h
#define _XtinitialI_h
/****************************************************************
*
* Displays
*
****************************************************************/
#ifndef X_NOT_POSIX
#ifdef _POSIX_SOURCE
#include <limits.h>
#else
#define _POSIX_SOURCE
#include <limits.h>
#undef _POSIX_SOURCE
#endif
#endif
#ifndef PATH_MAX
#ifdef WIN32
#define PATH_MAX 512
#else
#include <sys/param.h>
#endif
#ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024
#endif
#endif
#endif
#include <X11/Xos.h>
#include <X11/Xpoll.h>
_XFUNCPROTOBEGIN
typedef struct _TimerEventRec {
struct timeval te_timer_value;
struct _TimerEventRec *te_next;
XtTimerCallbackProc te_proc;
XtAppContext app;
XtPointer te_closure;
} TimerEventRec;
typedef struct _InputEvent {
XtInputCallbackProc ie_proc;
XtPointer ie_closure;
struct _InputEvent *ie_next;
struct _InputEvent *ie_oq;
XtAppContext app;
int ie_source;
XtInputMask ie_condition;
} InputEvent;
typedef struct _SignalEventRec {
XtSignalCallbackProc se_proc;
XtPointer se_closure;
struct _SignalEventRec *se_next;
XtAppContext app;
Boolean se_notice;
} SignalEventRec;
typedef struct _WorkProcRec {
XtWorkProc proc;
XtPointer closure;
struct _WorkProcRec *next;
XtAppContext app;
} WorkProcRec;
typedef struct
{
#ifndef USE_POLL
fd_set rmask;
fd_set wmask;
fd_set emask;
#endif
int nfds;
} FdStruct;
typedef struct _LangProcRec {
XtLanguageProc proc;
XtPointer closure;
} LangProcRec;
typedef struct _ProcessContextRec {
XtAppContext defaultAppContext;
XtAppContext appContextList;
ConverterTable globalConverterTable;
LangProcRec globalLangProcRec;
} ProcessContextRec, *ProcessContext;
typedef struct {
char* start;
char* current;
int bytes_remaining;
} Heap;
typedef struct _DestroyRec DestroyRec;
typedef struct _XtAppStruct {
XtAppContext next; /* link to next app in process context */
ProcessContext process; /* back pointer to our process context */
InternalCallbackList destroy_callbacks;
Display **list;
TimerEventRec *timerQueue;
WorkProcRec *workQueue;
InputEvent **input_list;
InputEvent *outstandingQueue;
SignalEventRec *signalQueue;
XrmDatabase errorDB;
XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
XtErrorHandler errorHandler, warningHandler;
struct _ActionListRec *action_table;
ConverterTable converterTable;
unsigned long selectionTimeout;
FdStruct fds;
short count; /* num of assigned entries in list */
short max; /* allocate size of list */
short last;
short input_count;
short input_max; /* elts input_list init'd with */
Boolean sync, being_destroyed, error_inited;
#ifndef NO_IDENTIFY_WINDOWS
Boolean identify_windows; /* debugging hack */
#endif
Heap heap;
String * fallback_resources; /* Set by XtAppSetFallbackResources. */
struct _ActionHookRec* action_hook_list;
struct _BlockHookRec* block_hook_list;
int destroy_list_size; /* state data for 2-phase destroy */
int destroy_count;
int dispatch_level;
DestroyRec* destroy_list;
Widget in_phase2_destroy;
LangProcRec langProcRec;
struct _TMBindCacheRec * free_bindings;
String display_name_tried;
Display **dpy_destroy_list;
int dpy_destroy_count;
Boolean exit_flag;
Boolean rebuild_fdlist;
#ifdef XTHREADS
LockPtr lock_info;
ThreadAppProc lock;
ThreadAppProc unlock;
ThreadAppYieldLockProc yield_lock;
ThreadAppRestoreLockProc restore_lock;
ThreadAppProc free_lock;
#endif
} XtAppStruct;
extern void _XtHeapInit(Heap* heap);
extern void _XtHeapFree(Heap* heap);
#ifdef XTTRACEMEMORY
extern char *_XtHeapMalloc(
Heap* /* heap */,
Cardinal /* size */,
char * /* file */,
int /* line */
);
#define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
#else /* XTTRACEMEMORY */
extern char* _XtHeapAlloc(
Heap* /* heap */,
Cardinal /* size */
);
#endif /* XTTRACEMEMORY */
extern void _XtSetDefaultErrorHandlers(
XtErrorMsgHandler* /* errMsg */,
XtErrorMsgHandler* /* warnMsg */,
XtErrorHandler* /* err */,
XtErrorHandler* /* warn */
);
extern void _XtSetDefaultSelectionTimeout(
unsigned long* /* timeout */
);
extern XtAppContext _XtDefaultAppContext(
void
);
extern ProcessContext _XtGetProcessContext(
void
);
Display *
_XtAppInit(
XtAppContext* /* app_context_return */,
String /* application_class */,
XrmOptionDescRec* /* options */,
Cardinal /* num_options */,
int* /* argc_in_out */,
String** /* argv_in_out */,
String* /* fallback_resources */
);
extern void _XtDestroyAppContexts(
void
);
extern void _XtCloseDisplays(
XtAppContext /* app */
);
extern int _XtAppDestroyCount;
extern int _XtWaitForSomething(
XtAppContext /* app */,
_XtBoolean /* ignoreEvents */,
_XtBoolean /* ignoreTimers */,
_XtBoolean /* ignoreInputs */,
_XtBoolean /* ignoreSignals */,
_XtBoolean /* block */,
#ifdef XTHREADS
_XtBoolean /* drop_lock */,
#endif
unsigned long* /* howlong */
);
typedef struct _CaseConverterRec *CaseConverterPtr;
typedef struct _CaseConverterRec {
KeySym start; /* first KeySym valid in converter */
KeySym stop; /* last KeySym valid in converter */
XtCaseProc proc; /* case converter function */
CaseConverterPtr next; /* next converter record */
} CaseConverterRec;
typedef struct _ExtensionSelectorRec {
XtExtensionSelectProc proc;
int min, max;
XtPointer client_data;
} ExtSelectRec;
typedef struct _XtPerDisplayStruct {
InternalCallbackList destroy_callbacks;
Region region;
CaseConverterPtr case_cvt; /* user-registered case converters */
XtKeyProc defaultKeycodeTranslator;
XtAppContext appContext;
unsigned long keysyms_serial; /* for tracking MappingNotify events */
KeySym *keysyms; /* keycode to keysym table */
int keysyms_per_keycode; /* number of keysyms for each keycode*/
int min_keycode, max_keycode; /* range of keycodes */
KeySym *modKeysyms; /* keysym values for modToKeysysm */
ModToKeysymTable *modsToKeysyms; /* modifiers to Keysysms index table*/
unsigned char isModifier[32]; /* key-is-modifier-p bit table */
KeySym lock_meaning; /* Lock modifier meaning */
Modifiers mode_switch; /* keyboard group modifiers */
Modifiers num_lock; /* keyboard numlock modifiers */
Boolean being_destroyed;
Boolean rv; /* reverse_video resource */
XrmName name; /* resolved app name */
XrmClass class; /* application class */
Heap heap;
struct _GCrec *GClist; /* support for XtGetGC */
Drawable **pixmap_tab; /* ditto for XtGetGC */
String language; /* XPG language string */
XEvent last_event; /* last event dispatched */
Time last_timestamp; /* from last event dispatched */
int multi_click_time; /* for XtSetMultiClickTime */
struct _TMKeyContextRec* tm_context; /* for XtGetActionKeysym */
InternalCallbackList mapping_callbacks; /* special case for TM */
XtPerDisplayInputRec pdi; /* state for modal grabs & kbd focus */
struct _WWTable *WWtable; /* window to widget table */
XrmDatabase *per_screen_db; /* per screen resource databases */
XrmDatabase cmd_db; /* db from command line, if needed */
XrmDatabase server_db; /* resource property else .Xdefaults */
XtEventDispatchProc* dispatcher_list;
ExtSelectRec* ext_select_list;
int ext_select_count;
Widget hook_object;
#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
Atom rcm_init; /* ResConfig - initialize */
Atom rcm_data; /* ResConfig - data atom */
#endif
} XtPerDisplayStruct, *XtPerDisplay;
typedef struct _PerDisplayTable {
Display *dpy;
XtPerDisplayStruct perDpy;
struct _PerDisplayTable *next;
} PerDisplayTable, *PerDisplayTablePtr;
extern PerDisplayTablePtr _XtperDisplayList;
extern XtPerDisplay _XtSortPerDisplayList(
Display* /* dpy */
);
extern XtPerDisplay _XtGetPerDisplay(
Display* /* dpy */
);
extern XtPerDisplayInputRec* _XtGetPerDisplayInput(
Display* /* dpy */
);
#if 0
#ifdef DEBUG
#define _XtGetPerDisplay(display) \
((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
? &_XtperDisplayList->perDpy \
: _XtSortPerDisplayList(display))
#define _XtGetPerDisplayInput(display) \
((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
? &_XtperDisplayList->perDpy.pdi \
: &_XtSortPerDisplayList(display)->pdi)
#else
#define _XtGetPerDisplay(display) \
((_XtperDisplayList->dpy == (display)) \
? &_XtperDisplayList->perDpy \
: _XtSortPerDisplayList(display))
#define _XtGetPerDisplayInput(display) \
((_XtperDisplayList->dpy == (display)) \
? &_XtperDisplayList->perDpy.pdi \
: &_XtSortPerDisplayList(display)->pdi)
#endif /*DEBUG*/
#endif
extern void _XtDisplayInitialize(
Display* /* dpy */,
XtPerDisplay /* pd */,
_Xconst char* /* name */,
XrmOptionDescRec* /* urlist */,
Cardinal /* num_urs */,
int* /* argc */,
char** /* argv */
);
extern void _XtCacheFlushTag(
XtAppContext /* app */,
XtPointer /* tag */
);
extern void _XtFreeActions(
struct _ActionListRec* /* action_table */
);
extern void _XtDoPhase2Destroy(
XtAppContext /* app */,
int /* dispatch_level */
);
extern void _XtDoFreeBindings(
XtAppContext /* app */
);
extern void _XtExtensionSelect(
Widget /* widget */
);
#define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
extern void _XtAllocWWTable(
XtPerDisplay pd
);
extern void _XtFreeWWTable(
XtPerDisplay pd
);
extern String _XtGetUserName(String dest, int len);
extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist,
Cardinal num_urs, int argc, String *argv,
String *applName, String *displayName,
String *language);
_XFUNCPROTOEND
#endif /* _XtinitialI_h */
#warning "bigreqstr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/bigreqsproto.h> for the protocol defines."
#include <X11/extensions/bigreqsproto.h>
#warning "xcmiscstr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/xcmiscproto.h> for the protocol defines."
#include <X11/extensions/xcmiscproto.h>
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _XSHM_H_
#define _XSHM_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/shm.h>
#ifndef _XSHM_SERVER_
typedef unsigned long ShmSeg;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Drawable drawable; /* drawable of request */
int major_code; /* ShmReqCode */
int minor_code; /* X_ShmPutImage */
ShmSeg shmseg; /* the ShmSeg used in the request */
unsigned long offset; /* the offset into ShmSeg used in the request */
} XShmCompletionEvent;
typedef struct {
ShmSeg shmseg; /* resource id */
int shmid; /* kernel id */
char *shmaddr; /* address in client */
Bool readOnly; /* how the server should attach it */
} XShmSegmentInfo;
_XFUNCPROTOBEGIN
Bool XShmQueryExtension(
Display* /* dpy */
);
int XShmGetEventBase(
Display* /* dpy */
);
Bool XShmQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */,
Bool* /* sharedPixmaps */
);
int XShmPixmapFormat(
Display* /* dpy */
);
Bool XShmAttach(
Display* /* dpy */,
XShmSegmentInfo* /* shminfo */
);
Bool XShmDetach(
Display* /* dpy */,
XShmSegmentInfo* /* shminfo */
);
Bool XShmPutImage(
Display* /* dpy */,
Drawable /* d */,
GC /* gc */,
XImage* /* image */,
int /* src_x */,
int /* src_y */,
int /* dst_x */,
int /* dst_y */,
unsigned int /* src_width */,
unsigned int /* src_height */,
Bool /* send_event */
);
Bool XShmGetImage(
Display* /* dpy */,
Drawable /* d */,
XImage* /* image */,
int /* x */,
int /* y */,
unsigned long /* plane_mask */
);
XImage *XShmCreateImage(
Display* /* dpy */,
Visual* /* visual */,
unsigned int /* depth */,
int /* format */,
char* /* data */,
XShmSegmentInfo* /* shminfo */,
unsigned int /* width */,
unsigned int /* height */
);
Pixmap XShmCreatePixmap(
Display* /* dpy */,
Drawable /* d */,
char* /* data */,
XShmSegmentInfo* /* shminfo */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* depth */
);
_XFUNCPROTOEND
#endif /* _XSHM_SERVER_ */
#endif
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
#ifndef _XMITMISC_H_
#define _XMITMISC_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/mitmiscconst.h>
_XFUNCPROTOBEGIN
Bool XMITMiscQueryExtension(
Display* /* dpy */,
int* /* event_basep */,
int* /* error_basep */
);
Status XMITMiscSetBugMode(
Display* /* dpy */,
Bool /* onOff */
);
Bool XMITMiscGetBugMode(
Display* /* dpy */
);
_XFUNCPROTOEND
#endif
/******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Header file for Xlib-related DBE
*
*****************************************************************************/
#ifndef XDBE_H
#define XDBE_H
#include <X11/Xfuncproto.h>
#include <X11/extensions/dbe.h>
typedef struct
{
VisualID visual; /* one visual ID that supports double-buffering */
int depth; /* depth of visual in bits */
int perflevel; /* performance level of visual */
}
XdbeVisualInfo;
typedef struct
{
int count; /* number of items in visual_depth */
XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
}
XdbeScreenVisualInfo;
typedef Drawable XdbeBackBuffer;
typedef unsigned char XdbeSwapAction;
typedef struct
{
Window swap_window; /* window for which to swap buffers */
XdbeSwapAction swap_action; /* swap action to use for swap_window */
}
XdbeSwapInfo;
typedef struct
{
Window window; /* window that buffer belongs to */
}
XdbeBackBufferAttributes;
typedef struct
{
int type;
Display *display; /* display the event was read from */
XdbeBackBuffer buffer; /* resource id */
unsigned long serial; /* serial number of failed request */
unsigned char error_code; /* error base + XdbeBadBuffer */
unsigned char request_code; /* major opcode of failed request */
unsigned char minor_code; /* minor opcode of failed request */
}
XdbeBufferError;
/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops
* (for non-C++ builds) in X11/Xfuncproto.h.
*/
_XFUNCPROTOBEGIN
extern Status XdbeQueryExtension(
Display* /* dpy */,
int* /* major_version_return */,
int* /* minor_version_return */
);
extern XdbeBackBuffer XdbeAllocateBackBufferName(
Display* /* dpy */,
Window /* window */,
XdbeSwapAction /* swap_action */
);
extern Status XdbeDeallocateBackBufferName(
Display* /* dpy */,
XdbeBackBuffer /* buffer */
);
extern Status XdbeSwapBuffers(
Display* /* dpy */,
XdbeSwapInfo* /* swap_info */,
int /* num_windows */
);
extern Status XdbeBeginIdiom(
Display* /* dpy */
);
extern Status XdbeEndIdiom(
Display* /* dpy */
);
extern XdbeScreenVisualInfo *XdbeGetVisualInfo(
Display* /* dpy */,
Drawable* /* screen_specifiers */,
int* /* num_screens */
);
extern void XdbeFreeVisualInfo(
XdbeScreenVisualInfo* /* visual_info */
);
extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
Display* /* dpy */,
XdbeBackBuffer /* buffer */
);
_XFUNCPROTOEND
#endif /* XDBE_H */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _EVIPROTO_H_
#define _EVIPROTO_H_
#include <X11/extensions/EVI.h>
#define X_EVIQueryVersion 0
#define X_EVIGetVisualInfo 1
#define VisualID CARD32
typedef CARD32 VisualID32;
#define sz_VisualID32 4
typedef struct _xExtendedVisualInfo {
VisualID core_visual_id;
INT8 screen;
INT8 level;
CARD8 transparency_type;
CARD8 pad0;
CARD32 transparency_value;
CARD8 min_hw_colormaps;
CARD8 max_hw_colormaps;
CARD16 num_colormap_conflicts;
} xExtendedVisualInfo;
#define sz_xExtendedVisualInfo 16
typedef struct _XEVIQueryVersion {
CARD8 reqType; /* always XEVIReqCode */
CARD8 xeviReqType; /* always X_EVIQueryVersion */
CARD16 length;
} xEVIQueryVersionReq;
#define sz_xEVIQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of EVI protocol */
CARD16 minorVersion; /* minor version of EVI protocol */
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xEVIQueryVersionReply;
#define sz_xEVIQueryVersionReply 32
typedef struct _XEVIGetVisualInfoReq {
CARD8 reqType; /* always XEVIReqCode */
CARD8 xeviReqType; /* always X_EVIGetVisualInfo */
CARD16 length;
CARD32 n_visual;
} xEVIGetVisualInfoReq;
#define sz_xEVIGetVisualInfoReq 8
typedef struct _XEVIGetVisualInfoReply {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 n_info;
CARD32 n_conflicts;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xEVIGetVisualInfoReply;
#define sz_xEVIGetVisualInfoReply 32
#undef VisualID
#endif /* _EVIPROTO_H_ */
/*
* Copyright © 2003 Keith Packard
* Copyright © 2007 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _DAMAGEPROTO_H_
#define _DAMAGEPROTO_H_
#include <X11/Xmd.h>
#include <X11/extensions/xfixesproto.h>
#include <X11/extensions/damagewire.h>
#define Window CARD32
#define Drawable CARD32
#define Font CARD32
#define Pixmap CARD32
#define Cursor CARD32
#define Colormap CARD32
#define GContext CARD32
#define Atom CARD32
#define VisualID CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define Picture CARD32
#define Region CARD32
#define Damage CARD32
/************** Version 0 ******************/
typedef struct {
CARD8 reqType;
CARD8 damageReqType;
CARD16 length;
} xDamageReq;
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 damageReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xDamageQueryVersionReq;
#define sz_xDamageQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDamageQueryVersionReply;
#define sz_xDamageQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 damageReqType;
CARD16 length;
Damage damage;
Drawable drawable;
CARD8 level;
CARD8 pad1;
CARD16 pad2;
} xDamageCreateReq;
#define sz_xDamageCreateReq 16
typedef struct {
CARD8 reqType;
CARD8 damageReqType;
CARD16 length;
Damage damage;
} xDamageDestroyReq;
#define sz_xDamageDestroyReq 8
typedef struct {
CARD8 reqType;
CARD8 damageReqType;
CARD16 length;
Damage damage;
Region repair;
Region parts;
} xDamageSubtractReq;
#define sz_xDamageSubtractReq 16
typedef struct {
CARD8 reqType;
CARD8 damageReqType;
CARD16 length;
Drawable drawable;
Region region;
} xDamageAddReq;
#define sz_xDamageAddReq 12
/* Events */
#define DamageNotifyMore 0x80
typedef struct {
CARD8 type;
CARD8 level;
CARD16 sequenceNumber;
Drawable drawable;
Damage damage;
Time timestamp;
xRectangle area;
xRectangle geometry;
} xDamageNotifyEvent;
#undef Damage
#undef Region
#undef Picture
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef Atom
#undef VisualID
#undef Time
#undef KeyCode
#undef KeySym
#endif /* _DAMAGEPROTO_H_ */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XKBGEOM_H_
#define _XKBGEOM_H_
#include <X11/extensions/XKBstr.h>
#ifdef XKB_IN_SERVER
#define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias
#define XkbAddGeomColor SrvXkbAddGeomColor
#define XkbAddGeomDoodad SrvXkbAddGeomDoodad
#define XkbAddGeomKey SrvXkbAddGeomKey
#define XkbAddGeomOutline SrvXkbAddGeomOutline
#define XkbAddGeomOverlay SrvXkbAddGeomOverlay
#define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow
#define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey
#define XkbAddGeomProperty SrvXkbAddGeomProperty
#define XkbAddGeomRow SrvXkbAddGeomRow
#define XkbAddGeomSection SrvXkbAddGeomSection
#define XkbAddGeomShape SrvXkbAddGeomShape
#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases
#define XkbAllocGeomColors SrvXkbAllocGeomColors
#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads
#define XkbAllocGeomKeys SrvXkbAllocGeomKeys
#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines
#define XkbAllocGeomPoints SrvXkbAllocGeomPoints
#define XkbAllocGeomProps SrvXkbAllocGeomProps
#define XkbAllocGeomRows SrvXkbAllocGeomRows
#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads
#define XkbAllocGeomSections SrvXkbAllocGeomSections
#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays
#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows
#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys
#define XkbAllocGeomShapes SrvXkbAllocGeomShapes
#define XkbAllocGeometry SrvXkbAllocGeometry
#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases
#define XkbFreeGeomColors SrvXkbFreeGeomColors
#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads
#define XkbFreeGeomProperties SrvXkbFreeGeomProperties
#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys
#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows
#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays
#define XkbFreeGeomKeys SrvXkbFreeGeomKeys
#define XkbFreeGeomRows SrvXkbFreeGeomRows
#define XkbFreeGeomSections SrvXkbFreeGeomSections
#define XkbFreeGeomPoints SrvXkbFreeGeomPoints
#define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines
#define XkbFreeGeomShapes SrvXkbFreeGeomShapes
#define XkbFreeGeometry SrvXkbFreeGeometry
#endif
typedef struct _XkbProperty {
char *name;
char *value;
} XkbPropertyRec,*XkbPropertyPtr;
typedef struct _XkbColor {
unsigned int pixel;
char * spec;
} XkbColorRec,*XkbColorPtr;
typedef struct _XkbPoint {
short x;
short y;
} XkbPointRec, *XkbPointPtr;
typedef struct _XkbBounds {
short x1,y1;
short x2,y2;
} XkbBoundsRec, *XkbBoundsPtr;
#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))
#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))
/*
* In the following structs, this pattern is used for dynamically sized arrays:
* foo is an array for which sz_foo entries are allocated & num_foo are used
*/
typedef struct _XkbOutline {
unsigned short num_points;
unsigned short sz_points;
unsigned short corner_radius;
XkbPointPtr points;
} XkbOutlineRec, *XkbOutlinePtr;
typedef struct _XkbShape {
Atom name;
unsigned short num_outlines;
unsigned short sz_outlines;
XkbOutlinePtr outlines;
XkbOutlinePtr approx;
XkbOutlinePtr primary;
XkbBoundsRec bounds;
} XkbShapeRec, *XkbShapePtr;
#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))
typedef struct _XkbShapeDoodad {
Atom name;
unsigned char type;
unsigned char priority;
short top;
short left;
short angle;
unsigned short color_ndx;
unsigned short shape_ndx;
} XkbShapeDoodadRec, *XkbShapeDoodadPtr;
#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
typedef struct _XkbTextDoodad {
Atom name;
unsigned char type;
unsigned char priority;
short top;
short left;
short angle;
short width;
short height;
unsigned short color_ndx;
char * text;
char * font;
} XkbTextDoodadRec, *XkbTextDoodadPtr;
#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
typedef struct _XkbIndicatorDoodad {
Atom name;
unsigned char type;
unsigned char priority;
short top;
short left;
short angle;
unsigned short shape_ndx;
unsigned short on_color_ndx;
unsigned short off_color_ndx;
} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])
#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
#define XkbSetIndicatorDoodadOnColor(g,d,c) \
((d)->on_color_ndx= (c)-&(g)->colors[0])
#define XkbSetIndicatorDoodadOffColor(g,d,c) \
((d)->off_color_ndx= (c)-&(g)->colors[0])
#define XkbSetIndicatorDoodadShape(g,d,s) \
((d)->shape_ndx= (s)-&(g)->shapes[0])
typedef struct _XkbLogoDoodad {
Atom name;
unsigned char type;
unsigned char priority;
short top;
short left;
short angle;
unsigned short color_ndx;
unsigned short shape_ndx;
char * logo_name;
} XkbLogoDoodadRec, *XkbLogoDoodadPtr;
#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
typedef struct _XkbAnyDoodad {
Atom name;
unsigned char type;
unsigned char priority;
short top;
short left;
short angle;
} XkbAnyDoodadRec, *XkbAnyDoodadPtr;
typedef union _XkbDoodad {
XkbAnyDoodadRec any;
XkbShapeDoodadRec shape;
XkbTextDoodadRec text;
XkbIndicatorDoodadRec indicator;
XkbLogoDoodadRec logo;
} XkbDoodadRec, *XkbDoodadPtr;
#define XkbUnknownDoodad 0
#define XkbOutlineDoodad 1
#define XkbSolidDoodad 2
#define XkbTextDoodad 3
#define XkbIndicatorDoodad 4
#define XkbLogoDoodad 5
typedef struct _XkbKey {
XkbKeyNameRec name;
short gap;
unsigned char shape_ndx;
unsigned char color_ndx;
} XkbKeyRec, *XkbKeyPtr;
#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])
#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])
#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])
#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])
typedef struct _XkbRow {
short top;
short left;
unsigned short num_keys;
unsigned short sz_keys;
int vertical;
XkbKeyPtr keys;
XkbBoundsRec bounds;
} XkbRowRec, *XkbRowPtr;
typedef struct _XkbSection {
Atom name;
unsigned char priority;
short top;
short left;
unsigned short width;
unsigned short height;
short angle;
unsigned short num_rows;
unsigned short num_doodads;
unsigned short num_overlays;
unsigned short sz_rows;
unsigned short sz_doodads;
unsigned short sz_overlays;
XkbRowPtr rows;
XkbDoodadPtr doodads;
XkbBoundsRec bounds;
struct _XkbOverlay *overlays;
} XkbSectionRec, *XkbSectionPtr;
typedef struct _XkbOverlayKey {
XkbKeyNameRec over;
XkbKeyNameRec under;
} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
typedef struct _XkbOverlayRow {
unsigned short row_under;
unsigned short num_keys;
unsigned short sz_keys;
XkbOverlayKeyPtr keys;
} XkbOverlayRowRec,*XkbOverlayRowPtr;
typedef struct _XkbOverlay {
Atom name;
XkbSectionPtr section_under;
unsigned short num_rows;
unsigned short sz_rows;
XkbOverlayRowPtr rows;
XkbBoundsPtr bounds;
} XkbOverlayRec,*XkbOverlayPtr;
typedef struct _XkbGeometry {
Atom name;
unsigned short width_mm;
unsigned short height_mm;
char * label_font;
XkbColorPtr label_color;
XkbColorPtr base_color;
unsigned short sz_properties;
unsigned short sz_colors;
unsigned short sz_shapes;
unsigned short sz_sections;
unsigned short sz_doodads;
unsigned short sz_key_aliases;
unsigned short num_properties;
unsigned short num_colors;
unsigned short num_shapes;
unsigned short num_sections;
unsigned short num_doodads;
unsigned short num_key_aliases;
XkbPropertyPtr properties;
XkbColorPtr colors;
XkbShapePtr shapes;
XkbSectionPtr sections;
XkbDoodadPtr doodads;
XkbKeyAliasPtr key_aliases;
} XkbGeometryRec;
#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))
#define XkbGeomPropertiesMask (1<<0)
#define XkbGeomColorsMask (1<<1)
#define XkbGeomShapesMask (1<<2)
#define XkbGeomSectionsMask (1<<3)
#define XkbGeomDoodadsMask (1<<4)
#define XkbGeomKeyAliasesMask (1<<5)
#define XkbGeomAllMask (0x3f)
typedef struct _XkbGeometrySizes {
unsigned int which;
unsigned short num_properties;
unsigned short num_colors;
unsigned short num_shapes;
unsigned short num_sections;
unsigned short num_doodads;
unsigned short num_key_aliases;
} XkbGeometrySizesRec,*XkbGeometrySizesPtr;
_XFUNCPROTOBEGIN
extern XkbPropertyPtr
XkbAddGeomProperty(
XkbGeometryPtr /* geom */,
char * /* name */,
char * /* value */
);
extern XkbKeyAliasPtr
XkbAddGeomKeyAlias(
XkbGeometryPtr /* geom */,
char * /* alias */,
char * /* real */
);
extern XkbColorPtr
XkbAddGeomColor(
XkbGeometryPtr /* geom */,
char * /* spec */,
unsigned int /* pixel */
);
extern XkbOutlinePtr
XkbAddGeomOutline(
XkbShapePtr /* shape */,
int /* sz_points */
);
extern XkbShapePtr
XkbAddGeomShape(
XkbGeometryPtr /* geom */,
Atom /* name */,
int /* sz_outlines */
);
extern XkbKeyPtr
XkbAddGeomKey(
XkbRowPtr /* row */
);
extern XkbRowPtr
XkbAddGeomRow(
XkbSectionPtr /* section */,
int /* sz_keys */
);
extern XkbSectionPtr
XkbAddGeomSection(
XkbGeometryPtr /* geom */,
Atom /* name */,
int /* sz_rows */,
int /* sz_doodads */,
int /* sz_overlays */
);
extern XkbOverlayPtr
XkbAddGeomOverlay(
XkbSectionPtr /* section */,
Atom /* name */,
int /* sz_rows */
);
extern XkbOverlayRowPtr
XkbAddGeomOverlayRow(
XkbOverlayPtr /* overlay */,
int /* row_under */,
int /* sz_keys */
);
extern XkbOverlayKeyPtr
XkbAddGeomOverlayKey(
XkbOverlayPtr /* overlay */,
XkbOverlayRowPtr /* row */,
char * /* over */,
char * /* under */
);
extern XkbDoodadPtr
XkbAddGeomDoodad(
XkbGeometryPtr /* geom */,
XkbSectionPtr /* section */,
Atom /* name */
);
extern void
XkbFreeGeomKeyAliases(
XkbGeometryPtr /* geom */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomColors(
XkbGeometryPtr /* geom */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomDoodads(
XkbDoodadPtr /* doodads */,
int /* nDoodads */,
Bool /* freeAll */
);
extern void
XkbFreeGeomProperties(
XkbGeometryPtr /* geom */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomOverlayKeys(
XkbOverlayRowPtr /* row */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomOverlayRows(
XkbOverlayPtr /* overlay */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomOverlays(
XkbSectionPtr /* section */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomKeys(
XkbRowPtr /* row */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomRows(
XkbSectionPtr /* section */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomSections(
XkbGeometryPtr /* geom */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomPoints(
XkbOutlinePtr /* outline */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomOutlines(
XkbShapePtr /* shape */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeomShapes(
XkbGeometryPtr /* geom */,
int /* first */,
int /* count */,
Bool /* freeAll */
);
extern void
XkbFreeGeometry(
XkbGeometryPtr /* geom */,
unsigned int /* which */,
Bool /* freeMap */
);
extern Status
XkbAllocGeomProps(
XkbGeometryPtr /* geom */,
int /* nProps */
);
extern Status
XkbAllocGeomKeyAliases(
XkbGeometryPtr /* geom */,
int /* nAliases */
);
extern Status
XkbAllocGeomColors(
XkbGeometryPtr /* geom */,
int /* nColors */
);
extern Status
XkbAllocGeomShapes(
XkbGeometryPtr /* geom */,
int /* nShapes */
);
extern Status
XkbAllocGeomSections(
XkbGeometryPtr /* geom */,
int /* nSections */
);
extern Status
XkbAllocGeomOverlays(
XkbSectionPtr /* section */,
int /* num_needed */
);
extern Status
XkbAllocGeomOverlayRows(
XkbOverlayPtr /* overlay */,
int /* num_needed */
);
extern Status
XkbAllocGeomOverlayKeys(
XkbOverlayRowPtr /* row */,
int /* num_needed */
);
extern Status
XkbAllocGeomDoodads(
XkbGeometryPtr /* geom */,
int /* nDoodads */
);
extern Status
XkbAllocGeomSectionDoodads(
XkbSectionPtr /* section */,
int /* nDoodads */
);
extern Status
XkbAllocGeomOutlines(
XkbShapePtr /* shape */,
int /* nOL */
);
extern Status
XkbAllocGeomRows(
XkbSectionPtr /* section */,
int /* nRows */
);
extern Status
XkbAllocGeomPoints(
XkbOutlinePtr /* ol */,
int /* nPts */
);
extern Status
XkbAllocGeomKeys(
XkbRowPtr /* row */,
int /* nKeys */
);
extern Status
XkbAllocGeometry(
XkbDescPtr /* xkb */,
XkbGeometrySizesPtr /* sizes */
);
extern Status
XkbSetGeometry(
Display * /* dpy */,
unsigned /* deviceSpec */,
XkbGeometryPtr /* geom */
);
extern Bool
XkbComputeShapeTop(
XkbShapePtr /* shape */,
XkbBoundsPtr /* bounds */
);
extern Bool
XkbComputeShapeBounds(
XkbShapePtr /* shape */
);
extern Bool
XkbComputeRowBounds(
XkbGeometryPtr /* geom */,
XkbSectionPtr /* section */,
XkbRowPtr /* row */
);
extern Bool
XkbComputeSectionBounds(
XkbGeometryPtr /* geom */,
XkbSectionPtr /* section */
);
extern char *
XkbFindOverlayForKey(
XkbGeometryPtr /* geom */,
XkbSectionPtr /* wanted */,
char * /* under */
);
extern Status
XkbGetGeometry(
Display * /* dpy */,
XkbDescPtr /* xkb */
);
extern Status
XkbGetNamedGeometry(
Display * /* dpy */,
XkbDescPtr /* xkb */,
Atom /* name */
);
_XFUNCPROTOEND
#endif /* _XKBSTR_H_ */
/*
* Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation on the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
* Authors:
* Rickard E. (Rik) Faith <faith@redhat.com>
*
*/
/** \file
* This file describes the structures necessary to implement the wire
* protocol for the DMX protocol extension. It should be included only
* in files that implement the client-side (or server-side) part of the
* protocol (i.e., client-side applications should \b not include this
* file). */
#ifndef _DMXSTR_H_
#define _DMXSTR_H_
#define DMX_EXTENSION_NAME "DMX"
#define DMX_EXTENSION_MAJOR 2
#define DMX_EXTENSION_MINOR 2
#define DMX_EXTENSION_PATCH 20040604
/* These values must be larger than LastExtensionError.
The values in dmxext.h and dmxproto.h *MUST* match. */
#define DMX_BAD_XINERAMA 1001
#define DMX_BAD_VALUE 1002
#define X_DMXQueryVersion 0
#define X_DMXGetScreenCount 1
#define X_DMXGetScreenInformationDEPRECATED 2
#define X_DMXGetWindowAttributes 3
#define X_DMXGetInputCount 4
#define X_DMXGetInputAttributes 5
#define X_DMXForceWindowCreationDEPRECATED 6
#define X_DMXReconfigureScreenDEPRECATED 7
#define X_DMXSync 8
#define X_DMXForceWindowCreation 9
#define X_DMXGetScreenAttributes 10
#define X_DMXChangeScreensAttributes 11
#define X_DMXAddScreen 12
#define X_DMXRemoveScreen 13
#define X_DMXGetDesktopAttributes 14
#define X_DMXChangeDesktopAttributes 15
#define X_DMXAddInput 16
#define X_DMXRemoveInput 17
/** Wire-level description of DMXQueryVersion protocol request. */
typedef struct {
CARD8 reqType; /* dmxcode */
CARD8 dmxReqType; /* X_DMXQueryVersion */
CARD16 length;
} xDMXQueryVersionReq;
#define sz_xDMXQueryVersionReq 4
/** Wire-level description of DMXQueryVersion protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 ununsed;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 patchVersion;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
} xDMXQueryVersionReply;
#define sz_xDMXQueryVersionReply 32
/** Wire-level description of DMXSync protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXSync */
CARD16 length;
} xDMXSyncReq;
#define sz_xDMXSyncReq 4
/** Wire-level description of DMXSync protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXSyncReply;
#define sz_xDMXSyncReply 32
/** Wire-level description of DMXForceWindowCreation protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXForceWindowCreation */
CARD16 length;
CARD32 window;
} xDMXForceWindowCreationReq;
#define sz_xDMXForceWindowCreationReq 8
/** Wire-level description of DMXForceWindowCreation protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXForceWindowCreationReply;
#define sz_xDMXForceWindowCreationReply 32
/** Wire-level description of DMXGetScreenCount protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXGetScreenCount */
CARD16 length;
} xDMXGetScreenCountReq;
#define sz_xDMXGetScreenCountReq 4
/** Wire-level description of DMXGetScreenCount protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 screenCount;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXGetScreenCountReply;
#define sz_xDMXGetScreenCountReply 32
/** Wire-level description of DMXGetScreenAttributes protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXGetScreenAttributes */
CARD16 length;
CARD32 physicalScreen;
} xDMXGetScreenAttributesReq;
#define sz_xDMXGetScreenAttributesReq 8
/** Wire-level description of DMXGetScreenAttributes protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 displayNameLength;
CARD32 logicalScreen;
CARD16 screenWindowWidth;
CARD16 screenWindowHeight;
INT16 screenWindowXoffset;
INT16 screenWindowYoffset;
CARD16 rootWindowWidth;
CARD16 rootWindowHeight;
INT16 rootWindowXoffset;
INT16 rootWindowYoffset;
INT16 rootWindowXorigin;
INT16 rootWindowYorigin;
} xDMXGetScreenAttributesReply;
#define sz_xDMXGetScreenAttributesReply 36
/** Wire-level description of DMXChangeScreensAttributes protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXChangeScreensAttributes */
CARD16 length;
CARD32 screenCount;
CARD32 maskCount;
} xDMXChangeScreensAttributesReq;
#define sz_xDMXChangeScreensAttributesReq 12
/** Wire-level description of DMXChangeScreensAttributes protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 errorScreen;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xDMXChangeScreensAttributesReply;
#define sz_xDMXChangeScreensAttributesReply 32
/** Wire-level description of DMXAddScreen protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXAddScreen */
CARD16 length;
CARD32 displayNameLength;
CARD32 physicalScreen;
CARD32 valueMask;
} xDMXAddScreenReq;
#define sz_xDMXAddScreenReq 16
/** Wire-level description of DMXAddScreen protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 physicalScreen;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xDMXAddScreenReply;
#define sz_xDMXAddScreenReply 32
/** Wire-level description of DMXRemoveScreen protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXRemoveScreen */
CARD16 length;
CARD32 physicalScreen;
} xDMXRemoveScreenReq;
#define sz_xDMXRemoveScreenReq 8
/** Wire-level description of DMXRemoveScreen protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXRemoveScreenReply;
#define sz_xDMXRemoveScreenReply 32
/** Wire-level description of DMXGetWindowAttributes protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXGetWindowAttributes */
CARD16 length;
CARD32 window;
} xDMXGetWindowAttributesReq;
#define sz_xDMXGetWindowAttributesReq 8
/** Wire-level description of DMXGetWindowAttributes protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 screenCount;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXGetWindowAttributesReply;
#define sz_xDMXGetWindowAttributesReply 32
/** Wire-level description of DMXGetDesktopAttributes protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXGetDesktopAttributes */
CARD16 length;
} xDMXGetDesktopAttributesReq;
#define sz_xDMXGetDesktopAttributesReq 4
/** Wire-level description of DMXGetDesktopAttributes protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
INT16 width;
INT16 height;
INT16 shiftX;
INT16 shiftY;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xDMXGetDesktopAttributesReply;
#define sz_xDMXGetDesktopAttributesReply 32
/** Wire-level description of DMXChangeDesktopAttributes protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXChangeDesktopAttributes */
CARD16 length;
CARD32 valueMask;
} xDMXChangeDesktopAttributesReq;
#define sz_xDMXChangeDesktopAttributesReq 8
/** Wire-level description of DMXChangeDesktopAttributes protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXChangeDesktopAttributesReply;
#define sz_xDMXChangeDesktopAttributesReply 32
/** Wire-level description of DMXGetInputCount protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXGetInputCount */
CARD16 length;
} xDMXGetInputCountReq;
#define sz_xDMXGetInputCountReq 4
/** Wire-level description of DMXGetInputCount protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 inputCount;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXGetInputCountReply;
#define sz_xDMXGetInputCountReply 32
/** Wire-level description of DMXGetInputAttributes protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXGetInputAttributes */
CARD16 length;
CARD32 deviceId;
} xDMXGetInputAttributesReq;
#define sz_xDMXGetInputAttributesReq 8
/** Wire-level description of DMXGetInputAttributes protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 inputType;
CARD32 physicalScreen;
CARD32 physicalId;
CARD32 nameLength;
BOOL isCore;
BOOL sendsCore;
BOOL detached;
CARD8 pad0;
CARD32 pad1;
} xDMXGetInputAttributesReply;
#define sz_xDMXGetInputAttributesReply 32
/** Wire-level description of DMXAddInput protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXAddInput */
CARD16 length;
CARD32 displayNameLength;
CARD32 valueMask;
} xDMXAddInputReq;
#define sz_xDMXAddInputReq 12
/** Wire-level description of DMXAddInput protocol reply. */
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 physicalId;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xDMXAddInputReply;
#define sz_xDMXAddInputReply 32
/** Wire-level description of DMXRemoveInput protocol request. */
typedef struct {
CARD8 reqType; /* DMXCode */
CARD8 dmxReqType; /* X_DMXRemoveInput */
CARD16 length;
CARD32 physicalId;
} xDMXRemoveInputReq;
#define sz_xDMXRemoveInputReq 8
/** Wire-level description of DMXRemoveInput protocol reply. */
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDMXRemoveInputReply;
#define sz_xDMXRemoveInputReply 32
#endif
/*
* Copyright © 2008 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL 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 PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
*/
#ifndef _DRI2_TOKENS_H_
#define _DRI2_TOKENS_H_
#define DRI2BufferFrontLeft 0
#define DRI2BufferBackLeft 1
#define DRI2BufferFrontRight 2
#define DRI2BufferBackRight 3
#define DRI2BufferDepth 4
#define DRI2BufferStencil 5
#define DRI2BufferAccum 6
#define DRI2BufferFakeFrontLeft 7
#define DRI2BufferFakeFrontRight 8
#define DRI2BufferDepthStencil 9
#define DRI2BufferHiz 10
/* keep bits 16 and above for prime IDs */
#define DRI2DriverPrimeMask 7 /* 0 - 7 - allows for 6 devices*/
#define DRI2DriverPrimeShift 16
#define DRI2DriverPrimeId(x) (((x) >> DRI2DriverPrimeShift) & (DRI2DriverPrimeMask))
#define DRI2DriverDRI 0
#define DRI2DriverVDPAU 1
/* Event sub-types for the swap complete event */
#define DRI2_EXCHANGE_COMPLETE 0x1
#define DRI2_BLIT_COMPLETE 0x2
#define DRI2_FLIP_COMPLETE 0x3
#endif
/*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XEXT_H_
#define _XEXT_H_
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
typedef int (*XextErrorHandler) (
Display * /* dpy */,
_Xconst char* /* ext_name */,
_Xconst char* /* reason */
);
extern XextErrorHandler XSetExtensionErrorHandler(
XextErrorHandler /* handler */
);
extern int XMissingExtension(
Display* /* dpy */,
_Xconst char* /* ext_name */
);
_XFUNCPROTOEND
#define X_EXTENSION_UNKNOWN "unknown"
#define X_EXTENSION_MISSING "missing"
#endif /* _XEXT_H_ */
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef XV_H
#define XV_H
/*
** File:
**
** Xv.h --- Xv shared library and server header file
**
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 05.15.91 Carver
** - version 2.0 upgrade
**
** 01.24.91 Carver
** - version 1.4 upgrade
**
*/
#include <X11/X.h>
#define XvName "XVideo"
#define XvVersion 2
#define XvRevision 2
/* Symbols */
typedef XID XvPortID;
typedef XID XvEncodingID;
#define XvNone 0
#define XvInput 0
#define XvOutput 1
#define XvInputMask (1<<XvInput)
#define XvOutputMask (1<<XvOutput)
#define XvVideoMask 0x00000004
#define XvStillMask 0x00000008
#define XvImageMask 0x00000010
/* These two are not client viewable */
#define XvPixmapMask 0x00010000
#define XvWindowMask 0x00020000
#define XvGettable 0x01
#define XvSettable 0x02
#define XvRGB 0
#define XvYUV 1
#define XvPacked 0
#define XvPlanar 1
#define XvTopToBottom 0
#define XvBottomToTop 1
/* Events */
#define XvVideoNotify 0
#define XvPortNotify 1
#define XvNumEvents 2
/* Video Notify Reasons */
#define XvStarted 0
#define XvStopped 1
#define XvBusy 2
#define XvPreempted 3
#define XvHardError 4
#define XvLastReason 4
#define XvNumReasons (XvLastReason + 1)
#define XvStartedMask (1<<XvStarted)
#define XvStoppedMask (1<<XvStopped)
#define XvBusyMask (1<<XvBusy)
#define XvPreemptedMask (1<<XvPreempted)
#define XvHardErrorMask (1<<XvHardError)
#define XvAnyReasonMask ((1<<XvNumReasons) - 1)
#define XvNoReasonMask 0
/* Errors */
#define XvBadPort 0
#define XvBadEncoding 1
#define XvBadControl 2
#define XvNumErrors 3
/* Status */
#define XvBadExtension 1
#define XvAlreadyGrabbed 2
#define XvInvalidTime 3
#define XvBadReply 4
#define XvBadAlloc 5
#endif /* XV_H */
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995 XFree86 Inc.
*/
#ifndef _XF86DGAPROTO_H_
#define _XF86DGAPROTO_H_
#include <X11/extensions/xf86dga1proto.h>
#include <X11/extensions/xf86dgaconst.h>
#define XF86DGANAME "XFree86-DGA"
#define XDGA_MAJOR_VERSION 2 /* current version numbers */
#define XDGA_MINOR_VERSION 0
typedef struct _XDGAQueryVersion {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length;
} xXDGAQueryVersionReq;
#define sz_xXDGAQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of DGA protocol */
CARD16 minorVersion; /* minor version of DGA protocol */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXDGAQueryVersionReply;
#define sz_xXDGAQueryVersionReply 32
typedef struct _XDGAQueryModes {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
} xXDGAQueryModesReq;
#define sz_xXDGAQueryModesReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 number; /* number of modes available */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXDGAQueryModesReply;
#define sz_xXDGAQueryModesReply 32
typedef struct _XDGASetMode {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD32 mode; /* mode number to init */
CARD32 pid; /* Pixmap descriptor */
} xXDGASetModeReq;
#define sz_xXDGASetModeReq 16
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 offset; /* offset into framebuffer map */
CARD32 flags;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXDGASetModeReply;
#define sz_xXDGASetModeReply 32
typedef struct {
CARD8 byte_order;
CARD8 depth;
CARD16 num;
CARD16 bpp;
CARD16 name_size;
CARD32 vsync_num;
CARD32 vsync_den;
CARD32 flags;
CARD16 image_width;
CARD16 image_height;
CARD16 pixmap_width;
CARD16 pixmap_height;
CARD32 bytes_per_scanline;
CARD32 red_mask;
CARD32 green_mask;
CARD32 blue_mask;
CARD16 visual_class;
CARD16 pad1;
CARD16 viewport_width;
CARD16 viewport_height;
CARD16 viewport_xstep;
CARD16 viewport_ystep;
CARD16 viewport_xmax;
CARD16 viewport_ymax;
CARD32 viewport_flags;
CARD32 reserved1;
CARD32 reserved2;
} xXDGAModeInfo;
#define sz_xXDGAModeInfo 72
typedef struct _XDGAOpenFramebuffer {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
} xXDGAOpenFramebufferReq;
#define sz_xXDGAOpenFramebufferReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length; /* device name size if there is one */
CARD32 mem1; /* physical memory */
CARD32 mem2; /* spillover for _alpha_ */
CARD32 size; /* size of map in bytes */
CARD32 offset; /* optional offset into device */
CARD32 extra; /* extra info associated with the map */
CARD32 pad2;
} xXDGAOpenFramebufferReply;
#define sz_xXDGAOpenFramebufferReply 32
typedef struct _XDGACloseFramebuffer {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
} xXDGACloseFramebufferReq;
#define sz_xXDGACloseFramebufferReq 8
typedef struct _XDGASetViewport {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD16 x;
CARD16 y;
CARD32 flags;
} xXDGASetViewportReq;
#define sz_xXDGASetViewportReq 16
typedef struct _XDGAInstallColormap {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD32 cmap;
} xXDGAInstallColormapReq;
#define sz_xXDGAInstallColormapReq 12
typedef struct _XDGASelectInput {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD32 mask;
} xXDGASelectInputReq;
#define sz_xXDGASelectInputReq 12
typedef struct _XDGAFillRectangle {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD16 x;
CARD16 y;
CARD16 width;
CARD16 height;
CARD32 color;
} xXDGAFillRectangleReq;
#define sz_xXDGAFillRectangleReq 20
typedef struct _XDGACopyArea {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD16 srcx;
CARD16 srcy;
CARD16 width;
CARD16 height;
CARD16 dstx;
CARD16 dsty;
} xXDGACopyAreaReq;
#define sz_xXDGACopyAreaReq 20
typedef struct _XDGACopyTransparentArea {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD16 srcx;
CARD16 srcy;
CARD16 width;
CARD16 height;
CARD16 dstx;
CARD16 dsty;
CARD32 key;
} xXDGACopyTransparentAreaReq;
#define sz_xXDGACopyTransparentAreaReq 24
typedef struct _XDGAGetViewportStatus {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
} xXDGAGetViewportStatusReq;
#define sz_xXDGAGetViewportStatusReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXDGAGetViewportStatusReply;
#define sz_xXDGAGetViewportStatusReply 32
typedef struct _XDGASync {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
} xXDGASyncReq;
#define sz_xXDGASyncReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xXDGASyncReply;
#define sz_xXDGASyncReply 32
typedef struct _XDGASetClientVersion {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD16 major;
CARD16 minor;
} xXDGASetClientVersionReq;
#define sz_xXDGASetClientVersionReq 8
typedef struct {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD16 x;
CARD16 y;
CARD32 flags;
} xXDGAChangePixmapModeReq;
#define sz_xXDGAChangePixmapModeReq 16
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 x;
CARD16 y;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xXDGAChangePixmapModeReply;
#define sz_xXDGAChangePixmapModeReply 32
typedef struct _XDGACreateColormap {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD32 screen;
CARD32 id;
CARD32 mode;
CARD8 alloc;
CARD8 pad1;
CARD16 pad2;
} xXDGACreateColormapReq;
#define sz_xXDGACreateColormapReq 20
typedef struct {
union {
struct {
BYTE type;
BYTE detail;
CARD16 sequenceNumber;
} u;
struct {
CARD32 pad0;
CARD32 time;
INT16 dx;
INT16 dy;
INT16 screen;
CARD16 state;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} event;
} u;
} dgaEvent;
#endif /* _XF86DGAPROTO_H_ */
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _COMPOSITEPROTO_H_
#define _COMPOSITEPROTO_H_
#include <X11/Xmd.h>
#include <X11/extensions/composite.h>
#define Window CARD32
#define Region CARD32
#define Pixmap CARD32
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xCompositeQueryVersionReq;
#define sz_xCompositeQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xCompositeQueryVersionReply;
#define sz_xCompositeQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
CARD8 update;
CARD8 pad1;
CARD16 pad2;
} xCompositeRedirectWindowReq;
#define sz_xCompositeRedirectWindowReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
CARD8 update;
CARD8 pad1;
CARD16 pad2;
} xCompositeRedirectSubwindowsReq;
#define sz_xCompositeRedirectSubwindowsReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
CARD8 update;
CARD8 pad1;
CARD16 pad2;
} xCompositeUnredirectWindowReq;
#define sz_xCompositeUnredirectWindowReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
CARD8 update;
CARD8 pad1;
CARD16 pad2;
} xCompositeUnredirectSubwindowsReq;
#define sz_xCompositeUnredirectSubwindowsReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Region region;
Window window;
} xCompositeCreateRegionFromBorderClipReq;
#define sz_xCompositeCreateRegionFromBorderClipReq 12
/* Version 0.2 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
Pixmap pixmap;
} xCompositeNameWindowPixmapReq;
#define sz_xCompositeNameWindowPixmapReq 12
/* Version 0.3 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
} xCompositeGetOverlayWindowReq;
#define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq)
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
Window overlayWin;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xCompositeGetOverlayWindowReply;
#define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply)
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window;
} xCompositeReleaseOverlayWindowReq;
#define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq)
#undef Window
#undef Region
#undef Pixmap
#endif /* _COMPOSITEPROTO_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _SHMPROTO_H_
#define _SHMPROTO_H_
#include <X11/extensions/shm.h>
#define ShmSeg CARD32
#define Drawable CARD32
#define VisualID CARD32
#define GContext CARD32
#define Pixmap CARD32
#define X_ShmQueryVersion 0
#define X_ShmAttach 1
#define X_ShmDetach 2
#define X_ShmPutImage 3
#define X_ShmGetImage 4
#define X_ShmCreatePixmap 5
#define X_ShmAttachFd 6
#define X_ShmCreateSegment 7
typedef struct _ShmQueryVersion {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmQueryVersion */
CARD16 length;
} xShmQueryVersionReq;
#define sz_xShmQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL sharedPixmaps;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of SHM protocol */
CARD16 minorVersion; /* minor version of SHM protocol */
CARD16 uid;
CARD16 gid;
CARD8 pixmapFormat;
CARD8 pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xShmQueryVersionReply;
#define sz_xShmQueryVersionReply 32
typedef struct _ShmAttach {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmAttach */
CARD16 length;
ShmSeg shmseg;
CARD32 shmid;
BOOL readOnly;
BYTE pad0;
CARD16 pad1;
} xShmAttachReq;
#define sz_xShmAttachReq 16
typedef struct _ShmDetach {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmDetach */
CARD16 length;
ShmSeg shmseg;
} xShmDetachReq;
#define sz_xShmDetachReq 8
typedef struct _ShmPutImage {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmPutImage */
CARD16 length;
Drawable drawable;
GContext gc;
CARD16 totalWidth;
CARD16 totalHeight;
CARD16 srcX;
CARD16 srcY;
CARD16 srcWidth;
CARD16 srcHeight;
INT16 dstX;
INT16 dstY;
CARD8 depth;
CARD8 format;
CARD8 sendEvent;
CARD8 bpad;
ShmSeg shmseg;
CARD32 offset;
} xShmPutImageReq;
#define sz_xShmPutImageReq 40
typedef struct _ShmGetImage {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmGetImage */
CARD16 length;
Drawable drawable;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
CARD32 planeMask;
CARD8 format;
CARD8 pad0;
CARD8 pad1;
CARD8 pad2;
ShmSeg shmseg;
CARD32 offset;
} xShmGetImageReq;
#define sz_xShmGetImageReq 32
typedef struct _ShmGetImageReply {
BYTE type; /* X_Reply */
CARD8 depth;
CARD16 sequenceNumber;
CARD32 length;
VisualID visual;
CARD32 size;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xShmGetImageReply;
#define sz_xShmGetImageReply 32
typedef struct _ShmCreatePixmap {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmCreatePixmap */
CARD16 length;
Pixmap pid;
Drawable drawable;
CARD16 width;
CARD16 height;
CARD8 depth;
CARD8 pad0;
CARD8 pad1;
CARD8 pad2;
ShmSeg shmseg;
CARD32 offset;
} xShmCreatePixmapReq;
#define sz_xShmCreatePixmapReq 28
typedef struct _ShmCompletion {
BYTE type; /* always eventBase + ShmCompletion */
BYTE bpad0;
CARD16 sequenceNumber;
Drawable drawable;
CARD16 minorEvent;
BYTE majorEvent;
BYTE bpad1;
ShmSeg shmseg;
CARD32 offset;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
} xShmCompletionEvent;
#define sz_xShmCompletionEvent 32
/* Version 1.2 additions */
typedef struct _ShmAttachFd {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmAttachFd */
CARD16 length;
ShmSeg shmseg;
BOOL readOnly;
BYTE pad0;
CARD16 pad1;
} xShmAttachFdReq;
/* File descriptor is passed with this request */
#define sz_xShmAttachFdReq 12
typedef struct _ShmCreateSegment {
CARD8 reqType; /* always ShmReqCode */
CARD8 shmReqType; /* always X_ShmAttachFd */
CARD16 length;
ShmSeg shmseg;
CARD32 size;
BOOL readOnly;
BYTE pad0;
CARD16 pad1;
} xShmCreateSegmentReq;
#define sz_xShmCreateSegmentReq 16
typedef struct {
CARD8 type; /* must be X_Reply */
CARD8 nfd; /* must be 1 */
CARD16 sequenceNumber; /* last sequence number */
CARD32 length; /* 0 */
CARD32 pad2; /* unused */
CARD32 pad3; /* unused */
CARD32 pad4; /* unused */
CARD32 pad5; /* unused */
CARD32 pad6; /* unused */
CARD32 pad7; /* unused */
} xShmCreateSegmentReply;
/* File descriptor is passed with this reply */
#define sz_xShmCreateSegmentReply 32
#undef ShmSeg
#undef Drawable
#undef VisualID
#undef GContext
#undef Pixmap
#endif /* _SHMPROTO_H_ */
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright 2010 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _XFIXESPROTO_H_
#define _XFIXESPROTO_H_
#include <X11/Xmd.h>
#include <X11/extensions/xfixeswire.h>
#include <X11/extensions/shapeconst.h>
#define Window CARD32
#define Drawable CARD32
#define Font CARD32
#define Pixmap CARD32
#define Cursor CARD32
#define Colormap CARD32
#define GContext CARD32
#define Atom CARD32
#define VisualID CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define Picture CARD32
/*************** Version 1 ******************/
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
} xXFixesReq;
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xXFixesQueryVersionReq;
#define sz_xXFixesQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXFixesQueryVersionReply;
#define sz_xXFixesQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
BYTE mode; /* SetModeInsert/SetModeDelete*/
BYTE target; /* SaveSetNearest/SaveSetRoot*/
BYTE map; /* SaveSetMap/SaveSetUnmap */
BYTE pad1;
Window window;
} xXFixesChangeSaveSetReq;
#define sz_xXFixesChangeSaveSetReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Window window;
Atom selection;
CARD32 eventMask;
} xXFixesSelectSelectionInputReq;
#define sz_xXFixesSelectSelectionInputReq 16
typedef struct {
CARD8 type;
CARD8 subtype;
CARD16 sequenceNumber;
Window window;
Window owner;
Atom selection;
Time timestamp;
Time selectionTimestamp;
CARD32 pad2;
CARD32 pad3;
} xXFixesSelectionNotifyEvent;
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Window window;
CARD32 eventMask;
} xXFixesSelectCursorInputReq;
#define sz_xXFixesSelectCursorInputReq 12
typedef struct {
CARD8 type;
CARD8 subtype;
CARD16 sequenceNumber;
Window window;
CARD32 cursorSerial;
Time timestamp;
Atom name; /* Version 2 */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xXFixesCursorNotifyEvent;
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
} xXFixesGetCursorImageReq;
#define sz_xXFixesGetCursorImageReq 4
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
CARD16 xhot;
CARD16 yhot;
CARD32 cursorSerial;
CARD32 pad2;
CARD32 pad3;
} xXFixesGetCursorImageReply;
#define sz_xXFixesGetCursorImageReply 32
/*************** Version 2 ******************/
#define Region CARD32
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
/* LISTofRECTANGLE */
} xXFixesCreateRegionReq;
#define sz_xXFixesCreateRegionReq 8
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
Pixmap bitmap;
} xXFixesCreateRegionFromBitmapReq;
#define sz_xXFixesCreateRegionFromBitmapReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
Window window;
CARD8 kind;
CARD8 pad1;
CARD16 pad2;
} xXFixesCreateRegionFromWindowReq;
#define sz_xXFixesCreateRegionFromWindowReq 16
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
GContext gc;
} xXFixesCreateRegionFromGCReq;
#define sz_xXFixesCreateRegionFromGCReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
Picture picture;
} xXFixesCreateRegionFromPictureReq;
#define sz_xXFixesCreateRegionFromPictureReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
} xXFixesDestroyRegionReq;
#define sz_xXFixesDestroyRegionReq 8
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
/* LISTofRECTANGLE */
} xXFixesSetRegionReq;
#define sz_xXFixesSetRegionReq 8
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region source;
Region destination;
} xXFixesCopyRegionReq;
#define sz_xXFixesCopyRegionReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region source1;
Region source2;
Region destination;
} xXFixesCombineRegionReq,
xXFixesUnionRegionReq,
xXFixesIntersectRegionReq,
xXFixesSubtractRegionReq;
#define sz_xXFixesCombineRegionReq 16
#define sz_xXFixesUnionRegionReq sz_xXFixesCombineRegionReq
#define sz_xXFixesIntersectRegionReq sz_xXFixesCombineRegionReq
#define sz_xXFixesSubtractRegionReq sz_xXFixesCombineRegionReq
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region source;
INT16 x, y;
CARD16 width, height;
Region destination;
} xXFixesInvertRegionReq;
#define sz_xXFixesInvertRegionReq 20
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
INT16 dx, dy;
} xXFixesTranslateRegionReq;
#define sz_xXFixesTranslateRegionReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region source;
Region destination;
} xXFixesRegionExtentsReq;
#define sz_xXFixesRegionExtentsReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region region;
} xXFixesFetchRegionReq;
#define sz_xXFixesFetchRegionReq 8
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
INT16 x, y;
CARD16 width, height;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXFixesFetchRegionReply;
#define sz_xXFixesFetchRegionReply 32
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
GContext gc;
Region region;
INT16 xOrigin, yOrigin;
} xXFixesSetGCClipRegionReq;
#define sz_xXFixesSetGCClipRegionReq 16
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Window dest;
BYTE destKind;
CARD8 pad1;
CARD16 pad2;
INT16 xOff, yOff;
Region region;
} xXFixesSetWindowShapeRegionReq;
#define sz_xXFixesSetWindowShapeRegionReq 20
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Picture picture;
Region region;
INT16 xOrigin, yOrigin;
} xXFixesSetPictureClipRegionReq;
#define sz_xXFixesSetPictureClipRegionReq 16
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Cursor cursor;
CARD16 nbytes;
CARD16 pad;
} xXFixesSetCursorNameReq;
#define sz_xXFixesSetCursorNameReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Cursor cursor;
} xXFixesGetCursorNameReq;
#define sz_xXFixesGetCursorNameReq 8
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
Atom atom;
CARD16 nbytes;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXFixesGetCursorNameReply;
#define sz_xXFixesGetCursorNameReply 32
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
} xXFixesGetCursorImageAndNameReq;
#define sz_xXFixesGetCursorImageAndNameReq 4
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
CARD16 xhot;
CARD16 yhot;
CARD32 cursorSerial;
Atom cursorName;
CARD16 nbytes;
CARD16 pad;
} xXFixesGetCursorImageAndNameReply;
#define sz_xXFixesGetCursorImageAndNameReply 32
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Cursor source;
Cursor destination;
} xXFixesChangeCursorReq;
#define sz_xXFixesChangeCursorReq 12
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Cursor source;
CARD16 nbytes;
CARD16 pad;
} xXFixesChangeCursorByNameReq;
#define sz_xXFixesChangeCursorByNameReq 12
/*************** Version 3 ******************/
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Region source;
Region destination;
CARD16 left;
CARD16 right;
CARD16 top;
CARD16 bottom;
} xXFixesExpandRegionReq;
#define sz_xXFixesExpandRegionReq 20
/*************** Version 4.0 ******************/
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Window window;
} xXFixesHideCursorReq;
#define sz_xXFixesHideCursorReq sizeof(xXFixesHideCursorReq)
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Window window;
} xXFixesShowCursorReq;
#define sz_xXFixesShowCursorReq sizeof(xXFixesShowCursorReq)
/*************** Version 5.0 ******************/
#define Barrier CARD32
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Barrier barrier;
Window window;
INT16 x1;
INT16 y1;
INT16 x2;
INT16 y2;
CARD32 directions;
CARD16 pad;
CARD16 num_devices;
/* array of CARD16 devices */
} xXFixesCreatePointerBarrierReq;
#define sz_xXFixesCreatePointerBarrierReq 28
typedef struct {
CARD8 reqType;
CARD8 xfixesReqType;
CARD16 length;
Barrier barrier;
} xXFixesDestroyPointerBarrierReq;
#define sz_xXFixesDestroyPointerBarrierReq 8
#undef Barrier
#undef Region
#undef Picture
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef Atom
#undef VisualID
#undef Time
#undef KeyCode
#undef KeySym
#endif /* _XFIXESPROTO_H_ */
/*
Copyright (c) 1999 XFree86 Inc
*/
#ifndef _XF86DGACONST_H_
#define _XF86DGACONST_H_
#include <X11/extensions/xf86dga1const.h>
#define X_XDGAQueryVersion 0
/* 1 through 9 are in xf86dga1.h */
/* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */
#define X_XDGAQueryModes 12
#define X_XDGASetMode 13
#define X_XDGASetViewport 14
#define X_XDGAInstallColormap 15
#define X_XDGASelectInput 16
#define X_XDGAFillRectangle 17
#define X_XDGACopyArea 18
#define X_XDGACopyTransparentArea 19
#define X_XDGAGetViewportStatus 20
#define X_XDGASync 21
#define X_XDGAOpenFramebuffer 22
#define X_XDGACloseFramebuffer 23
#define X_XDGASetClientVersion 24
#define X_XDGAChangePixmapMode 25
#define X_XDGACreateColormap 26
#define XDGAConcurrentAccess 0x00000001
#define XDGASolidFillRect 0x00000002
#define XDGABlitRect 0x00000004
#define XDGABlitTransRect 0x00000008
#define XDGAPixmap 0x00000010
#define XDGAInterlaced 0x00010000
#define XDGADoublescan 0x00020000
#define XDGAFlipImmediate 0x00000001
#define XDGAFlipRetrace 0x00000002
#define XDGANeedRoot 0x00000001
#define XF86DGANumberEvents 7
#define XDGAPixmapModeLarge 0
#define XDGAPixmapModeSmall 1
#define XF86DGAClientNotLocal 0
#define XF86DGANoDirectVideoMode 1
#define XF86DGAScreenNotActive 2
#define XF86DGADirectNotActivated 3
#define XF86DGAOperationNotSupported 4
#define XF86DGANumberErrors (XF86DGAOperationNotSupported + 1)
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
char *name; /* name of mode given in the XF86Config */
float verticalRefresh;
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long redMask;
unsigned long greenMask;
unsigned long blueMask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int reserved1;
int reserved2;
} XDGAMode;
typedef struct {
XDGAMode mode;
unsigned char *data;
Pixmap pixmap;
} XDGADevice;
#endif /* _XF86DGACONST_H_ */
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _DAMAGEWIRE_H_
#define _DAMAGEWIRE_H_
#define DAMAGE_NAME "DAMAGE"
#define DAMAGE_MAJOR 1
#define DAMAGE_MINOR 1
/************* Version 1 ****************/
/* Constants */
#define XDamageReportRawRectangles 0
#define XDamageReportDeltaRectangles 1
#define XDamageReportBoundingBox 2
#define XDamageReportNonEmpty 3
/* Requests */
#define X_DamageQueryVersion 0
#define X_DamageCreate 1
#define X_DamageDestroy 2
#define X_DamageSubtract 3
#define X_DamageAdd 4
#define XDamageNumberRequests (X_DamageAdd + 1)
/* Events */
#define XDamageNotify 0
#define XDamageNumberEvents (XDamageNotify + 1)
/* Errors */
#define BadDamage 0
#define XDamageNumberErrors (BadDamage + 1)
#endif /* _DAMAGEWIRE_H_ */
/*
Copyright 1996, 1998, 2001 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _AGPROTO_H_ /* { */
#define _AGPROTO_H_
#include <X11/extensions/ag.h>
#define X_XagQueryVersion 0
#define X_XagCreate 1
#define X_XagDestroy 2
#define X_XagGetAttr 3
#define X_XagQuery 4
#define X_XagCreateAssoc 5
#define X_XagDestroyAssoc 6
#define XAppGroup CARD32
/*
* Redefine some basic types used by structures defined herein. This allows
* both the library and server to view communicated data as 32-bit entities,
* thus preventing problems on 64-bit architectures where libXext sees this
* data as 64 bits and the server sees it as 32 bits.
*/
#define Colormap CARD32
#define VisualID CARD32
#define Window CARD32
typedef struct _XagQueryVersion {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagQueryVersion */
CARD16 length;
CARD16 client_major_version;
CARD16 client_minor_version;
} xXagQueryVersionReq;
#define sz_xXagQueryVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number;
CARD32 length;
CARD16 server_major_version;
CARD16 server_minor_version;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXagQueryVersionReply;
#define sz_xXagQueryVersionReply 32
/* Set AppGroup Attributes masks */
#define XagSingleScreenMask 1 << 0
#define XagDefaultRootMask 1 << XagNdefaultRoot
#define XagRootVisualMask 1 << XagNrootVisual
#define XagDefaultColormapMask 1 << XagNdefaultColormap
#define XagBlackPixelMask 1 << XagNblackPixel
#define XagWhitePixelMask 1 << XagNwhitePixel
#define XagAppGroupLeaderMask 1 << XagNappGroupLeader
typedef struct _XagCreate {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagCreate */
CARD16 length;
XAppGroup app_group;
CARD32 attrib_mask; /* LISTofVALUE follows */
} xXagCreateReq;
#define sz_xXagCreateReq 12
typedef struct _XagDestroy {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagDestroy */
CARD16 length;
XAppGroup app_group;
} xXagDestroyReq;
#define sz_xXagDestroyReq 8
typedef struct _XagGetAttr {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagGetAttr */
CARD16 length;
XAppGroup app_group;
} xXagGetAttrReq;
#define sz_xXagGetAttrReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number;
CARD32 length;
Window default_root;
VisualID root_visual;
Colormap default_colormap;
CARD32 black_pixel;
CARD32 white_pixel;
BOOL single_screen;
BOOL app_group_leader;
CARD16 pad2;
} xXagGetAttrReply;
#define sz_xXagGetAttrReply 32
typedef struct _XagQuery {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagQuery */
CARD16 length;
CARD32 resource;
} xXagQueryReq;
#define sz_xXagQueryReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number;
CARD32 length;
XAppGroup app_group;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXagQueryReply;
#define sz_xXagQueryReply 32
typedef struct _XagCreateAssoc {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagCreateAssoc */
CARD16 length;
Window window;
CARD16 window_type;
CARD16 system_window_len; /* LISTofCARD8 follows */
} xXagCreateAssocReq;
#define sz_xXagCreateAssocReq 12
typedef struct _XagDestroyAssoc {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagDestroyAssoc */
CARD16 length;
Window window;
} xXagDestroyAssocReq;
#define sz_xXagDestroyAssocReq 8
#undef XAppGroup
/*
* Cancel the previous redefinition of the basic types, thus restoring their
* X.h definitions.
*/
#undef Window
#undef Colormap
#undef VisualID
#endif /* } _AGPROTO_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _SHMSTR_H_
#define _SHMSTR_H_
#include <X11/extensions/shmproto.h>
#ifdef _XSHM_SERVER_
#define XSHM_PUT_IMAGE_ARGS \
DrawablePtr /* dst */, \
GCPtr /* pGC */, \
int /* depth */, \
unsigned int /* format */, \
int /* w */, \
int /* h */, \
int /* sx */, \
int /* sy */, \
int /* sw */, \
int /* sh */, \
int /* dx */, \
int /* dy */, \
char * /* data */
#define XSHM_CREATE_PIXMAP_ARGS \
ScreenPtr /* pScreen */, \
int /* width */, \
int /* height */, \
int /* depth */, \
char * /* addr */
typedef struct _ShmFuncs {
PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS);
void (* PutImage)(XSHM_PUT_IMAGE_ARGS);
} ShmFuncs, *ShmFuncsPtr;
#endif
#endif /* _SHMSTR_H_ */
/*
* Copyright � 2007-2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors: Peter Hutterer, University of South Australia, NICTA
*
*/
/* XGE Client interfaces */
#ifndef _XGE_H_
#define _XGE_H_
#include <X11/Xlib.h>
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
/**
* Generic Event mask.
* To be used whenever a list of masks per extension has to be provided.
*
* But, don't actually use the CARD{8,16,32} types. We can't get them them
* defined here without polluting the namespace.
*/
typedef struct {
unsigned char extension;
unsigned char pad0;
unsigned short pad1;
unsigned int evmask;
} XGenericEventMask;
Bool XGEQueryExtension(Display* dpy, int *event_basep, int *err_basep);
Bool XGEQueryVersion(Display* dpy, int *major, int* minor);
_XFUNCPROTOEND
#endif /* _XGE_H_ */
/*
* Copyright © 2009 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
/* Conventions for this file:
* Names:
* structs: always typedef'd, prefixed with xXI, CamelCase
* struct members: lower_case_with_underscores
* Exceptions: reqType, ReqType, repType, RepType, sequenceNumber are
* named as such for historical reasons.
* request opcodes: X_XIRequestName as CamelCase
* defines: defines used in client applications must go in XI2.h
* defines used only in protocol handling: XISOMENAME
*
* Data types: unless there is a historical name for a datatype (e.g.
* Window), use stdint types specifying the size of the datatype.
* historical data type names must be defined and undefined at the top and
* end of the file.
*
* General:
* spaces, not tabs.
* structs specific to a request or reply added before the request
* definition. structs used in more than one request, reply or event
* appended to the common structs section before the definition of the
* first request.
* members of structs vertically aligned on column 16 if datatypes permit.
* otherwise aligned on next available 8n column.
*/
/**
* Protocol definitions for the XI2 protocol.
* This file should not be included by clients that merely use XI2, but do not
* need the wire protocol. Such clients should include XI2.h, or the matching
* header from the library.
*
*/
#ifndef _XI2PROTO_H_
#define _XI2PROTO_H_
#include <X11/Xproto.h>
#include <X11/X.h>
#include <X11/extensions/XI2.h>
#include <stdint.h>
/* make sure types have right sizes for protocol structures. */
#define Window uint32_t
#define Time uint32_t
#define Atom uint32_t
#define Cursor uint32_t
#define Barrier uint32_t
/**
* XI2 Request opcodes
*/
#define X_XIQueryPointer 40
#define X_XIWarpPointer 41
#define X_XIChangeCursor 42
#define X_XIChangeHierarchy 43
#define X_XISetClientPointer 44
#define X_XIGetClientPointer 45
#define X_XISelectEvents 46
#define X_XIQueryVersion 47
#define X_XIQueryDevice 48
#define X_XISetFocus 49
#define X_XIGetFocus 50
#define X_XIGrabDevice 51
#define X_XIUngrabDevice 52
#define X_XIAllowEvents 53
#define X_XIPassiveGrabDevice 54
#define X_XIPassiveUngrabDevice 55
#define X_XIListProperties 56
#define X_XIChangeProperty 57
#define X_XIDeleteProperty 58
#define X_XIGetProperty 59
#define X_XIGetSelectedEvents 60
#define X_XIBarrierReleasePointer 61
/** Number of XI requests */
#define XI2REQUESTS (X_XIBarrierReleasePointer - X_XIQueryPointer + 1)
/** Number of XI2 events */
#define XI2EVENTS (XI_LASTEVENT + 1)
/*************************************************************************************
* *
* COMMON STRUCTS *
* *
*************************************************************************************/
/** Fixed point 16.16 */
typedef int32_t FP1616;
/** Fixed point 32.32 */
typedef struct {
int32_t integral;
uint32_t frac;
} FP3232;
/**
* Struct to describe a device.
*
* For a MasterPointer or a MasterKeyboard, 'attachment' specifies the
* paired master device.
* For a SlaveKeyboard or SlavePointer, 'attachment' specifies the master
* device this device is attached to.
* For a FloatingSlave, 'attachment' is undefined.
*/
typedef struct {
uint16_t deviceid;
uint16_t use; /**< ::XIMasterPointer, ::XIMasterKeyboard,
::XISlavePointer, ::XISlaveKeyboard,
::XIFloatingSlave */
uint16_t attachment; /**< Current attachment or pairing.*/
uint16_t num_classes; /**< Number of classes following this struct. */
uint16_t name_len; /**< Length of name in bytes. */
uint8_t enabled; /**< TRUE if device is enabled. */
uint8_t pad;
} xXIDeviceInfo;
/**
* Default template for a device class.
* A device class is equivalent to a device's capabilities. Multiple classes
* are supported per device.
*/
typedef struct {
uint16_t type; /**< One of *class */
uint16_t length; /**< Length in 4 byte units */
uint16_t sourceid; /**< source device for this class */
uint16_t pad;
} xXIAnyInfo;
/**
* Denotes button capability on a device.
* Struct is followed by a button bit-mask (padded to four byte chunks) and
* then num_buttons * Atom that names the buttons in the device-native setup
* (i.e. ignoring button mappings).
*/
typedef struct {
uint16_t type; /**< Always ButtonClass */
uint16_t length; /**< Length in 4 byte units */
uint16_t sourceid; /**< source device for this class */
uint16_t num_buttons; /**< Number of buttons provided */
} xXIButtonInfo;
/**
* Denotes key capability on a device.
* Struct is followed by num_keys * CARD32 that lists the keycodes available
* on the device.
*/
typedef struct {
uint16_t type; /**< Always KeyClass */
uint16_t length; /**< Length in 4 byte units */
uint16_t sourceid; /**< source device for this class */
uint16_t num_keycodes; /**< Number of keys provided */
} xXIKeyInfo;
/**
* Denotes an valuator capability on a device.
* One XIValuatorInfo describes exactly one valuator (axis) on the device.
*/
typedef struct {
uint16_t type; /**< Always ValuatorClass */
uint16_t length; /**< Length in 4 byte units */
uint16_t sourceid; /**< source device for this class */
uint16_t number; /**< Valuator number */
Atom label; /**< Axis label */
FP3232 min; /**< Min value */
FP3232 max; /**< Max value */
FP3232 value; /**< Last published value */
uint32_t resolution; /**< Resolutions in units/m */
uint8_t mode; /**< ModeRelative or ModeAbsolute */
uint8_t pad1;
uint16_t pad2;
} xXIValuatorInfo;
/***
* Denotes a scroll valuator on a device.
* One XIScrollInfo describes exactly one scroll valuator that must have a
* XIValuatorInfo struct.
*/
typedef struct {
uint16_t type; /**< Always ValuatorClass */
uint16_t length; /**< Length in 4 byte units */
uint16_t sourceid; /**< source device for this class */
uint16_t number; /**< Valuator number */
uint16_t scroll_type; /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */
uint16_t pad0;
uint32_t flags; /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred */
FP3232 increment; /**< Increment for one unit of scrolling */
} xXIScrollInfo;
/**
* Denotes multitouch capability on a device.
*/
typedef struct {
uint16_t type; /**< Always TouchClass */
uint16_t length; /**< Length in 4 byte units */
uint16_t sourceid; /**< source device for this class */
uint8_t mode; /**< DirectTouch or DependentTouch */
uint8_t num_touches; /**< Maximum number of touches (0==unlimited) */
} xXITouchInfo;
/**
* Used to select for events on a given window.
* Struct is followed by (mask_len * CARD8), with each bit set representing
* the event mask for the given type. A mask bit represents an event type if
* (mask == (1 << type)).
*/
typedef struct {
uint16_t deviceid; /**< Device id to select for */
uint16_t mask_len; /**< Length of mask in 4 byte units */
} xXIEventMask;
/**
* XKB modifier information.
* The effective modifier is a binary mask of base, latched, and locked
* modifiers.
*/
typedef struct
{
uint32_t base_mods; /**< Logically pressed modifiers */
uint32_t latched_mods; /**< Logically latched modifiers */
uint32_t locked_mods; /**< Logically locked modifiers */
uint32_t effective_mods; /**< Effective modifiers */
} xXIModifierInfo;
/**
* XKB group information.
* The effective group is the mathematical sum of base, latched, and locked
* group after group wrapping is taken into account.
*/
typedef struct
{
uint8_t base_group; /**< Logically "pressed" group */
uint8_t latched_group; /**< Logically latched group */
uint8_t locked_group; /**< Logically locked group */
uint8_t effective_group; /**< Effective group */
} xXIGroupInfo;
/*************************************************************************************
* *
* REQUESTS *
* *
*************************************************************************************/
/**
* Query the server for the supported X Input extension version.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIQueryVersion */
uint16_t length; /**< Length in 4 byte units */
uint16_t major_version;
uint16_t minor_version;
} xXIQueryVersionReq;
#define sz_xXIQueryVersionReq 8
typedef struct {
uint8_t repType; /**< ::X_Reply */
uint8_t RepType; /**< Always ::X_XIQueryVersion */
uint16_t sequenceNumber;
uint32_t length;
uint16_t major_version;
uint16_t minor_version;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIQueryVersionReply;
#define sz_xXIQueryVersionReply 32
/**
* Query the server for information about a specific device or all input
* devices.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIQueryDevice */
uint16_t length; /**< Length in 4 byte units */
uint16_t deviceid;
uint16_t pad;
} xXIQueryDeviceReq;
#define sz_xXIQueryDeviceReq 8
typedef struct {
uint8_t repType; /**< ::X_Reply */
uint8_t RepType; /**< Always ::X_XIQueryDevice */
uint16_t sequenceNumber;
uint32_t length;
uint16_t num_devices;
uint16_t pad0;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIQueryDeviceReply;
#define sz_xXIQueryDeviceReply 32
/**
* Select for events on a given window.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XISelectEvents */
uint16_t length; /**< Length in 4 byte units */
Window win;
uint16_t num_masks;
uint16_t pad;
} xXISelectEventsReq;
#define sz_xXISelectEventsReq 12
/**
* Query for selected events on a given window.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIGetSelectedEvents */
uint16_t length; /**< Length in 4 byte units */
Window win;
} xXIGetSelectedEventsReq;
#define sz_xXIGetSelectedEventsReq 8
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_XIGetSelectedEvents */
uint16_t sequenceNumber;
uint32_t length;
uint16_t num_masks; /**< Number of xXIEventMask structs
trailing the reply */
uint16_t pad0;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIGetSelectedEventsReply;
#define sz_xXIGetSelectedEventsReply 32
/**
* Query the given device's screen/window coordinates.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIQueryPointer */
uint16_t length; /**< Length in 4 byte units */
Window win;
uint16_t deviceid;
uint16_t pad1;
} xXIQueryPointerReq;
#define sz_xXIQueryPointerReq 12
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_XIQueryPointer */
uint16_t sequenceNumber;
uint32_t length;
Window root;
Window child;
FP1616 root_x;
FP1616 root_y;
FP1616 win_x;
FP1616 win_y;
uint8_t same_screen;
uint8_t pad0;
uint16_t buttons_len;
xXIModifierInfo mods;
xXIGroupInfo group;
} xXIQueryPointerReply;
#define sz_xXIQueryPointerReply 56
/**
* Warp the given device's pointer to the specified position.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIWarpPointer */
uint16_t length; /**< Length in 4 byte units */
Window src_win;
Window dst_win;
FP1616 src_x;
FP1616 src_y;
uint16_t src_width;
uint16_t src_height;
FP1616 dst_x;
FP1616 dst_y;
uint16_t deviceid;
uint16_t pad1;
} xXIWarpPointerReq;
#define sz_xXIWarpPointerReq 36
/**
* Change the given device's sprite to the given cursor.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIChangeCursor */
uint16_t length; /**< Length in 4 byte units */
Window win;
Cursor cursor;
uint16_t deviceid;
uint16_t pad1;
} xXIChangeCursorReq;
#define sz_xXIChangeCursorReq 16
/**
* Modify the device hierarchy.
*/
typedef struct {
uint8_t reqType; /**< Input extension major code */
uint8_t ReqType; /**< Always ::X_XIChangeHierarchy */
uint16_t length; /**< Length in 4 byte units */
uint8_t num_changes;
uint8_t pad0;
uint16_t pad1;
} xXIChangeHierarchyReq;
#define sz_xXIChangeHierarchyReq 8
/**
* Generic header for any hierarchy change.
*/
typedef struct {
uint16_t type;
uint16_t length; /**< Length in 4 byte units */
} xXIAnyHierarchyChangeInfo;
/**
* Create a new master device.
* Name of new master follows struct (4-byte padded)
*/
typedef struct {
uint16_t type; /**< Always ::XIAddMaster */
uint16_t length; /**< 2 + (namelen + padding)/4 */
uint16_t name_len;
uint8_t send_core;
uint8_t enable;
} xXIAddMasterInfo;
/**
* Delete a master device. Will automatically delete the master device paired
* with the given master device.
*/
typedef struct {
uint16_t type; /**< Always ::XIRemoveMaster */
uint16_t length; /**< 3 */
uint16_t deviceid;
uint8_t return_mode; /**< ::XIAttachToMaster, ::XIFloating */
uint8_t pad;
uint16_t return_pointer; /**< Pointer to attach slave ptr devices to */
uint16_t return_keyboard; /**< keyboard to attach slave keybd devices to*/
} xXIRemoveMasterInfo;
/**
* Attach an SD to a new device.
* NewMaster has to be of same type (pointer->pointer, keyboard->keyboard);
*/
typedef struct {
uint16_t type; /**< Always ::XIAttachSlave */
uint16_t length; /**< 2 */
uint16_t deviceid;
uint16_t new_master; /**< id of new master device */
} xXIAttachSlaveInfo;
/**
* Detach an SD from its current master device.
*/
typedef struct {
uint16_t type; /**< Always ::XIDetachSlave */
uint16_t length; /**< 2 */
uint16_t deviceid;
uint16_t pad;
} xXIDetachSlaveInfo;
/**
* Set the window/client's ClientPointer.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XISetClientPointer */
uint16_t length; /**< Length in 4 byte units */
Window win;
uint16_t deviceid;
uint16_t pad1;
} xXISetClientPointerReq;
#define sz_xXISetClientPointerReq 12
/**
* Query the given window/client's ClientPointer setting.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_GetClientPointer */
uint16_t length; /**< Length in 4 byte units */
Window win;
} xXIGetClientPointerReq;
#define sz_xXIGetClientPointerReq 8
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_GetClientPointer */
uint16_t sequenceNumber;
uint32_t length;
BOOL set; /**< client pointer is set? */
uint8_t pad0;
uint16_t deviceid;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIGetClientPointerReply;
#define sz_xXIGetClientPointerReply 32
/**
* Set the input focus to the specified window.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XISetFocus */
uint16_t length; /**< Length in 4 byte units */
Window focus;
Time time;
uint16_t deviceid;
uint16_t pad0;
} xXISetFocusReq;
#define sz_xXISetFocusReq 16
/**
* Query the current input focus.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIGetDeviceFocus */
uint16_t length; /**< Length in 4 byte units */
uint16_t deviceid;
uint16_t pad0;
} xXIGetFocusReq;
#define sz_xXIGetFocusReq 8
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_XIGetFocus */
uint16_t sequenceNumber;
uint32_t length;
Window focus;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIGetFocusReply;
#define sz_xXIGetFocusReply 32
/**
* Grab the given device.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIGrabDevice */
uint16_t length; /**< Length in 4 byte units */
Window grab_window;
Time time;
Cursor cursor;
uint16_t deviceid;
uint8_t grab_mode;
uint8_t paired_device_mode;
uint8_t owner_events;
uint8_t pad;
uint16_t mask_len;
} xXIGrabDeviceReq;
#define sz_xXIGrabDeviceReq 24
/**
* Return codes from a XIPassiveGrabDevice request.
*/
typedef struct {
uint32_t modifiers; /**< Modifier state */
uint8_t status; /**< Grab status code */
uint8_t pad0;
uint16_t pad1;
} xXIGrabModifierInfo;
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_XIGrabDevice */
uint16_t sequenceNumber;
uint32_t length;
uint8_t status;
uint8_t pad0;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
uint32_t pad6;
} xXIGrabDeviceReply;
#define sz_xXIGrabDeviceReply 32
/**
* Ungrab the specified device.
*
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIUngrabDevice */
uint16_t length; /**< Length in 4 byte units */
Time time;
uint16_t deviceid;
uint16_t pad;
} xXIUngrabDeviceReq;
#define sz_xXIUngrabDeviceReq 12
/**
* Allow or replay events on the specified grabbed device.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIAllowEvents */
uint16_t length; /**< Length in 4 byte units */
Time time;
uint16_t deviceid;
uint8_t mode;
uint8_t pad;
} xXIAllowEventsReq;
#define sz_xXIAllowEventsReq 12
/**
* Allow or replay events on the specified grabbed device.
* Since XI 2.2
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIAllowEvents */
uint16_t length; /**< Length in 4 byte units */
Time time;
uint16_t deviceid;
uint8_t mode;
uint8_t pad;
uint32_t touchid; /**< Since XI 2.2 */
Window grab_window; /**< Since XI 2.2 */
} xXI2_2AllowEventsReq;
#define sz_xXI2_2AllowEventsReq 20
/**
* Passively grab the device.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIPassiveGrabDevice */
uint16_t length; /**< Length in 4 byte units */
Time time;
Window grab_window;
Cursor cursor;
uint32_t detail;
uint16_t deviceid;
uint16_t num_modifiers;
uint16_t mask_len;
uint8_t grab_type;
uint8_t grab_mode;
uint8_t paired_device_mode;
uint8_t owner_events;
uint16_t pad1;
} xXIPassiveGrabDeviceReq;
#define sz_xXIPassiveGrabDeviceReq 32
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_XIPassiveGrabDevice */
uint16_t sequenceNumber;
uint32_t length;
uint16_t num_modifiers;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
uint32_t pad6;
} xXIPassiveGrabDeviceReply;
#define sz_xXIPassiveGrabDeviceReply 32
/**
* Delete a passive grab for the given device.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIPassiveUngrabDevice */
uint16_t length; /**< Length in 4 byte units */
Window grab_window;
uint32_t detail;
uint16_t deviceid;
uint16_t num_modifiers;
uint8_t grab_type;
uint8_t pad0;
uint16_t pad1;
} xXIPassiveUngrabDeviceReq;
#define sz_xXIPassiveUngrabDeviceReq 20
/**
* List all device properties on the specified device.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIListProperties */
uint16_t length; /**< Length in 4 byte units */
uint16_t deviceid;
uint16_t pad;
} xXIListPropertiesReq;
#define sz_xXIListPropertiesReq 8
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always ::X_XIListProperties */
uint16_t sequenceNumber;
uint32_t length;
uint16_t num_properties;
uint16_t pad0;
uint32_t pad1;
uint32_t pad2;
uint32_t pad3;
uint32_t pad4;
uint32_t pad5;
} xXIListPropertiesReply;
#define sz_xXIListPropertiesReply 32
/**
* Change a property on the specified device.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always ::X_XIChangeProperty */
uint16_t length; /**< Length in 4 byte units */
uint16_t deviceid;
uint8_t mode;
uint8_t format;
Atom property;
Atom type;
uint32_t num_items;
} xXIChangePropertyReq;
#define sz_xXIChangePropertyReq 20
/**
* Delete the specified property.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always X_XIDeleteProperty */
uint16_t length; /**< Length in 4 byte units */
uint16_t deviceid;
uint16_t pad0;
Atom property;
} xXIDeletePropertyReq;
#define sz_xXIDeletePropertyReq 12
/**
* Query the specified property's values.
*/
typedef struct {
uint8_t reqType;
uint8_t ReqType; /**< Always X_XIGetProperty */
uint16_t length; /**< Length in 4 byte units */
uint16_t deviceid;
#if defined(__cplusplus) || defined(c_plusplus)
uint8_t c_delete;
#else
uint8_t delete;
#endif
uint8_t pad0;
Atom property;
Atom type;
uint32_t offset;
uint32_t len;
} xXIGetPropertyReq;
#define sz_xXIGetPropertyReq 24
typedef struct {
uint8_t repType; /**< Input extension major opcode */
uint8_t RepType; /**< Always X_XIGetProperty */
uint16_t sequenceNumber;
uint32_t length;
Atom type;
uint32_t bytes_after;
uint32_t num_items;
uint8_t format;
uint8_t pad0;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
} xXIGetPropertyReply;
#define sz_xXIGetPropertyReply 32
typedef struct {
uint16_t deviceid;
uint16_t pad;
Barrier barrier;
uint32_t eventid;
} xXIBarrierReleasePointerInfo;
typedef struct {
uint8_t reqType; /**< Input extension major opcode */
uint8_t ReqType; /**< Always X_XIBarrierReleasePointer */
uint16_t length;
uint32_t num_barriers;
/* array of xXIBarrierReleasePointerInfo */
} xXIBarrierReleasePointerReq;
#define sz_xXIBarrierReleasePointerReq 8
/*************************************************************************************
* *
* EVENTS *
* *
*************************************************************************************/
/**
* Generic XI2 event header. All XI2 events use the same header.
*/
typedef struct
{
uint8_t type;
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length;
uint16_t evtype;
uint16_t deviceid;
Time time;
} xXIGenericDeviceEvent;
/**
* Device hierarchy information.
*/
typedef struct
{
uint16_t deviceid;
uint16_t attachment; /**< ID of master or paired device */
uint8_t use; /**< ::XIMasterKeyboard,
::XIMasterPointer,
::XISlaveKeyboard,
::XISlavePointer,
::XIFloatingSlave */
BOOL enabled; /**< TRUE if the device is enabled */
uint16_t pad;
uint32_t flags; /**< ::XIMasterAdded, ::XIMasterRemoved,
::XISlaveAttached, ::XISlaveDetached,
::XISlaveAdded, ::XISlaveRemoved,
::XIDeviceEnabled, ::XIDeviceDisabled */
} xXIHierarchyInfo;
/**
* The device hierarchy has been modified. This event includes the device
* hierarchy after the modification has been applied.
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte units */
uint16_t evtype; /**< ::XI_Hierarchy */
uint16_t deviceid;
Time time;
uint32_t flags; /**< ::XIMasterAdded, ::XIMasterDeleted,
::XISlaveAttached, ::XISlaveDetached,
::XISlaveAdded, ::XISlaveRemoved,
::XIDeviceEnabled, ::XIDeviceDisabled */
uint16_t num_info;
uint16_t pad0;
uint32_t pad1;
uint32_t pad2;
} xXIHierarchyEvent;
/**
* A device has changed capabilities.
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte units */
uint16_t evtype; /**< XI_DeviceChanged */
uint16_t deviceid; /**< Device that has changed */
Time time;
uint16_t num_classes; /**< Number of classes that have changed */
uint16_t sourceid; /**< Source of the new classes */
uint8_t reason; /**< ::XISlaveSwitch, ::XIDeviceChange */
uint8_t pad0;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
} xXIDeviceChangedEvent;
/**
* The owner of a touch stream has passed on ownership to another client.
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte units */
uint16_t evtype; /**< XI_TouchOwnership */
uint16_t deviceid; /**< Device that has changed */
Time time;
uint32_t touchid;
Window root;
Window event;
Window child;
/* └──────── 32 byte boundary ────────┘ */
uint16_t sourceid;
uint16_t pad0;
uint32_t flags;
uint32_t pad1;
uint32_t pad2;
} xXITouchOwnershipEvent;
/**
* Default input event for pointer, keyboard or touch input.
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte uints */
uint16_t evtype;
uint16_t deviceid;
Time time;
uint32_t detail; /**< Keycode or button */
Window root;
Window event;
Window child;
/* └──────── 32 byte boundary ────────┘ */
FP1616 root_x; /**< Always screen coords, 16.16 fixed point */
FP1616 root_y;
FP1616 event_x; /**< Always screen coords, 16.16 fixed point */
FP1616 event_y;
uint16_t buttons_len; /**< Len of button flags in 4 b units */
uint16_t valuators_len; /**< Len of val. flags in 4 b units */
uint16_t sourceid; /**< The source device */
uint16_t pad0;
uint32_t flags; /**< ::XIKeyRepeat */
xXIModifierInfo mods;
xXIGroupInfo group;
} xXIDeviceEvent;
/**
* Sent when an input event is generated. RawEvents include valuator
* information in both device-specific data (i.e. unaccelerated) and
* processed data (i.e. accelerated, if applicable).
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte uints */
uint16_t evtype; /**< ::XI_RawEvent */
uint16_t deviceid;
Time time;
uint32_t detail;
uint16_t sourceid; /**< The source device (XI 2.1) */
uint16_t valuators_len; /**< Length of trailing valuator
mask in 4 byte units */
uint32_t flags; /**< ::XIKeyRepeat */
uint32_t pad2;
} xXIRawEvent;
/**
* Note that the layout of root, event, child, root_x, root_y, event_x,
* event_y must be identical to the xXIDeviceEvent.
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte uints */
uint16_t evtype; /**< ::XI_Enter */
uint16_t deviceid;
Time time;
uint16_t sourceid;
uint8_t mode;
uint8_t detail;
Window root;
Window event;
Window child;
/* └──────── 32 byte boundary ────────┘ */
FP1616 root_x;
FP1616 root_y;
FP1616 event_x;
FP1616 event_y;
BOOL same_screen;
BOOL focus;
uint16_t buttons_len; /**< Length of trailing button mask
in 4 byte units */
xXIModifierInfo mods;
xXIGroupInfo group;
} xXIEnterEvent;
typedef xXIEnterEvent xXILeaveEvent;
typedef xXIEnterEvent xXIFocusInEvent;
typedef xXIEnterEvent xXIFocusOutEvent;
/**
* Sent when a device property is created, modified or deleted. Does not
* include property data, the client is required to query the data.
*/
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte units */
uint16_t evtype; /**< ::XI_PropertyEvent */
uint16_t deviceid;
Time time;
Atom property;
uint8_t what; /**< ::XIPropertyDeleted,
::XIPropertyCreated,
::XIPropertyMotified */
uint8_t pad0;
uint16_t pad1;
uint32_t pad2;
uint32_t pad3;
} xXIPropertyEvent;
typedef struct
{
uint8_t type; /**< Always GenericEvent */
uint8_t extension; /**< XI extension offset */
uint16_t sequenceNumber;
uint32_t length; /**< Length in 4 byte units */
uint16_t evtype; /**< ::XI_BarrierHit or ::XI_BarrierLeave */
uint16_t deviceid;
Time time;
uint32_t eventid;
Window root;
Window event;
Barrier barrier;
/* └──────── 32 byte boundary ────────┘ */
uint32_t dtime;
uint32_t flags; /**< ::XIBarrierPointerReleased
::XIBarrierDeviceIsGrabbed */
uint16_t sourceid;
int16_t pad;
FP1616 root_x;
FP1616 root_y;
FP3232 dx;
FP3232 dy;
} xXIBarrierEvent;
typedef xXIBarrierEvent xXIBarrierHitEvent;
typedef xXIBarrierEvent xXIBarrierPointerReleasedEvent;
typedef xXIBarrierEvent xXIBarrierLeaveEvent;
#undef Window
#undef Time
#undef Atom
#undef Cursor
#undef Barrier
#endif /* _XI2PROTO_H_ */
/*
Copyright 1991, 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/***********************************************************
Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
and Olivetti Research Limited, Cambridge, England.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or Olivetti
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _SYNCPROTO_H_
#define _SYNCPROTO_H_
#include <X11/extensions/syncconst.h>
#define X_SyncInitialize 0
#define X_SyncListSystemCounters 1
#define X_SyncCreateCounter 2
#define X_SyncSetCounter 3
#define X_SyncChangeCounter 4
#define X_SyncQueryCounter 5
#define X_SyncDestroyCounter 6
#define X_SyncAwait 7
#define X_SyncCreateAlarm 8
#define X_SyncChangeAlarm 9
#define X_SyncQueryAlarm 10
#define X_SyncDestroyAlarm 11
#define X_SyncSetPriority 12
#define X_SyncGetPriority 13
#define X_SyncCreateFence 14
#define X_SyncTriggerFence 15
#define X_SyncResetFence 16
#define X_SyncDestroyFence 17
#define X_SyncQueryFence 18
#define X_SyncAwaitFence 19
/* cover up types from sync.h to make sure they're the right size for
* protocol packaging. These will be undef'ed after all the protocol
* structures are defined.
*/
#define XSyncCounter CARD32
#define XSyncAlarm CARD32
#define XSyncFence CARD32
#define Drawable CARD32
/*
* Initialize
*/
typedef struct _xSyncInitialize {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
CARD8 majorVersion;
CARD8 minorVersion;
CARD16 pad;
} xSyncInitializeReq;
#define sz_xSyncInitializeReq 8
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD8 majorVersion;
CARD8 minorVersion;
CARD16 pad;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xSyncInitializeReply;
#define sz_xSyncInitializeReply 32
/*
* ListSystemCounters
*/
typedef struct _xSyncListSystemCounters
{
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
} xSyncListSystemCountersReq;
#define sz_xSyncListSystemCountersReq 4
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
INT32 nCounters;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xSyncListSystemCountersReply;
#define sz_xSyncListSystemCountersReply 32
typedef struct {
XSyncCounter counter;
INT32 resolution_hi;
CARD32 resolution_lo;
CARD16 name_length;
} xSyncSystemCounter;
#define sz_xSyncSystemCounter 14
/*
* Create Counter
*/
typedef struct _xSyncCreateCounterReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncCounter cid;
INT32 initial_value_hi;
CARD32 initial_value_lo;
} xSyncCreateCounterReq;
#define sz_xSyncCreateCounterReq 16
/*
* Change Counter
*/
typedef struct _xSyncChangeCounterReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncCounter cid;
INT32 value_hi;
CARD32 value_lo;
} xSyncChangeCounterReq;
#define sz_xSyncChangeCounterReq 16
/*
* Set Counter
*/
typedef struct _xSyncSetCounterReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncCounter cid;
INT32 value_hi;
CARD32 value_lo;
} xSyncSetCounterReq;
#define sz_xSyncSetCounterReq 16
/*
* Destroy Counter
*/
typedef struct _xSyncDestroyCounterReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncCounter counter;
} xSyncDestroyCounterReq;
#define sz_xSyncDestroyCounterReq 8
/*
* Query Counter
*/
typedef struct _xSyncQueryCounterReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncCounter counter;
} xSyncQueryCounterReq;
#define sz_xSyncQueryCounterReq 8
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
INT32 value_hi;
CARD32 value_lo;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xSyncQueryCounterReply;
#define sz_xSyncQueryCounterReply 32
/*
* Await
*/
typedef struct _xSyncAwaitReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
} xSyncAwaitReq;
#define sz_xSyncAwaitReq 4
typedef struct _xSyncWaitCondition {
XSyncCounter counter;
CARD32 value_type;
INT32 wait_value_hi;
CARD32 wait_value_lo;
CARD32 test_type;
INT32 event_threshold_hi;
CARD32 event_threshold_lo;
} xSyncWaitCondition;
#define sz_xSyncWaitCondition 28
/*
* Create Alarm
*/
typedef struct _xSyncCreateAlarmReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncAlarm id;
CARD32 valueMask;
} xSyncCreateAlarmReq;
#define sz_xSyncCreateAlarmReq 12
/*
* Destroy Alarm
*/
typedef struct _xSyncDestroyAlarmReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncAlarm alarm;
} xSyncDestroyAlarmReq;
#define sz_xSyncDestroyAlarmReq 8
/*
* Query Alarm
*/
typedef struct _xSyncQueryAlarmReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncAlarm alarm;
} xSyncQueryAlarmReq;
#define sz_xSyncQueryAlarmReq 8
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
XSyncCounter counter;
CARD32 value_type;
INT32 wait_value_hi;
CARD32 wait_value_lo;
CARD32 test_type;
INT32 delta_hi;
CARD32 delta_lo;
BOOL events;
BYTE state;
BYTE pad0;
BYTE pad1;
} xSyncQueryAlarmReply;
#define sz_xSyncQueryAlarmReply 40
/*
* Change Alarm
*/
typedef struct _xSyncChangeAlarmReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncAlarm alarm;
CARD32 valueMask;
} xSyncChangeAlarmReq;
#define sz_xSyncChangeAlarmReq 12
/*
* SetPriority
*/
typedef struct _xSyncSetPriority{
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
CARD32 id;
INT32 priority;
} xSyncSetPriorityReq;
#define sz_xSyncSetPriorityReq 12
/*
* Get Priority
*/
typedef struct _xSyncGetPriority{
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
CARD32 id; /*XXX XID? */
} xSyncGetPriorityReq;
#define sz_xSyncGetPriorityReq 8
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
INT32 priority;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xSyncGetPriorityReply;
#define sz_xSyncGetPriorityReply 32
/*
* Create Fence
*/
typedef struct _xSyncCreateFenceReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
Drawable d;
XSyncFence fid;
BOOL initially_triggered;
CARD8 pad0;
CARD16 pad1;
} xSyncCreateFenceReq;
#define sz_xSyncCreateFenceReq 16
/*
* Put a fence object in the "triggered" state.
*/
typedef struct _xSyncTriggerFenceReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncFence fid;
} xSyncTriggerFenceReq;
#define sz_xSyncTriggerFenceReq 8
/*
* Put a fence in the "untriggered" state.
*/
typedef struct _xSyncResetFenceReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncFence fid;
} xSyncResetFenceReq;
#define sz_xSyncResetFenceReq 8
/*
* Destroy a fence object
*/
typedef struct _xSyncDestroyFenceReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncFence fid;
} xSyncDestroyFenceReq;
#define sz_xSyncDestroyFenceReq 8
/*
* Query a fence object
*/
typedef struct _xSyncQueryFenceReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
XSyncFence fid;
} xSyncQueryFenceReq;
#define sz_xSyncQueryFenceReq 8
/*
* Wait for any of a list of fence sync objects
* to reach the "triggered" state.
*/
typedef struct _xSyncAwaitFenceReq {
CARD8 reqType;
CARD8 syncReqType;
CARD16 length;
} xSyncAwaitFenceReq;
#define sz_xSyncAwaitFenceReq 4
typedef struct {
BYTE type;
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
BOOL triggered;
BYTE pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xSyncQueryFenceReply;
#define sz_xSyncQueryFenceReply 32
/*
* Events
*/
typedef struct _xSyncCounterNotifyEvent {
BYTE type;
BYTE kind;
CARD16 sequenceNumber;
XSyncCounter counter;
INT32 wait_value_hi;
CARD32 wait_value_lo;
INT32 counter_value_hi;
CARD32 counter_value_lo;
CARD32 time;
CARD16 count;
BOOL destroyed;
BYTE pad0;
} xSyncCounterNotifyEvent;
typedef struct _xSyncAlarmNotifyEvent {
BYTE type;
BYTE kind;
CARD16 sequenceNumber;
XSyncAlarm alarm;
INT32 counter_value_hi;
CARD32 counter_value_lo;
INT32 alarm_value_hi;
CARD32 alarm_value_lo;
CARD32 time;
CARD8 state;
BYTE pad0;
BYTE pad1;
BYTE pad2;
} xSyncAlarmNotifyEvent;
#undef XSyncCounter
#undef XSyncAlarm
#undef XSyncFence
#undef Drawable
#endif /* _SYNCPROTO_H_ */
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright 2010 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _XFIXESWIRE_H_
#define _XFIXESWIRE_H_
#define XFIXES_NAME "XFIXES"
#define XFIXES_MAJOR 5
#define XFIXES_MINOR 0
/*************** Version 1 ******************/
#define X_XFixesQueryVersion 0
#define X_XFixesChangeSaveSet 1
#define X_XFixesSelectSelectionInput 2
#define X_XFixesSelectCursorInput 3
#define X_XFixesGetCursorImage 4
/*************** Version 2 ******************/
#define X_XFixesCreateRegion 5
#define X_XFixesCreateRegionFromBitmap 6
#define X_XFixesCreateRegionFromWindow 7
#define X_XFixesCreateRegionFromGC 8
#define X_XFixesCreateRegionFromPicture 9
#define X_XFixesDestroyRegion 10
#define X_XFixesSetRegion 11
#define X_XFixesCopyRegion 12
#define X_XFixesUnionRegion 13
#define X_XFixesIntersectRegion 14
#define X_XFixesSubtractRegion 15
#define X_XFixesInvertRegion 16
#define X_XFixesTranslateRegion 17
#define X_XFixesRegionExtents 18
#define X_XFixesFetchRegion 19
#define X_XFixesSetGCClipRegion 20
#define X_XFixesSetWindowShapeRegion 21
#define X_XFixesSetPictureClipRegion 22
#define X_XFixesSetCursorName 23
#define X_XFixesGetCursorName 24
#define X_XFixesGetCursorImageAndName 25
#define X_XFixesChangeCursor 26
#define X_XFixesChangeCursorByName 27
/*************** Version 3 ******************/
#define X_XFixesExpandRegion 28
/*************** Version 4 ******************/
#define X_XFixesHideCursor 29
#define X_XFixesShowCursor 30
/*************** Version 5 ******************/
#define X_XFixesCreatePointerBarrier 31
#define X_XFixesDestroyPointerBarrier 32
#define XFixesNumberRequests (X_XFixesDestroyPointerBarrier+1)
/* Selection events share one event number */
#define XFixesSelectionNotify 0
/* Within the selection, the 'subtype' field distinguishes */
#define XFixesSetSelectionOwnerNotify 0
#define XFixesSelectionWindowDestroyNotify 1
#define XFixesSelectionClientCloseNotify 2
#define XFixesSetSelectionOwnerNotifyMask (1L << 0)
#define XFixesSelectionWindowDestroyNotifyMask (1L << 1)
#define XFixesSelectionClientCloseNotifyMask (1L << 2)
/* There's only one cursor event so far */
#define XFixesCursorNotify 1
#define XFixesDisplayCursorNotify 0
#define XFixesDisplayCursorNotifyMask (1L << 0)
#define XFixesNumberEvents (2)
/* errors */
#define BadRegion 0
#define BadBarrier 1
#define XFixesNumberErrors (BadBarrier+1)
#define SaveSetNearest 0
#define SaveSetRoot 1
#define SaveSetMap 0
#define SaveSetUnmap 1
/*************** Version 2 ******************/
#define WindowRegionBounding 0
#define WindowRegionClip 1
/*************** Version 5 ******************/
#define BarrierPositiveX (1L << 0)
#define BarrierPositiveY (1L << 1)
#define BarrierNegativeX (1L << 2)
#define BarrierNegativeY (1L << 3)
#endif /* _XFIXESWIRE_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _SECURITY_H
#define _SECURITY_H
#define _XAUTH_STRUCT_ONLY
#include <X11/Xauth.h>
#include <X11/extensions/secur.h>
_XFUNCPROTOBEGIN
Status XSecurityQueryExtension (
Display *dpy,
int *major_version_return,
int *minor_version_return);
Xauth *XSecurityAllocXauth(void);
void XSecurityFreeXauth(Xauth *auth);
/* type for returned auth ids */
typedef unsigned long XSecurityAuthorization;
typedef struct {
unsigned int timeout;
unsigned int trust_level;
XID group;
long event_mask;
} XSecurityAuthorizationAttributes;
Xauth *XSecurityGenerateAuthorization(
Display *dpy,
Xauth *auth_in,
unsigned long valuemask,
XSecurityAuthorizationAttributes *attributes,
XSecurityAuthorization *auth_id_return);
Status XSecurityRevokeAuthorization(
Display *dpy,
XSecurityAuthorization auth_id);
_XFUNCPROTOEND
typedef struct {
int type; /* event base + XSecurityAuthorizationRevoked */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
XSecurityAuthorization auth_id; /* revoked authorization id */
} XSecurityAuthorizationRevokedEvent;
#endif /* _SECURITY_H */
/*
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett-Packard Company
* Copyright © 2006 Intel Corporation
* Copyright © 2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, 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.
*
* Author: Jim Gettys, Hewlett-Packard Company, Inc.
* Keith Packard, Intel Corporation
*/
/* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */
/* V1.0 removes depth switching from the protocol */
#ifndef _XRANDRP_H_
#define _XRANDRP_H_
#include <X11/extensions/randr.h>
#include <X11/extensions/renderproto.h>
#define Window CARD32
#define Drawable CARD32
#define Font CARD32
#define Pixmap CARD32
#define Cursor CARD32
#define Colormap CARD32
#define GContext CARD32
#define Atom CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define RROutput CARD32
#define RRMode CARD32
#define RRCrtc CARD32
#define RRProvider CARD32
#define RRModeFlags CARD32
#define RRLease CARD32
#define Rotation CARD16
#define SizeID CARD16
#define SubpixelOrder CARD16
/*
* data structures
*/
typedef struct {
CARD16 widthInPixels;
CARD16 heightInPixels;
CARD16 widthInMillimeters;
CARD16 heightInMillimeters;
} xScreenSizes;
#define sz_xScreenSizes 8
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xRRQueryVersionReq;
#define sz_xRRQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRQueryVersionReply;
#define sz_xRRQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
} xRRGetScreenInfoReq;
#define sz_xRRGetScreenInfoReq 8
/*
* the xRRScreenInfoReply structure is followed by:
*
* the size information
*/
typedef struct {
BYTE type; /* X_Reply */
BYTE setOfRotations;
CARD16 sequenceNumber;
CARD32 length;
Window root;
Time timestamp;
Time configTimestamp;
CARD16 nSizes;
SizeID sizeID;
Rotation rotation;
CARD16 rate;
CARD16 nrateEnts;
CARD16 pad;
} xRRGetScreenInfoReply;
#define sz_xRRGetScreenInfoReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Drawable drawable;
Time timestamp;
Time configTimestamp;
SizeID sizeID;
Rotation rotation;
} xRR1_0SetScreenConfigReq;
#define sz_xRR1_0SetScreenConfigReq 20
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Drawable drawable;
Time timestamp;
Time configTimestamp;
SizeID sizeID;
Rotation rotation;
CARD16 rate;
CARD16 pad;
} xRRSetScreenConfigReq;
#define sz_xRRSetScreenConfigReq 24
typedef struct {
BYTE type; /* X_Reply */
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time newTimestamp;
Time newConfigTimestamp;
Window root;
CARD16 subpixelOrder;
CARD16 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRSetScreenConfigReply;
#define sz_xRRSetScreenConfigReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
CARD16 enable;
CARD16 pad2;
} xRRSelectInputReq;
#define sz_xRRSelectInputReq 12
/*
* Additions for version 1.2
*/
typedef struct _xRRModeInfo {
RRMode id;
CARD16 width;
CARD16 height;
CARD32 dotClock;
CARD16 hSyncStart;
CARD16 hSyncEnd;
CARD16 hTotal;
CARD16 hSkew;
CARD16 vSyncStart;
CARD16 vSyncEnd;
CARD16 vTotal;
CARD16 nameLength;
RRModeFlags modeFlags;
} xRRModeInfo;
#define sz_xRRModeInfo 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
} xRRGetScreenSizeRangeReq;
#define sz_xRRGetScreenSizeRangeReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad;
CARD16 sequenceNumber;
CARD32 length;
CARD16 minWidth;
CARD16 minHeight;
CARD16 maxWidth;
CARD16 maxHeight;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xRRGetScreenSizeRangeReply;
#define sz_xRRGetScreenSizeRangeReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
CARD16 width;
CARD16 height;
CARD32 widthInMillimeters;
CARD32 heightInMillimeters;
} xRRSetScreenSizeReq;
#define sz_xRRSetScreenSizeReq 20
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
} xRRGetScreenResourcesReq;
#define sz_xRRGetScreenResourcesReq 8
typedef struct {
BYTE type;
CARD8 pad;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
Time configTimestamp;
CARD16 nCrtcs;
CARD16 nOutputs;
CARD16 nModes;
CARD16 nbytesNames;
CARD32 pad1;
CARD32 pad2;
} xRRGetScreenResourcesReply;
#define sz_xRRGetScreenResourcesReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
Time configTimestamp;
} xRRGetOutputInfoReq;
#define sz_xRRGetOutputInfoReq 12
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
RRCrtc crtc;
CARD32 mmWidth;
CARD32 mmHeight;
CARD8 connection;
CARD8 subpixelOrder;
CARD16 nCrtcs;
CARD16 nModes;
CARD16 nPreferred;
CARD16 nClones;
CARD16 nameLength;
} xRRGetOutputInfoReply;
#define sz_xRRGetOutputInfoReply 36
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
} xRRListOutputPropertiesReq;
#define sz_xRRListOutputPropertiesReq 8
typedef struct {
BYTE type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nAtoms;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRListOutputPropertiesReply;
#define sz_xRRListOutputPropertiesReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
Atom property;
} xRRQueryOutputPropertyReq;
#define sz_xRRQueryOutputPropertyReq 12
typedef struct {
BYTE type;
BYTE pad0;
CARD16 sequenceNumber;
CARD32 length;
BOOL pending;
BOOL range;
BOOL immutable;
BYTE pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRQueryOutputPropertyReply;
#define sz_xRRQueryOutputPropertyReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
Atom property;
BOOL pending;
BOOL range;
CARD16 pad;
} xRRConfigureOutputPropertyReq;
#define sz_xRRConfigureOutputPropertyReq 16
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
Atom property;
Atom type;
CARD8 format;
CARD8 mode;
CARD16 pad;
CARD32 nUnits;
} xRRChangeOutputPropertyReq;
#define sz_xRRChangeOutputPropertyReq 24
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
Atom property;
} xRRDeleteOutputPropertyReq;
#define sz_xRRDeleteOutputPropertyReq 12
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
Atom property;
Atom type;
CARD32 longOffset;
CARD32 longLength;
#ifdef __cplusplus
BOOL _delete;
#else
BOOL delete;
#endif
BOOL pending;
CARD16 pad1;
} xRRGetOutputPropertyReq;
#define sz_xRRGetOutputPropertyReq 28
typedef struct {
BYTE type;
CARD8 format;
CARD16 sequenceNumber;
CARD32 length;
Atom propertyType;
CARD32 bytesAfter;
CARD32 nItems;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xRRGetOutputPropertyReply;
#define sz_xRRGetOutputPropertyReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
xRRModeInfo modeInfo;
} xRRCreateModeReq;
#define sz_xRRCreateModeReq 40
typedef struct {
BYTE type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
RRMode mode;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRCreateModeReply;
#define sz_xRRCreateModeReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRMode mode;
} xRRDestroyModeReq;
#define sz_xRRDestroyModeReq 8
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
RRMode mode;
} xRRAddOutputModeReq;
#define sz_xRRAddOutputModeReq 12
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RROutput output;
RRMode mode;
} xRRDeleteOutputModeReq;
#define sz_xRRDeleteOutputModeReq 12
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
Time configTimestamp;
} xRRGetCrtcInfoReq;
#define sz_xRRGetCrtcInfoReq 12
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
RRMode mode;
Rotation rotation;
Rotation rotations;
CARD16 nOutput;
CARD16 nPossibleOutput;
} xRRGetCrtcInfoReply;
#define sz_xRRGetCrtcInfoReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
Time timestamp;
Time configTimestamp;
INT16 x;
INT16 y;
RRMode mode;
Rotation rotation;
CARD16 pad;
} xRRSetCrtcConfigReq;
#define sz_xRRSetCrtcConfigReq 28
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time newTimestamp;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRSetCrtcConfigReply;
#define sz_xRRSetCrtcConfigReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
} xRRGetCrtcGammaSizeReq;
#define sz_xRRGetCrtcGammaSizeReq 8
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
CARD16 size;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRGetCrtcGammaSizeReply;
#define sz_xRRGetCrtcGammaSizeReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
} xRRGetCrtcGammaReq;
#define sz_xRRGetCrtcGammaReq 8
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
CARD16 size;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRGetCrtcGammaReply;
#define sz_xRRGetCrtcGammaReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
CARD16 size;
CARD16 pad1;
} xRRSetCrtcGammaReq;
#define sz_xRRSetCrtcGammaReq 12
/*
* Additions for V1.3
*/
typedef xRRGetScreenResourcesReq xRRGetScreenResourcesCurrentReq;
#define sz_xRRGetScreenResourcesCurrentReq sz_xRRGetScreenResourcesReq
typedef xRRGetScreenResourcesReply xRRGetScreenResourcesCurrentReply;
#define sz_xRRGetScreenResourcesCurrentReply sz_xRRGetScreenResourcesReply
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
xRenderTransform transform;
CARD16 nbytesFilter; /* number of bytes in filter name */
CARD16 pad;
} xRRSetCrtcTransformReq;
#define sz_xRRSetCrtcTransformReq 48
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
} xRRGetCrtcTransformReq;
#define sz_xRRGetCrtcTransformReq 8
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
xRenderTransform pendingTransform;
BYTE hasTransforms;
CARD8 pad0;
CARD16 pad1;
xRenderTransform currentTransform;
CARD32 pad2;
CARD16 pendingNbytesFilter; /* number of bytes in filter name */
CARD16 pendingNparamsFilter; /* number of filter params */
CARD16 currentNbytesFilter; /* number of bytes in filter name */
CARD16 currentNparamsFilter; /* number of filter params */
} xRRGetCrtcTransformReply;
#define sz_xRRGetCrtcTransformReply 96
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
RROutput output;
} xRRSetOutputPrimaryReq;
#define sz_xRRSetOutputPrimaryReq 12
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
} xRRGetOutputPrimaryReq;
#define sz_xRRGetOutputPrimaryReq 8
typedef struct {
BYTE type;
CARD8 pad;
CARD16 sequenceNumber;
CARD32 length;
RROutput output;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRGetOutputPrimaryReply;
#define sz_xRRGetOutputPrimaryReply 32
/*
* Additions for V1.4
*/
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
} xRRGetProvidersReq;
#define sz_xRRGetProvidersReq 8
typedef struct {
BYTE type;
CARD8 pad;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
CARD16 nProviders;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRGetProvidersReply;
#define sz_xRRGetProvidersReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
Time configTimestamp;
} xRRGetProviderInfoReq;
#define sz_xRRGetProviderInfoReq 12
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
CARD32 capabilities;
CARD16 nCrtcs;
CARD16 nOutputs;
CARD16 nAssociatedProviders;
CARD16 nameLength;
CARD32 pad1;
CARD32 pad2;
} xRRGetProviderInfoReply;
#define sz_xRRGetProviderInfoReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
RRProvider source_provider;
Time configTimestamp;
} xRRSetProviderOutputSourceReq;
#define sz_xRRSetProviderOutputSourceReq 16
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
RRProvider sink_provider;
Time configTimestamp;
} xRRSetProviderOffloadSinkReq;
#define sz_xRRSetProviderOffloadSinkReq 16
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
} xRRListProviderPropertiesReq;
#define sz_xRRListProviderPropertiesReq 8
typedef struct {
BYTE type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nAtoms;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRListProviderPropertiesReply;
#define sz_xRRListProviderPropertiesReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
Atom property;
} xRRQueryProviderPropertyReq;
#define sz_xRRQueryProviderPropertyReq 12
typedef struct {
BYTE type;
BYTE pad0;
CARD16 sequenceNumber;
CARD32 length;
BOOL pending;
BOOL range;
BOOL immutable;
BYTE pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRRQueryProviderPropertyReply;
#define sz_xRRQueryProviderPropertyReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
Atom property;
BOOL pending;
BOOL range;
CARD16 pad;
} xRRConfigureProviderPropertyReq;
#define sz_xRRConfigureProviderPropertyReq 16
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
Atom property;
Atom type;
CARD8 format;
CARD8 mode;
CARD16 pad;
CARD32 nUnits;
} xRRChangeProviderPropertyReq;
#define sz_xRRChangeProviderPropertyReq 24
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
Atom property;
} xRRDeleteProviderPropertyReq;
#define sz_xRRDeleteProviderPropertyReq 12
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRProvider provider;
Atom property;
Atom type;
CARD32 longOffset;
CARD32 longLength;
#ifdef __cplusplus
BOOL _delete;
#else
BOOL delete;
#endif
BOOL pending;
CARD16 pad1;
} xRRGetProviderPropertyReq;
#define sz_xRRGetProviderPropertyReq 28
typedef struct {
BYTE type;
CARD8 format;
CARD16 sequenceNumber;
CARD32 length;
Atom propertyType;
CARD32 bytesAfter;
CARD32 nItems;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xRRGetProviderPropertyReply;
#define sz_xRRGetProviderPropertyReply 32
/*
* Additions for V1.6
*/
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
RRLease lid;
CARD16 nCrtcs;
CARD16 nOutputs;
} xRRCreateLeaseReq;
#define sz_xRRCreateLeaseReq 16
typedef struct {
BYTE type;
CARD8 nfd;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xRRCreateLeaseReply;
#define sz_xRRCreateLeaseReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRLease lid;
BYTE terminate;
CARD8 pad1;
CARD16 pad2;
} xRRFreeLeaseReq;
#define sz_xRRFreeLeaseReq 12
/*
* event
*/
typedef struct {
CARD8 type; /* always evBase + ScreenChangeNotify */
CARD8 rotation; /* new rotation */
CARD16 sequenceNumber;
Time timestamp; /* time screen was changed */
Time configTimestamp; /* time config data was changed */
Window root; /* root window */
Window window; /* window requesting notification */
SizeID sizeID; /* new size ID */
CARD16 subpixelOrder; /* subpixel order */
CARD16 widthInPixels; /* new size */
CARD16 heightInPixels;
CARD16 widthInMillimeters;
CARD16 heightInMillimeters;
} xRRScreenChangeNotifyEvent;
#define sz_xRRScreenChangeNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_CrtcChange */
CARD16 sequenceNumber;
Time timestamp; /* time crtc was changed */
Window window; /* window requesting notification */
RRCrtc crtc; /* affected CRTC */
RRMode mode; /* current mode */
CARD16 rotation; /* rotation and reflection */
CARD16 pad1; /* unused */
INT16 x; /* new location */
INT16 y;
CARD16 width; /* new size */
CARD16 height;
} xRRCrtcChangeNotifyEvent;
#define sz_xRRCrtcChangeNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_OutputChange */
CARD16 sequenceNumber;
Time timestamp; /* time output was changed */
Time configTimestamp; /* time config was changed */
Window window; /* window requesting notification */
RROutput output; /* affected output */
RRCrtc crtc; /* current crtc */
RRMode mode; /* current mode */
CARD16 rotation; /* rotation and reflection */
CARD8 connection; /* connection status */
CARD8 subpixelOrder; /* subpixel order */
} xRROutputChangeNotifyEvent;
#define sz_xRROutputChangeNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_OutputProperty */
CARD16 sequenceNumber;
Window window; /* window requesting notification */
RROutput output; /* affected output */
Atom atom; /* property name */
Time timestamp; /* time crtc was changed */
CARD8 state; /* NewValue or Deleted */
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
} xRROutputPropertyNotifyEvent;
#define sz_xRROutputPropertyNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_ProviderChange */
CARD16 sequenceNumber;
Time timestamp; /* time provider was changed */
Window window; /* window requesting notification */
RRProvider provider; /* affected provider */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xRRProviderChangeNotifyEvent;
#define sz_xRRProviderChangeNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_ProviderProperty */
CARD16 sequenceNumber;
Window window; /* window requesting notification */
RRProvider provider; /* affected provider */
Atom atom; /* property name */
Time timestamp; /* time provider was changed */
CARD8 state; /* NewValue or Deleted */
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
} xRRProviderPropertyNotifyEvent;
#define sz_xRRProviderPropertyNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_ResourceChange */
CARD16 sequenceNumber;
Time timestamp; /* time resource was changed */
Window window; /* window requesting notification */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRResourceChangeNotifyEvent;
#define sz_xRRResourceChangeNotifyEvent 32
typedef struct {
CARD8 type; /* always evBase + RRNotify */
CARD8 subCode; /* RRNotify_Lease */
CARD16 sequenceNumber;
Time timestamp; /* time resource was changed */
Window window; /* window requesting notification */
RRLease lease;
CARD8 created; /* created/deleted */
CARD8 pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xRRLeaseNotifyEvent;
#define sz_xRRLeaseNotifyEvent 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
} xRRGetPanningReq;
#define sz_xRRGetPanningReq 8
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
CARD16 left;
CARD16 top;
CARD16 width;
CARD16 height;
CARD16 track_left;
CARD16 track_top;
CARD16 track_width;
CARD16 track_height;
INT16 border_left;
INT16 border_top;
INT16 border_right;
INT16 border_bottom;
} xRRGetPanningReply;
#define sz_xRRGetPanningReply 36
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
RRCrtc crtc;
Time timestamp;
CARD16 left;
CARD16 top;
CARD16 width;
CARD16 height;
CARD16 track_left;
CARD16 track_top;
CARD16 track_width;
CARD16 track_height;
INT16 border_left;
INT16 border_top;
INT16 border_right;
INT16 border_bottom;
} xRRSetPanningReq;
#define sz_xRRSetPanningReq 36
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time newTimestamp;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRRSetPanningReply;
#define sz_xRRSetPanningReply 32
typedef struct {
Atom name;
BOOL primary;
BOOL automatic;
CARD16 noutput;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
CARD32 widthInMillimeters;
CARD32 heightInMillimeters;
} xRRMonitorInfo;
#define sz_xRRMonitorInfo 24
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
BOOL get_active;
CARD8 pad;
CARD16 pad2;
} xRRGetMonitorsReq;
#define sz_xRRGetMonitorsReq 12
typedef struct {
BYTE type;
CARD8 status;
CARD16 sequenceNumber;
CARD32 length;
Time timestamp;
CARD32 nmonitors;
CARD32 noutputs;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xRRGetMonitorsReply;
#define sz_xRRGetMonitorsReply 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
xRRMonitorInfo monitor;
} xRRSetMonitorReq;
#define sz_xRRSetMonitorReq 32
typedef struct {
CARD8 reqType;
CARD8 randrReqType;
CARD16 length;
Window window;
Atom name;
} xRRDeleteMonitorReq;
#define sz_xRRDeleteMonitorReq 12
#undef RRLease
#undef RRModeFlags
#undef RRCrtc
#undef RRMode
#undef RROutput
#undef RRMode
#undef RRCrtc
#undef RRProvider
#undef Drawable
#undef Window
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef Atom
#undef Time
#undef KeyCode
#undef KeySym
#undef Rotation
#undef SizeID
#undef SubpixelOrder
#endif /* _XRANDRP_H_ */
/*
* Copyright 1992 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, 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.
*
*/
#ifndef _LBX_H_
#define _LBX_H_
#define LBXNAME "LBX"
#define LBX_MAJOR_VERSION 1
#define LBX_MINOR_VERSION 0
#define LbxNumberReqs 44
#define LbxEvent 0
#define LbxQuickMotionDeltaEvent 1
#define LbxNumberEvents 2
/* This is always the master client */
#define LbxMasterClientIndex 0
/* LbxEvent lbxType sub-fields */
#define LbxSwitchEvent 0
#define LbxCloseEvent 1
#define LbxDeltaEvent 2
#define LbxInvalidateTagEvent 3
#define LbxSendTagDataEvent 4
#define LbxListenToOne 5
#define LbxListenToAll 6
#define LbxMotionDeltaEvent 7
#define LbxReleaseCmapEvent 8
#define LbxFreeCellsEvent 9
/*
* Lbx image compression methods
*
* No compression is always assigned the value of 0.
*
* The rest of the compression method opcodes are assigned dynamically
* at option negotiation time.
*/
#define LbxImageCompressNone 0
#define BadLbxClient 0
#define LbxNumberErrors (BadLbxClient + 1)
/* tagged data types */
#define LbxTagTypeModmap 1
#define LbxTagTypeKeymap 2
#define LbxTagTypeProperty 3
#define LbxTagTypeFont 4
#define LbxTagTypeConnInfo 5
#endif
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XKBSRV_H_
#define _XKBSRV_H_
#ifdef XKB_IN_SERVER
#define XkbAllocClientMap SrvXkbAllocClientMap
#define XkbAllocServerMap SrvXkbAllocServerMap
#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey
#define XkbAddKeyType SrvXkbAddKeyType
#define XkbCopyKeyType SrvXkbCopyKeyType
#define XkbCopyKeyTypes SrvXkbCopyKeyTypes
#define XkbFreeClientMap SrvXkbFreeClientMap
#define XkbFreeServerMap SrvXkbFreeServerMap
#define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes
#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols
#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey
#define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore
#define XkbResizeKeyActions SrvXkbResizeKeyActions
#define XkbResizeKeySyms SrvXkbResizeKeySyms
#define XkbResizeKeyType SrvXkbResizeKeyType
#define XkbAllocCompatMap SrvXkbAllocCompatMap
#define XkbAllocControls SrvXkbAllocControls
#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps
#define XkbAllocKeyboard SrvXkbAllocKeyboard
#define XkbAllocNames SrvXkbAllocNames
#define XkbFreeCompatMap SrvXkbFreeCompatMap
#define XkbFreeControls SrvXkbFreeControls
#define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps
#define XkbFreeKeyboard SrvXkbFreeKeyboard
#define XkbFreeNames SrvXkbFreeNames
#define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo
#define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo
#define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo
#define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions
#define XkbLatchModifiers SrvXkbLatchModifiers
#define XkbLatchGroup SrvXkbLatchGroup
#define XkbVirtualModsToReal SrvXkbVirtualModsToReal
#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange
#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges
#define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods
#define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods
#endif
#include <X11/extensions/XKBstr.h>
#include <X11/extensions/XKBproto.h>
#include "inputstr.h"
typedef struct _XkbInterest {
DeviceIntPtr dev;
ClientPtr client;
XID resource;
struct _XkbInterest * next;
CARD16 extDevNotifyMask;
CARD16 stateNotifyMask;
CARD16 namesNotifyMask;
CARD32 ctrlsNotifyMask;
CARD8 compatNotifyMask;
BOOL bellNotifyMask;
BOOL actionMessageMask;
CARD16 accessXNotifyMask;
CARD32 iStateNotifyMask;
CARD32 iMapNotifyMask;
CARD16 altSymsNotifyMask;
CARD32 autoCtrls;
CARD32 autoCtrlValues;
} XkbInterestRec,*XkbInterestPtr;
typedef struct _XkbRadioGroup {
CARD8 flags;
CARD8 nMembers;
CARD8 dfltDown;
CARD8 currentDown;
CARD8 members[XkbRGMaxMembers];
} XkbRadioGroupRec, *XkbRadioGroupPtr;
typedef struct _XkbEventCause {
CARD8 kc;
CARD8 event;
CARD8 mjr;
CARD8 mnr;
ClientPtr client;
} XkbEventCauseRec,*XkbEventCausePtr;
#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\
(c)->mjr= (c)->mnr= 0; \
(c)->client= NULL; }
#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\
(c)->mjr= (j),(c)->mnr= (n);\
(c)->client= (cl); }
#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl)
#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl)
#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0)
#define _OFF_TIMER 0
#define _KRG_WARN_TIMER 1
#define _KRG_TIMER 2
#define _SK_TIMEOUT_TIMER 3
#define _ALL_TIMEOUT_TIMER 4
#define _BEEP_NONE 0
#define _BEEP_FEATURE_ON 1
#define _BEEP_FEATURE_OFF 2
#define _BEEP_FEATURE_CHANGE 3
#define _BEEP_SLOW_WARN 4
#define _BEEP_SLOW_PRESS 5
#define _BEEP_SLOW_ACCEPT 6
#define _BEEP_SLOW_REJECT 7
#define _BEEP_SLOW_RELEASE 8
#define _BEEP_STICKY_LATCH 9
#define _BEEP_STICKY_LOCK 10
#define _BEEP_STICKY_UNLOCK 11
#define _BEEP_LED_ON 12
#define _BEEP_LED_OFF 13
#define _BEEP_LED_CHANGE 14
#define _BEEP_BOUNCE_REJECT 15
typedef struct _XkbSrvInfo {
XkbStateRec prev_state;
XkbStateRec state;
XkbDescPtr desc;
DeviceIntPtr device;
KbdCtrlProcPtr kbdProc;
XkbRadioGroupPtr radioGroups;
CARD8 nRadioGroups;
CARD8 clearMods;
CARD8 setMods;
INT16 groupChange;
CARD16 dfltPtrDelta;
double mouseKeysCurve;
double mouseKeysCurveFactor;
INT16 mouseKeysDX;
INT16 mouseKeysDY;
CARD8 mouseKeysFlags;
Bool mouseKeysAccel;
CARD8 mouseKeysCounter;
CARD8 lockedPtrButtons;
CARD8 shiftKeyCount;
KeyCode mouseKey;
KeyCode inactiveKey;
KeyCode slowKey;
KeyCode repeatKey;
CARD8 krgTimerActive;
CARD8 beepType;
CARD8 beepCount;
CARD32 flags;
CARD32 lastPtrEventTime;
CARD32 lastShiftEventTime;
OsTimerPtr beepTimer;
OsTimerPtr mouseKeyTimer;
OsTimerPtr slowKeysTimer;
OsTimerPtr bounceKeysTimer;
OsTimerPtr repeatKeyTimer;
OsTimerPtr krgTimer;
} XkbSrvInfoRec, *XkbSrvInfoPtr;
#define XkbSLI_IsDefault (1L<<0)
#define XkbSLI_HasOwnState (1L<<1)
typedef struct _XkbSrvLedInfo {
CARD16 flags;
CARD16 class;
CARD16 id;
union {
KbdFeedbackPtr kf;
LedFeedbackPtr lf;
} fb;
CARD32 physIndicators;
CARD32 autoState;
CARD32 explicitState;
CARD32 effectiveState;
CARD32 mapsPresent;
CARD32 namesPresent;
XkbIndicatorMapPtr maps;
Atom * names;
CARD32 usesBase;
CARD32 usesLatched;
CARD32 usesLocked;
CARD32 usesEffective;
CARD32 usesCompat;
CARD32 usesControls;
CARD32 usedComponents;
} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr;
/*
* Settings for xkbClientFlags field (used by DIX)
* These flags _must_ not overlap with XkbPCF_*
*/
#define _XkbClientInitialized (1<<15)
#define _XkbWantsDetectableAutoRepeat(c)\
((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask)
/*
* Settings for flags field
*/
#define _XkbStateNotifyInProgress (1<<0)
typedef struct
{
ProcessInputProc processInputProc;
ProcessInputProc realInputProc;
DeviceUnwrapProc unwrapProc;
} xkbDeviceInfoRec, *xkbDeviceInfoPtr;
#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
device->public.processInputProc = proc; \
oldprocs->processInputProc = \
oldprocs->realInputProc = device->public.realInputProc; \
device->public.realInputProc = proc; \
oldprocs->unwrapProc = device->unwrapProc; \
device->unwrapProc = unwrapproc;
#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
if (device->public.processInputProc == device->public.realInputProc)\
device->public.processInputProc = proc; \
oldprocs->processInputProc = \
oldprocs->realInputProc = device->public.realInputProc; \
device->public.realInputProc = proc; \
oldprocs->unwrapProc = device->unwrapProc; \
device->unwrapProc = unwrapproc;
#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \
device->public.processInputProc = oldprocs->processInputProc; \
device->public.realInputProc = oldprocs->realInputProc; \
device->unwrapProc = oldprocs->unwrapProc;
#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr)
/***====================================================================***/
/***====================================================================***/
#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask)
#define XkbAllFilteredEventsMask \
(XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask)
/***====================================================================***/
extern int XkbReqCode;
extern int XkbEventBase;
extern int XkbKeyboardErrorCode;
extern int XkbDisableLockActions;
extern char * XkbBaseDirectory;
extern char * XkbBinDirectory;
extern char * XkbInitialMap;
extern int _XkbClientMajor;
extern int _XkbClientMinor;
extern unsigned int XkbXIUnsupported;
extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed;
extern Bool noXkbExtension;
extern Bool XkbWantRulesProp;
extern pointer XkbLastRepeatEvent;
extern CARD32 xkbDebugFlags;
extern CARD32 xkbDebugCtrls;
#define _XkbAlloc(s) xalloc((s))
#define _XkbCalloc(n,s) Xcalloc((n)*(s))
#define _XkbRealloc(o,s) Xrealloc((o),(s))
#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t)))
#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t)))
#define _XkbTypedRealloc(o,n,t) \
((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
#define _XkbFree(p) Xfree(p)
#define _XkbLibError(c,l,d) \
{ _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
extern int DeviceKeyPress,DeviceKeyRelease;
extern int DeviceButtonPress,DeviceButtonRelease;
#ifdef XINPUT
#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress))
#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease))
#else
#define _XkbIsPressEvent(t) ((t)==KeyPress)
#define _XkbIsReleaseEvent(t) ((t)==KeyRelease)
#endif
#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\
((k)<=(c)->curKeySyms.maxKeyCode))
#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\
(c)->curKeySyms.minKeyCode+1)
#define XConvertCase(s,l,u) XkbConvertCase(s,l,u)
#undef IsKeypadKey
#define IsKeypadKey(s) XkbKSIsKeypad(s)
typedef int Status;
typedef pointer XPointer;
typedef struct _XDisplay Display;
#ifndef True
#define True 1
#define False 0
#endif
#ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024
#endif
#endif
_XFUNCPROTOBEGIN
extern void XkbUseMsg(
void
);
extern int XkbProcessArguments(
int /* argc */,
char ** /* argv */,
int /* i */
);
extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
extern void XkbFreeCompatMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeMap */
);
extern void XkbFreeNames(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeMap */
);
extern DeviceIntPtr _XkbLookupAnyDevice(
int /* id */,
int * /* why_rtrn */
);
extern DeviceIntPtr _XkbLookupKeyboard(
int /* id */,
int * /* why_rtrn */
);
extern DeviceIntPtr _XkbLookupBellDevice(
int /* id */,
int * /* why_rtrn */
);
extern DeviceIntPtr _XkbLookupLedDevice(
int /* id */,
int * /* why_rtrn */
);
extern DeviceIntPtr _XkbLookupButtonDevice(
int /* id */,
int * /* why_rtrn */
);
extern XkbDescPtr XkbAllocKeyboard(
void
);
extern Status XkbAllocClientMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
unsigned int /* nTypes */
);
extern Status XkbAllocServerMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
unsigned int /* nNewActions */
);
extern void XkbFreeClientMap(
XkbDescPtr /* xkb */,
unsigned int /* what */,
Bool /* freeMap */
);
extern void XkbFreeServerMap(
XkbDescPtr /* xkb */,
unsigned int /* what */,
Bool /* freeMap */
);
extern Status XkbAllocIndicatorMaps(
XkbDescPtr /* xkb */
);
extern Status XkbAllocCompatMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
unsigned int /* nInterpret */
);
extern Status XkbAllocNames(
XkbDescPtr /* xkb */,
unsigned int /* which */,
int /* nTotalRG */,
int /* nTotalAliases */
);
extern Status XkbAllocControls(
XkbDescPtr /* xkb */,
unsigned int /* which*/
);
extern Status XkbCopyKeyType(
XkbKeyTypePtr /* from */,
XkbKeyTypePtr /* into */
);
extern Status XkbCopyKeyTypes(
XkbKeyTypePtr /* from */,
XkbKeyTypePtr /* into */,
int /* num_types */
);
extern Status XkbResizeKeyType(
XkbDescPtr /* xkb */,
int /* type_ndx */,
int /* map_count */,
Bool /* want_preserve */,
int /* new_num_lvls */
);
extern void XkbFreeKeyboard(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeDesc */
);
extern void XkbSetActionKeyMods(
XkbDescPtr /* xkb */,
XkbAction * /* act */,
unsigned int /* mods */
);
extern Bool XkbCheckActionVMods(
XkbDescPtr /* xkb */,
XkbAction * /* act */,
unsigned int /* changed */
);
extern Bool XkbApplyVModChanges(
XkbSrvInfoPtr /* xkbi */,
unsigned int /* changed */,
XkbChangesPtr /* pChanges */,
unsigned int * /* needChecksRtrn */,
XkbEventCausePtr /* cause */
);
extern void XkbApplyVModChangesToAllDevices(
DeviceIntPtr /* dev */,
XkbDescPtr /* xkb */,
unsigned int /* changed */,
XkbEventCausePtr /* cause */
);
extern unsigned int XkbMaskForVMask(
XkbDescPtr /* xkb */,
unsigned int /* vmask */
);
extern Bool XkbVirtualModsToReal(
XkbDescPtr /* xkb */,
unsigned int /* virtua_mask */,
unsigned int * /* mask_rtrn */
);
extern unsigned int XkbAdjustGroup(
int /* group */,
XkbControlsPtr /* ctrls */
);
extern KeySym *XkbResizeKeySyms(
XkbDescPtr /* xkb */,
int /* key */,
int /* needed */
);
extern XkbAction *XkbResizeKeyActions(
XkbDescPtr /* xkb */,
int /* key */,
int /* needed */
);
extern void XkbUpdateKeyTypesFromCore(
DeviceIntPtr /* pXDev */,
KeyCode /* first */,
CARD8 /* num */,
XkbChangesPtr /* pChanges */
);
extern void XkbUpdateDescActions(
XkbDescPtr /* xkb */,
KeyCode /* first */,
CARD8 /* num */,
XkbChangesPtr /* changes */
);
extern void XkbUpdateActions(
DeviceIntPtr /* pXDev */,
KeyCode /* first */,
CARD8 /* num */,
XkbChangesPtr /* pChanges */,
unsigned int * /* needChecksRtrn */,
XkbEventCausePtr /* cause */
);
extern void XkbUpdateCoreDescription(
DeviceIntPtr /* keybd */,
Bool /* resize */
);
extern void XkbApplyMappingChange(
DeviceIntPtr /* pXDev */,
CARD8 /* request */,
KeyCode /* firstKey */,
CARD8 /* num */,
ClientPtr /* client */
);
extern void XkbSetIndicators(
DeviceIntPtr /* pXDev */,
CARD32 /* affect */,
CARD32 /* values */,
XkbEventCausePtr /* cause */
);
extern void XkbUpdateIndicators(
DeviceIntPtr /* keybd */,
CARD32 /* changed */,
Bool /* check_edevs */,
XkbChangesPtr /* pChanges */,
XkbEventCausePtr /* cause */
);
extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
DeviceIntPtr /* dev */,
KbdFeedbackPtr /* kf */,
LedFeedbackPtr /* lf */,
unsigned int /* needed_parts */
);
extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
DeviceIntPtr /* dev */,
unsigned int /* class */,
unsigned int /* id */,
unsigned int /* needed_parts */
);
extern void XkbApplyLedNameChanges(
DeviceIntPtr /* dev */,
XkbSrvLedInfoPtr /* sli */,
unsigned int /* changed_names */,
xkbExtensionDeviceNotify * /* ed */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void XkbApplyLedMapChanges(
DeviceIntPtr /* dev */,
XkbSrvLedInfoPtr /* sli */,
unsigned int /* changed_maps */,
xkbExtensionDeviceNotify * /* ed */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void XkbApplyLedStateChanges(
DeviceIntPtr /* dev */,
XkbSrvLedInfoPtr /* sli */,
unsigned int /* changed_leds */,
xkbExtensionDeviceNotify * /* ed */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void XkbUpdateLedAutoState(
DeviceIntPtr /* dev */,
XkbSrvLedInfoPtr /* sli */,
unsigned int /* maps_to_check */,
xkbExtensionDeviceNotify * /* ed */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void XkbFlushLedEvents(
DeviceIntPtr /* dev */,
DeviceIntPtr /* kbd */,
XkbSrvLedInfoPtr /* sli */,
xkbExtensionDeviceNotify * /* ed */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void XkbUpdateAllDeviceIndicators(
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern unsigned int XkbIndicatorsToUpdate(
DeviceIntPtr /* dev */,
unsigned long /* state_changes */,
Bool /* enabled_ctrl_changes */
);
extern void XkbComputeDerivedState(
XkbSrvInfoPtr /* xkbi */
);
extern void XkbCheckSecondaryEffects(
XkbSrvInfoPtr /* xkbi */,
unsigned int /* which */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void XkbCheckIndicatorMaps(
DeviceIntPtr /* dev */,
XkbSrvLedInfoPtr /* sli */,
unsigned int /* which */
);
extern unsigned int XkbStateChangedFlags(
XkbStatePtr /* old */,
XkbStatePtr /* new */
);
extern void XkbSendStateNotify(
DeviceIntPtr /* kbd */,
xkbStateNotify * /* pSN */
);
extern void XkbSendMapNotify(
DeviceIntPtr /* kbd */,
xkbMapNotify * /* ev */
);
extern int XkbComputeControlsNotify(
DeviceIntPtr /* kbd */,
XkbControlsPtr /* old */,
XkbControlsPtr /* new */,
xkbControlsNotify * /* pCN */,
Bool /* forceCtrlProc */
);
extern void XkbSendControlsNotify(
DeviceIntPtr /* kbd */,
xkbControlsNotify * /* ev */
);
extern void XkbSendCompatMapNotify(
DeviceIntPtr /* kbd */,
xkbCompatMapNotify * /* ev */
);
extern void XkbSendIndicatorNotify(
DeviceIntPtr /* kbd */,
int /* xkbType */,
xkbIndicatorNotify * /* ev */
);
extern void XkbHandleBell(
BOOL /* force */,
BOOL /* eventOnly */,
DeviceIntPtr /* kbd */,
CARD8 /* percent */,
pointer /* ctrl */,
CARD8 /* class */,
Atom /* name */,
WindowPtr /* pWin */,
ClientPtr /* pClient */
);
extern void XkbSendAccessXNotify(
DeviceIntPtr /* kbd */,
xkbAccessXNotify * /* pEv */
);
extern void XkbSendNamesNotify(
DeviceIntPtr /* kbd */,
xkbNamesNotify * /* ev */
);
extern void XkbSendCompatNotify(
DeviceIntPtr /* kbd */,
xkbCompatMapNotify * /* ev */
);
extern void XkbSendActionMessage(
DeviceIntPtr /* kbd */,
xkbActionMessage * /* ev */
);
extern void XkbSendExtensionDeviceNotify(
DeviceIntPtr /* kbd */,
ClientPtr /* client */,
xkbExtensionDeviceNotify * /* ev */
);
extern void XkbSendNotification(
DeviceIntPtr /* kbd */,
XkbChangesPtr /* pChanges */,
XkbEventCausePtr /* cause */
);
extern void XkbProcessKeyboardEvent(
struct _xEvent * /* xE */,
DeviceIntPtr /* keybd */,
int /* count */
);
extern void XkbProcessOtherEvent(
struct _xEvent * /* xE */,
DeviceIntPtr /* keybd */,
int /* count */
);
extern void XkbHandleActions(
DeviceIntPtr /* dev */,
DeviceIntPtr /* kbd */,
struct _xEvent * /* xE */,
int /* count */
);
extern Bool XkbEnableDisableControls(
XkbSrvInfoPtr /* xkbi */,
unsigned long /* change */,
unsigned long /* newValues */,
XkbChangesPtr /* changes */,
XkbEventCausePtr /* cause */
);
extern void AccessXInit(
DeviceIntPtr /* dev */
);
extern Bool AccessXFilterPressEvent(
register struct _xEvent * /* xE */,
register DeviceIntPtr /* keybd */,
int /* count */
);
extern Bool AccessXFilterReleaseEvent(
register struct _xEvent * /* xE */,
register DeviceIntPtr /* keybd */,
int /* count */
);
extern void AccessXCancelRepeatKey(
XkbSrvInfoPtr /* xkbi */,
KeyCode /* key */
);
extern void AccessXComputeCurveFactor(
XkbSrvInfoPtr /* xkbi */,
XkbControlsPtr /* ctrls */
);
extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo(
XkbDeviceInfoPtr /* devi */,
unsigned int /* ledClass */,
unsigned int /* ledId */
);
extern XkbDeviceInfoPtr XkbAllocDeviceInfo(
unsigned int /* deviceSpec */,
unsigned int /* nButtons */,
unsigned int /* szLeds */
);
extern void XkbFreeDeviceInfo(
XkbDeviceInfoPtr /* devi */,
unsigned int /* which */,
Bool /* freeDevI */
);
extern Status XkbResizeDeviceButtonActions(
XkbDeviceInfoPtr /* devi */,
unsigned int /* newTotal */
);
extern XkbInterestPtr XkbFindClientResource(
DevicePtr /* inDev */,
ClientPtr /* client */
);
extern XkbInterestPtr XkbAddClientResource(
DevicePtr /* inDev */,
ClientPtr /* client */,
XID /* id */
);
extern int XkbRemoveClient(
DevicePtr /* inDev */,
ClientPtr /* client */
);
extern int XkbRemoveResourceClient(
DevicePtr /* inDev */,
XID /* id */
);
extern int XkbDDXInitDevice(
DeviceIntPtr /* dev */
);
extern int XkbDDXAccessXBeep(
DeviceIntPtr /* dev */,
unsigned int /* what */,
unsigned int /* which */
);
extern void XkbDDXKeyClick(
DeviceIntPtr /* dev */,
int /* keycode */,
int /* synthetic */
);
extern int XkbDDXUsesSoftRepeat(
DeviceIntPtr /* dev */
);
extern void XkbDDXKeybdCtrlProc(
DeviceIntPtr /* dev */,
KeybdCtrl * /* ctrl */
);
extern void XkbDDXChangeControls(
DeviceIntPtr /* dev */,
XkbControlsPtr /* old */,
XkbControlsPtr /* new */
);
extern void XkbDDXUpdateIndicators(
DeviceIntPtr /* keybd */,
CARD32 /* newState */
);
extern void XkbDDXUpdateDeviceIndicators(
DeviceIntPtr /* dev */,
XkbSrvLedInfoPtr /* sli */,
CARD32 /* newState */
);
extern void XkbDDXFakePointerButton(
int /* event */,
int /* button */
);
extern void XkbDDXFakePointerMotion(
unsigned int /* flags */,
int /* x */,
int /* y */
);
extern void XkbDDXFakeDeviceButton(
DeviceIntPtr /* dev */,
Bool /* press */,
int /* button */
);
extern int XkbDDXTerminateServer(
DeviceIntPtr /* dev */,
KeyCode /* key */,
XkbAction * /* act */
);
extern int XkbDDXSwitchScreen(
DeviceIntPtr /* dev */,
KeyCode /* key */,
XkbAction * /* act */
);
extern int XkbDDXPrivate(
DeviceIntPtr /* dev */,
KeyCode /* key */,
XkbAction * /* act */
);
extern void XkbDisableComputedAutoRepeats(
DeviceIntPtr /* pXDev */,
unsigned int /* key */
);
extern void XkbSetRepeatKeys(
DeviceIntPtr /* pXDev */,
int /* key */,
int /* onoff */
);
extern int XkbLatchModifiers(
DeviceIntPtr /* pXDev */,
CARD8 /* mask */,
CARD8 /* latches */
);
extern int XkbLatchGroup(
DeviceIntPtr /* pXDev */,
int /* group */
);
extern void XkbClearAllLatchesAndLocks(
DeviceIntPtr /* dev */,
XkbSrvInfoPtr /* xkbi */,
Bool /* genEv */,
XkbEventCausePtr /* cause */
);
extern void XkbSetRulesDflts(
char * /* rulesFile */,
char * /* model */,
char * /* layout */,
char * /* variant */,
char * /* options */
);
extern void XkbInitDevice(
DeviceIntPtr /* pXDev */
);
extern Bool XkbInitKeyboardDeviceStruct(
DeviceIntPtr /* pXDev */,
XkbComponentNamesPtr /* pNames */,
KeySymsPtr /* pSyms */,
CARD8 /* pMods */[],
BellProcPtr /* bellProc */,
KbdCtrlProcPtr /* ctrlProc */
);
extern int SProcXkbDispatch(
ClientPtr /* client */
);
extern XkbGeometryPtr XkbLookupNamedGeometry(
DeviceIntPtr /* dev */,
Atom /* name */,
Bool * /* shouldFree */
);
extern char * _XkbDupString(
char * /* str */
);
extern void XkbConvertCase(
KeySym /* sym */,
KeySym * /* lower */,
KeySym * /* upper */
);
extern Status XkbChangeKeycodeRange(
XkbDescPtr /* xkb */,
int /* minKC */,
int /* maxKC */,
XkbChangesPtr /* changes */
);
extern int XkbFinishDeviceInit(
DeviceIntPtr /* pXDev */
);
extern void XkbFreeSrvLedInfo(
XkbSrvLedInfoPtr /* sli */
);
extern void XkbFreeInfo(
XkbSrvInfoPtr /* xkbi */
);
extern Status XkbChangeTypesOfKey(
XkbDescPtr /* xkb */,
int /* key */,
int /* nGroups */,
unsigned int /* groups */,
int * /* newTypesIn */,
XkbMapChangesPtr /* changes */
);
extern XkbKeyTypePtr XkbAddKeyType(
XkbDescPtr /* xkb */,
Atom /* name */,
int /* map_count */,
Bool /* want_preserve */,
int /* num_lvls */
);
extern Status XkbInitCanonicalKeyTypes(
XkbDescPtr /* xkb */,
unsigned int /* which */,
int /* keypadVMod */
);
extern int XkbKeyTypesForCoreSymbols(
XkbDescPtr /* xkb */,
int /* map_width */,
KeySym * /* core_syms */,
unsigned int /* protected */,
int * /* types_inout */,
KeySym * /* xkb_syms_rtrn */
);
extern Bool XkbApplyCompatMapToKey(
XkbDescPtr /* xkb */,
KeyCode /* key */,
XkbChangesPtr /* changes */
);
extern Bool XkbUpdateMapFromCore(
XkbDescPtr /* xkb */,
KeyCode /* first_key */,
int /* num_keys */,
int /* map_width */,
KeySym * /* core_keysyms */,
XkbChangesPtr /* changes */
);
extern void XkbFreeControls(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeMap */
);
extern void XkbFreeIndicatorMaps(
XkbDescPtr /* xkb */
);
extern Bool XkbApplyVirtualModChanges(
XkbDescPtr /* xkb */,
unsigned int /* changed */,
XkbChangesPtr /* changes */
);
extern Bool XkbUpdateActionVirtualMods(
XkbDescPtr /* xkb */,
XkbAction * /* act */,
unsigned int /* changed */
);
extern void XkbUpdateKeyTypeVirtualMods(
XkbDescPtr /* xkb */,
XkbKeyTypePtr /* type */,
unsigned int /* changed */,
XkbChangesPtr /* changes */
);
extern void XkbSendNewKeyboardNotify(
DeviceIntPtr /* kbd */,
xkbNewKeyboardNotify * /* pNKN */
);
#ifdef XKBSRV_NEED_FILE_FUNCS
#include <X11/extensions/XKMformat.h>
#include <X11/extensions/XKBfile.h>
#include <X11/extensions/XKBrules.h>
#define _XkbListKeymaps 0
#define _XkbListKeycodes 1
#define _XkbListTypes 2
#define _XkbListCompat 3
#define _XkbListSymbols 4
#define _XkbListGeometry 5
#define _XkbListNumComponents 6
typedef struct _XkbSrvListInfo {
int szPool;
int nPool;
char * pool;
int maxRtrn;
int nTotal;
char * pattern[_XkbListNumComponents];
int nFound[_XkbListNumComponents];
} XkbSrvListInfoRec,*XkbSrvListInfoPtr;
char *
XkbGetRulesDflts(
XkbRF_VarDefsPtr /* defs */
);
extern void XkbSetRulesUsed(
XkbRF_VarDefsPtr /* defs */
);
extern Status XkbDDXList(
DeviceIntPtr /* dev */,
XkbSrvListInfoPtr /* listing */,
ClientPtr /* client */
);
extern unsigned int XkbDDXLoadKeymapByNames(
DeviceIntPtr /* keybd */,
XkbComponentNamesPtr /* names */,
unsigned int /* want */,
unsigned int /* need */,
XkbFileInfoPtr /* finfoRtrn */,
char * /* keymapNameRtrn */,
int /* keymapNameRtrnLen */
);
extern Bool XkbDDXNamesFromRules(
DeviceIntPtr /* keybd */,
char * /* rules */,
XkbRF_VarDefsPtr /* defs */,
XkbComponentNamesPtr /* names */
);
extern FILE *XkbDDXOpenConfigFile(
char * /* mapName */,
char * /* fileNameRtrn */,
int /* fileNameRtrnLen */
);
extern Bool XkbDDXApplyConfig(
XPointer /* cfg_in */,
XkbSrvInfoPtr /* xkbi */
);
extern XPointer XkbDDXPreloadConfig(
char ** /* rulesFileRtrn */,
XkbRF_VarDefsPtr /* defs */,
XkbComponentNamesPtr /* names */,
DeviceIntPtr /* dev */
);
extern int _XkbStrCaseCmp(
char * /* str1 */,
char * /* str2 */
);
#endif /* XKBSRV_NEED_FILE_FUNCS */
_XFUNCPROTOEND
#define XkbAtomGetString(d,s) NameForAtom(s)
#endif /* _XKBSRV_H_ */
/* $XFree86: xc/include/extensions/xf86mscstr.h,v 3.12 2002/11/20 04:04:56 dawes Exp $ */
/*
* Copyright (c) 1995, 1996 The XFree86 Project, Inc
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _XF86MISCSTR_H_
#define _XF86MISCSTR_H_
#include <X11/extensions/xf86misc.h>
#define XF86MISCNAME "XFree86-Misc"
#define XF86MISC_MAJOR_VERSION 0 /* current version numbers */
#define XF86MISC_MINOR_VERSION 9
typedef struct _XF86MiscQueryVersion {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscQueryVersion */
CARD16 length;
} xXF86MiscQueryVersionReq;
#define sz_xXF86MiscQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of XFree86-Misc */
CARD16 minorVersion; /* minor version of XFree86-Misc */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86MiscQueryVersionReply;
#define sz_xXF86MiscQueryVersionReply 32
#ifdef _XF86MISC_SAVER_COMPAT_
typedef struct _XF86MiscGetSaver {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetSaver */
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86MiscGetSaverReq;
#define sz_xXF86MiscGetSaverReq 8
typedef struct _XF86MiscSetSaver {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetSaver */
CARD16 length;
CARD16 screen;
CARD16 pad;
CARD32 suspendTime;
CARD32 offTime;
} xXF86MiscSetSaverReq;
#define sz_xXF86MiscSetSaverReq 16
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 suspendTime;
CARD32 offTime;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86MiscGetSaverReply;
#define sz_xXF86MiscGetSaverReply 32
#endif
typedef struct _XF86MiscGetMouseSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetMouseSettings */
CARD16 length;
} xXF86MiscGetMouseSettingsReq;
#define sz_xXF86MiscGetMouseSettingsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 mousetype;
CARD32 baudrate;
CARD32 samplerate;
CARD32 resolution;
CARD32 buttons;
BOOL emulate3buttons;
BOOL chordmiddle;
CARD16 pad2;
CARD32 emulate3timeout;
CARD32 flags;
CARD32 devnamelen; /* strlen(device)+1 */
} xXF86MiscGetMouseSettingsReply;
#define sz_xXF86MiscGetMouseSettingsReply 44
typedef struct _XF86MiscGetKbdSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetKbdSettings */
CARD16 length;
} xXF86MiscGetKbdSettingsReq;
#define sz_xXF86MiscGetKbdSettingsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 kbdtype;
CARD32 rate;
CARD32 delay;
BOOL servnumlock;
BOOL pad2;
CARD16 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86MiscGetKbdSettingsReply;
#define sz_xXF86MiscGetKbdSettingsReply 32
typedef struct _XF86MiscSetMouseSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetMouseSettings */
CARD16 length;
CARD32 mousetype;
CARD32 baudrate;
CARD32 samplerate;
CARD32 resolution;
CARD32 buttons;
BOOL emulate3buttons;
BOOL chordmiddle;
CARD16 devnamelen;
CARD32 emulate3timeout;
CARD32 flags;
} xXF86MiscSetMouseSettingsReq;
#define sz_xXF86MiscSetMouseSettingsReq 36
typedef struct _XF86MiscSetKbdSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */
CARD16 length;
CARD32 kbdtype;
CARD32 rate;
CARD32 delay;
BOOL servnumlock;
BOOL pad1;
CARD16 pad2;
} xXF86MiscSetKbdSettingsReq;
#define sz_xXF86MiscSetKbdSettingsReq 20
typedef struct _XF86MiscSetGrabKeysState {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */
CARD16 length;
BOOL enable;
BOOL pad1;
CARD16 pad2;
} xXF86MiscSetGrabKeysStateReq;
#define sz_xXF86MiscSetGrabKeysStateReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86MiscSetGrabKeysStateReply;
#define sz_xXF86MiscSetGrabKeysStateReply 32
typedef struct _XF86MiscSetClientVersion {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType;
CARD16 length;
CARD16 major;
CARD16 minor;
} xXF86MiscSetClientVersionReq;
#define sz_xXF86MiscSetClientVersionReq 8
typedef struct _XF86MiscGetFilePaths {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetFilePaths */
CARD16 length;
} xXF86MiscGetFilePathsReq;
#define sz_xXF86MiscGetFilePathsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 configlen;
CARD16 modulelen;
CARD16 loglen;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86MiscGetFilePathsReply;
#define sz_xXF86MiscGetFilePathsReply 32
typedef struct _XF86MiscPassMessage {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscPassMessage */
CARD16 length;
CARD16 typelen;
CARD16 vallen;
CARD16 screen;
CARD16 pad;
} xXF86MiscPassMessageReq;
#define sz_xXF86MiscPassMessageReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 mesglen;
CARD16 pad2;
CARD32 status;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86MiscPassMessageReply;
#define sz_xXF86MiscPassMessageReply 32
#endif /* _XF86MISCSTR_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _SECURPROTO_H
#define _SECURPROTO_H
#include <X11/extensions/secur.h>
#define X_SecurityQueryVersion 0
#define X_SecurityGenerateAuthorization 1
#define X_SecurityRevokeAuthorization 2
typedef struct {
CARD8 reqType;
CARD8 securityReqType;
CARD16 length;
CARD16 majorVersion;
CARD16 minorVersion;
} xSecurityQueryVersionReq;
#define sz_xSecurityQueryVersionReq 8
typedef struct {
CARD8 type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion;
CARD16 minorVersion;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xSecurityQueryVersionReply;
#define sz_xSecurityQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 securityReqType;
CARD16 length;
CARD16 nbytesAuthProto;
CARD16 nbytesAuthData;
CARD32 valueMask;
/* auth protocol name padded to 4 bytes */
/* auth protocol data padded to 4 bytes */
/* list of CARD32 values, if any */
} xSecurityGenerateAuthorizationReq;
#define sz_xSecurityGenerateAuthorizationReq 12
typedef struct {
CARD8 type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 authId;
CARD16 dataLength;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xSecurityGenerateAuthorizationReply;
#define sz_xSecurityGenerateAuthorizationReply 32
typedef struct {
CARD8 reqType;
CARD8 securityReqType;
CARD16 length;
CARD32 authId;
} xSecurityRevokeAuthorizationReq;
#define sz_xSecurityRevokeAuthorizationReq 8
typedef struct _xSecurityAuthorizationRevokedEvent {
BYTE type;
BYTE detail;
CARD16 sequenceNumber;
CARD32 authId;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xSecurityAuthorizationRevokedEvent;
#define sz_xSecurityAuthorizationRevokedEvent 32
#endif /* _SECURPROTO_H */
/*
Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XTESTPROTO_H_
#define _XTESTPROTO_H_
#include <X11/extensions/xtestconst.h>
#define Window CARD32
#define Time CARD32
#define Cursor CARD32
#define X_XTestGetVersion 0
#define X_XTestCompareCursor 1
#define X_XTestFakeInput 2
#define X_XTestGrabControl 3
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 xtReqType; /* always X_XTestGetVersion */
CARD16 length;
CARD8 majorVersion;
CARD8 pad;
CARD16 minorVersion;
} xXTestGetVersionReq;
#define sz_xXTestGetVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 majorVersion;
CARD16 sequenceNumber;
CARD32 length;
CARD16 minorVersion;
CARD16 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXTestGetVersionReply;
#define sz_xXTestGetVersionReply 32
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 xtReqType; /* always X_XTestCompareCursor */
CARD16 length;
Window window;
Cursor cursor;
} xXTestCompareCursorReq;
#define sz_xXTestCompareCursorReq 12
typedef struct {
BYTE type; /* X_Reply */
BOOL same;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXTestCompareCursorReply;
#define sz_xXTestCompareCursorReply 32
/* used only on the client side */
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 xtReqType; /* always X_XTestFakeInput */
CARD16 length;
BYTE type;
BYTE detail;
CARD16 pad0;
Time time;
Window root;
CARD32 pad1;
CARD32 pad2;
INT16 rootX, rootY;
CARD32 pad3;
CARD16 pad4;
CARD8 pad5;
CARD8 deviceid;
} xXTestFakeInputReq;
#define sz_xXTestFakeInputReq 36
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 xtReqType; /* always X_XTestGrabControl */
CARD16 length;
BOOL impervious;
CARD8 pad0;
CARD8 pad1;
CARD8 pad2;
} xXTestGrabControlReq;
#define sz_xXTestGrabControlReq 8
#undef Window
#undef Time
#undef Cursor
#endif /* _XTESTPROTO_H_ */
/***************************************************************************
* Copyright 1995 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Network Computing Devices
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
*
* NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE
* FOR ANY SPECIAL, 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.
**************************************************************************/
#ifndef _RECORDPROTO_H_
#define _RECORDPROTO_H_
#include <X11/extensions/recordconst.h>
/* only difference between 1.12 and 1.13 is byte order of device events,
which the library doesn't deal with. */
/*********************************************************
*
* Protocol request constants
*
*/
#define X_RecordQueryVersion 0 /* First request from client */
#define X_RecordCreateContext 1 /* Create client RC */
#define X_RecordRegisterClients 2 /* Add to client RC */
#define X_RecordUnregisterClients 3 /* Delete from client RC */
#define X_RecordGetContext 4 /* Query client RC */
#define X_RecordEnableContext 5 /* Enable interception and reporting */
#define X_RecordDisableContext 6 /* Disable interception and reporting */
#define X_RecordFreeContext 7 /* Free client RC */
#define sz_XRecordRange 32
#define sz_XRecordClientInfo 12
#define sz_XRecordState 16
#define sz_XRecordDatum 32
#define XRecordGlobaldef
#define XRecordGlobalref extern
#define RecordMaxEvent (128L-1L)
#define RecordMinDeviceEvent (2L)
#define RecordMaxDeviceEvent (6L)
#define RecordMaxError (256L-1L)
#define RecordMaxCoreRequest (128L-1L)
#define RecordMaxExtRequest (256L-1L)
#define RecordMinExtRequest (129L-1L)
#define RECORD_RC CARD32
#define RECORD_XIDBASE CARD32
#define RECORD_CLIENTSPEC CARD32
#define RECORD_ELEMENT_HEADER CARD8
typedef RECORD_CLIENTSPEC RecordClientSpec, *RecordClientSpecPtr;
typedef struct
{
CARD8 first;
CARD8 last;
} RECORD_RANGE8;
typedef struct
{
CARD16 first;
CARD16 last;
} RECORD_RANGE16;
typedef struct
{
RECORD_RANGE8 majorCode;
RECORD_RANGE16 minorCode;
} RECORD_EXTRANGE;
typedef struct
{
RECORD_RANGE8 coreRequests;
RECORD_RANGE8 coreReplies;
RECORD_EXTRANGE extRequests;
RECORD_EXTRANGE extReplies;
RECORD_RANGE8 deliveredEvents;
RECORD_RANGE8 deviceEvents;
RECORD_RANGE8 errors;
BOOL clientStarted;
BOOL clientDied;
} RECORDRANGE;
#define sz_RECORDRANGE 24
/* typedef RECORDRANGE xRecordRange, *xRecordRangePtr;
#define sz_xRecordRange 24 */
/* Cannot have structures within structures going over the wire */
typedef struct
{
CARD8 coreRequestsFirst;
CARD8 coreRequestsLast;
CARD8 coreRepliesFirst;
CARD8 coreRepliesLast;
CARD8 extRequestsMajorFirst;
CARD8 extRequestsMajorLast;
CARD16 extRequestsMinorFirst;
CARD16 extRequestsMinorLast;
CARD8 extRepliesMajorFirst;
CARD8 extRepliesMajorLast;
CARD16 extRepliesMinorFirst;
CARD16 extRepliesMinorLast;
CARD8 deliveredEventsFirst;
CARD8 deliveredEventsLast;
CARD8 deviceEventsFirst;
CARD8 deviceEventsLast;
CARD8 errorsFirst;
CARD8 errorsLast;
BOOL clientStarted;
BOOL clientDied;
} xRecordRange;
#define sz_xRecordRange 24
typedef struct
{
RECORD_CLIENTSPEC clientResource;
CARD32 nRanges;
/* LISTofRECORDRANGE */
} RECORD_CLIENT_INFO;
typedef RECORD_CLIENT_INFO xRecordClientInfo;
/*
* Initialize
*/
typedef struct {
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
CARD16 majorVersion;
CARD16 minorVersion;
} xRecordQueryVersionReq;
#define sz_xRecordQueryVersionReq 8
typedef struct
{
CARD8 type;
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion;
CARD16 minorVersion;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRecordQueryVersionReply;
#define sz_xRecordQueryVersionReply 32
/*
* Create RC
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
RECORD_ELEMENT_HEADER elementHeader;
CARD8 pad;
CARD16 pad0;
CARD32 nClients;
CARD32 nRanges;
/* LISTofRECORD_CLIENTSPEC */
/* LISTofRECORDRANGE */
} xRecordCreateContextReq;
#define sz_xRecordCreateContextReq 20
/*
* Add to RC
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
RECORD_ELEMENT_HEADER elementHeader;
CARD8 pad;
CARD16 pad0;
CARD32 nClients;
CARD32 nRanges;
/* LISTofRECORD_CLIENTSPEC */
/* LISTofRECORDRANGE */
} xRecordRegisterClientsReq;
#define sz_xRecordRegisterClientsReq 20
/*
* Delete from RC
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
CARD32 nClients;
/* LISTofRECORD_CLIENTSPEC */
} xRecordUnregisterClientsReq;
#define sz_xRecordUnregisterClientsReq 12
/*
* Query RC
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
} xRecordGetContextReq;
#define sz_xRecordGetContextReq 8
typedef struct
{
CARD8 type;
BOOL enabled;
CARD16 sequenceNumber;
CARD32 length;
RECORD_ELEMENT_HEADER elementHeader;
CARD8 pad;
CARD16 pad0;
CARD32 nClients;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
/* LISTofCLIENT_INFO */ /* intercepted-clients */
} xRecordGetContextReply;
#define sz_xRecordGetContextReply 32
/*
* Enable data interception
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
} xRecordEnableContextReq;
#define sz_xRecordEnableContextReq 8
typedef struct
{
CARD8 type;
CARD8 category;
CARD16 sequenceNumber;
CARD32 length;
RECORD_ELEMENT_HEADER elementHeader;
BOOL clientSwapped;
CARD16 pad1;
RECORD_XIDBASE idBase;
CARD32 serverTime;
CARD32 recordedSequenceNumber;
CARD32 pad3;
CARD32 pad4;
/* BYTE data; */
} xRecordEnableContextReply;
#define sz_xRecordEnableContextReply 32
/*
* Disable data interception
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
} xRecordDisableContextReq;
#define sz_xRecordDisableContextReq 8
/*
* Free RC
*/
typedef struct
{
CARD8 reqType;
CARD8 recordReqType;
CARD16 length;
RECORD_RC context;
} xRecordFreeContextReq;
#define sz_xRecordFreeContextReq 8
#undef RECORD_RC
#undef RECORD_XIDBASE
#undef RECORD_ELEMENT_HEADER
#undef RECORD_CLIENTSPEC
#endif
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XKBPROTO_H_
#define _XKBPROTO_H_
#include <X11/Xmd.h>
#include <X11/extensions/XKB.h>
#define Window CARD32
#define Atom CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2)
typedef struct _xkbUseExtension {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBUseExtension */
CARD16 length;
CARD16 wantedMajor;
CARD16 wantedMinor;
} xkbUseExtensionReq;
#define sz_xkbUseExtensionReq 8
typedef struct _xkbUseExtensionReply {
BYTE type; /* X_Reply */
BOOL supported;
CARD16 sequenceNumber;
CARD32 length;
CARD16 serverMajor;
CARD16 serverMinor;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xkbUseExtensionReply;
#define sz_xkbUseExtensionReply 32
typedef struct _xkbSelectEvents {
CARD8 reqType;
CARD8 xkbReqType; /* X_KBSelectEvents */
CARD16 length;
CARD16 deviceSpec;
CARD16 affectWhich;
CARD16 clear;
CARD16 selectAll;
CARD16 affectMap;
CARD16 map;
} xkbSelectEventsReq;
#define sz_xkbSelectEventsReq 16
typedef struct _xkbBell {
CARD8 reqType;
CARD8 xkbReqType; /* X_KBBell */
CARD16 length;
CARD16 deviceSpec;
CARD16 bellClass;
CARD16 bellID;
INT8 percent;
BOOL forceSound;
BOOL eventOnly;
CARD8 pad1;
INT16 pitch;
INT16 duration;
CARD16 pad2;
Atom name;
Window window;
} xkbBellReq;
#define sz_xkbBellReq 28
typedef struct _xkbGetState {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetState */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad;
} xkbGetStateReq;
#define sz_xkbGetStateReq 8
typedef struct _xkbGetStateReply {
BYTE type;
BYTE deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD8 mods;
CARD8 baseMods;
CARD8 latchedMods;
CARD8 lockedMods;
CARD8 group;
CARD8 lockedGroup;
INT16 baseGroup;
INT16 latchedGroup;
CARD8 compatState;
CARD8 grabMods;
CARD8 compatGrabMods;
CARD8 lookupMods;
CARD8 compatLookupMods;
CARD8 pad1;
CARD16 ptrBtnState;
CARD16 pad2;
CARD32 pad3;
} xkbGetStateReply;
#define sz_xkbGetStateReply 32
typedef struct _xkbLatchLockState {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBLatchLockState */
CARD16 length;
CARD16 deviceSpec;
CARD8 affectModLocks;
CARD8 modLocks;
BOOL lockGroup;
CARD8 groupLock;
CARD8 affectModLatches;
CARD8 modLatches;
CARD8 pad;
BOOL latchGroup;
INT16 groupLatch;
} xkbLatchLockStateReq;
#define sz_xkbLatchLockStateReq 16
typedef struct _xkbGetControls {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetControls */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad;
} xkbGetControlsReq;
#define sz_xkbGetControlsReq 8
typedef struct _xkbGetControlsReply {
BYTE type; /* X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD8 mkDfltBtn;
CARD8 numGroups;
CARD8 groupsWrap;
CARD8 internalMods;
CARD8 ignoreLockMods;
CARD8 internalRealMods;
CARD8 ignoreLockRealMods;
CARD8 pad1;
CARD16 internalVMods;
CARD16 ignoreLockVMods;
CARD16 repeatDelay;
CARD16 repeatInterval;
CARD16 slowKeysDelay;
CARD16 debounceDelay;
CARD16 mkDelay;
CARD16 mkInterval;
CARD16 mkTimeToMax;
CARD16 mkMaxSpeed;
INT16 mkCurve;
CARD16 axOptions;
CARD16 axTimeout;
CARD16 axtOptsMask;
CARD16 axtOptsValues;
CARD16 pad2;
CARD32 axtCtrlsMask;
CARD32 axtCtrlsValues;
CARD32 enabledCtrls;
BYTE perKeyRepeat[XkbPerKeyBitArraySize];
} xkbGetControlsReply;
#define sz_xkbGetControlsReply 92
typedef struct _xkbSetControls {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetControls */
CARD16 length;
CARD16 deviceSpec;
CARD8 affectInternalMods;
CARD8 internalMods;
CARD8 affectIgnoreLockMods;
CARD8 ignoreLockMods;
CARD16 affectInternalVMods;
CARD16 internalVMods;
CARD16 affectIgnoreLockVMods;
CARD16 ignoreLockVMods;
CARD8 mkDfltBtn;
CARD8 groupsWrap;
CARD16 axOptions;
CARD16 pad1;
CARD32 affectEnabledCtrls;
CARD32 enabledCtrls;
CARD32 changeCtrls;
CARD16 repeatDelay;
CARD16 repeatInterval;
CARD16 slowKeysDelay;
CARD16 debounceDelay;
CARD16 mkDelay;
CARD16 mkInterval;
CARD16 mkTimeToMax;
CARD16 mkMaxSpeed;
INT16 mkCurve;
CARD16 axTimeout;
CARD32 axtCtrlsMask;
CARD32 axtCtrlsValues;
CARD16 axtOptsMask;
CARD16 axtOptsValues;
BYTE perKeyRepeat[XkbPerKeyBitArraySize];
} xkbSetControlsReq;
#define sz_xkbSetControlsReq 100
typedef struct _xkbKTMapEntryWireDesc {
BOOL active;
CARD8 mask;
CARD8 level;
CARD8 realMods;
CARD16 virtualMods;
CARD16 pad;
} xkbKTMapEntryWireDesc;
#define sz_xkbKTMapEntryWireDesc 8
typedef struct _xkbKTSetMapEntryWireDesc {
CARD8 level;
CARD8 realMods;
CARD16 virtualMods;
} xkbKTSetMapEntryWireDesc;
#define sz_xkbKTSetMapEntryWireDesc 4
typedef struct _xkbModsWireDesc {
CARD8 mask; /* GetMap only */
CARD8 realMods;
CARD16 virtualMods;
} xkbModsWireDesc;
#define sz_xkbModsWireDesc 4
typedef struct _xkbKeyTypeWireDesc {
CARD8 mask;
CARD8 realMods;
CARD16 virtualMods;
CARD8 numLevels;
CARD8 nMapEntries;
BOOL preserve;
CARD8 pad;
} xkbKeyTypeWireDesc;
#define sz_xkbKeyTypeWireDesc 8
typedef struct _xkbSymMapWireDesc {
CARD8 ktIndex[XkbNumKbdGroups];
CARD8 groupInfo;
CARD8 width;
CARD16 nSyms;
} xkbSymMapWireDesc;
#define sz_xkbSymMapWireDesc 8
typedef struct _xkbVModMapWireDesc {
KeyCode key;
CARD8 pad;
CARD16 vmods;
} xkbVModMapWireDesc;
#define sz_xkbVModMapWireDesc 4
typedef struct _xkbBehaviorWireDesc {
CARD8 key;
CARD8 type;
CARD8 data;
CARD8 pad;
} xkbBehaviorWireDesc;
#define sz_xkbBehaviorWireDesc 4
typedef struct _xkbActionWireDesc {
CARD8 type;
CARD8 data[7];
} xkbActionWireDesc;
#define sz_xkbActionWireDesc 8
typedef struct _xkbGetMap {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetMap */
CARD16 length;
CARD16 deviceSpec;
CARD16 full;
CARD16 partial;
CARD8 firstType;
CARD8 nTypes;
KeyCode firstKeySym;
CARD8 nKeySyms;
KeyCode firstKeyAct;
CARD8 nKeyActs;
KeyCode firstKeyBehavior;
CARD8 nKeyBehaviors;
CARD16 virtualMods;
KeyCode firstKeyExplicit;
CARD8 nKeyExplicit;
KeyCode firstModMapKey;
CARD8 nModMapKeys;
KeyCode firstVModMapKey;
CARD8 nVModMapKeys;
CARD16 pad1;
} xkbGetMapReq;
#define sz_xkbGetMapReq 28
typedef struct _xkbGetMapReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD16 pad1;
KeyCode minKeyCode;
KeyCode maxKeyCode;
CARD16 present;
CARD8 firstType;
CARD8 nTypes;
CARD8 totalTypes;
KeyCode firstKeySym;
CARD16 totalSyms;
CARD8 nKeySyms;
KeyCode firstKeyAct;
CARD16 totalActs;
CARD8 nKeyActs;
KeyCode firstKeyBehavior;
CARD8 nKeyBehaviors;
CARD8 totalKeyBehaviors;
KeyCode firstKeyExplicit;
CARD8 nKeyExplicit;
CARD8 totalKeyExplicit;
KeyCode firstModMapKey;
CARD8 nModMapKeys;
CARD8 totalModMapKeys;
KeyCode firstVModMapKey;
CARD8 nVModMapKeys;
CARD8 totalVModMapKeys;
CARD8 pad2;
CARD16 virtualMods;
} xkbGetMapReply;
#define sz_xkbGetMapReply 40
#define XkbSetMapResizeTypes (1L<<0)
#define XkbSetMapRecomputeActions (1L<<1)
#define XkbSetMapAllFlags (0x3)
typedef struct _xkbSetMap {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetMap */
CARD16 length;
CARD16 deviceSpec;
CARD16 present;
CARD16 flags;
KeyCode minKeyCode;
KeyCode maxKeyCode;
CARD8 firstType;
CARD8 nTypes;
KeyCode firstKeySym;
CARD8 nKeySyms;
CARD16 totalSyms;
KeyCode firstKeyAct;
CARD8 nKeyActs;
CARD16 totalActs;
KeyCode firstKeyBehavior;
CARD8 nKeyBehaviors;
CARD8 totalKeyBehaviors;
KeyCode firstKeyExplicit;
CARD8 nKeyExplicit;
CARD8 totalKeyExplicit;
KeyCode firstModMapKey;
CARD8 nModMapKeys;
CARD8 totalModMapKeys;
KeyCode firstVModMapKey;
CARD8 nVModMapKeys;
CARD8 totalVModMapKeys;
CARD16 virtualMods;
} xkbSetMapReq;
#define sz_xkbSetMapReq 36
typedef struct _xkbSymInterpretWireDesc {
CARD32 sym;
CARD8 mods;
CARD8 match;
CARD8 virtualMod;
CARD8 flags;
xkbActionWireDesc act;
} xkbSymInterpretWireDesc;
#define sz_xkbSymInterpretWireDesc 16
typedef struct _xkbGetCompatMap {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetCompatMap */
CARD16 length;
CARD16 deviceSpec;
CARD8 groups;
BOOL getAllSI;
CARD16 firstSI;
CARD16 nSI;
} xkbGetCompatMapReq;
#define sz_xkbGetCompatMapReq 12
typedef struct _xkbGetCompatMapReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD8 groups;
CARD8 pad1;
CARD16 firstSI;
CARD16 nSI;
CARD16 nTotalSI;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xkbGetCompatMapReply;
#define sz_xkbGetCompatMapReply 32
typedef struct _xkbSetCompatMap {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetCompatMap */
CARD16 length;
CARD16 deviceSpec;
CARD8 pad1;
BOOL recomputeActions;
BOOL truncateSI;
CARD8 groups;
CARD16 firstSI;
CARD16 nSI;
CARD16 pad2;
} xkbSetCompatMapReq;
#define sz_xkbSetCompatMapReq 16
typedef struct _xkbGetIndicatorState {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetIndicatorState */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad1;
} xkbGetIndicatorStateReq;
#define sz_xkbGetIndicatorStateReq 8
typedef struct _xkbGetIndicatorStateReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD32 state;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xkbGetIndicatorStateReply;
#define sz_xkbGetIndicatorStateReply 32
typedef struct _xkbGetIndicatorMap {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetIndicatorMap */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad;
CARD32 which;
} xkbGetIndicatorMapReq;
#define sz_xkbGetIndicatorMapReq 12
typedef struct _xkbGetIndicatorMapReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD32 which;
CARD32 realIndicators;
CARD8 nIndicators;
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xkbGetIndicatorMapReply;
#define sz_xkbGetIndicatorMapReply 32
typedef struct _xkbIndicatorMapWireDesc {
CARD8 flags;
CARD8 whichGroups;
CARD8 groups;
CARD8 whichMods;
CARD8 mods;
CARD8 realMods;
CARD16 virtualMods;
CARD32 ctrls;
} xkbIndicatorMapWireDesc;
#define sz_xkbIndicatorMapWireDesc 12
typedef struct _xkbSetIndicatorMap {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetIndicatorMap */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad1;
CARD32 which;
} xkbSetIndicatorMapReq;
#define sz_xkbSetIndicatorMapReq 12
typedef struct _xkbGetNamedIndicator {
CARD8 reqType;
CARD8 xkbReqType; /* X_KBGetNamedIndicator */
CARD16 length;
CARD16 deviceSpec;
CARD16 ledClass;
CARD16 ledID;
CARD16 pad1;
Atom indicator;
} xkbGetNamedIndicatorReq;
#define sz_xkbGetNamedIndicatorReq 16
typedef struct _xkbGetNamedIndicatorReply {
BYTE type;
BYTE deviceID;
CARD16 sequenceNumber;
CARD32 length;
Atom indicator;
BOOL found;
BOOL on;
BOOL realIndicator;
CARD8 ndx;
CARD8 flags;
CARD8 whichGroups;
CARD8 groups;
CARD8 whichMods;
CARD8 mods;
CARD8 realMods;
CARD16 virtualMods;
CARD32 ctrls;
BOOL supported;
CARD8 pad1;
CARD16 pad2;
} xkbGetNamedIndicatorReply;
#define sz_xkbGetNamedIndicatorReply 32
typedef struct _xkbSetNamedIndicator {
CARD8 reqType;
CARD8 xkbReqType; /* X_KBSetNamedIndicator */
CARD16 length;
CARD16 deviceSpec;
CARD16 ledClass;
CARD16 ledID;
CARD16 pad1;
Atom indicator;
BOOL setState;
BOOL on;
BOOL setMap;
BOOL createMap;
CARD8 pad2;
CARD8 flags;
CARD8 whichGroups;
CARD8 groups;
CARD8 whichMods;
CARD8 realMods;
CARD16 virtualMods;
CARD32 ctrls;
} xkbSetNamedIndicatorReq;
#define sz_xkbSetNamedIndicatorReq 32
typedef struct _xkbGetNames {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetNames */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad;
CARD32 which;
} xkbGetNamesReq;
#define sz_xkbGetNamesReq 12
typedef struct _xkbGetNamesReply {
BYTE type;
BYTE deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD32 which;
KeyCode minKeyCode;
KeyCode maxKeyCode;
CARD8 nTypes;
CARD8 groupNames;
CARD16 virtualMods;
KeyCode firstKey;
CARD8 nKeys;
CARD32 indicators;
CARD8 nRadioGroups;
CARD8 nKeyAliases;
CARD16 nKTLevels;
CARD32 pad3;
} xkbGetNamesReply;
#define sz_xkbGetNamesReply 32
typedef struct _xkbSetNames {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetNames */
CARD16 length;
CARD16 deviceSpec;
CARD16 virtualMods;
CARD32 which;
CARD8 firstType;
CARD8 nTypes;
CARD8 firstKTLevel;
CARD8 nKTLevels;
CARD32 indicators;
CARD8 groupNames;
CARD8 nRadioGroups;
KeyCode firstKey;
CARD8 nKeys;
CARD8 nKeyAliases;
CARD8 pad1;
CARD16 totalKTLevelNames;
} xkbSetNamesReq;
#define sz_xkbSetNamesReq 28
typedef struct _xkbPointWireDesc {
INT16 x;
INT16 y;
} xkbPointWireDesc;
#define sz_xkbPointWireDesc 4
typedef struct _xkbOutlineWireDesc {
CARD8 nPoints;
CARD8 cornerRadius;
CARD16 pad;
} xkbOutlineWireDesc;
#define sz_xkbOutlineWireDesc 4
typedef struct _xkbShapeWireDesc {
Atom name;
CARD8 nOutlines;
CARD8 primaryNdx;
CARD8 approxNdx;
CARD8 pad;
} xkbShapeWireDesc;
#define sz_xkbShapeWireDesc 8
typedef struct _xkbSectionWireDesc {
Atom name;
INT16 top;
INT16 left;
CARD16 width;
CARD16 height;
INT16 angle;
CARD8 priority;
CARD8 nRows;
CARD8 nDoodads;
CARD8 nOverlays;
CARD16 pad;
} xkbSectionWireDesc;
#define sz_xkbSectionWireDesc 20
typedef struct _xkbRowWireDesc {
INT16 top;
INT16 left;
CARD8 nKeys;
BOOL vertical;
CARD16 pad;
} xkbRowWireDesc;
#define sz_xkbRowWireDesc 8
typedef struct _xkbKeyWireDesc {
CARD8 name[XkbKeyNameLength];
INT16 gap;
CARD8 shapeNdx;
CARD8 colorNdx;
} xkbKeyWireDesc;
#define sz_xkbKeyWireDesc 8
typedef struct _xkbOverlayWireDesc {
Atom name;
CARD8 nRows;
CARD8 pad1;
CARD16 pad2;
} xkbOverlayWireDesc;
#define sz_xkbOverlayWireDesc 8
typedef struct _xkbOverlayRowWireDesc {
CARD8 rowUnder;
CARD8 nKeys;
CARD16 pad1;
} xkbOverlayRowWireDesc;
#define sz_xkbOverlayRowWireDesc 4
typedef struct _xkbOverlayKeyWireDesc {
CARD8 over[XkbKeyNameLength];
CARD8 under[XkbKeyNameLength];
} xkbOverlayKeyWireDesc;
#define sz_xkbOverlayKeyWireDesc 8
typedef struct _xkbShapeDoodadWireDesc {
Atom name;
CARD8 type;
CARD8 priority;
INT16 top;
INT16 left;
INT16 angle;
CARD8 colorNdx;
CARD8 shapeNdx;
CARD16 pad1;
CARD32 pad2;
} xkbShapeDoodadWireDesc;
#define sz_xkbShapeDoodadWireDesc 20
typedef struct _xkbTextDoodadWireDesc {
Atom name;
CARD8 type;
CARD8 priority;
INT16 top;
INT16 left;
INT16 angle;
CARD16 width;
CARD16 height;
CARD8 colorNdx;
CARD8 pad1;
CARD16 pad2;
} xkbTextDoodadWireDesc;
#define sz_xkbTextDoodadWireDesc 20
typedef struct _xkbIndicatorDoodadWireDesc {
Atom name;
CARD8 type;
CARD8 priority;
INT16 top;
INT16 left;
INT16 angle;
CARD8 shapeNdx;
CARD8 onColorNdx;
CARD8 offColorNdx;
CARD8 pad1;
CARD32 pad2;
} xkbIndicatorDoodadWireDesc;
#define sz_xkbIndicatorDoodadWireDesc 20
typedef struct _xkbLogoDoodadWireDesc {
Atom name;
CARD8 type;
CARD8 priority;
INT16 top;
INT16 left;
INT16 angle;
CARD8 colorNdx;
CARD8 shapeNdx;
CARD16 pad1;
CARD32 pad2;
} xkbLogoDoodadWireDesc;
#define sz_xkbLogoDoodadWireDesc 20
typedef struct _xkbAnyDoodadWireDesc {
Atom name;
CARD8 type;
CARD8 priority;
INT16 top;
INT16 left;
INT16 angle;
CARD32 pad2;
CARD32 pad3;
} xkbAnyDoodadWireDesc;
#define sz_xkbAnyDoodadWireDesc 20
typedef union _xkbDoodadWireDesc {
xkbAnyDoodadWireDesc any;
xkbShapeDoodadWireDesc shape;
xkbTextDoodadWireDesc text;
xkbIndicatorDoodadWireDesc indicator;
xkbLogoDoodadWireDesc logo;
} xkbDoodadWireDesc;
#define sz_xkbDoodadWireDesc 20
typedef struct _xkbGetGeometry {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetGeometry */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad;
Atom name;
} xkbGetGeometryReq;
#define sz_xkbGetGeometryReq 12
typedef struct _xkbGetGeometryReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
Atom name;
BOOL found;
CARD8 pad;
CARD16 widthMM;
CARD16 heightMM;
CARD16 nProperties;
CARD16 nColors;
CARD16 nShapes;
CARD16 nSections;
CARD16 nDoodads;
CARD16 nKeyAliases;
CARD8 baseColorNdx;
CARD8 labelColorNdx;
} xkbGetGeometryReply;
#define sz_xkbGetGeometryReply 32
typedef struct _xkbSetGeometry {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetGeometry */
CARD16 length;
CARD16 deviceSpec;
CARD8 nShapes;
CARD8 nSections;
Atom name;
CARD16 widthMM;
CARD16 heightMM;
CARD16 nProperties;
CARD16 nColors;
CARD16 nDoodads;
CARD16 nKeyAliases;
CARD8 baseColorNdx;
CARD8 labelColorNdx;
CARD16 pad;
} xkbSetGeometryReq;
#define sz_xkbSetGeometryReq 28
typedef struct _xkbPerClientFlags {
CARD8 reqType;
CARD8 xkbReqType;/* always X_KBPerClientFlags */
CARD16 length;
CARD16 deviceSpec;
CARD16 pad1;
CARD32 change;
CARD32 value;
CARD32 ctrlsToChange;
CARD32 autoCtrls;
CARD32 autoCtrlValues;
} xkbPerClientFlagsReq;
#define sz_xkbPerClientFlagsReq 28
typedef struct _xkbPerClientFlagsReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD32 supported;
CARD32 value;
CARD32 autoCtrls;
CARD32 autoCtrlValues;
CARD32 pad1;
CARD32 pad2;
} xkbPerClientFlagsReply;
#define sz_xkbPerClientFlagsReply 32
typedef struct _xkbListComponents {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBListComponents */
CARD16 length;
CARD16 deviceSpec;
CARD16 maxNames;
} xkbListComponentsReq;
#define sz_xkbListComponentsReq 8
typedef struct _xkbListComponentsReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD16 nKeymaps;
CARD16 nKeycodes;
CARD16 nTypes;
CARD16 nCompatMaps;
CARD16 nSymbols;
CARD16 nGeometries;
CARD16 extra;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
} xkbListComponentsReply;
#define sz_xkbListComponentsReply 32
typedef struct _xkbGetKbdByName {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetKbdByName */
CARD16 length;
CARD16 deviceSpec;
CARD16 need; /* combination of XkbGBN_* */
CARD16 want; /* combination of XkbGBN_* */
BOOL load;
CARD8 pad;
} xkbGetKbdByNameReq;
#define sz_xkbGetKbdByNameReq 12
typedef struct _xkbGetKbdByNameReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
KeyCode minKeyCode;
KeyCode maxKeyCode;
BOOL loaded;
BOOL newKeyboard;
CARD16 found; /* combination of XkbGBN_* */
CARD16 reported; /* combination of XkbAllComponents */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xkbGetKbdByNameReply;
#define sz_xkbGetKbdByNameReply 32
typedef struct _xkbDeviceLedsWireDesc {
CARD16 ledClass;
CARD16 ledID;
CARD32 namesPresent;
CARD32 mapsPresent;
CARD32 physIndicators;
CARD32 state;
} xkbDeviceLedsWireDesc;
#define sz_xkbDeviceLedsWireDesc 20
typedef struct _xkbGetDeviceInfo {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBGetDeviceInfo */
CARD16 length;
CARD16 deviceSpec;
CARD16 wanted;
BOOL allBtns;
CARD8 firstBtn;
CARD8 nBtns;
CARD8 pad;
CARD16 ledClass;
CARD16 ledID;
} xkbGetDeviceInfoReq;
#define sz_xkbGetDeviceInfoReq 16
typedef struct _xkbGetDeviceInfoReply {
CARD8 type; /* always X_Reply */
CARD8 deviceID;
CARD16 sequenceNumber;
CARD32 length;
CARD16 present;
CARD16 supported;
CARD16 unsupported;
CARD16 nDeviceLedFBs;
CARD8 firstBtnWanted;
CARD8 nBtnsWanted;
CARD8 firstBtnRtrn;
CARD8 nBtnsRtrn;
CARD8 totalBtns;
BOOL hasOwnState;
CARD16 dfltKbdFB;
CARD16 dfltLedFB;
CARD16 pad;
Atom devType;
} xkbGetDeviceInfoReply;
#define sz_xkbGetDeviceInfoReply 32
typedef struct _xkbSetDeviceInfo {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetDeviceInfo */
CARD16 length;
CARD16 deviceSpec;
CARD8 firstBtn;
CARD8 nBtns;
CARD16 change;
CARD16 nDeviceLedFBs;
} xkbSetDeviceInfoReq;
#define sz_xkbSetDeviceInfoReq 12
typedef struct _xkbSetDebuggingFlags {
CARD8 reqType;
CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */
CARD16 length;
CARD16 msgLength;
CARD16 pad;
CARD32 affectFlags;
CARD32 flags;
CARD32 affectCtrls;
CARD32 ctrls;
} xkbSetDebuggingFlagsReq;
#define sz_xkbSetDebuggingFlagsReq 24
typedef struct _xkbSetDebuggingFlagsReply {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 currentFlags;
CARD32 currentCtrls;
CARD32 supportedFlags;
CARD32 supportedCtrls;
CARD32 pad1;
CARD32 pad2;
} xkbSetDebuggingFlagsReply;
#define sz_xkbSetDebuggingFlagsReply 32
/*
* X KEYBOARD EXTENSION EVENT STRUCTURES
*/
typedef struct _xkbAnyEvent {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xkbAnyEvent;
#define sz_xkbAnyEvent 32
typedef struct _xkbNewKeyboardNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 oldDeviceID;
KeyCode minKeyCode;
KeyCode maxKeyCode;
KeyCode oldMinKeyCode;
KeyCode oldMaxKeyCode;
CARD8 requestMajor;
CARD8 requestMinor;
CARD16 changed;
CARD8 detail;
CARD8 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xkbNewKeyboardNotify;
#define sz_xkbNewKeyboardNotify 32
typedef struct _xkbMapNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 ptrBtnActions;
CARD16 changed;
KeyCode minKeyCode;
KeyCode maxKeyCode;
CARD8 firstType;
CARD8 nTypes;
KeyCode firstKeySym;
CARD8 nKeySyms;
KeyCode firstKeyAct;
CARD8 nKeyActs;
KeyCode firstKeyBehavior;
CARD8 nKeyBehaviors;
KeyCode firstKeyExplicit;
CARD8 nKeyExplicit;
KeyCode firstModMapKey;
CARD8 nModMapKeys;
KeyCode firstVModMapKey;
CARD8 nVModMapKeys;
CARD16 virtualMods;
CARD16 pad1;
} xkbMapNotify;
#define sz_xkbMapNotify 32
typedef struct _xkbStateNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 mods;
CARD8 baseMods;
CARD8 latchedMods;
CARD8 lockedMods;
CARD8 group;
INT16 baseGroup;
INT16 latchedGroup;
CARD8 lockedGroup;
CARD8 compatState;
CARD8 grabMods;
CARD8 compatGrabMods;
CARD8 lookupMods;
CARD8 compatLookupMods;
CARD16 ptrBtnState;
CARD16 changed;
KeyCode keycode;
CARD8 eventType;
CARD8 requestMajor;
CARD8 requestMinor;
} xkbStateNotify;
#define sz_xkbStateNotify 32
typedef struct _xkbControlsNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 numGroups;
CARD16 pad1;
CARD32 changedControls;
CARD32 enabledControls;
CARD32 enabledControlChanges;
KeyCode keycode;
CARD8 eventType;
CARD8 requestMajor;
CARD8 requestMinor;
CARD32 pad2;
} xkbControlsNotify;
#define sz_xkbControlsNotify 32
typedef struct _xkbIndicatorNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 pad1;
CARD16 pad2;
CARD32 state;
CARD32 changed;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xkbIndicatorNotify;
#define sz_xkbIndicatorNotify 32
typedef struct _xkbNamesNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 pad1;
CARD16 changed;
CARD8 firstType;
CARD8 nTypes;
CARD8 firstLevelName;
CARD8 nLevelNames;
CARD8 pad2;
CARD8 nRadioGroups;
CARD8 nAliases;
CARD8 changedGroupNames;
CARD16 changedVirtualMods;
CARD8 firstKey;
CARD8 nKeys;
CARD32 changedIndicators;
CARD32 pad3;
} xkbNamesNotify;
#define sz_xkbNamesNotify 32
typedef struct _xkbCompatMapNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 changedGroups;
CARD16 firstSI;
CARD16 nSI;
CARD16 nTotalSI;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xkbCompatMapNotify;
#define sz_xkbCompatMapNotify 32
typedef struct _xkbBellNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 bellClass;
CARD8 bellID;
CARD8 percent;
CARD16 pitch;
CARD16 duration;
Atom name;
Window window;
BOOL eventOnly;
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
} xkbBellNotify;
#define sz_xkbBellNotify 32
typedef struct _xkbActionMessage {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
KeyCode keycode;
BOOL press;
BOOL keyEventFollows;
CARD8 mods;
CARD8 group;
CARD8 message[8];
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
} xkbActionMessage;
#define sz_xkbActionMessage 32
typedef struct _xkbAccessXNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
KeyCode keycode;
CARD16 detail;
CARD16 slowKeysDelay;
CARD16 debounceDelay;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xkbAccessXNotify;
#define sz_xkbAccessXNotify 32
typedef struct _xkbExtensionDeviceNotify {
BYTE type;
BYTE xkbType;
CARD16 sequenceNumber;
Time time;
CARD8 deviceID;
CARD8 pad1;
CARD16 reason;
CARD16 ledClass;
CARD16 ledID;
CARD32 ledsDefined;
CARD32 ledState;
CARD8 firstBtn;
CARD8 nBtns;
CARD16 supported;
CARD16 unsupported;
CARD16 pad3;
} xkbExtensionDeviceNotify;
#define sz_xkbExtensionDeviceNotify 32
typedef struct _xkbEvent {
union {
xkbAnyEvent any;
xkbNewKeyboardNotify new_kbd;
xkbMapNotify map;
xkbStateNotify state;
xkbControlsNotify ctrls;
xkbIndicatorNotify indicators;
xkbNamesNotify names;
xkbCompatMapNotify compat;
xkbBellNotify bell;
xkbActionMessage message;
xkbAccessXNotify accessx;
xkbExtensionDeviceNotify device;
} u;
} xkbEvent;
#define sz_xkbEvent 32
#undef Window
#undef Atom
#undef Time
#undef KeyCode
#undef KeySym
#endif /* _XKBPROTO_H_ */
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _MULTIBUFPROTO_H_
#define _MULTIBUFPROTO_H_
#include <X11/extensions/multibufconst.h>
/*
* Protocol requests constants and alignment values
*/
#define Window CARD32
#define Drawable CARD32
#define VisualID CARD32
#define Multibuffer CARD32
#define X_MbufGetBufferVersion 0
#define X_MbufCreateImageBuffers 1
#define X_MbufDestroyImageBuffers 2
#define X_MbufDisplayImageBuffers 3
#define X_MbufSetMBufferAttributes 4
#define X_MbufGetMBufferAttributes 5
#define X_MbufSetBufferAttributes 6
#define X_MbufGetBufferAttributes 7
#define X_MbufGetBufferInfo 8
#define X_MbufCreateStereoWindow 9
#define X_MbufClearImageBufferArea 10
typedef struct xMbufBufferInfo {
CARD32 visualID; /* associated visual */
CARD16 maxBuffers; /* maximum supported buffers */
CARD8 depth; /* depth of visual (redundant) */
CARD8 unused;
} xMbufBufferInfo;
#define sz_xMbufBufferInfo 8
typedef struct {
BYTE type;
BYTE unused;
CARD16 sequenceNumber;
CARD32 buffer; /* affected buffer */
BYTE state; /* current status */
CARD8 unused1;
CARD16 unused2;
CARD32 unused3;
CARD32 unused4;
CARD32 unused5;
CARD32 unused6;
CARD32 unused7;
} xMbufClobberNotifyEvent;
typedef struct {
BYTE type;
BYTE unused;
CARD16 sequenceNumber;
CARD32 buffer; /* affected buffer */
CARD32 timeStamp; /* update time */
CARD32 unused1;
CARD32 unused2;
CARD32 unused3;
CARD32 unused4;
CARD32 unused5;
CARD32 unused6;
} xMbufUpdateNotifyEvent;
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetBufferVersion */
CARD16 length;
} xMbufGetBufferVersionReq;
#define sz_xMbufGetBufferVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD8 majorVersion; /* major version of Multi-Buffering protocol */
CARD8 minorVersion; /* minor version of Multi-Buffering protocol */
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xMbufGetBufferVersionReply;
#define sz_xMbufGetBufferVersionReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufCreateImageBuffers */
CARD16 length;
CARD32 window; /* associated window */
CARD8 updateAction; /* action at update */
CARD8 updateHint; /* hint as to frequency of updates */
CARD16 unused;
} xMbufCreateImageBuffersReq; /* followed by buffer ids */
#define sz_xMbufCreateImageBuffersReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD16 numberBuffer; /* number successfully allocated */
CARD16 unused1;
CARD32 unused2;
CARD32 unused3;
CARD32 unused4;
CARD32 unused5;
CARD32 unused6;
} xMbufCreateImageBuffersReply;
#define sz_xMbufCreateImageBuffersReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufDestroyImageBuffers */
CARD16 length;
CARD32 window; /* associated window */
} xMbufDestroyImageBuffersReq;
#define sz_xMbufDestroyImageBuffersReq 8
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufDisplayImageBuffers */
CARD16 length;
CARD16 minDelay; /* minimum time between last update and now */
CARD16 maxDelay; /* maximum time between last update and now */
} xMbufDisplayImageBuffersReq; /* followed by list of buffers */
#define sz_xMbufDisplayImageBuffersReq 8
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufSetMBufferAttributes */
CARD16 length;
CARD32 window; /* associated window */
CARD32 valueMask; /* modified entries */
} xMbufSetMBufferAttributesReq; /* followed by values */
#define sz_xMbufSetMBufferAttributesReq 12
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetMBufferAttributes */
CARD16 length;
CARD32 window; /* associated window */
} xMbufGetMBufferAttributesReq;
#define sz_xMbufGetMBufferAttributesReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD16 displayedBuffer; /* currently visible buffer */
CARD8 updateAction;
CARD8 updateHint;
CARD8 windowMode;
CARD8 unused0;
CARD16 unused1;
CARD32 unused2;
CARD32 unused3;
CARD32 unused4;
CARD32 unused5;
} xMbufGetMBufferAttributesReply;
#define sz_xMbufGetMBufferAttributesReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufSetBufferAttributes */
CARD16 length;
CARD32 buffer;
CARD32 valueMask;
} xMbufSetBufferAttributesReq; /* followed by values */
#define sz_xMbufSetBufferAttributesReq 12
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetBufferAttributes */
CARD16 length;
CARD32 buffer;
} xMbufGetBufferAttributesReq;
#define sz_xMbufGetBufferAttributesReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD32 window;
CARD32 eventMask;
CARD16 bufferIndex;
CARD8 side;
CARD8 unused0;
CARD32 unused1;
CARD32 unused2;
CARD32 unused3;
} xMbufGetBufferAttributesReply;
#define sz_xMbufGetBufferAttributesReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetBufferInfo */
CARD16 length;
Drawable drawable;
} xMbufGetBufferInfoReq;
#define sz_xMbufGetBufferInfoReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD16 normalInfo;
CARD16 stereoInfo;
CARD32 unused1;
CARD32 unused2;
CARD32 unused3;
CARD32 unused4;
CARD32 unused5;
} xMbufGetBufferInfoReply; /* followed by buffer infos */
#define sz_xMbufGetBufferInfoReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufCreateStereoWindow */
CARD16 length;
CARD8 unused0;
CARD8 unused1;
CARD8 unused2;
CARD8 depth;
Window wid;
Window parent;
Multibuffer left; /* associated buffers */
Multibuffer right;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
CARD16 borderWidth;
#if defined(__cplusplus) || defined(c_plusplus)
CARD16 c_class;
#else
CARD16 class;
#endif
VisualID visual;
CARD32 mask;
} xMbufCreateStereoWindowReq; /* followed by value list */
#define sz_xMbufCreateStereoWindowReq 44
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufClearImageBufferArea */
CARD16 length;
Multibuffer buffer;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
CARD8 unused0;
CARD8 unused1;
CARD8 unused2;
BOOL exposures;
} xMbufClearImageBufferAreaReq;
#define sz_xMbufClearImageBufferAreaReq 20
#undef Window
#undef Drawable
#undef VisualID
#undef Multibuffer
#endif /* _MULTIBUFPROTO_H_ */
/*
* Copyright © 2008 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL 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 PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
*/
#ifndef _DRI2_PROTO_H_
#define _DRI2_PROTO_H_
#define DRI2_NAME "DRI2"
#define DRI2_MAJOR 1
#define DRI2_MINOR 4
#define DRI2NumberErrors 0
#define DRI2NumberEvents 2
#define DRI2NumberRequests 14
#define X_DRI2QueryVersion 0
#define X_DRI2Connect 1
#define X_DRI2Authenticate 2
#define X_DRI2CreateDrawable 3
#define X_DRI2DestroyDrawable 4
#define X_DRI2GetBuffers 5
#define X_DRI2CopyRegion 6
#define X_DRI2GetBuffersWithFormat 7
#define X_DRI2SwapBuffers 8
#define X_DRI2GetMSC 9
#define X_DRI2WaitMSC 10
#define X_DRI2WaitSBC 11
#define X_DRI2SwapInterval 12
#define X_DRI2GetParam 13
/*
* Events
*/
#define DRI2_BufferSwapComplete 0
#define DRI2_InvalidateBuffers 1
typedef struct {
CARD32 attachment;
CARD32 name;
CARD32 pitch;
CARD32 cpp;
CARD32 flags;
} xDRI2Buffer;
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xDRI2QueryVersionReq;
#define sz_xDRI2QueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDRI2QueryVersionReply;
#define sz_xDRI2QueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 window;
CARD32 driverType;
} xDRI2ConnectReq;
#define sz_xDRI2ConnectReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 driverNameLength;
CARD32 deviceNameLength;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDRI2ConnectReply;
#define sz_xDRI2ConnectReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 window;
CARD32 magic;
} xDRI2AuthenticateReq;
#define sz_xDRI2AuthenticateReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 authenticated;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xDRI2AuthenticateReply;
#define sz_xDRI2AuthenticateReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
} xDRI2CreateDrawableReq;
#define sz_xDRI2CreateDrawableReq 8
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
} xDRI2DestroyDrawableReq;
#define sz_xDRI2DestroyDrawableReq 8
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 count;
} xDRI2GetBuffersReq;
#define sz_xDRI2GetBuffersReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 width;
CARD32 height;
CARD32 count;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDRI2GetBuffersReply;
#define sz_xDRI2GetBuffersReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 region;
CARD32 dest;
CARD32 src;
} xDRI2CopyRegionReq;
#define sz_xDRI2CopyRegionReq 20
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xDRI2CopyRegionReply;
#define sz_xDRI2CopyRegionReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 target_msc_hi;
CARD32 target_msc_lo;
CARD32 divisor_hi;
CARD32 divisor_lo;
CARD32 remainder_hi;
CARD32 remainder_lo;
} xDRI2SwapBuffersReq;
#define sz_xDRI2SwapBuffersReq 32
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 swap_hi;
CARD32 swap_lo;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDRI2SwapBuffersReply;
#define sz_xDRI2SwapBuffersReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
} xDRI2GetMSCReq;
#define sz_xDRI2GetMSCReq 8
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 target_msc_hi;
CARD32 target_msc_lo;
CARD32 divisor_hi;
CARD32 divisor_lo;
CARD32 remainder_hi;
CARD32 remainder_lo;
} xDRI2WaitMSCReq;
#define sz_xDRI2WaitMSCReq 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 target_sbc_hi;
CARD32 target_sbc_lo;
} xDRI2WaitSBCReq;
#define sz_xDRI2WaitSBCReq 16
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 ust_hi;
CARD32 ust_lo;
CARD32 msc_hi;
CARD32 msc_lo;
CARD32 sbc_hi;
CARD32 sbc_lo;
} xDRI2MSCReply;
#define sz_xDRI2MSCReply 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 interval;
} xDRI2SwapIntervalReq;
#define sz_xDRI2SwapIntervalReq 12
typedef struct {
CARD8 type;
CARD8 pad;
CARD16 sequenceNumber;
CARD16 event_type;
CARD16 pad2;
CARD32 drawable;
CARD32 ust_hi;
CARD32 ust_lo;
CARD32 msc_hi;
CARD32 msc_lo;
CARD32 sbc_hi;
CARD32 sbc_lo;
} xDRI2BufferSwapComplete;
#define sz_xDRI2BufferSwapComplete 32
typedef struct {
CARD8 type;
CARD8 pad;
CARD16 sequenceNumber;
CARD16 event_type;
CARD16 pad2;
CARD32 drawable;
CARD32 ust_hi;
CARD32 ust_lo;
CARD32 msc_hi;
CARD32 msc_lo;
CARD32 sbc;
} xDRI2BufferSwapComplete2;
#define sz_xDRI2BufferSwapComplete2 32
typedef struct {
CARD8 type;
CARD8 pad;
CARD16 sequenceNumber;
CARD32 drawable;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xDRI2InvalidateBuffers;
#define sz_xDRI2InvalidateBuffers 32
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length;
CARD32 drawable;
CARD32 param;
} xDRI2GetParamReq;
#define sz_xDRI2GetParamReq 12
typedef struct {
BYTE type; /*X_Reply*/
BOOL is_param_recognized;
CARD16 sequenceNumber;
CARD32 length;
CARD32 value_hi;
CARD32 value_lo;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xDRI2GetParamReply;
#define sz_xDRI2GetParamReply 32
#endif
#warning "xf86dgastr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/xf86dgaproto.h> for the protocol defines."
#include <X11/extensions/xf86dgaproto.h>
/*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, 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.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _RENDER_H_
#define _RENDER_H_
#include <X11/Xdefs.h>
typedef XID Glyph;
typedef XID GlyphSet;
typedef XID Picture;
typedef XID PictFormat;
#define RENDER_NAME "RENDER"
#define RENDER_MAJOR 0
#define RENDER_MINOR 11
#define X_RenderQueryVersion 0
#define X_RenderQueryPictFormats 1
#define X_RenderQueryPictIndexValues 2 /* 0.7 */
#define X_RenderQueryDithers 3
#define X_RenderCreatePicture 4
#define X_RenderChangePicture 5
#define X_RenderSetPictureClipRectangles 6
#define X_RenderFreePicture 7
#define X_RenderComposite 8
#define X_RenderScale 9
#define X_RenderTrapezoids 10
#define X_RenderTriangles 11
#define X_RenderTriStrip 12
#define X_RenderTriFan 13
#define X_RenderColorTrapezoids 14
#define X_RenderColorTriangles 15
/* #define X_RenderTransform 16 */
#define X_RenderCreateGlyphSet 17
#define X_RenderReferenceGlyphSet 18
#define X_RenderFreeGlyphSet 19
#define X_RenderAddGlyphs 20
#define X_RenderAddGlyphsFromPicture 21
#define X_RenderFreeGlyphs 22
#define X_RenderCompositeGlyphs8 23
#define X_RenderCompositeGlyphs16 24
#define X_RenderCompositeGlyphs32 25
#define X_RenderFillRectangles 26
/* 0.5 */
#define X_RenderCreateCursor 27
/* 0.6 */
#define X_RenderSetPictureTransform 28
#define X_RenderQueryFilters 29
#define X_RenderSetPictureFilter 30
/* 0.8 */
#define X_RenderCreateAnimCursor 31
/* 0.9 */
#define X_RenderAddTraps 32
/* 0.10 */
#define X_RenderCreateSolidFill 33
#define X_RenderCreateLinearGradient 34
#define X_RenderCreateRadialGradient 35
#define X_RenderCreateConicalGradient 36
#define RenderNumberRequests (X_RenderCreateConicalGradient+1)
#define BadPictFormat 0
#define BadPicture 1
#define BadPictOp 2
#define BadGlyphSet 3
#define BadGlyph 4
#define RenderNumberErrors (BadGlyph+1)
#define PictTypeIndexed 0
#define PictTypeDirect 1
#define PictOpMinimum 0
#define PictOpClear 0
#define PictOpSrc 1
#define PictOpDst 2
#define PictOpOver 3
#define PictOpOverReverse 4
#define PictOpIn 5
#define PictOpInReverse 6
#define PictOpOut 7
#define PictOpOutReverse 8
#define PictOpAtop 9
#define PictOpAtopReverse 10
#define PictOpXor 11
#define PictOpAdd 12
#define PictOpSaturate 13
#define PictOpMaximum 13
/*
* Operators only available in version 0.2
*/
#define PictOpDisjointMinimum 0x10
#define PictOpDisjointClear 0x10
#define PictOpDisjointSrc 0x11
#define PictOpDisjointDst 0x12
#define PictOpDisjointOver 0x13
#define PictOpDisjointOverReverse 0x14
#define PictOpDisjointIn 0x15
#define PictOpDisjointInReverse 0x16
#define PictOpDisjointOut 0x17
#define PictOpDisjointOutReverse 0x18
#define PictOpDisjointAtop 0x19
#define PictOpDisjointAtopReverse 0x1a
#define PictOpDisjointXor 0x1b
#define PictOpDisjointMaximum 0x1b
#define PictOpConjointMinimum 0x20
#define PictOpConjointClear 0x20
#define PictOpConjointSrc 0x21
#define PictOpConjointDst 0x22
#define PictOpConjointOver 0x23
#define PictOpConjointOverReverse 0x24
#define PictOpConjointIn 0x25
#define PictOpConjointInReverse 0x26
#define PictOpConjointOut 0x27
#define PictOpConjointOutReverse 0x28
#define PictOpConjointAtop 0x29
#define PictOpConjointAtopReverse 0x2a
#define PictOpConjointXor 0x2b
#define PictOpConjointMaximum 0x2b
/*
* Operators only available in version 0.11
*/
#define PictOpBlendMinimum 0x30
#define PictOpMultiply 0x30
#define PictOpScreen 0x31
#define PictOpOverlay 0x32
#define PictOpDarken 0x33
#define PictOpLighten 0x34
#define PictOpColorDodge 0x35
#define PictOpColorBurn 0x36
#define PictOpHardLight 0x37
#define PictOpSoftLight 0x38
#define PictOpDifference 0x39
#define PictOpExclusion 0x3a
#define PictOpHSLHue 0x3b
#define PictOpHSLSaturation 0x3c
#define PictOpHSLColor 0x3d
#define PictOpHSLLuminosity 0x3e
#define PictOpBlendMaximum 0x3e
#define PolyEdgeSharp 0
#define PolyEdgeSmooth 1
#define PolyModePrecise 0
#define PolyModeImprecise 1
#define CPRepeat (1 << 0)
#define CPAlphaMap (1 << 1)
#define CPAlphaXOrigin (1 << 2)
#define CPAlphaYOrigin (1 << 3)
#define CPClipXOrigin (1 << 4)
#define CPClipYOrigin (1 << 5)
#define CPClipMask (1 << 6)
#define CPGraphicsExposure (1 << 7)
#define CPSubwindowMode (1 << 8)
#define CPPolyEdge (1 << 9)
#define CPPolyMode (1 << 10)
#define CPDither (1 << 11)
#define CPComponentAlpha (1 << 12)
#define CPLastBit 12
/* Filters included in 0.6 */
#define FilterNearest "nearest"
#define FilterBilinear "bilinear"
/* Filters included in 0.10 */
#define FilterConvolution "convolution"
#define FilterFast "fast"
#define FilterGood "good"
#define FilterBest "best"
#define FilterAliasNone -1
/* Subpixel orders included in 0.6 */
#define SubPixelUnknown 0
#define SubPixelHorizontalRGB 1
#define SubPixelHorizontalBGR 2
#define SubPixelVerticalRGB 3
#define SubPixelVerticalBGR 4
#define SubPixelNone 5
/* Extended repeat attributes included in 0.10 */
#define RepeatNone 0
#define RepeatNormal 1
#define RepeatPad 2
#define RepeatReflect 3
#endif /* _RENDER_H_ */
/*
* Copyright © 2007-2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors: Peter Hutterer, University of South Australia, NICTA
*
*/
#ifndef _GEPROTO_H_
#define _GEPROTO_H_
#include<X11/Xproto.h>
#include<X11/X.h>
#include<X11/extensions/ge.h>
/*********************************************************
*
* Protocol request constants
*
*/
#define X_GEGetExtensionVersion 1
/*********************************************************
*
* XGE protocol requests/replies
*
*/
/* generic request */
typedef struct {
CARD8 reqType;
CARD8 ReqType;
CARD16 length;
} xGEReq;
/* QueryVersion */
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GEQueryVersion */
CARD16 length;
CARD16 majorVersion;
CARD16 minorVersion;
} xGEQueryVersionReq;
#define sz_xGEQueryVersionReq 8
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GEQueryVersion */
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion;
CARD16 minorVersion;
CARD32 pad00;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
} xGEQueryVersionReply;
#define sz_xGEQueryVersionReply 32
#endif /* _GEPROTO_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
#ifndef _MITMISCPROTO_H_
#define _MITMISCPROTO_H_
#include <X11/extensions/mitmiscconst.h>
#define X_MITSetBugMode 0
#define X_MITGetBugMode 1
typedef struct _SetBugMode {
CARD8 reqType; /* always MITReqCode */
CARD8 mitReqType; /* always X_MITSetBugMode */
CARD16 length;
BOOL onOff;
BYTE pad0;
CARD16 pad1;
} xMITSetBugModeReq;
#define sz_xMITSetBugModeReq 8
typedef struct _GetBugMode {
CARD8 reqType; /* always MITReqCode */
CARD8 mitReqType; /* always X_MITGetBugMode */
CARD16 length;
} xMITGetBugModeReq;
#define sz_xMITGetBugModeReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL onOff;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xMITGetBugModeReply;
#define sz_xMITGetBugModeReply 32
#endif /* _MITMISCPROTO_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _SHM_H_
#define _SHM_H_
#define SHMNAME "MIT-SHM"
#define SHM_MAJOR_VERSION 1 /* current version numbers */
#define SHM_MINOR_VERSION 2
#define ShmCompletion 0
#define ShmNumberEvents (ShmCompletion + 1)
#define BadShmSeg 0
#define ShmNumberErrors (BadShmSeg + 1)
#endif /* _SHM_H_ */
#ifndef _SHAPESTR_H_
#define _SHAPESTR_H_
#warning "shapestr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/shapeproto.h> for the protocol defines."
#include <X11/extensions/shapeproto.h>
#endif /* _SHAPESTR_H_ */
/*
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett Packard Company
* Copyright © 2006 Intel Corporation
* Copyright © 2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, 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.
*
* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
* Keith Packard, Intel Corporation
*/
#ifndef _RANDR_H_
#define _RANDR_H_
typedef unsigned short Rotation;
typedef unsigned short SizeID;
typedef unsigned short SubpixelOrder;
typedef unsigned short Connection;
typedef unsigned short XRandrRotation;
typedef unsigned short XRandrSizeID;
typedef unsigned short XRandrSubpixelOrder;
typedef unsigned long XRandrModeFlags;
#define RANDR_NAME "RANDR"
#define RANDR_MAJOR 1
#define RANDR_MINOR 6
#define RRNumberErrors 5
#define RRNumberEvents 2
#define RRNumberRequests 47
#define X_RRQueryVersion 0
/* we skip 1 to make old clients fail pretty immediately */
#define X_RROldGetScreenInfo 1
#define X_RR1_0SetScreenConfig 2
/* V1.0 apps share the same set screen config request id */
#define X_RRSetScreenConfig 2
#define X_RROldScreenChangeSelectInput 3
/* 3 used to be ScreenChangeSelectInput; deprecated */
#define X_RRSelectInput 4
#define X_RRGetScreenInfo 5
/* V1.2 additions */
#define X_RRGetScreenSizeRange 6
#define X_RRSetScreenSize 7
#define X_RRGetScreenResources 8
#define X_RRGetOutputInfo 9
#define X_RRListOutputProperties 10
#define X_RRQueryOutputProperty 11
#define X_RRConfigureOutputProperty 12
#define X_RRChangeOutputProperty 13
#define X_RRDeleteOutputProperty 14
#define X_RRGetOutputProperty 15
#define X_RRCreateMode 16
#define X_RRDestroyMode 17
#define X_RRAddOutputMode 18
#define X_RRDeleteOutputMode 19
#define X_RRGetCrtcInfo 20
#define X_RRSetCrtcConfig 21
#define X_RRGetCrtcGammaSize 22
#define X_RRGetCrtcGamma 23
#define X_RRSetCrtcGamma 24
/* V1.3 additions */
#define X_RRGetScreenResourcesCurrent 25
#define X_RRSetCrtcTransform 26
#define X_RRGetCrtcTransform 27
#define X_RRGetPanning 28
#define X_RRSetPanning 29
#define X_RRSetOutputPrimary 30
#define X_RRGetOutputPrimary 31
#define RRTransformUnit (1L << 0)
#define RRTransformScaleUp (1L << 1)
#define RRTransformScaleDown (1L << 2)
#define RRTransformProjective (1L << 3)
/* v1.4 */
#define X_RRGetProviders 32
#define X_RRGetProviderInfo 33
#define X_RRSetProviderOffloadSink 34
#define X_RRSetProviderOutputSource 35
#define X_RRListProviderProperties 36
#define X_RRQueryProviderProperty 37
#define X_RRConfigureProviderProperty 38
#define X_RRChangeProviderProperty 39
#define X_RRDeleteProviderProperty 40
#define X_RRGetProviderProperty 41
/* v1.5 */
#define X_RRGetMonitors 42
#define X_RRSetMonitor 43
#define X_RRDeleteMonitor 44
/* v1.6 */
#define X_RRCreateLease 45
#define X_RRFreeLease 46
/* Event selection bits */
#define RRScreenChangeNotifyMask (1L << 0)
/* V1.2 additions */
#define RRCrtcChangeNotifyMask (1L << 1)
#define RROutputChangeNotifyMask (1L << 2)
#define RROutputPropertyNotifyMask (1L << 3)
/* V1.4 additions */
#define RRProviderChangeNotifyMask (1L << 4)
#define RRProviderPropertyNotifyMask (1L << 5)
#define RRResourceChangeNotifyMask (1L << 6)
/* V1.6 additions */
#define RRLeaseNotifyMask (1L << 7)
/* Event codes */
#define RRScreenChangeNotify 0
/* V1.2 additions */
#define RRNotify 1
/* RRNotify Subcodes */
#define RRNotify_CrtcChange 0
#define RRNotify_OutputChange 1
#define RRNotify_OutputProperty 2
#define RRNotify_ProviderChange 3
#define RRNotify_ProviderProperty 4
#define RRNotify_ResourceChange 5
/* V1.6 additions */
#define RRNotify_Lease 6
/* used in the rotation field; rotation and reflection in 0.1 proto. */
#define RR_Rotate_0 1
#define RR_Rotate_90 2
#define RR_Rotate_180 4
#define RR_Rotate_270 8
/* new in 1.0 protocol, to allow reflection of screen */
#define RR_Reflect_X 16
#define RR_Reflect_Y 32
#define RRSetConfigSuccess 0
#define RRSetConfigInvalidConfigTime 1
#define RRSetConfigInvalidTime 2
#define RRSetConfigFailed 3
/* new in 1.2 protocol */
#define RR_HSyncPositive 0x00000001
#define RR_HSyncNegative 0x00000002
#define RR_VSyncPositive 0x00000004
#define RR_VSyncNegative 0x00000008
#define RR_Interlace 0x00000010
#define RR_DoubleScan 0x00000020
#define RR_CSync 0x00000040
#define RR_CSyncPositive 0x00000080
#define RR_CSyncNegative 0x00000100
#define RR_HSkewPresent 0x00000200
#define RR_BCast 0x00000400
#define RR_PixelMultiplex 0x00000800
#define RR_DoubleClock 0x00001000
#define RR_ClockDivideBy2 0x00002000
#define RR_Connected 0
#define RR_Disconnected 1
#define RR_UnknownConnection 2
#define BadRROutput 0
#define BadRRCrtc 1
#define BadRRMode 2
#define BadRRProvider 3
#define BadRRLease 4
/* Conventional RandR output properties */
#define RR_PROPERTY_BACKLIGHT "Backlight"
#define RR_PROPERTY_RANDR_EDID "EDID"
#define RR_PROPERTY_SIGNAL_FORMAT "SignalFormat"
#define RR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties"
#define RR_PROPERTY_CONNECTOR_TYPE "ConnectorType"
#define RR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber"
#define RR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList"
#define RR_PROPERTY_CLONE_LIST "CloneList"
#define RR_PROPERTY_BORDER "Border"
#define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions"
#define RR_PROPERTY_GUID "GUID"
#define RR_PROPERTY_RANDR_TILE "TILE"
#define RR_PROPERTY_NON_DESKTOP "non-desktop"
/* roles this device can carry out */
#define RR_Capability_None 0
#define RR_Capability_SourceOutput 1
#define RR_Capability_SinkOutput 2
#define RR_Capability_SourceOffload 4
#define RR_Capability_SinkOffload 8
#endif /* _RANDR_H_ */
/*
Copyright (c) 1992 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifndef _SAVERPROTO_H_
#define _SAVERPROTO_H_
#include <X11/extensions/saver.h>
#define Window CARD32
#define Drawable CARD32
#define Font CARD32
#define Pixmap CARD32
#define Cursor CARD32
#define Colormap CARD32
#define GContext CARD32
#define Atom CARD32
#define VisualID CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define X_ScreenSaverQueryVersion 0
typedef struct _ScreenSaverQueryVersion {
CARD8 reqType; /* always ScreenSaverReqCode */
CARD8 saverReqType; /* always X_ScreenSaverQueryVersion */
CARD16 length;
CARD8 clientMajor;
CARD8 clientMinor;
CARD16 unused;
} xScreenSaverQueryVersionReq;
#define sz_xScreenSaverQueryVersionReq 8
typedef struct {
CARD8 type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of protocol */
CARD16 minorVersion; /* minor version of protocol */
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xScreenSaverQueryVersionReply;
#define sz_xScreenSaverQueryVersionReply 32
#define X_ScreenSaverQueryInfo 1
typedef struct _ScreenSaverQueryInfo {
CARD8 reqType; /* always ScreenSaverReqCode */
CARD8 saverReqType; /* always X_ScreenSaverQueryInfo */
CARD16 length;
Drawable drawable;
} xScreenSaverQueryInfoReq;
#define sz_xScreenSaverQueryInfoReq 8
typedef struct {
CARD8 type; /* X_Reply */
BYTE state; /* Off, On */
CARD16 sequenceNumber;
CARD32 length;
Window window;
CARD32 tilOrSince;
CARD32 idle;
CARD32 eventMask;
BYTE kind; /* Blanked, Internal, External */
CARD8 pad0;
CARD16 pad1;
CARD32 pad2;
} xScreenSaverQueryInfoReply;
#define sz_xScreenSaverQueryInfoReply 32
#define X_ScreenSaverSelectInput 2
typedef struct _ScreenSaverSelectInput {
CARD8 reqType; /* always ScreenSaverReqCode */
CARD8 saverReqType; /* always X_ScreenSaverSelectInput */
CARD16 length;
Drawable drawable;
CARD32 eventMask;
} xScreenSaverSelectInputReq;
#define sz_xScreenSaverSelectInputReq 12
#define X_ScreenSaverSetAttributes 3
typedef struct _ScreenSaverSetAttributes {
CARD8 reqType; /* always ScreenSaverReqCode */
CARD8 saverReqType; /* always X_ScreenSaverSetAttributes */
CARD16 length;
Drawable drawable;
INT16 x, y;
CARD16 width, height, borderWidth;
BYTE c_class;
CARD8 depth;
VisualID visualID;
CARD32 mask;
} xScreenSaverSetAttributesReq;
#define sz_xScreenSaverSetAttributesReq 28
#define X_ScreenSaverUnsetAttributes 4
typedef struct _ScreenSaverUnsetAttributes {
CARD8 reqType; /* always ScreenSaverReqCode */
CARD8 saverReqType; /* always X_ScreenSaverUnsetAttributes */
CARD16 length;
Drawable drawable;
} xScreenSaverUnsetAttributesReq;
#define sz_xScreenSaverUnsetAttributesReq 8
#define X_ScreenSaverSuspend 5
typedef struct _ScreenSaverSuspend {
CARD8 reqType;
CARD8 saverReqType;
CARD16 length;
CARD32 suspend; /* a boolean, but using the wrong encoding */
} xScreenSaverSuspendReq;
#define sz_xScreenSaverSuspendReq 8
typedef struct _ScreenSaverNotify {
CARD8 type; /* always eventBase + ScreenSaverNotify */
BYTE state; /* off, on, cycle */
CARD16 sequenceNumber;
Time timestamp;
Window root;
Window window; /* screen saver window */
BYTE kind; /* blanked, internal, external */
BYTE forced;
CARD16 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xScreenSaverNotifyEvent;
#define sz_xScreenSaverNotifyEvent 32
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef Atom
#undef VisualID
#undef Time
#undef KeyCode
#undef KeySym
#endif /* _SAVERPROTO_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
#ifndef _SHAPEPROTO_H_
#define _SHAPEPROTO_H_
#include <X11/extensions/shapeconst.h>
/*
* Protocol requests constants and alignment values
* These would really be in SHAPE's X.h and Xproto.h equivalents
*/
#define Window CARD32
#define Time CARD32
#define X_ShapeQueryVersion 0
#define X_ShapeRectangles 1
#define X_ShapeMask 2
#define X_ShapeCombine 3
#define X_ShapeOffset 4
#define X_ShapeQueryExtents 5
#define X_ShapeSelectInput 6
#define X_ShapeInputSelected 7
#define X_ShapeGetRectangles 8
typedef struct _ShapeQueryVersion {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeQueryVersion */
CARD16 length;
} xShapeQueryVersionReq;
#define sz_xShapeQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of SHAPE protocol */
CARD16 minorVersion; /* minor version of SHAPE protocol */
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xShapeQueryVersionReply;
#define sz_xShapeQueryVersionReply 32
typedef struct _ShapeRectangles {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeRectangles */
CARD16 length;
CARD8 op; /* Set, ... */
CARD8 destKind; /* ShapeBounding or ShapeClip */
CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */
CARD8 pad0; /* not used */
Window dest;
INT16 xOff;
INT16 yOff;
} xShapeRectanglesReq; /* followed by xRects */
#define sz_xShapeRectanglesReq 16
typedef struct _ShapeMask {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeMask */
CARD16 length;
CARD8 op; /* Set, ... */
CARD8 destKind; /* ShapeBounding or ShapeClip */
CARD16 junk; /* not used */
Window dest;
INT16 xOff;
INT16 yOff;
CARD32 src; /* 1 bit pixmap */
} xShapeMaskReq;
#define sz_xShapeMaskReq 20
typedef struct _ShapeCombine {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeCombine */
CARD16 length;
CARD8 op; /* Set, ... */
CARD8 destKind; /* ShapeBounding or ShapeClip */
CARD8 srcKind; /* ShapeBounding or ShapeClip */
CARD8 junk; /* not used */
Window dest;
INT16 xOff;
INT16 yOff;
Window src;
} xShapeCombineReq;
#define sz_xShapeCombineReq 20
typedef struct _ShapeOffset {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeOffset */
CARD16 length;
CARD8 destKind; /* ShapeBounding or ShapeClip */
CARD8 junk1; /* not used */
CARD16 junk2; /* not used */
Window dest;
INT16 xOff;
INT16 yOff;
} xShapeOffsetReq;
#define sz_xShapeOffsetReq 16
typedef struct _ShapeQueryExtents {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeQueryExtents */
CARD16 length;
Window window;
} xShapeQueryExtentsReq;
#define sz_xShapeQueryExtentsReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD8 boundingShaped; /* window has bounding shape */
CARD8 clipShaped; /* window has clip shape */
CARD16 unused1;
INT16 xBoundingShape; /* extents of bounding shape */
INT16 yBoundingShape;
CARD16 widthBoundingShape;
CARD16 heightBoundingShape;
INT16 xClipShape; /* extents of clip shape */
INT16 yClipShape;
CARD16 widthClipShape;
CARD16 heightClipShape;
CARD32 pad1;
} xShapeQueryExtentsReply;
#define sz_xShapeQueryExtentsReply 32
typedef struct _ShapeSelectInput {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeSelectInput */
CARD16 length;
Window window;
BYTE enable; /* xTrue -> send events */
BYTE pad1;
CARD16 pad2;
} xShapeSelectInputReq;
#define sz_xShapeSelectInputReq 12
typedef struct _ShapeNotify {
BYTE type; /* always eventBase + ShapeNotify */
BYTE kind; /* either ShapeBounding or ShapeClip */
CARD16 sequenceNumber;
Window window;
INT16 x;
INT16 y; /* extents of new shape */
CARD16 width;
CARD16 height;
Time time; /* time of change */
BYTE shaped; /* set when a shape actual exists */
BYTE pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
} xShapeNotifyEvent;
#define sz_xShapeNotifyEvent 32
typedef struct _ShapeInputSelected {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeInputSelected */
CARD16 length;
Window window;
} xShapeInputSelectedReq;
#define sz_xShapeInputSelectedReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 enabled; /* current status */
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD32 pad1; /* unused */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xShapeInputSelectedReply;
#define sz_xShapeInputSelectedReply 32
typedef struct _ShapeGetRectangles {
CARD8 reqType; /* always ShapeReqCode */
CARD8 shapeReqType; /* always X_ShapeGetRectangles */
CARD16 length;
Window window;
CARD8 kind; /* ShapeBounding or ShapeClip */
CARD8 junk1;
CARD16 junk2;
} xShapeGetRectanglesReq;
#define sz_xShapeGetRectanglesReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */
CARD16 sequenceNumber;
CARD32 length; /* not zero */
CARD32 nrects; /* number of rectangles */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xShapeGetRectanglesReply; /* followed by xRectangles */
#define sz_xShapeGetRectanglesReply 32
#undef Window
#undef Time
#endif /* _SHAPEPROTO_H_ */
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifndef _DPMSPROTO_H_
#define _DPMSPROTO_H_
#include <X11/extensions/dpmsconst.h>
#define X_DPMSGetVersion 0
#define X_DPMSCapable 1
#define X_DPMSGetTimeouts 2
#define X_DPMSSetTimeouts 3
#define X_DPMSEnable 4
#define X_DPMSDisable 5
#define X_DPMSForceLevel 6
#define X_DPMSInfo 7
#define X_DPMSSelectInput 8
#define DPMSNumberEvents 0
#define DPMSNumberErrors 0
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSGetVersion */
CARD16 length;
CARD16 majorVersion;
CARD16 minorVersion;
} xDPMSGetVersionReq;
#define sz_xDPMSGetVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion;
CARD16 minorVersion;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDPMSGetVersionReply;
#define sz_xDPMSGetVersionReply 32
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSCapable */
CARD16 length;
} xDPMSCapableReq;
#define sz_xDPMSCapableReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
BOOL capable;
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xDPMSCapableReply;
#define sz_xDPMSCapableReply 32
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSGetTimeouts */
CARD16 length;
} xDPMSGetTimeoutsReq;
#define sz_xDPMSGetTimeoutsReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 standby;
CARD16 suspend;
CARD16 off;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDPMSGetTimeoutsReply;
#define sz_xDPMSGetTimeoutsReply 32
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSSetTimeouts */
CARD16 length;
CARD16 standby;
CARD16 suspend;
CARD16 off;
CARD16 pad0;
} xDPMSSetTimeoutsReq;
#define sz_xDPMSSetTimeoutsReq 12
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSEnable */
CARD16 length;
} xDPMSEnableReq;
#define sz_xDPMSEnableReq 4
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSDisable */
CARD16 length;
} xDPMSDisableReq;
#define sz_xDPMSDisableReq 4
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSForceLevel */
CARD16 length;
CARD16 level; /* power level requested */
CARD16 pad0;
} xDPMSForceLevelReq;
#define sz_xDPMSForceLevelReq 8
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSInfo */
CARD16 length;
} xDPMSInfoReq;
#define sz_xDPMSInfoReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 power_level;
BOOL state;
CARD8 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xDPMSInfoReply;
#define sz_xDPMSInfoReply 32
typedef struct {
CARD8 reqType; /* always DPMSCode */
CARD8 dpmsReqType; /* always X_DPMSSelectInput */
CARD16 length B16;
CARD32 eventMask B32;
} xDPMSSelectInputReq;
#define sz_xDPMSSelectInputReq 8
typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber B16;
CARD32 length;
CARD16 evtype B16;
CARD16 pad0 B16;
Time timestamp B32;
CARD16 power_level B16;
BOOL state;
CARD8 pad1;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xDPMSInfoNotifyEvent;
#define sz_xDPMSInfoNotifyEvent 32
#endif /* _DPMSPROTO_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
#ifndef _SHAPE_H_
#define _SHAPE_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/shapeconst.h>
#ifndef _SHAPE_SERVER_
#include <X11/Xutil.h>
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window of event */
int kind; /* ShapeBounding or ShapeClip */
int x, y; /* extents of new region */
unsigned width, height;
Time time; /* server timestamp when region changed */
Bool shaped; /* true if the region exists */
} XShapeEvent;
_XFUNCPROTOBEGIN
extern Bool XShapeQueryExtension (
Display* /* display */,
int* /* event_base */,
int* /* error_base */
);
extern Status XShapeQueryVersion (
Display* /* display */,
int* /* major_version */,
int* /* minor_version */
);
extern void XShapeCombineRegion (
Display* /* display */,
Window /* dest */,
int /* dest_kind */,
int /* x_off */,
int /* y_off */,
Region /* region */,
int /* op */
);
extern void XShapeCombineRectangles (
Display* /* display */,
Window /* dest */,
int /* dest_kind */,
int /* x_off */,
int /* y_off */,
XRectangle* /* rectangles */,
int /* n_rects */,
int /* op */,
int /* ordering */
);
extern void XShapeCombineMask (
Display* /* display */,
Window /* dest */,
int /* dest_kind */,
int /* x_off */,
int /* y_off */,
Pixmap /* src */,
int /* op */
);
extern void XShapeCombineShape (
Display* /* display */,
Window /* dest */,
int /* dest_kind */,
int /* x_off */,
int /* y_off */,
Window /* src */,
int /* src_kind */,
int /* op */
);
extern void XShapeOffsetShape (
Display* /* display */,
Window /* dest */,
int /* dest_kind */,
int /* x_off */,
int /* y_off */
);
extern Status XShapeQueryExtents (
Display* /* display */,
Window /* window */,
Bool* /* bounding_shaped */,
int* /* x_bounding */,
int* /* y_bounding */,
unsigned int* /* w_bounding */,
unsigned int* /* h_bounding */,
Bool* /* clip_shaped */,
int* /* x_clip */,
int* /* y_clip */,
unsigned int* /* w_clip */,
unsigned int* /* h_clip */
);
extern void XShapeSelectInput (
Display* /* display */,
Window /* window */,
unsigned long /* mask */
);
extern unsigned long XShapeInputSelected (
Display* /* display */,
Window /* window */
);
extern XRectangle *XShapeGetRectangles (
Display* /* display */,
Window /* window */,
int /* kind */,
int* /* count */,
int* /* ordering */
);
_XFUNCPROTOEND
#endif /* !_SHAPE_SERVER_ */
#endif /* _SHAPE_H_ */
/*
Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XTEST_CONST_H_
#define _XTEST_CONST_H_
#define XTestNumberEvents 0
#define XTestNumberErrors 0
#define XTestCurrentCursor ((Cursor)1)
#define XTestMajorVersion 2
#define XTestMinorVersion 2
#define XTestExtensionName "XTEST"
#endif
/*
* Copyright © 2009 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef _XI2_H_
#define _XI2_H_
#define XInput_2_0 7
/* DO NOT ADD TO THIS LIST. These are libXi-specific defines.
See commit libXi-1.4.2-21-ge8531dd */
#define XI_2_Major 2
#define XI_2_Minor 3
/* Property event flags */
#define XIPropertyDeleted 0
#define XIPropertyCreated 1
#define XIPropertyModified 2
/* Property modes */
#define XIPropModeReplace 0
#define XIPropModePrepend 1
#define XIPropModeAppend 2
/* Special property type used for XIGetProperty */
#define XIAnyPropertyType 0L
/* Enter/Leave and Focus In/Out modes */
#define XINotifyNormal 0
#define XINotifyGrab 1
#define XINotifyUngrab 2
#define XINotifyWhileGrabbed 3
#define XINotifyPassiveGrab 4
#define XINotifyPassiveUngrab 5
/* Enter/Leave and focus In/out detail */
#define XINotifyAncestor 0
#define XINotifyVirtual 1
#define XINotifyInferior 2
#define XINotifyNonlinear 3
#define XINotifyNonlinearVirtual 4
#define XINotifyPointer 5
#define XINotifyPointerRoot 6
#define XINotifyDetailNone 7
/* Grab modes */
#define XIGrabModeSync 0
#define XIGrabModeAsync 1
#define XIGrabModeTouch 2
/* Grab reply status codes */
#define XIGrabSuccess 0
#define XIAlreadyGrabbed 1
#define XIGrabInvalidTime 2
#define XIGrabNotViewable 3
#define XIGrabFrozen 4
/* Grab owner events values */
#define XIOwnerEvents True
#define XINoOwnerEvents False
/* Passive grab types */
#define XIGrabtypeButton 0
#define XIGrabtypeKeycode 1
#define XIGrabtypeEnter 2
#define XIGrabtypeFocusIn 3
#define XIGrabtypeTouchBegin 4
/* Passive grab modifier */
#define XIAnyModifier (1U << 31)
#define XIAnyButton 0
#define XIAnyKeycode 0
/* XIAllowEvents event-modes */
#define XIAsyncDevice 0
#define XISyncDevice 1
#define XIReplayDevice 2
#define XIAsyncPairedDevice 3
#define XIAsyncPair 4
#define XISyncPair 5
#define XIAcceptTouch 6
#define XIRejectTouch 7
/* DeviceChangedEvent change reasons */
#define XISlaveSwitch 1
#define XIDeviceChange 2
/* Hierarchy flags */
#define XIMasterAdded (1 << 0)
#define XIMasterRemoved (1 << 1)
#define XISlaveAdded (1 << 2)
#define XISlaveRemoved (1 << 3)
#define XISlaveAttached (1 << 4)
#define XISlaveDetached (1 << 5)
#define XIDeviceEnabled (1 << 6)
#define XIDeviceDisabled (1 << 7)
/* ChangeHierarchy constants */
#define XIAddMaster 1
#define XIRemoveMaster 2
#define XIAttachSlave 3
#define XIDetachSlave 4
#define XIAttachToMaster 1
#define XIFloating 2
/* Valuator modes */
#define XIModeRelative 0
#define XIModeAbsolute 1
/* Device types */
#define XIMasterPointer 1
#define XIMasterKeyboard 2
#define XISlavePointer 3
#define XISlaveKeyboard 4
#define XIFloatingSlave 5
/* Device classes: classes that are not identical to Xi 1.x classes must be
* numbered starting from 8. */
#define XIKeyClass 0
#define XIButtonClass 1
#define XIValuatorClass 2
#define XIScrollClass 3
#define XITouchClass 8
/* Scroll class types */
#define XIScrollTypeVertical 1
#define XIScrollTypeHorizontal 2
/* Scroll class flags */
#define XIScrollFlagNoEmulation (1 << 0)
#define XIScrollFlagPreferred (1 << 1)
/* Device event flags (common) */
/* Device event flags (key events only) */
#define XIKeyRepeat (1 << 16)
/* Device event flags (pointer events only) */
#define XIPointerEmulated (1 << 16)
/* Device event flags (touch events only) */
#define XITouchPendingEnd (1 << 16)
#define XITouchEmulatingPointer (1 << 17)
/* Barrier event flags */
#define XIBarrierPointerReleased (1 << 0)
#define XIBarrierDeviceIsGrabbed (1 << 1)
/* Touch modes */
#define XIDirectTouch 1
#define XIDependentTouch 2
/* XI2 event mask macros */
#define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7)))
#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7)))
#define XIMaskLen(event) (((event) >> 3) + 1)
/* Fake device ID's for event selection */
#define XIAllDevices 0
#define XIAllMasterDevices 1
/* Event types */
#define XI_DeviceChanged 1
#define XI_KeyPress 2
#define XI_KeyRelease 3
#define XI_ButtonPress 4
#define XI_ButtonRelease 5
#define XI_Motion 6
#define XI_Enter 7
#define XI_Leave 8
#define XI_FocusIn 9
#define XI_FocusOut 10
#define XI_HierarchyChanged 11
#define XI_PropertyEvent 12
#define XI_RawKeyPress 13
#define XI_RawKeyRelease 14
#define XI_RawButtonPress 15
#define XI_RawButtonRelease 16
#define XI_RawMotion 17
#define XI_TouchBegin 18 /* XI 2.2 */
#define XI_TouchUpdate 19
#define XI_TouchEnd 20
#define XI_TouchOwnership 21
#define XI_RawTouchBegin 22
#define XI_RawTouchUpdate 23
#define XI_RawTouchEnd 24
#define XI_BarrierHit 25 /* XI 2.3 */
#define XI_BarrierLeave 26
#define XI_LASTEVENT XI_BarrierLeave
/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
* as XI_LASTEVENT if the server is supposed to handle masks etc. for this
* type of event. */
/* Event masks.
* Note: the protocol spec defines a mask to be of (1 << type). Clients are
* free to create masks by bitshifting instead of using these defines.
*/
#define XI_DeviceChangedMask (1 << XI_DeviceChanged)
#define XI_KeyPressMask (1 << XI_KeyPress)
#define XI_KeyReleaseMask (1 << XI_KeyRelease)
#define XI_ButtonPressMask (1 << XI_ButtonPress)
#define XI_ButtonReleaseMask (1 << XI_ButtonRelease)
#define XI_MotionMask (1 << XI_Motion)
#define XI_EnterMask (1 << XI_Enter)
#define XI_LeaveMask (1 << XI_Leave)
#define XI_FocusInMask (1 << XI_FocusIn)
#define XI_FocusOutMask (1 << XI_FocusOut)
#define XI_HierarchyChangedMask (1 << XI_HierarchyChanged)
#define XI_PropertyEventMask (1 << XI_PropertyEvent)
#define XI_RawKeyPressMask (1 << XI_RawKeyPress)
#define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease)
#define XI_RawButtonPressMask (1 << XI_RawButtonPress)
#define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease)
#define XI_RawMotionMask (1 << XI_RawMotion)
#define XI_TouchBeginMask (1 << XI_TouchBegin)
#define XI_TouchEndMask (1 << XI_TouchEnd)
#define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership)
#define XI_TouchUpdateMask (1 << XI_TouchUpdate)
#define XI_RawTouchBeginMask (1 << XI_RawTouchBegin)
#define XI_RawTouchEndMask (1 << XI_RawTouchEnd)
#define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate)
#define XI_BarrierHitMask (1 << XI_BarrierHit)
#define XI_BarrierLeaveMask (1 << XI_BarrierLeave)
#endif /* _XI2_H_ */
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _PRESENT_TOKENS_H_
#define _PRESENT_TOKENS_H_
#define PRESENT_NAME "Present"
#define PRESENT_MAJOR 1
#define PRESENT_MINOR 2
#define PresentNumberErrors 0
#define PresentNumberEvents 0
/* Requests */
#define X_PresentQueryVersion 0
#define X_PresentPixmap 1
#define X_PresentNotifyMSC 2
#define X_PresentSelectInput 3
#define X_PresentQueryCapabilities 4
#define PresentNumberRequests 5
/* Present operation options */
#define PresentOptionNone 0
#define PresentOptionAsync (1 << 0)
#define PresentOptionCopy (1 << 1)
#define PresentOptionUST (1 << 2)
#define PresentOptionSuboptimal (1 << 3)
#define PresentAllOptions (PresentOptionAsync | \
PresentOptionCopy | \
PresentOptionUST | \
PresentOptionSuboptimal)
/* Present capabilities */
#define PresentCapabilityNone 0
#define PresentCapabilityAsync 1
#define PresentCapabilityFence 2
#define PresentCapabilityUST 4
#define PresentAllCapabilities (PresentCapabilityAsync | \
PresentCapabilityFence | \
PresentCapabilityUST)
/* Events */
#define PresentConfigureNotify 0
#define PresentCompleteNotify 1
#define PresentIdleNotify 2
#if PRESENT_FUTURE_VERSION
#define PresentRedirectNotify 3
#endif
/* Event Masks */
#define PresentConfigureNotifyMask 1
#define PresentCompleteNotifyMask 2
#define PresentIdleNotifyMask 4
#if PRESENT_FUTURE_VERSION
#define PresentRedirectNotifyMask 8
#endif
#if PRESENT_FUTURE_VERSION
#define PRESENT_REDIRECT_NOTIFY_MASK PresentRedirectNotifyMask
#else
#define PRESENT_REDIRECT_NOTIFY_MASK 0
#endif
#define PresentAllEvents (PresentConfigureNotifyMask | \
PresentCompleteNotifyMask | \
PresentIdleNotifyMask | \
PRESENT_REDIRECT_NOTIFY_MASK)
/* Complete Kinds */
#define PresentCompleteKindPixmap 0
#define PresentCompleteKindNotifyMSC 1
/* Complete Modes */
#define PresentCompleteModeCopy 0
#define PresentCompleteModeFlip 1
#define PresentCompleteModeSkip 2
#define PresentCompleteModeSuboptimalCopy 3
#endif
#warning "xf86vmstr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/xf86vmproto.h> for the protocol defines."
#include <X11/extensions/xf86vmproto.h>
/*
Copyright 1991, 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/***********************************************************
Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
and Olivetti Research Limited, Cambridge, England.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or Olivetti
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _SYNCCONST_H_
#define _SYNCCONST_H_
#define SYNC_NAME "SYNC"
#define SYNC_MAJOR_VERSION 3
#define SYNC_MINOR_VERSION 1
#define XSyncCounterNotify 0
#define XSyncAlarmNotify 1
#define XSyncAlarmNotifyMask (1L << XSyncAlarmNotify)
#define XSyncNumberEvents 2L
#define XSyncBadCounter 0L
#define XSyncBadAlarm 1L
#define XSyncBadFence 2L
#define XSyncNumberErrors (XSyncBadFence + 1)
/*
* Flags for Alarm Attributes
*/
#define XSyncCACounter (1L<<0)
#define XSyncCAValueType (1L<<1)
#define XSyncCAValue (1L<<2)
#define XSyncCATestType (1L<<3)
#define XSyncCADelta (1L<<4)
#define XSyncCAEvents (1L<<5)
/* The _XSync macros below are for library internal use only. They exist
* so that if we have to make a fix, we can change it in this one place
* and have both the macro and function variants inherit the fix.
*/
#define _XSyncIntToValue(pv, i) ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i))
#define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h))
#define _XSyncValueGreaterThan(a, b)\
((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo))
#define _XSyncValueLessThan(a, b)\
((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo))
#define _XSyncValueGreaterOrEqual(a, b)\
((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo))
#define _XSyncValueLessOrEqual(a, b)\
((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo))
#define _XSyncValueEqual(a, b) ((a).lo==(b).lo && (a).hi==(b).hi)
#define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0)
#define _XSyncValueIsZero(a) ((a).lo==0 && (a).hi==0)
#define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1)
#define _XSyncValueLow32(v) ((v).lo)
#define _XSyncValueHigh32(v) ((v).hi)
#define _XSyncValueAdd(presult,a,b,poverflow) {\
int t = (a).lo;\
Bool signa = XSyncValueIsNegative(a);\
Bool signb = XSyncValueIsNegative(b);\
((presult)->lo = (a).lo + (b).lo);\
((presult)->hi = (a).hi + (b).hi);\
if (t>(presult)->lo) (presult)->hi++;\
*poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
}
#define _XSyncValueSubtract(presult,a,b,poverflow) {\
int t = (a).lo;\
Bool signa = XSyncValueIsNegative(a);\
Bool signb = XSyncValueIsNegative(b);\
((presult)->lo = (a).lo - (b).lo);\
((presult)->hi = (a).hi - (b).hi);\
if (t<(presult)->lo) (presult)->hi--;\
*poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
}
#define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff)
#define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0)
/*
* These are the publically usable macros. If you want the function version
* of one of these, just #undef the macro to uncover the function.
* (This is the same convention that the ANSI C library uses.)
*/
#define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i)
#define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h)
#define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b)
#define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b)
#define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b)
#define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b)
#define XSyncValueEqual(a, b) _XSyncValueEqual(a, b)
#define XSyncValueIsNegative(v) _XSyncValueIsNegative(v)
#define XSyncValueIsZero(a) _XSyncValueIsZero(a)
#define XSyncValueIsPositive(v) _XSyncValueIsPositive(v)
#define XSyncValueLow32(v) _XSyncValueLow32(v)
#define XSyncValueHigh32(v) _XSyncValueHigh32(v)
#define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow)
#define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow)
#define XSyncMaxValue(pv) _XSyncMaxValue(pv)
#define XSyncMinValue(pv) _XSyncMinValue(pv)
/*
* Constants for the value_type argument of various requests
*/
typedef enum {
XSyncAbsolute,
XSyncRelative
} XSyncValueType;
/*
* Alarm Test types
*/
typedef enum {
XSyncPositiveTransition,
XSyncNegativeTransition,
XSyncPositiveComparison,
XSyncNegativeComparison
} XSyncTestType;
/*
* Alarm state constants
*/
typedef enum {
XSyncAlarmActive,
XSyncAlarmInactive,
XSyncAlarmDestroyed
} XSyncAlarmState;
typedef XID XSyncCounter;
typedef XID XSyncAlarm;
typedef XID XSyncFence;
typedef struct _XSyncValue {
int hi;
unsigned int lo;
} XSyncValue;
#endif /* _SYNCCONST_H_ */
/*
Copyright 1991, 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/***********************************************************
Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
and Olivetti Research Limited, Cambridge, England.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or Olivetti
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _SYNCSTR_H_
#define _SYNCSTR_H_
#include <X11/extensions/syncproto.h>
#ifdef _SYNC_SERVER
#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
typedef struct _SyncCounter {
ClientPtr client; /* Owning client. 0 for system counters */
XSyncCounter id; /* resource ID */
CARD64 value; /* counter value */
struct _SyncTriggerList *pTriglist; /* list of triggers */
Bool beingDestroyed; /* in process of going away */
struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
} SyncCounter;
/*
* The System Counter interface
*/
typedef enum {
XSyncCounterNeverChanges,
XSyncCounterNeverIncreases,
XSyncCounterNeverDecreases,
XSyncCounterUnrestricted
} SyncCounterType;
typedef struct _SysCounterInfo {
char *name;
CARD64 resolution;
CARD64 bracket_greater;
CARD64 bracket_less;
SyncCounterType counterType; /* how can this counter change */
void (*QueryValue)(
pointer /*pCounter*/,
CARD64 * /*freshvalue*/
);
void (*BracketValues)(
pointer /*pCounter*/,
CARD64 * /*lessthan*/,
CARD64 * /*greaterthan*/
);
} SysCounterInfo;
typedef struct _SyncTrigger {
SyncCounter *pCounter;
CARD64 wait_value; /* wait value */
unsigned int value_type; /* Absolute or Relative */
unsigned int test_type; /* transition or Comparision type */
CARD64 test_value; /* trigger event threshold value */
Bool (*CheckTrigger)(
struct _SyncTrigger * /*pTrigger*/,
CARD64 /*newval*/
);
void (*TriggerFired)(
struct _SyncTrigger * /*pTrigger*/
);
void (*CounterDestroyed)(
struct _SyncTrigger * /*pTrigger*/
);
} SyncTrigger;
typedef struct _SyncTriggerList {
SyncTrigger *pTrigger;
struct _SyncTriggerList *next;
} SyncTriggerList;
typedef struct _SyncAlarmClientList {
ClientPtr client;
XID delete_id;
struct _SyncAlarmClientList *next;
} SyncAlarmClientList;
typedef struct _SyncAlarm {
SyncTrigger trigger;
ClientPtr client;
XSyncAlarm alarm_id;
CARD64 delta;
int events;
int state;
SyncAlarmClientList *pEventClients;
} SyncAlarm;
typedef struct {
ClientPtr client;
CARD32 delete_id;
int num_waitconditions;
} SyncAwaitHeader;
typedef struct {
SyncTrigger trigger;
CARD64 event_threshold;
SyncAwaitHeader *pHeader;
} SyncAwait;
typedef union {
SyncAwaitHeader header;
SyncAwait await;
} SyncAwaitUnion;
extern pointer SyncCreateSystemCounter(
char * /* name */,
CARD64 /* initial_value */,
CARD64 /* resolution */,
SyncCounterType /* change characterization */,
void (* /*QueryValue*/ ) (
pointer /* pCounter */,
CARD64 * /* pValue_return */), /* XXX prototype */
void (* /*BracketValues*/) (
pointer /* pCounter */,
CARD64 * /* pbracket_less */,
CARD64 * /* pbracket_greater */)
);
extern void SyncChangeCounter(
SyncCounter * /* pCounter*/,
CARD64 /* new_value */
);
extern void SyncDestroySystemCounter(
pointer pCounter
);
extern void InitServertime(void);
#endif /* _SYNC_SERVER */
#endif /* _SYNCSTR_H_ */
/***************************************************************************
* Copyright 1995 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Network Computing Devices
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission.
*
* NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE
* FOR ANY SPECIAL, 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.
**************************************************************************/
#ifndef _RECORDCONST_H_
#define _RECORDCONST_H_
#define RECORD_NAME "RECORD"
#define RECORD_MAJOR_VERSION 1
#define RECORD_MINOR_VERSION 13
#define RECORD_LOWEST_MAJOR_VERSION 1
#define RECORD_LOWEST_MINOR_VERSION 12
#define XRecordBadContext 0 /* Not a valid RC */
#define RecordNumErrors (XRecordBadContext + 1)
#define RecordNumEvents 0L
/*
* Constants for arguments of various requests
*/
#define XRecordFromServerTime 0x01
#define XRecordFromClientTime 0x02
#define XRecordFromClientSequence 0x04
#define XRecordCurrentClients 1
#define XRecordFutureClients 2
#define XRecordAllClients 3
#define XRecordFromServer 0
#define XRecordFromClient 1
#define XRecordClientStarted 2
#define XRecordClientDied 3
#define XRecordStartOfData 4
#define XRecordEndOfData 5
#endif /* _RECORD_H_ */
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XCUPPROTO_H_ /* { */
#define _XCUPPROTO_H_
#include <X11/extensions/cup.h>
#define X_XcupQueryVersion 0
#define X_XcupGetReservedColormapEntries 1
#define X_XcupStoreColors 2
typedef struct _XcupQueryVersion {
CARD8 reqType; /* always XcupReqCode */
CARD8 xcupReqType; /* always X_XcupQueryVersion */
CARD16 length;
CARD16 client_major_version;
CARD16 client_minor_version;
} xXcupQueryVersionReq;
#define sz_xXcupQueryVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number;
CARD32 length;
CARD16 server_major_version;
CARD16 server_minor_version;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXcupQueryVersionReply;
#define sz_xXcupQueryVersionReply 32
typedef struct _XcupGetReservedColormapEntries {
CARD8 reqType; /* always XcupReqCode */
CARD8 xcupReqType; /* always X_XcupGetReservedColormapEntries */
CARD16 length;
CARD32 screen;
} xXcupGetReservedColormapEntriesReq;
#define sz_xXcupGetReservedColormapEntriesReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xXcupGetReservedColormapEntriesReply;
#define sz_xXcupGetReservedColormapEntriesReply 32
typedef struct _XcupStoreColors {
CARD8 reqType; /* always XcupReqCode */
CARD8 xcupReqType; /* always X_XcupStoreColors */
CARD16 length;
CARD32 cmap;
} xXcupStoreColorsReq;
#define sz_xXcupStoreColorsReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xXcupStoreColorsReply;
#define sz_xXcupStoreColorsReply 32
#endif /* } _XCUPPROTO_H_ */
/*
Copyright (c) 2002 XFree86 Inc
*/
#ifndef _XRESPROTO_H
#define _XRESPROTO_H
#define XRES_MAJOR_VERSION 1
#define XRES_MINOR_VERSION 2
#define XRES_NAME "X-Resource"
/* v1.0 */
#define X_XResQueryVersion 0
#define X_XResQueryClients 1
#define X_XResQueryClientResources 2
#define X_XResQueryClientPixmapBytes 3
/* Version 1.1 has been accidentally released from the version */
/* control and while it doesn't have differences to version 1.0, the */
/* next version is labeled 1.2 in order to remove the risk of confusion. */
/* v1.2 */
#define X_XResQueryClientIds 4
#define X_XResQueryResourceBytes 5
typedef struct {
CARD32 resource_base;
CARD32 resource_mask;
} xXResClient;
#define sz_xXResClient 8
typedef struct {
CARD32 resource_type;
CARD32 count;
} xXResType;
#define sz_xXResType 8
/* XResQueryVersion */
typedef struct _XResQueryVersion {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD8 client_major;
CARD8 client_minor;
CARD16 unused;
} xXResQueryVersionReq;
#define sz_xXResQueryVersionReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 server_major;
CARD16 server_minor;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXResQueryVersionReply;
#define sz_xXResQueryVersionReply 32
/* XResQueryClients */
typedef struct _XResQueryClients {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
} xXResQueryClientsReq;
#define sz_xXResQueryClientsReq 4
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_clients;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXResQueryClientsReply;
#define sz_xXResQueryClientsReply 32
/* XResQueryClientResources */
typedef struct _XResQueryClientResources {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 xid;
} xXResQueryClientResourcesReq;
#define sz_xXResQueryClientResourcesReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_types;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXResQueryClientResourcesReply;
#define sz_xXResQueryClientResourcesReply 32
/* XResQueryClientPixmapBytes */
typedef struct _XResQueryClientPixmapBytes {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 xid;
} xXResQueryClientPixmapBytesReq;
#define sz_xXResQueryClientPixmapBytesReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 bytes;
CARD32 bytes_overflow;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXResQueryClientPixmapBytesReply;
#define sz_xXResQueryClientPixmapBytesReply 32
/* v1.2 XResQueryClientIds */
#define X_XResClientXIDMask 0x01
#define X_XResLocalClientPIDMask 0x02
typedef struct _XResClientIdSpec {
CARD32 client;
CARD32 mask;
} xXResClientIdSpec;
#define sz_xXResClientIdSpec 8
typedef struct _XResClientIdValue {
xXResClientIdSpec spec;
CARD32 length;
// followed by length CARD32s
} xXResClientIdValue;
#define sz_xResClientIdValue (sz_xXResClientIdSpec + 4)
typedef struct _XResQueryClientIds {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 numSpecs;
// followed by numSpecs times XResClientIdSpec
} xXResQueryClientIdsReq;
#define sz_xXResQueryClientIdsReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numIds;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
// followed by numIds times XResClientIdValue
} xXResQueryClientIdsReply;
#define sz_xXResQueryClientIdsReply 32
/* v1.2 XResQueryResourceBytes */
typedef struct _XResResourceIdSpec {
CARD32 resource;
CARD32 type;
} xXResResourceIdSpec;
#define sz_xXResResourceIdSpec 8
typedef struct _XResQueryResourceBytes {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 client;
CARD32 numSpecs;
// followed by numSpecs times XResResourceIdSpec
} xXResQueryResourceBytesReq;
#define sz_xXResQueryResourceBytesReq 12
typedef struct _XResResourceSizeSpec {
xXResResourceIdSpec spec;
CARD32 bytes;
CARD32 refCount;
CARD32 useCount;
} xXResResourceSizeSpec;
#define sz_xXResResourceSizeSpec (sz_xXResResourceIdSpec + 12)
typedef struct _XResResourceSizeValue {
xXResResourceSizeSpec size;
CARD32 numCrossReferences;
// followed by numCrossReferences times XResResourceSizeSpec
} xXResResourceSizeValue;
#define sz_xXResResourceSizeValue (sz_xXResResourceSizeSpec + 4)
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numSizes;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
// followed by numSizes times XResResourceSizeValue
} xXResQueryResourceBytesReply;
#define sz_xXResQueryResourceBytesReply 32
#endif /* _XRESPROTO_H */
/*
Copyright 1992, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _BIGREQSPROTO_H_
#define _BIGREQSPROTO_H_
#define X_BigReqEnable 0
#define XBigReqNumberEvents 0
#define XBigReqNumberErrors 0
#define XBigReqExtensionName "BIG-REQUESTS"
typedef struct {
CARD8 reqType; /* always XBigReqCode */
CARD8 brReqType; /* always X_BigReqEnable */
CARD16 length;
} xBigReqEnableReq;
#define sz_xBigReqEnableReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 max_request_size;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xBigReqEnableReply;
#define sz_xBigReqEnableReply 32
typedef struct {
CARD8 reqType;
CARD8 data;
CARD16 zero;
CARD32 length;
} xBigReq;
#endif /* _BIGREQSPROTO_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _XAG_H_
#define _XAG_H_
#include <X11/extensions/ag.h>
#include <X11/Xfuncproto.h>
#include <stdarg.h>
_XFUNCPROTOBEGIN
typedef XID XAppGroup;
Bool XagQueryVersion(
Display* /* dpy */,
int* /* major_version */,
int* /* minor_version */
);
Status XagCreateEmbeddedApplicationGroup(
Display* /* dpy */,
VisualID /* root_visual */,
Colormap /* default_colormap */,
unsigned long /* black_pixel */,
unsigned long /* white_pixel */,
XAppGroup* /* app_group_return */
);
Status XagCreateNonembeddedApplicationGroup(
Display* /* dpy */,
XAppGroup* /* app_group_return */
);
Status XagDestroyApplicationGroup(
Display* /* dpy */,
XAppGroup /* app_group */
);
Status XagGetApplicationGroupAttributes(
Display* /* dpy */,
XAppGroup /* app_group */,
...
);
Status XagQueryApplicationGroup(
Display* /* dpy */,
XID /* resource_base */,
XAppGroup* /* app_group_ret */
);
Status XagCreateAssociation(
Display* /* dpy */,
Window* /* window_ret */,
void* /* system_window */
);
Status XagDestroyAssociation(
Display* /* dpy */,
Window /* window */
);
_XFUNCPROTOEND
#endif /* _XAG_H_ */
/*
* xtestext1.h
*
* X11 Input Synthesis Extension include file
*/
/*
Copyright 1986, 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Hewlett-Packard not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
Hewlett-Packard makes no representations about the
suitability of this software for any purpose. It is provided
"as is" without express or implied warranty.
This software is not subject to any license of the American
Telephone and Telegraph Company or of the Regents of the
University of California.
*/
#ifndef _XTESTEXT1PROTO_H
#define _XTESTEXT1PROTO_H 1
#include <X11/extensions/xtestext1const.h>
/*
* the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
*/
/*
* XTest request type values
*
* used in the XTest extension protocol requests
*/
#define X_TestFakeInput 1
#define X_TestGetInput 2
#define X_TestStopInput 3
#define X_TestReset 4
#define X_TestQueryInputSize 5
/*
* This defines the maximum size of a list of input actions
* to be sent to the server. It should always be a multiple of
* 4 so that the entire xTestFakeInputReq structure size is a
* multiple of 4.
*/
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 XTestReqType; /* always X_TestFakeInput */
CARD16 length; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
CARD32 ack;
CARD8 action_list[XTestMAX_ACTION_LIST_SIZE];
} xTestFakeInputReq;
#define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 XTestReqType; /* always X_TestGetInput */
CARD16 length; /* 2 */
CARD32 mode;
} xTestGetInputReq;
#define sz_xTestGetInputReq 8
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 XTestReqType; /* always X_TestStopInput */
CARD16 length; /* 1 */
} xTestStopInputReq;
#define sz_xTestStopInputReq 4
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 XTestReqType; /* always X_TestReset */
CARD16 length; /* 1 */
} xTestResetReq;
#define sz_xTestResetReq 4
typedef struct {
CARD8 reqType; /* always XTestReqCode */
CARD8 XTestReqType; /* always X_TestQueryInputSize */
CARD16 length; /* 1 */
} xTestQueryInputSizeReq;
#define sz_xTestQueryInputSizeReq 4
/*
* This is the definition of the reply for the xTestQueryInputSize
* request. It should remain the same minimum size as other replies
* (32 bytes).
*/
typedef struct {
CARD8 type; /* always X_Reply */
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length; /* always 0 */
CARD32 size_return;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xTestQueryInputSizeReply;
/*
* This is the definition for the input action wire event structure.
* This event is sent to the client when the server has one or
* more user input actions to report to the client. It must
* remain the same size as all other wire events (32 bytes).
*/
typedef struct {
CARD8 type; /* always XTestInputActionType */
CARD8 pad00;
CARD16 sequenceNumber;
CARD8 actions[XTestACTIONS_SIZE];
} xTestInputActionEvent;
/*
* This is the definition for the xTestFakeAck wire event structure.
* This event is sent to the client when the server has completely
* processed its input action buffer, and is ready for more.
* It must remain the same size as all other wire events (32 bytes).
*/
typedef struct {
CARD8 type; /* always XTestFakeAckType */
CARD8 pad00;
CARD16 sequenceNumber;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
CARD32 pad06;
CARD32 pad07;
CARD32 pad08;
} xTestFakeAckEvent;
/*
* These are the definitions for key/button motion input actions.
*/
typedef struct {
CARD8 header; /* which device, key up/down */
CARD8 keycode; /* which key/button to move */
CARD16 delay_time; /* how long to delay (in ms) */
} XTestKeyInfo;
/*
* This is the definition for pointer jump input actions.
*/
typedef struct {
CARD8 header; /* which pointer */
CARD8 pad1; /* unused padding byte */
CARD16 jumpx; /* x coord to jump to */
CARD16 jumpy; /* y coord to jump to */
CARD16 delay_time; /* how long to delay (in ms) */
} XTestJumpInfo;
/*
* These are the definitions for pointer relative motion input
* actions.
*
* The sign bits for the x and y relative motions are contained
* in the header byte. The x and y relative motions are packed
* into one byte to make things fit in 32 bits. If the relative
* motion range is larger than +/-15, use the pointer jump action.
*/
typedef struct {
CARD8 header; /* which pointer */
CARD8 motion_data; /* x,y relative motion */
CARD16 delay_time; /* how long to delay (in ms) */
} XTestMotionInfo;
/*
* These are the definitions for a long delay input action. It is
* used when more than XTestSHORT_DELAY_TIME milliseconds of delay
* (approximately one minute) is needed.
*
* The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
* This guarantees that a header byte with a value of 0 is not
* a valid header, so it can be used as a flag to indicate that
* there are no more input actions in an XTestInputAction event.
*/
typedef struct {
CARD8 header; /* always XTestDELAY_DEVICE_ID */
CARD8 pad1; /* unused padding byte */
CARD16 pad2; /* unused padding word */
CARD32 delay_time; /* how long to delay (in ms) */
} XTestDelayInfo;
#endif /* _XTESTEXT1PROTO_H */
/* $XFree86: xc/include/extensions/xf86misc.h,v 3.16 2002/11/20 04:04:56 dawes Exp $ */
/*
* Copyright (c) 1995, 1996 The XFree86 Project, Inc
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _XF86MISC_H_
#define _XF86MISC_H_
#include <X11/Xfuncproto.h>
#define X_XF86MiscQueryVersion 0
#ifdef _XF86MISC_SAVER_COMPAT_
#define X_XF86MiscGetSaver 1
#define X_XF86MiscSetSaver 2
#endif
#define X_XF86MiscGetMouseSettings 3
#define X_XF86MiscGetKbdSettings 4
#define X_XF86MiscSetMouseSettings 5
#define X_XF86MiscSetKbdSettings 6
#define X_XF86MiscSetGrabKeysState 7
#define X_XF86MiscSetClientVersion 8
#define X_XF86MiscGetFilePaths 9
#define X_XF86MiscPassMessage 10
#define XF86MiscNumberEvents 0
#define XF86MiscBadMouseProtocol 0
#define XF86MiscBadMouseBaudRate 1
#define XF86MiscBadMouseFlags 2
#define XF86MiscBadMouseCombo 3
#define XF86MiscBadKbdType 4
#define XF86MiscModInDevDisabled 5
#define XF86MiscModInDevClientNotLocal 6
#define XF86MiscNoModule 7
#define XF86MiscNumberErrors (XF86MiscNoModule + 1)
/* Never renumber these */
#define MTYPE_MICROSOFT 0
#define MTYPE_MOUSESYS 1
#define MTYPE_MMSERIES 2
#define MTYPE_LOGITECH 3
#define MTYPE_BUSMOUSE 4
#define MTYPE_LOGIMAN 5
#define MTYPE_PS_2 6
#define MTYPE_MMHIT 7
#define MTYPE_GLIDEPOINT 8
#define MTYPE_IMSERIAL 9
#define MTYPE_THINKING 10
#define MTYPE_IMPS2 11
#define MTYPE_THINKINGPS2 12
#define MTYPE_MMANPLUSPS2 13
#define MTYPE_GLIDEPOINTPS2 14
#define MTYPE_NETPS2 15
#define MTYPE_NETSCROLLPS2 16
#define MTYPE_SYSMOUSE 17
#define MTYPE_AUTOMOUSE 18
#define MTYPE_ACECAD 19
#define MTYPE_EXPPS2 20
#define MTYPE_XQUEUE 127
#define MTYPE_OSMOUSE 126
#define MTYPE_UNKNOWN 125
#define KTYPE_UNKNOWN 0
#define KTYPE_84KEY 1
#define KTYPE_101KEY 2
#define KTYPE_OTHER 3
#define KTYPE_XQUEUE 4
#define MF_CLEAR_DTR 1
#define MF_CLEAR_RTS 2
#define MF_REOPEN 128
#ifndef _XF86MISC_SERVER_
/* return values for XF86MiscSetGrabKeysState */
#define MiscExtGrabStateSuccess 0 /* No errors */
#define MiscExtGrabStateLocked 1 /* A client already requested that
* grabs cannot be removed/killed */
#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling
* grab removal/kill already done */
_XFUNCPROTOBEGIN
typedef struct {
char* device;
int type;
int baudrate;
int samplerate;
int resolution;
int buttons;
Bool emulate3buttons;
int emulate3timeout;
Bool chordmiddle;
int flags;
} XF86MiscMouseSettings;
typedef struct {
int type;
int rate;
int delay;
Bool servnumlock;
} XF86MiscKbdSettings;
typedef struct {
char* configfile;
char* modulepath;
char* logfile;
} XF86MiscFilePaths;
Bool XF86MiscQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Bool XF86MiscQueryExtension(
Display* /* dpy */,
int* /* event_base */,
int* /* error_base */
);
Bool XF86MiscSetClientVersion(
Display *dpy /* dpy */
);
Status XF86MiscGetMouseSettings(
Display* /* dpy */,
XF86MiscMouseSettings* /* mouse info */
);
Status XF86MiscGetKbdSettings(
Display* /* dpy */,
XF86MiscKbdSettings* /* keyboard info */
);
Status XF86MiscSetMouseSettings(
Display* /* dpy */,
XF86MiscMouseSettings* /* mouse info */
);
Status XF86MiscSetKbdSettings(
Display* /* dpy */,
XF86MiscKbdSettings* /* keyboard info */
);
int XF86MiscSetGrabKeysState(
Display* /* dpy */,
Bool /* enabled */
);
Status XF86MiscGetFilePaths(
Display* /* dpy */,
XF86MiscFilePaths* /* file paths/locations */
);
Status XF86MiscPassMessage(
Display* /* dpy */,
int /* screen */,
const char* /* message name/type */,
const char* /* message contents/value */,
char ** /* returned message */
);
_XFUNCPROTOEND
#endif
#endif
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef XVPROTO_H
#define XVPROTO_H
/*
** File:
**
** Xvproto.h --- Xv protocol header file
**
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 11.06.91 Carver
** - changed SetPortControl to SetPortAttribute
** - changed GetPortControl to GetPortAttribute
** - changed QueryBestSize
**
** 15.05.91 Carver
** - version 2.0 upgrade
**
** 24.01.91 Carver
** - version 1.4 upgrade
**
*/
#include <X11/Xmd.h>
/* Symbols: These are undefined at the end of this file to restore the
values they have in Xv.h */
#define XvPortID CARD32
#define XvEncodingID CARD32
#define ShmSeg CARD32
#define VisualID CARD32
#define Drawable CARD32
#define GContext CARD32
#define Time CARD32
#define Atom CARD32
/* Structures */
typedef struct {
INT32 numerator;
INT32 denominator;
} xvRational;
#define sz_xvRational 8
typedef struct {
XvPortID base_id;
CARD16 name_size;
CARD16 num_ports;
CARD16 num_formats;
CARD8 type;
CARD8 pad;
} xvAdaptorInfo;
#define sz_xvAdaptorInfo 12
typedef struct {
XvEncodingID encoding;
CARD16 name_size;
CARD16 width, height;
CARD16 pad;
xvRational rate;
} xvEncodingInfo;
#define sz_xvEncodingInfo (12 + sz_xvRational)
typedef struct {
VisualID visual;
CARD8 depth;
CARD8 pad1;
CARD16 pad2;
} xvFormat;
#define sz_xvFormat 8
typedef struct {
CARD32 flags;
INT32 min;
INT32 max;
CARD32 size;
} xvAttributeInfo;
#define sz_xvAttributeInfo 16
typedef struct {
CARD32 id;
CARD8 type;
CARD8 byte_order;
CARD16 pad1;
CARD8 guid[16];
CARD8 bpp;
CARD8 num_planes;
CARD16 pad2;
CARD8 depth;
CARD8 pad3;
CARD16 pad4;
CARD32 red_mask;
CARD32 green_mask;
CARD32 blue_mask;
CARD8 format;
CARD8 pad5;
CARD16 pad6;
CARD32 y_sample_bits;
CARD32 u_sample_bits;
CARD32 v_sample_bits;
CARD32 horz_y_period;
CARD32 horz_u_period;
CARD32 horz_v_period;
CARD32 vert_y_period;
CARD32 vert_u_period;
CARD32 vert_v_period;
CARD8 comp_order[32];
CARD8 scanline_order;
CARD8 pad7;
CARD16 pad8;
CARD32 pad9;
CARD32 pad10;
} xvImageFormatInfo;
#define sz_xvImageFormatInfo 128
/* Requests */
#define xv_QueryExtension 0
#define xv_QueryAdaptors 1
#define xv_QueryEncodings 2
#define xv_GrabPort 3
#define xv_UngrabPort 4
#define xv_PutVideo 5
#define xv_PutStill 6
#define xv_GetVideo 7
#define xv_GetStill 8
#define xv_StopVideo 9
#define xv_SelectVideoNotify 10
#define xv_SelectPortNotify 11
#define xv_QueryBestSize 12
#define xv_SetPortAttribute 13
#define xv_GetPortAttribute 14
#define xv_QueryPortAttributes 15
#define xv_ListImageFormats 16
#define xv_QueryImageAttributes 17
#define xv_PutImage 18
#define xv_ShmPutImage 19
#define xv_LastRequest xv_ShmPutImage
#define xvNumRequests (xv_LastRequest + 1)
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
} xvQueryExtensionReq;
#define sz_xvQueryExtensionReq 4
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
CARD32 window;
} xvQueryAdaptorsReq;
#define sz_xvQueryAdaptorsReq 8
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
CARD32 port;
} xvQueryEncodingsReq;
#define sz_xvQueryEncodingsReq 8
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
GContext gc;
INT16 vid_x;
INT16 vid_y;
CARD16 vid_w;
CARD16 vid_h;
INT16 drw_x;
INT16 drw_y;
CARD16 drw_w;
CARD16 drw_h;
} xvPutVideoReq;
#define sz_xvPutVideoReq 32
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
GContext gc;
INT16 vid_x;
INT16 vid_y;
CARD16 vid_w;
CARD16 vid_h;
INT16 drw_x;
INT16 drw_y;
CARD16 drw_w;
CARD16 drw_h;
} xvPutStillReq;
#define sz_xvPutStillReq 32
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
GContext gc;
INT16 vid_x;
INT16 vid_y;
CARD16 vid_w;
CARD16 vid_h;
INT16 drw_x;
INT16 drw_y;
CARD16 drw_w;
CARD16 drw_h;
} xvGetVideoReq;
#define sz_xvGetVideoReq 32
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
GContext gc;
INT16 vid_x;
INT16 vid_y;
CARD16 vid_w;
CARD16 vid_h;
INT16 drw_x;
INT16 drw_y;
CARD16 drw_w;
CARD16 drw_h;
} xvGetStillReq;
#define sz_xvGetStillReq 32
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Time time;
} xvGrabPortReq;
#define sz_xvGrabPortReq 12
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Time time;
} xvUngrabPortReq;
#define sz_xvUngrabPortReq 12
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
Drawable drawable;
BOOL onoff;
CARD8 pad1;
CARD16 pad2;
} xvSelectVideoNotifyReq;
#define sz_xvSelectVideoNotifyReq 12
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
BOOL onoff;
CARD8 pad1;
CARD16 pad2;
} xvSelectPortNotifyReq;
#define sz_xvSelectPortNotifyReq 12
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
} xvStopVideoReq;
#define sz_xvStopVideoReq 12
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Atom attribute;
INT32 value;
} xvSetPortAttributeReq;
#define sz_xvSetPortAttributeReq 16
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Atom attribute;
} xvGetPortAttributeReq;
#define sz_xvGetPortAttributeReq 12
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
CARD16 vid_w;
CARD16 vid_h;
CARD16 drw_w;
CARD16 drw_h;
CARD8 motion;
CARD8 pad1;
CARD16 pad2;
} xvQueryBestSizeReq;
#define sz_xvQueryBestSizeReq 20
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
} xvQueryPortAttributesReq;
#define sz_xvQueryPortAttributesReq 8
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
GContext gc;
CARD32 id;
INT16 src_x;
INT16 src_y;
CARD16 src_w;
CARD16 src_h;
INT16 drw_x;
INT16 drw_y;
CARD16 drw_w;
CARD16 drw_h;
CARD16 width;
CARD16 height;
} xvPutImageReq;
#define sz_xvPutImageReq 40
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
Drawable drawable;
GContext gc;
ShmSeg shmseg;
CARD32 id;
CARD32 offset;
INT16 src_x;
INT16 src_y;
CARD16 src_w;
CARD16 src_h;
INT16 drw_x;
INT16 drw_y;
CARD16 drw_w;
CARD16 drw_h;
CARD16 width;
CARD16 height;
CARD8 send_event;
CARD8 pad1;
CARD16 pad2;
} xvShmPutImageReq;
#define sz_xvShmPutImageReq 52
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
XvPortID port;
} xvListImageFormatsReq;
#define sz_xvListImageFormatsReq 8
typedef struct {
CARD8 reqType;
CARD8 xvReqType;
CARD16 length;
CARD32 port;
CARD32 id;
CARD16 width;
CARD16 height;
} xvQueryImageAttributesReq;
#define sz_xvQueryImageAttributesReq 16
/* Replies */
typedef struct _QueryExtensionReply {
BYTE type; /* X_Reply */
CARD8 padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 version;
CARD16 revision;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvQueryExtensionReply;
#define sz_xvQueryExtensionReply 32
typedef struct _QueryAdaptorsReply {
BYTE type; /* X_Reply */
CARD8 padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 num_adaptors;
CARD16 pads3;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvQueryAdaptorsReply;
#define sz_xvQueryAdaptorsReply 32
typedef struct _QueryEncodingsReply {
BYTE type; /* X_Reply */
CARD8 padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 num_encodings;
CARD16 padl3;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvQueryEncodingsReply;
#define sz_xvQueryEncodingsReply 32
typedef struct {
BYTE type; /* X_Reply */
BYTE result;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD32 padl3;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvGrabPortReply;
#define sz_xvGrabPortReply 32
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
INT32 value;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvGetPortAttributeReply;
#define sz_xvGetPortAttributeReply 32
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD16 actual_width;
CARD16 actual_height;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvQueryBestSizeReply;
#define sz_xvQueryBestSizeReply 32
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD32 num_attributes;
CARD32 text_size;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvQueryPortAttributesReply;
#define sz_xvQueryPortAttributesReply 32
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_formats;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvListImageFormatsReply;
#define sz_xvListImageFormatsReply 32
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_planes;
CARD32 data_size;
CARD16 width;
CARD16 height;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} xvQueryImageAttributesReply;
#define sz_xvQueryImageAttributesReply 32
/* DEFINE EVENT STRUCTURE */
typedef struct {
union {
struct {
BYTE type;
BYTE detail;
CARD16 sequenceNumber;
} u;
struct {
BYTE type;
BYTE reason;
CARD16 sequenceNumber;
Time time;
Drawable drawable;
XvPortID port;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} videoNotify;
struct {
BYTE type;
BYTE padb1;
CARD16 sequenceNumber;
Time time;
XvPortID port;
Atom attribute;
INT32 value;
CARD32 padl6;
CARD32 padl7;
CARD32 padl8;
} portNotify;
} u;
} xvEvent;
#undef XvPortID
#undef XvEncodingID
#undef ShmSeg
#undef VisualID
#undef Drawable
#undef GContext
#undef Time
#undef Atom
#endif /* XVPROTO_H */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XEVI_H_
#define _XEVI_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/EVI.h>
typedef struct {
VisualID core_visual_id;
int screen;
int level;
unsigned int transparency_type;
unsigned int transparency_value;
unsigned int min_hw_colormaps;
unsigned int max_hw_colormaps;
unsigned int num_colormap_conflicts;
VisualID* colormap_conflicts;
} ExtendedVisualInfo;
_XFUNCPROTOBEGIN
Bool XeviQueryExtension(
Display* /* dpy */
);
Status XeviQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Status XeviGetVisualInfo(
Display* /* dpy */,
VisualID* /* visual_query */,
int /* nVisual_query */,
ExtendedVisualInfo** /* extendedVisualInfo_return */,
int* /* nInfo_return */
);
_XFUNCPROTOEND
#endif
/*
* Declarations for the BIGFONT extension.
*
* Copyright (c) 1999-2000 Bruno Haible
* Copyright (c) 1999-2000 The XFree86 Project, Inc.
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _XF86BIGFONT_H_
#define _XF86BIGFONT_H_
#define X_XF86BigfontQueryVersion 0
#define X_XF86BigfontQueryFont 1
#define XF86BigfontNumberEvents 0
#define XF86BigfontNumberErrors 0
#endif /* _XF86BIGFONT_H_ */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XKB_H_
#define _XKB_H_
/*
* XKB request codes, used in:
* - xkbReqType field of all requests
* - requestMinor field of some events
*/
#define X_kbUseExtension 0
#define X_kbSelectEvents 1
#define X_kbBell 3
#define X_kbGetState 4
#define X_kbLatchLockState 5
#define X_kbGetControls 6
#define X_kbSetControls 7
#define X_kbGetMap 8
#define X_kbSetMap 9
#define X_kbGetCompatMap 10
#define X_kbSetCompatMap 11
#define X_kbGetIndicatorState 12
#define X_kbGetIndicatorMap 13
#define X_kbSetIndicatorMap 14
#define X_kbGetNamedIndicator 15
#define X_kbSetNamedIndicator 16
#define X_kbGetNames 17
#define X_kbSetNames 18
#define X_kbGetGeometry 19
#define X_kbSetGeometry 20
#define X_kbPerClientFlags 21
#define X_kbListComponents 22
#define X_kbGetKbdByName 23
#define X_kbGetDeviceInfo 24
#define X_kbSetDeviceInfo 25
#define X_kbSetDebuggingFlags 101
/*
* In the X sense, XKB reports only one event.
* The type field of all XKB events is XkbEventCode
*/
#define XkbEventCode 0
#define XkbNumberEvents (XkbEventCode+1)
/*
* XKB has a minor event code so it can use one X event code for
* multiple purposes.
* - reported in the xkbType field of all XKB events.
* - XkbSelectEventDetails: Indicates the event for which event details
* are being changed
*/
#define XkbNewKeyboardNotify 0
#define XkbMapNotify 1
#define XkbStateNotify 2
#define XkbControlsNotify 3
#define XkbIndicatorStateNotify 4
#define XkbIndicatorMapNotify 5
#define XkbNamesNotify 6
#define XkbCompatMapNotify 7
#define XkbBellNotify 8
#define XkbActionMessage 9
#define XkbAccessXNotify 10
#define XkbExtensionDeviceNotify 11
/*
* Event Mask:
* - XkbSelectEvents: Specifies event interest.
*/
#define XkbNewKeyboardNotifyMask (1L << 0)
#define XkbMapNotifyMask (1L << 1)
#define XkbStateNotifyMask (1L << 2)
#define XkbControlsNotifyMask (1L << 3)
#define XkbIndicatorStateNotifyMask (1L << 4)
#define XkbIndicatorMapNotifyMask (1L << 5)
#define XkbNamesNotifyMask (1L << 6)
#define XkbCompatMapNotifyMask (1L << 7)
#define XkbBellNotifyMask (1L << 8)
#define XkbActionMessageMask (1L << 9)
#define XkbAccessXNotifyMask (1L << 10)
#define XkbExtensionDeviceNotifyMask (1L << 11)
#define XkbAllEventsMask (0xFFF)
/*
* NewKeyboardNotify event details:
*/
#define XkbNKN_KeycodesMask (1L << 0)
#define XkbNKN_GeometryMask (1L << 1)
#define XkbNKN_DeviceIDMask (1L << 2)
#define XkbAllNewKeyboardEventsMask (0x7)
/*
* AccessXNotify event types:
* - The 'what' field of AccessXNotify events reports the
* reason that the event was generated.
*/
#define XkbAXN_SKPress 0
#define XkbAXN_SKAccept 1
#define XkbAXN_SKReject 2
#define XkbAXN_SKRelease 3
#define XkbAXN_BKAccept 4
#define XkbAXN_BKReject 5
#define XkbAXN_AXKWarning 6
/*
* AccessXNotify details:
* - Used as an event detail mask to limit the conditions under which
* AccessXNotify events are reported
*/
#define XkbAXN_SKPressMask (1L << 0)
#define XkbAXN_SKAcceptMask (1L << 1)
#define XkbAXN_SKRejectMask (1L << 2)
#define XkbAXN_SKReleaseMask (1L << 3)
#define XkbAXN_BKAcceptMask (1L << 4)
#define XkbAXN_BKRejectMask (1L << 5)
#define XkbAXN_AXKWarningMask (1L << 6)
#define XkbAllAccessXEventsMask (0x7f)
/*
* Miscellaneous event details:
* - event detail masks for assorted events that don't reall
* have any details.
*/
#define XkbAllStateEventsMask XkbAllStateComponentsMask
#define XkbAllMapEventsMask XkbAllMapComponentsMask
#define XkbAllControlEventsMask XkbAllControlsMask
#define XkbAllIndicatorEventsMask XkbAllIndicatorsMask
#define XkbAllNameEventsMask XkbAllNamesMask
#define XkbAllCompatMapEventsMask XkbAllCompatMask
#define XkbAllBellEventsMask (1L << 0)
#define XkbAllActionMessagesMask (1L << 0)
/*
* XKB reports one error: BadKeyboard
* A further reason for the error is encoded into to most significant
* byte of the resourceID for the error:
* XkbErr_BadDevice - the device in question was not found
* XkbErr_BadClass - the device was found but it doesn't belong to
* the appropriate class.
* XkbErr_BadId - the device was found and belongs to the right
* class, but not feedback with a matching id was
* found.
* The low byte of the resourceID for this error contains the device
* id, class specifier or feedback id that failed.
*/
#define XkbKeyboard 0
#define XkbNumberErrors 1
#define XkbErr_BadDevice 0xff
#define XkbErr_BadClass 0xfe
#define XkbErr_BadId 0xfd
/*
* Keyboard Components Mask:
* - Specifies the components that follow a GetKeyboardByNameReply
*/
#define XkbClientMapMask (1L << 0)
#define XkbServerMapMask (1L << 1)
#define XkbCompatMapMask (1L << 2)
#define XkbIndicatorMapMask (1L << 3)
#define XkbNamesMask (1L << 4)
#define XkbGeometryMask (1L << 5)
#define XkbControlsMask (1L << 6)
#define XkbAllComponentsMask (0x7f)
/*
* State detail mask:
* - The 'changed' field of StateNotify events reports which of
* the keyboard state components have changed.
* - Used as an event detail mask to limit the conditions under
* which StateNotify events are reported.
*/
#define XkbModifierStateMask (1L << 0)
#define XkbModifierBaseMask (1L << 1)
#define XkbModifierLatchMask (1L << 2)
#define XkbModifierLockMask (1L << 3)
#define XkbGroupStateMask (1L << 4)
#define XkbGroupBaseMask (1L << 5)
#define XkbGroupLatchMask (1L << 6)
#define XkbGroupLockMask (1L << 7)
#define XkbCompatStateMask (1L << 8)
#define XkbGrabModsMask (1L << 9)
#define XkbCompatGrabModsMask (1L << 10)
#define XkbLookupModsMask (1L << 11)
#define XkbCompatLookupModsMask (1L << 12)
#define XkbPointerButtonMask (1L << 13)
#define XkbAllStateComponentsMask (0x3fff)
/*
* Controls detail masks:
* The controls specified in XkbAllControlsMask:
* - The 'changed' field of ControlsNotify events reports which of
* the keyboard controls have changed.
* - The 'changeControls' field of the SetControls request specifies
* the controls for which values are to be changed.
* - Used as an event detail mask to limit the conditions under
* which ControlsNotify events are reported.
*
* The controls specified in the XkbAllBooleanCtrlsMask:
* - The 'enabledControls' field of ControlsNotify events reports the
* current status of the boolean controls.
* - The 'enabledControlsChanges' field of ControlsNotify events reports
* any boolean controls that have been turned on or off.
* - The 'affectEnabledControls' and 'enabledControls' fields of the
* kbSetControls request change the set of enabled controls.
* - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
* an XkbControlsRec specify the controls to be changed if the keyboard
* times out and the values to which they should be changed.
* - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags
* request specifies the specify the controls to be reset when the
* client exits and the values to which they should be reset.
* - The 'ctrls' field of an indicator map specifies the controls
* that drive the indicator.
* - Specifies the boolean controls affected by the SetControls and
* LockControls key actions.
*/
#define XkbRepeatKeysMask (1L << 0)
#define XkbSlowKeysMask (1L << 1)
#define XkbBounceKeysMask (1L << 2)
#define XkbStickyKeysMask (1L << 3)
#define XkbMouseKeysMask (1L << 4)
#define XkbMouseKeysAccelMask (1L << 5)
#define XkbAccessXKeysMask (1L << 6)
#define XkbAccessXTimeoutMask (1L << 7)
#define XkbAccessXFeedbackMask (1L << 8)
#define XkbAudibleBellMask (1L << 9)
#define XkbOverlay1Mask (1L << 10)
#define XkbOverlay2Mask (1L << 11)
#define XkbIgnoreGroupLockMask (1L << 12)
#define XkbGroupsWrapMask (1L << 27)
#define XkbInternalModsMask (1L << 28)
#define XkbIgnoreLockModsMask (1L << 29)
#define XkbPerKeyRepeatMask (1L << 30)
#define XkbControlsEnabledMask (1L << 31)
#define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask)
#define XkbAllBooleanCtrlsMask (0x00001FFF)
#define XkbAllControlsMask (0xF8001FFF)
#define XkbAllControlEventsMask XkbAllControlsMask
/*
* AccessX Options Mask
* - The 'accessXOptions' field of an XkbControlsRec specifies the
* AccessX options that are currently in effect.
* - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
* fields of an XkbControlsRec specify the Access X options to be
* changed if the keyboard times out and the values to which they
* should be changed.
*/
#define XkbAX_SKPressFBMask (1L << 0)
#define XkbAX_SKAcceptFBMask (1L << 1)
#define XkbAX_FeatureFBMask (1L << 2)
#define XkbAX_SlowWarnFBMask (1L << 3)
#define XkbAX_IndicatorFBMask (1L << 4)
#define XkbAX_StickyKeysFBMask (1L << 5)
#define XkbAX_TwoKeysMask (1L << 6)
#define XkbAX_LatchToLockMask (1L << 7)
#define XkbAX_SKReleaseFBMask (1L << 8)
#define XkbAX_SKRejectFBMask (1L << 9)
#define XkbAX_BKRejectFBMask (1L << 10)
#define XkbAX_DumbBellFBMask (1L << 11)
#define XkbAX_FBOptionsMask (0xF3F)
#define XkbAX_SKOptionsMask (0x0C0)
#define XkbAX_AllOptionsMask (0xFFF)
/*
* XkbUseCoreKbd is used to specify the core keyboard without having
* to look up its X input extension identifier.
* XkbUseCorePtr is used to specify the core pointer without having
* to look up its X input extension identifier.
* XkbDfltXIClass is used to specify "don't care" any place that the
* XKB protocol is looking for an X Input Extension
* device class.
* XkbDfltXIId is used to specify "don't care" any place that the
* XKB protocol is looking for an X Input Extension
* feedback identifier.
* XkbAllXIClasses is used to get information about all device indicators,
* whether they're part of the indicator feedback class
* or the keyboard feedback class.
* XkbAllXIIds is used to get information about all device indicator
* feedbacks without having to list them.
* XkbXINone is used to indicate that no class or id has been specified.
* XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs
* XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
* XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
* XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class
* XkbExplicitXIId(c) True if 'i' explicitly specifies a device id
* XkbSingleXIClass(c) True if 'c' specifies exactly one device class,
* including the default.
* XkbSingleXIId(i) True if 'i' specifies exactly one device
* identifier, including the default.
*/
#define XkbUseCoreKbd 0x0100
#define XkbUseCorePtr 0x0200
#define XkbDfltXIClass 0x0300
#define XkbDfltXIId 0x0400
#define XkbAllXIClasses 0x0500
#define XkbAllXIIds 0x0600
#define XkbXINone 0xff00
#define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\
((c)==LedFeedbackClass)||\
((c)==XkbDfltXIClass)||\
((c)==XkbAllXIClasses))
#define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\
((c)==BellFeedbackClass)||\
((c)==XkbDfltXIClass)||\
((c)==XkbAllXIClasses))
#define XkbExplicitXIDevice(c) (((c)&(~0xff))==0)
#define XkbExplicitXIClass(c) (((c)&(~0xff))==0)
#define XkbExplicitXIId(c) (((c)&(~0xff))==0)
#define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
#define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
#define XkbNoModifier 0xff
#define XkbNoShiftLevel 0xff
#define XkbNoShape 0xff
#define XkbNoIndicator 0xff
#define XkbNoModifierMask 0
#define XkbAllModifiersMask 0xff
#define XkbAllVirtualModsMask 0xffff
#define XkbNumKbdGroups 4
#define XkbMaxKbdGroup (XkbNumKbdGroups-1)
#define XkbMaxMouseKeysBtn 4
/*
* Group Index and Mask:
* - Indices into the kt_index array of a key type.
* - Mask specifies types to be changed for XkbChangeTypesOfKey
*/
#define XkbGroup1Index 0
#define XkbGroup2Index 1
#define XkbGroup3Index 2
#define XkbGroup4Index 3
#define XkbAnyGroup 254
#define XkbAllGroups 255
#define XkbGroup1Mask (1<<0)
#define XkbGroup2Mask (1<<1)
#define XkbGroup3Mask (1<<2)
#define XkbGroup4Mask (1<<3)
#define XkbAnyGroupMask (1<<7)
#define XkbAllGroupsMask (0xf)
/*
* BuildCoreState: Given a keyboard group and a modifier state,
* construct the value to be reported an event.
* GroupForCoreState: Given the state reported in an event,
* determine the keyboard group.
* IsLegalGroup: Returns TRUE if 'g' is a valid group index.
*/
#define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff))
#define XkbGroupForCoreState(s) (((s)>>13)&0x3)
#define XkbIsLegalGroup(g) (((g)>=0)&&((g)<XkbNumKbdGroups))
/*
* GroupsWrap values:
* - The 'groupsWrap' field of an XkbControlsRec specifies the
* treatment of out of range groups.
* - Bits 6 and 7 of the group info field of a key symbol map
* specify the interpretation of out of range groups for the
* corresponding key.
*/
#define XkbWrapIntoRange (0x00)
#define XkbClampIntoRange (0x40)
#define XkbRedirectIntoRange (0x80)
/*
* Action flags: Reported in the 'flags' field of most key actions.
* Interpretation depends on the type of the action; not all actions
* accept all flags.
*
* Option Used for Actions
* ------ ----------------
* ClearLocks SetMods, LatchMods, SetGroup, LatchGroup
* LatchToLock SetMods, LatchMods, SetGroup, LatchGroup
* LockNoLock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
* LockNoUnlock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
* UseModMapMods SetMods, LatchMods, LockMods, ISOLock
* GroupAbsolute SetGroup, LatchGroup, LockGroup, ISOLock
* UseDfltButton PtrBtn, LockPtrBtn
* NoAcceleration MovePtr
* MoveAbsoluteX MovePtr
* MoveAbsoluteY MovePtr
* ISODfltIsGroup ISOLock
* ISONoAffectMods ISOLock
* ISONoAffectGroup ISOLock
* ISONoAffectPtr ISOLock
* ISONoAffectCtrls ISOLock
* MessageOnPress ActionMessage
* MessageOnRelease ActionMessage
* MessageGenKeyEvent ActionMessage
* AffectDfltBtn SetPtrDflt
* DfltBtnAbsolute SetPtrDflt
* SwitchApplication SwitchScreen
* SwitchAbsolute SwitchScreen
*/
#define XkbSA_ClearLocks (1L << 0)
#define XkbSA_LatchToLock (1L << 1)
#define XkbSA_LockNoLock (1L << 0)
#define XkbSA_LockNoUnlock (1L << 1)
#define XkbSA_UseModMapMods (1L << 2)
#define XkbSA_GroupAbsolute (1L << 2)
#define XkbSA_UseDfltButton 0
#define XkbSA_NoAcceleration (1L << 0)
#define XkbSA_MoveAbsoluteX (1L << 1)
#define XkbSA_MoveAbsoluteY (1L << 2)
#define XkbSA_ISODfltIsGroup (1L << 7)
#define XkbSA_ISONoAffectMods (1L << 6)
#define XkbSA_ISONoAffectGroup (1L << 5)
#define XkbSA_ISONoAffectPtr (1L << 4)
#define XkbSA_ISONoAffectCtrls (1L << 3)
#define XkbSA_ISOAffectMask (0x78)
#define XkbSA_MessageOnPress (1L << 0)
#define XkbSA_MessageOnRelease (1L << 1)
#define XkbSA_MessageGenKeyEvent (1L << 2)
#define XkbSA_AffectDfltBtn 1
#define XkbSA_DfltBtnAbsolute (1L << 2)
#define XkbSA_SwitchApplication (1L << 0)
#define XkbSA_SwitchAbsolute (1L << 2)
/*
* The following values apply to the SA_DeviceValuator
* action only. Valuator operations specify the action
* to be taken. Values specified in the action are
* multiplied by 2^scale before they are applied.
*/
#define XkbSA_IgnoreVal (0x00)
#define XkbSA_SetValMin (0x10)
#define XkbSA_SetValCenter (0x20)
#define XkbSA_SetValMax (0x30)
#define XkbSA_SetValRelative (0x40)
#define XkbSA_SetValAbsolute (0x50)
#define XkbSA_ValOpMask (0x70)
#define XkbSA_ValScaleMask (0x07)
#define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask)
#define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask)
/*
* Action types: specifies the type of a key action. Reported in the
* type field of all key actions.
*/
#define XkbSA_NoAction 0x00
#define XkbSA_SetMods 0x01
#define XkbSA_LatchMods 0x02
#define XkbSA_LockMods 0x03
#define XkbSA_SetGroup 0x04
#define XkbSA_LatchGroup 0x05
#define XkbSA_LockGroup 0x06
#define XkbSA_MovePtr 0x07
#define XkbSA_PtrBtn 0x08
#define XkbSA_LockPtrBtn 0x09
#define XkbSA_SetPtrDflt 0x0a
#define XkbSA_ISOLock 0x0b
#define XkbSA_Terminate 0x0c
#define XkbSA_SwitchScreen 0x0d
#define XkbSA_SetControls 0x0e
#define XkbSA_LockControls 0x0f
#define XkbSA_ActionMessage 0x10
#define XkbSA_RedirectKey 0x11
#define XkbSA_DeviceBtn 0x12
#define XkbSA_LockDeviceBtn 0x13
#define XkbSA_DeviceValuator 0x14
#define XkbSA_LastAction XkbSA_DeviceValuator
#define XkbSA_NumActions (XkbSA_LastAction+1)
#define XkbSA_XFree86Private 0x86
/*
* Specifies the key actions that clear latched groups or modifiers.
*/
#define XkbSA_BreakLatch \
((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
(1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
(1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
(1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
/*
* Macros to classify key actions
*/
#define XkbIsModAction(a) (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
#define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
#define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
/*
* Key Behavior Qualifier:
* KB_Permanent indicates that the behavior describes an unalterable
* characteristic of the keyboard, not an XKB software-simulation of
* the listed behavior.
* Key Behavior Types:
* Specifies the behavior of the underlying key.
*/
#define XkbKB_Permanent 0x80
#define XkbKB_OpMask 0x7f
#define XkbKB_Default 0x00
#define XkbKB_Lock 0x01
#define XkbKB_RadioGroup 0x02
#define XkbKB_Overlay1 0x03
#define XkbKB_Overlay2 0x04
#define XkbKB_RGAllowNone 0x80
/*
* Various macros which describe the range of legal keycodes.
*/
#define XkbMinLegalKeyCode 8
#define XkbMaxLegalKeyCode 255
#define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8)
/* Seems kinda silly to check that an unsigned char is <= 255... */
#define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode)
/*
* Assorted constants and limits.
*/
#define XkbNumModifiers 8
#define XkbNumVirtualMods 16
#define XkbNumIndicators 32
#define XkbAllIndicatorsMask (0xffffffff)
#define XkbMaxRadioGroups 32
#define XkbAllRadioGroupsMask (0xffffffff)
#define XkbMaxShiftLevel 63
#define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups)
#define XkbRGMaxMembers 12
#define XkbActionMessageLength 6
#define XkbKeyNameLength 4
#define XkbMaxRedirectCount 8
#define XkbGeomPtsPerMM 10
#define XkbGeomMaxColors 32
#define XkbGeomMaxLabelColors 3
#define XkbGeomMaxPriority 255
/*
* Key Type index and mask for the four standard key types.
*/
#define XkbOneLevelIndex 0
#define XkbTwoLevelIndex 1
#define XkbAlphabeticIndex 2
#define XkbKeypadIndex 3
#define XkbLastRequiredType XkbKeypadIndex
#define XkbNumRequiredTypes (XkbLastRequiredType+1)
#define XkbMaxKeyTypes 255
#define XkbOneLevelMask (1<<0)
#define XkbTwoLevelMask (1<<1)
#define XkbAlphabeticMask (1<<2)
#define XkbKeypadMask (1<<3)
#define XkbAllRequiredTypes (0xf)
#define XkbShiftLevel(n) ((n)-1)
#define XkbShiftLevelMask(n) (1<<((n)-1))
/*
* Extension name and version information
*/
#define XkbName "XKEYBOARD"
#define XkbMajorVersion 1
#define XkbMinorVersion 0
/*
* Explicit map components:
* - Used in the 'explicit' field of an XkbServerMap. Specifies
* the keyboard components that should _not_ be updated automatically
* in response to core protocol keyboard mapping requests.
*/
#define XkbExplicitKeyTypesMask (0x0f)
#define XkbExplicitKeyType1Mask (1<<0)
#define XkbExplicitKeyType2Mask (1<<1)
#define XkbExplicitKeyType3Mask (1<<2)
#define XkbExplicitKeyType4Mask (1<<3)
#define XkbExplicitInterpretMask (1<<4)
#define XkbExplicitAutoRepeatMask (1<<5)
#define XkbExplicitBehaviorMask (1<<6)
#define XkbExplicitVModMapMask (1<<7)
#define XkbAllExplicitMask (0xff)
/*
* Map components masks:
* Those in AllMapComponentsMask:
* - Specifies the individual fields to be loaded or changed for the
* GetMap and SetMap requests.
* Those in ClientInfoMask:
* - Specifies the components to be allocated by XkbAllocClientMap.
* Those in ServerInfoMask:
* - Specifies the components to be allocated by XkbAllocServerMap.
*/
#define XkbKeyTypesMask (1<<0)
#define XkbKeySymsMask (1<<1)
#define XkbModifierMapMask (1<<2)
#define XkbExplicitComponentsMask (1<<3)
#define XkbKeyActionsMask (1<<4)
#define XkbKeyBehaviorsMask (1<<5)
#define XkbVirtualModsMask (1<<6)
#define XkbVirtualModMapMask (1<<7)
#define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
#define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
#define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask)
/*
* Symbol interpretations flags:
* - Used in the flags field of a symbol interpretation
*/
#define XkbSI_AutoRepeat (1<<0)
#define XkbSI_LockingKey (1<<1)
/*
* Symbol interpretations match specification:
* - Used in the match field of a symbol interpretation to specify
* the conditions under which an interpretation is used.
*/
#define XkbSI_LevelOneOnly (0x80)
#define XkbSI_OpMask (0x7f)
#define XkbSI_NoneOf (0)
#define XkbSI_AnyOfOrNone (1)
#define XkbSI_AnyOf (2)
#define XkbSI_AllOf (3)
#define XkbSI_Exactly (4)
/*
* Indicator map flags:
* - Used in the flags field of an indicator map to indicate the
* conditions under which and indicator can be changed and the
* effects of changing the indicator.
*/
#define XkbIM_NoExplicit (1L << 7)
#define XkbIM_NoAutomatic (1L << 6)
#define XkbIM_LEDDrivesKB (1L << 5)
/*
* Indicator map component specifications:
* - Used by the 'which_groups' and 'which_mods' fields of an indicator
* map to specify which keyboard components should be used to drive
* the indicator.
*/
#define XkbIM_UseBase (1L << 0)
#define XkbIM_UseLatched (1L << 1)
#define XkbIM_UseLocked (1L << 2)
#define XkbIM_UseEffective (1L << 3)
#define XkbIM_UseCompat (1L << 4)
#define XkbIM_UseNone 0
#define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
|XkbIM_UseEffective)
#define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat)
/*
* Compatibility Map Components:
* - Specifies the components to be allocated in XkbAllocCompatMap.
*/
#define XkbSymInterpMask (1<<0)
#define XkbGroupCompatMask (1<<1)
#define XkbAllCompatMask (0x3)
/*
* Names component mask:
* - Specifies the names to be loaded or changed for the GetNames and
* SetNames requests.
* - Specifies the names that have changed in a NamesNotify event.
* - Specifies the names components to be allocated by XkbAllocNames.
*/
#define XkbKeycodesNameMask (1<<0)
#define XkbGeometryNameMask (1<<1)
#define XkbSymbolsNameMask (1<<2)
#define XkbPhysSymbolsNameMask (1<<3)
#define XkbTypesNameMask (1<<4)
#define XkbCompatNameMask (1<<5)
#define XkbKeyTypeNamesMask (1<<6)
#define XkbKTLevelNamesMask (1<<7)
#define XkbIndicatorNamesMask (1<<8)
#define XkbKeyNamesMask (1<<9)
#define XkbKeyAliasesMask (1<<10)
#define XkbVirtualModNamesMask (1<<11)
#define XkbGroupNamesMask (1<<12)
#define XkbRGNamesMask (1<<13)
#define XkbComponentNamesMask (0x3f)
#define XkbAllNamesMask (0x3fff)
/*
* GetByName components:
* - Specifies desired or necessary components to GetKbdByName request.
* - Reports the components that were found in a GetKbdByNameReply
*/
#define XkbGBN_TypesMask (1L << 0)
#define XkbGBN_CompatMapMask (1L << 1)
#define XkbGBN_ClientSymbolsMask (1L << 2)
#define XkbGBN_ServerSymbolsMask (1L << 3)
#define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
#define XkbGBN_IndicatorMapMask (1L << 4)
#define XkbGBN_KeyNamesMask (1L << 5)
#define XkbGBN_GeometryMask (1L << 6)
#define XkbGBN_OtherNamesMask (1L << 7)
#define XkbGBN_AllComponentsMask (0xff)
/*
* ListComponents flags
*/
#define XkbLC_Hidden (1L << 0)
#define XkbLC_Default (1L << 1)
#define XkbLC_Partial (1L << 2)
#define XkbLC_AlphanumericKeys (1L << 8)
#define XkbLC_ModifierKeys (1L << 9)
#define XkbLC_KeypadKeys (1L << 10)
#define XkbLC_FunctionKeys (1L << 11)
#define XkbLC_AlternateGroup (1L << 12)
/*
* X Input Extension Interactions
* - Specifies the possible interactions between XKB and the X input
* extension
* - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
* XKB information about an extension device.
* - Reports the list of supported optional features in the reply to
* XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
* XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
* events to indicate an attempt to use an unsupported feature.
*/
#define XkbXI_KeyboardsMask (1L << 0)
#define XkbXI_ButtonActionsMask (1L << 1)
#define XkbXI_IndicatorNamesMask (1L << 2)
#define XkbXI_IndicatorMapsMask (1L << 3)
#define XkbXI_IndicatorStateMask (1L << 4)
#define XkbXI_UnsupportedFeatureMask (1L << 15)
#define XkbXI_AllFeaturesMask (0x001f)
#define XkbXI_AllDeviceFeaturesMask (0x001e)
#define XkbXI_IndicatorsMask (0x001c)
#define XkbAllExtensionDeviceEventsMask (0x801f)
/*
* Per-Client Flags:
* - Specifies flags to be changed by the PerClientFlags request.
*/
#define XkbPCF_DetectableAutoRepeatMask (1L << 0)
#define XkbPCF_GrabsUseXKBStateMask (1L << 1)
#define XkbPCF_AutoResetControlsMask (1L << 2)
#define XkbPCF_LookupStateWhenGrabbed (1L << 3)
#define XkbPCF_SendEventUsesXKBState (1L << 4)
#define XkbPCF_AllFlagsMask (0x1F)
/*
* Debugging flags and controls
*/
#define XkbDF_DisableLocks (1<<0)
#endif /* _XKB_H_ */
#ifndef _XVMCPROTO_H_
#define _XVMCPROTO_H_
#define xvmc_QueryVersion 0
#define xvmc_ListSurfaceTypes 1
#define xvmc_CreateContext 2
#define xvmc_DestroyContext 3
#define xvmc_CreateSurface 4
#define xvmc_DestroySurface 5
#define xvmc_CreateSubpicture 6
#define xvmc_DestroySubpicture 7
#define xvmc_ListSubpictureTypes 8
#define xvmc_GetDRInfo 9
#define xvmc_LastRequest xvmc_GetDRInfo
#define xvmcNumRequest (xvmc_LastRequest + 1)
typedef struct {
CARD32 surface_type_id;
CARD16 chroma_format;
CARD16 pad0;
CARD16 max_width;
CARD16 max_height;
CARD16 subpicture_max_width;
CARD16 subpicture_max_height;
CARD32 mc_type;
CARD32 flags;
} xvmcSurfaceInfo;
#define sz_xvmcSurfaceInfo 24;
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
} xvmcQueryVersionReq;
#define sz_xvmcQueryVersionReq 4;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 major;
CARD32 minor;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
} xvmcQueryVersionReply;
#define sz_xvmcQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 port;
} xvmcListSurfaceTypesReq;
#define sz_xvmcListSurfaceTypesReq 8;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num;
CARD32 padl3;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
} xvmcListSurfaceTypesReply;
#define sz_xvmcListSurfaceTypesReply 32
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 context_id;
CARD32 port;
CARD32 surface_type_id;
CARD16 width;
CARD16 height;
CARD32 flags;
} xvmcCreateContextReq;
#define sz_xvmcCreateContextReq 24;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 width_actual;
CARD16 height_actual;
CARD32 flags_return;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
} xvmcCreateContextReply;
#define sz_xvmcCreateContextReply 32
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 context_id;
} xvmcDestroyContextReq;
#define sz_xvmcDestroyContextReq 8;
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 surface_id;
CARD32 context_id;
} xvmcCreateSurfaceReq;
#define sz_xvmcCreateSurfaceReq 12;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 padl2;
CARD32 padl3;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
} xvmcCreateSurfaceReply;
#define sz_xvmcCreateSurfaceReply 32
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 surface_id;
} xvmcDestroySurfaceReq;
#define sz_xvmcDestroySurfaceReq 8;
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 subpicture_id;
CARD32 context_id;
CARD32 xvimage_id;
CARD16 width;
CARD16 height;
} xvmcCreateSubpictureReq;
#define sz_xvmcCreateSubpictureReq 20;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 width_actual;
CARD16 height_actual;
CARD16 num_palette_entries;
CARD16 entry_bytes;
CARD8 component_order[4];
CARD32 padl5;
CARD32 padl6;
CARD32 padl7;
} xvmcCreateSubpictureReply;
#define sz_xvmcCreateSubpictureReply 32
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 subpicture_id;
} xvmcDestroySubpictureReq;
#define sz_xvmcDestroySubpictureReq 8;
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 port;
CARD32 surface_type_id;
} xvmcListSubpictureTypesReq;
#define sz_xvmcListSubpictureTypesReq 12;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num;
CARD32 padl2;
CARD32 padl3;
CARD32 padl4;
CARD32 padl5;
CARD32 padl6;
} xvmcListSubpictureTypesReply;
#define sz_xvmcListSubpictureTypesReply 32
typedef struct {
CARD8 reqType;
CARD8 xvmcReqType;
CARD16 length;
CARD32 port;
CARD32 shmKey;
CARD32 magic;
} xvmcGetDRInfoReq;
#define sz_xvmcGetDRInfoReq 16;
typedef struct {
BYTE type; /* X_Reply */
BYTE padb1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 major;
CARD32 minor;
CARD32 patchLevel;
CARD32 nameLen;
CARD32 busIDLen;
CARD32 isLocal;
} xvmcGetDRInfoReply;
#define sz_xvmcGetDRInfoReply 32
#endif
/*
Copyright 1991, 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/***********************************************************
Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
and Olivetti Research Limited, Cambridge, England.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or Olivetti
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _SYNC_H_
#define _SYNC_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/syncconst.h>
#ifdef _SYNC_SERVER
#include <X11/extensions/syncproto.h>
#else
_XFUNCPROTOBEGIN
/* get rid of macros so we can define corresponding functions */
#undef XSyncIntToValue
#undef XSyncIntsToValue
#undef XSyncValueGreaterThan
#undef XSyncValueLessThan
#undef XSyncValueGreaterOrEqual
#undef XSyncValueLessOrEqual
#undef XSyncValueEqual
#undef XSyncValueIsNegative
#undef XSyncValueIsZero
#undef XSyncValueIsPositive
#undef XSyncValueLow32
#undef XSyncValueHigh32
#undef XSyncValueAdd
#undef XSyncValueSubtract
#undef XSyncMaxValue
#undef XSyncMinValue
extern void XSyncIntToValue(
XSyncValue* /*pv*/,
int /*i*/
);
extern void XSyncIntsToValue(
XSyncValue* /*pv*/,
unsigned int /*l*/,
int /*h*/
);
extern Bool XSyncValueGreaterThan(
XSyncValue /*a*/,
XSyncValue /*b*/
);
extern Bool XSyncValueLessThan(
XSyncValue /*a*/,
XSyncValue /*b*/
);
extern Bool XSyncValueGreaterOrEqual(
XSyncValue /*a*/,
XSyncValue /*b*/
);
extern Bool XSyncValueLessOrEqual(
XSyncValue /*a*/,
XSyncValue /*b*/
);
extern Bool XSyncValueEqual(
XSyncValue /*a*/,
XSyncValue /*b*/
);
extern Bool XSyncValueIsNegative(
XSyncValue /*v*/
);
extern Bool XSyncValueIsZero(
XSyncValue /*a*/
);
extern Bool XSyncValueIsPositive(
XSyncValue /*v*/
);
extern unsigned int XSyncValueLow32(
XSyncValue /*v*/
);
extern int XSyncValueHigh32(
XSyncValue /*v*/
);
extern void XSyncValueAdd(
XSyncValue* /*presult*/,
XSyncValue /*a*/,
XSyncValue /*b*/,
int* /*poverflow*/
);
extern void XSyncValueSubtract(
XSyncValue* /*presult*/,
XSyncValue /*a*/,
XSyncValue /*b*/,
int* /*poverflow*/
);
extern void XSyncMaxValue(
XSyncValue* /*pv*/
);
extern void XSyncMinValue(
XSyncValue* /*pv*/
);
_XFUNCPROTOEND
typedef struct _XSyncSystemCounter {
char *name; /* null-terminated name of system counter */
XSyncCounter counter; /* counter id of this system counter */
XSyncValue resolution; /* resolution of this system counter */
} XSyncSystemCounter;
typedef struct {
XSyncCounter counter; /* counter to trigger on */
XSyncValueType value_type; /* absolute/relative */
XSyncValue wait_value; /* value to compare counter to */
XSyncTestType test_type; /* pos/neg comparison/transtion */
} XSyncTrigger;
typedef struct {
XSyncTrigger trigger; /* trigger for await */
XSyncValue event_threshold; /* send event if past threshold */
} XSyncWaitCondition;
typedef struct {
XSyncTrigger trigger;
XSyncValue delta;
Bool events;
XSyncAlarmState state;
} XSyncAlarmAttributes;
/*
* Events
*/
typedef struct {
int type; /* event base + XSyncCounterNotify */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
XSyncCounter counter; /* counter involved in await */
XSyncValue wait_value; /* value being waited for */
XSyncValue counter_value; /* counter value when this event was sent */
Time time; /* milliseconds */
int count; /* how many more events to come */
Bool destroyed; /* True if counter was destroyed */
} XSyncCounterNotifyEvent;
typedef struct {
int type; /* event base + XSyncAlarmNotify */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
XSyncAlarm alarm; /* alarm that triggered */
XSyncValue counter_value; /* value that triggered the alarm */
XSyncValue alarm_value; /* test value of trigger in alarm */
Time time; /* milliseconds */
XSyncAlarmState state; /* new state of alarm */
} XSyncAlarmNotifyEvent;
/*
* Errors
*/
typedef struct {
int type;
Display *display; /* Display the event was read from */
XSyncAlarm alarm; /* resource id */
unsigned long serial; /* serial number of failed request */
unsigned char error_code; /* error base + XSyncBadAlarm */
unsigned char request_code; /* Major op-code of failed request */
unsigned char minor_code; /* Minor op-code of failed request */
} XSyncAlarmError;
typedef struct {
int type;
Display *display; /* Display the event was read from */
XSyncCounter counter; /* resource id */
unsigned long serial; /* serial number of failed request */
unsigned char error_code; /* error base + XSyncBadCounter */
unsigned char request_code; /* Major op-code of failed request */
unsigned char minor_code; /* Minor op-code of failed request */
} XSyncCounterError;
/*
* Prototypes
*/
_XFUNCPROTOBEGIN
extern Status XSyncQueryExtension(
Display* /*dpy*/,
int* /*event_base_return*/,
int* /*error_base_return*/
);
extern Status XSyncInitialize(
Display* /*dpy*/,
int* /*major_version_return*/,
int* /*minor_version_return*/
);
extern XSyncSystemCounter *XSyncListSystemCounters(
Display* /*dpy*/,
int* /*n_counters_return*/
);
extern void XSyncFreeSystemCounterList(
XSyncSystemCounter* /*list*/
);
extern XSyncCounter XSyncCreateCounter(
Display* /*dpy*/,
XSyncValue /*initial_value*/
);
extern Status XSyncSetCounter(
Display* /*dpy*/,
XSyncCounter /*counter*/,
XSyncValue /*value*/
);
extern Status XSyncChangeCounter(
Display* /*dpy*/,
XSyncCounter /*counter*/,
XSyncValue /*value*/
);
extern Status XSyncDestroyCounter(
Display* /*dpy*/,
XSyncCounter /*counter*/
);
extern Status XSyncQueryCounter(
Display* /*dpy*/,
XSyncCounter /*counter*/,
XSyncValue* /*value_return*/
);
extern Status XSyncAwait(
Display* /*dpy*/,
XSyncWaitCondition* /*wait_list*/,
int /*n_conditions*/
);
extern XSyncAlarm XSyncCreateAlarm(
Display* /*dpy*/,
unsigned long /*values_mask*/,
XSyncAlarmAttributes* /*values*/
);
extern Status XSyncDestroyAlarm(
Display* /*dpy*/,
XSyncAlarm /*alarm*/
);
extern Status XSyncQueryAlarm(
Display* /*dpy*/,
XSyncAlarm /*alarm*/,
XSyncAlarmAttributes* /*values_return*/
);
extern Status XSyncChangeAlarm(
Display* /*dpy*/,
XSyncAlarm /*alarm*/,
unsigned long /*values_mask*/,
XSyncAlarmAttributes* /*values*/
);
extern Status XSyncSetPriority(
Display* /*dpy*/,
XID /*client_resource_id*/,
int /*priority*/
);
extern Status XSyncGetPriority(
Display* /*dpy*/,
XID /*client_resource_id*/,
int* /*return_priority*/
);
extern XSyncFence XSyncCreateFence(
Display* /*dpy*/,
Drawable /*d*/,
Bool /*initially_triggered*/
);
extern Bool XSyncTriggerFence(
Display* /*dpy*/,
XSyncFence /*fence*/
);
extern Bool XSyncResetFence(
Display* /*dpy*/,
XSyncFence /*fence*/
);
extern Bool XSyncDestroyFence(
Display* /*dpy*/,
XSyncFence /*fence*/
);
extern Bool XSyncQueryFence(
Display* /*dpy*/,
XSyncFence /*fence*/,
Bool* /*triggered*/
);
extern Bool XSyncAwaitFence(
Display* /*dpy*/,
const XSyncFence* /*fence_list*/,
int /*n_fences*/
);
_XFUNCPROTOEND
#endif /* _SYNC_SERVER */
#endif /* _SYNC_H_ */
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifndef _X11_EXTENSIONS_DPMS_H
#define _X11_EXTENSIONS_DPMS_H 1
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/extensions/dpmsconst.h>
#ifndef DPMS_SERVER
_XFUNCPROTOBEGIN
extern Bool DPMSQueryExtension(Display *, int *, int *);
extern Status DPMSGetVersion(Display *, int *, int *);
extern Bool DPMSCapable(Display *);
extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16);
extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *);
extern Status DPMSEnable(Display *);
extern Status DPMSDisable(Display *);
extern Status DPMSForceLevel(Display *, CARD16);
extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
_XFUNCPROTOEND
#endif
#endif /* !_X11_EXTENSIONS_DPMS_H */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XKBSTR_H_
#define _XKBSTR_H_
#include <X11/extensions/XKB.h>
#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))
#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l)))
/*
* The Xkb structs are full of implicit padding to properly align members.
* We can't clean that up without breaking ABI, so tell clang not to bother
* complaining about it.
*/
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
/*
* Common data structures and access macros
*/
typedef struct _XkbStateRec {
unsigned char group;
unsigned char locked_group;
unsigned short base_group;
unsigned short latched_group;
unsigned char mods;
unsigned char base_mods;
unsigned char latched_mods;
unsigned char locked_mods;
unsigned char compat_state;
unsigned char grab_mods;
unsigned char compat_grab_mods;
unsigned char lookup_mods;
unsigned char compat_lookup_mods;
unsigned short ptr_buttons;
} XkbStateRec,*XkbStatePtr;
#define XkbModLocks(s) ((s)->locked_mods)
#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
#define XkbGroupLock(s) ((s)->locked_group)
#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group)
typedef struct _XkbMods {
unsigned char mask; /* effective mods */
unsigned char real_mods;
unsigned short vmods;
} XkbModsRec,*XkbModsPtr;
typedef struct _XkbKTMapEntry {
Bool active;
unsigned char level;
XkbModsRec mods;
} XkbKTMapEntryRec,*XkbKTMapEntryPtr;
typedef struct _XkbKeyType {
XkbModsRec mods;
unsigned char num_levels;
unsigned char map_count;
/* map is an array of map_count XkbKTMapEntryRec structs */
XkbKTMapEntryPtr map;
/* preserve is an array of map_count XkbModsRec structs */
XkbModsPtr preserve;
Atom name;
/* level_names is an array of num_levels Atoms */
Atom * level_names;
} XkbKeyTypeRec, *XkbKeyTypePtr;
#define XkbNumGroups(g) ((g)&0x0f)
#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0)
#define XkbOutOfRangeGroupAction(g) ((g)&0xc0)
#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)
#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))
#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f))
/*
* Structures and access macros used primarily by the server
*/
typedef struct _XkbBehavior {
unsigned char type;
unsigned char data;
} XkbBehavior;
#define XkbAnyActionDataSize 7
typedef struct _XkbAnyAction {
unsigned char type;
unsigned char data[XkbAnyActionDataSize];
} XkbAnyAction;
typedef struct _XkbModAction {
unsigned char type;
unsigned char flags;
unsigned char mask;
unsigned char real_mods;
unsigned char vmods1;
unsigned char vmods2;
} XkbModAction;
#define XkbModActionVMods(a) \
((short)(((a)->vmods1<<8)|((a)->vmods2)))
#define XkbSetModActionVMods(a,v) \
(((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))
typedef struct _XkbGroupAction {
unsigned char type;
unsigned char flags;
char group_XXX;
} XkbGroupAction;
#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX))
#define XkbSASetGroup(a,g) ((a)->group_XXX=(g))
typedef struct _XkbISOAction {
unsigned char type;
unsigned char flags;
unsigned char mask;
unsigned char real_mods;
char group_XXX;
unsigned char affect;
unsigned char vmods1;
unsigned char vmods2;
} XkbISOAction;
typedef struct _XkbPtrAction {
unsigned char type;
unsigned char flags;
unsigned char high_XXX;
unsigned char low_XXX;
unsigned char high_YYY;
unsigned char low_YYY;
} XkbPtrAction;
#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
typedef struct _XkbPtrBtnAction {
unsigned char type;
unsigned char flags;
unsigned char count;
unsigned char button;
} XkbPtrBtnAction;
typedef struct _XkbPtrDfltAction {
unsigned char type;
unsigned char flags;
unsigned char affect;
char valueXXX;
} XkbPtrDfltAction;
#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX))
#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff))
typedef struct _XkbSwitchScreenAction {
unsigned char type;
unsigned char flags;
char screenXXX;
} XkbSwitchScreenAction;
#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX))
#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff))
typedef struct _XkbCtrlsAction {
unsigned char type;
unsigned char flags;
unsigned char ctrls3;
unsigned char ctrls2;
unsigned char ctrls1;
unsigned char ctrls0;
} XkbCtrlsAction;
#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\
((a)->ctrls2=(((c)>>16)&0xff)),\
((a)->ctrls1=(((c)>>8)&0xff)),\
((a)->ctrls0=((c)&0xff)))
#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
(((unsigned int)(a)->ctrls2)<<16)|\
(((unsigned int)(a)->ctrls1)<<8)|\
((unsigned int)((a)->ctrls0)))
typedef struct _XkbMessageAction {
unsigned char type;
unsigned char flags;
unsigned char message[6];
} XkbMessageAction;
typedef struct _XkbRedirectKeyAction {
unsigned char type;
unsigned char new_key;
unsigned char mods_mask;
unsigned char mods;
unsigned char vmods_mask0;
unsigned char vmods_mask1;
unsigned char vmods0;
unsigned char vmods1;
} XkbRedirectKeyAction;
#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\
((unsigned int)(a)->vmods0))
#define XkbSARedirectSetVMods(a,m) (((a)->vmods1=(((m)>>8)&0xff)),\
((a)->vmods0=((m)&0xff)))
#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\
((unsigned int)(a)->vmods_mask0))
#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\
((a)->vmods_mask0=((m)&0xff)))
typedef struct _XkbDeviceBtnAction {
unsigned char type;
unsigned char flags;
unsigned char count;
unsigned char button;
unsigned char device;
} XkbDeviceBtnAction;
typedef struct _XkbDeviceValuatorAction {
unsigned char type;
unsigned char device;
unsigned char v1_what;
unsigned char v1_ndx;
unsigned char v1_value;
unsigned char v2_what;
unsigned char v2_ndx;
unsigned char v2_value;
} XkbDeviceValuatorAction;
typedef union _XkbAction {
XkbAnyAction any;
XkbModAction mods;
XkbGroupAction group;
XkbISOAction iso;
XkbPtrAction ptr;
XkbPtrBtnAction btn;
XkbPtrDfltAction dflt;
XkbSwitchScreenAction screen;
XkbCtrlsAction ctrls;
XkbMessageAction msg;
XkbRedirectKeyAction redirect;
XkbDeviceBtnAction devbtn;
XkbDeviceValuatorAction devval;
unsigned char type;
} XkbAction;
typedef struct _XkbControls {
unsigned char mk_dflt_btn;
unsigned char num_groups;
unsigned char groups_wrap;
XkbModsRec internal;
XkbModsRec ignore_lock;
unsigned int enabled_ctrls;
unsigned short repeat_delay;
unsigned short repeat_interval;
unsigned short slow_keys_delay;
unsigned short debounce_delay;
unsigned short mk_delay;
unsigned short mk_interval;
unsigned short mk_time_to_max;
unsigned short mk_max_speed;
short mk_curve;
unsigned short ax_options;
unsigned short ax_timeout;
unsigned short axt_opts_mask;
unsigned short axt_opts_values;
unsigned int axt_ctrls_mask;
unsigned int axt_ctrls_values;
unsigned char per_key_repeat[XkbPerKeyBitArraySize];
} XkbControlsRec, *XkbControlsPtr;
#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w))
#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
typedef struct _XkbServerMapRec {
/* acts is an array of XkbActions structs, with size_acts entries
allocated, and num_acts entries used. */
unsigned short num_acts;
unsigned short size_acts;
XkbAction *acts;
/* behaviors, key_acts, explicit, & vmodmap are all arrays with
(xkb->max_key_code + 1) entries allocated for each. */
XkbBehavior *behaviors;
unsigned short *key_acts;
#if defined(__cplusplus) || defined(c_plusplus)
/* explicit is a C++ reserved word */
unsigned char *c_explicit;
#else
unsigned char *explicit;
#endif
unsigned char vmods[XkbNumVirtualMods];
unsigned short *vmodmap;
} XkbServerMapRec, *XkbServerMapPtr;
#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])
/*
* Structures and access macros used primarily by clients
*/
typedef struct _XkbSymMapRec {
unsigned char kt_index[XkbNumKbdGroups];
unsigned char group_info;
unsigned char width;
unsigned short offset;
} XkbSymMapRec, *XkbSymMapPtr;
typedef struct _XkbClientMapRec {
/* types is an array of XkbKeyTypeRec structs, with size_types entries
allocated, and num_types entries used. */
unsigned char size_types;
unsigned char num_types;
XkbKeyTypePtr types;
/* syms is an array of size_syms KeySyms, in which num_syms are used */
unsigned short size_syms;
unsigned short num_syms;
KeySym *syms;
/* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */
XkbSymMapPtr key_sym_map;
/* modmap is an array of (max_key_code + 1) unsigned chars */
unsigned char *modmap;
} XkbClientMapRec, *XkbClientMapPtr;
#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info)
#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info))
#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)
#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)
#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])
#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])
#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))
#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset)
#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)])
/*
* Compatibility structures and access macros
*/
typedef struct _XkbSymInterpretRec {
KeySym sym;
unsigned char flags;
unsigned char match;
unsigned char mods;
unsigned char virtual_mod;
XkbAnyAction act;
} XkbSymInterpretRec,*XkbSymInterpretPtr;
typedef struct _XkbCompatMapRec {
/* sym_interpret is an array of XkbSymInterpretRec structs,
in which size_si are allocated & num_si are used. */
XkbSymInterpretPtr sym_interpret;
XkbModsRec groups[XkbNumKbdGroups];
unsigned short num_si;
unsigned short size_si;
} XkbCompatMapRec, *XkbCompatMapPtr;
typedef struct _XkbIndicatorMapRec {
unsigned char flags;
unsigned char which_groups;
unsigned char groups;
unsigned char which_mods;
XkbModsRec mods;
unsigned int ctrls;
} XkbIndicatorMapRec, *XkbIndicatorMapPtr;
#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\
(((i)->which_groups&&(i)->groups)||\
((i)->which_mods&&(i)->mods.mask)||\
((i)->ctrls)))
#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\
((i)->which_mods)||((i)->ctrls))
typedef struct _XkbIndicatorRec {
unsigned long phys_indicators;
XkbIndicatorMapRec maps[XkbNumIndicators];
} XkbIndicatorRec,*XkbIndicatorPtr;
typedef struct _XkbKeyNameRec {
char name[XkbKeyNameLength];
} XkbKeyNameRec,*XkbKeyNamePtr;
typedef struct _XkbKeyAliasRec {
char real[XkbKeyNameLength];
char alias[XkbKeyNameLength];
} XkbKeyAliasRec,*XkbKeyAliasPtr;
/*
* Names for everything
*/
typedef struct _XkbNamesRec {
Atom keycodes;
Atom geometry;
Atom symbols;
Atom types;
Atom compat;
Atom vmods[XkbNumVirtualMods];
Atom indicators[XkbNumIndicators];
Atom groups[XkbNumKbdGroups];
/* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */
XkbKeyNamePtr keys;
/* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */
XkbKeyAliasPtr key_aliases;
/* radio_groups is an array of num_rg Atoms */
Atom *radio_groups;
Atom phys_symbols;
/* num_keys seems to be unused in libX11 */
unsigned char num_keys;
unsigned char num_key_aliases;
unsigned short num_rg;
} XkbNamesRec,*XkbNamesPtr;
typedef struct _XkbGeometry *XkbGeometryPtr;
/*
* Tie it all together into one big keyboard description
*/
typedef struct _XkbDesc {
struct _XDisplay * dpy;
unsigned short flags;
unsigned short device_spec;
KeyCode min_key_code;
KeyCode max_key_code;
XkbControlsPtr ctrls;
XkbServerMapPtr server;
XkbClientMapPtr map;
XkbIndicatorPtr indicators;
XkbNamesPtr names;
XkbCompatMapPtr compat;
XkbGeometryPtr geom;
} XkbDescRec, *XkbDescPtr;
#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g))
#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g))
#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g))
#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k))
#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k)))
#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k)))
#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k)))
#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k)))
#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n])
#define XkbKeySymEntry(d,k,sl,g) \
(XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
#define XkbKeyAction(d,k,n) \
(XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)
#define XkbKeyActionEntry(d,k,sl,g) \
(XkbKeyHasActions(d,k)?\
XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL)
#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0)
#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)
#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k))
#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\
((k)<=(d)->max_key_code))
#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1)
/*
* The following structures can be used to track changes
* to a keyboard device
*/
typedef struct _XkbMapChanges {
unsigned short changed;
KeyCode min_key_code;
KeyCode max_key_code;
unsigned char first_type;
unsigned char num_types;
KeyCode first_key_sym;
unsigned char num_key_syms;
KeyCode first_key_act;
unsigned char num_key_acts;
KeyCode first_key_behavior;
unsigned char num_key_behaviors;
KeyCode first_key_explicit;
unsigned char num_key_explicit;
KeyCode first_modmap_key;
unsigned char num_modmap_keys;
KeyCode first_vmodmap_key;
unsigned char num_vmodmap_keys;
unsigned char pad;
unsigned short vmods;
} XkbMapChangesRec,*XkbMapChangesPtr;
typedef struct _XkbControlsChanges {
unsigned int changed_ctrls;
unsigned int enabled_ctrls_changes;
Bool num_groups_changed;
} XkbControlsChangesRec,*XkbControlsChangesPtr;
typedef struct _XkbIndicatorChanges {
unsigned int state_changes;
unsigned int map_changes;
} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr;
typedef struct _XkbNameChanges {
unsigned int changed;
unsigned char first_type;
unsigned char num_types;
unsigned char first_lvl;
unsigned char num_lvls;
unsigned char num_aliases;
unsigned char num_rg;
unsigned char first_key;
unsigned char num_keys;
unsigned short changed_vmods;
unsigned long changed_indicators;
unsigned char changed_groups;
} XkbNameChangesRec,*XkbNameChangesPtr;
typedef struct _XkbCompatChanges {
unsigned char changed_groups;
unsigned short first_si;
unsigned short num_si;
} XkbCompatChangesRec,*XkbCompatChangesPtr;
typedef struct _XkbChanges {
unsigned short device_spec;
unsigned short state_changes;
XkbMapChangesRec map;
XkbControlsChangesRec ctrls;
XkbIndicatorChangesRec indicators;
XkbNameChangesRec names;
XkbCompatChangesRec compat;
} XkbChangesRec, *XkbChangesPtr;
/*
* These data structures are used to construct a keymap from
* a set of components or to list components in the server
* database.
*/
typedef struct _XkbComponentNames {
char * keymap;
char * keycodes;
char * types;
char * compat;
char * symbols;
char * geometry;
} XkbComponentNamesRec, *XkbComponentNamesPtr;
typedef struct _XkbComponentName {
unsigned short flags;
char * name;
} XkbComponentNameRec,*XkbComponentNamePtr;
typedef struct _XkbComponentList {
int num_keymaps;
int num_keycodes;
int num_types;
int num_compat;
int num_symbols;
int num_geometry;
XkbComponentNamePtr keymaps;
XkbComponentNamePtr keycodes;
XkbComponentNamePtr types;
XkbComponentNamePtr compat;
XkbComponentNamePtr symbols;
XkbComponentNamePtr geometry;
} XkbComponentListRec, *XkbComponentListPtr;
/*
* The following data structures describe and track changes to a
* non-keyboard extension device
*/
typedef struct _XkbDeviceLedInfo {
unsigned short led_class;
unsigned short led_id;
unsigned int phys_indicators;
unsigned int maps_present;
unsigned int names_present;
unsigned int state;
Atom names[XkbNumIndicators];
XkbIndicatorMapRec maps[XkbNumIndicators];
} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr;
typedef struct _XkbDeviceInfo {
char * name;
Atom type;
unsigned short device_spec;
Bool has_own_state;
unsigned short supported;
unsigned short unsupported;
/* btn_acts is an array of num_btn XkbAction entries */
unsigned short num_btns;
XkbAction * btn_acts;
unsigned short sz_leds;
unsigned short num_leds;
unsigned short dflt_kbd_fb;
unsigned short dflt_led_fb;
/* leds is an array of XkbDeviceLedInfoRec in which
sz_leds entries are allocated and num_leds entries are used */
XkbDeviceLedInfoPtr leds;
} XkbDeviceInfoRec,*XkbDeviceInfoPtr;
#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL))
#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))
#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL))
typedef struct _XkbDeviceLedChanges {
unsigned short led_class;
unsigned short led_id;
unsigned int defined; /* names or maps changed */
struct _XkbDeviceLedChanges *next;
} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr;
typedef struct _XkbDeviceChanges {
unsigned int changed;
unsigned short first_btn;
unsigned short num_btns;
XkbDeviceLedChangesRec leds;
} XkbDeviceChangesRec,*XkbDeviceChangesPtr;
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif /* _XKBSTR_H_ */
/*
* Copyright 1992 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, 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.
*
*/
#ifndef _LBXPROTO_H_
#define _LBXPROTO_H_
#include <X11/extensions/lbx.h>
/*
* NOTE: any changes or additions to the opcodes needs to be reflected
* in the lbxCacheable array in Xserver/lbx/lbxmain.c
*/
#define X_LbxQueryVersion 0
#define X_LbxStartProxy 1
#define X_LbxStopProxy 2
#define X_LbxSwitch 3
#define X_LbxNewClient 4
#define X_LbxCloseClient 5
#define X_LbxModifySequence 6
#define X_LbxAllowMotion 7
#define X_LbxIncrementPixel 8
#define X_LbxDelta 9
#define X_LbxGetModifierMapping 10
#define X_LbxInvalidateTag 12
#define X_LbxPolyPoint 13
#define X_LbxPolyLine 14
#define X_LbxPolySegment 15
#define X_LbxPolyRectangle 16
#define X_LbxPolyArc 17
#define X_LbxFillPoly 18
#define X_LbxPolyFillRectangle 19
#define X_LbxPolyFillArc 20
#define X_LbxGetKeyboardMapping 21
#define X_LbxQueryFont 22
#define X_LbxChangeProperty 23
#define X_LbxGetProperty 24
#define X_LbxTagData 25
#define X_LbxCopyArea 26
#define X_LbxCopyPlane 27
#define X_LbxPolyText8 28
#define X_LbxPolyText16 29
#define X_LbxImageText8 30
#define X_LbxImageText16 31
#define X_LbxQueryExtension 32
#define X_LbxPutImage 33
#define X_LbxGetImage 34
#define X_LbxBeginLargeRequest 35
#define X_LbxLargeRequestData 36
#define X_LbxEndLargeRequest 37
#define X_LbxInternAtoms 38
#define X_LbxGetWinAttrAndGeom 39
#define X_LbxGrabCmap 40
#define X_LbxReleaseCmap 41
#define X_LbxAllocColor 42
#define X_LbxSync 43
/*
* Redefine some basic types used by structures defined herein. This removes
* any possibility on 64-bit architectures of one entity viewing communicated
* data as 32-bit quantities and another entity viewing the same data as 64-bit
* quantities.
*/
#define XID CARD32
#define Atom CARD32
#define Colormap CARD32
#define Drawable CARD32
#define VisualID CARD32
#define Window CARD32
typedef struct {
BOOL success; /* TRUE */
BOOL changeType;
CARD16 majorVersion,
minorVersion;
CARD16 length; /* 1/4 additional bytes in setup info */
CARD32 tag;
} xLbxConnSetupPrefix;
typedef struct _LbxQueryVersion {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxQueryVersion */
CARD16 length;
} xLbxQueryVersionReq;
#define sz_xLbxQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of LBX protocol */
CARD16 minorVersion; /* minor version of LBX protocol */
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxQueryVersionReply;
#define sz_xLbxQueryVersionReply 32
typedef struct _LbxStartProxy {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxStartProxy */
CARD16 length;
} xLbxStartProxyReq;
#define sz_xLbxStartProxyReq 4
typedef struct _LbxStopProxy {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxStopProxy */
CARD16 length;
} xLbxStopProxyReq;
#define sz_xLbxStopProxyReq 4
typedef struct _LbxSwitch {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxSwitch */
CARD16 length;
CARD32 client; /* new client */
} xLbxSwitchReq;
#define sz_xLbxSwitchReq 8
typedef struct _LbxNewClient {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxNewClient */
CARD16 length;
CARD32 client; /* new client */
} xLbxNewClientReq;
#define sz_xLbxNewClientReq 8
typedef struct _LbxCloseClient {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxCloseClient */
CARD16 length;
CARD32 client; /* new client */
} xLbxCloseClientReq;
#define sz_xLbxCloseClientReq 8
typedef struct _LbxModifySequence {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxModifySequence */
CARD16 length;
CARD32 adjust;
} xLbxModifySequenceReq;
#define sz_xLbxModifySequenceReq 8
typedef struct _LbxAllowMotion {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxAllowMotion */
CARD16 length;
CARD32 num;
} xLbxAllowMotionReq;
#define sz_xLbxAllowMotionReq 8
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGrabCmap */
CARD16 length;
Colormap cmap;
} xLbxGrabCmapReq;
#define sz_xLbxGrabCmapReq 8
#define LBX_SMART_GRAB 0x80
#define LBX_AUTO_RELEASE 0x40
#define LBX_3CHANNELS 0x20
#define LBX_2BYTE_PIXELS 0x10
#define LBX_RGB_BITS_MASK 0x0f
#define LBX_LIST_END 0
#define LBX_PIXEL_PRIVATE 1
#define LBX_PIXEL_SHARED 2
#define LBX_PIXEL_RANGE_PRIVATE 3
#define LBX_PIXEL_RANGE_SHARED 4
#define LBX_NEXT_CHANNEL 5
typedef struct {
BYTE type; /* X_Reply */
CARD8 flags;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xLbxGrabCmapReply;
#define sz_xLbxGrabCmapReply 32
#define sz_xLbxGrabCmapReplyHdr 8
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxReleaseCmap */
CARD16 length;
Colormap cmap;
} xLbxReleaseCmapReq;
#define sz_xLbxReleaseCmapReq 8
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxAllocColor */
CARD16 length;
Colormap cmap;
CARD32 pixel;
CARD16 red, green, blue;
CARD16 pad;
} xLbxAllocColorReq;
#define sz_xLbxAllocColorReq 20
typedef struct _LbxIncrementPixel {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxIncrementPixel */
CARD16 length;
CARD32 cmap;
CARD32 pixel;
} xLbxIncrementPixelReq;
#define sz_xLbxIncrementPixelReq 12
typedef struct _LbxDelta {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxDelta */
CARD16 length;
CARD8 diffs; /* number of diffs */
CARD8 cindex; /* cache index */
/* list of diffs follows */
} xLbxDeltaReq;
#define sz_xLbxDeltaReq 6
typedef struct _LbxGetModifierMapping {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetModifierMapping */
CARD16 length;
} xLbxGetModifierMappingReq;
#define sz_xLbxGetModifierMappingReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 keyspermod;
CARD16 sequenceNumber;
CARD32 length;
CARD32 tag;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxGetModifierMappingReply;
#define sz_xLbxGetModifierMappingReply 32
typedef struct _LbxGetKeyboardMapping {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetKeyboardMapping */
CARD16 length;
KeyCode firstKeyCode;
CARD8 count;
CARD16 pad1;
} xLbxGetKeyboardMappingReq;
#define sz_xLbxGetKeyboardMappingReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 keysperkeycode;
CARD16 sequenceNumber;
CARD32 length;
CARD32 tag;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxGetKeyboardMappingReply;
#define sz_xLbxGetKeyboardMappingReply 32
typedef struct _LbxQueryFont {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxQueryFont */
CARD16 length;
CARD32 fid;
} xLbxQueryFontReq;
#define sz_xLbxQueryFontReq 8
typedef struct _LbxInternAtoms {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxInternAtoms */
CARD16 length;
CARD16 num;
} xLbxInternAtomsReq;
#define sz_xLbxInternAtomsReq 6
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber;
CARD32 length;
CARD32 atomsStart;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxInternAtomsReply;
#define sz_xLbxInternAtomsReply 32
#define sz_xLbxInternAtomsReplyHdr 8
typedef struct _LbxGetWinAttrAndGeom {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetWinAttrAndGeom */
CARD16 length;
CARD32 id; /* window id */
} xLbxGetWinAttrAndGeomReq;
#define sz_xLbxGetWinAttrAndGeomReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 backingStore;
CARD16 sequenceNumber;
CARD32 length; /* NOT 0; this is an extra-large reply */
VisualID visualID;
#if defined(__cplusplus) || defined(c_plusplus)
CARD16 c_class;
#else
CARD16 class;
#endif
CARD8 bitGravity;
CARD8 winGravity;
CARD32 backingBitPlanes;
CARD32 backingPixel;
BOOL saveUnder;
BOOL mapInstalled;
CARD8 mapState;
BOOL override;
Colormap colormap;
CARD32 allEventMasks;
CARD32 yourEventMask;
CARD16 doNotPropagateMask;
CARD16 pad1;
Window root;
INT16 x, y;
CARD16 width, height;
CARD16 borderWidth;
CARD8 depth;
CARD8 pad2;
} xLbxGetWinAttrAndGeomReply;
#define sz_xLbxGetWinAttrAndGeomReply 60
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxSync */
CARD16 length;
} xLbxSyncReq;
#define sz_xLbxSyncReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xLbxSyncReply;
#define sz_xLbxSyncReply 32
/* an LBX squished charinfo packs the data in a CARD32 as follows */
#define LBX_WIDTH_SHIFT 26
#define LBX_LEFT_SHIFT 20
#define LBX_RIGHT_SHIFT 13
#define LBX_ASCENT_SHIFT 7
#define LBX_DESCENT_SHIFT 0
#define LBX_WIDTH_BITS 6
#define LBX_LEFT_BITS 6
#define LBX_RIGHT_BITS 7
#define LBX_ASCENT_BITS 6
#define LBX_DESCENT_BITS 7
#define LBX_WIDTH_MASK 0xfc000000
#define LBX_LEFT_MASK 0x03f00000
#define LBX_RIGHT_MASK 0x000fe000
#define LBX_ASCENT_MASK 0x00001f80
#define LBX_DESCENT_MASK 0x0000007f
#define LBX_MASK_BITS(val, n) ((unsigned int) ((val) & ((1 << (n)) - 1)))
typedef struct {
CARD32 metrics;
} xLbxCharInfo;
/* note that this is identical to xQueryFontReply except for missing
* first 2 words
*/
typedef struct {
xCharInfo minBounds;
/* XXX do we need to leave this gunk? */
#ifndef WORD64
CARD32 walign1;
#endif
xCharInfo maxBounds;
#ifndef WORD64
CARD32 walign2;
#endif
CARD16 minCharOrByte2, maxCharOrByte2;
CARD16 defaultChar;
CARD16 nFontProps; /* followed by this many xFontProp structures */
CARD8 drawDirection;
CARD8 minByte1, maxByte1;
BOOL allCharsExist;
INT16 fontAscent, fontDescent;
CARD32 nCharInfos; /* followed by this many xLbxCharInfo structures */
} xLbxFontInfo;
typedef struct {
BYTE type; /* X_Reply */
CARD8 compression;
CARD16 sequenceNumber;
CARD32 length;
CARD32 tag;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
/* X_QueryFont sticks much of the data in the base reply packet,
* but we hope that it won't be needed, (and it won't fit in 32 bytes
* with the tag anyways)
*
* if any additional data is needed, its sent in a xLbxFontInfo
*/
} xLbxQueryFontReply;
#define sz_xLbxQueryFontReply 32
typedef struct _LbxChangeProperty {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxChangeProperty */
CARD16 length;
Window window;
Atom property;
Atom type;
CARD8 format;
CARD8 mode;
BYTE pad[2];
CARD32 nUnits;
} xLbxChangePropertyReq;
#define sz_xLbxChangePropertyReq 24
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad;
CARD16 sequenceNumber;
CARD32 length;
CARD32 tag;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxChangePropertyReply;
#define sz_xLbxChangePropertyReply 32
typedef struct _LbxGetProperty {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetProperty */
CARD16 length;
Window window;
Atom property;
Atom type;
CARD8 delete;
BYTE pad[3];
CARD32 longOffset;
CARD32 longLength;
} xLbxGetPropertyReq;
#define sz_xLbxGetPropertyReq 28
typedef struct {
BYTE type; /* X_Reply */
CARD8 format;
CARD16 sequenceNumber;
CARD32 length;
Atom propertyType;
CARD32 bytesAfter;
CARD32 nItems;
CARD32 tag;
CARD32 pad1;
CARD32 pad2;
} xLbxGetPropertyReply;
#define sz_xLbxGetPropertyReply 32
typedef struct _LbxTagData {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxTagData */
CARD16 length;
XID tag;
CARD32 real_length;
/* data */
} xLbxTagDataReq;
#define sz_xLbxTagDataReq 12
typedef struct _LbxInvalidateTag {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxInvalidateTag */
CARD16 length;
CARD32 tag;
} xLbxInvalidateTagReq;
#define sz_xLbxInvalidateTagReq 8
typedef struct _LbxPutImage {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxPutImage */
CARD16 length;
CARD8 compressionMethod;
CARD8 cacheEnts;
CARD8 bitPacked;
/* rest is variable */
} xLbxPutImageReq;
#define sz_xLbxPutImageReq 7
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetImage */
CARD16 length;
Drawable drawable;
INT16 x, y;
CARD16 width, height;
CARD32 planeMask;
CARD8 format;
CARD8 pad1;
CARD16 pad2;
} xLbxGetImageReq;
#define sz_xLbxGetImageReq 24
typedef struct {
BYTE type; /* X_Reply */
CARD8 depth;
CARD16 sequenceNumber;
CARD32 lbxLength;
CARD32 xLength;
VisualID visual;
CARD8 compressionMethod;
CARD8 pad1;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xLbxGetImageReply;
#define sz_xLbxGetImageReply 32
/* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment,
LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */
#define GFX_CACHE_SIZE 15
#define GFXdCacheEnt(e) ((e) & 0xf)
#define GFXgCacheEnt(e) (((e) >> 4) & 0xf)
#define GFXCacheEnts(d,g) (((d) & 0xf) | (((g) & 0xf) << 4))
#define GFXCacheNone 0xf
typedef struct _LbxPolyPoint {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length;
CARD8 cacheEnts;
CARD8 padBytes;
} xLbxPolyPointReq;
#define sz_xLbxPolyPointReq 6
typedef xLbxPolyPointReq xLbxPolyLineReq;
typedef xLbxPolyPointReq xLbxPolySegmentReq;
typedef xLbxPolyPointReq xLbxPolyRectangleReq;
typedef xLbxPolyPointReq xLbxPolyArcReq;
typedef xLbxPolyPointReq xLbxPolyFillRectangleReq;
typedef xLbxPolyPointReq xLbxPolyFillArcReq;
#define sz_xLbxPolyLineReq sz_xLbxPolyPointReq
#define sz_xLbxPolySegmentReq sz_xLbxPolyPointReq
#define sz_xLbxPolyRectangleReq sz_xLbxPolyPointReq
#define sz_xLbxPolyArcReq sz_xLbxPolyPointReq
#define sz_xLbxPolyFillRectangleReq sz_xLbxPolyPointReq
#define sz_xLbxPolyFillArc sz_xLbxPolyPointReq
typedef struct _LbxFillPoly {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length;
CARD8 cacheEnts;
BYTE shape;
CARD8 padBytes;
} xLbxFillPolyReq;
#define sz_xLbxFillPolyReq 7
typedef struct _LbxCopyArea {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length;
CARD8 srcCache; /* source drawable */
CARD8 cacheEnts; /* dest drawable and gc */
/* followed by encoded src x, src y, dst x, dst y, width, height */
} xLbxCopyAreaReq;
#define sz_xLbxCopyAreaReq 6
typedef struct _LbxCopyPlane {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length;
CARD32 bitPlane;
CARD8 srcCache; /* source drawable */
CARD8 cacheEnts; /* dest drawable and gc */
/* followed by encoded src x, src y, dst x, dst y, width, height */
} xLbxCopyPlaneReq;
#define sz_xLbxCopyPlaneReq 10
typedef struct _LbxPolyText {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length;
CARD8 cacheEnts;
/* followed by encoded src x, src y coordinates and text elts */
} xLbxPolyTextReq;
#define sz_xLbxPolyTextReq 5
typedef xLbxPolyTextReq xLbxPolyText8Req;
typedef xLbxPolyTextReq xLbxPolyText16Req;
#define sz_xLbxPolyTextReq 5
#define sz_xLbxPolyText8Req 5
#define sz_xLbxPolyText16Req 5
typedef struct _LbxImageText {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length;
CARD8 cacheEnts;
CARD8 nChars;
/* followed by encoded src x, src y coordinates and string */
} xLbxImageTextReq;
typedef xLbxImageTextReq xLbxImageText8Req;
typedef xLbxImageTextReq xLbxImageText16Req;
#define sz_xLbxImageTextReq 6
#define sz_xLbxImageText8Req 6
#define sz_xLbxImageText16Req 6
typedef struct {
CARD8 offset;
CARD8 diff;
} xLbxDiffItem;
#define sz_xLbxDiffItem 2
typedef struct {
BYTE type; /* X_Reply */
CARD8 nOpts;
CARD16 sequenceNumber;
CARD32 length;
CARD32 optDataStart;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxStartReply;
#define sz_xLbxStartReply 32
#define sz_xLbxStartReplyHdr 8
typedef struct _LbxQueryExtension {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxQueryExtension */
CARD16 length;
CARD32 nbytes;
} xLbxQueryExtensionReq;
#define sz_xLbxQueryExtensionReq 8
typedef struct _LbxQueryExtensionReply {
BYTE type; /* X_Reply */
CARD8 numReqs;
CARD16 sequenceNumber;
CARD32 length;
BOOL present;
CARD8 major_opcode;
CARD8 first_event;
CARD8 first_error;
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
/* reply & event generating requests */
} xLbxQueryExtensionReply;
#define sz_xLbxQueryExtensionReply 32
typedef struct _LbxBeginLargeRequest {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxBeginLargeRequest */
CARD16 length;
CARD32 largeReqLength;
} xLbxBeginLargeRequestReq;
#define sz_BeginLargeRequestReq 8
typedef struct _LbxLargeRequestData {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxLargeRequestData */
CARD16 length;
/* followed by LISTofCARD8 data */
} xLbxLargeRequestDataReq;
#define sz_LargeRequestDataReq 4
typedef struct _LbxEndLargeRequest {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxEndLargeRequest */
CARD16 length;
} xLbxEndLargeRequestReq;
#define sz_EndLargeRequestReq 4
typedef struct _LbxSwitchEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxSwitchEvent */
CARD16 pad;
CARD32 client;
} xLbxSwitchEvent;
#define sz_xLbxSwitchEvent 8
typedef struct _LbxCloseEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxCloseEvent */
CARD16 sequenceNumber;
CARD32 client;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xLbxCloseEvent;
#define sz_xLbxCloseEvent 32
typedef struct _LbxInvalidateTagEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxInvalidateTagEvent */
CARD16 sequenceNumber;
CARD32 tag;
CARD32 tagType;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xLbxInvalidateTagEvent;
#define sz_xLbxInvalidateTagEvent 32
typedef struct _LbxSendTagDataEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxSendTagDataEvent */
CARD16 sequenceNumber;
CARD32 tag;
CARD32 tagType;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xLbxSendTagDataEvent;
#define sz_xLbxSendTagDataEvent 32
typedef struct _LbxListenToOneEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxListenToOneEvent */
CARD16 sequenceNumber;
CARD32 client;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xLbxListenToOneEvent;
#define sz_xLbxListenToOneEvent 32
typedef struct _LbxListenToAllEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxListenToAllEvent */
CARD16 sequenceNumber;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xLbxListenToAllEvent;
#define sz_xLbxListenToOneEvent 32
typedef struct _LbxReleaseCmapEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxReleaseCmapEvent */
CARD16 sequenceNumber;
Colormap colormap;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xLbxReleaseCmapEvent;
#define sz_xLbxReleaseCmapEvent 32
typedef struct _LbxFreeCellsEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxFreeCellsEvent */
CARD16 sequenceNumber;
Colormap colormap;
CARD32 pixelStart;
CARD32 pixelEnd;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xLbxFreeCellsEvent;
#define sz_xLbxFreeCellsEvent 32
/*
* squished X event sizes. If these change, be sure to update lbxquish.c
* and unsquish.c appropriately
*
* lbxsz_* is the padded squished length
* lbxupsz_* is the unpadded squished length
*/
#define lbxsz_KeyButtonEvent 32
#define lbxupsz_KeyButtonEvent 31
#define lbxsz_EnterLeaveEvent 32
#define lbxupsz_EnterLeaveEvent 32
#define lbxsz_FocusEvent 12
#define lbxupsz_FocusEvent 9
#define lbxsz_KeymapEvent 32
#define lbxupsz_KeymapEvent 32
#define lbxsz_ExposeEvent 20
#define lbxupsz_ExposeEvent 18
#define lbxsz_GfxExposeEvent 24
#define lbxupsz_GfxExposeEvent 21
#define lbxsz_NoExposeEvent 12
#define lbxupsz_NoExposeEvent 11
#define lbxsz_VisibilityEvent 12
#define lbxupsz_VisibilityEvent 9
#define lbxsz_CreateNotifyEvent 24
#define lbxupsz_CreateNotifyEvent 23
#define lbxsz_DestroyNotifyEvent 12
#define lbxupsz_DestroyNotifyEvent 12
#define lbxsz_UnmapNotifyEvent 16
#define lbxupsz_UnmapNotifyEvent 13
#define lbxsz_MapNotifyEvent 16
#define lbxupsz_MapNotifyEvent 13
#define lbxsz_MapRequestEvent 12
#define lbxupsz_MapRequestEvent 12
#define lbxsz_ReparentEvent 24
#define lbxupsz_ReparentEvent 21
#define lbxsz_ConfigureNotifyEvent 28
#define lbxupsz_ConfigureNotifyEvent 27
#define lbxsz_ConfigureRequestEvent 28
#define lbxupsz_ConfigureRequestEvent 28
#define lbxsz_GravityEvent 16
#define lbxupsz_GravityEvent 16
#define lbxsz_ResizeRequestEvent 12
#define lbxupsz_ResizeRequestEvent 12
#define lbxsz_CirculateEvent 20
#define lbxupsz_CirculateEvent 17
#define lbxsz_PropertyEvent 20
#define lbxupsz_PropertyEvent 17
#define lbxsz_SelectionClearEvent 16
#define lbxupsz_SelectionClearEvent 16
#define lbxsz_SelectionRequestEvent 28
#define lbxupsz_SelectionRequestEvent 28
#define lbxsz_SelectionNotifyEvent 24
#define lbxupsz_SelectionNotifyEvent 24
#define lbxsz_ColormapEvent 16
#define lbxupsz_ColormapEvent 14
#define lbxsz_MappingNotifyEvent 8
#define lbxupsz_MappingNotifyEvent 7
#define lbxsz_ClientMessageEvent 32
#define lbxupsz_ClientMessageEvent 32
#define lbxsz_UnknownEvent 32
#ifdef DEBUG
#define DBG_SWITCH 0x00000001
#define DBG_CLOSE 0x00000002
#define DBG_IO 0x00000004
#define DBG_READ_REQ 0x00000008
#define DBG_LEN 0x00000010
#define DBG_BLOCK 0x00000020
#define DBG_CLIENT 0x00000040
#define DBG_DELTA 0x00000080
#endif
/*
* Cancel the previous redefinition of the basic types, thus restoring their
* X.h definitions.
*/
#undef XID
#undef Atom
#undef Colormap
#undef Drawable
#undef VisualID
#undef Window
#endif /* _LBXPROTO_H_ */
/*
Copyright (c) 1992 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifndef _SAVER_H_
#define _SAVER_H_
#define ScreenSaverName "MIT-SCREEN-SAVER"
#define ScreenSaverPropertyName "_MIT_SCREEN_SAVER_ID"
#define ScreenSaverNotifyMask 0x00000001
#define ScreenSaverCycleMask 0x00000002
#define ScreenSaverMajorVersion 1
#define ScreenSaverMinorVersion 1
#define ScreenSaverOff 0
#define ScreenSaverOn 1
#define ScreenSaverCycle 2
#define ScreenSaverDisabled 3
#define ScreenSaverBlanked 0
#define ScreenSaverInternal 1
#define ScreenSaverExternal 2
#define ScreenSaverNotify 0
#define ScreenSaverNumberEvents 1
#endif /* _SAVER_H_ */
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _COMPOSITE_H_
#define _COMPOSITE_H_
#include <X11/extensions/xfixeswire.h>
#define COMPOSITE_NAME "Composite"
#define COMPOSITE_MAJOR 0
#define COMPOSITE_MINOR 4
#define CompositeRedirectAutomatic 0
#define CompositeRedirectManual 1
#define X_CompositeQueryVersion 0
#define X_CompositeRedirectWindow 1
#define X_CompositeRedirectSubwindows 2
#define X_CompositeUnredirectWindow 3
#define X_CompositeUnredirectSubwindows 4
#define X_CompositeCreateRegionFromBorderClip 5
#define X_CompositeNameWindowPixmap 6
#define X_CompositeGetOverlayWindow 7
#define X_CompositeReleaseOverlayWindow 8
#define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1)
#define CompositeNumberEvents 0
#endif /* _COMPOSITE_H_ */
#warning "recordstr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/record.h> for the library interfaces."
#warning "include <X11/extensions/recordproto.h> for the protocol defines."
#include <X11/extensions/recordproto.h>
/*
* Declarations of request structures for the BIGFONT extension.
*
* Copyright (c) 1999-2000 Bruno Haible
* Copyright (c) 1999-2000 The XFree86 Project, Inc.
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _XF86BIGFPROTO_H_
#define _XF86BIGFPROTO_H_
#include <X11/extensions/xf86bigfont.h>
#define XF86BIGFONTNAME "XFree86-Bigfont"
#define XF86BIGFONT_MAJOR_VERSION 1 /* current version numbers */
#define XF86BIGFONT_MINOR_VERSION 1
typedef struct _XF86BigfontQueryVersion {
CARD8 reqType; /* always XF86BigfontReqCode */
CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryVersion */
CARD16 length;
} xXF86BigfontQueryVersionReq;
#define sz_xXF86BigfontQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 capabilities;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of XFree86-Bigfont */
CARD16 minorVersion; /* minor version of XFree86-Bigfont */
CARD32 uid;
CARD32 gid;
CARD32 signature;
CARD32 pad1;
CARD32 pad2;
} xXF86BigfontQueryVersionReply;
#define sz_xXF86BigfontQueryVersionReply 32
/* Bit masks that can be set in the capabilities */
#define XF86Bigfont_CAP_LocalShm 1
typedef struct _XF86BigfontQueryFont {
CARD8 reqType; /* always XF86BigfontReqCode */
CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryFont */
CARD16 length;
CARD32 id;
CARD32 flags;
} xXF86BigfontQueryFontReq;
#define sz_xXF86BigfontQueryFontReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
xCharInfo minBounds;
#ifndef WORD64
CARD32 walign1;
#endif
xCharInfo maxBounds;
#ifndef WORD64
CARD32 walign2;
#endif
CARD16 minCharOrByte2;
CARD16 maxCharOrByte2;
CARD16 defaultChar;
CARD16 nFontProps;
CARD8 drawDirection;
CARD8 minByte1;
CARD8 maxByte1;
BOOL allCharsExist;
INT16 fontAscent;
INT16 fontDescent;
CARD32 nCharInfos;
CARD32 nUniqCharInfos;
CARD32 shmid;
CARD32 shmsegoffset;
/* followed by nFontProps xFontProp structures */
/* and if nCharInfos > 0 && shmid == -1,
followed by nUniqCharInfos xCharInfo structures
and then by nCharInfos CARD16 indices (each >= 0, < nUniqCharInfos)
and then, if nCharInfos is odd, one more CARD16 for padding. */
} xXF86BigfontQueryFontReply;
#define sz_xXF86BigfontQueryFontReply 72
/* Bit masks that can be set in the flags */
#define XF86Bigfont_FLAGS_Shm 1
#endif /* _XF86BIGFPROTO_H_ */
#ifndef _XVMC_H_
#define _XVMC_H_
#include <X11/X.h>
#include <X11/extensions/Xv.h>
#define XvMCName "XVideo-MotionCompensation"
#define XvMCNumEvents 0
#define XvMCNumErrors 3
#define XvMCVersion 1
#define XvMCRevision 1
#define XvMCBadContext 0
#define XvMCBadSurface 1
#define XvMCBadSubpicture 2
/* Chroma formats */
#define XVMC_CHROMA_FORMAT_420 0x00000001
#define XVMC_CHROMA_FORMAT_422 0x00000002
#define XVMC_CHROMA_FORMAT_444 0x00000003
/* XvMCSurfaceInfo Flags */
#define XVMC_OVERLAID_SURFACE 0x00000001
#define XVMC_BACKEND_SUBPICTURE 0x00000002
#define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004
#define XVMC_INTRA_UNSIGNED 0x00000008
/* Motion Compensation types */
#define XVMC_MOCOMP 0x00000000
#define XVMC_IDCT 0x00010000
#define XVMC_MPEG_1 0x00000001
#define XVMC_MPEG_2 0x00000002
#define XVMC_H263 0x00000003
#define XVMC_MPEG_4 0x00000004
#define XVMC_MB_TYPE_MOTION_FORWARD 0x02
#define XVMC_MB_TYPE_MOTION_BACKWARD 0x04
#define XVMC_MB_TYPE_PATTERN 0x08
#define XVMC_MB_TYPE_INTRA 0x10
#define XVMC_PREDICTION_FIELD 0x01
#define XVMC_PREDICTION_FRAME 0x02
#define XVMC_PREDICTION_DUAL_PRIME 0x03
#define XVMC_PREDICTION_16x8 0x02
#define XVMC_PREDICTION_4MV 0x04
#define XVMC_SELECT_FIRST_FORWARD 0x01
#define XVMC_SELECT_FIRST_BACKWARD 0x02
#define XVMC_SELECT_SECOND_FORWARD 0x04
#define XVMC_SELECT_SECOND_BACKWARD 0x08
#define XVMC_DCT_TYPE_FRAME 0x00
#define XVMC_DCT_TYPE_FIELD 0x01
#define XVMC_TOP_FIELD 0x00000001
#define XVMC_BOTTOM_FIELD 0x00000002
#define XVMC_FRAME_PICTURE (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD)
#define XVMC_SECOND_FIELD 0x00000004
#define XVMC_DIRECT 0x00000001
#define XVMC_RENDERING 0x00000001
#define XVMC_DISPLAYING 0x00000002
typedef struct {
int surface_type_id;
int chroma_format;
unsigned short max_width;
unsigned short max_height;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;
int mc_type;
int flags;
} XvMCSurfaceInfo;
typedef struct {
XID context_id;
int surface_type_id;
unsigned short width;
unsigned short height;
XvPortID port;
int flags;
void * privData; /* private to the library */
} XvMCContext;
typedef struct {
XID surface_id;
XID context_id;
int surface_type_id;
unsigned short width;
unsigned short height;
void *privData; /* private to the library */
} XvMCSurface;
typedef struct {
XID subpicture_id;
XID context_id;
int xvimage_id;
unsigned short width;
unsigned short height;
int num_palette_entries;
int entry_bytes;
char component_order[4];
void *privData; /* private to the library */
} XvMCSubpicture;
typedef struct {
unsigned int num_blocks;
XID context_id;
void *privData;
short *blocks;
} XvMCBlockArray;
typedef struct {
unsigned short x;
unsigned short y;
unsigned char macroblock_type;
unsigned char motion_type;
unsigned char motion_vertical_field_select;
unsigned char dct_type;
short PMV[2][2][2];
unsigned int index;
unsigned short coded_block_pattern;
unsigned short pad0;
} XvMCMacroBlock;
typedef struct {
unsigned int num_blocks;
XID context_id;
void *privData;
XvMCMacroBlock *macro_blocks;
} XvMCMacroBlockArray;
#endif
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995 XFree86 Inc.
*/
#ifndef _XF86DGAPROTO1_H_
#define _XF86DGAPROTO1_H_
#include <X11/extensions/xf86dga1const.h>
typedef struct _XF86DGAQueryVersion {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length;
} xXF86DGAQueryVersionReq;
#define sz_xXF86DGAQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of DGA protocol */
CARD16 minorVersion; /* minor version of DGA protocol */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86DGAQueryVersionReply;
#define sz_xXF86DGAQueryVersionReply 32
typedef struct _XF86DGAGetVideoLL {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGAGetVideoLL */
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86DGAGetVideoLLReq;
#define sz_xXF86DGAGetVideoLLReq 8
typedef struct _XF86DGAInstallColormap{
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length;
CARD16 screen;
CARD16 pad2;
CARD32 id; /* colormap. */
} xXF86DGAInstallColormapReq;
#define sz_xXF86DGAInstallColormapReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 offset;
CARD32 width;
CARD32 bank_size;
CARD32 ram_size;
CARD32 pad4;
CARD32 pad5;
} xXF86DGAGetVideoLLReply;
#define sz_xXF86DGAGetVideoLLReply 32
typedef struct _XF86DGADirectVideo {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGADirectVideo */
CARD16 length;
CARD16 screen;
CARD16 enable;
} xXF86DGADirectVideoReq;
#define sz_xXF86DGADirectVideoReq 8
typedef struct _XF86DGAGetViewPortSize {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGAGetViewPort */
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86DGAGetViewPortSizeReq;
#define sz_xXF86DGAGetViewPortSizeReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 width;
CARD32 height;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86DGAGetViewPortSizeReply;
#define sz_xXF86DGAGetViewPortSizeReply 32
typedef struct _XF86DGASetViewPort {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGASetViewPort */
CARD16 length;
CARD16 screen;
CARD16 pad;
CARD32 x;
CARD32 y;
} xXF86DGASetViewPortReq;
#define sz_xXF86DGASetViewPortReq 16
typedef struct _XF86DGAGetVidPage {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGAGetVidPage */
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86DGAGetVidPageReq;
#define sz_xXF86DGAGetVidPageReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 vpage;
CARD32 pad;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86DGAGetVidPageReply;
#define sz_xXF86DGAGetVidPageReply 32
typedef struct _XF86DGASetVidPage {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGASetVidPage */
CARD16 length;
CARD16 screen;
CARD16 vpage;
} xXF86DGASetVidPageReq;
#define sz_xXF86DGASetVidPageReq 8
typedef struct _XF86DGAQueryDirectVideo {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86DGAQueryDirectVideoReq;
#define sz_xXF86DGAQueryDirectVideoReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 flags;
CARD32 pad;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86DGAQueryDirectVideoReply;
#define sz_xXF86DGAQueryDirectVideoReply 32
typedef struct _XF86DGAViewPortChanged {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length;
CARD16 screen;
CARD16 n;
} xXF86DGAViewPortChangedReq;
#define sz_xXF86DGAViewPortChangedReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 result;
CARD32 pad;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86DGAViewPortChangedReply;
#define sz_xXF86DGAViewPortChangedReply 32
#endif /* _XF86DGAPROTO1_H_ */
#warning "xf86bigfstr.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/xf86bigfproto.h> for the protocol defines."
#include <X11/extensions/xf86bigfproto.h>
#ifdef _XF86DGA_SERVER_
#warning "xf86dga.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/xf86dgaconst.h> instead."
#include <X11/extensions/xf86dgaconst.h>
#else
#warning "xf86dga.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/Xxf86dga.h> instead."
#include <X11/extensions/Xxf86dga.h>
#endif
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _DRI3_PROTO_H_
#define _DRI3_PROTO_H_
#define DRI3_NAME "DRI3"
#define DRI3_MAJOR 1
#define DRI3_MINOR 2
#define DRI3NumberErrors 0
#define DRI3NumberEvents 0
#define X_DRI3QueryVersion 0
#define X_DRI3Open 1
#define X_DRI3PixmapFromBuffer 2
#define X_DRI3BufferFromPixmap 3
#define X_DRI3FenceFromFD 4
#define X_DRI3FDFromFence 5
/* v1.2 */
#define xDRI3GetSupportedModifiers 6
#define xDRI3PixmapFromBuffers 7
#define xDRI3BuffersFromPixmap 8
#define DRI3NumberRequests 9
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xDRI3QueryVersionReq;
#define sz_xDRI3QueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDRI3QueryVersionReply;
#define sz_xDRI3QueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 drawable;
CARD32 provider;
} xDRI3OpenReq;
#define sz_xDRI3OpenReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 nfd;
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xDRI3OpenReply;
#define sz_xDRI3OpenReply 32
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 pixmap;
CARD32 drawable;
CARD32 size;
CARD16 width;
CARD16 height;
CARD16 stride;
CARD8 depth;
CARD8 bpp;
} xDRI3PixmapFromBufferReq;
#define sz_xDRI3PixmapFromBufferReq 24
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 pixmap;
} xDRI3BufferFromPixmapReq;
#define sz_xDRI3BufferFromPixmapReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 nfd; /* Number of file descriptors returned (1) */
CARD16 sequenceNumber;
CARD32 length;
CARD32 size;
CARD16 width;
CARD16 height;
CARD16 stride;
CARD8 depth;
CARD8 bpp;
CARD32 pad20;
CARD32 pad24;
CARD32 pad28;
} xDRI3BufferFromPixmapReply;
#define sz_xDRI3BufferFromPixmapReply 32
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 drawable;
CARD32 fence;
BOOL initially_triggered;
CARD8 pad13;
CARD16 pad14;
} xDRI3FenceFromFDReq;
#define sz_xDRI3FenceFromFDReq 16
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 drawable;
CARD32 fence;
} xDRI3FDFromFenceReq;
#define sz_xDRI3FDFromFenceReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 nfd; /* Number of file descriptors returned (1) */
CARD16 sequenceNumber;
CARD32 length;
CARD32 pad08;
CARD32 pad12;
CARD32 pad16;
CARD32 pad20;
CARD32 pad24;
CARD32 pad28;
} xDRI3FDFromFenceReply;
#define sz_xDRI3FDFromFenceReply 32
/* v1.2 */
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 window;
CARD8 depth;
CARD8 bpp;
CARD16 pad10;
} xDRI3GetSupportedModifiersReq;
#define sz_xDRI3GetSupportedModifiersReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numWindowModifiers;
CARD32 numScreenModifiers;
CARD32 pad16;
CARD32 pad20;
CARD32 pad24;
CARD32 pad28;
} xDRI3GetSupportedModifiersReply;
#define sz_xDRI3GetSupportedModifiersReply 32
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 pixmap;
CARD32 window;
CARD8 num_buffers; /* Number of file descriptors passed */
CARD8 pad13;
CARD16 pad14;
CARD16 width;
CARD16 height;
CARD32 stride0;
CARD32 offset0;
CARD32 stride1;
CARD32 offset1;
CARD32 stride2;
CARD32 offset2;
CARD32 stride3;
CARD32 offset3;
CARD8 depth;
CARD8 bpp;
CARD16 pad54;
CARD64 modifier;
} xDRI3PixmapFromBuffersReq;
#define sz_xDRI3PixmapFromBuffersReq 64
typedef struct {
CARD8 reqType;
CARD8 dri3ReqType;
CARD16 length;
CARD32 pixmap;
} xDRI3BuffersFromPixmapReq;
#define sz_xDRI3BuffersFromPixmapReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 nfd; /* Number of file descriptors returned */
CARD16 sequenceNumber;
CARD32 length;
CARD16 width;
CARD16 height;
CARD32 pad12;
CARD64 modifier;
CARD8 depth;
CARD8 bpp;
CARD16 pad26;
CARD32 pad28;
} xDRI3BuffersFromPixmapReply;
#define sz_xDRI3BuffersFromPixmapReply 32
#endif
/******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Header file for Xlib-related DBE
*
*****************************************************************************/
#ifndef DBE_PROTO_H
#define DBE_PROTO_H
#include <X11/extensions/dbe.h>
/* Request values used in (S)ProcDbeDispatch() */
#define X_DbeGetVersion 0
#define X_DbeAllocateBackBufferName 1
#define X_DbeDeallocateBackBufferName 2
#define X_DbeSwapBuffers 3
#define X_DbeBeginIdiom 4
#define X_DbeEndIdiom 5
#define X_DbeGetVisualInfo 6
#define X_DbeGetBackBufferAttributes 7
typedef CARD8 xDbeSwapAction;
typedef CARD32 xDbeBackBuffer;
/* TYPEDEFS */
/* Protocol data types */
typedef struct
{
CARD32 window; /* window */
xDbeSwapAction swapAction; /* swap action */
CARD8 pad1; /* unused */
CARD16 pad2;
} xDbeSwapInfo;
typedef struct
{
CARD32 visualID; /* associated visual */
CARD8 depth; /* depth of visual */
CARD8 perfLevel; /* performance level hint */
CARD16 pad1;
} xDbeVisInfo;
#define sz_xDbeVisInfo 8
typedef struct
{
CARD32 n; /* number of visual info items in list */
} xDbeScreenVisInfo; /* followed by n xDbeVisInfo items */
typedef struct
{
CARD32 window; /* window */
} xDbeBufferAttributes;
/* Requests and replies */
typedef struct
{
CARD8 reqType; /* major-opcode: always codes->major_opcode */
CARD8 dbeReqType; /* minor-opcode: always X_DbeGetVersion (0) */
CARD16 length; /* request length: (2) */
CARD8 majorVersion; /* client-major-version */
CARD8 minorVersion; /* client-minor-version */
CARD16 unused; /* unused */
} xDbeGetVersionReq;
#define sz_xDbeGetVersionReq 8
typedef struct
{
BYTE type; /* Reply: X_Reply (1) */
CARD8 unused; /* unused */
CARD16 sequenceNumber; /* sequence number */
CARD32 length; /* reply length: (0) */
CARD8 majorVersion; /* server-major-version */
CARD8 minorVersion; /* server-minor-version */
CARD16 pad1; /* unused */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xDbeGetVersionReply;
#define sz_xDbeGetVersionReply 32
typedef struct
{
CARD8 reqType; /* major-opcode: codes->major_opcode */
CARD8 dbeReqType; /* X_DbeAllocateBackBufferName (1) */
CARD16 length; /* request length: (4) */
CARD32 window; /* window */
xDbeBackBuffer buffer; /* back buffer name */
xDbeSwapAction swapAction; /* swap action hint */
CARD8 pad1; /* unused */
CARD16 pad2;
} xDbeAllocateBackBufferNameReq;
#define sz_xDbeAllocateBackBufferNameReq 16
typedef struct
{
CARD8 reqType; /* major-opcode: codes->major_opcode */
CARD8 dbeReqType; /* X_DbeDeallocateBackBufferName (2) */
CARD16 length; /* request length: (2) */
xDbeBackBuffer buffer; /* back buffer name */
} xDbeDeallocateBackBufferNameReq;
#define sz_xDbeDeallocateBackBufferNameReq 8
typedef struct
{
CARD8 reqType; /* major-opcode: always codes->major_opcode */
CARD8 dbeReqType; /* minor-opcode: always X_DbeSwapBuffers (3) */
CARD16 length; /* request length: (2+2n) */
CARD32 n; /* n, number of window/swap action pairs */
} xDbeSwapBuffersReq; /* followed by n window/swap action pairs */
#define sz_xDbeSwapBuffersReq 8
typedef struct
{
CARD8 reqType; /* major-opcode: always codes->major_opcode */
CARD8 dbeReqType; /* minor-opcode: always X_DbeBeginIdom (4) */
CARD16 length; /* request length: (1) */
} xDbeBeginIdiomReq;
#define sz_xDbeBeginIdiomReq 4
typedef struct
{
CARD8 reqType; /* major-opcode: always codes->major_opcode */
CARD8 dbeReqType; /* minor-opcode: always X_DbeEndIdom (5) */
CARD16 length; /* request length: (1) */
} xDbeEndIdiomReq;
#define sz_xDbeEndIdiomReq 4
typedef struct
{
CARD8 reqType; /* always codes->major_opcode */
CARD8 dbeReqType; /* always X_DbeGetVisualInfo (6) */
CARD16 length; /* request length: (2+n) */
CARD32 n; /* n, number of drawables in list */
} xDbeGetVisualInfoReq; /* followed by n drawables */
#define sz_xDbeGetVisualInfoReq 8
typedef struct
{
BYTE type; /* Reply: X_Reply (1) */
CARD8 unused; /* unused */
CARD16 sequenceNumber; /* sequence number */
CARD32 length; /* reply length */
CARD32 m; /* m, number of visual infos in list */
CARD32 pad1; /* unused */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDbeGetVisualInfoReply; /* followed by m visual infos */
#define sz_xDbeGetVisualInfoReply 32
typedef struct
{
CARD8 reqType; /* always codes->major_opcode */
CARD8 dbeReqType; /* X_DbeGetBackBufferAttributes (7) */
CARD16 length; /* request length: (2) */
xDbeBackBuffer buffer; /* back buffer name */
} xDbeGetBackBufferAttributesReq;
#define sz_xDbeGetBackBufferAttributesReq 8
typedef struct
{
BYTE type; /* Reply: X_Reply (1) */
CARD8 unused; /* unused */
CARD16 sequenceNumber; /* sequence number */
CARD32 length; /* reply length: (0) */
CARD32 attributes; /* attributes */
CARD32 pad1; /* unused */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xDbeGetBackBufferAttributesReply;
#define sz_xDbeGetBackBufferAttributesReply 32
#endif /* DBE_PROTO_H */
/*
Copyright 1995 Kaleb S. KEITHLEY
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Kaleb S. KEITHLEY
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
from Kaleb S. KEITHLEY
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _XF86VIDMODEPROTO_H_
#define _XF86VIDMODEPROTO_H_
#include <X11/extensions/xf86vm.h>
#define XF86VIDMODENAME "XFree86-VidModeExtension"
#define XF86VIDMODE_MAJOR_VERSION 2 /* current version numbers */
#define XF86VIDMODE_MINOR_VERSION 2
#define X_XF86VidModeQueryVersion 0
#define X_XF86VidModeGetModeLine 1
#define X_XF86VidModeModModeLine 2
#define X_XF86VidModeSwitchMode 3
#define X_XF86VidModeGetMonitor 4
#define X_XF86VidModeLockModeSwitch 5
#define X_XF86VidModeGetAllModeLines 6
#define X_XF86VidModeAddModeLine 7
#define X_XF86VidModeDeleteModeLine 8
#define X_XF86VidModeValidateModeLine 9
#define X_XF86VidModeSwitchToMode 10
#define X_XF86VidModeGetViewPort 11
#define X_XF86VidModeSetViewPort 12
/* new for version 2.x of this extension */
#define X_XF86VidModeGetDotClocks 13
#define X_XF86VidModeSetClientVersion 14
#define X_XF86VidModeSetGamma 15
#define X_XF86VidModeGetGamma 16
#define X_XF86VidModeGetGammaRamp 17
#define X_XF86VidModeSetGammaRamp 18
#define X_XF86VidModeGetGammaRampSize 19
#define X_XF86VidModeGetPermissions 20
/*
* major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm.
* major version 1 == uses parameter-to-wire functions hard-coded in xvidtune
* client.
* major version 2 == uses new protocol version in XFree86 4.0.
*/
typedef struct _XF86VidModeQueryVersion {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeQueryVersion */
CARD16 length;
} xXF86VidModeQueryVersionReq;
#define sz_xXF86VidModeQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion; /* major version of XF86VidMode */
CARD16 minorVersion; /* minor version of XF86VidMode */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86VidModeQueryVersionReply;
#define sz_xXF86VidModeQueryVersionReply 32
typedef struct _XF86VidModeGetModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86VidModeGetModeLineReq,
xXF86VidModeGetAllModeLinesReq,
xXF86VidModeGetMonitorReq,
xXF86VidModeGetViewPortReq,
xXF86VidModeGetDotClocksReq,
xXF86VidModeGetPermissionsReq;
#define sz_xXF86VidModeGetModeLineReq 8
#define sz_xXF86VidModeGetAllModeLinesReq 8
#define sz_xXF86VidModeGetMonitorReq 8
#define sz_xXF86VidModeGetViewPortReq 8
#define sz_xXF86VidModeGetDotClocksReq 8
#define sz_xXF86VidModeGetPermissionsReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 hskew;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD16 pad2;
CARD32 flags;
CARD32 reserved1;
CARD32 reserved2;
CARD32 reserved3;
CARD32 privsize;
} xXF86VidModeGetModeLineReply;
#define sz_xXF86VidModeGetModeLineReply 52
/* 0.x version */
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD32 flags;
CARD32 privsize;
} xXF86OldVidModeGetModeLineReply;
#define sz_xXF86OldVidModeGetModeLineReply 36
typedef struct {
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD32 hskew;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD16 pad1;
CARD32 flags;
CARD32 reserved1;
CARD32 reserved2;
CARD32 reserved3;
CARD32 privsize;
} xXF86VidModeModeInfo;
/* 0.x version */
typedef struct {
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD32 flags;
CARD32 privsize;
} xXF86OldVidModeModeInfo;
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 modecount;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86VidModeGetAllModeLinesReply;
#define sz_xXF86VidModeGetAllModeLinesReply 32
typedef struct _XF86VidModeAddModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */
CARD16 length;
CARD32 screen; /* could be CARD16 but need the pad */
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 hskew;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD16 pad1;
CARD32 flags;
CARD32 reserved1;
CARD32 reserved2;
CARD32 reserved3;
CARD32 privsize;
CARD32 after_dotclock;
CARD16 after_hdisplay;
CARD16 after_hsyncstart;
CARD16 after_hsyncend;
CARD16 after_htotal;
CARD16 after_hskew;
CARD16 after_vdisplay;
CARD16 after_vsyncstart;
CARD16 after_vsyncend;
CARD16 after_vtotal;
CARD16 pad2;
CARD32 after_flags;
CARD32 reserved4;
CARD32 reserved5;
CARD32 reserved6;
} xXF86VidModeAddModeLineReq;
#define sz_xXF86VidModeAddModeLineReq 92
/* 0.x version */
typedef struct _XF86OldVidModeAddModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */
CARD16 length;
CARD32 screen; /* could be CARD16 but need the pad */
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD32 flags;
CARD32 privsize;
CARD32 after_dotclock;
CARD16 after_hdisplay;
CARD16 after_hsyncstart;
CARD16 after_hsyncend;
CARD16 after_htotal;
CARD16 after_vdisplay;
CARD16 after_vsyncstart;
CARD16 after_vsyncend;
CARD16 after_vtotal;
CARD32 after_flags;
} xXF86OldVidModeAddModeLineReq;
#define sz_xXF86OldVidModeAddModeLineReq 60
typedef struct _XF86VidModeModModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeModModeLine */
CARD16 length;
CARD32 screen; /* could be CARD16 but need the pad */
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 hskew;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD16 pad1;
CARD32 flags;
CARD32 reserved1;
CARD32 reserved2;
CARD32 reserved3;
CARD32 privsize;
} xXF86VidModeModModeLineReq;
#define sz_xXF86VidModeModModeLineReq 48
/* 0.x version */
typedef struct _XF86OldVidModeModModeLine {
CARD8 reqType; /* always XF86OldVidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86OldVidModeModModeLine */
CARD16 length;
CARD32 screen; /* could be CARD16 but need the pad */
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD32 flags;
CARD32 privsize;
} xXF86OldVidModeModModeLineReq;
#define sz_xXF86OldVidModeModModeLineReq 32
typedef struct _XF86VidModeValidateModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD32 screen; /* could be CARD16 but need the pad */
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 hskew;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD16 pad1;
CARD32 flags;
CARD32 reserved1;
CARD32 reserved2;
CARD32 reserved3;
CARD32 privsize;
} xXF86VidModeDeleteModeLineReq,
xXF86VidModeValidateModeLineReq,
xXF86VidModeSwitchToModeReq;
#define sz_xXF86VidModeDeleteModeLineReq 52
#define sz_xXF86VidModeValidateModeLineReq 52
#define sz_xXF86VidModeSwitchToModeReq 52
/* 0.x version */
typedef struct _XF86OldVidModeValidateModeLine {
CARD8 reqType; /* always XF86OldVidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD32 screen; /* could be CARD16 but need the pad */
CARD32 dotclock;
CARD16 hdisplay;
CARD16 hsyncstart;
CARD16 hsyncend;
CARD16 htotal;
CARD16 vdisplay;
CARD16 vsyncstart;
CARD16 vsyncend;
CARD16 vtotal;
CARD32 flags;
CARD32 privsize;
} xXF86OldVidModeDeleteModeLineReq,
xXF86OldVidModeValidateModeLineReq,
xXF86OldVidModeSwitchToModeReq;
#define sz_xXF86OldVidModeDeleteModeLineReq 36
#define sz_xXF86OldVidModeValidateModeLineReq 36
#define sz_xXF86OldVidModeSwitchToModeReq 36
typedef struct _XF86VidModeSwitchMode {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSwitchMode */
CARD16 length;
CARD16 screen;
CARD16 zoom;
} xXF86VidModeSwitchModeReq;
#define sz_xXF86VidModeSwitchModeReq 8
typedef struct _XF86VidModeLockModeSwitch {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeLockModeSwitch */
CARD16 length;
CARD16 screen;
CARD16 lock;
} xXF86VidModeLockModeSwitchReq;
#define sz_xXF86VidModeLockModeSwitchReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 status;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86VidModeValidateModeLineReply;
#define sz_xXF86VidModeValidateModeLineReply 32
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD8 vendorLength;
CARD8 modelLength;
CARD8 nhsync;
CARD8 nvsync;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86VidModeGetMonitorReply;
#define sz_xXF86VidModeGetMonitorReply 32
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 x;
CARD32 y;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86VidModeGetViewPortReply;
#define sz_xXF86VidModeGetViewPortReply 32
typedef struct _XF86VidModeSetViewPort {
CARD8 reqType; /* always VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSetViewPort */
CARD16 length;
CARD16 screen;
CARD16 pad;
CARD32 x;
CARD32 y;
} xXF86VidModeSetViewPortReq;
#define sz_xXF86VidModeSetViewPortReq 16
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 flags;
CARD32 clocks;
CARD32 maxclocks;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xXF86VidModeGetDotClocksReply;
#define sz_xXF86VidModeGetDotClocksReply 32
typedef struct _XF86VidModeSetClientVersion {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 major;
CARD16 minor;
} xXF86VidModeSetClientVersionReq;
#define sz_xXF86VidModeSetClientVersionReq 8
typedef struct _XF86VidModeGetGamma {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 screen;
CARD16 pad;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXF86VidModeGetGammaReq;
#define sz_xXF86VidModeGetGammaReq 32
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber;
CARD32 length;
CARD32 red;
CARD32 green;
CARD32 blue;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xXF86VidModeGetGammaReply;
#define sz_xXF86VidModeGetGammaReply 32
typedef struct _XF86VidModeSetGamma {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 screen;
CARD16 pad;
CARD32 red;
CARD32 green;
CARD32 blue;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
} xXF86VidModeSetGammaReq;
#define sz_xXF86VidModeSetGammaReq 32
typedef struct _XF86VidModeSetGammaRamp {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 screen;
CARD16 size;
} xXF86VidModeSetGammaRampReq;
#define sz_xXF86VidModeSetGammaRampReq 8
typedef struct _XF86VidModeGetGammaRamp {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 screen;
CARD16 size;
} xXF86VidModeGetGammaRampReq;
#define sz_xXF86VidModeGetGammaRampReq 8
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber;
CARD32 length;
CARD16 size;
CARD16 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86VidModeGetGammaRampReply;
#define sz_xXF86VidModeGetGammaRampReply 32
typedef struct _XF86VidModeGetGammaRampSize {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length;
CARD16 screen;
CARD16 pad;
} xXF86VidModeGetGammaRampSizeReq;
#define sz_xXF86VidModeGetGammaRampSizeReq 8
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber;
CARD32 length;
CARD16 size;
CARD16 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86VidModeGetGammaRampSizeReply;
#define sz_xXF86VidModeGetGammaRampSizeReply 32
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber;
CARD32 length;
CARD32 permissions;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXF86VidModeGetPermissionsReply;
#define sz_xXF86VidModeGetPermissionsReply 32
#endif /* _XF86VIDMODEPROTO_H_ */
#warning "xf86dga1str.h is obsolete and may be removed in the future."
#warning "include <X11/extensions/xf86dga1proto.h> for the protocol defines."
#include <X11/extensions/xf86dga1proto.h>
/*
Copyright 1995 Kaleb S. KEITHLEY
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Kaleb S. KEITHLEY
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
from Kaleb S. KEITHLEY
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _XF86VM_H_
#define _XF86VM_H_
#include <X11/Xmd.h>
#define CLKFLAG_PROGRAMABLE 1
#ifdef XF86VIDMODE_EVENTS
#define XF86VidModeNotify 0
#define XF86VidModeNumberEvents (XF86VidModeNotify + 1)
#define XF86VidModeNotifyMask 0x00000001
#define XF86VidModeNonEvent 0
#define XF86VidModeModeChange 1
#else
#define XF86VidModeNumberEvents 0
#endif
#define XF86VidModeBadClock 0
#define XF86VidModeBadHTimings 1
#define XF86VidModeBadVTimings 2
#define XF86VidModeModeUnsuitable 3
#define XF86VidModeExtensionDisabled 4
#define XF86VidModeClientNotLocal 5
#define XF86VidModeZoomLocked 6
#define XF86VidModeNumberErrors (XF86VidModeZoomLocked + 1)
#define XF86VM_READ_PERMISSION 1
#define XF86VM_WRITE_PERMISSION 2
#endif
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _MULTIBUFCONST_H_
#define _MULTIBUFCONST_H_
#define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
#define MULTIBUFFER_MAJOR_VERSION 1 /* current version numbers */
#define MULTIBUFFER_MINOR_VERSION 1 /* has ClearImageBufferArea */
/*
* update_action field
*/
#define MultibufferUpdateActionUndefined 0
#define MultibufferUpdateActionBackground 1
#define MultibufferUpdateActionUntouched 2
#define MultibufferUpdateActionCopied 3
/*
* update_hint field
*/
#define MultibufferUpdateHintFrequent 0
#define MultibufferUpdateHintIntermittent 1
#define MultibufferUpdateHintStatic 2
/*
* valuemask fields
*/
#define MultibufferWindowUpdateHint (1L << 0)
#define MultibufferBufferEventMask (1L << 0)
/*
* mono vs. stereo and left vs. right
*/
#define MultibufferModeMono 0
#define MultibufferModeStereo 1
#define MultibufferSideMono 0
#define MultibufferSideLeft 1
#define MultibufferSideRight 2
/*
* clobber state
*/
#define MultibufferUnclobbered 0
#define MultibufferPartiallyClobbered 1
#define MultibufferFullyClobbered 2
/*
* event stuff
*/
#define MultibufferClobberNotifyMask 0x02000000
#define MultibufferUpdateNotifyMask 0x04000000
#define MultibufferClobberNotify 0
#define MultibufferUpdateNotify 1
#define MultibufferNumberEvents (MultibufferUpdateNotify + 1)
#define MultibufferBadBuffer 0
#define MultibufferNumberErrors (MultibufferBadBuffer + 1)
#endif /* _MULTIBUFCONST_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
#ifndef _SHAPECONST_H_
#define _SHAPECONST_H_
/*
* Protocol requests constants and alignment values
* These would really be in SHAPE's X.h and Xproto.h equivalents
*/
#define SHAPENAME "SHAPE"
#define SHAPE_MAJOR_VERSION 1 /* current version numbers */
#define SHAPE_MINOR_VERSION 1
#define ShapeSet 0
#define ShapeUnion 1
#define ShapeIntersect 2
#define ShapeSubtract 3
#define ShapeInvert 4
#define ShapeBounding 0
#define ShapeClip 1
#define ShapeInput 2
#define ShapeNotifyMask (1L << 0)
#define ShapeNotify 0
#define ShapeNumberEvents (ShapeNotify + 1)
#endif /* _SHAPECONST_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _SECUR_H
#define _SECUR_H
#define SECURITY_EXTENSION_NAME "SECURITY"
#define SECURITY_MAJOR_VERSION 1
#define SECURITY_MINOR_VERSION 0
#define XSecurityNumberEvents 1
#define XSecurityNumberErrors 2
#define XSecurityBadAuthorization 0
#define XSecurityBadAuthorizationProtocol 1
/* trust levels */
#define XSecurityClientTrusted 0
#define XSecurityClientUntrusted 1
/* authorization attribute masks */
#define XSecurityTimeout (1<<0)
#define XSecurityTrustLevel (1<<1)
#define XSecurityGroup (1<<2)
#define XSecurityEventMask (1<<3)
#define XSecurityAllAuthorizationAttributes \
(XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask)
/* event masks */
#define XSecurityAuthorizationRevokedMask (1<<0)
#define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask
/* event offsets */
#define XSecurityAuthorizationRevoked 0
#define XSecurityAuthorizationName "XC-QUERY-SECURITY-1"
#define XSecurityAuthorizationNameLen 19
#endif /* _SECUR_H */
/******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Header file for Xlib-related DBE
*
*****************************************************************************/
#ifndef DBE_H
#define DBE_H
/* Values for swap_action field of XdbeSwapInfo structure */
#define XdbeUndefined 0
#define XdbeBackground 1
#define XdbeUntouched 2
#define XdbeCopied 3
/* Errors */
#define XdbeBadBuffer 0
#define DBE_PROTOCOL_NAME "DOUBLE-BUFFER"
/* Current version numbers */
#define DBE_MAJOR_VERSION 1
#define DBE_MINOR_VERSION 0
/* Used when adding extension; also used in Xdbe macros */
#define DbeNumberEvents 0
#define DbeBadBuffer 0
#define DbeNumberErrors (DbeBadBuffer + 1)
#endif /* DBE_H */
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _PRESENT_PROTO_H_
#define _PRESENT_PROTO_H_
#include <X11/extensions/presenttokens.h>
#define Window CARD32
#define Pixmap CARD32
#define Region CARD32
#define XSyncFence CARD32
#define EventID CARD32
typedef struct {
Window window;
CARD32 serial;
} xPresentNotify;
#define sz_xPresentNotify 8
typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xPresentQueryVersionReq;
#define sz_xPresentQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xPresentQueryVersionReply;
#define sz_xPresentQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length;
Window window;
Pixmap pixmap;
CARD32 serial;
Region valid;
Region update;
INT16 x_off;
INT16 y_off;
CARD32 target_crtc;
XSyncFence wait_fence;
XSyncFence idle_fence;
CARD32 options;
CARD32 pad1;
CARD64 target_msc;
CARD64 divisor;
CARD64 remainder;
/* followed by a LISTofPRESENTNOTIFY */
} xPresentPixmapReq;
#define sz_xPresentPixmapReq 72
typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length;
Window window;
CARD32 serial;
CARD32 pad0;
CARD64 target_msc;
CARD64 divisor;
CARD64 remainder;
} xPresentNotifyMSCReq;
#define sz_xPresentNotifyMSCReq 40
typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length;
CARD32 eid;
CARD32 window;
CARD32 eventMask;
} xPresentSelectInputReq;
#define sz_xPresentSelectInputReq 16
typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length;
CARD32 target;
} xPresentQueryCapabilitiesReq;
#define sz_xPresentQueryCapabilitiesReq 8
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 capabilities;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} xPresentQueryCapabilitiesReply;
#define sz_xPresentQueryCapabilitiesReply 32
/*
* Events
*
* All Present events are X Generic Events
*/
typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber;
CARD32 length;
CARD16 evtype;
CARD16 pad2;
CARD32 eid;
CARD32 window;
INT16 x;
INT16 y;
CARD16 width;
CARD16 height;
INT16 off_x;
INT16 off_y;
CARD16 pixmap_width;
CARD16 pixmap_height;
CARD32 pixmap_flags;
} xPresentConfigureNotify;
#define sz_xPresentConfigureNotify 40
typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber;
CARD32 length;
CARD16 evtype;
CARD8 kind;
CARD8 mode;
CARD32 eid;
Window window;
CARD32 serial;
CARD64 ust;
CARD64 msc;
} xPresentCompleteNotify;
#define sz_xPresentCompleteNotify 40
typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber;
CARD32 length;
CARD16 evtype;
CARD16 pad2;
CARD32 eid;
Window window;
CARD32 serial;
Pixmap pixmap;
CARD32 idle_fence;
} xPresentIdleNotify;
#define sz_xPresentIdleNotify 32
#if PRESENT_FUTURE_VERSION
typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber;
CARD32 length;
CARD16 evtype;
CARD8 update_window;
CARD8 pad1;
CARD32 eid;
Window event_window;
Window window;
Pixmap pixmap;
CARD32 serial;
/* 32-byte boundary */
Region valid_region;
Region update_region;
xRectangle valid_rect;
xRectangle update_rect;
INT16 x_off;
INT16 y_off;
CARD32 target_crtc;
XSyncFence wait_fence;
XSyncFence idle_fence;
CARD32 options;
CARD32 pad2;
CARD64 target_msc;
CARD64 divisor;
CARD64 remainder;
} xPresentRedirectNotify;
#define sz_xPresentRedirectNotify 104
#endif
#undef Window
#undef Pixmap
#undef Region
#undef XSyncFence
#undef EventID
#endif
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Hewlett-Packard not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _XIPROTO_H
#define _XIPROTO_H
#include <X11/Xproto.h>
#include <X11/X.h>
/* make sure types have right sizes for protocol structures. */
#define Window CARD32
#define Time CARD32
#define KeyCode CARD8
#define Mask CARD32
#define Atom CARD32
#define Cursor CARD32
/*********************************************************
*
* number of events, errors, and extension name.
*
*/
#define MORE_EVENTS 0x80
#define DEVICE_BITS 0x7F
#define InputClassBits 0x3F /* bits in mode field for input classes */
#define ModeBitsShift 6 /* amount to shift the remaining bits */
#define numInputClasses 7
#define IEVENTS 17 /* does NOT include generic events */
#define IERRORS 5
#define IREQUESTS 39
#define CLIENT_REQ 1
typedef struct _XExtEventInfo
{
Mask mask;
BYTE type;
BYTE word;
} XExtEventInfo;
#ifndef _XITYPEDEF_POINTER
typedef void *Pointer;
#endif
struct tmask
{
Mask mask;
void *dev;
};
/*********************************************************
*
* Event constants used by library.
*
*/
#define XI_DeviceValuator 0
#define XI_DeviceKeyPress 1
#define XI_DeviceKeyRelease 2
#define XI_DeviceButtonPress 3
#define XI_DeviceButtonRelease 4
#define XI_DeviceMotionNotify 5
#define XI_DeviceFocusIn 6
#define XI_DeviceFocusOut 7
#define XI_ProximityIn 8
#define XI_ProximityOut 9
#define XI_DeviceStateNotify 10
#define XI_DeviceMappingNotify 11
#define XI_ChangeDeviceNotify 12
#define XI_DeviceKeystateNotify 13
#define XI_DeviceButtonstateNotify 14
#define XI_DevicePresenceNotify 15
#define XI_DevicePropertyNotify 16
/*********************************************************
*
* Protocol request constants
*
*/
#define X_GetExtensionVersion 1
#define X_ListInputDevices 2
#define X_OpenDevice 3
#define X_CloseDevice 4
#define X_SetDeviceMode 5
#define X_SelectExtensionEvent 6
#define X_GetSelectedExtensionEvents 7
#define X_ChangeDeviceDontPropagateList 8
#define X_GetDeviceDontPropagateList 9
#define X_GetDeviceMotionEvents 10
#define X_ChangeKeyboardDevice 11
#define X_ChangePointerDevice 12
#define X_GrabDevice 13
#define X_UngrabDevice 14
#define X_GrabDeviceKey 15
#define X_UngrabDeviceKey 16
#define X_GrabDeviceButton 17
#define X_UngrabDeviceButton 18
#define X_AllowDeviceEvents 19
#define X_GetDeviceFocus 20
#define X_SetDeviceFocus 21
#define X_GetFeedbackControl 22
#define X_ChangeFeedbackControl 23
#define X_GetDeviceKeyMapping 24
#define X_ChangeDeviceKeyMapping 25
#define X_GetDeviceModifierMapping 26
#define X_SetDeviceModifierMapping 27
#define X_GetDeviceButtonMapping 28
#define X_SetDeviceButtonMapping 29
#define X_QueryDeviceState 30
#define X_SendExtensionEvent 31
#define X_DeviceBell 32
#define X_SetDeviceValuators 33
#define X_GetDeviceControl 34
#define X_ChangeDeviceControl 35
/* XI 1.5 */
#define X_ListDeviceProperties 36
#define X_ChangeDeviceProperty 37
#define X_DeleteDeviceProperty 38
#define X_GetDeviceProperty 39
/*********************************************************
*
* Protocol request and reply structures.
*
* GetExtensionVersion.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GetExtensionVersion */
CARD16 length;
CARD16 nbytes;
CARD8 pad1, pad2;
} xGetExtensionVersionReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetExtensionVersion */
CARD16 sequenceNumber;
CARD32 length;
CARD16 major_version;
CARD16 minor_version;
BOOL present;
CARD8 pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
} xGetExtensionVersionReply;
/*********************************************************
*
* ListInputDevices.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_ListInputDevices */
CARD16 length;
} xListInputDevicesReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_ListInputDevices */
CARD16 sequenceNumber;
CARD32 length;
CARD8 ndevices;
CARD8 pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xListInputDevicesReply;
typedef struct _xDeviceInfo *xDeviceInfoPtr;
typedef struct _xAnyClassinfo *xAnyClassPtr;
typedef struct _xAnyClassinfo {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
} xAnyClassInfo;
typedef struct _xDeviceInfo {
CARD32 type;
CARD8 id;
CARD8 num_classes;
CARD8 use; /* IsXPointer | IsXKeyboard | IsXExtension... */
CARD8 attached; /* id of master dev (if IsXExtension..) */
} xDeviceInfo;
typedef struct _xKeyInfo *xKeyInfoPtr;
typedef struct _xKeyInfo {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
KeyCode min_keycode;
KeyCode max_keycode;
CARD16 num_keys;
CARD8 pad1,pad2;
} xKeyInfo;
typedef struct _xButtonInfo *xButtonInfoPtr;
typedef struct _xButtonInfo {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
CARD16 num_buttons;
} xButtonInfo;
typedef struct _xValuatorInfo *xValuatorInfoPtr;
typedef struct _xValuatorInfo {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
CARD8 num_axes;
CARD8 mode;
CARD32 motion_buffer_size;
} xValuatorInfo;
typedef struct _xAxisInfo *xAxisInfoPtr;
typedef struct _xAxisInfo {
CARD32 resolution;
CARD32 min_value;
CARD32 max_value;
} xAxisInfo;
/*********************************************************
*
* OpenDevice.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_OpenDevice */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xOpenDeviceReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_OpenDevice */
CARD16 sequenceNumber;
CARD32 length;
CARD8 num_classes;
BYTE pad1, pad2, pad3;
CARD32 pad00;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
} xOpenDeviceReply;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 event_type_base;
} xInputClassInfo;
/*********************************************************
*
* CloseDevice.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_CloseDevice */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xCloseDeviceReq;
/*********************************************************
*
* SetDeviceMode.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_SetDeviceMode */
CARD16 length;
CARD8 deviceid;
CARD8 mode;
BYTE pad1, pad2;
} xSetDeviceModeReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_SetDeviceMode */
CARD16 sequenceNumber;
CARD32 length;
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xSetDeviceModeReply;
/*********************************************************
*
* SelectExtensionEvent.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_SelectExtensionEvent */
CARD16 length;
Window window;
CARD16 count;
CARD16 pad00;
} xSelectExtensionEventReq;
/*********************************************************
*
* GetSelectedExtensionEvent.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_GetSelectedExtensionEvents */
CARD16 length;
Window window;
} xGetSelectedExtensionEventsReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* GetSelectedExtensionEvents */
CARD16 sequenceNumber;
CARD32 length;
CARD16 this_client_count;
CARD16 all_clients_count;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xGetSelectedExtensionEventsReply;
/*********************************************************
*
* ChangeDeviceDontPropagateList.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_ChangeDeviceDontPropagateList */
CARD16 length;
Window window;
CARD16 count;
CARD8 mode;
BYTE pad;
} xChangeDeviceDontPropagateListReq;
/*********************************************************
*
* GetDeviceDontPropagateList.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_GetDeviceDontPropagateList */
CARD16 length;
Window window;
} xGetDeviceDontPropagateListReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* GetDeviceDontPropagateList */
CARD16 sequenceNumber;
CARD32 length;
CARD16 count;
CARD16 pad00;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xGetDeviceDontPropagateListReply;
/*********************************************************
*
* GetDeviceMotionEvents.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GetDeviceMotionEvents*/
CARD16 length;
Time start;
Time stop;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xGetDeviceMotionEventsReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceMotionEvents */
CARD16 sequenceNumber;
CARD32 length;
CARD32 nEvents;
CARD8 axes;
CARD8 mode;
BYTE pad1, pad2;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
} xGetDeviceMotionEventsReply;
/*********************************************************
*
* ChangeKeyboardDevice.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_ChangeKeyboardDevice */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xChangeKeyboardDeviceReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_ChangeKeyboardDevice*/
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xChangeKeyboardDeviceReply;
/*********************************************************
*
* ChangePointerDevice.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_ChangePointerDevice */
CARD16 length;
CARD8 xaxis;
CARD8 yaxis;
CARD8 deviceid;
BYTE pad1;
} xChangePointerDeviceReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_ChangePointerDevice */
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xChangePointerDeviceReply;
/*********************************************************
*
* GrabDevice.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GrabDevice */
CARD16 length;
Window grabWindow;
Time time;
CARD16 event_count;
CARD8 this_device_mode;
CARD8 other_devices_mode;
BOOL ownerEvents;
CARD8 deviceid;
CARD16 pad01;
} xGrabDeviceReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GrabDevice */
CARD16 sequenceNumber;
CARD32 length; /* 0 */
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xGrabDeviceReply;
/*********************************************************
*
* UngrabDevice.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_UnGrabDevice */
CARD16 length;
Time time;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xUngrabDeviceReq;
/*********************************************************
*
* GrabDeviceKey.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GrabDeviceKey */
CARD16 length;
Window grabWindow;
CARD16 event_count;
CARD16 modifiers;
CARD8 modifier_device;
CARD8 grabbed_device;
CARD8 key;
BYTE this_device_mode;
BYTE other_devices_mode;
BOOL ownerEvents;
BYTE pad1, pad2;
} xGrabDeviceKeyReq;
/*********************************************************
*
* UngrabDeviceKey.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_UngrabDeviceKey */
CARD16 length;
Window grabWindow;
CARD16 modifiers;
CARD8 modifier_device;
CARD8 key;
CARD8 grabbed_device;
BYTE pad1, pad2, pad3;
} xUngrabDeviceKeyReq;
/*********************************************************
*
* GrabDeviceButton.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GrabDeviceButton */
CARD16 length;
Window grabWindow;
CARD8 grabbed_device;
CARD8 modifier_device;
CARD16 event_count;
CARD16 modifiers;
BYTE this_device_mode;
BYTE other_devices_mode;
CARD8 button;
BOOL ownerEvents;
BYTE pad1, pad2;
} xGrabDeviceButtonReq;
/*********************************************************
*
* UngrabDeviceButton.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_UngrabDeviceButton */
CARD16 length;
Window grabWindow;
CARD16 modifiers;
CARD8 modifier_device;
CARD8 button;
CARD8 grabbed_device;
BYTE pad1, pad2, pad3;
} xUngrabDeviceButtonReq;
/*********************************************************
*
* AllowDeviceEvents.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_AllowDeviceEvents */
CARD16 length;
Time time;
CARD8 mode;
CARD8 deviceid;
BYTE pad1, pad2;
} xAllowDeviceEventsReq;
/*********************************************************
*
* GetDeviceFocus.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GetDeviceFocus */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xGetDeviceFocusReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceFocus */
CARD16 sequenceNumber;
CARD32 length;
CARD32 focus;
Time time;
CARD8 revertTo;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
} xGetDeviceFocusReply;
/*********************************************************
*
* SetDeviceFocus.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_SetDeviceFocus */
CARD16 length;
Window focus;
Time time;
CARD8 revertTo;
CARD8 device;
CARD16 pad01;
} xSetDeviceFocusReq;
/*********************************************************
*
* GetFeedbackControl.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_GetFeedbackControl */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xGetFeedbackControlReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetFeedbackControl */
CARD16 sequenceNumber;
CARD32 length;
CARD16 num_feedbacks;
CARD16 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
CARD32 pad06;
} xGetFeedbackControlReply;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class */
#else
CARD8 class; /* feedback class */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
} xFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 id;
CARD16 length;
CARD16 pitch;
CARD16 duration;
CARD32 led_mask;
CARD32 led_values;
BOOL global_auto_repeat;
CARD8 click;
CARD8 percent;
BYTE pad;
BYTE auto_repeats[32];
} xKbdFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 id;
CARD16 length;
CARD8 pad1,pad2;
CARD16 accelNum;
CARD16 accelDenom;
CARD16 threshold;
} xPtrFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id;
CARD16 length; /* feedback length */
CARD32 resolution;
INT32 min_value;
INT32 max_value;
} xIntegerFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id;
CARD16 length; /* feedback length */
CARD16 max_symbols;
CARD16 num_syms_supported;
} xStringFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id;
CARD16 length; /* feedback length */
CARD8 percent;
BYTE pad1, pad2, pad3;
CARD16 pitch;
CARD16 duration;
} xBellFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id;
CARD16 length; /* feedback length */
CARD32 led_mask;
CARD32 led_values;
} xLedFeedbackState;
/*********************************************************
*
* ChangeFeedbackControl.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_ChangeFeedbackControl */
CARD16 length;
CARD32 mask;
CARD8 deviceid;
CARD8 feedbackid;
BYTE pad1, pad2;
} xChangeFeedbackControlReq;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
} xFeedbackCtl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback length */
CARD16 length; /* feedback length */
KeyCode key;
CARD8 auto_repeat_mode;
INT8 click;
INT8 percent;
INT16 pitch;
INT16 duration;
CARD32 led_mask;
CARD32 led_values;
} xKbdFeedbackCtl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
CARD8 pad1,pad2;
INT16 num;
INT16 denom;
INT16 thresh;
} xPtrFeedbackCtl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
INT32 int_to_display;
} xIntegerFeedbackCtl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
CARD8 pad1,pad2;
CARD16 num_keysyms;
} xStringFeedbackCtl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
INT8 percent;
BYTE pad1, pad2, pad3;
INT16 pitch;
INT16 duration;
} xBellFeedbackCtl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class; /* feedback class id */
#else
CARD8 class; /* feedback class id */
#endif
CARD8 id; /* feedback id */
CARD16 length; /* feedback length */
CARD32 led_mask;
CARD32 led_values;
} xLedFeedbackCtl;
/*********************************************************
*
* GetDeviceKeyMapping.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GetDeviceKeyMapping */
CARD16 length;
CARD8 deviceid;
KeyCode firstKeyCode;
CARD8 count;
BYTE pad1;
} xGetDeviceKeyMappingReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceKeyMapping */
CARD16 sequenceNumber;
CARD32 length;
CARD8 keySymsPerKeyCode;
CARD8 pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetDeviceKeyMappingReply;
/*********************************************************
*
* ChangeDeviceKeyMapping.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_ChangeDeviceKeyMapping */
CARD16 length;
CARD8 deviceid;
KeyCode firstKeyCode;
CARD8 keySymsPerKeyCode;
CARD8 keyCodes;
} xChangeDeviceKeyMappingReq;
/*********************************************************
*
* GetDeviceModifierMapping.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GetDeviceModifierMapping */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xGetDeviceModifierMappingReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceModifierMapping */
CARD16 sequenceNumber;
CARD32 length;
CARD8 numKeyPerModifier;
CARD8 pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xGetDeviceModifierMappingReply;
/*********************************************************
*
* SetDeviceModifierMapping.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_SetDeviceModifierMapping */
CARD16 length;
CARD8 deviceid;
CARD8 numKeyPerModifier;
CARD16 pad1;
} xSetDeviceModifierMappingReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_SetDeviceModifierMapping */
CARD16 sequenceNumber;
CARD32 length;
CARD8 success;
CARD8 pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xSetDeviceModifierMappingReply;
/*********************************************************
*
* GetDeviceButtonMapping.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_GetDeviceButtonMapping */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xGetDeviceButtonMappingReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceButtonMapping */
CARD16 sequenceNumber;
CARD32 length;
CARD8 nElts;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xGetDeviceButtonMappingReply;
/*********************************************************
*
* SetDeviceButtonMapping.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* X_SetDeviceButtonMapping */
CARD16 length;
CARD8 deviceid;
CARD8 map_length;
BYTE pad1, pad2;
} xSetDeviceButtonMappingReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_SetDeviceButtonMapping */
CARD16 sequenceNumber;
CARD32 length;
CARD8 status;
BYTE pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xSetDeviceButtonMappingReply;
/*********************************************************
*
* QueryDeviceState.
*
*/
typedef struct {
CARD8 reqType;
CARD8 ReqType; /* always X_QueryDeviceState */
CARD16 length;
CARD8 deviceid;
BYTE pad1, pad2, pad3;
} xQueryDeviceStateReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_QueryDeviceState */
CARD16 sequenceNumber;
CARD32 length;
CARD8 num_classes;
BYTE pad0;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xQueryDeviceStateReply;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
CARD8 num_keys;
BYTE pad1;
CARD8 keys[32];
} xKeyState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
CARD8 num_buttons;
BYTE pad1;
CARD8 buttons[32];
} xButtonState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
CARD8 c_class;
#else
CARD8 class;
#endif
CARD8 length;
CARD8 num_valuators;
CARD8 mode;
} xValuatorState;
/*********************************************************
*
* SendExtensionEvent.
* THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH!
* MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED!
*
*/
typedef struct {
CARD8 reqType;
CARD8 ReqType; /* always X_SendExtensionEvent */
CARD16 length;
Window destination;
CARD8 deviceid;
BOOL propagate;
CARD16 count;
CARD8 num_events;
BYTE pad1,pad2,pad3;
} xSendExtensionEventReq;
/*********************************************************
*
* DeviceBell.
*
*/
typedef struct {
CARD8 reqType;
CARD8 ReqType; /* always X_DeviceBell */
CARD16 length;
CARD8 deviceid;
CARD8 feedbackid;
CARD8 feedbackclass;
INT8 percent;
} xDeviceBellReq;
/*********************************************************
*
* SetDeviceValuators.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_SetDeviceValuators */
CARD16 length;
CARD8 deviceid;
CARD8 first_valuator;
CARD8 num_valuators;
BYTE pad1;
} xSetDeviceValuatorsReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_SetDeviceValuators */
CARD16 sequenceNumber;
CARD32 length;
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xSetDeviceValuatorsReply;
/*********************************************************
*
* GetDeviceControl.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_GetDeviceControl */
CARD16 length;
CARD16 control;
CARD8 deviceid;
BYTE pad2;
} xGetDeviceControlReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceControl */
CARD16 sequenceNumber;
CARD32 length;
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xGetDeviceControlReply;
typedef struct {
CARD16 control; /* control type */
CARD16 length; /* control length */
} xDeviceState;
typedef struct {
CARD16 control; /* control type */
CARD16 length; /* control length */
CARD32 num_valuators; /* number of valuators */
} xDeviceResolutionState;
typedef struct {
CARD16 control;
CARD16 length;
INT32 min_x;
INT32 max_x;
INT32 min_y;
INT32 max_y;
CARD32 flip_x;
CARD32 flip_y;
CARD32 rotation;
CARD32 button_threshold;
} xDeviceAbsCalibState;
typedef struct {
CARD16 control;
CARD16 length;
CARD32 offset_x;
CARD32 offset_y;
CARD32 width;
CARD32 height;
CARD32 screen;
CARD32 following;
} xDeviceAbsAreaState;
typedef struct {
CARD16 control; /* control type */
CARD16 length; /* control length */
CARD8 status;
CARD8 iscore;
CARD16 pad1;
} xDeviceCoreState;
typedef struct {
CARD16 control; /* control type */
CARD16 length; /* control length */
CARD8 enable;
CARD8 pad0;
CARD16 pad1;
} xDeviceEnableState;
/*********************************************************
*
* ChangeDeviceControl.
*
*/
typedef struct {
CARD8 reqType; /* input extension major code */
CARD8 ReqType; /* always X_ChangeDeviceControl */
CARD16 length;
CARD16 control;
CARD8 deviceid;
BYTE pad0;
} xChangeDeviceControlReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_ChangeDeviceControl */
CARD16 sequenceNumber;
CARD32 length;
CARD8 status;
BYTE pad1, pad2, pad3;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
} xChangeDeviceControlReply;
typedef struct {
CARD16 control; /* control type */
CARD16 length; /* control length */
} xDeviceCtl;
typedef struct {
CARD16 control; /* control type */
CARD16 length; /* control length */
CARD8 first_valuator; /* first valuator to change */
CARD8 num_valuators; /* number of valuators to change*/
CARD8 pad1,pad2;
} xDeviceResolutionCtl;
typedef struct {
CARD16 control;
CARD16 length;
INT32 min_x;
INT32 max_x;
INT32 min_y;
INT32 max_y;
CARD32 flip_x;
CARD32 flip_y;
CARD32 rotation;
CARD32 button_threshold;
} xDeviceAbsCalibCtl;
typedef struct {
CARD16 control;
CARD16 length;
CARD32 offset_x;
CARD32 offset_y;
INT32 width;
INT32 height;
INT32 screen;
CARD32 following;
} xDeviceAbsAreaCtl;
typedef struct {
CARD16 control;
CARD16 length;
CARD8 status;
CARD8 pad0;
CARD16 pad1;
} xDeviceCoreCtl;
typedef struct {
CARD16 control;
CARD16 length;
CARD8 enable;
CARD8 pad0;
CARD16 pad1;
} xDeviceEnableCtl;
/* XI 1.5 */
/*********************************************************
*
* ListDeviceProperties.
*
*/
typedef struct {
CARD8 reqType; /* input extension major opcode */
CARD8 ReqType; /* always X_ListDeviceProperties */
CARD16 length;
CARD8 deviceid;
CARD8 pad0;
CARD16 pad1;
} xListDevicePropertiesReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_ListDeviceProperties */
CARD16 sequenceNumber;
CARD32 length;
CARD16 nAtoms;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xListDevicePropertiesReply;
/*********************************************************
*
* ChangeDeviceProperty.
*
*/
typedef struct {
CARD8 reqType; /* input extension major opcode */
CARD8 ReqType; /* always X_ChangeDeviceProperty */
CARD16 length;
Atom property;
Atom type;
CARD8 deviceid;
CARD8 format;
CARD8 mode;
CARD8 pad;
CARD32 nUnits;
} xChangeDevicePropertyReq;
/*********************************************************
*
* DeleteDeviceProperty.
*
*/
typedef struct {
CARD8 reqType; /* input extension major opcode */
CARD8 ReqType; /* always X_DeleteDeviceProperty */
CARD16 length;
Atom property;
CARD8 deviceid;
CARD8 pad0;
CARD16 pad1;
} xDeleteDevicePropertyReq;
/*********************************************************
*
* GetDeviceProperty.
*
*/
typedef struct {
CARD8 reqType; /* input extension major opcode */
CARD8 ReqType; /* always X_GetDeviceProperty */
CARD16 length;
Atom property;
Atom type;
CARD32 longOffset;
CARD32 longLength;
CARD8 deviceid;
#if defined(__cplusplus) || defined(c_plusplus)
BOOL c_delete;
#else
BOOL delete;
#endif
CARD16 pad;
} xGetDevicePropertyReq;
typedef struct {
CARD8 repType; /* X_Reply */
CARD8 RepType; /* always X_GetDeviceProperty */
CARD16 sequenceNumber;
CARD32 length;
Atom propertyType;
CARD32 bytesAfter;
CARD32 nItems;
CARD8 format;
CARD8 deviceid;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
} xGetDevicePropertyReply;
/**********************************************************
*
* Input extension events.
*
* DeviceValuator
*
*/
typedef struct
{
BYTE type;
CARD8 deviceid;
CARD16 sequenceNumber;
KeyButMask device_state;
CARD8 num_valuators;
CARD8 first_valuator;
INT32 valuator0;
INT32 valuator1;
INT32 valuator2;
INT32 valuator3;
INT32 valuator4;
INT32 valuator5;
} deviceValuator;
/**********************************************************
*
* DeviceKeyButtonPointer.
*
* Used for: DeviceKeyPress, DeviceKeyRelease,
* DeviceButtonPress, DeviceButtonRelease,
* ProximityIn, ProximityOut
* DeviceMotionNotify,
*
*/
typedef struct
{
BYTE type;
BYTE detail;
CARD16 sequenceNumber;
Time time;
Window root;
Window event;
Window child;
INT16 root_x;
INT16 root_y;
INT16 event_x;
INT16 event_y;
KeyButMask state;
BOOL same_screen;
CARD8 deviceid;
} deviceKeyButtonPointer;
/**********************************************************
*
* DeviceFocus.
*
*/
typedef struct
{
BYTE type;
BYTE detail;
CARD16 sequenceNumber;
Time time;
Window window;
BYTE mode;
CARD8 deviceid;
BYTE pad1, pad2;
CARD32 pad00;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
} deviceFocus;
/**********************************************************
*
* DeviceStateNotify.
*
* Note that the two high-order bits in the classes_reported
* field are the proximity state (InProximity or OutOfProximity),
* and the device mode (Absolute or Relative), respectively.
*
*/
typedef struct
{
BYTE type;
BYTE deviceid;
CARD16 sequenceNumber;
Time time;
CARD8 num_keys;
CARD8 num_buttons;
CARD8 num_valuators;
CARD8 classes_reported;
CARD8 buttons[4];
CARD8 keys[4];
INT32 valuator0;
INT32 valuator1;
INT32 valuator2;
} deviceStateNotify;
/**********************************************************
*
* DeviceKeyStateNotify.
*
*/
typedef struct
{
BYTE type;
BYTE deviceid;
CARD16 sequenceNumber;
CARD8 keys[28];
} deviceKeyStateNotify;
/**********************************************************
*
* DeviceButtonStateNotify.
*
*/
typedef struct
{
BYTE type;
BYTE deviceid;
CARD16 sequenceNumber;
CARD8 buttons[28];
} deviceButtonStateNotify;
/**********************************************************
*
* DeviceMappingNotify.
* Fields must be kept in sync with core mappingnotify event.
*
*/
typedef struct
{
BYTE type;
BYTE deviceid;
CARD16 sequenceNumber;
CARD8 request;
KeyCode firstKeyCode;
CARD8 count;
BYTE pad1;
Time time;
CARD32 pad00;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
} deviceMappingNotify;
/**********************************************************
*
* ChangeDeviceNotify.
*
*/
typedef struct
{
BYTE type;
BYTE deviceid;
CARD16 sequenceNumber;
Time time;
CARD8 request;
BYTE pad1, pad2, pad3;
CARD32 pad00;
CARD32 pad01;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
} changeDeviceNotify;
/**********************************************************
*
* devicePresenceNotify.
*
*/
typedef struct
{
BYTE type;
BYTE pad00;
CARD16 sequenceNumber;
Time time;
BYTE devchange; /* Device{Added|Removed|Enabled|Disabled|ControlChanged} */
BYTE deviceid;
CARD16 control;
CARD32 pad02;
CARD32 pad03;
CARD32 pad04;
CARD32 pad05;
CARD32 pad06;
} devicePresenceNotify;
/*********************************************************
* DevicePropertyNotifyEvent
*
* Sent whenever a device's property changes.
*
*/
typedef struct
{
BYTE type;
BYTE state; /* NewValue or Deleted */
CARD16 sequenceNumber;
CARD32 time;
Atom atom; /* affected property */
CARD32 pad0;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD16 pad5;
CARD8 pad4;
CARD8 deviceid; /* id of device */
} devicePropertyNotify;
#undef Window
#undef Time
#undef KeyCode
#undef Mask
#undef Atom
#undef Cursor
#endif
/*
* xtestext1.h
*
* X11 Input Synthesis Extension include file
*/
/*
Copyright 1986, 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Hewlett-Packard not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
Hewlett-Packard makes no representations about the
suitability of this software for any purpose. It is provided
"as is" without express or implied warranty.
This software is not subject to any license of the American
Telephone and Telegraph Company or of the Regents of the
University of California.
*/
#ifndef _XTESTEXT1CONST_H
#define _XTESTEXT1CONST_H 1
#define XTestMAX_ACTION_LIST_SIZE 64
#define XTestACTIONS_SIZE 28
/*
* used in the XTestPressButton and XTestPressKey functions
*/
#define XTestPRESS 1 << 0
#define XTestRELEASE 1 << 1
#define XTestSTROKE 1 << 2
/*
* When doing a key or button stroke, the number of milliseconds
* to delay between the press and the release of a key or button
* in the XTestPressButton and XTestPressKey functions.
*/
#define XTestSTROKE_DELAY_TIME 10
/*
* used in the XTestGetInput function
*/
#define XTestEXCLUSIVE 1 << 0
#define XTestPACKED_ACTIONS 1 << 1
#define XTestPACKED_MOTION 1 << 2
/*
* used in the XTestFakeInput function
*/
#define XTestFAKE_ACK_NOT_NEEDED 0
#define XTestFAKE_ACK_REQUEST 1
/*
* used in the XTest extension initialization routine
*/
#define XTestEXTENSION_NAME "XTestExtension1"
#define XTestEVENT_COUNT 2
/*
* This is the definition for the format of the header byte
* in the input action structures.
*/
#define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */
#define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */
#define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */
#define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */
#define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */
#define XTestMAX_DEVICE_ID 0x0f
#define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4)
#define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4)
/*
* These are the possible action types.
*/
#define XTestDELAY_ACTION 0
#define XTestKEY_ACTION 1
#define XTestMOTION_ACTION 2
#define XTestJUMP_ACTION 3
/*
* These are the definitions for key/button motion input actions.
*/
#define XTestKEY_UP 0x04
#define XTestKEY_DOWN 0x00
/*
* These are the definitions for pointer relative motion input
* actions.
*
* The sign bits for the x and y relative motions are contained
* in the header byte. The x and y relative motions are packed
* into one byte to make things fit in 32 bits. If the relative
* motion range is larger than +/-15, use the pointer jump action.
*/
#define XTestMOTION_MAX 15
#define XTestMOTION_MIN -15
#define XTestX_NEGATIVE 0x04
#define XTestY_NEGATIVE 0x08
#define XTestX_MOTION_MASK 0x0f
#define XTestY_MOTION_MASK 0xf0
#define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
#define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK)
#define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
#define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
/*
* These are the definitions for a long delay input action. It is
* used when more than XTestSHORT_DELAY_TIME milliseconds of delay
* (approximately one minute) is needed.
*
* The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
* This guarantees that a header byte with a value of 0 is not
* a valid header, so it can be used as a flag to indicate that
* there are no more input actions in an XTestInputAction event.
*/
#define XTestSHORT_DELAY_TIME 0xffff
#define XTestDELAY_DEVICE_ID 0x0f
#endif /* _XTESTEXT1CONST_H */
/*
* Copyright 1992 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, 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.
*
*/
#ifndef _XLBX_H_
#define _XLBX_H_
#include <X11/Xfuncproto.h>
#include <X11/Xdefs.h>
#include <X11/Xlib.h>
#include <X11/extensions/lbx.h>
_XFUNCPROTOBEGIN
Bool XLbxQueryExtension(
Display* /* dpy */,
int* /* requestp */,
int* /* event_basep */,
int* /* error_basep */
);
Bool XLbxQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
int XLbxGetEventBase(Display *dpy);
_XFUNCPROTOEND
#endif
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _EVI_H_
#define _EVI_H_
#define XEVI_TRANSPARENCY_NONE 0
#define XEVI_TRANSPARENCY_PIXEL 1
#define XEVI_TRANSPARENCY_MASK 2
#define EVINAME "Extended-Visual-Information"
#define XEVI_MAJOR_VERSION 1 /* current version numbers */
#define XEVI_MINOR_VERSION 0
#endif
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
#ifndef _MITMISCCONST_H_
#define _MITMISCCONST_H_
#define MITMiscNumberEvents 0
#define MITMiscNumberErrors 0
#define MITMISCNAME "MIT-SUNDRY-NONSTANDARD"
#endif
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifndef _DPMSCONST_H
#define _DPMSCONST_H 1
#define DPMSMajorVersion 1
#define DPMSMinorVersion 2
#define DPMSExtensionName "DPMS"
#define DPMSModeOn 0
#define DPMSModeStandby 1
#define DPMSModeSuspend 2
#define DPMSModeOff 3
#define DPMSInfoNotifyMask (1L << 0)
#define DPMSInfoNotify 0
#endif /* !_DPMSCONST_H */
/*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
* Author: Jim Fulton, MIT The Open Group
*
* Xlib Extension-Writing Utilities
*
* This package contains utilities for writing the client API for various
* protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
* ARE SUBJECT TO CHANGE!
*/
#ifndef _EXTUTIL_H_
#define _EXTUTIL_H_
#include <X11/extensions/Xext.h>
/*
* We need to keep a list of open displays since the Xlib display list isn't
* public. We also have to per-display info in a separate block since it isn't
* stored directly in the Display structure.
*/
typedef struct _XExtDisplayInfo {
struct _XExtDisplayInfo *next; /* keep a linked list */
Display *display; /* which display this is */
XExtCodes *codes; /* the extension protocol codes */
XPointer data; /* extra data for extension to use */
} XExtDisplayInfo;
typedef struct _XExtensionInfo {
XExtDisplayInfo *head; /* start of list */
XExtDisplayInfo *cur; /* most recently used */
int ndisplays; /* number of displays */
} XExtensionInfo;
typedef struct _XExtensionHooks {
int (*create_gc)(
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
int (*copy_gc)(
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
int (*flush_gc)(
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
int (*free_gc)(
Display* /* display */,
GC /* gc */,
XExtCodes* /* codes */
);
int (*create_font)(
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
);
int (*free_font)(
Display* /* display */,
XFontStruct* /* fs */,
XExtCodes* /* codes */
);
int (*close_display)(
Display* /* display */,
XExtCodes* /* codes */
);
Bool (*wire_to_event)(
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
);
Status (*event_to_wire)(
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
);
int (*error)(
Display* /* display */,
xError* /* err */,
XExtCodes* /* codes */,
int* /* ret_code */
);
char *(*error_string)(
Display* /* display */,
int /* code */,
XExtCodes* /* codes */,
char* /* buffer */,
int /* nbytes */
);
} XExtensionHooks;
extern XExtensionInfo *XextCreateExtension(
void
);
extern void XextDestroyExtension(
XExtensionInfo* /* info */
);
extern XExtDisplayInfo *XextAddDisplay(
XExtensionInfo* /* extinfo */,
Display* /* dpy */,
_Xconst char* /* ext_name */,
XExtensionHooks* /* hooks */,
int /* nevents */,
XPointer /* data */
);
extern int XextRemoveDisplay(
XExtensionInfo* /* extinfo */,
Display* /* dpy */
);
extern XExtDisplayInfo *XextFindDisplay(
XExtensionInfo* /* extinfo */,
Display* /* dpy */
);
#define XextHasExtension(i) ((i) && ((i)->codes))
#define XextCheckExtension(dpy,i,name,val) \
if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
#define XextSimpleCheckExtension(dpy,i,name) \
if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
/*
* helper macros to generate code that is common to all extensions; caller
* should prefix it with static if extension source is in one file; this
* could be a utility function, but have to stack 6 unused arguments for
* something that is called many, many times would be bad.
*/
#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
XExtDisplayInfo *proc (Display *dpy) \
{ \
XExtDisplayInfo *dpyinfo; \
if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
return dpyinfo; \
}
#define XEXT_FIND_DISPLAY_PROTO(proc) \
XExtDisplayInfo *proc(Display *dpy)
#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
int proc (Display *dpy, XExtCodes *codes) \
{ \
return XextRemoveDisplay (extinfo, dpy); \
}
#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
int proc(Display *dpy, XExtCodes *codes)
#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
{ \
code -= codes->first_error; \
if (code >= 0 && code < nerr) { \
char tmp[256]; \
snprintf (tmp, sizeof(tmp), "%s.%d", extname, code); \
XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
return buf; \
} \
return (char *)0; \
}
#define XEXT_ERROR_STRING_PROTO(proc) \
char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
#endif
/*
* xtestext1.h
*
* X11 Input Synthesis Extension include file
*/
/*
Copyright 1986, 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Hewlett-Packard not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
Hewlett-Packard makes no representations about the
suitability of this software for any purpose. It is provided
"as is" without express or implied warranty.
This software is not subject to any license of the American
Telephone and Telegraph Company or of the Regents of the
University of California.
*/
#ifndef _XTESTEXT1_H
#define _XTESTEXT1_H
/*
* the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
*/
#include <X11/extensions/xtestext1const.h>
/*
* This is the definition for the input action host format event structure.
* This is the form that a client using this extension will see when
* it receives an input action event.
*/
typedef struct {
int type; /* always XTestInputActionType */
Display *display;
Window window;
CARD8 actions[XTestACTIONS_SIZE];
} XTestInputActionEvent;
/*
* This is the definition for the xTestFakeAck host format event structure.
* This is the form that a client using this extension will see when
* it receives an XTestFakeAck event.
*/
typedef struct {
int type; /* always XTestFakeAckType */
Display *display;
Window window;
} XTestFakeAckEvent;
_XFUNCPROTOBEGIN
int XTestFakeInput(register Display *dpy, char *action_list_addr, int action_list_size, int ack_flag);
int XTestGetInput(register Display *dpy, int action_handling);
int XTestQueryInputSize(register Display *dpy, unsigned long *size_return);
int XTestPressKey(Display *display, int device_id, unsigned long delay, unsigned int keycode, unsigned int key_action);
int XTestPressButton(Display * display, int device_id, unsigned long delay, unsigned int button_number, unsigned int button_action);
int XTestMovePointer(Display *display, int device_id, unsigned long delay[], int x[], int y[], unsigned int count);
int XTestFlush(Display *display);
int XTestStopInput(register Display *dpy);
int XTestReset(register Display *dpy);
_XFUNCPROTOEND
#endif /* _XTESTEXT1_H */
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XCUP_H_
#define _XCUP_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/cup.h>
_XFUNCPROTOBEGIN
Bool XcupQueryVersion(
Display* /* dpy */,
int* /* major_version */,
int* /* minor_version */
);
Status XcupGetReservedColormapEntries(
Display* /* dpy */,
int /* screen */,
XColor** /* colors_out */,
int* /* ncolors */
);
Status XcupStoreColors(
Display* /* dpy */,
Colormap /* colormap */,
XColor* /* colors */,
int /* ncolors */
);
_XFUNCPROTOEND
#endif /* _XCUP_H_ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Hewlett-Packard not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
/* Definitions used by the server, library and client */
#ifndef _XI_H_
#define _XI_H_
#define sz_xGetExtensionVersionReq 8
#define sz_xGetExtensionVersionReply 32
#define sz_xListInputDevicesReq 4
#define sz_xListInputDevicesReply 32
#define sz_xOpenDeviceReq 8
#define sz_xOpenDeviceReply 32
#define sz_xCloseDeviceReq 8
#define sz_xSetDeviceModeReq 8
#define sz_xSetDeviceModeReply 32
#define sz_xSelectExtensionEventReq 12
#define sz_xGetSelectedExtensionEventsReq 8
#define sz_xGetSelectedExtensionEventsReply 32
#define sz_xChangeDeviceDontPropagateListReq 12
#define sz_xGetDeviceDontPropagateListReq 8
#define sz_xGetDeviceDontPropagateListReply 32
#define sz_xGetDeviceMotionEventsReq 16
#define sz_xGetDeviceMotionEventsReply 32
#define sz_xChangeKeyboardDeviceReq 8
#define sz_xChangeKeyboardDeviceReply 32
#define sz_xChangePointerDeviceReq 8
#define sz_xChangePointerDeviceReply 32
#define sz_xGrabDeviceReq 20
#define sz_xGrabDeviceReply 32
#define sz_xUngrabDeviceReq 12
#define sz_xGrabDeviceKeyReq 20
#define sz_xGrabDeviceKeyReply 32
#define sz_xUngrabDeviceKeyReq 16
#define sz_xGrabDeviceButtonReq 20
#define sz_xGrabDeviceButtonReply 32
#define sz_xUngrabDeviceButtonReq 16
#define sz_xAllowDeviceEventsReq 12
#define sz_xGetDeviceFocusReq 8
#define sz_xGetDeviceFocusReply 32
#define sz_xSetDeviceFocusReq 16
#define sz_xGetFeedbackControlReq 8
#define sz_xGetFeedbackControlReply 32
#define sz_xChangeFeedbackControlReq 12
#define sz_xGetDeviceKeyMappingReq 8
#define sz_xGetDeviceKeyMappingReply 32
#define sz_xChangeDeviceKeyMappingReq 8
#define sz_xGetDeviceModifierMappingReq 8
#define sz_xSetDeviceModifierMappingReq 8
#define sz_xSetDeviceModifierMappingReply 32
#define sz_xGetDeviceButtonMappingReq 8
#define sz_xGetDeviceButtonMappingReply 32
#define sz_xSetDeviceButtonMappingReq 8
#define sz_xSetDeviceButtonMappingReply 32
#define sz_xQueryDeviceStateReq 8
#define sz_xQueryDeviceStateReply 32
#define sz_xSendExtensionEventReq 16
#define sz_xDeviceBellReq 8
#define sz_xSetDeviceValuatorsReq 8
#define sz_xSetDeviceValuatorsReply 32
#define sz_xGetDeviceControlReq 8
#define sz_xGetDeviceControlReply 32
#define sz_xChangeDeviceControlReq 8
#define sz_xChangeDeviceControlReply 32
#define sz_xListDevicePropertiesReq 8
#define sz_xListDevicePropertiesReply 32
#define sz_xChangeDevicePropertyReq 20
#define sz_xDeleteDevicePropertyReq 12
#define sz_xGetDevicePropertyReq 24
#define sz_xGetDevicePropertyReply 32
#define INAME "XInputExtension"
#define XI_KEYBOARD "KEYBOARD"
#define XI_MOUSE "MOUSE"
#define XI_TABLET "TABLET"
#define XI_TOUCHSCREEN "TOUCHSCREEN"
#define XI_TOUCHPAD "TOUCHPAD"
#define XI_BARCODE "BARCODE"
#define XI_BUTTONBOX "BUTTONBOX"
#define XI_KNOB_BOX "KNOB_BOX"
#define XI_ONE_KNOB "ONE_KNOB"
#define XI_NINE_KNOB "NINE_KNOB"
#define XI_TRACKBALL "TRACKBALL"
#define XI_QUADRATURE "QUADRATURE"
#define XI_ID_MODULE "ID_MODULE"
#define XI_SPACEBALL "SPACEBALL"
#define XI_DATAGLOVE "DATAGLOVE"
#define XI_EYETRACKER "EYETRACKER"
#define XI_CURSORKEYS "CURSORKEYS"
#define XI_FOOTMOUSE "FOOTMOUSE"
#define XI_JOYSTICK "JOYSTICK"
/* Indices into the versions[] array (XExtInt.c). Used as a index to
* retrieve the minimum version of XI from _XiCheckExtInit */
#define Dont_Check 0
#define XInput_Initial_Release 1
#define XInput_Add_XDeviceBell 2
#define XInput_Add_XSetDeviceValuators 3
#define XInput_Add_XChangeDeviceControl 4
#define XInput_Add_DevicePresenceNotify 5
#define XInput_Add_DeviceProperties 6
/* DO NOT ADD TO HERE -> XI2 */
#define XI_Absent 0
#define XI_Present 1
#define XI_Initial_Release_Major 1
#define XI_Initial_Release_Minor 0
#define XI_Add_XDeviceBell_Major 1
#define XI_Add_XDeviceBell_Minor 1
#define XI_Add_XSetDeviceValuators_Major 1
#define XI_Add_XSetDeviceValuators_Minor 2
#define XI_Add_XChangeDeviceControl_Major 1
#define XI_Add_XChangeDeviceControl_Minor 3
#define XI_Add_DevicePresenceNotify_Major 1
#define XI_Add_DevicePresenceNotify_Minor 4
#define XI_Add_DeviceProperties_Major 1
#define XI_Add_DeviceProperties_Minor 5
#define DEVICE_RESOLUTION 1
#define DEVICE_ABS_CALIB 2
#define DEVICE_CORE 3
#define DEVICE_ENABLE 4
#define DEVICE_ABS_AREA 5
#define NoSuchExtension 1
#define COUNT 0
#define CREATE 1
#define NewPointer 0
#define NewKeyboard 1
#define XPOINTER 0
#define XKEYBOARD 1
#define UseXKeyboard 0xFF
#define IsXPointer 0
#define IsXKeyboard 1
#define IsXExtensionDevice 2
#define IsXExtensionKeyboard 3
#define IsXExtensionPointer 4
#define AsyncThisDevice 0
#define SyncThisDevice 1
#define ReplayThisDevice 2
#define AsyncOtherDevices 3
#define AsyncAll 4
#define SyncAll 5
#define FollowKeyboard 3
#ifndef RevertToFollowKeyboard
#define RevertToFollowKeyboard 3
#endif
#define DvAccelNum (1L << 0)
#define DvAccelDenom (1L << 1)
#define DvThreshold (1L << 2)
#define DvKeyClickPercent (1L<<0)
#define DvPercent (1L<<1)
#define DvPitch (1L<<2)
#define DvDuration (1L<<3)
#define DvLed (1L<<4)
#define DvLedMode (1L<<5)
#define DvKey (1L<<6)
#define DvAutoRepeatMode (1L<<7)
#define DvString (1L << 0)
#define DvInteger (1L << 0)
#define DeviceMode (1L << 0)
#define Relative 0
#define Absolute 1
#define ProximityState (1L << 1)
#define InProximity (0L << 1)
#define OutOfProximity (1L << 1)
#define AddToList 0
#define DeleteFromList 1
#define KeyClass 0
#define ButtonClass 1
#define ValuatorClass 2
#define FeedbackClass 3
#define ProximityClass 4
#define FocusClass 5
#define OtherClass 6
#define AttachClass 7
#define KbdFeedbackClass 0
#define PtrFeedbackClass 1
#define StringFeedbackClass 2
#define IntegerFeedbackClass 3
#define LedFeedbackClass 4
#define BellFeedbackClass 5
#define _devicePointerMotionHint 0
#define _deviceButton1Motion 1
#define _deviceButton2Motion 2
#define _deviceButton3Motion 3
#define _deviceButton4Motion 4
#define _deviceButton5Motion 5
#define _deviceButtonMotion 6
#define _deviceButtonGrab 7
#define _deviceOwnerGrabButton 8
#define _noExtensionEvent 9
#define _devicePresence 0
#define _deviceEnter 0
#define _deviceLeave 1
/* Device presence notify states */
#define DeviceAdded 0
#define DeviceRemoved 1
#define DeviceEnabled 2
#define DeviceDisabled 3
#define DeviceUnrecoverable 4
#define DeviceControlChanged 5
/* XI Errors */
#define XI_BadDevice 0
#define XI_BadEvent 1
#define XI_BadMode 2
#define XI_DeviceBusy 3
#define XI_BadClass 4
/*
* Make XEventClass be a CARD32 for 64 bit servers. Don't affect client
* definition of XEventClass since that would be a library interface change.
* See the top of X.h for more _XSERVER64 magic.
*
* But, don't actually use the CARD32 type. We can't get it defined here
* without polluting the namespace.
*/
#ifdef _XSERVER64
typedef unsigned int XEventClass;
#else
typedef unsigned long XEventClass;
#endif
/*******************************************************************
*
* Extension version structure.
*
*/
typedef struct {
int present;
short major_version;
short minor_version;
} XExtensionVersion;
#endif /* _XI_H_ */
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995 XFree86 Inc
*/
/************************************************************************
THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE
************************************************************************/
#ifndef _XF86DGA1CONST_H_
#define _XF86DGA1CONST_H_
#define X_XF86DGAQueryVersion 0
#define X_XF86DGAGetVideoLL 1
#define X_XF86DGADirectVideo 2
#define X_XF86DGAGetViewPortSize 3
#define X_XF86DGASetViewPort 4
#define X_XF86DGAGetVidPage 5
#define X_XF86DGASetVidPage 6
#define X_XF86DGAInstallColormap 7
#define X_XF86DGAQueryDirectVideo 8
#define X_XF86DGAViewPortChanged 9
#define XF86DGADirectPresent 0x0001
#define XF86DGADirectGraphics 0x0002
#define XF86DGADirectMouse 0x0004
#define XF86DGADirectKeyb 0x0008
#define XF86DGAHasColormap 0x0100
#define XF86DGADirectColormap 0x0200
#endif /* _XF86DGA1CONST_H_ */
/*
* Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation on the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
* Authors:
* Rickard E. (Rik) Faith <faith@redhat.com>
*
*/
/** \file
* This file describes the interface to the client-side libdmx.a
* library. All DMX-aware client-side applications should include this
* file. */
#ifndef _DMX_H_
#define _DMX_H_
/* These values must be larger than LastExtensionError.
The values in dmxext.h and dmxproto.h *MUST* match. */
#define DmxBadXinerama 1001
#define DmxBadValue 1002
#define DmxBadReply 1003
#define DMXScreenWindowWidth (1L<<0)
#define DMXScreenWindowHeight (1L<<1)
#define DMXScreenWindowXoffset (1L<<2)
#define DMXScreenWindowYoffset (1L<<3)
#define DMXRootWindowWidth (1L<<4)
#define DMXRootWindowHeight (1L<<5)
#define DMXRootWindowXoffset (1L<<6)
#define DMXRootWindowYoffset (1L<<7)
#define DMXRootWindowXorigin (1L<<8)
#define DMXRootWindowYorigin (1L<<9)
#define DMXDesktopWidth (1L<<0)
#define DMXDesktopHeight (1L<<1)
#define DMXDesktopShiftX (1L<<2)
#define DMXDesktopShiftY (1L<<3)
#define DMXInputType (1L<<0)
#define DMXInputPhysicalScreen (1L<<1)
#define DMXInputSendsCore (1L<<2)
#endif
/*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, 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.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _XRENDERP_H_
#define _XRENDERP_H_
#include <X11/Xmd.h>
#include <X11/extensions/render.h>
#define Window CARD32
#define Drawable CARD32
#define Font CARD32
#define Pixmap CARD32
#define Cursor CARD32
#define Colormap CARD32
#define GContext CARD32
#define Atom CARD32
#define VisualID CARD32
#define Time CARD32
#define KeyCode CARD8
#define KeySym CARD32
#define Picture CARD32
#define PictFormat CARD32
#define Fixed INT32
#define Glyphset CARD32
/*
* data structures
*/
typedef struct {
CARD16 red;
CARD16 redMask;
CARD16 green;
CARD16 greenMask;
CARD16 blue;
CARD16 blueMask;
CARD16 alpha;
CARD16 alphaMask;
} xDirectFormat;
#define sz_xDirectFormat 16
typedef struct {
PictFormat id;
CARD8 type;
CARD8 depth;
CARD16 pad1;
xDirectFormat direct;
Colormap colormap;
} xPictFormInfo;
#define sz_xPictFormInfo 28
typedef struct {
VisualID visual;
PictFormat format;
} xPictVisual;
#define sz_xPictVisual 8
typedef struct {
CARD8 depth;
CARD8 pad1;
CARD16 nPictVisuals;
CARD32 pad2;
} xPictDepth;
#define sz_xPictDepth 8
typedef struct {
CARD32 nDepth;
PictFormat fallback;
} xPictScreen;
#define sz_xPictScreen 8
typedef struct {
CARD32 pixel;
CARD16 red;
CARD16 green;
CARD16 blue;
CARD16 alpha;
} xIndexValue;
#define sz_xIndexValue 12
typedef struct {
CARD16 red;
CARD16 green;
CARD16 blue;
CARD16 alpha;
} xRenderColor;
#define sz_xRenderColor 8
typedef struct {
Fixed x;
Fixed y;
} xPointFixed;
#define sz_xPointFixed 8
typedef struct {
xPointFixed p1;
xPointFixed p2;
} xLineFixed;
#define sz_xLineFixed 16
typedef struct {
xPointFixed p1, p2, p3;
} xTriangle;
#define sz_xTriangle 24
typedef struct {
Fixed top;
Fixed bottom;
xLineFixed left;
xLineFixed right;
} xTrapezoid;
#define sz_xTrapezoid 40
typedef struct {
CARD16 width;
CARD16 height;
INT16 x;
INT16 y;
INT16 xOff;
INT16 yOff;
} xGlyphInfo;
#define sz_xGlyphInfo 12
typedef struct {
CARD8 len;
CARD8 pad1;
CARD16 pad2;
INT16 deltax;
INT16 deltay;
} xGlyphElt;
#define sz_xGlyphElt 8
typedef struct {
Fixed l, r, y;
} xSpanFix;
#define sz_xSpanFix 12
typedef struct {
xSpanFix top, bot;
} xTrap;
#define sz_xTrap 24
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD32 majorVersion;
CARD32 minorVersion;
} xRenderQueryVersionReq;
#define sz_xRenderQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 majorVersion;
CARD32 minorVersion;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRenderQueryVersionReply;
#define sz_xRenderQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
} xRenderQueryPictFormatsReq;
#define sz_xRenderQueryPictFormatsReq 4
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numFormats;
CARD32 numScreens;
CARD32 numDepths;
CARD32 numVisuals;
CARD32 numSubpixel; /* Version 0.6 */
CARD32 pad5;
} xRenderQueryPictFormatsReply;
#define sz_xRenderQueryPictFormatsReply 32
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
PictFormat format;
} xRenderQueryPictIndexValuesReq;
#define sz_xRenderQueryPictIndexValuesReq 8
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numIndexValues;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xRenderQueryPictIndexValuesReply;
#define sz_xRenderQueryPictIndexValuesReply 32
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture pid;
Drawable drawable;
PictFormat format;
CARD32 mask;
} xRenderCreatePictureReq;
#define sz_xRenderCreatePictureReq 20
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture picture;
CARD32 mask;
} xRenderChangePictureReq;
#define sz_xRenderChangePictureReq 12
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture picture;
INT16 xOrigin;
INT16 yOrigin;
} xRenderSetPictureClipRectanglesReq;
#define sz_xRenderSetPictureClipRectanglesReq 12
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture picture;
} xRenderFreePictureReq;
#define sz_xRenderFreePictureReq 8
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture src;
Picture mask;
Picture dst;
INT16 xSrc;
INT16 ySrc;
INT16 xMask;
INT16 yMask;
INT16 xDst;
INT16 yDst;
CARD16 width;
CARD16 height;
} xRenderCompositeReq;
#define sz_xRenderCompositeReq 36
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture src;
Picture dst;
CARD32 colorScale;
CARD32 alphaScale;
INT16 xSrc;
INT16 ySrc;
INT16 xDst;
INT16 yDst;
CARD16 width;
CARD16 height;
} xRenderScaleReq;
#define sz_xRenderScaleReq 32
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture src;
Picture dst;
PictFormat maskFormat;
INT16 xSrc;
INT16 ySrc;
} xRenderTrapezoidsReq;
#define sz_xRenderTrapezoidsReq 24
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture src;
Picture dst;
PictFormat maskFormat;
INT16 xSrc;
INT16 ySrc;
} xRenderTrianglesReq;
#define sz_xRenderTrianglesReq 24
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture src;
Picture dst;
PictFormat maskFormat;
INT16 xSrc;
INT16 ySrc;
} xRenderTriStripReq;
#define sz_xRenderTriStripReq 24
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture src;
Picture dst;
PictFormat maskFormat;
INT16 xSrc;
INT16 ySrc;
} xRenderTriFanReq;
#define sz_xRenderTriFanReq 24
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Glyphset gsid;
PictFormat format;
} xRenderCreateGlyphSetReq;
#define sz_xRenderCreateGlyphSetReq 12
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Glyphset gsid;
Glyphset existing;
} xRenderReferenceGlyphSetReq;
#define sz_xRenderReferenceGlyphSetReq 24
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Glyphset glyphset;
} xRenderFreeGlyphSetReq;
#define sz_xRenderFreeGlyphSetReq 8
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Glyphset glyphset;
CARD32 nglyphs;
} xRenderAddGlyphsReq;
#define sz_xRenderAddGlyphsReq 12
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Glyphset glyphset;
} xRenderFreeGlyphsReq;
#define sz_xRenderFreeGlyphsReq 8
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture src;
Picture dst;
PictFormat maskFormat;
Glyphset glyphset;
INT16 xSrc;
INT16 ySrc;
} xRenderCompositeGlyphsReq, xRenderCompositeGlyphs8Req,
xRenderCompositeGlyphs16Req, xRenderCompositeGlyphs32Req;
#define sz_xRenderCompositeGlyphs8Req 28
#define sz_xRenderCompositeGlyphs16Req 28
#define sz_xRenderCompositeGlyphs32Req 28
/* 0.1 and higher */
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
CARD8 op;
CARD8 pad1;
CARD16 pad2;
Picture dst;
xRenderColor color;
} xRenderFillRectanglesReq;
#define sz_xRenderFillRectanglesReq 20
/* 0.5 and higher */
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Cursor cid;
Picture src;
CARD16 x;
CARD16 y;
} xRenderCreateCursorReq;
#define sz_xRenderCreateCursorReq 16
/* 0.6 and higher */
/*
* This can't use an array because 32-bit values may be in bitfields
*/
typedef struct {
Fixed matrix11;
Fixed matrix12;
Fixed matrix13;
Fixed matrix21;
Fixed matrix22;
Fixed matrix23;
Fixed matrix31;
Fixed matrix32;
Fixed matrix33;
} xRenderTransform;
#define sz_xRenderTransform 36
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture picture;
xRenderTransform transform;
} xRenderSetPictureTransformReq;
#define sz_xRenderSetPictureTransformReq 44
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Drawable drawable;
} xRenderQueryFiltersReq;
#define sz_xRenderQueryFiltersReq 8
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numAliases; /* LISTofCARD16 */
CARD32 numFilters; /* LISTofSTRING8 */
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xRenderQueryFiltersReply;
#define sz_xRenderQueryFiltersReply 32
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture picture;
CARD16 nbytes; /* number of bytes in name */
CARD16 pad;
} xRenderSetPictureFilterReq;
#define sz_xRenderSetPictureFilterReq 12
/* 0.8 and higher */
typedef struct {
Cursor cursor;
CARD32 delay;
} xAnimCursorElt;
#define sz_xAnimCursorElt 8
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Cursor cid;
} xRenderCreateAnimCursorReq;
#define sz_xRenderCreateAnimCursorReq 8
/* 0.9 and higher */
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture picture;
INT16 xOff;
INT16 yOff;
} xRenderAddTrapsReq;
#define sz_xRenderAddTrapsReq 12
/* 0.10 and higher */
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture pid;
xRenderColor color;
} xRenderCreateSolidFillReq;
#define sz_xRenderCreateSolidFillReq 16
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture pid;
xPointFixed p1;
xPointFixed p2;
CARD32 nStops;
} xRenderCreateLinearGradientReq;
#define sz_xRenderCreateLinearGradientReq 28
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture pid;
xPointFixed inner;
xPointFixed outer;
Fixed inner_radius;
Fixed outer_radius;
CARD32 nStops;
} xRenderCreateRadialGradientReq;
#define sz_xRenderCreateRadialGradientReq 36
typedef struct {
CARD8 reqType;
CARD8 renderReqType;
CARD16 length;
Picture pid;
xPointFixed center;
Fixed angle; /* in degrees */
CARD32 nStops;
} xRenderCreateConicalGradientReq;
#define sz_xRenderCreateConicalGradientReq 24
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef Atom
#undef VisualID
#undef Time
#undef KeyCode
#undef KeySym
#undef Picture
#undef PictFormat
#undef Fixed
#undef Glyphset
#endif /* _XRENDERP_H_ */
/*
* Copyright © 2007-2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors: Peter Hutterer, University of South Australia, NICTA
*
*/
#ifndef _GE_H_
#define _GE_H_
#define GE_NAME "Generic Event Extension"
#define GE_MAJOR 1
#define GE_MINOR 0
/*********************************************************
*
* Requests
*
*/
#define X_GEQueryVersion 0
#define GENumberRequests (X_GEQueryVersion + 1)
/*********************************************************
*
* Events
*
*/
#define GENumberEvents 0
/*********************************************************
*
* Errors
*
*/
#define GENumberErrors 0
#endif /* _GE_H_ */
/*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _MULTIBUF_H_
#define _MULTIBUF_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/multibufconst.h>
#define MbufGetReq(name,req,info) GetReq (name, req); \
req->reqType = info->codes->major_opcode; \
req->mbufReqType = X_##name;
/*
* Extra definitions that will only be needed in the client
*/
typedef XID Multibuffer;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Multibuffer buffer; /* buffer of event */
int state; /* see Clobbered constants above */
} XmbufClobberNotifyEvent;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Multibuffer buffer; /* buffer of event */
} XmbufUpdateNotifyEvent;
/*
* per-window attributes that can be got
*/
typedef struct {
int displayed_index; /* which buffer is being displayed */
int update_action; /* Undefined, Background, Untouched, Copied */
int update_hint; /* Frequent, Intermittent, Static */
int window_mode; /* Mono, Stereo */
int nbuffers; /* Number of buffers */
Multibuffer *buffers; /* Buffers */
} XmbufWindowAttributes;
/*
* per-window attributes that can be set
*/
typedef struct {
int update_hint; /* Frequent, Intermittent, Static */
} XmbufSetWindowAttributes;
/*
* per-buffer attributes that can be got
*/
typedef struct {
Window window; /* which window this belongs to */
unsigned long event_mask; /* events that have been selected */
int buffer_index; /* which buffer is this */
int side; /* Mono, Left, Right */
} XmbufBufferAttributes;
/*
* per-buffer attributes that can be set
*/
typedef struct {
unsigned long event_mask; /* events that have been selected */
} XmbufSetBufferAttributes;
/*
* per-screen buffer info (there will be lists of them)
*/
typedef struct {
VisualID visualid; /* visual usuable at this depth */
int max_buffers; /* most buffers for this visual */
int depth; /* depth of buffers to be created */
} XmbufBufferInfo;
_XFUNCPROTOBEGIN
extern Bool XmbufQueryExtension(
Display* /* dpy */,
int* /* event_base_return */,
int* /* error_base_return */
);
extern Status XmbufGetVersion(
Display* /* dpy */,
int* /* major_version_return */,
int* /* minor_version_return */
);
extern int XmbufCreateBuffers(
Display* /* dpy */,
Window /* w */,
int /* count */,
int /* update_action */,
int /* update_hint */,
Multibuffer* /* buffers */
);
extern void XmbufDestroyBuffers(
Display* /* dpy */,
Window /* window */
);
extern void XmbufDisplayBuffers(
Display* /* dpy */,
int /* count */,
Multibuffer* /* buffers */,
int /* min_delay */,
int /* max_delay */
);
extern Status XmbufGetWindowAttributes(
Display* /* dpy */,
Window /* w */,
XmbufWindowAttributes* /* attr */
);
extern void XmbufChangeWindowAttributes(
Display* /* dpy */,
Window /* w */,
unsigned long /* valuemask */,
XmbufSetWindowAttributes* /* attr */
);
extern Status XmbufGetBufferAttributes(
Display* /* dpy */,
Multibuffer /* b */,
XmbufBufferAttributes* /* attr */
);
extern void XmbufChangeBufferAttributes(
Display* /* dpy */,
Multibuffer /* b */,
unsigned long /* valuemask */,
XmbufSetBufferAttributes* /* attr */
);
extern Status XmbufGetScreenInfo(
Display* /* dpy */,
Drawable /* d */,
int* /* nmono_return */,
XmbufBufferInfo** /* mono_info_return */,
int* /* nstereo_return */,
XmbufBufferInfo** /* stereo_info_return */
);
extern Window XmbufCreateStereoWindow(
Display* /* dpy */,
Window /* parent */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* border_width */,
int /* depth */,
unsigned int /* class */,
Visual* /* visual */,
unsigned long /* valuemask */,
XSetWindowAttributes* /* attr */,
Multibuffer* /* leftp */,
Multibuffer* /* rightp */
);
extern void XmbufClearBufferArea(
Display* /* dpy */,
Multibuffer /* buffer */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
Bool /* exposures */
);
_XFUNCPROTOEND
#endif /* _MULTIBUF_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifndef _AG_H_
#define _AG_H_
#define XAGNAME "XC-APPGROUP"
#define XAG_MAJOR_VERSION 1 /* current version numbers */
#define XAG_MINOR_VERSION 0
#define XagWindowTypeX11 0
#define XagWindowTypeMacintosh 1
#define XagWindowTypeWin32 2
#define XagWindowTypeWin16 3
#define XagBadAppGroup 0
#define XagNumberErrors (XagBadAppGroup + 1)
#define XagNsingleScreen 7
#define XagNdefaultRoot 1
#define XagNrootVisual 2
#define XagNdefaultColormap 3
#define XagNblackPixel 4
#define XagNwhitePixel 5
#define XagNappGroupLeader 6
#endif /* _AG_H_ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
#ifndef _PANORAMIXPROTO_H_
#define _PANORAMIXPROTO_H_
#define PANORAMIX_MAJOR_VERSION 1 /* current version number */
#define PANORAMIX_MINOR_VERSION 1
#define PANORAMIX_PROTOCOL_NAME "XINERAMA"
#define X_PanoramiXQueryVersion 0
#define X_PanoramiXGetState 1
#define X_PanoramiXGetScreenCount 2
#define X_PanoramiXGetScreenSize 3
#define X_XineramaIsActive 4
#define X_XineramaQueryScreens 5
typedef struct _PanoramiXQueryVersion {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */
CARD16 length;
CARD8 clientMajor;
CARD8 clientMinor;
CARD16 unused;
} xPanoramiXQueryVersionReq;
#define sz_xPanoramiXQueryVersionReq 8
typedef struct {
CARD8 type; /* must be X_Reply */
CARD8 pad1; /* unused */
CARD16 sequenceNumber; /* last sequence number */
CARD32 length; /* 0 */
CARD16 majorVersion;
CARD16 minorVersion;
CARD32 pad2; /* unused */
CARD32 pad3; /* unused */
CARD32 pad4; /* unused */
CARD32 pad5; /* unused */
CARD32 pad6; /* unused */
} xPanoramiXQueryVersionReply;
#define sz_xPanoramiXQueryVersionReply 32
typedef struct _PanoramiXGetState {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length;
CARD32 window;
} xPanoramiXGetStateReq;
#define sz_xPanoramiXGetStateReq 8
typedef struct {
BYTE type;
BYTE state;
CARD16 sequenceNumber;
CARD32 length;
CARD32 window;
CARD32 pad1; /* unused */
CARD32 pad2; /* unused */
CARD32 pad3; /* unused */
CARD32 pad4; /* unused */
CARD32 pad5; /* unused */
} xPanoramiXGetStateReply;
#define sz_panoramiXGetStateReply 32
typedef struct _PanoramiXGetScreenCount {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */
CARD16 length;
CARD32 window;
} xPanoramiXGetScreenCountReq;
#define sz_xPanoramiXGetScreenCountReq 8
typedef struct {
BYTE type;
BYTE ScreenCount;
CARD16 sequenceNumber;
CARD32 length;
CARD32 window;
CARD32 pad1; /* unused */
CARD32 pad2; /* unused */
CARD32 pad3; /* unused */
CARD32 pad4; /* unused */
CARD32 pad5; /* unused */
} xPanoramiXGetScreenCountReply;
#define sz_panoramiXGetScreenCountReply 32
typedef struct _PanoramiXGetScreenSize {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length;
CARD32 window;
CARD32 screen;
} xPanoramiXGetScreenSizeReq;
#define sz_xPanoramiXGetScreenSizeReq 12
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 width;
CARD32 height;
CARD32 window;
CARD32 screen;
CARD32 pad2; /* unused */
CARD32 pad3; /* unused */
} xPanoramiXGetScreenSizeReply;
#define sz_panoramiXGetScreenSizeReply 32
/************ Alternate protocol ******************/
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length;
} xXineramaIsActiveReq;
#define sz_xXineramaIsActiveReq 4
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 state;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXineramaIsActiveReply;
#define sz_XineramaIsActiveReply 32
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length;
} xXineramaQueryScreensReq;
#define sz_xXineramaQueryScreensReq 4
typedef struct {
BYTE type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 number;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXineramaQueryScreensReply;
#define sz_XineramaQueryScreensReply 32
typedef struct {
INT16 x_org;
INT16 y_org;
CARD16 width;
CARD16 height;
} xXineramaScreenInfo;
#define sz_XineramaScreenInfo 8
#endif
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _CUP_H_
#define _CUP_H_
#define XCUPNAME "TOG-CUP"
#define XCUP_MAJOR_VERSION 1 /* current version numbers */
#define XCUP_MINOR_VERSION 0
#define XcupNumberErrors 0
#endif /* _CUP_H_ */
/*
Copyright 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XCMISCPROTO_H_
#define _XCMISCPROTO_H_
#define X_XCMiscGetVersion 0
#define X_XCMiscGetXIDRange 1
#define X_XCMiscGetXIDList 2
#define XCMiscNumberEvents 0
#define XCMiscNumberErrors 0
#define XCMiscMajorVersion 1
#define XCMiscMinorVersion 1
#define XCMiscExtensionName "XC-MISC"
typedef struct {
CARD8 reqType; /* always XCMiscCode */
CARD8 miscReqType; /* always X_XCMiscGetVersion */
CARD16 length;
CARD16 majorVersion;
CARD16 minorVersion;
} xXCMiscGetVersionReq;
#define sz_xXCMiscGetVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD16 majorVersion;
CARD16 minorVersion;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXCMiscGetVersionReply;
#define sz_xXCMiscGetVersionReply 32
typedef struct {
CARD8 reqType; /* always XCMiscCode */
CARD8 miscReqType; /* always X_XCMiscGetXIDRange */
CARD16 length;
} xXCMiscGetXIDRangeReq;
#define sz_xXCMiscGetXIDRangeReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 start_id;
CARD32 count;
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
} xXCMiscGetXIDRangeReply;
#define sz_xXCMiscGetXIDRangeReply 32
typedef struct {
CARD8 reqType; /* always XCMiscCode */
CARD8 miscReqType; /* always X_XCMiscGetXIDList */
CARD16 length;
CARD32 count; /* number of IDs requested */
} xXCMiscGetXIDListReq;
#define sz_xXCMiscGetXIDListReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber;
CARD32 length;
CARD32 count; /* number of IDs requested */
CARD32 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXCMiscGetXIDListReply;
#define sz_xXCMiscGetXIDListReply 32
#endif /* _XCMISCPROTO_H_ */
/* Copyright (C) 2003-2006 Jamey Sharp, Josh Triplett
* This file is licensed under the MIT license. See the file COPYING. */
#ifndef _X11_XLIB_XCB_H_
#define _X11_XLIB_XCB_H_
#include <xcb/xcb.h>
#include <X11/Xlib.h>
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
xcb_connection_t *XGetXCBConnection(Display *dpy);
enum XEventQueueOwner { XlibOwnsEventQueue = 0, XCBOwnsEventQueue };
void XSetEventQueueOwner(Display *dpy, enum XEventQueueOwner owner);
_XFUNCPROTOEND
#endif /* _X11_XLIB_XCB_H_ */
/* include/X11/XlibConf.h. Generated from XlibConf.h.in by configure. */
/*
* Copyright © 2005 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, 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.
*/
#ifndef _XLIBCONF_H_
#define _XLIBCONF_H_
/*
* This header file exports defines necessary to correctly
* use Xlibint.h both inside Xlib and by external libraries
* such as extensions.
*/
/* Threading support? */
#define XTHREADS 1
/* Use multi-threaded libc functions? */
#define XUSE_MTSAFE_API 1
#endif /* _XLIBCONF_H_ */
/************************************************************
Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
********************************************************/
/*
Copyright 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */
#ifndef _XtThreadsI_h
#define _XtThreadsI_h
#include <X11/XlibConf.h>
#ifdef XTHREADS
typedef struct _LockRec *LockPtr;
typedef void (*ThreadAppProc)(
XtAppContext /* app */
);
typedef void (*ThreadAppYieldLockProc)(
XtAppContext, /* app */
Boolean*, /* push_thread */
Boolean*, /* pushed_thread */
int* /* level */
);
typedef void (*ThreadAppRestoreLockProc)(
XtAppContext /* app */,
int, /* level */
Boolean* /* pushed_thread */
);
_XFUNCPROTOBEGIN
extern void (*_XtProcessLock)(
void
);
extern void (*_XtProcessUnlock)(
void
);
extern void (*_XtInitAppLock)(
XtAppContext /* app */
);
_XFUNCPROTOEND
#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app)
#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app)
#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)()
#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)()
#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app)
#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app)
#define YIELD_APP_LOCK(app,push,pushed,level)\
if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level)
#define RESTORE_APP_LOCK(app,level,pushed)\
if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed)
#define WIDGET_TO_APPCON(w) \
XtAppContext app = (w && _XtProcessLock ? \
XtWidgetToApplicationContext(w) : NULL)
#define DPY_TO_APPCON(d) \
XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): NULL)
#else /* defined(XTHREADS) */
#define LOCK_PROCESS
#define UNLOCK_PROCESS
#define LOCK_APP(app)
#define UNLOCK_APP(app)
#define INIT_APP_LOCK(app)
#define FREE_APP_LOCK(app)
#define WIDGET_TO_APPCON(w)
#define DPY_TO_APPCON(d)
#endif /* !defined(XTHREADS) */
#endif /* _XtThreadsI_h */
/******************************************************************************
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
#ifndef _ICEPROTO_H_
#define _ICEPROTO_H_
#include <X11/Xmd.h>
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 data[2];
CARD32 length B32;
} iceMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD16 errorClass B16;
CARD32 length B32;
CARD8 offendingMinorOpcode;
CARD8 severity;
CARD16 unused B16;
CARD32 offendingSequenceNum B32;
/* n varying values */
/* p p = pad (n, 8) */
} iceErrorMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 byteOrder;
CARD8 unused;
CARD32 length B32;
} iceByteOrderMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 versionCount;
CARD8 authCount;
CARD32 length B32;
CARD8 mustAuthenticate;
CARD8 unused[7];
/* i STRING vendor */
/* j STRING release */
/* k LIST of STRING authentication-protocol-names */
/* m LIST of VERSION version-list */
/* p p = pad (i+j+k+m, 8) */
} iceConnectionSetupMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 authIndex;
CARD8 unused1;
CARD32 length B32;
CARD16 authDataLength B16;
CARD8 unused2[6];
/* n varying data */
/* p p = pad (n, 8) */
} iceAuthRequiredMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused1[2];
CARD32 length B32;
CARD16 authDataLength B16;
CARD8 unused2[6];
/* n varying data */
/* p p = pad (n, 8) */
} iceAuthReplyMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 unused1[2];
CARD32 length B32;
CARD16 authDataLength B16;
CARD8 unused2[6];
/* n varying data */
/* p p = pad (n, 8) */
} iceAuthNextPhaseMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 versionIndex;
CARD8 unused;
CARD32 length B32;
/* i STRING vendor */
/* j STRING release */
/* p p = pad (i+j, 8) */
} iceConnectionReplyMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 protocolOpcode;
CARD8 mustAuthenticate;
CARD32 length B32;
CARD8 versionCount;
CARD8 authCount;
CARD8 unused[6];
/* i STRING protocol-name */
/* j STRING vendor */
/* k STRING release */
/* m LIST of STRING authentication-protocol-names */
/* n LIST of VERSION version-list */
/* p p = pad (i+j+k+m+n, 8) */
} iceProtocolSetupMsg;
typedef struct {
CARD8 majorOpcode;
CARD8 minorOpcode;
CARD8 versionIndex;
CARD8 protocolOpcode;
CARD32 length B32;
/* i STRING vendor */
/* j STRING release */
/* p p = pad (i+j, 8) */
} iceProtocolReplyMsg;
typedef iceMsg icePingMsg;
typedef iceMsg icePingReplyMsg;
typedef iceMsg iceWantToCloseMsg;
typedef iceMsg iceNoCloseMsg;
/*
* SIZEOF values. These better be multiples of 8.
*/
#define sz_iceMsg 8
#define sz_iceErrorMsg 16
#define sz_iceByteOrderMsg 8
#define sz_iceConnectionSetupMsg 16
#define sz_iceAuthRequiredMsg 16
#define sz_iceAuthReplyMsg 16
#define sz_iceAuthNextPhaseMsg 16
#define sz_iceConnectionReplyMsg 8
#define sz_iceProtocolSetupMsg 16
#define sz_iceProtocolReplyMsg 8
#define sz_icePingMsg 8
#define sz_icePingReplyMsg 8
#define sz_iceWantToCloseMsg 8
#define sz_iceNoCloseMsg 8
#endif /* _ICEPROTO_H_ */
/******************************************************************************
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
#ifndef _ICEMSG_H_
#define _ICEMSG_H_
#include <X11/Xfuncproto.h>
#include <X11/ICE/ICEconn.h>
_XFUNCPROTOBEGIN
/*
* Function prototypes for internal ICElib functions
*/
extern Status _IceRead (
IceConn /* iceConn */,
unsigned long /* nbytes */,
char * /* ptr */
);
extern void _IceReadSkip (
IceConn /* iceConn */,
unsigned long /* nbytes */
);
extern void _IceWrite (
IceConn /* iceConn */,
unsigned long /* nbytes */,
char * /* ptr */
);
extern void _IceErrorBadMinor (
IceConn /* iceConn */,
int /* majorOpcode */,
int /* offendingMinor */,
int /* severity */
);
extern void _IceErrorBadState (
IceConn /* iceConn */,
int /* majorOpcode */,
int /* offendingMinor */,
int /* severity */
);
extern void _IceErrorBadLength (
IceConn /* iceConn */,
int /* majorOpcode */,
int /* offendingMinor */,
int /* severity */
);
extern void _IceErrorBadValue (
IceConn /* iceConn */,
int /* majorOpcode */,
int /* offendingMinor */,
int /* offset */,
int /* length */,
IcePointer /* value */
);
extern IcePoAuthStatus _IcePoMagicCookie1Proc (
IceConn /* iceConn */,
IcePointer * /* authStatePtr */,
Bool /* cleanUp */,
Bool /* swap */,
int /* authDataLen */,
IcePointer /* authData */,
int * /* replyDataLenRet */,
IcePointer * /* replyDataRet */,
char ** /* errorStringRet */
);
extern IcePaAuthStatus _IcePaMagicCookie1Proc (
IceConn /* iceConn */,
IcePointer * /* authStatePtr */,
Bool /* swap */,
int /* authDataLen */,
IcePointer /* authData */,
int * /* replyDataLenRet */,
IcePointer * /* replyDataRet */,
char ** /* errorStringRet */
);
/*
* Macro to check if IO operations are valid on an ICE connection.
*/
#define IceValidIO(_iceConn) _iceConn->io_ok
/*
* Macros for writing messages.
*/
#define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \
if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \
IceFlush (_iceConn); \
_pMsg = (_msgType *) _iceConn->outbufptr; \
_pMsg->majorOpcode = _major; \
_pMsg->minorOpcode = _minor; \
_pMsg->length = (_headerSize - SIZEOF (iceMsg)) >> 3; \
_iceConn->outbufptr += _headerSize; \
_iceConn->send_sequence++
#define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \
if ((_iceConn->outbufptr + \
_headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \
IceFlush (_iceConn); \
_pMsg = (_msgType *) _iceConn->outbufptr; \
if ((_iceConn->outbufptr + \
_headerSize + ((_extra) << 3)) <= _iceConn->outbufmax) \
_pData = (char *) _pMsg + _headerSize; \
else \
_pData = NULL; \
_pMsg->majorOpcode = _major; \
_pMsg->minorOpcode = _minor; \
_pMsg->length = ((_headerSize - SIZEOF (iceMsg)) >> 3) + (_extra); \
_iceConn->outbufptr += (_headerSize + ((_extra) << 3)); \
_iceConn->send_sequence++
#define IceSimpleMessage(_iceConn, _major, _minor) \
{ \
iceMsg *_pMsg; \
IceGetHeader (_iceConn, _major, _minor, SIZEOF (iceMsg), iceMsg, _pMsg); \
}
#define IceErrorHeader(_iceConn, _offendingMajorOpcode, _offendingMinorOpcode, _offendingSequenceNum, _severity, _errorClass, _dataLength) \
{ \
iceErrorMsg *_pMsg; \
\
IceGetHeader (_iceConn, _offendingMajorOpcode, ICE_Error, \
SIZEOF (iceErrorMsg), iceErrorMsg, _pMsg); \
_pMsg->length += (_dataLength); \
_pMsg->offendingMinorOpcode = (CARD8) _offendingMinorOpcode; \
_pMsg->severity = (CARD8) _severity; \
_pMsg->offendingSequenceNum = (CARD32) _offendingSequenceNum; \
_pMsg->errorClass = (CARD16) _errorClass; \
}
/*
* Write data into the ICE output buffer.
*/
#define IceWriteData(_iceConn, _bytes, _data) \
{ \
if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
{ \
IceFlush (_iceConn); \
_IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
} \
else \
{ \
memcpy (_iceConn->outbufptr, _data, _bytes); \
_iceConn->outbufptr += (_bytes); \
} \
}
#define IceWriteData16(_iceConn, _bytes, _data) \
IceWriteData (_iceConn, _bytes, (char *) _data)
#define IceWriteData32(_iceConn, _bytes, _data) \
IceWriteData (_iceConn, _bytes, (char *) _data)
/*
* The IceSendData macro bypasses copying the data to the
* ICE connection buffer and sends the data directly. If necessary,
* the ICE connection buffer is first flushed.
*/
#define IceSendData(_iceConn, _bytes, _data) \
{ \
if (_iceConn->outbufptr > _iceConn->outbuf) \
IceFlush (_iceConn); \
_IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
}
/*
* Write pad bytes. Used to force 32 or 64 bit alignment.
* A maximum of 7 pad bytes can be specified.
*/
#define IceWritePad(_iceConn, _bytes) \
{ \
if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
{ \
char _dummy[7] = { 0 }; \
IceFlush (_iceConn); \
_IceWrite (_iceConn, (unsigned long) (_bytes), _dummy); \
} \
else \
{ \
_iceConn->outbufptr += (_bytes); \
} \
}
/*
* Macros for reading messages.
*/
#define IceReadCompleteMessage(_iceConn, _headerSize, _msgType, _pMsg, _pData)\
{ \
unsigned long _bytes; \
IceReadMessageHeader (_iceConn, _headerSize, _msgType, _pMsg); \
_bytes = (_pMsg->length << 3) - (_headerSize - SIZEOF (iceMsg)); \
if ((_iceConn->inbufmax - _iceConn->inbufptr) >= _bytes) \
{ \
_IceRead (_iceConn, _bytes, _iceConn->inbufptr); \
_pData = _iceConn->inbufptr; \
_iceConn->inbufptr += _bytes; \
} \
else \
{ \
_pData = malloc (_bytes); \
if (_pData) \
_IceRead (_iceConn, _bytes, _pData); \
else \
_IceReadSkip (_iceConn, _bytes); \
} \
}
#define IceDisposeCompleteMessage(_iceConn, _pData) \
if ((char *) _pData < _iceConn->inbuf || \
(char *) _pData >= _iceConn->inbufmax) \
free (_pData);
#define IceReadSimpleMessage(_iceConn, _msgType, _pMsg) \
_pMsg = (_msgType *) (_iceConn->inbuf);
#define IceReadMessageHeader(_iceConn, _headerSize, _msgType, _pMsg) \
{ \
_IceRead (_iceConn, \
(unsigned long) (_headerSize - SIZEOF (iceMsg)), \
_iceConn->inbufptr); \
_pMsg = (_msgType *) (_iceConn->inbuf); \
_iceConn->inbufptr += (_headerSize - SIZEOF (iceMsg)); \
}
#define IceReadData(_iceConn, _bytes, _pData) \
_IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
#define IceReadData16(_iceConn, _swap, _bytes, _pData) \
{ \
_IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
}
#define IceReadData32(_iceConn, _swap, _bytes, _pData) \
{ \
_IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
}
/*
* Read pad bytes (for 32 or 64 bit alignment).
* A maxium of 7 pad bytes can be specified.
*/
#define IceReadPad(_iceConn, _bytes) \
{ \
char _dummy[7]; \
_IceRead (_iceConn, (unsigned long) (_bytes), _dummy); \
}
_XFUNCPROTOEND
#endif /* _ICEMSG_H_ */
/******************************************************************************
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
#ifndef _ICELIB_H_
#define _ICELIB_H_
#include <X11/ICE/ICE.h>
#include <X11/Xfuncproto.h>
#define Bool int
#define Status int
#define True 1
#define False 0
typedef void *IcePointer;
typedef enum {
IcePoAuthHaveReply,
IcePoAuthRejected,
IcePoAuthFailed,
IcePoAuthDoneCleanup
} IcePoAuthStatus;
typedef enum {
IcePaAuthContinue,
IcePaAuthAccepted,
IcePaAuthRejected,
IcePaAuthFailed
} IcePaAuthStatus;
typedef enum {
IceConnectPending,
IceConnectAccepted,
IceConnectRejected,
IceConnectIOError
} IceConnectStatus;
typedef enum {
IceProtocolSetupSuccess,
IceProtocolSetupFailure,
IceProtocolSetupIOError,
IceProtocolAlreadyActive
} IceProtocolSetupStatus;
typedef enum {
IceAcceptSuccess,
IceAcceptFailure,
IceAcceptBadMalloc
} IceAcceptStatus;
typedef enum {
IceClosedNow,
IceClosedASAP,
IceConnectionInUse,
IceStartedShutdownNegotiation
} IceCloseStatus;
typedef enum {
IceProcessMessagesSuccess,
IceProcessMessagesIOError,
IceProcessMessagesConnectionClosed
} IceProcessMessagesStatus;
typedef struct {
unsigned long sequence_of_request;
int major_opcode_of_request;
int minor_opcode_of_request;
IcePointer reply;
} IceReplyWaitInfo;
typedef struct _IceConn *IceConn;
typedef struct _IceListenObj *IceListenObj;
typedef void (*IceWatchProc) (
IceConn /* iceConn */,
IcePointer /* clientData */,
Bool /* opening */,
IcePointer * /* watchData */
);
typedef void (*IcePoProcessMsgProc) (
IceConn /* iceConn */,
IcePointer /* clientData */,
int /* opcode */,
unsigned long /* length */,
Bool /* swap */,
IceReplyWaitInfo * /* replyWait */,
Bool * /* replyReadyRet */
);
typedef void (*IcePaProcessMsgProc) (
IceConn /* iceConn */,
IcePointer /* clientData */,
int /* opcode */,
unsigned long /* length */,
Bool /* swap */
);
typedef struct {
int major_version;
int minor_version;
IcePoProcessMsgProc process_msg_proc;
} IcePoVersionRec;
typedef struct {
int major_version;
int minor_version;
IcePaProcessMsgProc process_msg_proc;
} IcePaVersionRec;
typedef IcePoAuthStatus (*IcePoAuthProc) (
IceConn /* iceConn */,
IcePointer * /* authStatePtr */,
Bool /* cleanUp */,
Bool /* swap */,
int /* authDataLen */,
IcePointer /* authData */,
int * /* replyDataLenRet */,
IcePointer * /* replyDataRet */,
char ** /* errorStringRet */
);
typedef IcePaAuthStatus (*IcePaAuthProc) (
IceConn /* iceConn */,
IcePointer * /* authStatePtr */,
Bool /* swap */,
int /* authDataLen */,
IcePointer /* authData */,
int * /* replyDataLenRet */,
IcePointer * /* replyDataRet */,
char ** /* errorStringRet */
);
typedef Bool (*IceHostBasedAuthProc) (
char * /* hostName */
);
typedef Status (*IceProtocolSetupProc) (
IceConn /* iceConn */,
int /* majorVersion */,
int /* minorVersion */,
char * /* vendor */,
char * /* release */,
IcePointer * /* clientDataRet */,
char ** /* failureReasonRet */
);
typedef void (*IceProtocolActivateProc) (
IceConn /* iceConn */,
IcePointer /* clientData */
);
typedef void (*IceIOErrorProc) (
IceConn /* iceConn */
);
typedef void (*IcePingReplyProc) (
IceConn /* iceConn */,
IcePointer /* clientData */
);
typedef void (*IceErrorHandler) (
IceConn /* iceConn */,
Bool /* swap */,
int /* offendingMinorOpcode */,
unsigned long /* offendingSequence */,
int /* errorClass */,
int /* severity */,
IcePointer /* values */
);
typedef void (*IceIOErrorHandler) (
IceConn /* iceConn */
);
/*
* Function prototypes
*/
_XFUNCPROTOBEGIN
extern int IceRegisterForProtocolSetup (
const char * /* protocolName */,
const char * /* vendor */,
const char * /* release */,
int /* versionCount */,
IcePoVersionRec * /* versionRecs */,
int /* authCount */,
const char ** /* authNames */,
IcePoAuthProc * /* authProcs */,
IceIOErrorProc /* IOErrorProc */
);
extern int IceRegisterForProtocolReply (
const char * /* protocolName */,
const char * /* vendor */,
const char * /* release */,
int /* versionCount */,
IcePaVersionRec * /* versionRecs */,
int /* authCount */,
const char ** /* authNames */,
IcePaAuthProc * /* authProcs */,
IceHostBasedAuthProc /* hostBasedAuthProc */,
IceProtocolSetupProc /* protocolSetupProc */,
IceProtocolActivateProc /* protocolActivateProc */,
IceIOErrorProc /* IOErrorProc */
);
extern IceConn IceOpenConnection (
char * /* networkIdsList */,
IcePointer /* context */,
Bool /* mustAuthenticate */,
int /* majorOpcodeCheck */,
int /* errorLength */,
char * /* errorStringRet */
);
extern IcePointer IceGetConnectionContext (
IceConn /* iceConn */
);
extern Status IceListenForConnections (
int * /* countRet */,
IceListenObj ** /* listenObjsRet */,
int /* errorLength */,
char * /* errorStringRet */
);
extern Status IceListenForWellKnownConnections (
char * /* port */,
int * /* countRet */,
IceListenObj ** /* listenObjsRet */,
int /* errorLength */,
char * /* errorStringRet */
);
extern int IceGetListenConnectionNumber (
IceListenObj /* listenObj */
);
extern char *IceGetListenConnectionString (
IceListenObj /* listenObj */
);
extern char *IceComposeNetworkIdList (
int /* count */,
IceListenObj * /* listenObjs */
);
extern void IceFreeListenObjs (
int /* count */,
IceListenObj * /* listenObjs */
);
extern void IceSetHostBasedAuthProc (
IceListenObj /* listenObj */,
IceHostBasedAuthProc /* hostBasedAuthProc */
);
extern IceConn IceAcceptConnection (
IceListenObj /* listenObj */,
IceAcceptStatus * /* statusRet */
);
extern void IceSetShutdownNegotiation (
IceConn /* iceConn */,
Bool /* negotiate */
);
extern Bool IceCheckShutdownNegotiation (
IceConn /* iceConn */
);
extern IceCloseStatus IceCloseConnection (
IceConn /* iceConn */
);
extern Status IceAddConnectionWatch (
IceWatchProc /* watchProc */,
IcePointer /* clientData */
);
extern void IceRemoveConnectionWatch (
IceWatchProc /* watchProc */,
IcePointer /* clientData */
);
extern IceProtocolSetupStatus IceProtocolSetup (
IceConn /* iceConn */,
int /* myOpcode */,
IcePointer /* clientData */,
Bool /* mustAuthenticate */,
int * /* majorVersionRet */,
int * /* minorVersionRet */,
char ** /* vendorRet */,
char ** /* releaseRet */,
int /* errorLength */,
char * /* errorStringRet */
);
extern Status IceProtocolShutdown (
IceConn /* iceConn */,
int /* majorOpcode */
);
extern IceProcessMessagesStatus IceProcessMessages (
IceConn /* iceConn */,
IceReplyWaitInfo * /* replyWait */,
Bool * /* replyReadyRet */
);
extern Status IcePing (
IceConn /* iceConn */,
IcePingReplyProc /* pingReplyProc */,
IcePointer /* clientData */
);
extern char *IceAllocScratch (
IceConn /* iceConn */,
unsigned long /* size */
);
extern int IceFlush (
IceConn /* iceConn */
);
extern int IceGetOutBufSize (
IceConn /* iceConn */
);
extern int IceGetInBufSize (
IceConn /* iceConn */
);
extern IceConnectStatus IceConnectionStatus (
IceConn /* iceConn */
);
extern char *IceVendor (
IceConn /* iceConn */
);
extern char *IceRelease (
IceConn /* iceConn */
);
extern int IceProtocolVersion (
IceConn /* iceConn */
);
extern int IceProtocolRevision (
IceConn /* iceConn */
);
extern int IceConnectionNumber (
IceConn /* iceConn */
);
extern char *IceConnectionString (
IceConn /* iceConn */
);
extern unsigned long IceLastSentSequenceNumber (
IceConn /* iceConn */
);
extern unsigned long IceLastReceivedSequenceNumber (
IceConn /* iceConn */
);
extern Bool IceSwapping (
IceConn /* iceConn */
);
extern IceErrorHandler IceSetErrorHandler (
IceErrorHandler /* handler */
);
extern IceIOErrorHandler IceSetIOErrorHandler (
IceIOErrorHandler /* handler */
);
extern char *IceGetPeerName (
IceConn /* iceConn */
);
/*
* Multithread Routines
*/
extern Status IceInitThreads (
void
);
extern void IceAppLockConn (
IceConn /* iceConn */
);
extern void IceAppUnlockConn (
IceConn /* iceConn */
);
_XFUNCPROTOEND
#endif /* _ICELIB_H_ */
/******************************************************************************
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
#ifndef _ICEUTIL_H_
#define _ICEUTIL_H_
#include <X11/Xfuncproto.h>
#include <stdio.h>
_XFUNCPROTOBEGIN
/*
* Data structure for entry in ICE authority file
*/
typedef struct {
char *protocol_name;
unsigned short protocol_data_length;
char *protocol_data;
char *network_id;
char *auth_name;
unsigned short auth_data_length;
char *auth_data;
} IceAuthFileEntry;
/*
* Authentication data maintained in memory.
*/
typedef struct {
char *protocol_name;
char *network_id;
char *auth_name;
unsigned short auth_data_length;
char *auth_data;
} IceAuthDataEntry;
/*
* Return values from IceLockAuthFile
*/
#define IceAuthLockSuccess 0 /* lock succeeded */
#define IceAuthLockError 1 /* lock unexpectely failed, check errno */
#define IceAuthLockTimeout 2 /* lock failed, timeouts expired */
/*
* Function Prototypes
*/
extern char *IceAuthFileName (
void
);
extern int IceLockAuthFile (
const char * /* file_name */,
int /* retries */,
int /* timeout */,
long /* dead */
);
extern void IceUnlockAuthFile (
const char * /* file_name */
);
extern IceAuthFileEntry *IceReadAuthFileEntry (
FILE * /* auth_file */
);
extern void IceFreeAuthFileEntry (
IceAuthFileEntry * /* auth */
);
extern Status IceWriteAuthFileEntry (
FILE * /* auth_file */,
IceAuthFileEntry * /* auth */
);
extern IceAuthFileEntry *IceGetAuthFileEntry (
const char * /* protocol_name */,
const char * /* network_id */,
const char * /* auth_name */
);
extern char *IceGenerateMagicCookie (
int /* len */
);
extern void IceSetPaAuthData (
int /* numEntries */,
IceAuthDataEntry * /* entries */
);
_XFUNCPROTOEND
#endif /* _ICEUTIL_H_ */
/******************************************************************************
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
#ifndef _ICE_H_
#define _ICE_H_
/*
* Protocol Version
*/
#define IceProtoMajor 1
#define IceProtoMinor 0
/*
* Byte Order
*/
#define IceLSBfirst 0
#define IceMSBfirst 1
/*
* ICE minor opcodes
*/
#define ICE_Error 0
#define ICE_ByteOrder 1
#define ICE_ConnectionSetup 2
#define ICE_AuthRequired 3
#define ICE_AuthReply 4
#define ICE_AuthNextPhase 5
#define ICE_ConnectionReply 6
#define ICE_ProtocolSetup 7
#define ICE_ProtocolReply 8
#define ICE_Ping 9
#define ICE_PingReply 10
#define ICE_WantToClose 11
#define ICE_NoClose 12
/*
* Error severity
*/
#define IceCanContinue 0
#define IceFatalToProtocol 1
#define IceFatalToConnection 2
/*
* ICE error classes that are common to all protocols
*/
#define IceBadMinor 0x8000
#define IceBadState 0x8001
#define IceBadLength 0x8002
#define IceBadValue 0x8003
/*
* ICE error classes that are specific to the ICE protocol
*/
#define IceBadMajor 0
#define IceNoAuth 1
#define IceNoVersion 2
#define IceSetupFailed 3
#define IceAuthRejected 4
#define IceAuthFailed 5
#define IceProtocolDuplicate 6
#define IceMajorOpcodeDuplicate 7
#define IceUnknownProtocol 8
#endif /* _ICE_H_ */
/******************************************************************************
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
#ifndef _ICECONN_H_
#define _ICECONN_H_
#include <X11/ICE/ICElib.h>
/*
* Data structures for ICE connection object
*/
typedef struct _IceSavedReplyWait {
IceReplyWaitInfo *reply_wait;
Bool reply_ready;
struct _IceSavedReplyWait *next;
} _IceSavedReplyWait;
typedef struct _IcePingWait {
IcePingReplyProc ping_reply_proc;
IcePointer client_data;
struct _IcePingWait *next;
} _IcePingWait;
typedef struct {
char *vendor;
char *release;
int version_count;
IcePoVersionRec *version_recs;
int auth_count;
char **auth_names;
IcePoAuthProc *auth_procs;
IceIOErrorProc io_error_proc;
} _IcePoProtocol;
typedef struct {
char *vendor;
char *release;
int version_count;
IcePaVersionRec *version_recs;
IceProtocolSetupProc protocol_setup_proc;
IceProtocolActivateProc protocol_activate_proc;
int auth_count;
char **auth_names;
IcePaAuthProc *auth_procs;
IceHostBasedAuthProc host_based_auth_proc;
IceIOErrorProc io_error_proc;
} _IcePaProtocol;
typedef struct {
char *protocol_name;
_IcePoProtocol *orig_client;
_IcePaProtocol *accept_client;
} _IceProtocol;
typedef struct {
Bool in_use;
int my_opcode;
_IceProtocol *protocol;
IcePointer client_data;
Bool accept_flag;
union {
IcePaProcessMsgProc accept_client;
IcePoProcessMsgProc orig_client;
} process_msg_proc;
} _IceProcessMsgInfo;
typedef struct {
int his_version_index;
int my_version_index;
char *his_vendor;
char *his_release;
char my_auth_index;
IcePointer my_auth_state;
Bool must_authenticate;
} _IceConnectToMeInfo;
typedef struct {
int his_opcode;
int my_opcode;
int his_version_index;
int my_version_index;
char *his_vendor;
char *his_release;
char my_auth_index;
IcePointer my_auth_state;
Bool must_authenticate;
} _IceProtoSetupToMeInfo;
typedef struct {
Bool auth_active;
char my_auth_index;
IcePointer my_auth_state;
} _IceConnectToYouInfo;
typedef struct {
int my_opcode;
int my_auth_count;
int *my_auth_indices;
Bool auth_active;
char my_auth_index;
IcePointer my_auth_state;
} _IceProtoSetupToYouInfo;
struct _IceConn {
unsigned int io_ok : 1; /* did an IO error occur? */
unsigned int swap : 1; /* do we need to swap on reads? */
unsigned int waiting_for_byteorder : 1; /* waiting for a ByteOrder msg? */
unsigned int skip_want_to_close : 1; /* avoid shutdown negotiation? */
unsigned int want_to_close : 1; /* did we send a WantToClose? */
unsigned int free_asap : 1; /* free as soon as possible */
unsigned int unused1 : 2; /* future use */
unsigned int unused2 : 8; /* future use */
IceConnectStatus connection_status; /* pending, accepted, rejected */
unsigned char my_ice_version_index; /* which version are we using? */
struct _XtransConnInfo *trans_conn; /* transport connection object */
unsigned long send_sequence; /* Sequence # of last msg sent */
unsigned long receive_sequence; /* Sequence # of last msg received */
char *connection_string; /* network connection string */
char *vendor; /* other client's vendor */
char *release; /* other client's release */
char *inbuf; /* Input buffer starting address */
char *inbufptr; /* Input buffer index pointer */
char *inbufmax; /* Input buffer maximum+1 address */
char *outbuf; /* Output buffer starting address */
char *outbufptr; /* Output buffer index pointer */
char *outbufmax; /* Output buffer maximum+1 address */
char *scratch; /* scratch buffer */
unsigned long scratch_size; /* scratch size */
int dispatch_level; /* IceProcessMessages dispatch level */
IcePointer context; /* context associated with caller
of IceOpenConnection */
/*
* Before we read a message, the major opcode of the message must be
* mapped to our corresponding major opcode (the two clients can use
* different opcodes for the same protocol). In order to save space,
* we keep track of the mininum and maximum major opcodes used by the
* other client. To get the information on how to process this message,
* we do the following...
*
* processMsgInfo = iceConn->process_msg_info[
* message->majorOpcode - iceConn->his_min_opcode]
*
* Note that the number of elements in the iceConn->process_msg_info
* array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1).
* We check process_msg_info->in_use to see if the opcode is being used.
*/
_IceProcessMsgInfo *process_msg_info;
char his_min_opcode; /* [1..255] */
char his_max_opcode; /* [1..255] */
/*
* Number of times this iceConn was returned in IceOpenConnection
* or IceAcceptConnection.
*/
unsigned char open_ref_count;
/*
* Number of active protocols.
*/
unsigned char proto_ref_count;
/*
* If this ICE connection was created with IceAcceptConnection,
* the listen_obj field is set to the listen object. Otherwise,
* the listen_obj field is NULL.
*/
IceListenObj listen_obj;
/*
* We need to keep track of all the replies we're waiting for.
* Check the comments in process.c for how this works.
*/
_IceSavedReplyWait *saved_reply_waits;
/*
* We keep track of all Pings sent from the client. When the Ping reply
* arrives, we remove it from the list.
*/
_IcePingWait *ping_waits;
/*
* Some state for a client doing a Connection/Protocol Setup
*/
_IceConnectToYouInfo *connect_to_you;
_IceProtoSetupToYouInfo *protosetup_to_you;
/*
* Some state for a client receiving a Connection/Protocol Setup
*/
_IceConnectToMeInfo *connect_to_me;
_IceProtoSetupToMeInfo *protosetup_to_me;
};
#endif /* _ICECONN_H_ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* Various and sundry Thread-Safe functions used by X11, Motif, and CDE.
*
* Use this file in MT-safe code where you would have included
* <dirent.h> for readdir()
* <grp.h> for getgrgid() or getgrnam()
* <netdb.h> for gethostbyname(), gethostbyaddr(), or getservbyname()
* <pwd.h> for getpwnam() or getpwuid()
* <string.h> for strtok()
* <time.h> for asctime(), ctime(), localtime(), or gmtime()
* <unistd.h> for getlogin() or ttyname()
* or their thread-safe analogs.
*
* If you are on a platform that defines XTHREADS but does not have
* MT-safe system API (e.g. UnixWare) you must define _Xos_processLock
* and _Xos_processUnlock macros before including this header.
*
* For convenience XOS_USE_XLIB_LOCKING or XOS_USE_XT_LOCKING may be defined
* to obtain either Xlib-only or Xt-based versions of these macros. These
* macros won't result in truly thread-safe calls, but they are better than
* nothing. If you do not want locking in this situation define
* XOS_USE_NO_LOCKING.
*
* NOTE: On systems lacking appropriate _r functions Gethostbyname(),
* Gethostbyaddr(), and Getservbyname() do NOT copy the host or
* protocol lists!
*
* NOTE: On systems lacking appropriate _r functions Getgrgid() and
* Getgrnam() do NOT copy the list of group members!
*
* This header is nominally intended to simplify porting X11, Motif, and
* CDE; it may be useful to other people too. The structure below is
* complicated, mostly because P1003.1c (the IEEE POSIX Threads spec)
* went through lots of drafts, and some vendors shipped systems based
* on draft API that were changed later. Unfortunately POSIX did not
* provide a feature-test macro for distinguishing each of the drafts.
*/
/*
* This header has several parts. Search for "Effective prototypes"
* to locate the beginning of a section.
*/
/* This header can be included multiple times with different defines! */
#ifndef _XOS_R_H_
# define _XOS_R_H_
# include <X11/Xos.h>
# include <X11/Xfuncs.h>
# ifndef X_NOT_POSIX
# ifdef _POSIX_SOURCE
# include <limits.h>
# else
# define _POSIX_SOURCE
# include <limits.h>
# undef _POSIX_SOURCE
# endif
# ifndef LINE_MAX
# define X_LINE_MAX 2048
# else
# define X_LINE_MAX LINE_MAX
# endif
# endif
#endif /* _XOS_R_H */
#ifndef WIN32
#ifdef __cplusplus
extern "C" {
#endif
# if defined(XOS_USE_XLIB_LOCKING)
# ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */
typedef struct _LockInfoRec *LockInfoPtr;
extern LockInfoPtr _Xglobal_lock;
# endif
# ifndef _Xos_isThreadInitialized
# define _Xos_isThreadInitialized (_Xglobal_lock)
# endif
# if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
# ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */
# include <X11/Xfuncproto.h> /* for NeedFunctionPrototypes */
extern void (*_XLockMutex_fn)(
# if NeedFunctionPrototypes
LockInfoPtr /* lock */, char * /* file */, int /* line */
# endif
);
extern void (*_XUnlockMutex_fn)(
# if NeedFunctionPrototypes
LockInfoPtr /* lock */, char * /* file */, int /* line */
# endif
);
# endif
# ifndef _Xos_processLock
# define _Xos_processLock \
(_XLockMutex_fn ? (*_XLockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0)
# endif
# ifndef _Xos_processUnlock
# define _Xos_processUnlock \
(_XUnlockMutex_fn ? (*_XUnlockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0)
# endif
# else
# ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */
# include <X11/Xfuncproto.h> /* for NeedFunctionPrototypes */
extern void (*_XLockMutex_fn)(
# if NeedFunctionPrototypes
LockInfoPtr /* lock */
# endif
);
extern void (*_XUnlockMutex_fn)(
# if NeedFunctionPrototypes
LockInfoPtr /* lock */
# endif
);
# endif
# ifndef _Xos_processLock
# define _Xos_processLock \
(_XLockMutex_fn ? ((*_XLockMutex_fn)(_Xglobal_lock), 0) : 0)
# endif
# ifndef _Xos_processUnlock
# define _Xos_processUnlock \
(_XUnlockMutex_fn ? ((*_XUnlockMutex_fn)(_Xglobal_lock), 0) : 0)
# endif
# endif
# elif defined(XOS_USE_XT_LOCKING)
# ifndef _XtThreadsI_h
extern void (*_XtProcessLock)(void);
# endif
# ifndef _XtintrinsicP_h
# include <X11/Xfuncproto.h> /* for NeedFunctionPrototypes */
extern void XtProcessLock(
# if NeedFunctionPrototypes
void
# endif
);
extern void XtProcessUnlock(
# if NeedFunctionPrototypes
void
# endif
);
# endif
# ifndef _Xos_isThreadInitialized
# define _Xos_isThreadInitialized _XtProcessLock
# endif
# ifndef _Xos_processLock
# define _Xos_processLock XtProcessLock()
# endif
# ifndef _Xos_processUnlock
# define _Xos_processUnlock XtProcessUnlock()
# endif
# elif defined(XOS_USE_NO_LOCKING)
# ifndef _Xos_isThreadInitialized
# define _Xos_isThreadInitialized 0
# endif
# ifndef _Xos_processLock
# define _Xos_processLock 0
# endif
# ifndef _Xos_processUnlock
# define _Xos_processUnlock 0
# endif
# endif
#endif /* !defined WIN32 */
/*
* Solaris defines the POSIX thread-safe feature test macro, but
* uses the older SVR4 thread-safe functions unless the POSIX ones
* are specifically requested. Fix the feature test macro.
*/
#if defined(__sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \
(_POSIX_C_SOURCE - 0 < 199506L) && !defined(_POSIX_PTHREAD_SEMANTICS)
# undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif
/***** <pwd.h> wrappers *****/
/*
* Effective prototypes for <pwd.h> wrappers:
*
* #define X_INCLUDE_PWD_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xgetpwparams;
*
* struct passwd* _XGetpwnam(const char *name, _Xgetpwparams);
* struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams);
*/
#if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H)
# include <pwd.h>
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI)
# define XOS_USE_MTSAFE_PWDAPI 1
# endif
#endif
#undef X_NEEDS_PWPARAMS
#if !defined(X_INCLUDE_PWD_H) || defined(_XOS_INCLUDED_PWD_H)
/* Do nothing */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
# if defined(X_NOT_POSIX) && !defined(__i386__) && !defined(SYSV)
extern struct passwd *getpwuid(), *getpwnam();
# endif
typedef int _Xgetpwparams; /* dummy */
# define _XGetpwuid(u,p) getpwuid((u))
# define _XGetpwnam(u,p) getpwnam((u))
#elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI)
/* UnixWare 2.0, or other systems with thread support but no _r API. */
# define X_NEEDS_PWPARAMS
typedef struct {
struct passwd pws;
char pwbuf[1024];
struct passwd* pwp;
size_t len;
} _Xgetpwparams;
/*
* NetBSD and FreeBSD, at least, are missing several of the unixware passwd
* fields.
*/
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__APPLE__) || defined(__DragonFly__)
static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p)
{
memcpy(&(p).pws, (p).pwp, sizeof(struct passwd));
(p).pws.pw_name = (p).pwbuf;
(p).len = strlen((p).pwp->pw_name);
strcpy((p).pws.pw_name, (p).pwp->pw_name);
(p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1;
(p).len = strlen((p).pwp->pw_passwd);
strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd);
(p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1;
(p).len = strlen((p).pwp->pw_class);
strcpy((p).pws.pw_class, (p).pwp->pw_class);
(p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1;
(p).len = strlen((p).pwp->pw_gecos);
strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos);
(p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1;
(p).len = strlen((p).pwp->pw_dir);
strcpy((p).pws.pw_dir, (p).pwp->pw_dir);
(p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1;
(p).len = strlen((p).pwp->pw_shell);
strcpy((p).pws.pw_shell, (p).pwp->pw_shell);
(p).pwp = &(p).pws;
}
#else
# define _Xpw_copyPasswd(p) \
(memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \
((p).pws.pw_name = (p).pwbuf), \
((p).len = strlen((p).pwp->pw_name)), \
strcpy((p).pws.pw_name, (p).pwp->pw_name), \
((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \
((p).len = strlen((p).pwp->pw_passwd)), \
strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \
((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \
((p).len = strlen((p).pwp->pw_age)), \
strcpy((p).pws.pw_age, (p).pwp->pw_age), \
((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \
((p).len = strlen((p).pwp->pw_comment)), \
strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \
((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \
((p).len = strlen((p).pwp->pw_gecos)), \
strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \
((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \
((p).len = strlen((p).pwp->pw_dir)), \
strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \
((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \
((p).len = strlen((p).pwp->pw_shell)), \
strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \
((p).pwp = &(p).pws), \
0 )
#endif
# define _XGetpwuid(u,p) \
( (_Xos_processLock), \
(((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p), 0 : 0), \
(_Xos_processUnlock), \
(p).pwp )
# define _XGetpwnam(u,p) \
( (_Xos_processLock), \
(((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p), 0 : 0), \
(_Xos_processUnlock), \
(p).pwp )
#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__)
# define X_NEEDS_PWPARAMS
typedef struct {
struct passwd pws;
char pwbuf[X_LINE_MAX];
} _Xgetpwparams;
# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4)
# define _XGetpwuid(u,p) \
((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws)
# define _XGetpwnam(u,p) \
((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws)
# else /* SVR4 */
# define _XGetpwuid(u,p) \
((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws)
# define _XGetpwnam(u,p) \
((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws)
# endif /* SVR4 */
#else /* _POSIX_THREAD_SAFE_FUNCTIONS */
# define X_NEEDS_PWPARAMS
typedef struct {
struct passwd pws;
char pwbuf[X_LINE_MAX];
struct passwd* pwp;
} _Xgetpwparams;
typedef int _Xgetpwret;
# define _XGetpwuid(u,p) \
((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \
(p).pwp : NULL)
# define _XGetpwnam(u,p) \
((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \
(p).pwp : NULL)
#endif /* X_INCLUDE_PWD_H */
#if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H)
# define _XOS_INCLUDED_PWD_H
#endif
/***** <netdb.h> wrappers *****/
/*
* Effective prototypes for <netdb.h> wrappers:
*
* NOTE: On systems lacking the appropriate _r functions Gethostbyname(),
* Gethostbyaddr(), and Getservbyname() do NOT copy the host or
* protocol lists!
*
* #define X_INCLUDE_NETDB_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xgethostbynameparams;
* typedef ... _Xgetservbynameparams;
*
* struct hostent* _XGethostbyname(const char* name,_Xgethostbynameparams);
* struct hostent* _XGethostbyaddr(const char* addr, int len, int type,
* _Xgethostbynameparams);
* struct servent* _XGetservbyname(const char* name, const char* proto,
* _Xgetservbynameparams);
*/
#undef XTHREADS_NEEDS_BYNAMEPARAMS
#if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \
&& !defined(WIN32)
# include <netdb.h>
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI)
# define XOS_USE_MTSAFE_NETDBAPI 1
# endif
#endif
#if !defined(X_INCLUDE_NETDB_H) || defined(_XOS_INCLUDED_NETDB_H)
/* Do nothing. */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
typedef int _Xgethostbynameparams; /* dummy */
typedef int _Xgetservbynameparams; /* dummy */
# define _XGethostbyname(h,hp) gethostbyname((h))
# define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t))
# define _XGetservbyname(s,p,sp) getservbyname((s),(p))
#elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI)
/* WARNING: The h_addr_list and s_aliases values are *not* copied! */
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
#include <sys/param.h>
#endif
typedef struct {
struct hostent hent;
char h_name[MAXHOSTNAMELEN];
struct hostent *hptr;
} _Xgethostbynameparams;
typedef struct {
struct servent sent;
char s_name[255];
char s_proto[255];
struct servent *sptr;
} _Xgetservbynameparams;
# define XTHREADS_NEEDS_BYNAMEPARAMS
# define _Xg_copyHostent(hp) \
(memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \
strcpy((hp).h_name, (hp).hptr->h_name), \
((hp).hent.h_name = (hp).h_name), \
((hp).hptr = &(hp).hent), \
0 )
# define _Xg_copyServent(sp) \
(memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \
strcpy((sp).s_name, (sp).sptr->s_name), \
((sp).sent.s_name = (sp).s_name), \
strcpy((sp).s_proto, (sp).sptr->s_proto), \
((sp).sent.s_proto = (sp).s_proto), \
((sp).sptr = &(sp).sent), \
0 )
# define _XGethostbyname(h,hp) \
((_Xos_processLock), \
(((hp).hptr = gethostbyname((h))) ? _Xg_copyHostent(hp) : 0), \
(_Xos_processUnlock), \
(hp).hptr )
# define _XGethostbyaddr(a,al,t,hp) \
((_Xos_processLock), \
(((hp).hptr = gethostbyaddr((a),(al),(t))) ? _Xg_copyHostent(hp) : 0), \
(_Xos_processUnlock), \
(hp).hptr )
# define _XGetservbyname(s,p,sp) \
((_Xos_processLock), \
(((sp).sptr = getservbyname((s),(p))) ? _Xg_copyServent(sp) : 0), \
(_Xos_processUnlock), \
(sp).sptr )
#elif defined(XUSE_NETDB_R_API)
/*
* POSIX does not specify _r equivalents for <netdb.h> API, but some
* vendors provide them anyway. Use them only when explicitly asked.
*/
# ifdef _POSIX_REENTRANT_FUNCTIONS
# ifndef _POSIX_THREAD_SAFE_FUNCTIONS
# endif
# endif
# ifdef _POSIX_THREAD_SAFE_FUNCTIONS
# define X_POSIX_THREAD_SAFE_FUNCTIONS 1
# endif
# define XTHREADS_NEEDS_BYNAMEPARAMS
# ifndef X_POSIX_THREAD_SAFE_FUNCTIONS
typedef struct {
struct hostent hent;
char hbuf[X_LINE_MAX];
int herr;
} _Xgethostbynameparams;
typedef struct {
struct servent sent;
char sbuf[X_LINE_MAX];
} _Xgetservbynameparams;
# define _XGethostbyname(h,hp) \
gethostbyname_r((h),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr)
# define _XGethostbyaddr(a,al,t,hp) \
gethostbyaddr_r((a),(al),(t),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr)
# define _XGetservbyname(s,p,sp) \
getservbyname_r((s),(p),&(sp).sent,(sp).sbuf,sizeof((sp).sbuf))
# else
typedef struct {
struct hostent hent;
struct hostent_data hdata;
} _Xgethostbynameparams;
typedef struct {
struct servent sent;
struct servent_data sdata;
} _Xgetservbynameparams;
# define _XGethostbyname(h,hp) \
(bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \
((gethostbyname_r((h),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent))
# define _XGethostbyaddr(a,al,t,hp) \
(bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \
((gethostbyaddr_r((a),(al),(t),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent))
# define _XGetservbyname(s,p,sp) \
(bzero((char*)&(sp).sdata,sizeof((sp).sdata)), \
((getservbyname_r((s),(p),&(sp).sent,&(sp).sdata) == -1) ? NULL : &(sp).sent) )
# endif
# ifdef X_POSIX_THREAD_SAFE_FUNCTIONS
# undef X_POSIX_THREAD_SAFE_FUNCTIONS
# endif
#else
/* The regular API is assumed to be MT-safe under POSIX. */
typedef int _Xgethostbynameparams; /* dummy */
typedef int _Xgetservbynameparams; /* dummy */
# define _XGethostbyname(h,hp) gethostbyname((h))
# define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t))
# define _XGetservbyname(s,p,sp) getservbyname((s),(p))
#endif /* X_INCLUDE_NETDB_H */
#if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H)
# define _XOS_INCLUDED_NETDB_H
#endif
/***** <dirent.h> wrappers *****/
/*
* Effective prototypes for <dirent.h> wrappers:
*
* #define X_INCLUDE_DIRENT_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xreaddirparams;
*
* struct dirent *_XReaddir(DIR *dir_pointer, _Xreaddirparams);
*/
#if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H)
# include <sys/types.h>
# if !defined(X_NOT_POSIX) || defined(SYSV)
# include <dirent.h>
# else
# include <sys/dir.h>
# ifndef dirent
# define dirent direct
# endif
# endif
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI)
# define XOS_USE_MTSAFE_DIRENTAPI 1
# endif
#endif
#if !defined(X_INCLUDE_DIRENT_H) || defined(_XOS_INCLUDED_DIRENT_H)
/* Do nothing. */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
typedef int _Xreaddirparams; /* dummy */
# define _XReaddir(d,p) readdir(d)
#elif !defined(XOS_USE_MTSAFE_DIRENTAPI) || defined(XNO_MTSAFE_DIRENTAPI)
/* Systems with thread support but no _r API. */
typedef struct {
struct dirent *result;
struct dirent dir_entry;
# ifdef _POSIX_PATH_MAX
char buf[_POSIX_PATH_MAX];
# elif defined(NAME_MAX)
char buf[NAME_MAX];
# else
char buf[255];
# endif
} _Xreaddirparams;
# define _XReaddir(d,p) \
( (_Xos_processLock), \
(((p).result = readdir((d))) ? \
(memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \
((p).result = &(p).dir_entry), 0) : \
0), \
(_Xos_processUnlock), \
(p).result )
#else
typedef struct {
struct dirent *result;
struct dirent dir_entry;
# ifdef _POSIX_PATH_MAX
char buf[_POSIX_PATH_MAX];
# elif defined(NAME_MAX)
char buf[NAME_MAX];
# else
char buf[255];
# endif
} _Xreaddirparams;
# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(__APPLE__)
/* POSIX final API, returns (int)0 on success. */
# define _XReaddir(d,p) \
(readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result)
# elif defined(_POSIX_REENTRANT_FUNCTIONS)
/* POSIX draft API, returns (int)0 on success. */
# define _XReaddir(d,p) \
(readdir_r((d),&((p).dir_entry)) ? NULL : &((p).dir_entry))
# elif defined(SVR4)
/* Pre-POSIX API, returns non-NULL on success. */
# define _XReaddir(d,p) (readdir_r((d), &(p).dir_entry))
# else
/* We have no idea what is going on. Fake it all using process locks. */
# define _XReaddir(d,p) \
( (_Xos_processLock), \
(((p).result = readdir((d))) ? \
(memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \
((p).result = &(p).dir_entry), 0) : \
0), \
(_Xos_processUnlock), \
(p).result )
# endif
#endif /* X_INCLUDE_DIRENT_H */
#if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H)
# define _XOS_INCLUDED_DIRENT_H
#endif
/***** <unistd.h> wrappers *****/
/*
* Effective prototypes for <unistd.h> wrappers:
*
* #define X_INCLUDE_UNISTD_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xgetloginparams;
* typedef ... _Xttynameparams;
*
* char *_XGetlogin(_Xgetloginparams);
* char *_XTtyname(int, _Xttynameparams);
*/
#if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H)
/* <unistd.h> already included by <X11/Xos.h> */
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI)
# define XOS_USE_MTSAFE_UNISTDAPI 1
# endif
#endif
#if !defined(X_INCLUDE_UNISTD_H) || defined(_XOS_INCLUDED_UNISTD_H)
/* Do nothing. */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
typedef int _Xgetloginparams; /* dummy */
typedef int _Xttynameparams; /* dummy */
# define _XGetlogin(p) getlogin()
# define _XTtyname(f) ttyname((f))
#elif !defined(XOS_USE_MTSAFE_UNISTDAPI) || defined(XNO_MTSAFE_UNISTDAPI)
/* Systems with thread support but no _r API. */
typedef struct {
char *result;
# if defined(MAXLOGNAME)
char buf[MAXLOGNAME];
# elif defined(LOGIN_NAME_MAX)
char buf[LOGIN_NAME_MAX];
# else
char buf[64];
# endif
} _Xgetloginparams;
typedef struct {
char *result;
# ifdef TTY_NAME_MAX
char buf[TTY_NAME_MAX];
# elif defined(_POSIX_TTY_NAME_MAX)
char buf[_POSIX_TTY_NAME_MAX];
# elif defined(_POSIX_PATH_MAX)
char buf[_POSIX_PATH_MAX];
# else
char buf[256];
# endif
} _Xttynameparams;
# define _XGetlogin(p) \
( (_Xos_processLock), \
(((p).result = getlogin()) ? \
(strncpy((p).buf, (p).result, sizeof((p).buf)), \
((p).buf[sizeof((p).buf)-1] = '\0'), \
((p).result = (p).buf), 0) : 0), \
(_Xos_processUnlock), \
(p).result )
#define _XTtyname(f,p) \
( (_Xos_processLock), \
(((p).result = ttyname(f)) ? \
(strncpy((p).buf, (p).result, sizeof((p).buf)), \
((p).buf[sizeof((p).buf)-1] = '\0'), \
((p).result = (p).buf), 0) : 0), \
(_Xos_processUnlock), \
(p).result )
#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_POSIX_REENTRANT_FUNCTIONS)
/* POSIX API.
*
* extern int getlogin_r(char *, size_t);
* extern int ttyname_r(int, char *, size_t);
*/
typedef struct {
# if defined(MAXLOGNAME)
char buf[MAXLOGNAME];
# elif defined(LOGIN_NAME_MAX)
char buf[LOGIN_NAME_MAX];
# else
char buf[64];
# endif
} _Xgetloginparams;
typedef struct {
# ifdef TTY_NAME_MAX
char buf[TTY_NAME_MAX];
# elif defined(_POSIX_TTY_NAME_MAX)
char buf[_POSIX_TTY_NAME_MAX];
# elif defined(_POSIX_PATH_MAX)
char buf[_POSIX_PATH_MAX];
# else
char buf[256];
# endif
} _Xttynameparams;
# define _XGetlogin(p) (getlogin_r((p).buf, sizeof((p).buf)) ? NULL : (p).buf)
# define _XTtyname(f,p) \
(ttyname_r((f), (p).buf, sizeof((p).buf)) ? NULL : (p).buf)
#else
/* Pre-POSIX API.
*
* extern char *getlogin_r(char *, size_t);
* extern char *ttyname_r(int, char *, size_t);
*/
typedef struct {
# if defined(MAXLOGNAME)
char buf[MAXLOGNAME];
# elif defined(LOGIN_NAME_MAX)
char buf[LOGIN_NAME_MAX];
# else
char buf[64];
# endif
} _Xgetloginparams;
typedef struct {
# ifdef TTY_NAME_MAX
char buf[TTY_NAME_MAX];
# elif defined(_POSIX_TTY_NAME_MAX)
char buf[_POSIX_TTY_NAME_MAX];
# elif defined(_POSIX_PATH_MAX)
char buf[_POSIX_PATH_MAX];
# else
char buf[256];
# endif
} _Xttynameparams;
# define _XGetlogin(p) getlogin_r((p).buf, sizeof((p).buf))
# define _XTtyname(f,p) ttyname_r((f), (p).buf, sizeof((p).buf))
#endif /* X_INCLUDE_UNISTD_H */
#if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H)
# define _XOS_INCLUDED_UNISTD_H
#endif
/***** <string.h> wrappers *****/
/*
* Effective prototypes for <string.h> wrappers:
*
* #define X_INCLUDE_STRING_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xstrtokparams;
*
* char *_XStrtok(char *, const char*, _Xstrtokparams);
*/
#if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H)
/* <string.h> has already been included by <X11/Xos.h> */
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI)
# define XOS_USE_MTSAFE_STRINGAPI 1
# endif
#endif
#if !defined(X_INCLUDE_STRING_H) || defined(_XOS_INCLUDED_STRING_H)
/* Do nothing. */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
typedef int _Xstrtokparams; /* dummy */
# define _XStrtok(s1,s2,p) \
( p = 0, (void)p, strtok((s1),(s2)) )
#elif !defined(XOS_USE_MTSAFE_STRINGAPI) || defined(XNO_MTSAFE_STRINGAPI)
/* Systems with thread support but no _r API. */
typedef char *_Xstrtokparams;
# define _XStrtok(s1,s2,p) \
( (_Xos_processLock), \
((p) = strtok((s1),(s2))), \
(_Xos_processUnlock), \
(p) )
#else
/* POSIX or pre-POSIX API. */
typedef char * _Xstrtokparams;
# define _XStrtok(s1,s2,p) strtok_r((s1),(s2),&(p))
#endif /* X_INCLUDE_STRING_H */
/***** <time.h> wrappers *****/
/*
* Effective prototypes for <time.h> wrappers:
*
* #define X_INCLUDE_TIME_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xatimeparams;
* typedef ... _Xctimeparams;
* typedef ... _Xgtimeparams;
* typedef ... _Xltimeparams;
*
* char *_XAsctime(const struct tm *, _Xatimeparams);
* char *_XCtime(const time_t *, _Xctimeparams);
* struct tm *_XGmtime(const time_t *, _Xgtimeparams);
* struct tm *_XLocaltime(const time_t *, _Xltimeparams);
*/
#if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H)
# include <time.h>
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI)
# define XOS_USE_MTSAFE_TIMEAPI 1
# endif
#endif
#if !defined(X_INCLUDE_TIME_H) || defined(_XOS_INCLUDED_TIME_H)
/* Do nothing. */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
typedef int _Xatimeparams; /* dummy */
# define _XAsctime(t,p) asctime((t))
typedef int _Xctimeparams; /* dummy */
# define _XCtime(t,p) ctime((t))
typedef int _Xgtimeparams; /* dummy */
# define _XGmtime(t,p) gmtime((t))
typedef int _Xltimeparams; /* dummy */
# define _XLocaltime(t,p) localtime((t))
#elif !defined(XOS_USE_MTSAFE_TIMEAPI) || defined(XNO_MTSAFE_TIMEAPI)
/* Systems with thread support but no _r API. */
typedef struct {
# ifdef TIMELEN
char buf[TIMELEN];
# else
char buf[26];
# endif
char *result;
} _Xctimeparams, _Xatimeparams;
typedef struct {
struct tm buf;
struct tm *result;
} _Xgtimeparams, _Xltimeparams;
# define _XAsctime(t,p) \
( (_Xos_processLock), \
(((p).result = asctime((t))) ? \
(strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
0), \
(_Xos_processUnlock), \
(p).result )
# define _XCtime(t,p) \
( (_Xos_processLock), \
(((p).result = ctime((t))) ? \
(strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
0), \
(_Xos_processUnlock), \
(p).result )
# define _XGmtime(t,p) \
( (_Xos_processLock), \
(((p).result = gmtime(t)) ? \
(memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
0), \
(_Xos_processUnlock), \
(p).result )
# define _XLocaltime(t,p) \
( (_Xos_processLock), \
(((p).result = localtime(t)) ? \
(memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \
0), \
(_Xos_processUnlock), \
(p).result )
#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(hpV4)
/* Returns (int)0 on success.
*
* extern int asctime_r(const struct tm *timeptr, char *buffer, int buflen);
* extern int ctime_r(const time_t *timer, char *buffer, int buflen);
* extern int gmtime_r(const time_t *timer, struct tm *result);
* extern int localtime_r(const time_t *timer, struct tm *result);
*/
# ifdef TIMELEN
typedef char _Xatimeparams[TIMELEN];
typedef char _Xctimeparams[TIMELEN];
# else
typedef char _Xatimeparams[26];
typedef char _Xctimeparams[26];
# endif
typedef struct tm _Xgtimeparams;
typedef struct tm _Xltimeparams;
# define _XAsctime(t,p) (asctime_r((t),(p),sizeof((p))) ? NULL : (p))
# define _XCtime(t,p) (ctime_r((t),(p),sizeof((p))) ? NULL : (p))
# define _XGmtime(t,p) (gmtime_r((t),&(p)) ? NULL : &(p))
# define _XLocaltime(t,p) (localtime_r((t),&(p)) ? NULL : &(p))
#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun)
/* Returns NULL on failure. Solaris 2.5
*
* extern char *asctime_r(const struct tm *tm,char *buf, int buflen);
* extern char *ctime_r(const time_t *clock, char *buf, int buflen);
* extern struct tm *gmtime_r(const time_t *clock, struct tm *res);
* extern struct tm *localtime_r(const time_t *clock, struct tm *res);
*/
# ifdef TIMELEN
typedef char _Xatimeparams[TIMELEN];
typedef char _Xctimeparams[TIMELEN];
# else
typedef char _Xatimeparams[26];
typedef char _Xctimeparams[26];
# endif
typedef struct tm _Xgtimeparams;
typedef struct tm _Xltimeparams;
# define _XAsctime(t,p) asctime_r((t),(p),sizeof((p)))
# define _XCtime(t,p) ctime_r((t),(p),sizeof((p)))
# define _XGmtime(t,p) gmtime_r((t),&(p))
# define _XLocaltime(t,p) localtime_r((t),&(p))
#else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */
/* POSIX final API.
* extern char *asctime_r(const struct tm *timeptr, char *buffer);
* extern char *ctime_r(const time_t *timer, char *buffer);
* extern struct tm *gmtime_r(const time_t *timer, struct tm *result);
* extern struct tm *localtime_r(const time_t *timer, struct tm *result);
*/
# ifdef TIMELEN
typedef char _Xatimeparams[TIMELEN];
typedef char _Xctimeparams[TIMELEN];
# else
typedef char _Xatimeparams[26];
typedef char _Xctimeparams[26];
# endif
typedef struct tm _Xgtimeparams;
typedef struct tm _Xltimeparams;
# define _XAsctime(t,p) asctime_r((t),(p))
# define _XCtime(t,p) ctime_r((t),(p))
# define _XGmtime(t,p) gmtime_r((t),&(p))
# define _XLocaltime(t,p) localtime_r((t),&(p))
#endif /* X_INCLUDE_TIME_H */
#if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H)
# define _XOS_INCLUDED_TIME_H
#endif
/***** <grp.h> wrappers *****/
/*
* Effective prototypes for <grp.h> wrappers:
*
* NOTE: On systems lacking appropriate _r functions Getgrgid() and
* Getgrnam() do NOT copy the list of group members!
*
* Remember that fgetgrent(), setgrent(), getgrent(), and endgrent()
* are not included in POSIX.
*
* #define X_INCLUDE_GRP_H
* #define XOS_USE_..._LOCKING
* #include <X11/Xos_r.h>
*
* typedef ... _Xgetgrparams;
*
* struct group *_XGetgrgid(gid_t, _Xgetgrparams);
* struct group *_XGetgrnam(const char *, _Xgetgrparams);
*/
#if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H)
# include <grp.h>
# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI)
# define XOS_USE_MTSAFE_GRPAPI 1
# endif
#endif
#if !defined(X_INCLUDE_GRP_H) || defined(_XOS_INCLUDED_GRP_H)
/* Do nothing. */
#elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API)
/* Use regular, unsafe API. */
typedef int _Xgetgrparams; /* dummy */
#define _XGetgrgid(g,p) getgrgid((g))
#define _XGetgrnam(n,p) getgrnam((n))
#elif !defined(XOS_USE_MTSAFE_GRPAPI) || defined(XNO_MTSAFE_GRPAPI)
/* Systems with thread support but no _r API. UnixWare 2.0. */
typedef struct {
struct group grp;
char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
struct group *pgrp;
size_t len;
} _Xgetgrparams;
#ifdef SVR4
/* Copy the gr_passwd field too. */
# define _Xgrp_copyGroup(p) \
( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \
((p).grp.gr_name = (p).buf), \
((p).len = strlen((p).pgrp->gr_name)), \
strcpy((p).grp.gr_name, (p).pgrp->gr_name), \
((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \
((p).pgrp = &(p).grp), \
0 )
#else
# define _Xgrp_copyGroup(p) \
( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \
((p).grp.gr_name = (p).buf), \
strcpy((p).grp.gr_name, (p).pgrp->gr_name), \
((p).pgrp = &(p).grp), \
0 )
#endif
#define _XGetgrgid(g,p) \
( (_Xos_processLock), \
(((p).pgrp = getgrgid((g))) ? _Xgrp_copyGroup(p) : 0), \
(_Xos_processUnlock), \
(p).pgrp )
#define _XGetgrnam(n,p) \
( (_Xos_processLock), \
(((p).pgrp = getgrnam((n))) ? _Xgrp_copyGroup(p) : 0), \
(_Xos_processUnlock), \
(p).pgrp )
#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun)
/* Non-POSIX API. Solaris.
*
* extern struct group *getgrgid_r(gid_t, struct group *, char *, int);
* extern struct group *getgrnam_r(const char *, struct group *, char *, int);
*/
typedef struct {
struct group grp;
char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
} _Xgetgrparams;
#define _XGetgrgid(g,p) getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf))
#define _XGetgrnam(n,p) getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf))
#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
/* Non-POSIX API.
* extern int getgrgid_r(gid_t, struct group *, char *, int);
* extern int getgrnam_r(const char *, struct group *, char *, int);
*/
typedef struct {
struct group grp;
char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
} _Xgetgrparams;
#define _XGetgrgid(g,p) \
((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp))
#define _XGetgrnam(n,p) \
((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp))
#else
/* POSIX final API.
*
* int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
* int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
*/
typedef struct {
struct group grp;
char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */
struct group *result;
} _Xgetgrparams;
#define _XGetgrgid(g,p) \
((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \
NULL : (p).result))
#define _XGetgrnam(n,p) \
((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \
NULL : (p).result))
#endif
#if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H)
# define _XOS_INCLUDED_GRP_H
#endif
#ifdef __cplusplus
} /* Close scope of 'extern "C"' declaration which encloses file. */
#endif
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* TranslateI.h - Header file private to translation management
*
* Author: Gabe Beged-Dov, HP
*
* Former Author: Charles Haynes
* Digital Equipment Corporation
* Western Research Laboratory
* Date: Sat Aug 29 1987
*/
/*#define REFCNT_TRANSLATIONS*/
#define CACHE_TRANSLATIONS
#define TM_NO_MATCH (-2)
#define _XtRStateTablePair "_XtStateTablePair"
typedef unsigned char TMByteCard;
typedef unsigned short TMShortCard;
typedef unsigned long TMLongCard;
typedef short TMShortInt;
typedef struct _TMTypeMatchRec *TMTypeMatch;
typedef struct _TMModifierMatchRec *TMModifierMatch;
typedef struct _TMEventRec *TMEventPtr;
typedef Boolean (*MatchProc)(TMTypeMatch typeMatch,
TMModifierMatch modMatch,
TMEventPtr eventSeq);
typedef struct _ModToKeysymTable {
Modifiers mask;
int count;
int idx;
} ModToKeysymTable;
typedef struct _LateBindings {
unsigned int knot:1;
unsigned int pair:1;
unsigned short ref_count; /* garbage collection */
KeySym keysym;
} LateBindings, *LateBindingsPtr;
typedef short ModifierMask;
typedef struct _ActionsRec *ActionPtr;
typedef struct _ActionsRec {
int idx; /* index into quarkTable to find proc */
String *params; /* pointer to array of params */
Cardinal num_params; /* number of params */
ActionPtr next; /* next action to perform */
} ActionRec;
typedef struct _XtStateRec *StatePtr;
typedef struct _XtStateRec {
unsigned int isCycleStart:1;
unsigned int isCycleEnd:1;
TMShortCard typeIndex;
TMShortCard modIndex;
ActionPtr actions; /* rhs list of actions to perform */
StatePtr nextLevel;
}StateRec;
#define XtTableReplace 0
#define XtTableAugment 1
#define XtTableOverride 2
#define XtTableUnmerge 3
typedef unsigned int _XtTranslateOp;
/*
* New Definitions
*/
typedef struct _TMModifierMatchRec{
TMLongCard modifiers;
TMLongCard modifierMask;
LateBindingsPtr lateModifiers;
Boolean standard;
}TMModifierMatchRec;
typedef struct _TMTypeMatchRec{
TMLongCard eventType;
TMLongCard eventCode;
TMLongCard eventCodeMask;
MatchProc matchEvent;
}TMTypeMatchRec;
typedef struct _TMBranchHeadRec {
unsigned int isSimple:1;
unsigned int hasActions:1;
unsigned int hasCycles:1;
unsigned int more:13;
TMShortCard typeIndex;
TMShortCard modIndex;
}TMBranchHeadRec, *TMBranchHead;
/* NOTE: elements of this structure must match those of
* TMComplexStateTreeRec and TMParseStateTreeRec.
*/
typedef struct _TMSimpleStateTreeRec{
unsigned int isSimple:1;
unsigned int isAccelerator:1;
unsigned int mappingNotifyInterest:1;
unsigned int refCount:13;
TMShortCard numBranchHeads;
TMShortCard numQuarks; /* # of entries in quarkTbl */
TMShortCard unused; /* to ensure same alignment */
TMBranchHeadRec *branchHeadTbl;
XrmQuark *quarkTbl; /* table of quarkified rhs*/
}TMSimpleStateTreeRec, *TMSimpleStateTree;
/* NOTE: elements of this structure must match those of
* TMSimpleStateTreeRec and TMParseStateTreeRec.
*/
typedef struct _TMComplexStateTreeRec{
unsigned int isSimple:1;
unsigned int isAccelerator:1;
unsigned int mappingNotifyInterest:1;
unsigned int refCount:13;
TMShortCard numBranchHeads;
TMShortCard numQuarks; /* # of entries in quarkTbl */
TMShortCard numComplexBranchHeads;
TMBranchHeadRec *branchHeadTbl;
XrmQuark *quarkTbl; /* table of quarkified rhs*/
StatePtr *complexBranchHeadTbl;
}TMComplexStateTreeRec, *TMComplexStateTree;
/* NOTE: elements of this structure must match those of
* TMSimpleStateTreeRec and TMComplexStateTreeRec.
*/
typedef struct _TMParseStateTreeRec{
unsigned int isSimple:1;
unsigned int isAccelerator:1;
unsigned int mappingNotifyInterest:1;
unsigned int isStackQuarks:1;
unsigned int isStackBranchHeads:1;
unsigned int isStackComplexBranchHeads:1;
unsigned int unused:10; /* to ensure correct alignment */
TMShortCard numBranchHeads;
TMShortCard numQuarks; /* # of entries in quarkTbl */
TMShortCard numComplexBranchHeads;
TMBranchHeadRec *branchHeadTbl;
XrmQuark *quarkTbl; /* table of quarkified rhs*/
StatePtr *complexBranchHeadTbl;
TMShortCard branchHeadTblSize;
TMShortCard quarkTblSize; /*total size of quarkTbl */
TMShortCard complexBranchHeadTblSize;
StatePtr head;
}TMParseStateTreeRec, *TMParseStateTree;
typedef union _TMStateTreeRec{
TMSimpleStateTreeRec simple;
TMParseStateTreeRec parse;
TMComplexStateTreeRec complex;
}*TMStateTree, **TMStateTreePtr, **TMStateTreeList;
typedef struct _TMSimpleBindProcsRec {
XtActionProc *procs;
}TMSimpleBindProcsRec, *TMSimpleBindProcs;
typedef struct _TMComplexBindProcsRec {
Widget widget; /*widgetID to pass to action Proc*/
XtTranslations aXlations;
XtActionProc *procs;
}TMComplexBindProcsRec, *TMComplexBindProcs;
typedef struct _TMSimpleBindDataRec {
unsigned int isComplex:1; /* must be first */
TMSimpleBindProcsRec bindTbl[1]; /* variable length */
}TMSimpleBindDataRec, *TMSimpleBindData;
typedef struct _TMComplexBindDataRec {
unsigned int isComplex:1; /* must be first */
struct _ATranslationData *accel_context; /* for GetValues */
TMComplexBindProcsRec bindTbl[1]; /* variable length */
}TMComplexBindDataRec, *TMComplexBindData;
typedef union _TMBindDataRec{
TMSimpleBindDataRec simple;
TMComplexBindDataRec complex;
}*TMBindData;
typedef struct _TranslationData{
unsigned char hasBindings; /* must be first */
unsigned char operation; /*replace,augment,override*/
TMShortCard numStateTrees;
struct _TranslationData *composers[2];
EventMask eventMask;
TMStateTree stateTreeTbl[1]; /* variable length */
}TranslationData;
/*
* ATranslations is returned by GetValues for translations that contain
* accelerators. The TM can differentiate between this and TranslationData
* (that don't have a bindTbl) by looking at the first field (hasBindings)
* of either structure. All ATranslationData structures associated with a
* widget are chained off the BindData record of the widget.
*/
typedef struct _ATranslationData{
unsigned char hasBindings; /* must be first */
unsigned char operation;
struct _TranslationData *xlations; /* actual translations */
struct _ATranslationData *next; /* chain the contexts together */
TMComplexBindProcsRec bindTbl[1]; /* accelerator bindings */
}ATranslationData, *ATranslations;
typedef struct _TMConvertRec {
XtTranslations old; /* table to merge into */
XtTranslations new; /* table to merge from */
} TMConvertRec;
#define _XtEventTimerEventType ((TMLongCard)~0L)
#define KeysymModMask (1L<<27) /* private to TM */
#define AnyButtonMask (1L<<28) /* private to TM */
typedef struct _EventRec {
TMLongCard modifiers;
TMLongCard modifierMask;
LateBindingsPtr lateModifiers;
TMLongCard eventType;
TMLongCard eventCode;
TMLongCard eventCodeMask;
MatchProc matchEvent;
Boolean standard;
} Event;
typedef struct _EventSeqRec *EventSeqPtr;
typedef struct _EventSeqRec {
Event event; /* X event description */
StatePtr state; /* private to state table builder */
EventSeqPtr next; /* next event on line */
ActionPtr actions; /* r.h.s. list of actions to perform */
} EventSeqRec;
typedef EventSeqRec EventRec;
typedef EventSeqPtr EventPtr;
typedef struct _TMEventRec {
XEvent *xev;
Event event;
}TMEventRec;
typedef struct _ActionHookRec {
struct _ActionHookRec* next; /* must remain first */
XtAppContext app;
XtActionHookProc proc;
XtPointer closure;
} ActionHookRec, *ActionHook;
/* choose a number between 2 and 8 */
#define TMKEYCACHELOG2 6
#define TMKEYCACHESIZE (1<<TMKEYCACHELOG2)
typedef struct _KeyCacheRec {
unsigned char modifiers_return[256]; /* constant per KeyCode, key proc */
KeyCode keycode[TMKEYCACHESIZE];
unsigned char modifiers[TMKEYCACHESIZE];
KeySym keysym[TMKEYCACHESIZE];
} TMKeyCache;
typedef struct _TMKeyContextRec {
XEvent *event;
unsigned long serial;
KeySym keysym;
Modifiers modifiers;
TMKeyCache keycache; /* keep this last, to keep offsets to others small */
} TMKeyContextRec, *TMKeyContext;
typedef struct _TMGlobalRec{
TMTypeMatchRec **typeMatchSegmentTbl;
TMShortCard numTypeMatches;
TMShortCard numTypeMatchSegments;
TMShortCard typeMatchSegmentTblSize;
TMModifierMatchRec **modMatchSegmentTbl;
TMShortCard numModMatches;
TMShortCard numModMatchSegments;
TMShortCard modMatchSegmentTblSize;
Boolean newMatchSemantics;
#ifdef TRACE_TM
XtTranslations *tmTbl;
TMShortCard numTms;
TMShortCard tmTblSize;
struct _TMBindCacheRec **bindCacheTbl;
TMShortCard numBindCache;
TMShortCard bindCacheTblSize;
TMShortCard numLateBindings;
TMShortCard numBranchHeads;
TMShortCard numComplexStates;
TMShortCard numComplexActions;
#endif /* TRACE_TM */
}TMGlobalRec;
_XFUNCPROTOBEGIN
extern TMGlobalRec _XtGlobalTM;
#define TM_MOD_SEGMENT_SIZE 16
#define TM_TYPE_SEGMENT_SIZE 16
#define TMGetTypeMatch(idx) \
((TMTypeMatch) \
&((_XtGlobalTM.typeMatchSegmentTbl[((idx) >> 4)])[(idx) & 15]))
#define TMGetModifierMatch(idx) \
((TMModifierMatch) \
&((_XtGlobalTM.modMatchSegmentTbl[(idx) >> 4])[(idx) & 15]))
/* Useful Access Macros */
#define TMNewMatchSemantics() (_XtGlobalTM.newMatchSemantics)
#define TMBranchMore(branch) (branch->more)
#define TMComplexBranchHead(tree, br) \
(((TMComplexStateTree)tree)->complexBranchHeadTbl[TMBranchMore(br)])
#define TMGetComplexBindEntry(bindData, idx) \
((TMComplexBindProcs)&(((TMComplexBindData)bindData)->bindTbl[idx]))
#define TMGetSimpleBindEntry(bindData, idx) \
((TMSimpleBindProcs)&(((TMSimpleBindData)bindData)->bindTbl[idx]))
#define _InitializeKeysymTables(dpy, pd) \
if (pd->keysyms == NULL) \
_XtBuildKeysymTables(dpy, pd)
/*
* Internal Functions
*/
extern void _XtPopup(
Widget /* widget */,
XtGrabKind /* grab_kind */,
_XtBoolean /* spring_loaded */
);
extern String _XtPrintXlations(
Widget /* w */,
XtTranslations /* xlations */,
Widget /* accelWidget */,
_XtBoolean /* includeRHS */
);
extern void _XtRegisterGrabs(
Widget /* widget */
);
extern XtPointer _XtInitializeActionData(
struct _XtActionsRec * /* actions */,
Cardinal /* count */,
_XtBoolean /* inPlace */
);
extern void _XtAddEventSeqToStateTree(
EventSeqPtr /* eventSeq */,
TMParseStateTree /* stateTree */
);
extern Boolean _XtMatchUsingStandardMods(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
);
extern Boolean _XtMatchUsingDontCareMods(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
);
extern Boolean _XtRegularMatch(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
);
extern Boolean _XtMatchAtom(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
);
extern void _XtTranslateEvent(
Widget /* widget */,
XEvent* /* event */
);
#include "CallbackI.h"
#include "EventI.h"
#include "HookObjI.h"
#include "PassivGraI.h"
#include "ThreadsI.h"
#include "InitialI.h"
#include "ResourceI.h"
#include "StringDefs.h"
extern void _XtBuildKeysymTables(Display *dpy, XtPerDisplay pd);
#ifndef NO_MIT_HACKS
extern void _XtDisplayTranslations(
Widget /* widget */,
XEvent* /* event */,
String* /* params */,
Cardinal* /* num_params */
);
extern void _XtDisplayAccelerators(
Widget /* widget */,
XEvent* /* event */,
String* /* params */,
Cardinal* /* num_params */
);
extern void _XtDisplayInstalledAccelerators(
Widget /* widget */,
XEvent* /* event */,
String* /* params */,
Cardinal* /* num_params */
);
#endif /* ifndef NO_MIT_HACKS */
extern void _XtPopupInitialize(
XtAppContext /* app_context */
);
extern void _XtBindActions(
Widget /* widget */,
XtTM /* tm_rec */
);
extern Boolean _XtComputeLateBindings(
Display* /* dpy */,
LateBindingsPtr /* lateModifiers */,
Modifiers* /* computed */,
Modifiers* /* computedMask */
);
extern XtTranslations _XtCreateXlations(
TMStateTree * /* stateTrees */,
TMShortCard /* numStateTrees */,
XtTranslations /* first */,
XtTranslations /* second */
);
extern Boolean _XtCvtMergeTranslations(
Display* /* dpy */,
XrmValuePtr /* args */,
Cardinal* /* num_args */,
XrmValuePtr /* from */,
XrmValuePtr /* to */,
XtPointer* /* closure_ret */
);
void _XtRemoveStateTreeByIndex(
XtTranslations /* xlations */,
TMShortCard /* i */);
void _XtFreeTranslations(
XtAppContext /* app */,
XrmValuePtr /* toVal */,
XtPointer /* closure */,
XrmValuePtr /* args */,
Cardinal* /* num_args */
);
extern TMShortCard _XtGetModifierIndex(
Event* /* event */
);
extern TMShortCard _XtGetQuarkIndex(
TMParseStateTree /* stateTreePtr */,
XrmQuark /* quark */
);
extern XtTranslations _XtGetTranslationValue(
Widget /* widget */
);
extern TMShortCard _XtGetTypeIndex(
Event* /* event */
);
extern void _XtGrabInitialize(
XtAppContext /* app */
);
extern void _XtInstallTranslations(
Widget /* widget */
);
extern void _XtRemoveTranslations(
Widget /* widget */
);
extern void _XtDestroyTMData(
Widget /* widget */
);
extern void _XtMergeTranslations(
Widget /* widget */,
XtTranslations /* newXlations */,
_XtTranslateOp /* operation */
);
extern void _XtActionInitialize(
XtAppContext /* app */
);
extern TMStateTree _XtParseTreeToStateTree(
TMParseStateTree /* parseTree */
);
extern String _XtPrintActions(
ActionRec* /* actions */,
XrmQuark* /* quarkTbl */
);
extern String _XtPrintState(
TMStateTree /* stateTree */,
TMBranchHead /* branchHead */);
extern String _XtPrintEventSeq(
EventSeqPtr /* eventSeq */,
Display* /* dpy */
);
typedef Boolean (*_XtTraversalProc)(
StatePtr /* state */,
XtPointer /* data */
);
extern void _XtTraverseStateTree(
TMStateTree /* tree */,
_XtTraversalProc /* func */,
XtPointer /* data */
);
extern void _XtTranslateInitialize(
void
);
extern void _XtAddTMConverters(
ConverterTable /* table */
);
extern void _XtUnbindActions(
Widget /* widget */,
XtTranslations /* xlations */,
TMBindData /* bindData */
);
extern void _XtUnmergeTranslations(
Widget /* widget */,
XtTranslations /* xlations */
);
/* TMKey.c */
extern void _XtAllocTMContext(XtPerDisplay pd);
_XFUNCPROTOEND
/***********************************************************
Copyright 1987, 1988, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtStringDefs_h_
#define _XtStringDefs_h_
#ifndef XTSTRINGDEFINES
#define _XtStringDefs_h_Const const
#endif
/* $Xorg: makestrs.c,v 1.6 2001/02/09 02:03:17 xorgcvs Exp $ */
/* This file is automatically generated. */
/* Default ABI version -- Do not edit */
#ifdef XTSTRINGDEFINES
#define XtNaccelerators "accelerators"
#define XtNallowHoriz "allowHoriz"
#define XtNallowVert "allowVert"
#define XtNancestorSensitive "ancestorSensitive"
#define XtNbackground "background"
#define XtNbackgroundPixmap "backgroundPixmap"
#define XtNbitmap "bitmap"
#define XtNborderColor "borderColor"
#define XtNborder "borderColor"
#define XtNborderPixmap "borderPixmap"
#define XtNborderWidth "borderWidth"
#define XtNcallback "callback"
#define XtNchildren "children"
#define XtNcolormap "colormap"
#define XtNdepth "depth"
#define XtNdestroyCallback "destroyCallback"
#define XtNeditType "editType"
#define XtNfile "file"
#define XtNfont "font"
#define XtNforceBars "forceBars"
#define XtNforeground "foreground"
#define XtNfunction "function"
#define XtNheight "height"
#define XtNhighlight "highlight"
#define XtNhSpace "hSpace"
#define XtNindex "index"
#define XtNinitialResourcesPersistent "initialResourcesPersistent"
#define XtNinnerHeight "innerHeight"
#define XtNinnerWidth "innerWidth"
#define XtNinnerWindow "innerWindow"
#define XtNinsertPosition "insertPosition"
#define XtNinternalHeight "internalHeight"
#define XtNinternalWidth "internalWidth"
#define XtNjumpProc "jumpProc"
#define XtNjustify "justify"
#define XtNknobHeight "knobHeight"
#define XtNknobIndent "knobIndent"
#define XtNknobPixel "knobPixel"
#define XtNknobWidth "knobWidth"
#define XtNlabel "label"
#define XtNlength "length"
#define XtNlowerRight "lowerRight"
#define XtNmappedWhenManaged "mappedWhenManaged"
#define XtNmenuEntry "menuEntry"
#define XtNname "name"
#define XtNnotify "notify"
#define XtNnumChildren "numChildren"
#define XtNorientation "orientation"
#define XtNparameter "parameter"
#define XtNpixmap "pixmap"
#define XtNpopupCallback "popupCallback"
#define XtNpopdownCallback "popdownCallback"
#define XtNresize "resize"
#define XtNreverseVideo "reverseVideo"
#define XtNscreen "screen"
#define XtNscrollProc "scrollProc"
#define XtNscrollDCursor "scrollDCursor"
#define XtNscrollHCursor "scrollHCursor"
#define XtNscrollLCursor "scrollLCursor"
#define XtNscrollRCursor "scrollRCursor"
#define XtNscrollUCursor "scrollUCursor"
#define XtNscrollVCursor "scrollVCursor"
#define XtNselection "selection"
#define XtNselectionArray "selectionArray"
#define XtNsensitive "sensitive"
#define XtNshown "shown"
#define XtNspace "space"
#define XtNstring "string"
#define XtNtextOptions "textOptions"
#define XtNtextSink "textSink"
#define XtNtextSource "textSource"
#define XtNthickness "thickness"
#define XtNthumb "thumb"
#define XtNthumbProc "thumbProc"
#define XtNtop "top"
#define XtNtranslations "translations"
#define XtNunrealizeCallback "unrealizeCallback"
#define XtNupdate "update"
#define XtNuseBottom "useBottom"
#define XtNuseRight "useRight"
#define XtNvalue "value"
#define XtNvSpace "vSpace"
#define XtNwidth "width"
#define XtNwindow "window"
#define XtNx "x"
#define XtNy "y"
#define XtCAccelerators "Accelerators"
#define XtCBackground "Background"
#define XtCBitmap "Bitmap"
#define XtCBoolean "Boolean"
#define XtCBorderColor "BorderColor"
#define XtCBorderWidth "BorderWidth"
#define XtCCallback "Callback"
#define XtCColormap "Colormap"
#define XtCColor "Color"
#define XtCCursor "Cursor"
#define XtCDepth "Depth"
#define XtCEditType "EditType"
#define XtCEventBindings "EventBindings"
#define XtCFile "File"
#define XtCFont "Font"
#define XtCForeground "Foreground"
#define XtCFraction "Fraction"
#define XtCFunction "Function"
#define XtCHeight "Height"
#define XtCHSpace "HSpace"
#define XtCIndex "Index"
#define XtCInitialResourcesPersistent "InitialResourcesPersistent"
#define XtCInsertPosition "InsertPosition"
#define XtCInterval "Interval"
#define XtCJustify "Justify"
#define XtCKnobIndent "KnobIndent"
#define XtCKnobPixel "KnobPixel"
#define XtCLabel "Label"
#define XtCLength "Length"
#define XtCMappedWhenManaged "MappedWhenManaged"
#define XtCMargin "Margin"
#define XtCMenuEntry "MenuEntry"
#define XtCNotify "Notify"
#define XtCOrientation "Orientation"
#define XtCParameter "Parameter"
#define XtCPixmap "Pixmap"
#define XtCPosition "Position"
#define XtCReadOnly "ReadOnly"
#define XtCResize "Resize"
#define XtCReverseVideo "ReverseVideo"
#define XtCScreen "Screen"
#define XtCScrollProc "ScrollProc"
#define XtCScrollDCursor "ScrollDCursor"
#define XtCScrollHCursor "ScrollHCursor"
#define XtCScrollLCursor "ScrollLCursor"
#define XtCScrollRCursor "ScrollRCursor"
#define XtCScrollUCursor "ScrollUCursor"
#define XtCScrollVCursor "ScrollVCursor"
#define XtCSelection "Selection"
#define XtCSensitive "Sensitive"
#define XtCSelectionArray "SelectionArray"
#define XtCSpace "Space"
#define XtCString "String"
#define XtCTextOptions "TextOptions"
#define XtCTextPosition "TextPosition"
#define XtCTextSink "TextSink"
#define XtCTextSource "TextSource"
#define XtCThickness "Thickness"
#define XtCThumb "Thumb"
#define XtCTranslations "Translations"
#define XtCValue "Value"
#define XtCVSpace "VSpace"
#define XtCWidth "Width"
#define XtCWindow "Window"
#define XtCX "X"
#define XtCY "Y"
#define XtRAcceleratorTable "AcceleratorTable"
#ifndef XtRAtom
#define XtRAtom "Atom"
#endif
#define XtRBitmap "Bitmap"
#define XtRBool "Bool"
#define XtRBoolean "Boolean"
#define XtRCallback "Callback"
#define XtRCallProc "CallProc"
#define XtRCardinal "Cardinal"
#define XtRColor "Color"
#define XtRColormap "Colormap"
#define XtRCursor "Cursor"
#define XtRDimension "Dimension"
#define XtRDisplay "Display"
#define XtREditMode "EditMode"
#define XtREnum "Enum"
#define XtRFile "File"
#define XtRFloat "Float"
#define XtRFont "Font"
#define XtRFontStruct "FontStruct"
#define XtRFunction "Function"
#define XtRGeometry "Geometry"
#define XtRImmediate "Immediate"
#define XtRInitialState "InitialState"
#define XtRInt "Int"
#define XtRJustify "Justify"
#define XtRLongBoolean "Bool"
#define XtRObject "Object"
#define XtROrientation "Orientation"
#define XtRPixel "Pixel"
#define XtRPixmap "Pixmap"
#define XtRPointer "Pointer"
#define XtRPosition "Position"
#define XtRScreen "Screen"
#define XtRShort "Short"
#define XtRString "String"
#define XtRStringArray "StringArray"
#define XtRStringTable "StringTable"
#define XtRUnsignedChar "UnsignedChar"
#define XtRTranslationTable "TranslationTable"
#define XtRVisual "Visual"
#define XtRWidget "Widget"
#define XtRWidgetClass "WidgetClass"
#define XtRWidgetList "WidgetList"
#define XtRWindow "Window"
#define XtEoff "off"
#define XtEfalse "false"
#define XtEno "no"
#define XtEon "on"
#define XtEtrue "true"
#define XtEyes "yes"
#define XtEvertical "vertical"
#define XtEhorizontal "horizontal"
#define XtEtextRead "read"
#define XtEtextAppend "append"
#define XtEtextEdit "edit"
#define XtExtdefaultbackground "xtdefaultbackground"
#define XtExtdefaultforeground "xtdefaultforeground"
#define XtExtdefaultfont "xtdefaultfont"
#define XtNfontSet "fontSet"
#define XtRFontSet "FontSet"
#define XtCFontSet "FontSet"
#define XtRGravity "Gravity"
#define XtNcreateHook "createHook"
#define XtNchangeHook "changeHook"
#define XtNconfigureHook "configureHook"
#define XtNgeometryHook "geometryHook"
#define XtNdestroyHook "destroyHook"
#define XtNshells "shells"
#define XtNnumShells "numShells"
#define XtRCommandArgArray "CommandArgArray"
#define XtRDirectoryString "DirectoryString"
#define XtREnvironmentArray "EnvironmentArray"
#define XtRRestartStyle "RestartStyle"
#define XtRSmcConn "SmcConn"
#define XtHcreate "Xtcreate"
#define XtHsetValues "XtsetValues"
#define XtHmanageChildren "XtmanageChildren"
#define XtHunmanageChildren "XtunmanageChildren"
#define XtHmanageSet "XtmanageSet"
#define XtHunmanageSet "XtunmanageSet"
#define XtHrealizeWidget "XtrealizeWidget"
#define XtHunrealizeWidget "XtunrealizeWidget"
#define XtHaddCallback "XtaddCallback"
#define XtHaddCallbacks "XtaddCallbacks"
#define XtHremoveCallback "XtremoveCallback"
#define XtHremoveCallbacks "XtremoveCallbacks"
#define XtHremoveAllCallbacks "XtremoveAllCallbacks"
#define XtHaugmentTranslations "XtaugmentTranslations"
#define XtHoverrideTranslations "XtoverrideTranslations"
#define XtHuninstallTranslations "XtuninstallTranslations"
#define XtHsetKeyboardFocus "XtsetKeyboardFocus"
#define XtHsetWMColormapWindows "XtsetWMColormapWindows"
#define XtHsetMappedWhenManaged "XtsetMappedWhenManaged"
#define XtHmapWidget "XtmapWidget"
#define XtHunmapWidget "XtunmapWidget"
#define XtHpopup "Xtpopup"
#define XtHpopupSpringLoaded "XtpopupSpringLoaded"
#define XtHpopdown "Xtpopdown"
#define XtHconfigure "Xtconfigure"
#define XtHpreGeometry "XtpreGeometry"
#define XtHpostGeometry "XtpostGeometry"
#define XtHdestroy "Xtdestroy"
#else
extern _XtStringDefs_h_Const char XtStrings[];
#ifndef XtNaccelerators
#define XtNaccelerators ((char*)&XtStrings[0])
#endif
#ifndef XtNallowHoriz
#define XtNallowHoriz ((char*)&XtStrings[13])
#endif
#ifndef XtNallowVert
#define XtNallowVert ((char*)&XtStrings[24])
#endif
#ifndef XtNancestorSensitive
#define XtNancestorSensitive ((char*)&XtStrings[34])
#endif
#ifndef XtNbackground
#define XtNbackground ((char*)&XtStrings[52])
#endif
#ifndef XtNbackgroundPixmap
#define XtNbackgroundPixmap ((char*)&XtStrings[63])
#endif
#ifndef XtNbitmap
#define XtNbitmap ((char*)&XtStrings[80])
#endif
#ifndef XtNborderColor
#define XtNborderColor ((char*)&XtStrings[87])
#endif
#ifndef XtNborder
#define XtNborder ((char*)&XtStrings[99])
#endif
#ifndef XtNborderPixmap
#define XtNborderPixmap ((char*)&XtStrings[111])
#endif
#ifndef XtNborderWidth
#define XtNborderWidth ((char*)&XtStrings[124])
#endif
#ifndef XtNcallback
#define XtNcallback ((char*)&XtStrings[136])
#endif
#ifndef XtNchildren
#define XtNchildren ((char*)&XtStrings[145])
#endif
#ifndef XtNcolormap
#define XtNcolormap ((char*)&XtStrings[154])
#endif
#ifndef XtNdepth
#define XtNdepth ((char*)&XtStrings[163])
#endif
#ifndef XtNdestroyCallback
#define XtNdestroyCallback ((char*)&XtStrings[169])
#endif
#ifndef XtNeditType
#define XtNeditType ((char*)&XtStrings[185])
#endif
#ifndef XtNfile
#define XtNfile ((char*)&XtStrings[194])
#endif
#ifndef XtNfont
#define XtNfont ((char*)&XtStrings[199])
#endif
#ifndef XtNforceBars
#define XtNforceBars ((char*)&XtStrings[204])
#endif
#ifndef XtNforeground
#define XtNforeground ((char*)&XtStrings[214])
#endif
#ifndef XtNfunction
#define XtNfunction ((char*)&XtStrings[225])
#endif
#ifndef XtNheight
#define XtNheight ((char*)&XtStrings[234])
#endif
#ifndef XtNhighlight
#define XtNhighlight ((char*)&XtStrings[241])
#endif
#ifndef XtNhSpace
#define XtNhSpace ((char*)&XtStrings[251])
#endif
#ifndef XtNindex
#define XtNindex ((char*)&XtStrings[258])
#endif
#ifndef XtNinitialResourcesPersistent
#define XtNinitialResourcesPersistent ((char*)&XtStrings[264])
#endif
#ifndef XtNinnerHeight
#define XtNinnerHeight ((char*)&XtStrings[291])
#endif
#ifndef XtNinnerWidth
#define XtNinnerWidth ((char*)&XtStrings[303])
#endif
#ifndef XtNinnerWindow
#define XtNinnerWindow ((char*)&XtStrings[314])
#endif
#ifndef XtNinsertPosition
#define XtNinsertPosition ((char*)&XtStrings[326])
#endif
#ifndef XtNinternalHeight
#define XtNinternalHeight ((char*)&XtStrings[341])
#endif
#ifndef XtNinternalWidth
#define XtNinternalWidth ((char*)&XtStrings[356])
#endif
#ifndef XtNjumpProc
#define XtNjumpProc ((char*)&XtStrings[370])
#endif
#ifndef XtNjustify
#define XtNjustify ((char*)&XtStrings[379])
#endif
#ifndef XtNknobHeight
#define XtNknobHeight ((char*)&XtStrings[387])
#endif
#ifndef XtNknobIndent
#define XtNknobIndent ((char*)&XtStrings[398])
#endif
#ifndef XtNknobPixel
#define XtNknobPixel ((char*)&XtStrings[409])
#endif
#ifndef XtNknobWidth
#define XtNknobWidth ((char*)&XtStrings[419])
#endif
#ifndef XtNlabel
#define XtNlabel ((char*)&XtStrings[429])
#endif
#ifndef XtNlength
#define XtNlength ((char*)&XtStrings[435])
#endif
#ifndef XtNlowerRight
#define XtNlowerRight ((char*)&XtStrings[442])
#endif
#ifndef XtNmappedWhenManaged
#define XtNmappedWhenManaged ((char*)&XtStrings[453])
#endif
#ifndef XtNmenuEntry
#define XtNmenuEntry ((char*)&XtStrings[471])
#endif
#ifndef XtNname
#define XtNname ((char*)&XtStrings[481])
#endif
#ifndef XtNnotify
#define XtNnotify ((char*)&XtStrings[486])
#endif
#ifndef XtNnumChildren
#define XtNnumChildren ((char*)&XtStrings[493])
#endif
#ifndef XtNorientation
#define XtNorientation ((char*)&XtStrings[505])
#endif
#ifndef XtNparameter
#define XtNparameter ((char*)&XtStrings[517])
#endif
#ifndef XtNpixmap
#define XtNpixmap ((char*)&XtStrings[527])
#endif
#ifndef XtNpopupCallback
#define XtNpopupCallback ((char*)&XtStrings[534])
#endif
#ifndef XtNpopdownCallback
#define XtNpopdownCallback ((char*)&XtStrings[548])
#endif
#ifndef XtNresize
#define XtNresize ((char*)&XtStrings[564])
#endif
#ifndef XtNreverseVideo
#define XtNreverseVideo ((char*)&XtStrings[571])
#endif
#ifndef XtNscreen
#define XtNscreen ((char*)&XtStrings[584])
#endif
#ifndef XtNscrollProc
#define XtNscrollProc ((char*)&XtStrings[591])
#endif
#ifndef XtNscrollDCursor
#define XtNscrollDCursor ((char*)&XtStrings[602])
#endif
#ifndef XtNscrollHCursor
#define XtNscrollHCursor ((char*)&XtStrings[616])
#endif
#ifndef XtNscrollLCursor
#define XtNscrollLCursor ((char*)&XtStrings[630])
#endif
#ifndef XtNscrollRCursor
#define XtNscrollRCursor ((char*)&XtStrings[644])
#endif
#ifndef XtNscrollUCursor
#define XtNscrollUCursor ((char*)&XtStrings[658])
#endif
#ifndef XtNscrollVCursor
#define XtNscrollVCursor ((char*)&XtStrings[672])
#endif
#ifndef XtNselection
#define XtNselection ((char*)&XtStrings[686])
#endif
#ifndef XtNselectionArray
#define XtNselectionArray ((char*)&XtStrings[696])
#endif
#ifndef XtNsensitive
#define XtNsensitive ((char*)&XtStrings[711])
#endif
#ifndef XtNshown
#define XtNshown ((char*)&XtStrings[721])
#endif
#ifndef XtNspace
#define XtNspace ((char*)&XtStrings[727])
#endif
#ifndef XtNstring
#define XtNstring ((char*)&XtStrings[733])
#endif
#ifndef XtNtextOptions
#define XtNtextOptions ((char*)&XtStrings[740])
#endif
#ifndef XtNtextSink
#define XtNtextSink ((char*)&XtStrings[752])
#endif
#ifndef XtNtextSource
#define XtNtextSource ((char*)&XtStrings[761])
#endif
#ifndef XtNthickness
#define XtNthickness ((char*)&XtStrings[772])
#endif
#ifndef XtNthumb
#define XtNthumb ((char*)&XtStrings[782])
#endif
#ifndef XtNthumbProc
#define XtNthumbProc ((char*)&XtStrings[788])
#endif
#ifndef XtNtop
#define XtNtop ((char*)&XtStrings[798])
#endif
#ifndef XtNtranslations
#define XtNtranslations ((char*)&XtStrings[802])
#endif
#ifndef XtNunrealizeCallback
#define XtNunrealizeCallback ((char*)&XtStrings[815])
#endif
#ifndef XtNupdate
#define XtNupdate ((char*)&XtStrings[833])
#endif
#ifndef XtNuseBottom
#define XtNuseBottom ((char*)&XtStrings[840])
#endif
#ifndef XtNuseRight
#define XtNuseRight ((char*)&XtStrings[850])
#endif
#ifndef XtNvalue
#define XtNvalue ((char*)&XtStrings[859])
#endif
#ifndef XtNvSpace
#define XtNvSpace ((char*)&XtStrings[865])
#endif
#ifndef XtNwidth
#define XtNwidth ((char*)&XtStrings[872])
#endif
#ifndef XtNwindow
#define XtNwindow ((char*)&XtStrings[878])
#endif
#ifndef XtNx
#define XtNx ((char*)&XtStrings[885])
#endif
#ifndef XtNy
#define XtNy ((char*)&XtStrings[887])
#endif
#ifndef XtCAccelerators
#define XtCAccelerators ((char*)&XtStrings[889])
#endif
#ifndef XtCBackground
#define XtCBackground ((char*)&XtStrings[902])
#endif
#ifndef XtCBitmap
#define XtCBitmap ((char*)&XtStrings[913])
#endif
#ifndef XtCBoolean
#define XtCBoolean ((char*)&XtStrings[920])
#endif
#ifndef XtCBorderColor
#define XtCBorderColor ((char*)&XtStrings[928])
#endif
#ifndef XtCBorderWidth
#define XtCBorderWidth ((char*)&XtStrings[940])
#endif
#ifndef XtCCallback
#define XtCCallback ((char*)&XtStrings[952])
#endif
#ifndef XtCColormap
#define XtCColormap ((char*)&XtStrings[961])
#endif
#ifndef XtCColor
#define XtCColor ((char*)&XtStrings[970])
#endif
#ifndef XtCCursor
#define XtCCursor ((char*)&XtStrings[976])
#endif
#ifndef XtCDepth
#define XtCDepth ((char*)&XtStrings[983])
#endif
#ifndef XtCEditType
#define XtCEditType ((char*)&XtStrings[989])
#endif
#ifndef XtCEventBindings
#define XtCEventBindings ((char*)&XtStrings[998])
#endif
#ifndef XtCFile
#define XtCFile ((char*)&XtStrings[1012])
#endif
#ifndef XtCFont
#define XtCFont ((char*)&XtStrings[1017])
#endif
#ifndef XtCForeground
#define XtCForeground ((char*)&XtStrings[1022])
#endif
#ifndef XtCFraction
#define XtCFraction ((char*)&XtStrings[1033])
#endif
#ifndef XtCFunction
#define XtCFunction ((char*)&XtStrings[1042])
#endif
#ifndef XtCHeight
#define XtCHeight ((char*)&XtStrings[1051])
#endif
#ifndef XtCHSpace
#define XtCHSpace ((char*)&XtStrings[1058])
#endif
#ifndef XtCIndex
#define XtCIndex ((char*)&XtStrings[1065])
#endif
#ifndef XtCInitialResourcesPersistent
#define XtCInitialResourcesPersistent ((char*)&XtStrings[1071])
#endif
#ifndef XtCInsertPosition
#define XtCInsertPosition ((char*)&XtStrings[1098])
#endif
#ifndef XtCInterval
#define XtCInterval ((char*)&XtStrings[1113])
#endif
#ifndef XtCJustify
#define XtCJustify ((char*)&XtStrings[1122])
#endif
#ifndef XtCKnobIndent
#define XtCKnobIndent ((char*)&XtStrings[1130])
#endif
#ifndef XtCKnobPixel
#define XtCKnobPixel ((char*)&XtStrings[1141])
#endif
#ifndef XtCLabel
#define XtCLabel ((char*)&XtStrings[1151])
#endif
#ifndef XtCLength
#define XtCLength ((char*)&XtStrings[1157])
#endif
#ifndef XtCMappedWhenManaged
#define XtCMappedWhenManaged ((char*)&XtStrings[1164])
#endif
#ifndef XtCMargin
#define XtCMargin ((char*)&XtStrings[1182])
#endif
#ifndef XtCMenuEntry
#define XtCMenuEntry ((char*)&XtStrings[1189])
#endif
#ifndef XtCNotify
#define XtCNotify ((char*)&XtStrings[1199])
#endif
#ifndef XtCOrientation
#define XtCOrientation ((char*)&XtStrings[1206])
#endif
#ifndef XtCParameter
#define XtCParameter ((char*)&XtStrings[1218])
#endif
#ifndef XtCPixmap
#define XtCPixmap ((char*)&XtStrings[1228])
#endif
#ifndef XtCPosition
#define XtCPosition ((char*)&XtStrings[1235])
#endif
#ifndef XtCReadOnly
#define XtCReadOnly ((char*)&XtStrings[1244])
#endif
#ifndef XtCResize
#define XtCResize ((char*)&XtStrings[1253])
#endif
#ifndef XtCReverseVideo
#define XtCReverseVideo ((char*)&XtStrings[1260])
#endif
#ifndef XtCScreen
#define XtCScreen ((char*)&XtStrings[1273])
#endif
#ifndef XtCScrollProc
#define XtCScrollProc ((char*)&XtStrings[1280])
#endif
#ifndef XtCScrollDCursor
#define XtCScrollDCursor ((char*)&XtStrings[1291])
#endif
#ifndef XtCScrollHCursor
#define XtCScrollHCursor ((char*)&XtStrings[1305])
#endif
#ifndef XtCScrollLCursor
#define XtCScrollLCursor ((char*)&XtStrings[1319])
#endif
#ifndef XtCScrollRCursor
#define XtCScrollRCursor ((char*)&XtStrings[1333])
#endif
#ifndef XtCScrollUCursor
#define XtCScrollUCursor ((char*)&XtStrings[1347])
#endif
#ifndef XtCScrollVCursor
#define XtCScrollVCursor ((char*)&XtStrings[1361])
#endif
#ifndef XtCSelection
#define XtCSelection ((char*)&XtStrings[1375])
#endif
#ifndef XtCSensitive
#define XtCSensitive ((char*)&XtStrings[1385])
#endif
#ifndef XtCSelectionArray
#define XtCSelectionArray ((char*)&XtStrings[1395])
#endif
#ifndef XtCSpace
#define XtCSpace ((char*)&XtStrings[1410])
#endif
#ifndef XtCString
#define XtCString ((char*)&XtStrings[1416])
#endif
#ifndef XtCTextOptions
#define XtCTextOptions ((char*)&XtStrings[1423])
#endif
#ifndef XtCTextPosition
#define XtCTextPosition ((char*)&XtStrings[1435])
#endif
#ifndef XtCTextSink
#define XtCTextSink ((char*)&XtStrings[1448])
#endif
#ifndef XtCTextSource
#define XtCTextSource ((char*)&XtStrings[1457])
#endif
#ifndef XtCThickness
#define XtCThickness ((char*)&XtStrings[1468])
#endif
#ifndef XtCThumb
#define XtCThumb ((char*)&XtStrings[1478])
#endif
#ifndef XtCTranslations
#define XtCTranslations ((char*)&XtStrings[1484])
#endif
#ifndef XtCValue
#define XtCValue ((char*)&XtStrings[1497])
#endif
#ifndef XtCVSpace
#define XtCVSpace ((char*)&XtStrings[1503])
#endif
#ifndef XtCWidth
#define XtCWidth ((char*)&XtStrings[1510])
#endif
#ifndef XtCWindow
#define XtCWindow ((char*)&XtStrings[1516])
#endif
#ifndef XtCX
#define XtCX ((char*)&XtStrings[1523])
#endif
#ifndef XtCY
#define XtCY ((char*)&XtStrings[1525])
#endif
#ifndef XtRAcceleratorTable
#define XtRAcceleratorTable ((char*)&XtStrings[1527])
#endif
#ifndef XtRAtom
#define XtRAtom ((char*)&XtStrings[1544])
#endif
#ifndef XtRBitmap
#define XtRBitmap ((char*)&XtStrings[1549])
#endif
#ifndef XtRBool
#define XtRBool ((char*)&XtStrings[1556])
#endif
#ifndef XtRBoolean
#define XtRBoolean ((char*)&XtStrings[1561])
#endif
#ifndef XtRCallback
#define XtRCallback ((char*)&XtStrings[1569])
#endif
#ifndef XtRCallProc
#define XtRCallProc ((char*)&XtStrings[1578])
#endif
#ifndef XtRCardinal
#define XtRCardinal ((char*)&XtStrings[1587])
#endif
#ifndef XtRColor
#define XtRColor ((char*)&XtStrings[1596])
#endif
#ifndef XtRColormap
#define XtRColormap ((char*)&XtStrings[1602])
#endif
#ifndef XtRCursor
#define XtRCursor ((char*)&XtStrings[1611])
#endif
#ifndef XtRDimension
#define XtRDimension ((char*)&XtStrings[1618])
#endif
#ifndef XtRDisplay
#define XtRDisplay ((char*)&XtStrings[1628])
#endif
#ifndef XtREditMode
#define XtREditMode ((char*)&XtStrings[1636])
#endif
#ifndef XtREnum
#define XtREnum ((char*)&XtStrings[1645])
#endif
#ifndef XtRFile
#define XtRFile ((char*)&XtStrings[1650])
#endif
#ifndef XtRFloat
#define XtRFloat ((char*)&XtStrings[1655])
#endif
#ifndef XtRFont
#define XtRFont ((char*)&XtStrings[1661])
#endif
#ifndef XtRFontStruct
#define XtRFontStruct ((char*)&XtStrings[1666])
#endif
#ifndef XtRFunction
#define XtRFunction ((char*)&XtStrings[1677])
#endif
#ifndef XtRGeometry
#define XtRGeometry ((char*)&XtStrings[1686])
#endif
#ifndef XtRImmediate
#define XtRImmediate ((char*)&XtStrings[1695])
#endif
#ifndef XtRInitialState
#define XtRInitialState ((char*)&XtStrings[1705])
#endif
#ifndef XtRInt
#define XtRInt ((char*)&XtStrings[1718])
#endif
#ifndef XtRJustify
#define XtRJustify ((char*)&XtStrings[1722])
#endif
#ifndef XtRLongBoolean
#define XtRLongBoolean ((char*)&XtStrings[1730])
#endif
#ifndef XtRObject
#define XtRObject ((char*)&XtStrings[1735])
#endif
#ifndef XtROrientation
#define XtROrientation ((char*)&XtStrings[1742])
#endif
#ifndef XtRPixel
#define XtRPixel ((char*)&XtStrings[1754])
#endif
#ifndef XtRPixmap
#define XtRPixmap ((char*)&XtStrings[1760])
#endif
#ifndef XtRPointer
#define XtRPointer ((char*)&XtStrings[1767])
#endif
#ifndef XtRPosition
#define XtRPosition ((char*)&XtStrings[1775])
#endif
#ifndef XtRScreen
#define XtRScreen ((char*)&XtStrings[1784])
#endif
#ifndef XtRShort
#define XtRShort ((char*)&XtStrings[1791])
#endif
#ifndef XtRString
#define XtRString ((char*)&XtStrings[1797])
#endif
#ifndef XtRStringArray
#define XtRStringArray ((char*)&XtStrings[1804])
#endif
#ifndef XtRStringTable
#define XtRStringTable ((char*)&XtStrings[1816])
#endif
#ifndef XtRUnsignedChar
#define XtRUnsignedChar ((char*)&XtStrings[1828])
#endif
#ifndef XtRTranslationTable
#define XtRTranslationTable ((char*)&XtStrings[1841])
#endif
#ifndef XtRVisual
#define XtRVisual ((char*)&XtStrings[1858])
#endif
#ifndef XtRWidget
#define XtRWidget ((char*)&XtStrings[1865])
#endif
#ifndef XtRWidgetClass
#define XtRWidgetClass ((char*)&XtStrings[1872])
#endif
#ifndef XtRWidgetList
#define XtRWidgetList ((char*)&XtStrings[1884])
#endif
#ifndef XtRWindow
#define XtRWindow ((char*)&XtStrings[1895])
#endif
#ifndef XtEoff
#define XtEoff ((char*)&XtStrings[1902])
#endif
#ifndef XtEfalse
#define XtEfalse ((char*)&XtStrings[1906])
#endif
#ifndef XtEno
#define XtEno ((char*)&XtStrings[1912])
#endif
#ifndef XtEon
#define XtEon ((char*)&XtStrings[1915])
#endif
#ifndef XtEtrue
#define XtEtrue ((char*)&XtStrings[1918])
#endif
#ifndef XtEyes
#define XtEyes ((char*)&XtStrings[1923])
#endif
#ifndef XtEvertical
#define XtEvertical ((char*)&XtStrings[1927])
#endif
#ifndef XtEhorizontal
#define XtEhorizontal ((char*)&XtStrings[1936])
#endif
#ifndef XtEtextRead
#define XtEtextRead ((char*)&XtStrings[1947])
#endif
#ifndef XtEtextAppend
#define XtEtextAppend ((char*)&XtStrings[1952])
#endif
#ifndef XtEtextEdit
#define XtEtextEdit ((char*)&XtStrings[1959])
#endif
#ifndef XtExtdefaultbackground
#define XtExtdefaultbackground ((char*)&XtStrings[1964])
#endif
#ifndef XtExtdefaultforeground
#define XtExtdefaultforeground ((char*)&XtStrings[1984])
#endif
#ifndef XtExtdefaultfont
#define XtExtdefaultfont ((char*)&XtStrings[2004])
#endif
#ifndef XtNfontSet
#define XtNfontSet ((char*)&XtStrings[2018])
#endif
#ifndef XtRFontSet
#define XtRFontSet ((char*)&XtStrings[2026])
#endif
#ifndef XtCFontSet
#define XtCFontSet ((char*)&XtStrings[2034])
#endif
#ifndef XtRGravity
#define XtRGravity ((char*)&XtStrings[2042])
#endif
#ifndef XtNcreateHook
#define XtNcreateHook ((char*)&XtStrings[2050])
#endif
#ifndef XtNchangeHook
#define XtNchangeHook ((char*)&XtStrings[2061])
#endif
#ifndef XtNconfigureHook
#define XtNconfigureHook ((char*)&XtStrings[2072])
#endif
#ifndef XtNgeometryHook
#define XtNgeometryHook ((char*)&XtStrings[2086])
#endif
#ifndef XtNdestroyHook
#define XtNdestroyHook ((char*)&XtStrings[2099])
#endif
#ifndef XtNshells
#define XtNshells ((char*)&XtStrings[2111])
#endif
#ifndef XtNnumShells
#define XtNnumShells ((char*)&XtStrings[2118])
#endif
#ifndef XtRCommandArgArray
#define XtRCommandArgArray ((char*)&XtStrings[2128])
#endif
#ifndef XtRDirectoryString
#define XtRDirectoryString ((char*)&XtStrings[2144])
#endif
#ifndef XtREnvironmentArray
#define XtREnvironmentArray ((char*)&XtStrings[2160])
#endif
#ifndef XtRRestartStyle
#define XtRRestartStyle ((char*)&XtStrings[2177])
#endif
#ifndef XtRSmcConn
#define XtRSmcConn ((char*)&XtStrings[2190])
#endif
#ifndef XtHcreate
#define XtHcreate ((char*)&XtStrings[2198])
#endif
#ifndef XtHsetValues
#define XtHsetValues ((char*)&XtStrings[2207])
#endif
#ifndef XtHmanageChildren
#define XtHmanageChildren ((char*)&XtStrings[2219])
#endif
#ifndef XtHunmanageChildren
#define XtHunmanageChildren ((char*)&XtStrings[2236])
#endif
#ifndef XtHmanageSet
#define XtHmanageSet ((char*)&XtStrings[2255])
#endif
#ifndef XtHunmanageSet
#define XtHunmanageSet ((char*)&XtStrings[2267])
#endif
#ifndef XtHrealizeWidget
#define XtHrealizeWidget ((char*)&XtStrings[2281])
#endif
#ifndef XtHunrealizeWidget
#define XtHunrealizeWidget ((char*)&XtStrings[2297])
#endif
#ifndef XtHaddCallback
#define XtHaddCallback ((char*)&XtStrings[2315])
#endif
#ifndef XtHaddCallbacks
#define XtHaddCallbacks ((char*)&XtStrings[2329])
#endif
#ifndef XtHremoveCallback
#define XtHremoveCallback ((char*)&XtStrings[2344])
#endif
#ifndef XtHremoveCallbacks
#define XtHremoveCallbacks ((char*)&XtStrings[2361])
#endif
#ifndef XtHremoveAllCallbacks
#define XtHremoveAllCallbacks ((char*)&XtStrings[2379])
#endif
#ifndef XtHaugmentTranslations
#define XtHaugmentTranslations ((char*)&XtStrings[2400])
#endif
#ifndef XtHoverrideTranslations
#define XtHoverrideTranslations ((char*)&XtStrings[2422])
#endif
#ifndef XtHuninstallTranslations
#define XtHuninstallTranslations ((char*)&XtStrings[2445])
#endif
#ifndef XtHsetKeyboardFocus
#define XtHsetKeyboardFocus ((char*)&XtStrings[2469])
#endif
#ifndef XtHsetWMColormapWindows
#define XtHsetWMColormapWindows ((char*)&XtStrings[2488])
#endif
#ifndef XtHsetMappedWhenManaged
#define XtHsetMappedWhenManaged ((char*)&XtStrings[2511])
#endif
#ifndef XtHmapWidget
#define XtHmapWidget ((char*)&XtStrings[2534])
#endif
#ifndef XtHunmapWidget
#define XtHunmapWidget ((char*)&XtStrings[2546])
#endif
#ifndef XtHpopup
#define XtHpopup ((char*)&XtStrings[2560])
#endif
#ifndef XtHpopupSpringLoaded
#define XtHpopupSpringLoaded ((char*)&XtStrings[2568])
#endif
#ifndef XtHpopdown
#define XtHpopdown ((char*)&XtStrings[2588])
#endif
#ifndef XtHconfigure
#define XtHconfigure ((char*)&XtStrings[2598])
#endif
#ifndef XtHpreGeometry
#define XtHpreGeometry ((char*)&XtStrings[2610])
#endif
#ifndef XtHpostGeometry
#define XtHpostGeometry ((char*)&XtStrings[2624])
#endif
#ifndef XtHdestroy
#define XtHdestroy ((char*)&XtStrings[2639])
#endif
#endif /* XTSTRINGDEFINES */
#ifndef XTSTRINGDEFINES
#undef _XtStringDefs_h_Const
#endif
#endif /* _XtStringDefs_h_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtObject_h
#define _XtObject_h
_XFUNCPROTOBEGIN
typedef struct _ObjectRec *Object;
typedef struct _ObjectClassRec *ObjectClass;
#ifndef VMS
externalref WidgetClass objectClass;
#endif
_XFUNCPROTOEND
#endif /* _XtObject_h */
/* DON'T ADD STUFF AFTER THIS #endif */
#ifndef XPROTOSTRUCTS_H
#define XPROTOSTRUCTS_H
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#include <X11/Xmd.h>
/* Used by PolySegment */
typedef struct _xSegment {
INT16 x1, y1, x2, y2;
} xSegment;
/* POINT */
typedef struct _xPoint {
INT16 x, y;
} xPoint;
typedef struct _xRectangle {
INT16 x, y;
CARD16 width, height;
} xRectangle;
/* ARC */
typedef struct _xArc {
INT16 x, y;
CARD16 width, height;
INT16 angle1, angle2;
} xArc;
#endif /* XPROTOSTRUCTS_H */
/************************************************************
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, 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.
********************************************************/
#ifndef _X11_XKBLIB_H_
#define _X11_XKBLIB_H_
#include <X11/Xlib.h>
#include <X11/extensions/XKBstr.h>
typedef struct _XkbAnyEvent {
int type; /* XkbAnyEvent */
unsigned long serial; /* # of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XKB event minor code */
unsigned int device; /* device ID */
} XkbAnyEvent;
typedef struct _XkbNewKeyboardNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbNewKeyboardNotify */
int device; /* device ID */
int old_device; /* device ID of previous keyboard */
int min_key_code; /* minimum key code */
int max_key_code; /* maximum key code */
int old_min_key_code;/* min key code of previous kbd */
int old_max_key_code;/* max key code of previous kbd */
unsigned int changed; /* changed aspects of the keyboard */
char req_major; /* major and minor opcode of req */
char req_minor; /* that caused change, if applicable */
} XkbNewKeyboardNotifyEvent;
typedef struct _XkbMapNotifyEvent {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbMapNotify */
int device; /* device ID */
unsigned int changed; /* fields which have been changed */
unsigned int flags; /* reserved */
int first_type; /* first changed key type */
int num_types; /* number of changed key types */
KeyCode min_key_code;
KeyCode max_key_code;
KeyCode first_key_sym;
KeyCode first_key_act;
KeyCode first_key_behavior;
KeyCode first_key_explicit;
KeyCode first_modmap_key;
KeyCode first_vmodmap_key;
int num_key_syms;
int num_key_acts;
int num_key_behaviors;
int num_key_explicit;
int num_modmap_keys;
int num_vmodmap_keys;
unsigned int vmods; /* mask of changed virtual mods */
} XkbMapNotifyEvent;
typedef struct _XkbStateNotifyEvent {
int type; /* XkbAnyEvent */
unsigned long serial; /* # of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbStateNotify */
int device; /* device ID */
unsigned int changed; /* mask of changed state components */
int group; /* keyboard group */
int base_group; /* base keyboard group */
int latched_group; /* latched keyboard group */
int locked_group; /* locked keyboard group */
unsigned int mods; /* modifier state */
unsigned int base_mods; /* base modifier state */
unsigned int latched_mods; /* latched modifiers */
unsigned int locked_mods; /* locked modifiers */
int compat_state; /* compatibility state */
unsigned char grab_mods; /* mods used for grabs */
unsigned char compat_grab_mods;/* grab mods for non-XKB clients */
unsigned char lookup_mods; /* mods sent to clients */
unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */
int ptr_buttons; /* pointer button state */
KeyCode keycode; /* keycode that caused the change */
char event_type; /* KeyPress or KeyRelease */
char req_major; /* Major opcode of request */
char req_minor; /* Minor opcode of request */
} XkbStateNotifyEvent;
typedef struct _XkbControlsNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbControlsNotify */
int device; /* device ID */
unsigned int changed_ctrls; /* controls with changed sub-values */
unsigned int enabled_ctrls; /* controls currently enabled */
unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */
int num_groups; /* total groups on keyboard */
KeyCode keycode; /* key that caused change or 0 */
char event_type; /* type of event that caused change */
char req_major; /* if keycode==0, major and minor */
char req_minor; /* opcode of req that caused change */
} XkbControlsNotifyEvent;
typedef struct _XkbIndicatorNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbIndicatorNotify */
int device; /* device ID */
unsigned int changed; /* indicators with new state or map */
unsigned int state; /* current state of all indicators */
} XkbIndicatorNotifyEvent;
typedef struct _XkbNamesNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbNamesNotify */
int device; /* device ID */
unsigned int changed; /* names that have changed */
int first_type; /* first key type with new name */
int num_types; /* number of key types with new names */
int first_lvl; /* first key type new new level names */
int num_lvls; /* # of key types w/new level names */
int num_aliases; /* total number of key aliases*/
int num_radio_groups;/* total number of radio groups */
unsigned int changed_vmods; /* virtual modifiers with new names */
unsigned int changed_groups; /* groups with new names */
unsigned int changed_indicators;/* indicators with new names */
int first_key; /* first key with new name */
int num_keys; /* number of keys with new names */
} XkbNamesNotifyEvent;
typedef struct _XkbCompatMapNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbCompatMapNotify */
int device; /* device ID */
unsigned int changed_groups; /* groups with new compat maps */
int first_si; /* first new symbol interp */
int num_si; /* number of new symbol interps */
int num_total_si; /* total # of symbol interps */
} XkbCompatMapNotifyEvent;
typedef struct _XkbBellNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbBellNotify */
int device; /* device ID */
int percent; /* requested volume as a % of maximum */
int pitch; /* requested pitch in Hz */
int duration; /* requested duration in useconds */
int bell_class; /* (input extension) feedback class */
int bell_id; /* (input extension) ID of feedback */
Atom name; /* "name" of requested bell */
Window window; /* window associated with event */
Bool event_only; /* "event only" requested */
} XkbBellNotifyEvent;
typedef struct _XkbActionMessage {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbActionMessage */
int device; /* device ID */
KeyCode keycode; /* key that generated the event */
Bool press; /* true if act caused by key press */
Bool key_event_follows;/* true if key event also generated */
int group; /* effective group */
unsigned int mods; /* effective mods */
char message[XkbActionMessageLength+1];
/* message -- leave space for NUL */
} XkbActionMessageEvent;
typedef struct _XkbAccessXNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbAccessXNotify */
int device; /* device ID */
int detail; /* XkbAXN_* */
int keycode; /* key of event */
int sk_delay; /* current slow keys delay */
int debounce_delay; /* current debounce delay */
} XkbAccessXNotifyEvent;
typedef struct _XkbExtensionDeviceNotify {
int type; /* XkbAnyEvent */
unsigned long serial; /* of last req processed by server */
Bool send_event; /* is this from a SendEvent request? */
Display * display; /* Display the event was read from */
Time time; /* milliseconds */
int xkb_type; /* XkbExtensionDeviceNotify */
int device; /* device ID */
unsigned int reason; /* reason for the event */
unsigned int supported; /* mask of supported features */
unsigned int unsupported; /* mask of unsupported features */
/* that some app tried to use */
int first_btn; /* first button that changed */
int num_btns; /* range of buttons changed */
unsigned int leds_defined; /* indicators with names or maps */
unsigned int led_state; /* current state of the indicators */
int led_class; /* feedback class for led changes */
int led_id; /* feedback id for led changes */
} XkbExtensionDeviceNotifyEvent;
typedef union _XkbEvent {
int type;
XkbAnyEvent any;
XkbNewKeyboardNotifyEvent new_kbd;
XkbMapNotifyEvent map;
XkbStateNotifyEvent state;
XkbControlsNotifyEvent ctrls;
XkbIndicatorNotifyEvent indicators;
XkbNamesNotifyEvent names;
XkbCompatMapNotifyEvent compat;
XkbBellNotifyEvent bell;
XkbActionMessageEvent message;
XkbAccessXNotifyEvent accessx;
XkbExtensionDeviceNotifyEvent device;
XEvent core;
} XkbEvent;
typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr;
/* XkbOpenDisplay error codes */
#define XkbOD_Success 0
#define XkbOD_BadLibraryVersion 1
#define XkbOD_ConnectionRefused 2
#define XkbOD_NonXkbServer 3
#define XkbOD_BadServerVersion 4
/* Values for XlibFlags */
#define XkbLC_ForceLatin1Lookup (1<<0)
#define XkbLC_ConsumeLookupMods (1<<1)
#define XkbLC_AlwaysConsumeShiftAndLock (1<<2)
#define XkbLC_IgnoreNewKeyboards (1<<3)
#define XkbLC_ControlFallback (1<<4)
#define XkbLC_ConsumeKeysOnComposeFail (1<<29)
#define XkbLC_ComposeLED (1<<30)
#define XkbLC_BeepOnComposeFail (1<<31)
#define XkbLC_AllComposeControls (0xc0000000)
#define XkbLC_AllControls (0xc000001f)
_XFUNCPROTOBEGIN
extern Bool XkbIgnoreExtension(
Bool /* ignore */
);
extern Display *XkbOpenDisplay(
char * /* name */,
int * /* ev_rtrn */,
int * /* err_rtrn */,
int * /* major_rtrn */,
int * /* minor_rtrn */,
int * /* reason */
);
extern Bool XkbQueryExtension(
Display * /* dpy */,
int * /* opcodeReturn */,
int * /* eventBaseReturn */,
int * /* errorBaseReturn */,
int * /* majorRtrn */,
int * /* minorRtrn */
);
extern Bool XkbUseExtension(
Display * /* dpy */,
int * /* major_rtrn */,
int * /* minor_rtrn */
);
extern Bool XkbLibraryVersion(
int * /* libMajorRtrn */,
int * /* libMinorRtrn */
);
extern unsigned int XkbSetXlibControls(
Display* /* dpy */,
unsigned int /* affect */,
unsigned int /* values */
);
extern unsigned int XkbGetXlibControls(
Display* /* dpy */
);
extern unsigned int XkbXlibControlsImplemented(void);
typedef Atom (*XkbInternAtomFunc)(
Display * /* dpy */,
_Xconst char * /* name */,
Bool /* only_if_exists */
);
typedef char * (*XkbGetAtomNameFunc)(
Display * /* dpy */,
Atom /* atom */
);
extern void XkbSetAtomFuncs(
XkbInternAtomFunc /* getAtom */,
XkbGetAtomNameFunc /* getName */
);
extern KeySym XkbKeycodeToKeysym(
Display * /* dpy */,
#if NeedWidePrototypes
unsigned int /* kc */,
#else
KeyCode /* kc */,
#endif
int /* group */,
int /* level */
);
extern unsigned int XkbKeysymToModifiers(
Display * /* dpy */,
KeySym /* ks */
);
extern Bool XkbLookupKeySym(
Display * /* dpy */,
KeyCode /* keycode */,
unsigned int /* modifiers */,
unsigned int * /* modifiers_return */,
KeySym * /* keysym_return */
);
extern int XkbLookupKeyBinding(
Display * /* dpy */,
KeySym /* sym_rtrn */,
unsigned int /* mods */,
char * /* buffer */,
int /* nbytes */,
int * /* extra_rtrn */
);
extern Bool XkbTranslateKeyCode(
XkbDescPtr /* xkb */,
KeyCode /* keycode */,
unsigned int /* modifiers */,
unsigned int * /* modifiers_return */,
KeySym * /* keysym_return */
);
extern int XkbTranslateKeySym(
Display * /* dpy */,
register KeySym * /* sym_return */,
unsigned int /* modifiers */,
char * /* buffer */,
int /* nbytes */,
int * /* extra_rtrn */
);
extern Bool XkbSetAutoRepeatRate(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* delay */,
unsigned int /* interval */
);
extern Bool XkbGetAutoRepeatRate(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int * /* delayRtrn */,
unsigned int * /* intervalRtrn */
);
extern Bool XkbChangeEnabledControls(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* affect */,
unsigned int /* values */
);
extern Bool XkbDeviceBell(
Display * /* dpy */,
Window /* win */,
int /* deviceSpec */,
int /* bellClass */,
int /* bellID */,
int /* percent */,
Atom /* name */
);
extern Bool XkbForceDeviceBell(
Display * /* dpy */,
int /* deviceSpec */,
int /* bellClass */,
int /* bellID */,
int /* percent */
);
extern Bool XkbDeviceBellEvent(
Display * /* dpy */,
Window /* win */,
int /* deviceSpec */,
int /* bellClass */,
int /* bellID */,
int /* percent */,
Atom /* name */
);
extern Bool XkbBell(
Display * /* dpy */,
Window /* win */,
int /* percent */,
Atom /* name */
);
extern Bool XkbForceBell(
Display * /* dpy */,
int /* percent */
);
extern Bool XkbBellEvent(
Display * /* dpy */,
Window /* win */,
int /* percent */,
Atom /* name */
);
extern Bool XkbSelectEvents(
Display * /* dpy */,
unsigned int /* deviceID */,
unsigned int /* affect */,
unsigned int /* values */
);
extern Bool XkbSelectEventDetails(
Display * /* dpy */,
unsigned int /* deviceID */,
unsigned int /* eventType */,
unsigned long /* affect */,
unsigned long /* details */
);
extern void XkbNoteMapChanges(
XkbMapChangesPtr /* old */,
XkbMapNotifyEvent * /* new */,
unsigned int /* wanted */
);
extern void XkbNoteNameChanges(
XkbNameChangesPtr /* old */,
XkbNamesNotifyEvent * /* new */,
unsigned int /* wanted */
);
extern Status XkbGetIndicatorState(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int * /* pStateRtrn */
);
extern Status XkbGetDeviceIndicatorState(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* ledClass */,
unsigned int /* ledID */,
unsigned int * /* pStateRtrn */
);
extern Status XkbGetIndicatorMap(
Display * /* dpy */,
unsigned long /* which */,
XkbDescPtr /* desc */
);
extern Bool XkbSetIndicatorMap(
Display * /* dpy */,
unsigned long /* which */,
XkbDescPtr /* desc */
);
#define XkbNoteIndicatorMapChanges(o,n,w) \
((o)->map_changes|=((n)->map_changes&(w)))
#define XkbNoteIndicatorStateChanges(o,n,w)\
((o)->state_changes|=((n)->state_changes&(w)))
#define XkbGetIndicatorMapChanges(d,x,c) \
(XkbGetIndicatorMap((d),(c)->map_changes,x))
#define XkbChangeIndicatorMaps(d,x,c) \
(XkbSetIndicatorMap((d),(c)->map_changes,x))
extern Bool XkbGetNamedIndicator(
Display * /* dpy */,
Atom /* name */,
int * /* pNdxRtrn */,
Bool * /* pStateRtrn */,
XkbIndicatorMapPtr /* pMapRtrn */,
Bool * /* pRealRtrn */
);
extern Bool XkbGetNamedDeviceIndicator(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* ledClass */,
unsigned int /* ledID */,
Atom /* name */,
int * /* pNdxRtrn */,
Bool * /* pStateRtrn */,
XkbIndicatorMapPtr /* pMapRtrn */,
Bool * /* pRealRtrn */
);
extern Bool XkbSetNamedIndicator(
Display * /* dpy */,
Atom /* name */,
Bool /* changeState */,
Bool /* state */,
Bool /* createNewMap */,
XkbIndicatorMapPtr /* pMap */
);
extern Bool XkbSetNamedDeviceIndicator(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* ledClass */,
unsigned int /* ledID */,
Atom /* name */,
Bool /* changeState */,
Bool /* state */,
Bool /* createNewMap */,
XkbIndicatorMapPtr /* pMap */
);
extern Bool XkbLockModifiers(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* affect */,
unsigned int /* values */
);
extern Bool XkbLatchModifiers(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* affect */,
unsigned int /* values */
);
extern Bool XkbLockGroup(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* group */
);
extern Bool XkbLatchGroup(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* group */
);
extern Bool XkbSetServerInternalMods(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* affectReal */,
unsigned int /* realValues */,
unsigned int /* affectVirtual */,
unsigned int /* virtualValues */
);
extern Bool XkbSetIgnoreLockMods(
Display * /* dpy */,
unsigned int /* deviceSpec */,
unsigned int /* affectReal */,
unsigned int /* realValues */,
unsigned int /* affectVirtual */,
unsigned int /* virtualValues */
);
extern Bool XkbVirtualModsToReal(
XkbDescPtr /* xkb */,
unsigned int /* virtual_mask */,
unsigned int * /* mask_rtrn */
);
extern Bool XkbComputeEffectiveMap(
XkbDescPtr /* xkb */,
XkbKeyTypePtr /* type */,
unsigned char * /* map_rtrn */
);
extern Status XkbInitCanonicalKeyTypes(
XkbDescPtr /* xkb */,
unsigned int /* which */,
int /* keypadVMod */
);
extern XkbDescPtr XkbAllocKeyboard(
void
);
extern void XkbFreeKeyboard(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeDesc */
);
extern Status XkbAllocClientMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
unsigned int /* nTypes */
);
extern Status XkbAllocServerMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
unsigned int /* nActions */
);
extern void XkbFreeClientMap(
XkbDescPtr /* xkb */,
unsigned int /* what */,
Bool /* freeMap */
);
extern void XkbFreeServerMap(
XkbDescPtr /* xkb */,
unsigned int /* what */,
Bool /* freeMap */
);
extern XkbKeyTypePtr XkbAddKeyType(
XkbDescPtr /* xkb */,
Atom /* name */,
int /* map_count */,
Bool /* want_preserve */,
int /* num_lvls */
);
extern Status XkbAllocIndicatorMaps(
XkbDescPtr /* xkb */
);
extern void XkbFreeIndicatorMaps(
XkbDescPtr /* xkb */
);
extern XkbDescPtr XkbGetMap(
Display * /* dpy */,
unsigned int /* which */,
unsigned int /* deviceSpec */
);
extern Status XkbGetUpdatedMap(
Display * /* dpy */,
unsigned int /* which */,
XkbDescPtr /* desc */
);
extern Status XkbGetMapChanges(
Display * /* dpy */,
XkbDescPtr /* xkb */,
XkbMapChangesPtr /* changes */
);
extern Status XkbRefreshKeyboardMapping(
XkbMapNotifyEvent * /* event */
);
extern Status XkbGetKeyTypes(
Display * /* dpy */,
unsigned int /* first */,
unsigned int /* num */,
XkbDescPtr /* xkb */
);
extern Status XkbGetKeySyms(
Display * /* dpy */,
unsigned int /* first */,
unsigned int /* num */,
XkbDescPtr /* xkb */
);
extern Status XkbGetKeyActions(
Display * /* dpy */,
unsigned int /* first */,
unsigned int /* num */,
XkbDescPtr /* xkb */
);
extern Status XkbGetKeyBehaviors(
Display * /* dpy */,
unsigned int /* firstKey */,
unsigned int /* nKeys */,
XkbDescPtr /* desc */
);
extern Status XkbGetVirtualMods(
Display * /* dpy */,
unsigned int /* which */,
XkbDescPtr /* desc */
);
extern Status XkbGetKeyExplicitComponents(
Display * /* dpy */,
unsigned int /* firstKey */,
unsigned int /* nKeys */,
XkbDescPtr /* desc */
);
extern Status XkbGetKeyModifierMap(
Display * /* dpy */,
unsigned int /* firstKey */,
unsigned int /* nKeys */,
XkbDescPtr /* desc */
);
extern Status XkbGetKeyVirtualModMap(
Display * /* dpy */,
unsigned int /* first */,
unsigned int /* num */,
XkbDescPtr /* xkb */
);
extern Status XkbAllocControls(
XkbDescPtr /* xkb */,
unsigned int /* which*/
);
extern void XkbFreeControls(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeMap */
);
extern Status XkbGetControls(
Display * /* dpy */,
unsigned long /* which */,
XkbDescPtr /* desc */
);
extern Bool XkbSetControls(
Display * /* dpy */,
unsigned long /* which */,
XkbDescPtr /* desc */
);
extern void XkbNoteControlsChanges(
XkbControlsChangesPtr /* old */,
XkbControlsNotifyEvent * /* new */,
unsigned int /* wanted */
);
#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x)
#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x)
extern Status XkbAllocCompatMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
unsigned int /* nInterpret */
);
extern void XkbFreeCompatMap(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeMap */
);
extern Status XkbGetCompatMap(
Display * /* dpy */,
unsigned int /* which */,
XkbDescPtr /* xkb */
);
extern Bool XkbSetCompatMap(
Display * /* dpy */,
unsigned int /* which */,
XkbDescPtr /* xkb */,
Bool /* updateActions */
);
extern XkbSymInterpretPtr XkbAddSymInterpret(
XkbDescPtr /* xkb */,
XkbSymInterpretPtr /* si */,
Bool /* updateMap */,
XkbChangesPtr /* changes */
);
extern Status XkbAllocNames(
XkbDescPtr /* xkb */,
unsigned int /* which */,
int /* nTotalRG */,
int /* nTotalAliases */
);
extern Status XkbGetNames(
Display * /* dpy */,
unsigned int /* which */,
XkbDescPtr /* desc */
);
extern Bool XkbSetNames(
Display * /* dpy */,
unsigned int /* which */,
unsigned int /* firstType */,
unsigned int /* nTypes */,
XkbDescPtr /* desc */
);
extern Bool XkbChangeNames(
Display * /* dpy */,
XkbDescPtr /* xkb */,
XkbNameChangesPtr /* changes */
);
extern void XkbFreeNames(
XkbDescPtr /* xkb */,
unsigned int /* which */,
Bool /* freeMap */
);
extern Status XkbGetState(
Display * /* dpy */,
unsigned int /* deviceSpec */,
XkbStatePtr /* rtrnState */
);
extern Bool XkbSetMap(
Display * /* dpy */,
unsigned int /* which */,
XkbDescPtr /* desc */
);
extern Bool XkbChangeMap(
Display* /* dpy */,
XkbDescPtr /* desc */,
XkbMapChangesPtr /* changes */
);
extern Bool XkbSetDetectableAutoRepeat(
Display * /* dpy */,
Bool /* detectable */,
Bool * /* supported */
);
extern Bool XkbGetDetectableAutoRepeat(
Display * /* dpy */,
Bool * /* supported */
);
extern Bool XkbSetAutoResetControls(
Display * /* dpy */,
unsigned int /* changes */,
unsigned int * /* auto_ctrls */,
unsigned int * /* auto_values */
);
extern Bool XkbGetAutoResetControls(
Display * /* dpy */,
unsigned int * /* auto_ctrls */,
unsigned int * /* auto_ctrl_values */
);
extern Bool XkbSetPerClientControls(
Display * /* dpy */,
unsigned int /* change */,
unsigned int * /* values */
);
extern Bool XkbGetPerClientControls(
Display * /* dpy */,
unsigned int * /* ctrls */
);
extern Status XkbCopyKeyType(
XkbKeyTypePtr /* from */,
XkbKeyTypePtr /* into */
);
extern Status XkbCopyKeyTypes(
XkbKeyTypePtr /* from */,
XkbKeyTypePtr /* into */,
int /* num_types */
);
extern Status XkbResizeKeyType(
XkbDescPtr /* xkb */,
int /* type_ndx */,
int /* map_count */,
Bool /* want_preserve */,
int /* new_num_lvls */
);
extern KeySym *XkbResizeKeySyms(
XkbDescPtr /* desc */,
int /* forKey */,
int /* symsNeeded */
);
extern XkbAction *XkbResizeKeyActions(
XkbDescPtr /* desc */,
int /* forKey */,
int /* actsNeeded */
);
extern Status XkbChangeTypesOfKey(
XkbDescPtr /* xkb */,
int /* key */,
int /* num_groups */,
unsigned int /* groups */,
int * /* newTypes */,
XkbMapChangesPtr /* pChanges */
);
extern Status XkbChangeKeycodeRange(
XkbDescPtr /* xkb */,
int /* minKC */,
int /* maxKC */,
XkbChangesPtr /* changes */
);
/***====================================================================***/
extern XkbComponentListPtr XkbListComponents(
Display * /* dpy */,
unsigned int /* deviceSpec */,
XkbComponentNamesPtr /* ptrns */,
int * /* max_inout */
);
extern void XkbFreeComponentList(
XkbComponentListPtr /* list */
);
extern XkbDescPtr XkbGetKeyboard(
Display * /* dpy */,
unsigned int /* which */,
unsigned int /* deviceSpec */
);
extern XkbDescPtr XkbGetKeyboardByName(
Display * /* dpy */,
unsigned int /* deviceSpec */,
XkbComponentNamesPtr /* names */,
unsigned int /* want */,
unsigned int /* need */,
Bool /* load */
);
/***====================================================================***/
extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */
XkbDescPtr /* xkb */, /* keyboard device */
int /* map_width */, /* width of core KeySym array */
KeySym * /* core_syms */, /* always mapWidth symbols */
unsigned int /* protected */, /* explicit key types */
int * /* types_inout */, /* always four type indices */
KeySym * /* xkb_syms_rtrn */ /* must have enough space */
);
extern Bool XkbApplyCompatMapToKey( /* False only on error */
XkbDescPtr /* xkb */, /* keymap to be edited */
KeyCode /* key */, /* key to be updated */
XkbChangesPtr /* changes */ /* resulting changes to map */
);
extern Bool XkbUpdateMapFromCore( /* False only on error */
XkbDescPtr /* xkb */, /* XKB keyboard to be edited */
KeyCode /* first_key */, /* first changed key */
int /* num_keys */, /* number of changed keys */
int /* map_width */, /* width of core keymap */
KeySym * /* core_keysyms */, /* symbols from core keymap */
XkbChangesPtr /* changes */ /* resulting changes */
);
/***====================================================================***/
extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo(
XkbDeviceInfoPtr /* devi */,
unsigned int /* ledClass */,
unsigned int /* ledId */
);
extern Status XkbResizeDeviceButtonActions(
XkbDeviceInfoPtr /* devi */,
unsigned int /* newTotal */
);
extern XkbDeviceInfoPtr XkbAllocDeviceInfo(
unsigned int /* deviceSpec */,
unsigned int /* nButtons */,
unsigned int /* szLeds */
);
extern void XkbFreeDeviceInfo(
XkbDeviceInfoPtr /* devi */,
unsigned int /* which */,
Bool /* freeDevI */
);
extern void XkbNoteDeviceChanges(
XkbDeviceChangesPtr /* old */,
XkbExtensionDeviceNotifyEvent * /* new */,
unsigned int /* wanted */
);
extern XkbDeviceInfoPtr XkbGetDeviceInfo(
Display * /* dpy */,
unsigned int /* which */,
unsigned int /* deviceSpec */,
unsigned int /* ledClass */,
unsigned int /* ledID */
);
extern Status XkbGetDeviceInfoChanges(
Display * /* dpy */,
XkbDeviceInfoPtr /* devi */,
XkbDeviceChangesPtr /* changes */
);
extern Status XkbGetDeviceButtonActions(
Display * /* dpy */,
XkbDeviceInfoPtr /* devi */,
Bool /* all */,
unsigned int /* first */,
unsigned int /* nBtns */
);
extern Status XkbGetDeviceLedInfo(
Display * /* dpy */,
XkbDeviceInfoPtr /* devi */,
unsigned int /* ledClass (class, XIDflt, XIAll) */,
unsigned int /* ledId (id, XIDflt, XIAll) */,
unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */
);
extern Bool XkbSetDeviceInfo(
Display * /* dpy */,
unsigned int /* which */,
XkbDeviceInfoPtr /* devi */
);
extern Bool XkbChangeDeviceInfo(
Display* /* dpy */,
XkbDeviceInfoPtr /* desc */,
XkbDeviceChangesPtr /* changes */
);
extern Bool XkbSetDeviceLedInfo(
Display * /* dpy */,
XkbDeviceInfoPtr /* devi */,
unsigned int /* ledClass */,
unsigned int /* ledID */,
unsigned int /* which */
);
extern Bool XkbSetDeviceButtonActions(
Display * /* dpy */,
XkbDeviceInfoPtr /* devi */,
unsigned int /* first */,
unsigned int /* nBtns */
);
/***====================================================================***/
extern char XkbToControl(
char /* c */
);
/***====================================================================***/
extern Bool XkbSetDebuggingFlags(
Display * /* dpy */,
unsigned int /* mask */,
unsigned int /* flags */,
char * /* msg */,
unsigned int /* ctrls_mask */,
unsigned int /* ctrls */,
unsigned int * /* rtrn_flags */,
unsigned int * /* rtrn_ctrls */
);
extern Bool XkbApplyVirtualModChanges(
XkbDescPtr /* xkb */,
unsigned int /* changed */,
XkbChangesPtr /* changes */
);
extern Bool XkbUpdateActionVirtualMods(
XkbDescPtr /* xkb */,
XkbAction * /* act */,
unsigned int /* changed */
);
extern void XkbUpdateKeyTypeVirtualMods(
XkbDescPtr /* xkb */,
XkbKeyTypePtr /* type */,
unsigned int /* changed */,
XkbChangesPtr /* changes */
);
_XFUNCPROTOEND
#endif /* _X11_XKBLIB_H_ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
#ifndef _XtCompositeP_h
#define _XtCompositeP_h
#include <X11/Composite.h>
_XFUNCPROTOBEGIN
/************************************************************************
*
* Additional instance fields for widgets of (sub)class 'Composite'
*
************************************************************************/
typedef struct _CompositePart {
WidgetList children; /* array of ALL widget children */
Cardinal num_children; /* total number of widget children */
Cardinal num_slots; /* number of slots in children array */
XtOrderProc insert_position; /* compute position of new child */
} CompositePart,*CompositePtr;
typedef struct _CompositeRec {
CorePart core;
CompositePart composite;
} CompositeRec;
/*********************************************************************
*
* Additional class fields for widgets of (sub)class 'Composite'
*
********************************************************************/
typedef struct _CompositeClassPart {
XtGeometryHandler geometry_manager; /* geometry manager for children */
XtWidgetProc change_managed; /* change managed state of child */
XtWidgetProc insert_child; /* physically add child to parent */
XtWidgetProc delete_child; /* physically remove child */
XtPointer extension; /* pointer to extension record */
} CompositeClassPart,*CompositePartPtr;
typedef struct {
XtPointer next_extension; /* 1st 4 mandated for all extension records */
XrmQuark record_type; /* NULLQUARK; on CompositeClassPart */
long version; /* must be XtCompositeExtensionVersion */
Cardinal record_size; /* sizeof(CompositeClassExtensionRec) */
Boolean accepts_objects;
Boolean allows_change_managed_set;
} CompositeClassExtensionRec, *CompositeClassExtension;
typedef struct _CompositeClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
} CompositeClassRec;
externalref CompositeClassRec compositeClassRec;
_XFUNCPROTOEND
#define XtCompositeExtensionVersion 2L
#define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit)
#define XtInheritChangeManaged ((XtWidgetProc) _XtInherit)
#define XtInheritInsertChild ((XtWidgetProc) _XtInherit)
#define XtInheritDeleteChild ((XtWidgetProc) _XtInherit)
#endif /* _XtCompositeP_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*****************************************************************
(C) COPYRIGHT International Business Machines Corp. 1992,1997
All Rights Reserved
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the IBM Corporation shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from the IBM
Corporation.
******************************************************************/
#ifndef _RESCONFIGP_H
#define _RESCONFIGP_H
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
/*
* Atom names for resource configuration management customization tool.
*/
#define RCM_DATA "Custom Data"
#define RCM_INIT "Custom Init"
extern void _XtResourceConfigurationEH(
Widget /* w */,
XtPointer /* client_data */,
XEvent * /* event */
);
_XFUNCPROTOEND
#endif
#ifndef XATOM_H
#define XATOM_H 1
/* THIS IS A GENERATED FILE
*
* Do not change! Changing this file implies a protocol change!
*/
#define XA_PRIMARY ((Atom) 1)
#define XA_SECONDARY ((Atom) 2)
#define XA_ARC ((Atom) 3)
#define XA_ATOM ((Atom) 4)
#define XA_BITMAP ((Atom) 5)
#define XA_CARDINAL ((Atom) 6)
#define XA_COLORMAP ((Atom) 7)
#define XA_CURSOR ((Atom) 8)
#define XA_CUT_BUFFER0 ((Atom) 9)
#define XA_CUT_BUFFER1 ((Atom) 10)
#define XA_CUT_BUFFER2 ((Atom) 11)
#define XA_CUT_BUFFER3 ((Atom) 12)
#define XA_CUT_BUFFER4 ((Atom) 13)
#define XA_CUT_BUFFER5 ((Atom) 14)
#define XA_CUT_BUFFER6 ((Atom) 15)
#define XA_CUT_BUFFER7 ((Atom) 16)
#define XA_DRAWABLE ((Atom) 17)
#define XA_FONT ((Atom) 18)
#define XA_INTEGER ((Atom) 19)
#define XA_PIXMAP ((Atom) 20)
#define XA_POINT ((Atom) 21)
#define XA_RECTANGLE ((Atom) 22)
#define XA_RESOURCE_MANAGER ((Atom) 23)
#define XA_RGB_COLOR_MAP ((Atom) 24)
#define XA_RGB_BEST_MAP ((Atom) 25)
#define XA_RGB_BLUE_MAP ((Atom) 26)
#define XA_RGB_DEFAULT_MAP ((Atom) 27)
#define XA_RGB_GRAY_MAP ((Atom) 28)
#define XA_RGB_GREEN_MAP ((Atom) 29)
#define XA_RGB_RED_MAP ((Atom) 30)
#define XA_STRING ((Atom) 31)
#define XA_VISUALID ((Atom) 32)
#define XA_WINDOW ((Atom) 33)
#define XA_WM_COMMAND ((Atom) 34)
#define XA_WM_HINTS ((Atom) 35)
#define XA_WM_CLIENT_MACHINE ((Atom) 36)
#define XA_WM_ICON_NAME ((Atom) 37)
#define XA_WM_ICON_SIZE ((Atom) 38)
#define XA_WM_NAME ((Atom) 39)
#define XA_WM_NORMAL_HINTS ((Atom) 40)
#define XA_WM_SIZE_HINTS ((Atom) 41)
#define XA_WM_ZOOM_HINTS ((Atom) 42)
#define XA_MIN_SPACE ((Atom) 43)
#define XA_NORM_SPACE ((Atom) 44)
#define XA_MAX_SPACE ((Atom) 45)
#define XA_END_SPACE ((Atom) 46)
#define XA_SUPERSCRIPT_X ((Atom) 47)
#define XA_SUPERSCRIPT_Y ((Atom) 48)
#define XA_SUBSCRIPT_X ((Atom) 49)
#define XA_SUBSCRIPT_Y ((Atom) 50)
#define XA_UNDERLINE_POSITION ((Atom) 51)
#define XA_UNDERLINE_THICKNESS ((Atom) 52)
#define XA_STRIKEOUT_ASCENT ((Atom) 53)
#define XA_STRIKEOUT_DESCENT ((Atom) 54)
#define XA_ITALIC_ANGLE ((Atom) 55)
#define XA_X_HEIGHT ((Atom) 56)
#define XA_QUAD_WIDTH ((Atom) 57)
#define XA_WEIGHT ((Atom) 58)
#define XA_POINT_SIZE ((Atom) 59)
#define XA_RESOLUTION ((Atom) 60)
#define XA_COPYRIGHT ((Atom) 61)
#define XA_NOTICE ((Atom) 62)
#define XA_FONT_NAME ((Atom) 63)
#define XA_FAMILY_NAME ((Atom) 64)
#define XA_FULL_NAME ((Atom) 65)
#define XA_CAP_HEIGHT ((Atom) 66)
#define XA_WM_CLASS ((Atom) 67)
#define XA_WM_TRANSIENT_FOR ((Atom) 68)
#define XA_LAST_PREDEFINED ((Atom) 68)
#endif /* XATOM_H */
/*-------------------------------------------------------------------------
*
* postgres_ext.h
*
* This file contains declarations of things that are visible everywhere
* in PostgreSQL *and* are visible to clients of frontend interface libraries.
* For example, the Oid type is part of the API of libpq and other libraries.
*
* Declarations which are specific to a particular interface should
* go in the header file for that interface (such as libpq-fe.h). This
* file is only for fundamental Postgres declarations.
*
* User-written C functions don't count as "external to Postgres."
* Those function much as local modifications to the backend itself, and
* use header files that are otherwise internal to Postgres to interface
* with the backend.
*
* src/include/postgres_ext.h
*
*-------------------------------------------------------------------------
*/
#ifndef POSTGRES_EXT_H
#define POSTGRES_EXT_H
#include "pg_config_ext.h"
/*
* Object ID is a fundamental type in Postgres.
*/
typedef unsigned int Oid;
#ifdef __cplusplus
#define InvalidOid (Oid(0))
#else
#define InvalidOid ((Oid) 0)
#endif
#define OID_MAX UINT_MAX
/* you will need to include <limits.h> to use the above #define */
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
/* the above needs <stdlib.h> */
/* Define a signed 64-bit integer type for use in client API declarations. */
typedef PG_INT64_TYPE pg_int64;
/*
* Identifiers of error message fields. Kept here to keep common
* between frontend and backend, and also to export them to libpq
* applications.
*/
#define PG_DIAG_SEVERITY 'S'
#define PG_DIAG_SEVERITY_NONLOCALIZED 'V'
#define PG_DIAG_SQLSTATE 'C'
#define PG_DIAG_MESSAGE_PRIMARY 'M'
#define PG_DIAG_MESSAGE_DETAIL 'D'
#define PG_DIAG_MESSAGE_HINT 'H'
#define PG_DIAG_STATEMENT_POSITION 'P'
#define PG_DIAG_INTERNAL_POSITION 'p'
#define PG_DIAG_INTERNAL_QUERY 'q'
#define PG_DIAG_CONTEXT 'W'
#define PG_DIAG_SCHEMA_NAME 's'
#define PG_DIAG_TABLE_NAME 't'
#define PG_DIAG_COLUMN_NAME 'c'
#define PG_DIAG_DATATYPE_NAME 'd'
#define PG_DIAG_CONSTRAINT_NAME 'n'
#define PG_DIAG_SOURCE_FILE 'F'
#define PG_DIAG_SOURCE_LINE 'L'
#define PG_DIAG_SOURCE_FUNCTION 'R'
#endif /* POSTGRES_EXT_H */
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
*/
#ifndef _TERMIOS_H
#define _TERMIOS_H 1
#include <features.h>
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* We need `pid_t'. */
# include <bits/types.h>
# ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
# endif
#endif
__BEGIN_DECLS
/* Get the system-dependent definitions of `struct termios', `tcflag_t',
`cc_t', `speed_t', and all the macros specifying the flag bits. */
#include <bits/termios.h>
#ifdef __USE_MISC
/* Compare a character C to a value VAL from the `c_cc' array in a
`struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
# define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
#endif
/* Return the output baud rate stored in *TERMIOS_P. */
extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW;
/* Return the input baud rate stored in *TERMIOS_P. */
extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW;
/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW;
/* Set the input baud rate stored in *TERMIOS_P to SPEED. */
extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
#ifdef __USE_MISC
/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
#endif
/* Put the state of FD into *TERMIOS_P. */
extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
/* Set the state of FD to *TERMIOS_P.
Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */
extern int tcsetattr (int __fd, int __optional_actions,
const struct termios *__termios_p) __THROW;
#ifdef __USE_MISC
/* Set *TERMIOS_P to indicate raw mode. */
extern void cfmakeraw (struct termios *__termios_p) __THROW;
#endif
/* Send zero bits on FD. */
extern int tcsendbreak (int __fd, int __duration) __THROW;
/* Wait for pending output to be written on FD.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int tcdrain (int __fd);
/* Flush pending data on FD.
Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */
extern int tcflush (int __fd, int __queue_selector) __THROW;
/* Suspend or restart transmission on FD.
Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */
extern int tcflow (int __fd, int __action) __THROW;
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Get process group ID for session leader for controlling terminal FD. */
extern __pid_t tcgetsid (int __fd) __THROW;
#endif
#ifdef __USE_MISC
# include <sys/ttydefaults.h>
#endif
__END_DECLS
#endif /* termios.h */
/* Header describing `ar' archive file format.
Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _AR_H
#define _AR_H 1
#include <sys/cdefs.h>
/* Archive files start with the ARMAG identifying string. Then follows a
`struct ar_hdr', and as many bytes of member file data as its `ar_size'
member indicates, for each member file. */
#define ARMAG "!<arch>\n" /* String that begins an archive file. */
#define SARMAG 8 /* Size of that string. */
#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */
__BEGIN_DECLS
struct ar_hdr
{
char ar_name[16]; /* Member file name, sometimes / terminated. */
char ar_date[12]; /* File date, decimal seconds since Epoch. */
char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */
char ar_mode[8]; /* File mode, in ASCII octal. */
char ar_size[10]; /* File size, in ASCII decimal. */
char ar_fmag[2]; /* Always contains ARFMAG. */
};
__END_DECLS
#endif /* ar.h */
/****************************************************************************
* Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Thomas E. Dickey 2006 *
****************************************************************************/
/* $Id: nc_tparm.h,v 1.8 2017/07/22 17:09:46 tom Exp $ */
#ifndef NC_TPARM_included
#define NC_TPARM_included 1
#include <ncurses_cfg.h>
#include <curses.h>
/*
* Cast parameters past the formatting-string for tparm() to match the
* assumption of the varargs code.
*/
#ifndef TPARM_ARG
#ifdef NCURSES_TPARM_ARG
#define TPARM_ARG NCURSES_TPARM_ARG
#else
#define TPARM_ARG long
#endif
#endif /* TPARAM_ARG */
#define TPARM_N(n) (TPARM_ARG)(n)
#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
#if NCURSES_TPARM_VARARGS
#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i))
#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h))
#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g))
#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f))
#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
#define TPARM_1(a,b) tparm(a,TPARM_N(b))
#define TPARM_0(a) tparm(a)
#else
#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
#define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
#define TPARM_1(a,b) TPARM_2(a,b,0)
#define TPARM_1(a,b) TPARM_2(a,b,0)
#define TPARM_0(a) TPARM_1(a,0)
#endif
#endif /* NC_TPARM_included */
/* ltdl.h -- generic dlopen functions
Copyright (C) 1998-2000, 2004-2005, 2007-2008, 2011-2015 Free
Software Foundation, Inc.
Written by Thomas Tanner, 1998
NOTE: The canonical source of this file is maintained with the
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
GNU Libltdl is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
As a special exception to the GNU Lesser General Public License,
if you distribute this file as part of a program or library that
is built using GNU Libtool, you may include this file under the
same distribution terms that you use for the rest of that program.
GNU Libltdl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with GNU Libltdl; see the file COPYING.LIB. If not, a
copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
or obtained by writing to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Only include this header file once. */
#if !defined LTDL_H
#define LTDL_H 1
#include <libltdl/lt_system.h>
#include <libltdl/lt_error.h>
#include <libltdl/lt_dlloader.h>
LT_BEGIN_C_DECLS
/* LT_STRLEN can be used safely on NULL pointers. */
#define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0)
/* --- DYNAMIC MODULE LOADING API --- */
typedef struct lt__handle *lt_dlhandle; /* A loaded module. */
/* Initialisation and finalisation functions for libltdl. */
LT_SCOPE int lt_dlinit (void);
LT_SCOPE int lt_dlexit (void);
/* Module search path manipulation. */
LT_SCOPE int lt_dladdsearchdir (const char *search_dir);
LT_SCOPE int lt_dlinsertsearchdir (const char *before,
const char *search_dir);
LT_SCOPE int lt_dlsetsearchpath (const char *search_path);
LT_SCOPE const char *lt_dlgetsearchpath (void);
LT_SCOPE int lt_dlforeachfile (
const char *search_path,
int (*func) (const char *filename, void *data),
void *data);
/* User module loading advisors. */
LT_SCOPE int lt_dladvise_init (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_destroy (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_ext (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_resident (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_local (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_global (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_preload (lt_dladvise *advise);
/* Portable libltdl versions of the system dlopen() API. */
LT_SCOPE lt_dlhandle lt_dlopen (const char *filename);
LT_SCOPE lt_dlhandle lt_dlopenext (const char *filename);
LT_SCOPE lt_dlhandle lt_dlopenadvise (const char *filename,
lt_dladvise advise);
LT_SCOPE void * lt_dlsym (lt_dlhandle handle, const char *name);
LT_SCOPE const char *lt_dlerror (void);
LT_SCOPE int lt_dlclose (lt_dlhandle handle);
/* --- PRELOADED MODULE SUPPORT --- */
/* A preopened symbol. Arrays of this type comprise the exported
symbols for a dlpreopened module. */
typedef struct {
const char *name;
void *address;
} lt_dlsymlist;
typedef int lt_dlpreload_callback_func (lt_dlhandle handle);
LT_SCOPE int lt_dlpreload (const lt_dlsymlist *preloaded);
LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded);
LT_SCOPE int lt_dlpreload_open (const char *originator,
lt_dlpreload_callback_func *func);
#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols
/* Ensure C linkage. */
extern LT_DLSYM_CONST lt_dlsymlist lt__PROGRAM__LTX_preloaded_symbols[];
#define LTDL_SET_PRELOADED_SYMBOLS() \
lt_dlpreload_default(lt_preloaded_symbols)
/* --- MODULE INFORMATION --- */
/* Associating user data with loaded modules. */
typedef void * lt_dlinterface_id;
typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string);
LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string,
lt_dlhandle_interface *iface);
LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key);
LT_SCOPE void * lt_dlcaller_set_data (lt_dlinterface_id key,
lt_dlhandle handle, void *data);
LT_SCOPE void * lt_dlcaller_get_data (lt_dlinterface_id key,
lt_dlhandle handle);
/* Read only information pertaining to a loaded module. */
typedef struct {
char * filename; /* file name */
char * name; /* module name */
int ref_count; /* number of times lt_dlopened minus
number of times lt_dlclosed. */
unsigned int is_resident:1; /* module can't be unloaded. */
unsigned int is_symglobal:1; /* module symbols can satisfy
subsequently loaded modules. */
unsigned int is_symlocal:1; /* module symbols are only available
locally. */
} lt_dlinfo;
LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle);
LT_SCOPE lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface,
lt_dlhandle place);
LT_SCOPE lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface,
const char *module_name);
LT_SCOPE int lt_dlhandle_map (lt_dlinterface_id iface,
int (*func) (lt_dlhandle handle, void *data),
void *data);
/* Deprecated module residency management API. */
LT_SCOPE int lt_dlmakeresident (lt_dlhandle handle);
LT_SCOPE int lt_dlisresident (lt_dlhandle handle);
#define lt_ptr void *
LT_END_C_DECLS
#endif /*!defined LTDL_H*/
/*
* Copyright (c) 2013, Petar Alilovic,
* Faculty of Electrical Engineering and Computing, University of Zagreb
* All rights reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#ifndef lib_pcap_nflog_h
#define lib_pcap_nflog_h
#include <pcap/pcap-inttypes.h>
/*
* Structure of an NFLOG header and TLV parts, as described at
* https://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html
*
* The NFLOG header is big-endian.
*
* The TLV length and type are in host byte order. The value is either
* big-endian or is an array of bytes in some externally-specified byte
* order (text string, link-layer address, link-layer header, packet
* data, etc.).
*/
typedef struct nflog_hdr {
uint8_t nflog_family; /* address family */
uint8_t nflog_version; /* version */
uint16_t nflog_rid; /* resource ID */
} nflog_hdr_t;
typedef struct nflog_tlv {
uint16_t tlv_length; /* tlv length */
uint16_t tlv_type; /* tlv type */
/* value follows this */
} nflog_tlv_t;
typedef struct nflog_packet_hdr {
uint16_t hw_protocol; /* hw protocol */
uint8_t hook; /* netfilter hook */
uint8_t pad; /* padding to 32 bits */
} nflog_packet_hdr_t;
typedef struct nflog_hwaddr {
uint16_t hw_addrlen; /* address length */
uint16_t pad; /* padding to 32-bit boundary */
uint8_t hw_addr[8]; /* address, up to 8 bytes */
} nflog_hwaddr_t;
typedef struct nflog_timestamp {
uint64_t sec;
uint64_t usec;
} nflog_timestamp_t;
/*
* TLV types.
*/
#define NFULA_PACKET_HDR 1 /* nflog_packet_hdr_t */
#define NFULA_MARK 2 /* packet mark from skbuff */
#define NFULA_TIMESTAMP 3 /* nflog_timestamp_t for skbuff's time stamp */
#define NFULA_IFINDEX_INDEV 4 /* ifindex of device on which packet received (possibly bridge group) */
#define NFULA_IFINDEX_OUTDEV 5 /* ifindex of device on which packet transmitted (possibly bridge group) */
#define NFULA_IFINDEX_PHYSINDEV 6 /* ifindex of physical device on which packet received (not bridge group) */
#define NFULA_IFINDEX_PHYSOUTDEV 7 /* ifindex of physical device on which packet transmitted (not bridge group) */
#define NFULA_HWADDR 8 /* nflog_hwaddr_t for hardware address */
#define NFULA_PAYLOAD 9 /* packet payload */
#define NFULA_PREFIX 10 /* text string - null-terminated, count includes NUL */
#define NFULA_UID 11 /* UID owning socket on which packet was sent/received */
#define NFULA_SEQ 12 /* sequence number of packets on this NFLOG socket */
#define NFULA_SEQ_GLOBAL 13 /* sequence number of pakets on all NFLOG sockets */
#define NFULA_GID 14 /* GID owning socket on which packet was sent/received */
#define NFULA_HWTYPE 15 /* ARPHRD_ type of skbuff's device */
#define NFULA_HWHEADER 16 /* skbuff's MAC-layer header */
#define NFULA_HWLEN 17 /* length of skbuff's MAC-layer header */
#endif
/*
* Copyright (c) 2006 Paolo Abeni (Italy)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Basic USB data struct
* By Paolo Abeni <paolo.abeni@email.it>
*/
#ifndef lib_pcap_usb_h
#define lib_pcap_usb_h
#include <pcap/pcap-inttypes.h>
/*
* possible transfer mode
*/
#define URB_TRANSFER_IN 0x80
#define URB_ISOCHRONOUS 0x0
#define URB_INTERRUPT 0x1
#define URB_CONTROL 0x2
#define URB_BULK 0x3
/*
* possible event type
*/
#define URB_SUBMIT 'S'
#define URB_COMPLETE 'C'
#define URB_ERROR 'E'
/*
* USB setup header as defined in USB specification.
* Appears at the front of each Control S-type packet in DLT_USB captures.
*/
typedef struct _usb_setup {
uint8_t bmRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} pcap_usb_setup;
/*
* Information from the URB for Isochronous transfers.
*/
typedef struct _iso_rec {
int32_t error_count;
int32_t numdesc;
} iso_rec;
/*
* Header prepended by linux kernel to each event.
* Appears at the front of each packet in DLT_USB_LINUX captures.
*/
typedef struct _usb_header {
uint64_t id;
uint8_t event_type;
uint8_t transfer_type;
uint8_t endpoint_number;
uint8_t device_address;
uint16_t bus_id;
char setup_flag;/*if !=0 the urb setup header is not present*/
char data_flag; /*if !=0 no urb data is present*/
int64_t ts_sec;
int32_t ts_usec;
int32_t status;
uint32_t urb_len;
uint32_t data_len; /* amount of urb data really present in this event*/
pcap_usb_setup setup;
} pcap_usb_header;
/*
* Header prepended by linux kernel to each event for the 2.6.31
* and later kernels; for the 2.6.21 through 2.6.30 kernels, the
* "iso_rec" information, and the fields starting with "interval"
* are zeroed-out padding fields.
*
* Appears at the front of each packet in DLT_USB_LINUX_MMAPPED captures.
*/
typedef struct _usb_header_mmapped {
uint64_t id;
uint8_t event_type;
uint8_t transfer_type;
uint8_t endpoint_number;
uint8_t device_address;
uint16_t bus_id;
char setup_flag;/*if !=0 the urb setup header is not present*/
char data_flag; /*if !=0 no urb data is present*/
int64_t ts_sec;
int32_t ts_usec;
int32_t status;
uint32_t urb_len;
uint32_t data_len; /* amount of urb data really present in this event*/
union {
pcap_usb_setup setup;
iso_rec iso;
} s;
int32_t interval; /* for Interrupt and Isochronous events */
int32_t start_frame; /* for Isochronous events */
uint32_t xfer_flags; /* copy of URB's transfer flags */
uint32_t ndesc; /* number of isochronous descriptors */
} pcap_usb_header_mmapped;
/*
* Isochronous descriptors; for isochronous transfers there might be
* one or more of these at the beginning of the packet data. The
* number of descriptors is given by the "ndesc" field in the header;
* as indicated, in older kernels that don't put the descriptors at
* the beginning of the packet, that field is zeroed out, so that field
* can be trusted even in captures from older kernels.
*/
typedef struct _usb_isodesc {
int32_t status;
uint32_t offset;
uint32_t len;
uint8_t pad[4];
} usb_isodesc;
#endif
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lib_pcap_socket_h
#define lib_pcap_socket_h
/*
* Some minor differences between sockets on various platforms.
* We include whatever sockets are needed for Internet-protocol
* socket access on UN*X and Windows.
*/
#ifdef _WIN32
/* Need windef.h for defines used in winsock2.h under MingW32 */
#ifdef __MINGW32__
#include <windef.h>
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
/*
* Winsock doesn't have this UN*X type; it's used in the UN*X
* sockets API.
*
* XXX - do we need to worry about UN*Xes so old that *they*
* don't have it, either?
*/
typedef int socklen_t;
/*
* Winsock doesn't have this POSIX type; it's used for the
* tv_usec value of struct timeval.
*/
typedef long suseconds_t;
#else /* _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h> /* for struct addrinfo/getaddrinfo() */
#include <netinet/in.h> /* for sockaddr_in, in BSD at least */
#include <arpa/inet.h>
/*!
* \brief In Winsock, a socket handle is of type SOCKET; in UN*X, it's
* a file descriptor, and therefore a signed integer.
* We define SOCKET to be a signed integer on UN*X, so that it can
* be used on both platforms.
*/
#ifndef SOCKET
#define SOCKET int
#endif
/*!
* \brief In Winsock, the error return if socket() fails is INVALID_SOCKET;
* in UN*X, it's -1.
* We define INVALID_SOCKET to be -1 on UN*X, so that it can be used on
* both platforms.
*/
#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif
#endif /* _WIN32 */
#endif /* lib_pcap_socket_h */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*/
#ifndef lib_pcap_dlt_h
#define lib_pcap_dlt_h
/*
* Link-layer header type codes.
*
* Do *NOT* add new values to this list without asking
* "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run
* the risk of using a value that's already being used for some other
* purpose, and of having tools that read libpcap-format captures not
* being able to handle captures with your new DLT_ value, with no hope
* that they will ever be changed to do so (as that would destroy their
* ability to read captures using that value for that other purpose).
*
* See
*
* https://www.tcpdump.org/linktypes.html
*
* for detailed descriptions of some of these link-layer header types.
*/
/*
* These are the types that are the same on all platforms, and that
* have been defined by <net/bpf.h> for ages.
*/
#define DLT_NULL 0 /* BSD loopback encapsulation */
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
#define DLT_AX25 3 /* Amateur Radio AX.25 */
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* 802.5 Token Ring */
#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
/*
* These are types that are different on some platforms, and that
* have been defined by <net/bpf.h> for ages. We use #ifdefs to
* detect the BSDs that define them differently from the traditional
* libpcap <net/bpf.h>
*
* XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS,
* but I don't know what the right #define is for BSD/OS.
*/
#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */
#ifdef __OpenBSD__
#define DLT_RAW 14 /* raw IP */
#else
#define DLT_RAW 12 /* raw IP */
#endif
/*
* Given that the only OS that currently generates BSD/OS SLIP or PPP
* is, well, BSD/OS, arguably everybody should have chosen its values
* for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they
* didn't. So it goes.
*/
#if defined(__NetBSD__) || defined(__FreeBSD__)
#ifndef DLT_SLIP_BSDOS
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
#endif
#else
#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */
#endif
/*
* 17 was used for DLT_PFLOG in OpenBSD; it no longer is.
*
* It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG
* as 117 so that pflog captures would use a link-layer header type
* value that didn't collide with any other values. On all
* platforms other than OpenBSD, we defined DLT_PFLOG as 117,
* and we mapped between LINKTYPE_PFLOG and DLT_PFLOG.
*
* OpenBSD eventually switched to using 117 for DLT_PFLOG as well.
*
* Don't use 17 for anything else.
*/
/*
* 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and
* macOS; don't use it for anything else. (FreeBSD uses 121, which
* collides with DLT_HHDLC, even though it doesn't use 18 for
* anything and doesn't appear to have ever used it for anything.)
*
* We define it as 18 on those platforms; it is, unfortunately, used
* for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC
* in general. As the packet format for it, like that for
* DLT_PFLOG, is not only OS-dependent but OS-version-dependent,
* we don't support printing it in tcpdump except on OSes that
* have the relevant header files, so it's not that useful on
* other platforms.
*/
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
#define DLT_PFSYNC 18
#endif
#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */
/*
* Apparently Redback uses this for its SmartEdge 400/800. I hope
* nobody else decided to use it, too.
*/
#define DLT_REDBACK_SMARTEDGE 32
/*
* These values are defined by NetBSD; other platforms should refrain from
* using them for other purposes, so that NetBSD savefiles with link
* types of 50 or 51 can be read as this type on all platforms.
*/
#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */
#define DLT_PPP_ETHER 51 /* PPP over Ethernet */
/*
* The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses
* a link-layer type of 99 for the tcpdump it supplies. The link-layer
* header has 6 bytes of unknown data, something that appears to be an
* Ethernet type, and 36 bytes that appear to be 0 in at least one capture
* I've seen.
*/
#define DLT_SYMANTEC_FIREWALL 99
/*
* Values between 100 and 103 are used in capture file headers as
* link-layer header type LINKTYPE_ values corresponding to DLT_ types
* that differ between platforms; don't use those values for new DLT_
* new types.
*/
/*
* Values starting with 104 are used for newly-assigned link-layer
* header type values; for those link-layer header types, the DLT_
* value returned by pcap_datalink() and passed to pcap_open_dead(),
* and the LINKTYPE_ value that appears in capture files, are the
* same.
*
* DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is
* the highest such value.
*/
#define DLT_MATCHING_MIN 104
/*
* This value was defined by libpcap 0.5; platforms that have defined
* it with a different value should define it here with that value -
* a link type of 104 in a save file will be mapped to DLT_C_HDLC,
* whatever value that happens to be, so programs will correctly
* handle files with that link type regardless of the value of
* DLT_C_HDLC.
*
* The name DLT_C_HDLC was used by BSD/OS; we use that name for source
* compatibility with programs written for BSD/OS.
*
* libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
* for source compatibility with programs written for libpcap 0.5.
*/
#define DLT_C_HDLC 104 /* Cisco HDLC */
#define DLT_CHDLC DLT_C_HDLC
#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */
/*
* 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW,
* except when it isn't. (I.e., sometimes it's just raw IP, and
* sometimes it isn't.) We currently handle it as DLT_LINUX_SLL,
* so that we don't have to worry about the link-layer header.)
*/
/*
* Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
* with other values.
* DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
* (DLCI, etc.).
*/
#define DLT_FRELAY 107
/*
* OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
* that the AF_ type in the link-layer header is in network byte order.
*
* DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so
* we don't use 12 for it in OSes other than OpenBSD.
*/
#ifdef __OpenBSD__
#define DLT_LOOP 12
#else
#define DLT_LOOP 108
#endif
/*
* Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
* DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
* than OpenBSD.
*/
#ifdef __OpenBSD__
#define DLT_ENC 13
#else
#define DLT_ENC 109
#endif
/*
* Values between 110 and 112 are reserved for use in capture file headers
* as link-layer types corresponding to DLT_ types that might differ
* between platforms; don't use those values for new DLT_ types
* other than the corresponding DLT_ types.
*/
/*
* Linux cooked sockets.
*/
#define DLT_LINUX_SLL 113
/*
* Apple LocalTalk hardware.
*/
#define DLT_LTALK 114
/*
* Acorn Econet.
*/
#define DLT_ECONET 115
/*
* Reserved for use with OpenBSD ipfilter.
*/
#define DLT_IPFILTER 116
/*
* OpenBSD DLT_PFLOG.
*/
#define DLT_PFLOG 117
/*
* Registered for Cisco-internal use.
*/
#define DLT_CISCO_IOS 118
/*
* For 802.11 cards using the Prism II chips, with a link-layer
* header including Prism monitor mode information plus an 802.11
* header.
*/
#define DLT_PRISM_HEADER 119
/*
* Reserved for Aironet 802.11 cards, with an Aironet link-layer header
* (see Doug Ambrisko's FreeBSD patches).
*/
#define DLT_AIRONET_HEADER 120
/*
* Sigh.
*
* 121 was reserved for Siemens HiPath HDLC on 2002-01-25, as
* requested by Tomas Kukosa.
*
* On 2004-02-25, a FreeBSD checkin to sys/net/bpf.h was made that
* assigned 121 as DLT_PFSYNC. In current versions, its libpcap
* does DLT_ <-> LINKTYPE_ mapping, mapping DLT_PFSYNC to a
* LINKTYPE_PFSYNC value of 246, so it should write out DLT_PFSYNC
* dump files with 246 as the link-layer header type. (Earlier
* versions might not have done mapping, in which case they would
* have written them out with a link-layer header type of 121.)
*
* OpenBSD, from which pf came, however, uses 18 for DLT_PFSYNC;
* its libpcap does no DLT_ <-> LINKTYPE_ mapping, so it would
* write out DLT_PFSYNC dump files with use 18 as the link-layer
* header type.
*
* NetBSD, DragonFly BSD, and Darwin also use 18 for DLT_PFSYNC; in
* current versions, their libpcaps do DLT_ <-> LINKTYPE_ mapping,
* mapping DLT_PFSYNC to a LINKTYPE_PFSYNC value of 246, so they
* should write out DLT_PFSYNC dump files with 246 as the link-layer
* header type. (Earlier versions might not have done mapping,
* in which case they'd work the same way OpenBSD does, writing
* them out with a link-layer header type of 18.)
*
* We'll define DLT_PFSYNC as:
*
* 18 on NetBSD, OpenBSD, DragonFly BSD, and Darwin;
*
* 121 on FreeBSD;
*
* 246 everywhere else.
*
* We'll define DLT_HHDLC as 121 on everything except for FreeBSD;
* anybody who wants to compile, on FreeBSD, code that uses DLT_HHDLC
* is out of luck.
*
* We'll define LINKTYPE_PFSYNC as 246 on *all* platforms, so that
* savefiles written using *this* code won't use 18 or 121 for PFSYNC,
* they'll all use 246.
*
* Code that uses pcap_datalink() to determine the link-layer header
* type of a savefile won't, when built and run on FreeBSD, be able
* to distinguish between LINKTYPE_PFSYNC and LINKTYPE_HHDLC capture
* files, as pcap_datalink() will give 121 for both of them. Code
* that doesn't, such as the code in Wireshark, will be able to
* distinguish between them.
*
* FreeBSD's libpcap won't map a link-layer header type of 18 - i.e.,
* DLT_PFSYNC files from OpenBSD and possibly older versions of NetBSD,
* DragonFly BSD, and macOS - to DLT_PFSYNC, so code built with FreeBSD's
* libpcap won't treat those files as DLT_PFSYNC files.
*
* Other libpcaps won't map a link-layer header type of 121 to DLT_PFSYNC;
* this means they can read DLT_HHDLC files, if any exist, but won't
* treat pcap files written by any older versions of FreeBSD libpcap that
* didn't map to 246 as DLT_PFSYNC files.
*/
#ifdef __FreeBSD__
#define DLT_PFSYNC 121
#else
#define DLT_HHDLC 121
#endif
/*
* This is for RFC 2625 IP-over-Fibre Channel.
*
* This is not for use with raw Fibre Channel, where the link-layer
* header starts with a Fibre Channel frame header; it's for IP-over-FC,
* where the link-layer header starts with an RFC 2625 Network_Header
* field.
*/
#define DLT_IP_OVER_FC 122
/*
* This is for Full Frontal ATM on Solaris with SunATM, with a
* pseudo-header followed by an AALn PDU.
*
* There may be other forms of Full Frontal ATM on other OSes,
* with different pseudo-headers.
*
* If ATM software returns a pseudo-header with VPI/VCI information
* (and, ideally, packet type information, e.g. signalling, ILMI,
* LANE, LLC-multiplexed traffic, etc.), it should not use
* DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump
* and the like don't have to infer the presence or absence of a
* pseudo-header and the form of the pseudo-header.
*/
#define DLT_SUNATM 123 /* Solaris+SunATM */
/*
* Reserved as per request from Kent Dahlgren <kent@praesum.com>
* for private use.
*/
#define DLT_RIO 124 /* RapidIO */
#define DLT_PCI_EXP 125 /* PCI Express */
#define DLT_AURORA 126 /* Xilinx Aurora link layer */
/*
* Header for 802.11 plus a number of bits of link-layer information
* including radio information, used by some recent BSD drivers as
* well as the madwifi Atheros driver for Linux.
*/
#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */
/*
* Reserved for the TZSP encapsulation, as per request from
* Chris Waters <chris.waters@networkchemistry.com>
* TZSP is a generic encapsulation for any other link type,
* which includes a means to include meta-information
* with the packet, e.g. signal strength and channel
* for 802.11 packets.
*/
#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
/*
* BSD's ARCNET headers have the source host, destination host,
* and type at the beginning of the packet; that's what's handed
* up to userland via BPF.
*
* Linux's ARCNET headers, however, have a 2-byte offset field
* between the host IDs and the type; that's what's handed up
* to userland via PF_PACKET sockets.
*
* We therefore have to have separate DLT_ values for them.
*/
#define DLT_ARCNET_LINUX 129 /* ARCNET */
/*
* Juniper-private data link types, as per request from
* Hannes Gredler <hannes@juniper.net>. The DLT_s are used
* for passing on chassis-internal metainformation such as
* QOS profiles, etc..
*/
#define DLT_JUNIPER_MLPPP 130
#define DLT_JUNIPER_MLFR 131
#define DLT_JUNIPER_ES 132
#define DLT_JUNIPER_GGSN 133
#define DLT_JUNIPER_MFR 134
#define DLT_JUNIPER_ATM2 135
#define DLT_JUNIPER_SERVICES 136
#define DLT_JUNIPER_ATM1 137
/*
* Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund
* <dieter@apple.com>. The header that's presented is an Ethernet-like
* header:
*
* #define FIREWIRE_EUI64_LEN 8
* struct firewire_header {
* u_char firewire_dhost[FIREWIRE_EUI64_LEN];
* u_char firewire_shost[FIREWIRE_EUI64_LEN];
* u_short firewire_type;
* };
*
* with "firewire_type" being an Ethernet type value, rather than,
* for example, raw GASP frames being handed up.
*/
#define DLT_APPLE_IP_OVER_IEEE1394 138
/*
* Various SS7 encapsulations, as per a request from Jeff Morriss
* <jeff.morriss[AT]ulticom.com> and subsequent discussions.
*/
#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */
#define DLT_MTP2 140 /* MTP2, without pseudo-header */
#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */
#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */
/*
* DOCSIS MAC frames.
*/
#define DLT_DOCSIS 143
/*
* Linux-IrDA packets. Protocol defined at http://www.irda.org.
* Those packets include IrLAP headers and above (IrLMP...), but
* don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy
* framing can be handled by the hardware and depend on the bitrate.
* This is exactly the format you would get capturing on a Linux-IrDA
* interface (irdaX), but not on a raw serial port.
* Note the capture is done in "Linux-cooked" mode, so each packet include
* a fake packet header (struct sll_header). This is because IrDA packet
* decoding is dependant on the direction of the packet (incomming or
* outgoing).
* When/if other platform implement IrDA capture, we may revisit the
* issue and define a real DLT_IRDA...
* Jean II
*/
#define DLT_LINUX_IRDA 144
/*
* Reserved for IBM SP switch and IBM Next Federation switch.
*/
#define DLT_IBM_SP 145
#define DLT_IBM_SN 146
/*
* Reserved for private use. If you have some link-layer header type
* that you want to use within your organization, with the capture files
* using that link-layer header type not ever be sent outside your
* organization, you can use these values.
*
* No libpcap release will use these for any purpose, nor will any
* tcpdump release use them, either.
*
* Do *NOT* use these in capture files that you expect anybody not using
* your private versions of capture-file-reading tools to read; in
* particular, do *NOT* use them in products, otherwise you may find that
* people won't be able to use tcpdump, or snort, or Ethereal, or... to
* read capture files from your firewall/intrusion detection/traffic
* monitoring/etc. appliance, or whatever product uses that DLT_ value,
* and you may also find that the developers of those applications will
* not accept patches to let them read those files.
*
* Also, do not use them if somebody might send you a capture using them
* for *their* private type and tools using them for *your* private type
* would have to read them.
*
* Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value,
* as per the comment above, and use the type you're given.
*/
#define DLT_USER0 147
#define DLT_USER1 148
#define DLT_USER2 149
#define DLT_USER3 150
#define DLT_USER4 151
#define DLT_USER5 152
#define DLT_USER6 153
#define DLT_USER7 154
#define DLT_USER8 155
#define DLT_USER9 156
#define DLT_USER10 157
#define DLT_USER11 158
#define DLT_USER12 159
#define DLT_USER13 160
#define DLT_USER14 161
#define DLT_USER15 162
/*
* For future use with 802.11 captures - defined by AbsoluteValue
* Systems to store a number of bits of link-layer information
* including radio information:
*
* http://www.shaftnet.org/~pizza/software/capturefrm.txt
*
* but it might be used by some non-AVS drivers now or in the
* future.
*/
#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>. The DLT_s are used
* for passing on chassis-internal metainformation such as
* QOS profiles, etc..
*/
#define DLT_JUNIPER_MONITOR 164
/*
* BACnet MS/TP frames.
*/
#define DLT_BACNET_MS_TP 165
/*
* Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
*
* This is used in some OSes to allow a kernel socket filter to distinguish
* between incoming and outgoing packets, on a socket intended to
* supply pppd with outgoing packets so it can do dial-on-demand and
* hangup-on-lack-of-demand; incoming packets are filtered out so they
* don't cause pppd to hold the connection up (you don't want random
* input packets such as port scans, packets from old lost connections,
* etc. to force the connection to stay up).
*
* The first byte of the PPP header (0xff03) is modified to accomodate
* the direction - 0x00 = IN, 0x01 = OUT.
*/
#define DLT_PPP_PPPD 166
/*
* Names for backwards compatibility with older versions of some PPP
* software; new software should use DLT_PPP_PPPD.
*/
#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD
#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>. The DLT_s are used
* for passing on chassis-internal metainformation such as
* QOS profiles, cookies, etc..
*/
#define DLT_JUNIPER_PPPOE 167
#define DLT_JUNIPER_PPPOE_ATM 168
#define DLT_GPRS_LLC 169 /* GPRS LLC */
#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */
#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */
/*
* Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line
* monitoring equipment.
*/
#define DLT_GCOM_T1E1 172
#define DLT_GCOM_SERIAL 173
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>. The DLT_ is used
* for internal communication to Physical Interface Cards (PIC)
*/
#define DLT_JUNIPER_PIC_PEER 174
/*
* Link types requested by Gregor Maier <gregor@endace.com> of Endace
* Measurement Systems. They add an ERF header (see
* http://www.endace.com/support/EndaceRecordFormat.pdf) in front of
* the link-layer header.
*/
#define DLT_ERF_ETH 175 /* Ethernet */
#define DLT_ERF_POS 176 /* Packet-over-SONET */
/*
* Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD
* for vISDN (http://www.orlandi.com/visdn/). Its link-layer header
* includes additional information before the LAPD header, so it's
* not necessarily a generic LAPD header.
*/
#define DLT_LINUX_LAPD 177
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>.
* The DLT_ are used for prepending meta-information
* like interface index, interface name
* before standard Ethernet, PPP, Frelay & C-HDLC Frames
*/
#define DLT_JUNIPER_ETHER 178
#define DLT_JUNIPER_PPP 179
#define DLT_JUNIPER_FRELAY 180
#define DLT_JUNIPER_CHDLC 181
/*
* Multi Link Frame Relay (FRF.16)
*/
#define DLT_MFR 182
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>.
* The DLT_ is used for internal communication with a
* voice Adapter Card (PIC)
*/
#define DLT_JUNIPER_VP 183
/*
* Arinc 429 frames.
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
* Every frame contains a 32bit A429 label.
* More documentation on Arinc 429 can be found at
* http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
*/
#define DLT_A429 184
/*
* Arinc 653 Interpartition Communication messages.
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
* Please refer to the A653-1 standard for more information.
*/
#define DLT_A653_ICM 185
/*
* This used to be "USB packets, beginning with a USB setup header;
* requested by Paolo Abeni <paolo.abeni@email.it>."
*
* However, that header didn't work all that well - it left out some
* useful information - and was abandoned in favor of the DLT_USB_LINUX
* header.
*
* This is now used by FreeBSD for its BPF taps for USB; that has its
* own headers. So it is written, so it is done.
*
* For source-code compatibility, we also define DLT_USB to have this
* value. We do it numerically so that, if code that includes this
* file (directly or indirectly) also includes an OS header that also
* defines DLT_USB as 186, we don't get a redefinition warning.
* (NetBSD 7 does that.)
*/
#define DLT_USB_FREEBSD 186
#define DLT_USB 186
/*
* Bluetooth HCI UART transport layer (part H:4); requested by
* Paolo Abeni.
*/
#define DLT_BLUETOOTH_HCI_H4 187
/*
* IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
* <cruz_petagay@bah.com>.
*/
#define DLT_IEEE802_16_MAC_CPS 188
/*
* USB packets, beginning with a Linux USB header; requested by
* Paolo Abeni <paolo.abeni@email.it>.
*/
#define DLT_USB_LINUX 189
/*
* Controller Area Network (CAN) v. 2.0B packets.
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
* Used to dump CAN packets coming from a CAN Vector board.
* More documentation on the CAN v2.0B frames can be found at
* http://www.can-cia.org/downloads/?269
*/
#define DLT_CAN20B 190
/*
* IEEE 802.15.4, with address fields padded, as is done by Linux
* drivers; requested by Juergen Schimmer.
*/
#define DLT_IEEE802_15_4_LINUX 191
/*
* Per Packet Information encapsulated packets.
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
*/
#define DLT_PPI 192
/*
* Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
* requested by Charles Clancy.
*/
#define DLT_IEEE802_16_MAC_CPS_RADIO 193
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>.
* The DLT_ is used for internal communication with a
* integrated service module (ISM).
*/
#define DLT_JUNIPER_ISM 194
/*
* IEEE 802.15.4, exactly as it appears in the spec (no padding, no
* nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>.
* For this one, we expect the FCS to be present at the end of the frame;
* if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be used.
*
* We keep the name DLT_IEEE802_15_4 as an alias for backwards
* compatibility, but, again, this should *only* be used for 802.15.4
* frames that include the FCS.
*/
#define DLT_IEEE802_15_4_WITHFCS 195
#define DLT_IEEE802_15_4 DLT_IEEE802_15_4_WITHFCS
/*
* Various link-layer types, with a pseudo-header, for SITA
* (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).
*/
#define DLT_SITA 196
/*
* Various link-layer types, with a pseudo-header, for Endace DAG cards;
* encapsulates Endace ERF records. Requested by Stephen Donnelly
* <stephen@endace.com>.
*/
#define DLT_ERF 197
/*
* Special header prepended to Ethernet packets when capturing from a
* u10 Networks board. Requested by Phil Mulholland
* <phil@u10networks.com>.
*/
#define DLT_RAIF1 198
/*
* IPMB packet for IPMI, beginning with a 2-byte header, followed by
* the I2C slave address, followed by the netFn and LUN, etc..
* Requested by Chanthy Toeung <chanthy.toeung@ca.kontron.com>.
*
* XXX - this used to be called DLT_IPMB, back when we got the
* impression from the email thread requesting it that the packet
* had no extra 2-byte header. We've renamed it; if anybody used
* DLT_IPMB and assumed no 2-byte header, this will cause the compile
* to fail, at which point we'll have to figure out what to do about
* the two header types using the same DLT_/LINKTYPE_ value. If that
* doesn't happen, we'll assume nobody used it and that the redefinition
* is safe.
*/
#define DLT_IPMB_KONTRON 199
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>.
* The DLT_ is used for capturing data on a secure tunnel interface.
*/
#define DLT_JUNIPER_ST 200
/*
* Bluetooth HCI UART transport layer (part H:4), with pseudo-header
* that includes direction information; requested by Paolo Abeni.
*/
#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201
/*
* AX.25 packet with a 1-byte KISS header; see
*
* http://www.ax25.net/kiss.htm
*
* as per Richard Stearn <richard@rns-stearn.demon.co.uk>.
*/
#define DLT_AX25_KISS 202
/*
* LAPD packets from an ISDN channel, starting with the address field,
* with no pseudo-header.
* Requested by Varuna De Silva <varunax@gmail.com>.
*/
#define DLT_LAPD 203
/*
* PPP, with a one-byte direction pseudo-header prepended - zero means
* "received by this host", non-zero (any non-zero value) means "sent by
* this host" - as per Will Barker <w.barker@zen.co.uk>.
*/
#define DLT_PPP_WITH_DIR 204 /* Don't confuse with DLT_PPP_WITH_DIRECTION */
/*
* Cisco HDLC, with a one-byte direction pseudo-header prepended - zero
* means "received by this host", non-zero (any non-zero value) means
* "sent by this host" - as per Will Barker <w.barker@zen.co.uk>.
*/
#define DLT_C_HDLC_WITH_DIR 205
/*
* Frame Relay, with a one-byte direction pseudo-header prepended - zero
* means "received by this host" (DCE -> DTE), non-zero (any non-zero
* value) means "sent by this host" (DTE -> DCE) - as per Will Barker
* <w.barker@zen.co.uk>.
*/
#define DLT_FRELAY_WITH_DIR 206
/*
* LAPB, with a one-byte direction pseudo-header prepended - zero means
* "received by this host" (DCE -> DTE), non-zero (any non-zero value)
* means "sent by this host" (DTE -> DCE)- as per Will Barker
* <w.barker@zen.co.uk>.
*/
#define DLT_LAPB_WITH_DIR 207
/*
* 208 is reserved for an as-yet-unspecified proprietary link-layer
* type, as requested by Will Barker.
*/
/*
* IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman
* <avn@pigeonpoint.com>.
*/
#define DLT_IPMB_LINUX 209
/*
* FlexRay automotive bus - http://www.flexray.com/ - as requested
* by Hannes Kaelber <hannes.kaelber@x2e.de>.
*/
#define DLT_FLEXRAY 210
/*
* Media Oriented Systems Transport (MOST) bus for multimedia
* transport - http://www.mostcooperation.com/ - as requested
* by Hannes Kaelber <hannes.kaelber@x2e.de>.
*/
#define DLT_MOST 211
/*
* Local Interconnect Network (LIN) bus for vehicle networks -
* http://www.lin-subbus.org/ - as requested by Hannes Kaelber
* <hannes.kaelber@x2e.de>.
*/
#define DLT_LIN 212
/*
* X2E-private data link type used for serial line capture,
* as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
*/
#define DLT_X2E_SERIAL 213
/*
* X2E-private data link type used for the Xoraya data logger
* family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
*/
#define DLT_X2E_XORAYA 214
/*
* IEEE 802.15.4, exactly as it appears in the spec (no padding, no
* nothing), but with the PHY-level data for non-ASK PHYs (4 octets
* of 0 as preamble, one octet of SFD, one octet of frame length+
* reserved bit, and then the MAC-layer data, starting with the
* frame control field).
*
* Requested by Max Filippov <jcmvbkbc@gmail.com>.
*/
#define DLT_IEEE802_15_4_NONASK_PHY 215
/*
* David Gibson <david@gibson.dropbear.id.au> requested this for
* captures from the Linux kernel /dev/input/eventN devices. This
* is used to communicate keystrokes and mouse movements from the
* Linux kernel to display systems, such as Xorg.
*/
#define DLT_LINUX_EVDEV 216
/*
* GSM Um and Abis interfaces, preceded by a "gsmtap" header.
*
* Requested by Harald Welte <laforge@gnumonks.org>.
*/
#define DLT_GSMTAP_UM 217
#define DLT_GSMTAP_ABIS 218
/*
* MPLS, with an MPLS label as the link-layer header.
* Requested by Michele Marchetto <michele@openbsd.org> on behalf
* of OpenBSD.
*/
#define DLT_MPLS 219
/*
* USB packets, beginning with a Linux USB header, with the USB header
* padded to 64 bytes; required for memory-mapped access.
*/
#define DLT_USB_LINUX_MMAPPED 220
/*
* DECT packets, with a pseudo-header; requested by
* Matthias Wenzel <tcpdump@mazzoo.de>.
*/
#define DLT_DECT 221
/*
* From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov>
* Date: Mon, 11 May 2009 11:18:30 -0500
*
* DLT_AOS. We need it for AOS Space Data Link Protocol.
* I have already written dissectors for but need an OK from
* legal before I can submit a patch.
*
*/
#define DLT_AOS 222
/*
* Wireless HART (Highway Addressable Remote Transducer)
* From the HART Communication Foundation
* IES/PAS 62591
*
* Requested by Sam Roberts <vieuxtech@gmail.com>.
*/
#define DLT_WIHART 223
/*
* Fibre Channel FC-2 frames, beginning with a Frame_Header.
* Requested by Kahou Lei <kahou82@gmail.com>.
*/
#define DLT_FC_2 224
/*
* Fibre Channel FC-2 frames, beginning with an encoding of the
* SOF, and ending with an encoding of the EOF.
*
* The encodings represent the frame delimiters as 4-byte sequences
* representing the corresponding ordered sets, with K28.5
* represented as 0xBC, and the D symbols as the corresponding
* byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
* is represented as 0xBC 0xB5 0x55 0x55.
*
* Requested by Kahou Lei <kahou82@gmail.com>.
*/
#define DLT_FC_2_WITH_FRAME_DELIMS 225
/*
* Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.
*
* The pseudo-header starts with a one-byte version number; for version 2,
* the pseudo-header is:
*
* struct dl_ipnetinfo {
* uint8_t dli_version;
* uint8_t dli_family;
* uint16_t dli_htype;
* uint32_t dli_pktlen;
* uint32_t dli_ifindex;
* uint32_t dli_grifindex;
* uint32_t dli_zsrc;
* uint32_t dli_zdst;
* };
*
* dli_version is 2 for the current version of the pseudo-header.
*
* dli_family is a Solaris address family value, so it's 2 for IPv4
* and 26 for IPv6.
*
* dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
* packets, and 2 for packets arriving from another zone on the same
* machine.
*
* dli_pktlen is the length of the packet data following the pseudo-header
* (so the captured length minus dli_pktlen is the length of the
* pseudo-header, assuming the entire pseudo-header was captured).
*
* dli_ifindex is the interface index of the interface on which the
* packet arrived.
*
* dli_grifindex is the group interface index number (for IPMP interfaces).
*
* dli_zsrc is the zone identifier for the source of the packet.
*
* dli_zdst is the zone identifier for the destination of the packet.
*
* A zone number of 0 is the global zone; a zone number of 0xffffffff
* means that the packet arrived from another host on the network, not
* from another zone on the same machine.
*
* An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
* which of those it is.
*/
#define DLT_IPNET 226
/*
* CAN (Controller Area Network) frames, with a pseudo-header as supplied
* by Linux SocketCAN, and with multi-byte numerical fields in that header
* in big-endian byte order.
*
* See Documentation/networking/can.txt in the Linux source.
*
* Requested by Felix Obenhuber <felix@obenhuber.de>.
*/
#define DLT_CAN_SOCKETCAN 227
/*
* Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
* whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>.
*/
#define DLT_IPV4 228
#define DLT_IPV6 229
/*
* IEEE 802.15.4, exactly as it appears in the spec (no padding, no
* nothing), and with no FCS at the end of the frame; requested by
* Jon Smirl <jonsmirl@gmail.com>.
*/
#define DLT_IEEE802_15_4_NOFCS 230
/*
* Raw D-Bus:
*
* http://www.freedesktop.org/wiki/Software/dbus
*
* messages:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
*
* starting with the endianness flag, followed by the message type, etc.,
* but without the authentication handshake before the message sequence:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
*
* Requested by Martin Vidner <martin@vidner.net>.
*/
#define DLT_DBUS 231
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>.
*/
#define DLT_JUNIPER_VS 232
#define DLT_JUNIPER_SRX_E2E 233
#define DLT_JUNIPER_FIBRECHANNEL 234
/*
* DVB-CI (DVB Common Interface for communication between a PC Card
* module and a DVB receiver). See
*
* http://www.kaiser.cx/pcap-dvbci.html
*
* for the specification.
*
* Requested by Martin Kaiser <martin@kaiser.cx>.
*/
#define DLT_DVB_CI 235
/*
* Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but
* *not* the same as, 27.010). Requested by Hans-Christoph Schemmel
* <hans-christoph.schemmel@cinterion.com>.
*/
#define DLT_MUX27010 236
/*
* STANAG 5066 D_PDUs. Requested by M. Baris Demiray
* <barisdemiray@gmail.com>.
*/
#define DLT_STANAG_5066_D_PDU 237
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <hannes@juniper.net>.
*/
#define DLT_JUNIPER_ATM_CEMIC 238
/*
* NetFilter LOG messages
* (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
*
* Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
*/
#define DLT_NFLOG 239
/*
* Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
* for Ethernet packets with a 4-byte pseudo-header and always
* with the payload including the FCS, as supplied by their
* netANALYZER hardware and software.
*
* Requested by Holger P. Frommer <HPfrommer@hilscher.com>
*/
#define DLT_NETANALYZER 240
/*
* Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
* for Ethernet packets with a 4-byte pseudo-header and FCS and
* with the Ethernet header preceded by 7 bytes of preamble and
* 1 byte of SFD, as supplied by their netANALYZER hardware and
* software.
*
* Requested by Holger P. Frommer <HPfrommer@hilscher.com>
*/
#define DLT_NETANALYZER_TRANSPARENT 241
/*
* IP-over-InfiniBand, as specified by RFC 4391.
*
* Requested by Petr Sumbera <petr.sumbera@oracle.com>.
*/
#define DLT_IPOIB 242
/*
* MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
*
* Requested by Guy Martin <gmsoft@tuxicoman.be>.
*/
#define DLT_MPEG_2_TS 243
/*
* ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
* used by their ng40 protocol tester.
*
* Requested by Jens Grimmer <jens.grimmer@ng4t.com>.
*/
#define DLT_NG40 244
/*
* Pseudo-header giving adapter number and flags, followed by an NFC
* (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
* as specified by NFC Forum Logical Link Control Protocol Technical
* Specification LLCP 1.1.
*
* Requested by Mike Wakerly <mikey@google.com>.
*/
#define DLT_NFC_LLCP 245
/*
* 246 is used as LINKTYPE_PFSYNC; do not use it for any other purpose.
*
* DLT_PFSYNC has different values on different platforms, and all of
* them collide with something used elsewhere. On platforms that
* don't already define it, define it as 246.
*/
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__)
#define DLT_PFSYNC 246
#endif
/*
* Raw InfiniBand packets, starting with the Local Routing Header.
*
* Requested by Oren Kladnitsky <orenk@mellanox.com>.
*/
#define DLT_INFINIBAND 247
/*
* SCTP, with no lower-level protocols (i.e., no IPv4 or IPv6).
*
* Requested by Michael Tuexen <Michael.Tuexen@lurchi.franken.de>.
*/
#define DLT_SCTP 248
/*
* USB packets, beginning with a USBPcap header.
*
* Requested by Tomasz Mon <desowin@gmail.com>
*/
#define DLT_USBPCAP 249
/*
* Schweitzer Engineering Laboratories "RTAC" product serial-line
* packets.
*
* Requested by Chris Bontje <chris_bontje@selinc.com>.
*/
#define DLT_RTAC_SERIAL 250
/*
* Bluetooth Low Energy air interface link-layer packets.
*
* Requested by Mike Kershaw <dragorn@kismetwireless.net>.
*/
#define DLT_BLUETOOTH_LE_LL 251
/*
* DLT type for upper-protocol layer PDU saves from wireshark.
*
* the actual contents are determined by two TAGs stored with each
* packet:
* EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the
* original packet.
*
* EXP_PDU_TAG_PROTO_NAME the name of the wireshark dissector
* that can make sense of the data stored.
*/
#define DLT_WIRESHARK_UPPER_PDU 252
/*
* DLT type for the netlink protocol (nlmon devices).
*/
#define DLT_NETLINK 253
/*
* Bluetooth Linux Monitor headers for the BlueZ stack.
*/
#define DLT_BLUETOOTH_LINUX_MONITOR 254
/*
* Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
* captured by Ubertooth.
*/
#define DLT_BLUETOOTH_BREDR_BB 255
/*
* Bluetooth Low Energy link layer packets, as captured by Ubertooth.
*/
#define DLT_BLUETOOTH_LE_LL_WITH_PHDR 256
/*
* PROFIBUS data link layer.
*/
#define DLT_PROFIBUS_DL 257
/*
* Apple's DLT_PKTAP headers.
*
* Sadly, the folks at Apple either had no clue that the DLT_USERn values
* are for internal use within an organization and partners only, and
* didn't know that the right way to get a link-layer header type is to
* ask tcpdump.org for one, or knew and didn't care, so they just
* used DLT_USER2, which causes problems for everything except for
* their version of tcpdump.
*
* So I'll just give them one; hopefully this will show up in a
* libpcap release in time for them to get this into 10.10 Big Sur
* or whatever Mavericks' successor is called. LINKTYPE_PKTAP
* will be 258 *even on macOS*; that is *intentional*, so that
* PKTAP files look the same on *all* OSes (different OSes can have
* different numerical values for a given DLT_, but *MUST NOT* have
* different values for what goes in a file, as files can be moved
* between OSes!).
*
* When capturing, on a system with a Darwin-based OS, on a device
* that returns 149 (DLT_USER2 and Apple's DLT_PKTAP) with this
* version of libpcap, the DLT_ value for the pcap_t will be DLT_PKTAP,
* and that will continue to be DLT_USER2 on Darwin-based OSes. That way,
* binary compatibility with Mavericks is preserved for programs using
* this version of libpcap. This does mean that if you were using
* DLT_USER2 for some capture device on macOS, you can't do so with
* this version of libpcap, just as you can't with Apple's libpcap -
* on macOS, they define DLT_PKTAP to be DLT_USER2, so programs won't
* be able to distinguish between PKTAP and whatever you were using
* DLT_USER2 for.
*
* If the program saves the capture to a file using this version of
* libpcap's pcap_dump code, the LINKTYPE_ value in the file will be
* LINKTYPE_PKTAP, which will be 258, even on Darwin-based OSes.
* That way, the file will *not* be a DLT_USER2 file. That means
* that the latest version of tcpdump, when built with this version
* of libpcap, and sufficiently recent versions of Wireshark will
* be able to read those files and interpret them correctly; however,
* Apple's version of tcpdump in OS X 10.9 won't be able to handle
* them. (Hopefully, Apple will pick up this version of libpcap,
* and the corresponding version of tcpdump, so that tcpdump will
* be able to handle the old LINKTYPE_USER2 captures *and* the new
* LINKTYPE_PKTAP captures.)
*/
#ifdef __APPLE__
#define DLT_PKTAP DLT_USER2
#else
#define DLT_PKTAP 258
#endif
/*
* Ethernet packets preceded by a header giving the last 6 octets
* of the preamble specified by 802.3-2012 Clause 65, section
* 65.1.3.2 "Transmit".
*/
#define DLT_EPON 259
/*
* IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
* in the PICMG HPM.2 specification.
*/
#define DLT_IPMI_HPM_2 260
/*
* per Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
*/
#define DLT_ZWAVE_R1_R2 261
#define DLT_ZWAVE_R3 262
/*
* per Steve Karg <skarg@users.sourceforge.net>, formats for Wattstopper
* Digital Lighting Management room bus serial protocol captures.
*/
#define DLT_WATTSTOPPER_DLM 263
/*
* ISO 14443 contactless smart card messages.
*/
#define DLT_ISO_14443 264
/*
* Radio data system (RDS) groups. IEC 62106.
* Per Jonathan Brucker <jonathan.brucke@gmail.com>.
*/
#define DLT_RDS 265
/*
* USB packets, beginning with a Darwin (macOS, etc.) header.
*/
#define DLT_USB_DARWIN 266
/*
* OpenBSD DLT_OPENFLOW.
*/
#define DLT_OPENFLOW 267
/*
* SDLC frames containing SNA PDUs.
*/
#define DLT_SDLC 268
/*
* per "Selvig, Bjorn" <b.selvig@ti.com> used for
* TI protocol sniffer.
*/
#define DLT_TI_LLN_SNIFFER 269
/*
* per: Erik de Jong <erikdejong at gmail.com> for
* https://github.com/eriknl/LoRaTap/releases/tag/v0.1
*/
#define DLT_LORATAP 270
/*
* per: Stefanha at gmail.com for
* http://lists.sandelman.ca/pipermail/tcpdump-workers/2017-May/000772.html
* and: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vsockmon.h
* for: http://qemu-project.org/Features/VirtioVsock
*/
#define DLT_VSOCK 271
/*
* Nordic Semiconductor Bluetooth LE sniffer.
*/
#define DLT_NORDIC_BLE 272
/*
* Excentis DOCSIS 3.1 RF sniffer (XRA-31)
* per: bruno.verstuyft at excentis.com
* http://www.xra31.com/xra-header
*/
#define DLT_DOCSIS31_XRA31 273
/*
* mPackets, as specified by IEEE 802.3br Figure 99-4, starting
* with the preamble and always ending with a CRC field.
*/
#define DLT_ETHERNET_MPACKET 274
/*
* DisplayPort AUX channel monitoring data as specified by VESA
* DisplayPort(DP) Standard preceeded by a pseudo-header.
* per dirk.eibach at gdsys.cc
*/
#define DLT_DISPLAYPORT_AUX 275
/*
* Linux cooked sockets v2.
*/
#define DLT_LINUX_SLL2 276
/*
* In case the code that includes this file (directly or indirectly)
* has also included OS files that happen to define DLT_MATCHING_MAX,
* with a different value (perhaps because that OS hasn't picked up
* the latest version of our DLT definitions), we undefine the
* previous value of DLT_MATCHING_MAX.
*/
#ifdef DLT_MATCHING_MAX
#undef DLT_MATCHING_MAX
#endif
#define DLT_MATCHING_MAX 276 /* highest value in the "matching" range */
/*
* DLT and savefile link type values are split into a class and
* a member of that class. A class value of 0 indicates a regular
* DLT_/LINKTYPE_ value.
*/
#define DLT_CLASS(x) ((x) & 0x03ff0000)
/*
* NetBSD-specific generic "raw" link type. The class value indicates
* that this is the generic raw type, and the lower 16 bits are the
* address family we're dealing with. Those values are NetBSD-specific;
* do not assume that they correspond to AF_ values for your operating
* system.
*/
#define DLT_CLASS_NETBSD_RAWAF 0x02240000
#define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af))
#define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff)
#define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF)
#endif /* !defined(lib_pcap_dlt_h) */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#define IPH_AF_INET 2 /* Matches Solaris's AF_INET */
#define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */
#define IPNET_OUTBOUND 1
#define IPNET_INBOUND 2
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lib_pcap_compiler_tests_h
#define lib_pcap_compiler_tests_h
/*
* This was introduced by Clang:
*
* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
*
* in some version (which version?); it has been picked up by GCC 5.0.
*/
#ifndef __has_attribute
/*
* It's a macro, so you can check whether it's defined to check
* whether it's supported.
*
* If it's not, define it to always return 0, so that we move on to
* the fallback checks.
*/
#define __has_attribute(x) 0
#endif
/*
* Note that the C90 spec's "6.8.1 Conditional inclusion" and the
* C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say:
*
* Prior to evaluation, macro invocations in the list of preprocessing
* tokens that will become the controlling constant expression are
* replaced (except for those macro names modified by the defined unary
* operator), just as in normal text. If the token "defined" is
* generated as a result of this replacement process or use of the
* "defined" unary operator does not match one of the two specified
* forms prior to macro replacement, the behavior is undefined.
*
* so you shouldn't use defined() in a #define that's used in #if or
* #elif. Some versions of Clang, for example, will warn about this.
*
* Instead, we check whether the pre-defined macros for particular
* compilers are defined and, if not, define the "is this version XXX
* or a later version of this compiler" macros as 0.
*/
/*
* Check whether this is GCC major.minor or a later release, or some
* compiler that claims to be "just like GCC" of that version or a
* later release.
*/
#if ! defined(__GNUC__)
#define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
#else
#define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) \
(__GNUC__ > (major) || \
(__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
#endif
/*
* Check whether this is Clang major.minor or a later release.
*/
#if !defined(__clang__)
#define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) 0
#else
#define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) \
(__clang_major__ > (major) || \
(__clang_major__ == (major) && __clang_minor__ >= (minor)))
#endif
/*
* Check whether this is Sun C/SunPro C/Oracle Studio major.minor
* or a later release.
*
* The version number in __SUNPRO_C is encoded in hex BCD, with the
* uppermost hex digit being the major version number, the next
* one or two hex digits being the minor version number, and
* the last digit being the patch version.
*
* It represents the *compiler* version, not the product version;
* see
*
* https://sourceforge.net/p/predef/wiki/Compilers/
*
* for a partial mapping, which we assume continues for later
* 12.x product releases.
*/
#if ! defined(__SUNPRO_C)
#define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) 0
#else
#define PCAP_SUNPRO_VERSION_TO_BCD(major, minor) \
(((minor) >= 10) ? \
(((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \
(((major) << 8) | ((minor) << 4)))
#define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) \
(__SUNPRO_C >= PCAP_SUNPRO_VERSION_TO_BCD((major), (minor)))
#endif
/*
* Check whether this is IBM XL C major.minor or a later release.
*
* The version number in __xlC__ has the major version in the
* upper 8 bits and the minor version in the lower 8 bits.
*/
#if ! defined(__xlC__)
#define PCAP_IS_AT_LEAST_XL_C_VERSION(major,minor) 0
#else
#define PCAP_IS_AT_LEAST_XL_C_VERSION(major, minor) \
(__xlC__ >= (((major) << 8) | (minor)))
#endif
/*
* Check whether this is HP aC++/HP C major.minor or a later release.
*
* The version number in __HP_aCC is encoded in zero-padded decimal BCD,
* with the "A." stripped off, the uppermost two decimal digits being
* the major version number, the next two decimal digits being the minor
* version number, and the last two decimal digits being the patch version.
* (Strip off the A., remove the . between the major and minor version
* number, and add two digits of patch.)
*/
#if ! defined(__HP_aCC)
#define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) 0
#else
#define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) \
(__HP_aCC >= ((major)*10000 + (minor)*100))
#endif
#endif /* lib_pcap_compiler_tests_h */
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lib_pcap_funcattrs_h
#define lib_pcap_funcattrs_h
#include <pcap/compiler-tests.h>
/*
* Attributes to apply to functions and their arguments, using various
* compiler-specific extensions.
*/
/*
* PCAP_API_DEF must be used when defining *data* exported from
* libpcap. It can be used when defining *functions* exported
* from libpcap, but it doesn't have to be used there. It
* should not be used in declarations in headers.
*
* PCAP_API must be used when *declaring* data or functions
* exported from libpcap; PCAP_API_DEF won't work on all platforms.
*/
#if defined(_WIN32)
/*
* For Windows:
*
* when building libpcap:
*
* if we're building it as a DLL, we have to declare API
* functions with __declspec(dllexport);
*
* if we're building it as a static library, we don't want
* to do so.
*
* when using libpcap:
*
* if we're using the DLL, calls to its functions are a
* little more efficient if they're declared with
* __declspec(dllimport);
*
* if we're not using the dll, we don't want to declare
* them that way.
*
* So:
*
* if pcap_EXPORTS is defined, we define PCAP_API_DEF as
* __declspec(dllexport);
*
* if PCAP_DLL is defined, we define PCAP_API_DEF as
* __declspec(dllimport);
*
* otherwise, we define PCAP_API_DEF as nothing.
*/
#if defined(pcap_EXPORTS)
/*
* We're compiling libpcap as a DLL, so we should export functions
* in our API.
*/
#define PCAP_API_DEF __declspec(dllexport)
#elif defined(PCAP_DLL)
/*
* We're using libpcap as a DLL, so the calls will be a little more
* efficient if we explicitly import the functions.
*/
#define PCAP_API_DEF __declspec(dllimport)
#else
/*
* Either we're building libpcap as a static library, or we're using
* it as a static library, or we don't know for certain that we're
* using it as a dynamic library, so neither import nor export the
* functions explicitly.
*/
#define PCAP_API_DEF
#endif
#elif defined(MSDOS)
/* XXX - does this need special treatment? */
#define PCAP_API_DEF
#else /* UN*X */
#ifdef pcap_EXPORTS
/*
* We're compiling libpcap as a (dynamic) shared library, so we should
* export functions in our API. The compiler might be configured not
* to export functions from a shared library by default, so we might
* have to explicitly mark functions as exported.
*/
#if PCAP_IS_AT_LEAST_GNUC_VERSION(3,4) \
|| PCAP_IS_AT_LEAST_XL_C_VERSION(12,0)
/*
* GCC 3.4 or later, or some compiler asserting compatibility with
* GCC 3.4 or later, or XL C 13.0 or later, so we have
* __attribute__((visibility()).
*/
#define PCAP_API_DEF __attribute__((visibility("default")))
#elif PCAP_IS_AT_LEAST_SUNC_VERSION(5,5)
/*
* Sun C 5.5 or later, so we have __global.
* (Sun C 5.9 and later also have __attribute__((visibility()),
* but there's no reason to prefer it with Sun C.)
*/
#define PCAP_API_DEF __global
#else
/*
* We don't have anything to say.
*/
#define PCAP_API_DEF
#endif
#else
/*
* We're not building libpcap.
*/
#define PCAP_API_DEF
#endif
#endif /* _WIN32/MSDOS/UN*X */
#define PCAP_API PCAP_API_DEF extern
/*
* PCAP_NORETURN, before a function declaration, means "this function
* never returns". (It must go before the function declaration, e.g.
* "extern PCAP_NORETURN func(...)" rather than after the function
* declaration, as the MSVC version has to go before the declaration.)
*
* PCAP_NORETURN_DEF, before a function *definition*, means "this
* function never returns"; it would be used only for static functions
* that are defined before any use, and thus have no declaration.
* (MSVC doesn't support that; I guess the "decl" in "__declspec"
* means "declaration", and __declspec doesn't work with definitions.)
*/
#if __has_attribute(noreturn) \
|| PCAP_IS_AT_LEAST_GNUC_VERSION(2,5) \
|| PCAP_IS_AT_LEAST_SUNC_VERSION(5,9) \
|| PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \
|| PCAP_IS_AT_LEAST_HP_C_VERSION(6,10)
/*
* Compiler with support for __attribute((noreturn)), or GCC 2.5 or
* later, or some compiler asserting compatibility with GCC 2.5 or
* later, or Solaris Studio 12 (Sun C 5.9) or later, or IBM XL C 10.1
* or later (do any earlier versions of XL C support this?), or HP aCC
* A.06.10 or later.
*/
#define PCAP_NORETURN __attribute((noreturn))
#define PCAP_NORETURN_DEF __attribute((noreturn))
#elif defined(_MSC_VER)
/*
* MSVC.
*/
#define PCAP_NORETURN __declspec(noreturn)
#define PCAP_NORETURN_DEF
#else
#define PCAP_NORETURN
#define PCAP_NORETURN_DEF
#endif
/*
* PCAP_PRINTFLIKE(x,y), after a function declaration, means "this function
* does printf-style formatting, with the xth argument being the format
* string and the yth argument being the first argument for the format
* string".
*/
#if __has_attribute(__format__) \
|| PCAP_IS_AT_LEAST_GNUC_VERSION(2,3) \
|| PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \
|| PCAP_IS_AT_LEAST_HP_C_VERSION(6,10)
/*
* Compiler with support for it, or GCC 2.3 or later, or some compiler
* asserting compatibility with GCC 2.3 or later, or IBM XL C 10.1
* and later (do any earlier versions of XL C support this?),
* or HP aCC A.06.10 and later.
*/
#define PCAP_PRINTFLIKE(x,y) __attribute__((__format__(__printf__,x,y)))
#else
#define PCAP_PRINTFLIKE(x,y)
#endif
/*
* PCAP_DEPRECATED(func, msg), after a function declaration, marks the
* function as deprecated.
*
* The first argument is the name of the function; the second argument is
* a string giving the warning message to use if the compiler supports that.
*
* (Thank you, Microsoft, for requiring the function name.)
*/
#if __has_attribute(deprecated) \
|| PCAP_IS_AT_LEAST_GNUC_VERSION(4,5) \
|| PCAP_IS_AT_LEAST_SUNC_VERSION(5,13)
/*
* Compiler that supports __has_attribute and __attribute__((deprecated)),
* or GCC 4.5 or later, or Sun/Oracle C 12.4 (Sun C 5.13) or later.
*
* Those support __attribute__((deprecated(msg))) (we assume, perhaps
* incorrectly, that anything that supports __has_attribute() is
* recent enough to support __attribute__((deprecated(msg)))).
*/
#define PCAP_DEPRECATED(func, msg) __attribute__((deprecated(msg)))
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1)
/*
* GCC 3.1 through 4.4.
*
* Those support __attribute__((deprecated)) but not
* __attribute__((deprecated(msg))).
*/
#define PCAP_DEPRECATED(func, msg) __attribute__((deprecated))
#elif (defined(_MSC_VER) && (_MSC_VER >= 1500)) && !defined(BUILDING_PCAP)
/*
* MSVC from Visual Studio 2008 or later, and we're not building
* libpcap itself.
*
* If we *are* building libpcap, we don't want this, as it'll warn
* us even if we *define* the function.
*/
#define PCAP_DEPRECATED(func, msg) __pragma(deprecated(func))
#else
#define PCAP_DEPRECATED(func, msg)
#endif
/*
* For flagging arguments as format strings in MSVC.
*/
#ifdef _MSC_VER
#include <sal.h>
#if _MSC_VER > 1400
#define PCAP_FORMAT_STRING(p) _Printf_format_string_ p
#else
#define PCAP_FORMAT_STRING(p) __format_string p
#endif
#else
#define PCAP_FORMAT_STRING(p) p
#endif
#endif /* lib_pcap_funcattrs_h */
/*
* Copyright (c) 2006 Paolo Abeni (Italy)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* bluetooth data struct
* By Paolo Abeni <paolo.abeni@email.it>
*/
#ifndef lib_pcap_bluetooth_h
#define lib_pcap_bluetooth_h
#include <pcap/pcap-inttypes.h>
/*
* Header prepended libpcap to each bluetooth h4 frame,
* fields are in network byte order
*/
typedef struct _pcap_bluetooth_h4_header {
uint32_t direction; /* if first bit is set direction is incoming */
} pcap_bluetooth_h4_header;
/*
* Header prepended libpcap to each bluetooth linux monitor frame,
* fields are in network byte order
*/
typedef struct _pcap_bluetooth_linux_monitor_header {
uint16_t adapter_id;
uint16_t opcode;
} pcap_bluetooth_linux_monitor_header;
#endif
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Remote packet capture mechanisms and extensions from WinPcap:
*
* Copyright (c) 2002 - 2003
* NetGroup, Politecnico di Torino (Italy)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Politecnico di Torino nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef lib_pcap_pcap_h
#define lib_pcap_pcap_h
#include <pcap/funcattrs.h>
#include <pcap/pcap-inttypes.h>
#if defined(_WIN32)
#include <winsock2.h> /* u_int, u_char etc. */
#include <io.h> /* _get_osfhandle() */
#elif defined(MSDOS)
#include <sys/types.h> /* u_int, u_char etc. */
#include <sys/socket.h>
#else /* UN*X */
#include <sys/types.h> /* u_int, u_char etc. */
#include <sys/time.h>
#endif /* _WIN32/MSDOS/UN*X */
#include <pcap/socket.h> /* for SOCKET, as the active-mode rpcap APIs use it */
#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
#include <pcap/bpf.h>
#endif
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Version number of the current version of the pcap file format.
*
* NOTE: this is *NOT* the version number of the libpcap library.
* To fetch the version information for the version of libpcap
* you're using, use pcap_lib_version().
*/
#define PCAP_VERSION_MAJOR 2
#define PCAP_VERSION_MINOR 4
#define PCAP_ERRBUF_SIZE 256
/*
* Compatibility for systems that have a bpf.h that
* predates the bpf typedefs for 64-bit support.
*/
#if BPF_RELEASE - 0 < 199406
typedef int bpf_int32;
typedef u_int bpf_u_int32;
#endif
typedef struct pcap pcap_t;
typedef struct pcap_dumper pcap_dumper_t;
typedef struct pcap_if pcap_if_t;
typedef struct pcap_addr pcap_addr_t;
/*
* The first record in the file contains saved values for some
* of the flags used in the printout phases of tcpdump.
* Many fields here are 32 bit ints so compilers won't insert unwanted
* padding; these files need to be interchangeable across architectures.
*
* Do not change the layout of this structure, in any way (this includes
* changes that only affect the length of fields in this structure).
*
* Also, do not change the interpretation of any of the members of this
* structure, in any way (this includes using values other than
* LINKTYPE_ values, as defined in "savefile.c", in the "linktype"
* field).
*
* Instead:
*
* introduce a new structure for the new format, if the layout
* of the structure changed;
*
* send mail to "tcpdump-workers@lists.tcpdump.org", requesting
* a new magic number for your new capture file format, and, when
* you get the new magic number, put it in "savefile.c";
*
* use that magic number for save files with the changed file
* header;
*
* make the code in "savefile.c" capable of reading files with
* the old file header as well as files with the new file header
* (using the magic number to determine the header format).
*
* Then supply the changes by forking the branch at
*
* https://github.com/the-tcpdump-group/libpcap/issues
*
* and issuing a pull request, so that future versions of libpcap and
* programs that use it (such as tcpdump) will be able to read your new
* capture file format.
*/
struct pcap_file_header {
bpf_u_int32 magic;
u_short version_major;
u_short version_minor;
bpf_int32 thiszone; /* gmt to local correction */
bpf_u_int32 sigfigs; /* accuracy of timestamps */
bpf_u_int32 snaplen; /* max length saved portion of each pkt */
bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */
};
/*
* Macros for the value returned by pcap_datalink_ext().
*
* If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro
* gives the FCS length of packets in the capture.
*/
#define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000)
#define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28)
#define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000)
typedef enum {
PCAP_D_INOUT = 0,
PCAP_D_IN,
PCAP_D_OUT
} pcap_direction_t;
/*
* Generic per-packet information, as supplied by libpcap.
*
* The time stamp can and should be a "struct timeval", regardless of
* whether your system supports 32-bit tv_sec in "struct timeval",
* 64-bit tv_sec in "struct timeval", or both if it supports both 32-bit
* and 64-bit applications. The on-disk format of savefiles uses 32-bit
* tv_sec (and tv_usec); this structure is irrelevant to that. 32-bit
* and 64-bit versions of libpcap, even if they're on the same platform,
* should supply the appropriate version of "struct timeval", even if
* that's not what the underlying packet capture mechanism supplies.
*/
struct pcap_pkthdr {
struct timeval ts; /* time stamp */
bpf_u_int32 caplen; /* length of portion present */
bpf_u_int32 len; /* length this packet (off wire) */
};
/*
* As returned by the pcap_stats()
*/
struct pcap_stat {
u_int ps_recv; /* number of packets received */
u_int ps_drop; /* number of packets dropped */
u_int ps_ifdrop; /* drops by interface -- only supported on some platforms */
#ifdef _WIN32
u_int ps_capt; /* number of packets that reach the application */
u_int ps_sent; /* number of packets sent by the server on the network */
u_int ps_netdrop; /* number of packets lost on the network */
#endif /* _WIN32 */
};
#ifdef MSDOS
/*
* As returned by the pcap_stats_ex()
*/
struct pcap_stat_ex {
u_long rx_packets; /* total packets received */
u_long tx_packets; /* total packets transmitted */
u_long rx_bytes; /* total bytes received */
u_long tx_bytes; /* total bytes transmitted */
u_long rx_errors; /* bad packets received */
u_long tx_errors; /* packet transmit problems */
u_long rx_dropped; /* no space in Rx buffers */
u_long tx_dropped; /* no space available for Tx */
u_long multicast; /* multicast packets received */
u_long collisions;
/* detailed rx_errors: */
u_long rx_length_errors;
u_long rx_over_errors; /* receiver ring buff overflow */
u_long rx_crc_errors; /* recv'd pkt with crc error */
u_long rx_frame_errors; /* recv'd frame alignment error */
u_long rx_fifo_errors; /* recv'r fifo overrun */
u_long rx_missed_errors; /* recv'r missed packet */
/* detailed tx_errors */
u_long tx_aborted_errors;
u_long tx_carrier_errors;
u_long tx_fifo_errors;
u_long tx_heartbeat_errors;
u_long tx_window_errors;
};
#endif
/*
* Item in a list of interfaces.
*/
struct pcap_if {
struct pcap_if *next;
char *name; /* name to hand to "pcap_open_live()" */
char *description; /* textual description of interface, or NULL */
struct pcap_addr *addresses;
bpf_u_int32 flags; /* PCAP_IF_ interface flags */
};
#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */
#define PCAP_IF_UP 0x00000002 /* interface is up */
#define PCAP_IF_RUNNING 0x00000004 /* interface is running */
#define PCAP_IF_WIRELESS 0x00000008 /* interface is wireless (*NOT* necessarily Wi-Fi!) */
#define PCAP_IF_CONNECTION_STATUS 0x00000030 /* connection status: */
#define PCAP_IF_CONNECTION_STATUS_UNKNOWN 0x00000000 /* unknown */
#define PCAP_IF_CONNECTION_STATUS_CONNECTED 0x00000010 /* connected */
#define PCAP_IF_CONNECTION_STATUS_DISCONNECTED 0x00000020 /* disconnected */
#define PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE 0x00000030 /* not applicable */
/*
* Representation of an interface address.
*/
struct pcap_addr {
struct pcap_addr *next;
struct sockaddr *addr; /* address */
struct sockaddr *netmask; /* netmask for that address */
struct sockaddr *broadaddr; /* broadcast address for that address */
struct sockaddr *dstaddr; /* P2P destination address for that address */
};
typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
const u_char *);
/*
* Error codes for the pcap API.
* These will all be negative, so you can check for the success or
* failure of a call that returns these codes by checking for a
* negative value.
*/
#define PCAP_ERROR -1 /* generic error code */
#define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */
#define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */
#define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */
#define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */
#define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */
#define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */
#define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */
#define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */
#define PCAP_ERROR_CANTSET_TSTAMP_TYPE -10 /* this device doesn't support setting the time stamp type */
#define PCAP_ERROR_PROMISC_PERM_DENIED -11 /* you don't have permission to capture in promiscuous mode */
#define PCAP_ERROR_TSTAMP_PRECISION_NOTSUP -12 /* the requested time stamp precision is not supported */
/*
* Warning codes for the pcap API.
* These will all be positive and non-zero, so they won't look like
* errors.
*/
#define PCAP_WARNING 1 /* generic warning code */
#define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */
#define PCAP_WARNING_TSTAMP_TYPE_NOTSUP 3 /* the requested time stamp type is not supported */
/*
* Value to pass to pcap_compile() as the netmask if you don't know what
* the netmask is.
*/
#define PCAP_NETMASK_UNKNOWN 0xffffffff
/*
* We're deprecating pcap_lookupdev() for various reasons (not
* thread-safe, can behave weirdly with WinPcap). Callers
* should use pcap_findalldevs() and use the first device.
*/
PCAP_API char *pcap_lookupdev(char *)
PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device");
PCAP_API int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
PCAP_API pcap_t *pcap_create(const char *, char *);
PCAP_API int pcap_set_snaplen(pcap_t *, int);
PCAP_API int pcap_set_promisc(pcap_t *, int);
PCAP_API int pcap_can_set_rfmon(pcap_t *);
PCAP_API int pcap_set_rfmon(pcap_t *, int);
PCAP_API int pcap_set_timeout(pcap_t *, int);
PCAP_API int pcap_set_tstamp_type(pcap_t *, int);
PCAP_API int pcap_set_immediate_mode(pcap_t *, int);
PCAP_API int pcap_set_buffer_size(pcap_t *, int);
PCAP_API int pcap_set_tstamp_precision(pcap_t *, int);
PCAP_API int pcap_get_tstamp_precision(pcap_t *);
PCAP_API int pcap_activate(pcap_t *);
PCAP_API int pcap_list_tstamp_types(pcap_t *, int **);
PCAP_API void pcap_free_tstamp_types(int *);
PCAP_API int pcap_tstamp_type_name_to_val(const char *);
PCAP_API const char *pcap_tstamp_type_val_to_name(int);
PCAP_API const char *pcap_tstamp_type_val_to_description(int);
#ifdef __linux__
PCAP_API int pcap_set_protocol_linux(pcap_t *, int);
#endif
/*
* Time stamp types.
* Not all systems and interfaces will necessarily support all of these.
*
* A system that supports PCAP_TSTAMP_HOST is offering time stamps
* provided by the host machine, rather than by the capture device,
* but not committing to any characteristics of the time stamp;
* it will not offer any of the PCAP_TSTAMP_HOST_ subtypes.
*
* PCAP_TSTAMP_HOST_LOWPREC is a time stamp, provided by the host machine,
* that's low-precision but relatively cheap to fetch; it's normally done
* using the system clock, so it's normally synchronized with times you'd
* fetch from system calls.
*
* PCAP_TSTAMP_HOST_HIPREC is a time stamp, provided by the host machine,
* that's high-precision; it might be more expensive to fetch. It might
* or might not be synchronized with the system clock, and might have
* problems with time stamps for packets received on different CPUs,
* depending on the platform.
*
* PCAP_TSTAMP_ADAPTER is a high-precision time stamp supplied by the
* capture device; it's synchronized with the system clock.
*
* PCAP_TSTAMP_ADAPTER_UNSYNCED is a high-precision time stamp supplied by
* the capture device; it's not synchronized with the system clock.
*
* Note that time stamps synchronized with the system clock can go
* backwards, as the system clock can go backwards. If a clock is
* not in sync with the system clock, that could be because the
* system clock isn't keeping accurate time, because the other
* clock isn't keeping accurate time, or both.
*
* Note that host-provided time stamps generally correspond to the
* time when the time-stamping code sees the packet; this could
* be some unknown amount of time after the first or last bit of
* the packet is received by the network adapter, due to batching
* of interrupts for packet arrival, queueing delays, etc..
*/
#define PCAP_TSTAMP_HOST 0 /* host-provided, unknown characteristics */
#define PCAP_TSTAMP_HOST_LOWPREC 1 /* host-provided, low precision */
#define PCAP_TSTAMP_HOST_HIPREC 2 /* host-provided, high precision */
#define PCAP_TSTAMP_ADAPTER 3 /* device-provided, synced with the system clock */
#define PCAP_TSTAMP_ADAPTER_UNSYNCED 4 /* device-provided, not synced with the system clock */
/*
* Time stamp resolution types.
* Not all systems and interfaces will necessarily support all of these
* resolutions when doing live captures; all of them can be requested
* when reading a savefile.
*/
#define PCAP_TSTAMP_PRECISION_MICRO 0 /* use timestamps with microsecond precision, default */
#define PCAP_TSTAMP_PRECISION_NANO 1 /* use timestamps with nanosecond precision */
PCAP_API pcap_t *pcap_open_live(const char *, int, int, int, char *);
PCAP_API pcap_t *pcap_open_dead(int, int);
PCAP_API pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
PCAP_API pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
PCAP_API pcap_t *pcap_open_offline(const char *, char *);
#ifdef _WIN32
PCAP_API pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
PCAP_API pcap_t *pcap_hopen_offline(intptr_t, char *);
/*
* If we're building libpcap, these are internal routines in savefile.c,
* so we must not define them as macros.
*
* If we're not building libpcap, given that the version of the C runtime
* with which libpcap was built might be different from the version
* of the C runtime with which an application using libpcap was built,
* and that a FILE structure may differ between the two versions of the
* C runtime, calls to _fileno() must use the version of _fileno() in
* the C runtime used to open the FILE *, not the version in the C
* runtime with which libpcap was built. (Maybe once the Universal CRT
* rules the world, this will cease to be a problem.)
*/
#ifndef BUILDING_PCAP
#define pcap_fopen_offline_with_tstamp_precision(f,p,b) \
pcap_hopen_offline_with_tstamp_precision(_get_osfhandle(_fileno(f)), p, b)
#define pcap_fopen_offline(f,b) \
pcap_hopen_offline(_get_osfhandle(_fileno(f)), b)
#endif
#else /*_WIN32*/
PCAP_API pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
PCAP_API pcap_t *pcap_fopen_offline(FILE *, char *);
#endif /*_WIN32*/
PCAP_API void pcap_close(pcap_t *);
PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
PCAP_API int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
PCAP_API const u_char *pcap_next(pcap_t *, struct pcap_pkthdr *);
PCAP_API int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
PCAP_API void pcap_breakloop(pcap_t *);
PCAP_API int pcap_stats(pcap_t *, struct pcap_stat *);
PCAP_API int pcap_setfilter(pcap_t *, struct bpf_program *);
PCAP_API int pcap_setdirection(pcap_t *, pcap_direction_t);
PCAP_API int pcap_getnonblock(pcap_t *, char *);
PCAP_API int pcap_setnonblock(pcap_t *, int, char *);
PCAP_API int pcap_inject(pcap_t *, const void *, size_t);
PCAP_API int pcap_sendpacket(pcap_t *, const u_char *, int);
PCAP_API const char *pcap_statustostr(int);
PCAP_API const char *pcap_strerror(int);
PCAP_API char *pcap_geterr(pcap_t *);
PCAP_API void pcap_perror(pcap_t *, const char *);
PCAP_API int pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
bpf_u_int32);
PCAP_API int pcap_compile_nopcap(int, int, struct bpf_program *,
const char *, int, bpf_u_int32);
PCAP_API void pcap_freecode(struct bpf_program *);
PCAP_API int pcap_offline_filter(const struct bpf_program *,
const struct pcap_pkthdr *, const u_char *);
PCAP_API int pcap_datalink(pcap_t *);
PCAP_API int pcap_datalink_ext(pcap_t *);
PCAP_API int pcap_list_datalinks(pcap_t *, int **);
PCAP_API int pcap_set_datalink(pcap_t *, int);
PCAP_API void pcap_free_datalinks(int *);
PCAP_API int pcap_datalink_name_to_val(const char *);
PCAP_API const char *pcap_datalink_val_to_name(int);
PCAP_API const char *pcap_datalink_val_to_description(int);
PCAP_API const char *pcap_datalink_val_to_description_or_dlt(int);
PCAP_API int pcap_snapshot(pcap_t *);
PCAP_API int pcap_is_swapped(pcap_t *);
PCAP_API int pcap_major_version(pcap_t *);
PCAP_API int pcap_minor_version(pcap_t *);
PCAP_API int pcap_bufsize(pcap_t *);
/* XXX */
PCAP_API FILE *pcap_file(pcap_t *);
PCAP_API int pcap_fileno(pcap_t *);
#ifdef _WIN32
PCAP_API int pcap_wsockinit(void);
#endif
PCAP_API pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
#ifdef _WIN32
PCAP_API pcap_dumper_t *pcap_dump_hopen(pcap_t *, intptr_t);
/*
* If we're building libpcap, this is an internal routine in sf-pcap.c, so
* we must not define it as a macro.
*
* If we're not building libpcap, given that the version of the C runtime
* with which libpcap was built might be different from the version
* of the C runtime with which an application using libpcap was built,
* and that a FILE structure may differ between the two versions of the
* C runtime, calls to _fileno() must use the version of _fileno() in
* the C runtime used to open the FILE *, not the version in the C
* runtime with which libpcap was built. (Maybe once the Universal CRT
* rules the world, this will cease to be a problem.)
*/
#ifndef BUILDING_PCAP
#define pcap_dump_fopen(p,f) \
pcap_dump_hopen(p, _get_osfhandle(_fileno(f)))
#endif
#else /*_WIN32*/
PCAP_API pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);
#endif /*_WIN32*/
PCAP_API pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *);
PCAP_API FILE *pcap_dump_file(pcap_dumper_t *);
PCAP_API long pcap_dump_ftell(pcap_dumper_t *);
PCAP_API int64_t pcap_dump_ftell64(pcap_dumper_t *);
PCAP_API int pcap_dump_flush(pcap_dumper_t *);
PCAP_API void pcap_dump_close(pcap_dumper_t *);
PCAP_API void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
PCAP_API int pcap_findalldevs(pcap_if_t **, char *);
PCAP_API void pcap_freealldevs(pcap_if_t *);
/*
* We return a pointer to the version string, rather than exporting the
* version string directly.
*
* On at least some UNIXes, if you import data from a shared library into
* an program, the data is bound into the program binary, so if the string
* in the version of the library with which the program was linked isn't
* the same as the string in the version of the library with which the
* program is being run, various undesirable things may happen (warnings,
* the string being the one from the version of the library with which the
* program was linked, or even weirder things, such as the string being the
* one from the library but being truncated).
*
* On Windows, the string is constructed at run time.
*/
PCAP_API const char *pcap_lib_version(void);
/*
* On at least some versions of NetBSD and QNX, we don't want to declare
* bpf_filter() here, as it's also be declared in <net/bpf.h>, with a
* different signature, but, on other BSD-flavored UN*Xes, it's not
* declared in <net/bpf.h>, so we *do* want to declare it here, so it's
* declared when we build pcap-bpf.c.
*/
#if !defined(__NetBSD__) && !defined(__QNX__)
PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
#endif
PCAP_API int bpf_validate(const struct bpf_insn *f, int len);
PCAP_API char *bpf_image(const struct bpf_insn *, int);
PCAP_API void bpf_dump(const struct bpf_program *, int);
#if defined(_WIN32)
/*
* Win32 definitions
*/
/*!
\brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit().
*/
struct pcap_send_queue
{
u_int maxlen; /* Maximum size of the queue, in bytes. This
variable contains the size of the buffer field. */
u_int len; /* Current size of the queue, in bytes. */
char *buffer; /* Buffer containing the packets to be sent. */
};
typedef struct pcap_send_queue pcap_send_queue;
/*!
\brief This typedef is a support for the pcap_get_airpcap_handle() function
*/
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
typedef struct _AirpcapHandle *PAirpcapHandle;
#endif
PCAP_API int pcap_setbuff(pcap_t *p, int dim);
PCAP_API int pcap_setmode(pcap_t *p, int mode);
PCAP_API int pcap_setmintocopy(pcap_t *p, int size);
PCAP_API HANDLE pcap_getevent(pcap_t *p);
PCAP_API int pcap_oid_get_request(pcap_t *, bpf_u_int32, void *, size_t *);
PCAP_API int pcap_oid_set_request(pcap_t *, bpf_u_int32, const void *, size_t *);
PCAP_API pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
PCAP_API void pcap_sendqueue_destroy(pcap_send_queue* queue);
PCAP_API int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
PCAP_API u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
PCAP_API struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
PCAP_API int pcap_setuserbuffer(pcap_t *p, int size);
PCAP_API int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
PCAP_API int pcap_live_dump_ended(pcap_t *p, int sync);
PCAP_API int pcap_start_oem(char* err_str, int flags);
PCAP_API PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
#define MODE_CAPT 0
#define MODE_STAT 1
#define MODE_MON 2
#elif defined(MSDOS)
/*
* MS-DOS definitions
*/
PCAP_API int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *);
PCAP_API void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait);
PCAP_API u_long pcap_mac_packets (void);
#else /* UN*X */
/*
* UN*X definitions
*/
PCAP_API int pcap_get_selectable_fd(pcap_t *);
PCAP_API struct timeval *pcap_get_required_select_timeout(pcap_t *);
#endif /* _WIN32/MSDOS/UN*X */
/*
* Remote capture definitions.
*
* These routines are only present if libpcap has been configured to
* include remote capture support.
*/
/*
* The maximum buffer size in which address, port, interface names are kept.
*
* In case the adapter name or such is larger than this value, it is truncated.
* This is not used by the user; however it must be aware that an hostname / interface
* name longer than this value will be truncated.
*/
#define PCAP_BUF_SIZE 1024
/*
* The type of input source, passed to pcap_open().
*/
#define PCAP_SRC_FILE 2 /* local savefile */
#define PCAP_SRC_IFLOCAL 3 /* local network interface */
#define PCAP_SRC_IFREMOTE 4 /* interface on a remote host, using RPCAP */
/*
* The formats allowed by pcap_open() are the following:
* - file://path_and_filename [opens a local file]
* - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol]
* - rpcap://host/devicename [opens the selected device available on a remote host]
* - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP]
* - adaptername [to open a local adapter; kept for compability, but it is strongly discouraged]
* - (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged]
*
* The formats allowed by the pcap_findalldevs_ex() are the following:
* - file://folder/ [lists all the files in the given folder]
* - rpcap:// [lists all local adapters]
* - rpcap://host:port/ [lists the devices available on a remote host]
*
* Referring to the 'host' and 'port' parameters, they can be either numeric or literal. Since
* IPv6 is fully supported, these are the allowed formats:
*
* - host (literal): e.g. host.foo.bar
* - host (numeric IPv4): e.g. 10.11.12.13
* - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13]
* - host (numeric IPv6): e.g. [1:2:3::4]
* - port: can be either numeric (e.g. '80') or literal (e.g. 'http')
*
* Here you find some allowed examples:
* - rpcap://host.foo.bar/devicename [everything literal, no port number]
* - rpcap://host.foo.bar:1234/devicename [everything literal, with port number]
* - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number]
* - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number]
* - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number]
* - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number]
* - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number]
* - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number]
*/
/*
* URL schemes for capture source.
*/
/*
* This string indicates that the user wants to open a capture from a
* local file.
*/
#define PCAP_SRC_FILE_STRING "file://"
/*
* This string indicates that the user wants to open a capture from a
* network interface. This string does not necessarily involve the use
* of the RPCAP protocol. If the interface required resides on the local
* host, the RPCAP protocol is not involved and the local functions are used.
*/
#define PCAP_SRC_IF_STRING "rpcap://"
/*
* Flags to pass to pcap_open().
*/
/*
* Specifies whether promiscuous mode is to be used.
*/
#define PCAP_OPENFLAG_PROMISCUOUS 0x00000001
/*
* Specifies, for an RPCAP capture, whether the data transfer (in
* case of a remote capture) has to be done with UDP protocol.
*
* If it is '1' if you want a UDP data connection, '0' if you want
* a TCP data connection; control connection is always TCP-based.
* A UDP connection is much lighter, but it does not guarantee that all
* the captured packets arrive to the client workstation. Moreover,
* it could be harmful in case of network congestion.
* This flag is meaningless if the source is not a remote interface.
* In that case, it is simply ignored.
*/
#define PCAP_OPENFLAG_DATATX_UDP 0x00000002
/*
* Specifies wheether the remote probe will capture its own generated
* traffic.
*
* In case the remote probe uses the same interface to capture traffic
* and to send data back to the caller, the captured traffic includes
* the RPCAP traffic as well. If this flag is turned on, the RPCAP
* traffic is excluded from the capture, so that the trace returned
* back to the collector is does not include this traffic.
*
* Has no effect on local interfaces or savefiles.
*/
#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 0x00000004
/*
* Specifies whether the local adapter will capture its own generated traffic.
*
* This flag tells the underlying capture driver to drop the packets
* that were sent by itself. This is useful when building applications
* such as bridges that should ignore the traffic they just sent.
*
* Supported only on Windows.
*/
#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 0x00000008
/*
* This flag configures the adapter for maximum responsiveness.
*
* In presence of a large value for nbytes, WinPcap waits for the arrival
* of several packets before copying the data to the user. This guarantees
* a low number of system calls, i.e. lower processor usage, i.e. better
* performance, which is good for applications like sniffers. If the user
* sets the PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will
* copy the packets as soon as the application is ready to receive them.
* This is suggested for real time applications (such as, for example,
* a bridge) that need the best responsiveness.
*
* The equivalent with pcap_create()/pcap_activate() is "immediate mode".
*/
#define PCAP_OPENFLAG_MAX_RESPONSIVENESS 0x00000010
/*
* Remote authentication methods.
* These are used in the 'type' member of the pcap_rmtauth structure.
*/
/*
* NULL authentication.
*
* The 'NULL' authentication has to be equal to 'zero', so that old
* applications can just put every field of struct pcap_rmtauth to zero,
* and it does work.
*/
#define RPCAP_RMTAUTH_NULL 0
/*
* Username/password authentication.
*
* With this type of authentication, the RPCAP protocol will use the username/
* password provided to authenticate the user on the remote machine. If the
* authentication is successful (and the user has the right to open network
* devices) the RPCAP connection will continue; otherwise it will be dropped.
*
* *******NOTE********: the username and password are sent over the network
* to the capture server *IN CLEAR TEXT*. Don't use this on a network
* that you don't completely control! (And be *really* careful in your
* definition of "completely"!)
*/
#define RPCAP_RMTAUTH_PWD 1
/*
* This structure keeps the information needed to autheticate the user
* on a remote machine.
*
* The remote machine can either grant or refuse the access according
* to the information provided.
* In case the NULL authentication is required, both 'username' and
* 'password' can be NULL pointers.
*
* This structure is meaningless if the source is not a remote interface;
* in that case, the functions which requires such a structure can accept
* a NULL pointer as well.
*/
struct pcap_rmtauth
{
/*
* \brief Type of the authentication required.
*
* In order to provide maximum flexibility, we can support different types
* of authentication based on the value of this 'type' variable. The currently
* supported authentication methods are defined into the
* \link remote_auth_methods Remote Authentication Methods Section\endlink.
*/
int type;
/*
* \brief Zero-terminated string containing the username that has to be
* used on the remote machine for authentication.
*
* This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication
* and it can be NULL.
*/
char *username;
/*
* \brief Zero-terminated string containing the password that has to be
* used on the remote machine for authentication.
*
* This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication
* and it can be NULL.
*/
char *password;
};
/*
* This routine can open a savefile, a local device, or a device on
* a remote machine running an RPCAP server.
*
* For opening a savefile, the pcap_open_offline routines can be used,
* and will work just as well; code using them will work on more
* platforms than code using pcap_open() to open savefiles.
*
* For opening a local device, pcap_open_live() can be used; it supports
* most of the capabilities that pcap_open() supports, and code using it
* will work on more platforms than code using pcap_open(). pcap_create()
* and pcap_activate() can also be used; they support all capabilities
* that pcap_open() supports, except for the Windows-only
* PCAP_OPENFLAG_NOCAPTURE_LOCAL, and support additional capabilities.
*
* For opening a remote capture, pcap_open() is currently the only
* API available.
*/
PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
PCAP_API int pcap_createsrcstr(char *source, int type, const char *host,
const char *port, const char *name, char *errbuf);
PCAP_API int pcap_parsesrcstr(const char *source, int *type, char *host,
char *port, char *name, char *errbuf);
/*
* This routine can scan a directory for savefiles, list local capture
* devices, or list capture devices on a remote machine running an RPCAP
* server.
*
* For scanning for savefiles, it can be used on both UN*X systems and
* Windows systems; for each directory entry it sees, it tries to open
* the file as a savefile using pcap_open_offline(), and only includes
* it in the list of files if the open succeeds, so it filters out
* files for which the user doesn't have read permission, as well as
* files that aren't valid savefiles readable by libpcap.
*
* For listing local capture devices, it's just a wrapper around
* pcap_findalldevs(); code using pcap_findalldevs() will work on more
* platforms than code using pcap_findalldevs_ex().
*
* For listing remote capture devices, pcap_findalldevs_ex() is currently
* the only API available.
*/
PCAP_API int pcap_findalldevs_ex(const char *source,
struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
/*
* Sampling methods.
*
* These allow pcap_loop(), pcap_dispatch(), pcap_next(), and pcap_next_ex()
* to see only a sample of packets, rather than all packets.
*
* Currently, they work only on Windows local captures.
*/
/*
* Specifies that no sampling is to be done on the current capture.
*
* In this case, no sampling algorithms are applied to the current capture.
*/
#define PCAP_SAMP_NOSAMP 0
/*
* Specifies that only 1 out of N packets must be returned to the user.
*
* In this case, the 'value' field of the 'pcap_samp' structure indicates the
* number of packets (minus 1) that must be discarded before one packet got
* accepted.
* In other words, if 'value = 10', the first packet is returned to the
* caller, while the following 9 are discarded.
*/
#define PCAP_SAMP_1_EVERY_N 1
/*
* Specifies that we have to return 1 packet every N milliseconds.
*
* In this case, the 'value' field of the 'pcap_samp' structure indicates
* the 'waiting time' in milliseconds before one packet got accepted.
* In other words, if 'value = 10', the first packet is returned to the
* caller; the next returned one will be the first packet that arrives
* when 10ms have elapsed.
*/
#define PCAP_SAMP_FIRST_AFTER_N_MS 2
/*
* This structure defines the information related to sampling.
*
* In case the sampling is requested, the capturing device should read
* only a subset of the packets coming from the source. The returned packets
* depend on the sampling parameters.
*
* WARNING: The sampling process is applied *after* the filtering process.
* In other words, packets are filtered first, then the sampling process
* selects a subset of the 'filtered' packets and it returns them to the
* caller.
*/
struct pcap_samp
{
/*
* Method used for sampling; see above.
*/
int method;
/*
* This value depends on the sampling method defined.
* For its meaning, see above.
*/
int value;
};
/*
* New functions.
*/
PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
/*
* RPCAP active mode.
*/
/* Maximum length of an host name (needed for the RPCAP active mode) */
#define RPCAP_HOSTLIST_SIZE 1024
PCAP_API SOCKET pcap_remoteact_accept(const char *address, const char *port,
const char *hostlist, char *connectinghost,
struct pcap_rmtauth *auth, char *errbuf);
PCAP_API int pcap_remoteact_list(char *hostlist, char sep, int size,
char *errbuf);
PCAP_API int pcap_remoteact_close(const char *host, char *errbuf);
PCAP_API void pcap_remoteact_cleanup(void);
#ifdef __cplusplus
}
#endif
#endif /* lib_pcap_pcap_h */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*/
/*
* This is libpcap's cut-down version of bpf.h; it includes only
* the stuff needed for the code generator and the userland BPF
* interpreter, and the libpcap APIs for setting filters, etc..
*
* "pcap-bpf.c" will include the native OS version, as it deals with
* the OS's BPF implementation.
*
* At least two programs found by Google Code Search explicitly includes
* <pcap/bpf.h> (even though <pcap.h>/<pcap/pcap.h> includes it for you),
* so moving that stuff to <pcap/pcap.h> would break the build for some
* programs.
*/
/*
* If we've already included <net/bpf.h>, don't re-define this stuff.
* We assume BSD-style multiple-include protection in <net/bpf.h>,
* which is true of all but the oldest versions of FreeBSD and NetBSD,
* or Tru64 UNIX-style multiple-include protection (or, at least,
* Tru64 UNIX 5.x-style; I don't have earlier versions available to check),
* or AIX-style multiple-include protection (or, at least, AIX 5.x-style;
* I don't have earlier versions available to check), or QNX-style
* multiple-include protection (as per GitHub pull request #394).
*
* We do not check for BPF_MAJOR_VERSION, as that's defined by
* <linux/filter.h>, which is directly or indirectly included in some
* programs that also include pcap.h, and <linux/filter.h> doesn't
* define stuff we need.
*
* This also provides our own multiple-include protection.
*/
#if !defined(_NET_BPF_H_) && !defined(_NET_BPF_H_INCLUDED) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h)
#define lib_pcap_bpf_h
#include <pcap/funcattrs.h>
#ifdef __cplusplus
extern "C" {
#endif
/* BSD style release date */
#define BPF_RELEASE 199606
#ifdef MSDOS /* must be 32-bit */
typedef long bpf_int32;
typedef unsigned long bpf_u_int32;
#else
typedef int bpf_int32;
typedef u_int bpf_u_int32;
#endif
/*
* Alignment macros. BPF_WORDALIGN rounds up to the next
* even multiple of BPF_ALIGNMENT.
*
* Tcpdump's print-pflog.c uses this, so we define it here.
*/
#ifndef __NetBSD__
#define BPF_ALIGNMENT sizeof(bpf_int32)
#else
#define BPF_ALIGNMENT sizeof(long)
#endif
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
/*
* Structure for "pcap_compile()", "pcap_setfilter()", etc..
*/
struct bpf_program {
u_int bf_len;
struct bpf_insn *bf_insns;
};
#include <pcap/dlt.h>
/*
* The instruction encodings.
*
* Please inform tcpdump-workers@lists.tcpdump.org if you use any
* of the reserved values, so that we can note that they're used
* (and perhaps implement it in the reference BPF implementation
* and encourage its implementation elsewhere).
*/
/*
* The upper 8 bits of the opcode aren't used. BSD/OS used 0x8000.
*/
/* instruction classes */
#define BPF_CLASS(code) ((code) & 0x07)
#define BPF_LD 0x00
#define BPF_LDX 0x01
#define BPF_ST 0x02
#define BPF_STX 0x03
#define BPF_ALU 0x04
#define BPF_JMP 0x05
#define BPF_RET 0x06
#define BPF_MISC 0x07
/* ld/ldx fields */
#define BPF_SIZE(code) ((code) & 0x18)
#define BPF_W 0x00
#define BPF_H 0x08
#define BPF_B 0x10
/* 0x18 reserved; used by BSD/OS */
#define BPF_MODE(code) ((code) & 0xe0)
#define BPF_IMM 0x00
#define BPF_ABS 0x20
#define BPF_IND 0x40
#define BPF_MEM 0x60
#define BPF_LEN 0x80
#define BPF_MSH 0xa0
/* 0xc0 reserved; used by BSD/OS */
/* 0xe0 reserved; used by BSD/OS */
/* alu/jmp fields */
#define BPF_OP(code) ((code) & 0xf0)
#define BPF_ADD 0x00
#define BPF_SUB 0x10
#define BPF_MUL 0x20
#define BPF_DIV 0x30
#define BPF_OR 0x40
#define BPF_AND 0x50
#define BPF_LSH 0x60
#define BPF_RSH 0x70
#define BPF_NEG 0x80
#define BPF_MOD 0x90
#define BPF_XOR 0xa0
/* 0xb0 reserved */
/* 0xc0 reserved */
/* 0xd0 reserved */
/* 0xe0 reserved */
/* 0xf0 reserved */
#define BPF_JA 0x00
#define BPF_JEQ 0x10
#define BPF_JGT 0x20
#define BPF_JGE 0x30
#define BPF_JSET 0x40
/* 0x50 reserved; used on BSD/OS */
/* 0x60 reserved */
/* 0x70 reserved */
/* 0x80 reserved */
/* 0x90 reserved */
/* 0xa0 reserved */
/* 0xb0 reserved */
/* 0xc0 reserved */
/* 0xd0 reserved */
/* 0xe0 reserved */
/* 0xf0 reserved */
#define BPF_SRC(code) ((code) & 0x08)
#define BPF_K 0x00
#define BPF_X 0x08
/* ret - BPF_K and BPF_X also apply */
#define BPF_RVAL(code) ((code) & 0x18)
#define BPF_A 0x10
/* 0x18 reserved */
/* misc */
#define BPF_MISCOP(code) ((code) & 0xf8)
#define BPF_TAX 0x00
/* 0x08 reserved */
/* 0x10 reserved */
/* 0x18 reserved */
/* #define BPF_COP 0x20 NetBSD "coprocessor" extensions */
/* 0x28 reserved */
/* 0x30 reserved */
/* 0x38 reserved */
/* #define BPF_COPX 0x40 NetBSD "coprocessor" extensions */
/* also used on BSD/OS */
/* 0x48 reserved */
/* 0x50 reserved */
/* 0x58 reserved */
/* 0x60 reserved */
/* 0x68 reserved */
/* 0x70 reserved */
/* 0x78 reserved */
#define BPF_TXA 0x80
/* 0x88 reserved */
/* 0x90 reserved */
/* 0x98 reserved */
/* 0xa0 reserved */
/* 0xa8 reserved */
/* 0xb0 reserved */
/* 0xb8 reserved */
/* 0xc0 reserved; used on BSD/OS */
/* 0xc8 reserved */
/* 0xd0 reserved */
/* 0xd8 reserved */
/* 0xe0 reserved */
/* 0xe8 reserved */
/* 0xf0 reserved */
/* 0xf8 reserved */
/*
* The instruction data structure.
*/
struct bpf_insn {
u_short code;
u_char jt;
u_char jf;
bpf_u_int32 k;
};
/*
* Macros for insn array initializers.
*/
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
PCAP_API int bpf_validate(const struct bpf_insn *, int);
PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
*/
#define BPF_MEMWORDS 16
#ifdef __cplusplus
}
#endif
#endif /* !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* For captures on Linux cooked sockets, we construct a fake header
* that includes:
*
* a 2-byte "packet type" which is one of:
*
* LINUX_SLL_HOST packet was sent to us
* LINUX_SLL_BROADCAST packet was broadcast
* LINUX_SLL_MULTICAST packet was multicast
* LINUX_SLL_OTHERHOST packet was sent to somebody else
* LINUX_SLL_OUTGOING packet was sent *by* us;
*
* a 2-byte Ethernet protocol field;
*
* a 2-byte link-layer type;
*
* a 2-byte link-layer address length;
*
* an 8-byte source link-layer address, whose actual length is
* specified by the previous value.
*
* All fields except for the link-layer address are in network byte order.
*
* DO NOT change the layout of this structure, or change any of the
* LINUX_SLL_ values below. If you must change the link-layer header
* for a "cooked" Linux capture, introduce a new DLT_ type (ask
* "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it
* a value that collides with a value already being used), and use the
* new header in captures of that type, so that programs that can
* handle DLT_LINUX_SLL captures will continue to handle them correctly
* without any change, and so that capture files with different headers
* can be told apart and programs that read them can dissect the
* packets in them.
*/
#ifndef lib_pcap_sll_h
#define lib_pcap_sll_h
#include <pcap/pcap-inttypes.h>
/*
* A DLT_LINUX_SLL fake link-layer header.
*/
#define SLL_HDR_LEN 16 /* total header length */
#define SLL_ADDRLEN 8 /* length of address field */
struct sll_header {
uint16_t sll_pkttype; /* packet type */
uint16_t sll_hatype; /* link-layer address type */
uint16_t sll_halen; /* link-layer address length */
uint8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */
uint16_t sll_protocol; /* protocol */
};
/*
* A DLT_LINUX_SLL2 fake link-layer header.
*/
#define SLL2_HDR_LEN 20 /* total header length */
struct sll2_header {
uint16_t sll2_protocol; /* protocol */
uint16_t sll2_reserved_mbz; /* reserved - must be zero */
uint32_t sll2_if_index; /* 1-based interface index */
uint16_t sll2_hatype; /* link-layer address type */
uint8_t sll2_pkttype; /* packet type */
uint8_t sll2_halen; /* link-layer address length */
uint8_t sll2_addr[SLL_ADDRLEN]; /* link-layer address */
};
/*
* The LINUX_SLL_ values for "sll_pkttype" and LINUX_SLL2_ values for
* "sll2_pkttype"; these correspond to the PACKET_ values on Linux,
* which are defined by a header under include/uapi in the current
* kernel source, and are thus not going to change on Linux. We
* define them here so that they're available even on systems other
* than Linux.
*/
#define LINUX_SLL_HOST 0
#define LINUX_SLL_BROADCAST 1
#define LINUX_SLL_MULTICAST 2
#define LINUX_SLL_OTHERHOST 3
#define LINUX_SLL_OUTGOING 4
/*
* The LINUX_SLL_ values for "sll_protocol" and LINUX_SLL2_ values for
* "sll2_protocol"; these correspond to the ETH_P_ values on Linux, but
* are defined here so that they're available even on systems other than
* Linux. We assume, for now, that the ETH_P_ values won't change in
* Linux; if they do, then:
*
* if we don't translate them in "pcap-linux.c", capture files
* won't necessarily be readable if captured on a system that
* defines ETH_P_ values that don't match these values;
*
* if we do translate them in "pcap-linux.c", that makes life
* unpleasant for the BPF code generator, as the values you test
* for in the kernel aren't the values that you test for when
* reading a capture file, so the fixup code run on BPF programs
* handed to the kernel ends up having to do more work.
*
* Add other values here as necessary, for handling packet types that
* might show up on non-Ethernet, non-802.x networks. (Not all the ones
* in the Linux "if_ether.h" will, I suspect, actually show up in
* captures.)
*/
#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */
#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */
#define LINUX_SLL_P_CAN 0x000C /* CAN frames, with SocketCAN pseudo-headers */
#define LINUX_SLL_P_CANFD 0x000D /* CAN FD frames, with SocketCAN pseudo-headers */
#endif
/*
* Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
* Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Politecnico di Torino nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef pcap_pcap_inttypes_h
#define pcap_pcap_inttypes_h
/*
* Get the integer types and PRi[doux]64 values from C99 <inttypes.h>
* defined, by hook or by crook.
*/
#if defined(_MSC_VER)
/*
* Compiler is MSVC.
*/
#if _MSC_VER >= 1800
/*
* VS 2013 or newer; we have <inttypes.h>.
*/
#include <inttypes.h>
#else
/*
* Earlier VS; we have to define this stuff ourselves.
*/
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
#ifdef _MSC_EXTENSIONS
typedef unsigned _int64 uint64_t;
typedef _int64 int64_t;
#else /* _MSC_EXTENSIONS */
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif
#endif
/*
* These may be defined by <inttypes.h>.
*
* XXX - for MSVC, we always want the _MSC_EXTENSIONS versions.
* What about other compilers? If, as the MinGW Web site says MinGW
* does, the other compilers just use Microsoft's run-time library,
* then they should probably use the _MSC_EXTENSIONS even if the
* compiler doesn't define _MSC_EXTENSIONS.
*
* XXX - we currently aren't using any of these, but this allows
* their use in the future.
*/
#ifndef PRId64
#ifdef _MSC_EXTENSIONS
#define PRId64 "I64d"
#else
#define PRId64 "lld"
#endif
#endif /* PRId64 */
#ifndef PRIo64
#ifdef _MSC_EXTENSIONS
#define PRIo64 "I64o"
#else
#define PRIo64 "llo"
#endif
#endif /* PRIo64 */
#ifndef PRIx64
#ifdef _MSC_EXTENSIONS
#define PRIx64 "I64x"
#else
#define PRIx64 "llx"
#endif
#endif
#ifndef PRIu64
#ifdef _MSC_EXTENSIONS
#define PRIu64 "I64u"
#else
#define PRIu64 "llu"
#endif
#endif
/*
* MSVC's support library doesn't support %zu to print a size_t until
* Visual Studio 2017, but supports %Iu earlier, so use that.
*/
#define PRIsize "Iu"
#elif defined(__MINGW32__) || !defined(_WIN32)
/*
* Compiler is MinGW or target is UN*X or MS-DOS. Just use
* <inttypes.h>.
*/
#include <inttypes.h>
/*
* Assume the support library supports %zu; it's required by C99.
*/
#define PRIsize "zu"
#endif
#endif /* pcap/pcap-inttypes.h */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lib_pcap_vlan_h
#define lib_pcap_vlan_h
#include <pcap/pcap-inttypes.h>
struct vlan_tag {
uint16_t vlan_tpid; /* ETH_P_8021Q */
uint16_t vlan_tci; /* VLAN TCI */
};
#define VLAN_TAG_LEN 4
#endif
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lib_pcap_can_socketcan_h
#define lib_pcap_can_socketcan_h
#include <pcap/pcap-inttypes.h>
/*
* SocketCAN header, as per Documentation/networking/can.txt in the
* Linux source.
*/
typedef struct {
uint32_t can_id;
uint8_t payload_length;
uint8_t pad;
uint8_t reserved1;
uint8_t reserved2;
} pcap_can_socketcan_hdr;
#endif
/*
* Copyright (c) 1994, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lib_pcap_namedb_h
#define lib_pcap_namedb_h
#ifdef __cplusplus
extern "C" {
#endif
/*
* As returned by the pcap_next_etherent()
* XXX this stuff doesn't belong in this interface, but this
* library already must do name to address translation, so
* on systems that don't have support for /etc/ethers, we
* export these hooks since they're already being used by
* some applications (such as tcpdump) and already being
* marked as exported in some OSes offering libpcap (such
* as Debian).
*/
struct pcap_etherent {
u_char addr[6];
char name[122];
};
#ifndef PCAP_ETHERS_FILE
#define PCAP_ETHERS_FILE "/etc/ethers"
#endif
PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *);
PCAP_API u_char *pcap_ether_hostton(const char*);
PCAP_API u_char *pcap_ether_aton(const char *);
PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *);
PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
PCAP_API int pcap_nametoport(const char *, int *, int *);
PCAP_API int pcap_nametoportrange(const char *, int *, int *, int *);
PCAP_API int pcap_nametoproto(const char *);
PCAP_API int pcap_nametoeproto(const char *);
PCAP_API int pcap_nametollc(const char *);
/*
* If a protocol is unknown, PROTO_UNDEF is returned.
* Also, pcap_nametoport() returns the protocol along with the port number.
* If there are ambiguous entried in /etc/services (i.e. domain
* can be either tcp or udp) PROTO_UNDEF is returned.
*/
#define PROTO_UNDEF -1
#ifdef __cplusplus
}
#endif
#endif
/* $Id: tiffio.h,v 1.94 2017-01-11 19:02:49 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFFIO_
#define _TIFFIO_
/*
* TIFF I/O Library Definitions.
*/
#include "tiff.h"
#include "tiffvers.h"
/*
* TIFF is defined as an incomplete type to hide the
* library's internal data structures from clients.
*/
typedef struct tiff TIFF;
/*
* The following typedefs define the intrinsic size of
* data types used in the *exported* interfaces. These
* definitions depend on the proper definition of types
* in tiff.h. Note also that the varargs interface used
* to pass tag types and values uses the types defined in
* tiff.h directly.
*
* NB: ttag_t is unsigned int and not unsigned short because
* ANSI C requires that the type before the ellipsis be a
* promoted type (i.e. one of int, unsigned int, pointer,
* or double) and because we defined pseudo-tags that are
* outside the range of legal Aldus-assigned tags.
* NB: tsize_t is int32 and not uint32 because some functions
* return -1.
* NB: toff_t is not off_t for many reasons; TIFFs max out at
* 32-bit file offsets, and BigTIFF maxes out at 64-bit
* offsets being the most important, and to ensure use of
* a consistently unsigned type across architectures.
* Prior to libtiff 4.0, this was an unsigned 32 bit type.
*/
/*
* this is the machine addressing size type, only it's signed, so make it
* int32 on 32bit machines, int64 on 64bit machines
*/
typedef TIFF_SSIZE_T tmsize_t;
typedef uint64 toff_t; /* file offset */
/* the following are deprecated and should be replaced by their defining
counterparts */
typedef uint32 ttag_t; /* directory tag */
typedef uint16 tdir_t; /* directory index */
typedef uint16 tsample_t; /* sample number */
typedef uint32 tstrile_t; /* strip or tile number */
typedef tstrile_t tstrip_t; /* strip number */
typedef tstrile_t ttile_t; /* tile number */
typedef tmsize_t tsize_t; /* i/o size in bytes */
typedef void* tdata_t; /* image data ref */
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
#define __WIN32__
#endif
/*
* On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
* or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
*
* By default tif_unix.c is assumed.
*/
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
# define AVOID_WIN32_FILEIO
# endif
#endif
#if defined(USE_WIN32_FILEIO)
# define VC_EXTRALEAN
# include <windows.h>
# ifdef __WIN32__
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
# else
typedef HFILE thandle_t; /* client data handle */
# endif /* __WIN32__ */
#else
typedef void* thandle_t; /* client data handle */
#endif /* USE_WIN32_FILEIO */
/*
* Flags to pass to TIFFPrintDirectory to control
* printing of data structures that are potentially
* very large. Bit-or these flags to enable printing
* multiple items.
*/
#define TIFFPRINT_NONE 0x0 /* no extra info */
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
/*
* Colour conversion stuff
*/
/* reference white */
#define D65_X0 (95.0470F)
#define D65_Y0 (100.0F)
#define D65_Z0 (108.8827F)
#define D50_X0 (96.4250F)
#define D50_Y0 (100.0F)
#define D50_Z0 (82.4680F)
/* Structure for holding information about a display device. */
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
typedef struct {
float d_mat[3][3]; /* XYZ -> luminance matrix */
float d_YCR; /* Light o/p for reference white */
float d_YCG;
float d_YCB;
uint32 d_Vrwr; /* Pixel values for ref. white */
uint32 d_Vrwg;
uint32 d_Vrwb;
float d_Y0R; /* Residual light for black pixel */
float d_Y0G;
float d_Y0B;
float d_gammaR; /* Gamma values for the three guns */
float d_gammaG;
float d_gammaB;
} TIFFDisplay;
typedef struct { /* YCbCr->RGB support */
TIFFRGBValue* clamptab; /* range clamping table */
int* Cr_r_tab;
int* Cb_b_tab;
int32* Cr_g_tab;
int32* Cb_g_tab;
int32* Y_tab;
} TIFFYCbCrToRGB;
typedef struct { /* CIE Lab 1976->RGB support */
int range; /* Size of conversion table */
#define CIELABTORGB_TABLE_RANGE 1500
float rstep, gstep, bstep;
float X0, Y0, Z0; /* Reference white point */
TIFFDisplay display;
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
} TIFFCIELabToRGB;
/*
* RGBA-style image support.
*/
typedef struct _TIFFRGBAImage TIFFRGBAImage;
/*
* The image reading and conversion routines invoke
* ``put routines'' to copy/image/whatever tiles of
* raw image data. A default set of routines are
* provided to convert/copy raw image data to 8-bit
* packed ABGR format rasters. Applications can supply
* alternate routines that unpack the data into a
* different format or, for example, unpack the data
* and draw the unpacked raster on the display.
*/
typedef void (*tileContigRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*);
typedef void (*tileSeparateRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
/*
* RGBA-reader state.
*/
struct _TIFFRGBAImage {
TIFF* tif; /* image handle */
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
uint32 width; /* image width */
uint32 height; /* image height */
uint16 bitspersample; /* image bits/sample */
uint16 samplesperpixel; /* image samples/pixel */
uint16 orientation; /* image orientation */
uint16 req_orientation; /* requested orientation */
uint16 photometric; /* image photometric interp */
uint16* redcmap; /* colormap palette */
uint16* greencmap;
uint16* bluecmap;
/* get image data routine */
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
/* put decoded strip/tile */
union {
void (*any)(TIFFRGBAImage*);
tileContigRoutine contig;
tileSeparateRoutine separate;
} put;
TIFFRGBValue* Map; /* sample mapping array */
uint32** BWmap; /* black&white map */
uint32** PALmap; /* palette image map */
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
uint8* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
int row_offset;
int col_offset;
};
/*
* Macros for extracting components from the
* packed ABGR form returned by TIFFReadRGBAImage.
*/
#define TIFFGetR(abgr) ((abgr) & 0xff)
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
/*
* A CODEC is a software package that implements decoding,
* encoding, or decoding+encoding of a compression algorithm.
* The library provides a collection of builtin codecs.
* More codecs may be registered through calls to the library
* and/or the builtin implementations may be overridden.
*/
typedef int (*TIFFInitMethod)(TIFF*, int);
typedef struct {
char* name;
uint16 scheme;
TIFFInitMethod init;
} TIFFCodec;
#include <stdio.h>
#include <stdarg.h>
/* share internal LogLuv conversion routines? */
#ifndef LOGLUV_PUBLIC
#define LOGLUV_PUBLIC 1
#endif
#if !defined(__GNUC__) && !defined(__attribute__)
# define __attribute__(x) /*nothing*/
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t);
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
typedef int (*TIFFCloseProc)(thandle_t);
typedef toff_t (*TIFFSizeProc)(thandle_t);
typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size);
typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size);
typedef void (*TIFFExtendProc)(TIFF*);
extern const char* TIFFGetVersion(void);
extern const TIFFCodec* TIFFFindCODEC(uint16);
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
extern void TIFFUnRegisterCODEC(TIFFCodec*);
extern int TIFFIsCODECConfigured(uint16);
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
/*
* Auxiliary functions.
*/
extern void* _TIFFmalloc(tmsize_t s);
extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
extern void* _TIFFrealloc(void* p, tmsize_t s);
extern void _TIFFmemset(void* p, int v, tmsize_t c);
extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c);
extern void _TIFFfree(void* p);
/*
** Stuff, related to tag handling and creating custom tags.
*/
extern int TIFFGetTagListCount( TIFF * );
extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index );
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
#define TIFF_VARIABLE -1 /* marker for variable length tags */
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
#define FIELD_CUSTOM 65
typedef struct _TIFFField TIFFField;
typedef struct _TIFFFieldArray TIFFFieldArray;
extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType);
extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32);
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
extern uint32 TIFFFieldTag(const TIFFField*);
extern const char* TIFFFieldName(const TIFFField*);
extern TIFFDataType TIFFFieldDataType(const TIFFField*);
extern int TIFFFieldPassCount(const TIFFField*);
extern int TIFFFieldReadCount(const TIFFField*);
extern int TIFFFieldWriteCount(const TIFFField*);
typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list);
typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list);
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
typedef struct {
TIFFVSetMethod vsetfield; /* tag set routine */
TIFFVGetMethod vgetfield; /* tag get routine */
TIFFPrintMethod printdir; /* directory print routine */
} TIFFTagMethods;
extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
extern void *TIFFGetClientInfo(TIFF *, const char *);
extern void TIFFSetClientInfo(TIFF *, void *, const char *);
extern void TIFFCleanup(TIFF* tif);
extern void TIFFClose(TIFF* tif);
extern int TIFFFlush(TIFF* tif);
extern int TIFFFlushData(TIFF* tif);
extern int TIFFGetField(TIFF* tif, uint32 tag, ...);
extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap);
extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...);
extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap);
extern int TIFFReadDirectory(TIFF* tif);
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
extern uint64 TIFFScanlineSize64(TIFF* tif);
extern tmsize_t TIFFScanlineSize(TIFF* tif);
extern uint64 TIFFRasterScanlineSize64(TIFF* tif);
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
extern uint64 TIFFStripSize64(TIFF* tif);
extern tmsize_t TIFFStripSize(TIFF* tif);
extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip);
extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip);
extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows);
extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows);
extern uint64 TIFFTileRowSize64(TIFF* tif);
extern tmsize_t TIFFTileRowSize(TIFF* tif);
extern uint64 TIFFTileSize64(TIFF* tif);
extern tmsize_t TIFFTileSize(TIFF* tif);
extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows);
extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows);
extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request);
extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
extern int TIFFFileno(TIFF*);
extern int TIFFSetFileno(TIFF*, int);
extern thandle_t TIFFClientdata(TIFF*);
extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
extern int TIFFGetMode(TIFF*);
extern int TIFFSetMode(TIFF*, int);
extern int TIFFIsTiled(TIFF*);
extern int TIFFIsByteSwapped(TIFF*);
extern int TIFFIsUpSampled(TIFF*);
extern int TIFFIsMSB2LSB(TIFF*);
extern int TIFFIsBigEndian(TIFF*);
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
extern uint32 TIFFCurrentRow(TIFF*);
extern uint16 TIFFCurrentDirectory(TIFF*);
extern uint16 TIFFNumberOfDirectories(TIFF*);
extern uint64 TIFFCurrentDirOffset(TIFF*);
extern uint32 TIFFCurrentStrip(TIFF*);
extern uint32 TIFFCurrentTile(TIFF* tif);
extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
extern int TIFFSetupStrips(TIFF *);
extern int TIFFWriteCheck(TIFF*, int, const char *);
extern void TIFFFreeDirectory(TIFF*);
extern int TIFFCreateDirectory(TIFF*);
extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
extern int TIFFCreateEXIFDirectory(TIFF*);
extern int TIFFLastDirectory(TIFF*);
extern int TIFFSetDirectory(TIFF*, uint16);
extern int TIFFSetSubDirectory(TIFF*, uint64);
extern int TIFFUnlinkDirectory(TIFF*, uint16);
extern int TIFFSetField(TIFF*, uint32, ...);
extern int TIFFVSetField(TIFF*, uint32, va_list);
extern int TIFFUnsetField(TIFF*, uint32);
extern int TIFFWriteDirectory(TIFF *);
extern int TIFFWriteCustomDirectory(TIFF *, uint64 *);
extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *);
#if defined(c_plusplus) || defined(__cplusplus)
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
int = ORIENTATION_BOTLEFT, int = 0);
#else
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
#endif
extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * );
extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
extern int TIFFReadRGBAStripExt(TIFF*, uint32, uint32 *, int stop_on_error );
extern int TIFFReadRGBATileExt(TIFF*, uint32, uint32, uint32 *, int stop_on_error );
extern int TIFFRGBAImageOK(TIFF*, char [1024]);
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
extern TIFF* TIFFOpen(const char*, const char*);
# ifdef __WIN32__
extern TIFF* TIFFOpenW(const wchar_t*, const char*);
# endif /* __WIN32__ */
extern TIFF* TIFFFdOpen(int, const char*, const char*);
extern TIFF* TIFFClientOpen(const char*, const char*,
thandle_t,
TIFFReadWriteProc, TIFFReadWriteProc,
TIFFSeekProc, TIFFCloseProc,
TIFFSizeProc,
TIFFMapFileProc, TIFFUnmapFileProc);
extern const char* TIFFFileName(TIFF*);
extern const char* TIFFSetFileName(TIFF*, const char *);
extern void TIFFError(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3)));
extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4)));
extern void TIFFWarning(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3)));
extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4)));
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
extern uint32 TIFFNumberOfTiles(TIFF*);
extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16);
extern uint32 TIFFNumberOfStrips(TIFF*);
extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
extern void TIFFSwabShort(uint16*);
extern void TIFFSwabLong(uint32*);
extern void TIFFSwabLong8(uint64*);
extern void TIFFSwabFloat(float*);
extern void TIFFSwabDouble(double*);
extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n);
extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n);
extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n);
extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n);
extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
extern void TIFFReverseBits(uint8* cp, tmsize_t n);
extern const unsigned char* TIFFGetBitRevTable(int);
#ifdef LOGLUV_PUBLIC
#define U_NEU 0.210526316
#define V_NEU 0.473684211
#define UVSCALE 410.
extern double LogL16toY(int);
extern double LogL10toY(int);
extern void XYZtoRGB24(float*, uint8*);
extern int uv_decode(double*, double*, int);
extern void LogLuv24toXYZ(uint32, float*);
extern void LogLuv32toXYZ(uint32, float*);
#if defined(c_plusplus) || defined(__cplusplus)
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
#else
extern int LogL16fromY(double, int);
extern int LogL10fromY(double, int);
extern int uv_encode(double, double, int);
extern uint32 LogLuv24fromXYZ(float*, int);
extern uint32 LogLuv32fromXYZ(float*, int);
#endif
#endif /* LOGLUV_PUBLIC */
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
float *, float *, float *);
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
uint32 *, uint32 *, uint32 *);
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
uint32 *, uint32 *, uint32 *);
/****************************************************************************
* O B S O L E T E D I N T E R F A C E S
*
* Don't use this stuff in your applications, it may be removed in the future
* libtiff versions.
****************************************************************************/
typedef struct {
ttag_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
unsigned short field_bit; /* bit in fieldsset bit vector */
unsigned char field_oktochange; /* if true, can change while writing */
unsigned char field_passcount; /* if true, pass dir count on set */
char *field_name; /* ASCII name */
} TIFFFieldInfo;
extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* _TIFFIO_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Autogenerated file, please don't edit */
#include "mysqlx_error.h"
{"ER_X_BAD_MESSAGE", ER_X_BAD_MESSAGE, "", NULL, NULL, 0 },
{"ER_X_CAPABILITIES_PREPARE_FAILED", ER_X_CAPABILITIES_PREPARE_FAILED, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_NOT_FOUND", ER_X_CAPABILITY_NOT_FOUND, "", NULL, NULL, 0 },
{"ER_X_INVALID_PROTOCOL_DATA", ER_X_INVALID_PROTOCOL_DATA, "", NULL, NULL, 0 },
{"ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_VALUE_LENGTH", ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_VALUE_LENGTH, "", NULL, NULL, 0 },
{"ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_KEY_LENGTH", ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_KEY_LENGTH, "", NULL, NULL, 0 },
{"ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_EMPTY_KEY", ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_EMPTY_KEY, "", NULL, NULL, 0 },
{"ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_LENGTH", ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_LENGTH, "", NULL, NULL, 0 },
{"ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_TYPE", ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_TYPE, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_SET_NOT_ALLOWED", ER_X_CAPABILITY_SET_NOT_ALLOWED, "", NULL, NULL, 0 },
{"ER_X_SERVICE_ERROR", ER_X_SERVICE_ERROR, "", NULL, NULL, 0 },
{"ER_X_SESSION", ER_X_SESSION, "", NULL, NULL, 0 },
{"ER_X_INVALID_ARGUMENT", ER_X_INVALID_ARGUMENT, "", NULL, NULL, 0 },
{"ER_X_MISSING_ARGUMENT", ER_X_MISSING_ARGUMENT, "", NULL, NULL, 0 },
{"ER_X_BAD_INSERT_DATA", ER_X_BAD_INSERT_DATA, "", NULL, NULL, 0 },
{"ER_X_CMD_NUM_ARGUMENTS", ER_X_CMD_NUM_ARGUMENTS, "", NULL, NULL, 0 },
{"ER_X_CMD_ARGUMENT_TYPE", ER_X_CMD_ARGUMENT_TYPE, "", NULL, NULL, 0 },
{"ER_X_CMD_ARGUMENT_VALUE", ER_X_CMD_ARGUMENT_VALUE, "", NULL, NULL, 0 },
{"ER_X_BAD_UPSERT_DATA", ER_X_BAD_UPSERT_DATA, "", NULL, NULL, 0 },
{"ER_X_DUPLICATED_CAPABILITIES", ER_X_DUPLICATED_CAPABILITIES, "", NULL, NULL, 0 },
{"ER_X_CMD_ARGUMENT_OBJECT_EMPTY", ER_X_CMD_ARGUMENT_OBJECT_EMPTY, "", NULL, NULL, 0 },
{"ER_X_CMD_INVALID_ARGUMENT", ER_X_CMD_INVALID_ARGUMENT, "", NULL, NULL, 0 },
{"ER_X_BAD_UPDATE_DATA", ER_X_BAD_UPDATE_DATA, "", NULL, NULL, 0 },
{"ER_X_BAD_TYPE_OF_UPDATE", ER_X_BAD_TYPE_OF_UPDATE, "", NULL, NULL, 0 },
{"ER_X_BAD_COLUMN_TO_UPDATE", ER_X_BAD_COLUMN_TO_UPDATE, "", NULL, NULL, 0 },
{"ER_X_BAD_MEMBER_TO_UPDATE", ER_X_BAD_MEMBER_TO_UPDATE, "", NULL, NULL, 0 },
{"ER_X_BAD_STATEMENT_ID", ER_X_BAD_STATEMENT_ID, "", NULL, NULL, 0 },
{"ER_X_BAD_CURSOR_ID", ER_X_BAD_CURSOR_ID, "", NULL, NULL, 0 },
{"ER_X_BAD_SCHEMA", ER_X_BAD_SCHEMA, "", NULL, NULL, 0 },
{"ER_X_BAD_TABLE", ER_X_BAD_TABLE, "", NULL, NULL, 0 },
{"ER_X_BAD_PROJECTION", ER_X_BAD_PROJECTION, "", NULL, NULL, 0 },
{"ER_X_DOC_ID_MISSING", ER_X_DOC_ID_MISSING, "", NULL, NULL, 0 },
{"ER_X_DUPLICATE_ENTRY", ER_X_DUPLICATE_ENTRY, "", NULL, NULL, 0 },
{"ER_X_DOC_REQUIRED_FIELD_MISSING", ER_X_DOC_REQUIRED_FIELD_MISSING, "", NULL, NULL, 0 },
{"ER_X_PROJ_BAD_KEY_NAME", ER_X_PROJ_BAD_KEY_NAME, "", NULL, NULL, 0 },
{"ER_X_BAD_DOC_PATH", ER_X_BAD_DOC_PATH, "", NULL, NULL, 0 },
{"ER_X_CURSOR_EXISTS", ER_X_CURSOR_EXISTS, "", NULL, NULL, 0 },
{"ER_X_CURSOR_REACHED_EOF", ER_X_CURSOR_REACHED_EOF, "", NULL, NULL, 0 },
{"ER_X_PREPARED_STATMENT_CAN_HAVE_ONE_CURSOR", ER_X_PREPARED_STATMENT_CAN_HAVE_ONE_CURSOR, "", NULL, NULL, 0 },
{"ER_X_PREPARED_EXECUTE_ARGUMENT_NOT_SUPPORTED", ER_X_PREPARED_EXECUTE_ARGUMENT_NOT_SUPPORTED, "", NULL, NULL, 0 },
{"ER_X_PREPARED_EXECUTE_ARGUMENT_CONSISTENCY", ER_X_PREPARED_EXECUTE_ARGUMENT_CONSISTENCY, "", NULL, NULL, 0 },
{"ER_X_EXPR_BAD_OPERATOR", ER_X_EXPR_BAD_OPERATOR, "", NULL, NULL, 0 },
{"ER_X_EXPR_BAD_NUM_ARGS", ER_X_EXPR_BAD_NUM_ARGS, "", NULL, NULL, 0 },
{"ER_X_EXPR_MISSING_ARG", ER_X_EXPR_MISSING_ARG, "", NULL, NULL, 0 },
{"ER_X_EXPR_BAD_TYPE_VALUE", ER_X_EXPR_BAD_TYPE_VALUE, "", NULL, NULL, 0 },
{"ER_X_EXPR_BAD_VALUE", ER_X_EXPR_BAD_VALUE, "", NULL, NULL, 0 },
{"ER_X_INVALID_COLLECTION", ER_X_INVALID_COLLECTION, "", NULL, NULL, 0 },
{"ER_X_INVALID_ADMIN_COMMAND", ER_X_INVALID_ADMIN_COMMAND, "", NULL, NULL, 0 },
{"ER_X_EXPECT_NOT_OPEN", ER_X_EXPECT_NOT_OPEN, "", NULL, NULL, 0 },
{"ER_X_EXPECT_NO_ERROR_FAILED", ER_X_EXPECT_NO_ERROR_FAILED, "", NULL, NULL, 0 },
{"ER_X_EXPECT_BAD_CONDITION", ER_X_EXPECT_BAD_CONDITION, "", NULL, NULL, 0 },
{"ER_X_EXPECT_BAD_CONDITION_VALUE", ER_X_EXPECT_BAD_CONDITION_VALUE, "", NULL, NULL, 0 },
{"ER_X_INVALID_NAMESPACE", ER_X_INVALID_NAMESPACE, "", NULL, NULL, 0 },
{"ER_X_BAD_NOTICE", ER_X_BAD_NOTICE, "", NULL, NULL, 0 },
{"ER_X_CANNOT_DISABLE_NOTICE", ER_X_CANNOT_DISABLE_NOTICE, "", NULL, NULL, 0 },
{"ER_X_BAD_CONFIGURATION", ER_X_BAD_CONFIGURATION, "", NULL, NULL, 0 },
{"ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS", ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS, "", NULL, NULL, 0 },
{"ER_X_EXPECT_FIELD_EXISTS_FAILED", ER_X_EXPECT_FIELD_EXISTS_FAILED, "", NULL, NULL, 0 },
{"ER_X_BAD_LOCKING", ER_X_BAD_LOCKING, "", NULL, NULL, 0 },
{"ER_X_FRAME_COMPRESSION_DISABLED", ER_X_FRAME_COMPRESSION_DISABLED, "", NULL, NULL, 0 },
{"ER_X_DECOMPRESSION_FAILED", ER_X_DECOMPRESSION_FAILED, "", NULL, NULL, 0 },
{"ER_X_BAD_COMPRESSED_FRAME", ER_X_BAD_COMPRESSED_FRAME, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_COMPRESSION_INVALID_ALGORITHM", ER_X_CAPABILITY_COMPRESSION_INVALID_ALGORITHM, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_COMPRESSION_INVALID_SERVER_STYLE", ER_X_CAPABILITY_COMPRESSION_INVALID_SERVER_STYLE, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_COMPRESSION_INVALID_CLIENT_STYLE", ER_X_CAPABILITY_COMPRESSION_INVALID_CLIENT_STYLE, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_COMPRESSION_INVALID_OPTION", ER_X_CAPABILITY_COMPRESSION_INVALID_OPTION, "", NULL, NULL, 0 },
{"ER_X_CAPABILITY_COMPRESSION_MISSING_REQUIRED_FIELDS", ER_X_CAPABILITY_COMPRESSION_MISSING_REQUIRED_FIELDS, "", NULL, NULL, 0 },
{"ER_X_DOCUMENT_DOESNT_MATCH_EXPECTED_SCHEMA", ER_X_DOCUMENT_DOESNT_MATCH_EXPECTED_SCHEMA, "", NULL, NULL, 0 },
{"ER_X_COLLECTION_OPTION_DOESNT_EXISTS", ER_X_COLLECTION_OPTION_DOESNT_EXISTS, "", NULL, NULL, 0 },
{"ER_X_INVALID_VALIDATION_SCHEMA", ER_X_INVALID_VALIDATION_SCHEMA, "", NULL, NULL, 0 },
/* Copyright (c) 2017, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef UDF_REGISTRATION_TYPES_H
#define UDF_REGISTRATION_TYPES_H
#ifndef MYSQL_ABI_CHECK
#include <stdbool.h>
#endif
/**
Type of the user defined function return slot and arguments
*/
enum Item_result {
INVALID_RESULT = -1, /** not valid for UDFs */
STRING_RESULT = 0, /** char * */
REAL_RESULT, /** double */
INT_RESULT, /** long long */
ROW_RESULT, /** not valid for UDFs */
DECIMAL_RESULT /** char *, to be converted to/from a decimal */
};
typedef struct UDF_ARGS {
unsigned int arg_count; /**< Number of arguments */
enum Item_result *arg_type; /**< Pointer to item_results */
char **args; /**< Pointer to argument */
unsigned long *lengths; /**< Length of string arguments */
char *maybe_null; /**< Set to 1 for all maybe_null args */
char **attributes; /**< Pointer to attribute name */
unsigned long *attribute_lengths; /**< Length of attribute arguments */
void *extension;
} UDF_ARGS;
/**
Information about the result of a user defined function
@todo add a notion for determinism of the UDF.
@sa Item_udf_func::update_used_tables()
*/
typedef struct UDF_INIT {
bool maybe_null; /** 1 if function can return NULL */
unsigned int decimals; /** for real functions */
unsigned long max_length; /** For string functions */
char *ptr; /** free pointer for function data */
bool const_item; /** 1 if function always returns the same value */
void *extension;
} UDF_INIT;
enum Item_udftype { UDFTYPE_FUNCTION = 1, UDFTYPE_AGGREGATE };
typedef void (*Udf_func_clear)(UDF_INIT *, unsigned char *, unsigned char *);
typedef void (*Udf_func_add)(UDF_INIT *, UDF_ARGS *, unsigned char *,
unsigned char *);
typedef void (*Udf_func_deinit)(UDF_INIT *);
typedef bool (*Udf_func_init)(UDF_INIT *, UDF_ARGS *, char *);
typedef void (*Udf_func_any)(void);
typedef double (*Udf_func_double)(UDF_INIT *, UDF_ARGS *, unsigned char *,
unsigned char *);
typedef long long (*Udf_func_longlong)(UDF_INIT *, UDF_ARGS *, unsigned char *,
unsigned char *);
typedef char *(*Udf_func_string)(UDF_INIT *, UDF_ARGS *, char *,
unsigned long *, unsigned char *,
unsigned char *);
#endif /* UDF_REGISTRATION_TYPES_H */
#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED
/* Copyright (c) 2010, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file include/mysql/client_plugin.h
MySQL Client Plugin API.
This file defines the API for plugins that work on the client side
*/
#define MYSQL_CLIENT_PLUGIN_INCLUDED
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
#endif
/*
On Windows, exports from DLL need to be declared.
Also, plugin needs to be declared as extern "C" because MSVC
unlike other compilers, uses C++ mangling for variables not only
for functions.
*/
#if defined(_MSC_VER)
#if defined(MYSQL_DYNAMIC_CLIENT_PLUGIN)
#ifdef __cplusplus
#define MYSQL_CLIENT_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define MYSQL_CLIENT_PLUGIN_EXPORT __declspec(dllexport)
#endif
#else /* MYSQL_DYNAMIC_CLIENT_PLUGIN */
#ifdef __cplusplus
#define MYSQL_CLIENT_PLUGIN_EXPORT extern "C"
#else
#define MYSQL_CLIENT_PLUGIN_EXPORT
#endif
#endif /*MYSQL_DYNAMIC_CLIENT_PLUGIN */
#else /*_MSC_VER */
#if defined(MYSQL_DYNAMIC_CLIENT_PLUGIN)
#define MYSQL_CLIENT_PLUGIN_EXPORT MY_ATTRIBUTE((visibility("default")))
#else
#define MYSQL_CLIENT_PLUGIN_EXPORT
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* known plugin types */
#define MYSQL_CLIENT_reserved1 0
#define MYSQL_CLIENT_reserved2 1
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2
#define MYSQL_CLIENT_TRACE_PLUGIN 3
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0200
#define MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION 0x0200
#define MYSQL_CLIENT_MAX_PLUGINS 4
#define MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE "Oracle Corporation"
#define mysql_declare_client_plugin(X) \
MYSQL_CLIENT_PLUGIN_EXPORT st_mysql_client_plugin_##X \
_mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_##X##_PLUGIN, \
MYSQL_CLIENT_##X##_PLUGIN_INTERFACE_VERSION,
#define mysql_end_client_plugin }
/* generic plugin header structure */
#define MYSQL_CLIENT_PLUGIN_HEADER \
int type; \
unsigned int interface_version; \
const char *name; \
const char *author; \
const char *desc; \
unsigned int version[3]; \
const char *license; \
void *mysql_api; \
int (*init)(char *, size_t, int, va_list); \
int (*deinit)(void); \
int (*options)(const char *option, const void *); \
int (*get_options)(const char *option, void *);
struct st_mysql_client_plugin {
MYSQL_CLIENT_PLUGIN_HEADER
};
struct MYSQL;
/******** authentication plugin specific declarations *********/
#include "plugin_auth_common.h"
struct auth_plugin_t {
MYSQL_CLIENT_PLUGIN_HEADER
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct MYSQL *mysql);
enum net_async_status (*authenticate_user_nonblocking)(MYSQL_PLUGIN_VIO *vio,
struct MYSQL *mysql,
int *result);
};
// Needed for the mysql_declare_client_plugin() macro. Do not use elsewhere.
typedef struct auth_plugin_t st_mysql_client_plugin_AUTHENTICATION;
/******** using plugins ************/
/**
loads a plugin and initializes it
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
function
@param ... arguments for the plugin initialization function
@retval
a pointer to the loaded plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *mysql_load_plugin(struct MYSQL *mysql,
const char *name, int type,
int argc, ...);
/**
loads a plugin and initializes it, taking va_list as an argument
This is the same as mysql_load_plugin, but take va_list instead of
a list of arguments.
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
function
@param args arguments for the plugin initialization function
@retval
a pointer to the loaded plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *mysql_load_plugin_v(struct MYSQL *mysql,
const char *name, int type,
int argc, va_list args);
/**
finds an already loaded plugin by name, or loads it, if necessary
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded
@retval
a pointer to the plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *mysql_client_find_plugin(struct MYSQL *mysql,
const char *name,
int type);
/**
adds a plugin structure to the list of loaded plugins
This is useful if an application has the necessary functionality
(for example, a special load data handler) statically linked into
the application binary. It can use this function to register the plugin
directly, avoiding the need to factor it out into a shared object.
@param mysql MYSQL structure. It is only used for error reporting
@param plugin an st_mysql_client_plugin structure to register
@retval
a pointer to the plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *mysql_client_register_plugin(
struct MYSQL *mysql, struct st_mysql_client_plugin *plugin);
/**
set plugin options
Can be used to set extra options and affect behavior for a plugin.
This function may be called multiple times to set several options
@param plugin an st_mysql_client_plugin structure
@param option a string which specifies the option to set
@param value value for the option.
@retval 0 on success, 1 in case of failure
**/
int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
const char *option, const void *value);
/**
get plugin options
Can be used to get options from a plugin.
This function may be called multiple times to get several options
@param plugin an st_mysql_client_plugin structure
@param option a string which specifies the option to get
@param[out] value value for the option.
@retval 0 on success, 1 in case of failure
**/
int mysql_plugin_get_option(struct st_mysql_client_plugin *plugin,
const char *option, void *value);
#ifdef __cplusplus
}
#endif
#endif
#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/* Copyright (c) 2010, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file include/mysql/plugin_auth_common.h
This file defines constants and data structures that are the same for
both client- and server-side authentication plugins.
*/
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/** the max allowed length for a user name */
#define MYSQL_USERNAME_LENGTH 96
/**
return values of the plugin authenticate_user() method.
*/
/**
Authentication failed, plugin internal error.
An error occurred in the authentication plugin itself.
These errors are reported in table performance_schema.host_cache,
column COUNT_AUTH_PLUGIN_ERRORS.
*/
#define CR_AUTH_PLUGIN_ERROR 3
/**
Authentication failed, client server handshake.
An error occurred during the client server handshake.
These errors are reported in table performance_schema.host_cache,
column COUNT_HANDSHAKE_ERRORS.
*/
#define CR_AUTH_HANDSHAKE 2
/**
Authentication failed, user credentials.
For example, wrong passwords.
These errors are reported in table performance_schema.host_cache,
column COUNT_AUTHENTICATION_ERRORS.
*/
#define CR_AUTH_USER_CREDENTIALS 1
/**
Authentication failed. Additionally, all other CR_xxx values
(libmysql error code) can be used too.
The client plugin may set the error code and the error message directly
in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error
code was returned, an error message in the MYSQL structure will be
overwritten. If CR_ERROR is returned without setting the error in MYSQL,
CR_UNKNOWN_ERROR will be user.
*/
#define CR_ERROR 0
/**
Authentication (client part) was successful. It does not mean that the
authentication as a whole was successful, usually it only means
that the client was able to send the user name and the password to the
server. If CR_OK is returned, the libmysql reads the next packet expecting
it to be one of OK, ERROR, or CHANGE_PLUGIN packets.
*/
#define CR_OK -1
/**
Authentication was successful.
It means that the client has done its part successfully and also that
a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN).
In this case, libmysql will not read a packet from the server,
but it will use the data at mysql->net.read_pos.
A plugin may return this value if the number of roundtrips in the
authentication protocol is not known in advance, and the client plugin
needs to read one packet more to determine if the authentication is finished
or not.
*/
#define CR_OK_HANDSHAKE_COMPLETE -2
/**
Authentication was successful with limited operations.
It means that the both client and server side plugins decided to allow
authentication with very limited operations ALTER USER to do registration.
*/
#define CR_OK_AUTH_IN_SANDBOX_MODE -3
/**
Flag to be passed back to server from authentication plugins via
authenticated_as when proxy mapping should be done by the server.
*/
#define PROXY_FLAG 0
/*
We need HANDLE definition if on Windows. Define WIN32_LEAN_AND_MEAN (if
not already done) to minimize amount of imported declarations.
*/
#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#endif
struct MYSQL_PLUGIN_VIO_INFO {
enum {
MYSQL_VIO_INVALID,
MYSQL_VIO_TCP,
MYSQL_VIO_SOCKET,
MYSQL_VIO_PIPE,
MYSQL_VIO_MEMORY
} protocol;
int socket; /**< it's set, if the protocol is SOCKET or TCP */
#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */
#endif
};
/* state of an asynchronous operation */
enum net_async_status {
NET_ASYNC_COMPLETE = 0,
NET_ASYNC_NOT_READY,
NET_ASYNC_ERROR,
NET_ASYNC_COMPLETE_NO_MORE_RESULTS
};
/**
Provides plugin access to communication channel
*/
typedef struct MYSQL_PLUGIN_VIO {
/**
Plugin provides a pointer reference and this function sets it to the
contents of any incoming packet. Returns the packet length, or -1 if
the plugin should terminate.
*/
int (*read_packet)(struct MYSQL_PLUGIN_VIO *vio, unsigned char **buf);
/**
Plugin provides a buffer with data and the length and this
function sends it as a packet. Returns 0 on success, 1 on failure.
*/
int (*write_packet)(struct MYSQL_PLUGIN_VIO *vio, const unsigned char *packet,
int packet_len);
/**
Fills in a MYSQL_PLUGIN_VIO_INFO structure, providing the information
about the connection.
*/
void (*info)(struct MYSQL_PLUGIN_VIO *vio,
struct MYSQL_PLUGIN_VIO_INFO *info);
/**
Non blocking version of read_packet. This function points buf to starting
position of incoming packet. When this function returns NET_ASYNC_NOT_READY
plugin should call this function again until all incoming packets are read.
If return code is NET_ASYNC_COMPLETE, plugin can do further processing of
read packets.
*/
enum net_async_status (*read_packet_nonblocking)(struct MYSQL_PLUGIN_VIO *vio,
unsigned char **buf,
int *result);
/**
Non blocking version of write_packet. Sends data available in pkt of length
pkt_len to server in asynchronous way.
*/
enum net_async_status (*write_packet_nonblocking)(
struct MYSQL_PLUGIN_VIO *vio, const unsigned char *pkt, int pkt_len,
int *result);
} MYSQL_PLUGIN_VIO;
#endif
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Version numbers for X Plugin */
#ifndef _MYSQLX_VERSION_H_
#define _MYSQLX_VERSION_H_
#define MYSQLX_PLUGIN_VERSION_MAJOR 1
#define MYSQLX_PLUGIN_VERSION_MINOR 0
#define MYSQLX_PLUGIN_VERSION_PATCH 2
#define MYSQLX_PLUGIN_NAME "mysqlx"
#define MYSQLX_STATUS_VARIABLE_PREFIX(NAME) "Mysqlx_" NAME
#define MYSQLX_SYSTEM_VARIABLE_PREFIX(NAME) "mysqlx_" NAME
#define MYSQLX_TCP_PORT 33060U
#define MYSQLX_UNIX_ADDR "/var/run/mysqld/mysqlx.sock"
#define MYSQLX_PLUGIN_VERSION ( (MYSQLX_PLUGIN_VERSION_MAJOR << 8) | MYSQLX_PLUGIN_VERSION_MINOR )
#define MYSQLX_PLUGIN_VERSION_STRING "1.0.2"
#endif // _MYSQLX_VERSION_H_
/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB
& Detron HB, 1996, 1999-2004, 2007 MySQL AB.
This file is public domain and comes with NO WARRANTY of any kind
*/
/* Version numbers for protocol & mysqld */
#ifndef _mysql_version_h
#define _mysql_version_h
#define PROTOCOL_VERSION 10
#define MYSQL_SERVER_VERSION "8.0.43"
#define MYSQL_BASE_VERSION "mysqld-8.0"
#define MYSQL_SERVER_SUFFIX_DEF ""
#define MYSQL_VERSION_ID 80043
#define MYSQL_VERSION_STABILITY "LTS"
#define MYSQL_PORT 3306
#define MYSQL_ADMIN_PORT 33062
#define MYSQL_PORT_DEFAULT 0
#define MYSQL_UNIX_ADDR "/var/lib/mysql/mysql.sock"
#define MYSQL_CONFIG_NAME "my"
#define MYSQL_PERSIST_CONFIG_NAME "mysqld-auto"
#define MYSQL_COMPILATION_COMMENT "MySQL Community - GPL"
#define MYSQL_COMPILATION_COMMENT_SERVER "MySQL Community Server - GPL"
#define LIBMYSQL_VERSION "8.0.43"
#define LIBMYSQL_VERSION_ID 80043
#ifndef LICENSE
#define LICENSE GPL
#endif /* LICENSE */
#endif /* _mysql_version_h */
/* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file include/mysql_com.h
Common definition between mysql server & client.
*/
#ifndef _mysql_com_h
#define _mysql_com_h
#ifndef MYSQL_ABI_CHECK
#include <stdbool.h>
#include <stdint.h>
#endif
#include "my_command.h"
#include "my_compress.h"
/*
We need a definition for my_socket. On the client, <mysql.h> already provides
it, but on the server side, we need to get it from a header.
*/
#ifndef my_socket_defined
#include "my_io.h"
#include "mysql/components/services/bits/my_io_bits.h"
#endif
#ifndef MYSQL_ABI_CHECK
#include <stdbool.h>
#endif
#define SYSTEM_CHARSET_MBMAXLEN 3
#define FILENAME_CHARSET_MBMAXLEN 5
#define NAME_CHAR_LEN 64 /**< Field/table name length */
#define PARTITION_EXPR_CHAR_LEN \
2048 /**< Maximum expression length in chars \
*/
#define USERNAME_CHAR_LENGTH 32
#define USERNAME_CHAR_LENGTH_STR "32"
#ifndef NAME_LEN
#define NAME_LEN (NAME_CHAR_LEN * SYSTEM_CHARSET_MBMAXLEN)
#endif
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH * SYSTEM_CHARSET_MBMAXLEN)
#define CONNECT_STRING_MAXLEN 1024
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
/*
In FIDO terminology, relying party is the server where required services are
running. Relying party ID is unique name given to server.
*/
#define RELYING_PARTY_ID_LENGTH 255
/* Length of random salt sent during fido registration */
#define CHALLENGE_LENGTH 32
/* Maximum authentication factors server supports */
#define MAX_AUTH_FACTORS 3
/**
Maximum length of comments
pre 5.6: 60 characters
*/
#define TABLE_COMMENT_INLINE_MAXLEN 180
#define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024
#define TABLE_PARTITION_COMMENT_MAXLEN 1024
#define TABLESPACE_COMMENT_MAXLEN 2048
/**
Maximum length of protocol packet.
@ref page_protocol_basic_ok_packet length limit also restricted to this value
as any length greater than this value will have first byte of
@ref page_protocol_basic_ok_packet to be 254 thus does not
provide a means to identify if this is @ref page_protocol_basic_ok_packet or
@ref page_protocol_basic_eof_packet.
*/
#define MAX_PACKET_LENGTH (256L * 256L * 256L - 1)
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
#if defined(_WIN32)
#define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "MySQL"
#endif /* _WIN32 */
/** The length of the header part for each generated column in the .frm file.*/
#define FRM_GCOL_HEADER_SIZE 4
/**
Maximum length of the expression statement defined for generated columns.
*/
#define GENERATED_COLUMN_EXPRESSION_MAXLEN 65535 - FRM_GCOL_HEADER_SIZE
/**
Length of random string sent by server on handshake; this is also length of
obfuscated password, received from client
*/
#define SCRAMBLE_LENGTH 20
#define AUTH_PLUGIN_DATA_PART_1_LENGTH 8
/** length of password stored in the db: new passwords are preceded with '*'*/
#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH * 2 + 1)
/**
@defgroup group_cs_column_definition_flags Column Definition Flags
@ingroup group_cs
@brief Values for the flags bitmask used by ::Send_field:flags
Currently need to fit into 32 bits.
Each bit represents an optional feature of the protocol.
Both the client and the server are sending these.
The intersection of the two determines what optional parts of the
protocol will be used.
*/
/**
@addtogroup group_cs_column_definition_flags
@{
*/
#define NOT_NULL_FLAG 1 /**< Field can't be NULL */
#define PRI_KEY_FLAG 2 /**< Field is part of a primary key */
#define UNIQUE_KEY_FLAG 4 /**< Field is part of a unique key */
#define MULTIPLE_KEY_FLAG 8 /**< Field is part of a key */
#define BLOB_FLAG 16 /**< Field is a blob */
#define UNSIGNED_FLAG 32 /**< Field is unsigned */
#define ZEROFILL_FLAG 64 /**< Field is zerofill */
#define BINARY_FLAG 128 /**< Field is binary */
/* The following are only sent to new clients */
#define ENUM_FLAG 256 /**< field is an enum */
#define AUTO_INCREMENT_FLAG 512 /**< field is a autoincrement field */
#define TIMESTAMP_FLAG 1024 /**< Field is a timestamp */
#define SET_FLAG 2048 /**< field is a set */
#define NO_DEFAULT_VALUE_FLAG 4096 /**< Field doesn't have default value */
#define ON_UPDATE_NOW_FLAG 8192 /**< Field is set to NOW on UPDATE */
#define NUM_FLAG 32768 /**< Field is num (for clients) */
#define PART_KEY_FLAG 16384 /**< Intern; Part of some key */
#define GROUP_FLAG 32768 /**< Intern: Group field */
#define UNIQUE_FLAG 65536 /**< Intern: Used by sql_yacc */
#define BINCMP_FLAG 131072 /**< Intern: Used by sql_yacc */
#define GET_FIXED_FIELDS_FLAG \
(1 << 18) /**< Used to get fields in item tree \
*/
#define FIELD_IN_PART_FUNC_FLAG (1 << 19) /**< Field part of partition func */
/**
Intern: Field in TABLE object for new version of altered table,
which participates in a newly added index.
*/
#define FIELD_IN_ADD_INDEX (1 << 20)
#define FIELD_IS_RENAMED (1 << 21) /**< Intern: Field is being renamed */
#define FIELD_FLAGS_STORAGE_MEDIA 22 /**< Field storage media, bit 22-23 */
#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
#define FIELD_FLAGS_COLUMN_FORMAT 24 /**< Field column format, bit 24-25 */
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
#define FIELD_IS_DROPPED (1 << 26) /**< Intern: Field is being dropped */
#define EXPLICIT_NULL_FLAG \
(1 << 27) /**< Field is explicitly specified as \
NULL by the user */
/* 1 << 28 is unused. */
/** Field will not be loaded in secondary engine. */
#define NOT_SECONDARY_FLAG (1 << 29)
/** Field is explicitly marked as invisible by the user. */
#define FIELD_IS_INVISIBLE (1 << 30)
/** @}*/
/**
@defgroup group_cs_com_refresh_flags COM_REFRESH Flags
@ingroup group_cs
@brief Values for the `sub_command` in ::COM_REFRESH
Currently the protocol carries only 8 bits of these flags.
The rest (8-end) are used only internally in the server.
*/
/**
@addtogroup group_cs_com_refresh_flags
@{
*/
#define REFRESH_GRANT 1 /**< Refresh grant tables, FLUSH PRIVILEGES */
#define REFRESH_LOG 2 /**< Start on new log file, FLUSH LOGS */
#define REFRESH_TABLES 4 /**< close all tables, FLUSH TABLES */
#define REFRESH_HOSTS 8 /**< Flush host cache, FLUSH HOSTS */
#define REFRESH_STATUS 16 /**< Flush status variables, FLUSH STATUS */
#define REFRESH_THREADS 32 /**< Flush thread cache */
#define REFRESH_REPLICA \
64 /**< Reset master info and restart replica \
thread, RESET REPLICA */
#define REFRESH_SLAVE \
REFRESH_REPLICA /**< Reset master info and restart replica \
thread, RESET REPLICA. This is deprecated, \
use REFRESH_REPLICA instead. */
#define REFRESH_MASTER \
128 /**< Remove all bin logs in the index \
and truncate the index, RESET MASTER */
#define REFRESH_ERROR_LOG 256 /**< Rotate only the error log */
#define REFRESH_ENGINE_LOG 512 /**< Flush all storage engine logs */
#define REFRESH_BINARY_LOG 1024 /**< Flush the binary log */
#define REFRESH_RELAY_LOG 2048 /**< Flush the relay log */
#define REFRESH_GENERAL_LOG 4096 /**< Flush the general log */
#define REFRESH_SLOW_LOG 8192 /**< Flush the slow query log */
#define REFRESH_READ_LOCK 16384 /**< Lock tables for read. */
/**
Wait for an impending flush before closing the tables.
@sa REFRESH_READ_LOCK, handle_reload_request, close_cached_tables
*/
#define REFRESH_FAST 32768
#define REFRESH_USER_RESOURCES \
0x80000L /** FLUSH RESOURCES. @sa ::reset_mqh \
*/
#define REFRESH_FOR_EXPORT 0x100000L /** FLUSH TABLES ... FOR EXPORT */
#define REFRESH_OPTIMIZER_COSTS 0x200000L /** FLUSH OPTIMIZER_COSTS */
#define REFRESH_PERSIST 0x400000L /** RESET PERSIST */
/** @}*/
/**
@defgroup group_cs_capabilities_flags Capabilities Flags
@ingroup group_cs
@brief Values for the capabilities flag bitmask used by the MySQL protocol
Currently need to fit into 32 bits.
Each bit represents an optional feature of the protocol.
Both the client and the server are sending these.
The intersection of the two determines whast optional parts of the
protocol will be used.
*/
/**
@addtogroup group_cs_capabilities_flags
@{
*/
/**
Use the improved version of Old Password Authentication.
Not used.
@note Assumed to be set since 4.1.1.
*/
#define CLIENT_LONG_PASSWORD 1
/**
Send found rows instead of affected rows in @ref
page_protocol_basic_eof_packet
*/
#define CLIENT_FOUND_ROWS 2
/**
@brief Get all column flags
Longer flags in Protocol::ColumnDefinition320.
@todo Reference Protocol::ColumnDefinition320
Server
------
Supports longer flags.
Client
------
Expects longer flags.
*/
#define CLIENT_LONG_FLAG 4
/**
Database (schema) name can be specified on connect in Handshake Response
Packet.
@todo Reference Handshake Response Packet.
Server
------
Supports schema-name in Handshake Response Packet.
Client
------
Handshake Response Packet contains a schema-name.
@sa send_client_reply_packet()
*/
#define CLIENT_CONNECT_WITH_DB 8
#define CLIENT_NO_SCHEMA \
16 /**< DEPRECATED: Don't allow database.table.column */
/**
Compression protocol supported.
@todo Reference Compression
Server
------
Supports compression.
Client
------
Switches to Compression compressed protocol after successful authentication.
*/
#define CLIENT_COMPRESS 32
/**
Special handling of ODBC behavior.
@note No special behavior since 3.22.
*/
#define CLIENT_ODBC 64
/**
Can use LOAD DATA LOCAL.
Server
------
Enables the LOCAL INFILE request of LOAD DATA|XML.
Client
------
Will handle LOCAL INFILE request.
*/
#define CLIENT_LOCAL_FILES 128
/**
Ignore spaces before '('
Server
------
Parser can ignore spaces before '('.
Client
------
Let the parser ignore spaces before '('.
*/
#define CLIENT_IGNORE_SPACE 256
/**
New 4.1 protocol
@todo Reference the new 4.1 protocol
Server
------
Supports the 4.1 protocol.
Client
------
Uses the 4.1 protocol.
@note this value was CLIENT_CHANGE_USER in 3.22, unused in 4.0
*/
#define CLIENT_PROTOCOL_41 512
/**
This is an interactive client
Use @ref System_variables::net_wait_timeout
versus @ref System_variables::net_interactive_timeout.
Server
------
Supports interactive and noninteractive clients.
Client
------
Client is interactive.
@sa mysql_real_connect()
*/
#define CLIENT_INTERACTIVE 1024
/**
Use SSL encryption for the session
@todo Reference SSL
Server
------
Supports SSL
Client
------
Switch to SSL after sending the capability-flags.
*/
#define CLIENT_SSL 2048
/**
Client only flag. Not used.
Client
------
Do not issue SIGPIPE if network failures occur (libmysqlclient only).
@sa mysql_real_connect()
*/
#define CLIENT_IGNORE_SIGPIPE 4096
/**
Client knows about transactions
Server
------
Can send status flags in @ref page_protocol_basic_ok_packet /
@ref page_protocol_basic_eof_packet.
Client
------
Expects status flags in @ref page_protocol_basic_ok_packet /
@ref page_protocol_basic_eof_packet.
@note This flag is optional in 3.23, but always set by the server since 4.0.
@sa send_server_handshake_packet(), parse_client_handshake_packet(),
net_send_ok(), net_send_eof()
*/
#define CLIENT_TRANSACTIONS 8192
#define CLIENT_RESERVED 16384 /**< DEPRECATED: Old flag for 4.1 protocol */
#define CLIENT_RESERVED2 \
32768 /**< DEPRECATED: Old flag for 4.1 authentication \
CLIENT_SECURE_CONNECTION */
/**
Enable/disable multi-stmt support
Also sets @ref CLIENT_MULTI_RESULTS. Currently not checked anywhere.
Server
------
Can handle multiple statements per COM_QUERY and COM_STMT_PREPARE.
Client
-------
May send multiple statements per COM_QUERY and COM_STMT_PREPARE.
@note Was named ::CLIENT_MULTI_QUERIES in 4.1.0, renamed later.
Requires
--------
::CLIENT_PROTOCOL_41
@todo Reference COM_QUERY and COM_STMT_PREPARE
*/
#define CLIENT_MULTI_STATEMENTS (1UL << 16)
/**
Enable/disable multi-results
Server
------
Can send multiple resultsets for COM_QUERY.
Error if the server needs to send them and client
does not support them.
Client
-------
Can handle multiple resultsets for COM_QUERY.
Requires
--------
::CLIENT_PROTOCOL_41
@sa mysql_execute_command(), sp_head::MULTI_RESULTS
*/
#define CLIENT_MULTI_RESULTS (1UL << 17)
/**
Multi-results and OUT parameters in PS-protocol.
Server
------
Can send multiple resultsets for COM_STMT_EXECUTE.
Client
------
Can handle multiple resultsets for COM_STMT_EXECUTE.
Requires
--------
::CLIENT_PROTOCOL_41
@todo Reference COM_STMT_EXECUTE and PS-protocol
@sa Protocol_binary::send_out_parameters
*/
#define CLIENT_PS_MULTI_RESULTS (1UL << 18)
/**
Client supports plugin authentication
Server
------
Sends extra data in Initial Handshake Packet and supports the pluggable
authentication protocol.
Client
------
Supports authentication plugins.
Requires
--------
::CLIENT_PROTOCOL_41
@todo Reference plugin authentication, Initial Handshake Packet,
Authentication plugins
@sa send_change_user_packet(), send_client_reply_packet(), run_plugin_auth(),
parse_com_change_user_packet(), parse_client_handshake_packet()
*/
#define CLIENT_PLUGIN_AUTH (1UL << 19)
/**
Client supports connection attributes
Server
------
Permits connection attributes in Protocol::HandshakeResponse41.
Client
------
Sends connection attributes in Protocol::HandshakeResponse41.
@todo Reference Protocol::HandshakeResponse41
@sa send_client_connect_attrs(), read_client_connect_attrs()
*/
#define CLIENT_CONNECT_ATTRS (1UL << 20)
/**
Enable authentication response packet to be larger than 255 bytes.
When the ability to change default plugin require that the initial password
field in the Protocol::HandshakeResponse41 paclet can be of arbitrary size.
However, the 4.1 client-server protocol limits the length of the
auth-data-field sent from client to server to 255 bytes.
The solution is to change the type of the field to a true length encoded
string and indicate the protocol change
with this client capability flag.
Server
------
Understands length-encoded integer for auth response data in
Protocol::HandshakeResponse41.
Client
------
Length of auth response data in Protocol::HandshakeResponse41
is a length-encoded integer.
@todo Reference Protocol::HandshakeResponse41
@note The flag was introduced in 5.6.6, but had the wrong value.
@sa send_client_reply_packet(), parse_client_handshake_packet(),
get_56_lenc_string(), get_41_lenc_string()
*/
#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21)
/**
Don't close the connection for a user account with expired password.
Server
------
Announces support for expired password extension.
Client
------
Can handle expired passwords.
@todo Reference expired password
@sa MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, disconnect_on_expired_password
ACL_USER::password_expired, check_password_lifetime(), acl_authenticate()
*/
#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22)
/**
Capable of handling server state change information. Its a hint to the
server to include the state change information in
@ref page_protocol_basic_ok_packet.
Server
------
Can set ::SERVER_SESSION_STATE_CHANGED in the ::SERVER_STATUS_flags_enum
and send @ref sect_protocol_basic_ok_packet_sessinfo in a
@ref page_protocol_basic_ok_packet.
Client
------
Expects the server to send @ref sect_protocol_basic_ok_packet_sessinfo in
a @ref page_protocol_basic_ok_packet.
@sa enum_session_state_type, read_ok_ex(), net_send_ok(), Session_tracker,
State_tracker
*/
#define CLIENT_SESSION_TRACK (1UL << 23)
/**
Client no longer needs @ref page_protocol_basic_eof_packet and will
use @ref page_protocol_basic_ok_packet instead.
@sa net_send_ok()
Server
------
Can send OK after a Text Resultset.
Client
------
Expects an @ref page_protocol_basic_ok_packet (instead of
@ref page_protocol_basic_eof_packet) after the resultset rows of a
Text Resultset.
Background
----------
To support ::CLIENT_SESSION_TRACK, additional information must be sent after
all successful commands. Although the @ref page_protocol_basic_ok_packet is
extensible, the @ref page_protocol_basic_eof_packet is not due to the overlap
of its bytes with the content of the Text Resultset Row.
Therefore, the @ref page_protocol_basic_eof_packet in the
Text Resultset is replaced with an @ref page_protocol_basic_ok_packet.
@ref page_protocol_basic_eof_packet is deprecated as of MySQL 5.7.5.
@todo Reference Text Resultset
@sa cli_safe_read_with_ok(), read_ok_ex(), net_send_ok(), net_send_eof()
*/
#define CLIENT_DEPRECATE_EOF (1UL << 24)
/**
The client can handle optional metadata information in the resultset.
*/
#define CLIENT_OPTIONAL_RESULTSET_METADATA (1UL << 25)
/**
Compression protocol extended to support zstd compression method
This capability flag is used to send zstd compression level between
client and server provided both client and server are enabled with
this flag.
Server
------
Server sets this flag when global variable protocol-compression-algorithms
has zstd in its list of supported values.
Client
------
Client sets this flag when it is configured to use zstd compression method.
*/
#define CLIENT_ZSTD_COMPRESSION_ALGORITHM (1UL << 26)
/**
Support optional extension for query parameters into the @ref
page_protocol_com_query and @ref page_protocol_com_stmt_execute packets.
Server
------
Expects an optional part containing the query parameter set(s). Executes the
query for each set of parameters or returns an error if more than 1 set of
parameters is sent and the server can't execute it.
Client
------
Can send the optional part containing the query parameter set(s).
*/
#define CLIENT_QUERY_ATTRIBUTES (1UL << 27)
/**
Support Multi factor authentication.
Server
------
Server sends AuthNextFactor packet after every nth factor authentication
method succeeds, except the last factor authentication.
Client
------
Client reads AuthNextFactor packet sent by server and initiates next factor
authentication method.
*/
#define MULTI_FACTOR_AUTHENTICATION (1UL << 28)
/**
This flag will be reserved to extend the 32bit capabilities structure to
64bits.
*/
#define CLIENT_CAPABILITY_EXTENSION (1UL << 29)
/**
Verify server certificate.
Client only flag.
@deprecated in favor of --ssl-mode.
*/
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
/**
Don't reset the options after an unsuccessful connect
Client only flag.
Typically passed via ::mysql_real_connect() 's client_flag parameter.
@sa mysql_real_connect()
*/
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
/** @}*/
/** a compatibility alias for CLIENT_COMPRESS */
#define CAN_CLIENT_COMPRESS CLIENT_COMPRESS
/** Gather all possible capabilities (flags) supported by the server */
#define CLIENT_ALL_FLAGS \
(CLIENT_LONG_PASSWORD | CLIENT_FOUND_ROWS | CLIENT_LONG_FLAG | \
CLIENT_CONNECT_WITH_DB | CLIENT_NO_SCHEMA | CLIENT_COMPRESS | CLIENT_ODBC | \
CLIENT_LOCAL_FILES | CLIENT_IGNORE_SPACE | CLIENT_PROTOCOL_41 | \
CLIENT_INTERACTIVE | CLIENT_SSL | CLIENT_IGNORE_SIGPIPE | \
CLIENT_TRANSACTIONS | CLIENT_RESERVED | CLIENT_RESERVED2 | \
CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS | CLIENT_PS_MULTI_RESULTS | \
CLIENT_SSL_VERIFY_SERVER_CERT | CLIENT_REMEMBER_OPTIONS | \
CLIENT_PLUGIN_AUTH | CLIENT_CONNECT_ATTRS | \
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS | CLIENT_SESSION_TRACK | \
CLIENT_DEPRECATE_EOF | CLIENT_OPTIONAL_RESULTSET_METADATA | \
CLIENT_ZSTD_COMPRESSION_ALGORITHM | CLIENT_QUERY_ATTRIBUTES | \
MULTI_FACTOR_AUTHENTICATION)
/**
Switch off from ::CLIENT_ALL_FLAGS the flags that are optional and
depending on build flags.
If any of the optional flags is supported by the build it will be switched
on before sending to the client during the connection handshake.
*/
#define CLIENT_BASIC_FLAGS \
(CLIENT_ALL_FLAGS & \
~(CLIENT_SSL | CLIENT_COMPRESS | CLIENT_SSL_VERIFY_SERVER_CERT | \
CLIENT_ZSTD_COMPRESSION_ALGORITHM))
/** The status flags are a bit-field */
enum SERVER_STATUS_flags_enum {
/**
Is raised when a multi-statement transaction
has been started, either explicitly, by means
of BEGIN or COMMIT AND CHAIN, or
implicitly, by the first transactional
statement, when autocommit=off.
*/
SERVER_STATUS_IN_TRANS = 1,
SERVER_STATUS_AUTOCOMMIT = 2, /**< Server in auto_commit mode */
SERVER_MORE_RESULTS_EXISTS = 8, /**< Multi query - next query exists */
SERVER_QUERY_NO_GOOD_INDEX_USED = 16,
SERVER_QUERY_NO_INDEX_USED = 32,
/**
The server was able to fulfill the clients request and opened a
read-only non-scrollable cursor for a query. This flag comes
in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
Used by Binary Protocol Resultset to signal that COM_STMT_FETCH
must be used to fetch the row-data.
@todo Refify "Binary Protocol Resultset" and "COM_STMT_FETCH".
*/
SERVER_STATUS_CURSOR_EXISTS = 64,
/**
This flag is sent when a read-only cursor is exhausted, in reply to
COM_STMT_FETCH command.
*/
SERVER_STATUS_LAST_ROW_SENT = 128,
SERVER_STATUS_DB_DROPPED = 256, /**< A database was dropped */
SERVER_STATUS_NO_BACKSLASH_ESCAPES = 512,
/**
Sent to the client if after a prepared statement reprepare
we discovered that the new statement returns a different
number of result set columns.
*/
SERVER_STATUS_METADATA_CHANGED = 1024,
SERVER_QUERY_WAS_SLOW = 2048,
/**
To mark ResultSet containing output parameter values.
*/
SERVER_PS_OUT_PARAMS = 4096,
/**
Set at the same time as SERVER_STATUS_IN_TRANS if the started
multi-statement transaction is a read-only transaction. Cleared
when the transaction commits or aborts. Since this flag is sent
to clients in OK and EOF packets, the flag indicates the
transaction status at the end of command execution.
*/
SERVER_STATUS_IN_TRANS_READONLY = 8192,
/**
This status flag, when on, implies that one of the state information has
changed on the server because of the execution of the last statement.
*/
SERVER_SESSION_STATE_CHANGED = (1UL << 14)
};
/**
Server status flags that must be cleared when starting
execution of a new SQL statement.
Flags from this set are only added to the
current server status by the execution engine, but
never removed -- the execution engine expects them
to disappear automagically by the next command.
*/
#define SERVER_STATUS_CLEAR_SET \
(SERVER_QUERY_NO_GOOD_INDEX_USED | SERVER_QUERY_NO_INDEX_USED | \
SERVER_MORE_RESULTS_EXISTS | SERVER_STATUS_METADATA_CHANGED | \
SERVER_QUERY_WAS_SLOW | SERVER_STATUS_DB_DROPPED | \
SERVER_STATUS_CURSOR_EXISTS | SERVER_STATUS_LAST_ROW_SENT | \
SERVER_SESSION_STATE_CHANGED)
/** Max length of a error message. Should be kept in sync with ::ERRMSGSIZE. */
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /**< Timeout on read */
#define NET_WRITE_TIMEOUT 60 /**< Timeout on write */
#define NET_WAIT_TIMEOUT 8 * 60 * 60 /**< Wait for new query */
/**
Flag used by the parser. Kill only the query and not the connection.
@sa SQLCOM_KILL, sql_kill(), LEX::type
*/
#define ONLY_KILL_QUERY 1
#ifndef MYSQL_VIO
struct Vio;
#define MYSQL_VIO struct Vio *
#endif
#define MAX_TINYINT_WIDTH 3 /**< Max width for a TINY w.o. sign */
#define MAX_SMALLINT_WIDTH 5 /**< Max width for a SHORT w.o. sign */
#define MAX_MEDIUMINT_WIDTH 8 /**< Max width for a INT24 w.o. sign */
#define MAX_INT_WIDTH 10 /**< Max width for a LONG w.o. sign */
#define MAX_BIGINT_WIDTH 20 /**< Max width for a LONGLONG */
/// Max width for a CHAR column, in number of characters
#define MAX_CHAR_WIDTH 255
/// Default width for blob in bytes @todo - align this with sizes from field.h
#define MAX_BLOB_WIDTH 16777216
#define NET_ERROR_UNSET 0 /**< No error has occurred yet */
#define NET_ERROR_SOCKET_RECOVERABLE 1 /**< Socket still usable */
#define NET_ERROR_SOCKET_UNUSABLE 2 /**< Do not use the socket */
#define NET_ERROR_SOCKET_NOT_READABLE 3 /**< Try write and close socket */
#define NET_ERROR_SOCKET_NOT_WRITABLE 4 /**< Try read and close socket */
typedef struct NET {
MYSQL_VIO vio;
unsigned char *buff, *buff_end, *write_pos, *read_pos;
my_socket fd; /* For Perl DBI/dbd */
/**
Set if we are doing several queries in one
command ( as in LOAD TABLE ... FROM MASTER ),
and do not want to confuse the client with OK at the wrong time
*/
unsigned long remain_in_buf, length, buf_length, where_b;
unsigned long max_packet, max_packet_size;
unsigned int pkt_nr, compress_pkt_nr;
unsigned int write_timeout, read_timeout, retry_count;
int fcntl;
unsigned int *return_status;
unsigned char reading_or_writing;
unsigned char save_char;
bool compress;
unsigned int last_errno;
unsigned char error;
/** Client library error message buffer. Actually belongs to struct MYSQL. */
char last_error[MYSQL_ERRMSG_SIZE];
/** Client library sqlstate buffer. Set along with the error message. */
char sqlstate[SQLSTATE_LENGTH + 1];
/**
Extension pointer, for the caller private use.
Any program linking with the networking library can use this pointer,
which is handy when private connection specific data needs to be
maintained.
The mysqld server process uses this pointer internally,
to maintain the server internal instrumentation for the connection.
*/
void *extension;
} NET;
#define packet_error (~(unsigned long)0)
/**
@addtogroup group_cs_backward_compatibility Backward compatibility
@ingroup group_cs
@{
*/
#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS
#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL
#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL
#define FIELD_TYPE_TINY MYSQL_TYPE_TINY
#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT
#define FIELD_TYPE_LONG MYSQL_TYPE_LONG
#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT
#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE
#define FIELD_TYPE_NULL MYSQL_TYPE_NULL
#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP
#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG
#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24
#define FIELD_TYPE_DATE MYSQL_TYPE_DATE
#define FIELD_TYPE_TIME MYSQL_TYPE_TIME
#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME
#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR
#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE
#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM
#define FIELD_TYPE_SET MYSQL_TYPE_SET
#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB
#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB
#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB
#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB
#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING
#define FIELD_TYPE_STRING MYSQL_TYPE_STRING
#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY
#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM
#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY
#define FIELD_TYPE_BIT MYSQL_TYPE_BIT
/** @}*/
/**
@addtogroup group_cs_shutdown_kill_constants Shutdown/kill enums and constants
@ingroup group_cs
@sa THD::is_killable
@{
*/
#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0)
#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1)
#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3)
/**
We want levels to be in growing order of hardness (because we use number
comparisons).
@note ::SHUTDOWN_DEFAULT does not respect the growing property, but it's ok.
*/
enum mysql_enum_shutdown_level {
SHUTDOWN_DEFAULT = 0,
/** Wait for existing connections to finish */
SHUTDOWN_WAIT_CONNECTIONS = MYSQL_SHUTDOWN_KILLABLE_CONNECT,
/** Wait for existing transactons to finish */
SHUTDOWN_WAIT_TRANSACTIONS = MYSQL_SHUTDOWN_KILLABLE_TRANS,
/** Wait for existing updates to finish (=> no partial MyISAM update) */
SHUTDOWN_WAIT_UPDATES = MYSQL_SHUTDOWN_KILLABLE_UPDATE,
/** Flush InnoDB buffers and other storage engines' buffers*/
SHUTDOWN_WAIT_ALL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
/** Don't flush InnoDB buffers, flush other storage engines' buffers*/
SHUTDOWN_WAIT_CRITICAL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
/** Query level of the KILL command */
KILL_QUERY = 254,
/** Connection level of the KILL command */
KILL_CONNECTION = 255
};
/** @}*/
enum enum_resultset_metadata {
/** No metadata will be sent. */
RESULTSET_METADATA_NONE = 0,
/** The server will send all metadata. */
RESULTSET_METADATA_FULL = 1
};
#if defined(__clang__)
// disable -Wdocumentation to workaround
// https://bugs.llvm.org/show_bug.cgi?id=38905
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#endif
/**
The flags used in COM_STMT_EXECUTE.
@sa @ref Protocol_classic::parse_packet, @ref mysql_int_serialize_param_data
*/
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
enum enum_cursor_type {
CURSOR_TYPE_NO_CURSOR = 0,
CURSOR_TYPE_READ_ONLY = 1,
CURSOR_TYPE_FOR_UPDATE = 2,
CURSOR_TYPE_SCROLLABLE = 4,
/**
On when the client will send the parameter count
even for 0 parameters.
*/
PARAMETER_COUNT_AVAILABLE = 8
};
/** options for ::mysql_options() */
enum enum_mysql_set_option {
MYSQL_OPTION_MULTI_STATEMENTS_ON,
MYSQL_OPTION_MULTI_STATEMENTS_OFF
};
/**
Type of state change information that the server can include in the Ok
packet.
@note
- session_state_type shouldn't go past 255 (i.e. 1-byte boundary).
- Modify the definition of ::SESSION_TRACK_END when a new member is added.
*/
enum enum_session_state_type {
SESSION_TRACK_SYSTEM_VARIABLES, /**< Session system variables */
SESSION_TRACK_SCHEMA, /**< Current schema */
SESSION_TRACK_STATE_CHANGE, /**< track session state changes */
SESSION_TRACK_GTIDS, /**< See also: session_track_gtids */
SESSION_TRACK_TRANSACTION_CHARACTERISTICS, /**< Transaction chistics */
SESSION_TRACK_TRANSACTION_STATE /**< Transaction state */
};
/** start of ::enum_session_state_type */
#define SESSION_TRACK_BEGIN SESSION_TRACK_SYSTEM_VARIABLES
/** End of ::enum_session_state_type */
#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_STATE
/** is T a valid session state type */
#define IS_SESSION_STATE_TYPE(T) \
(((int)(T) >= SESSION_TRACK_BEGIN) && ((T) <= SESSION_TRACK_END))
#define net_new_transaction(net) ((net)->pkt_nr = 0)
bool my_net_init(struct NET *net, MYSQL_VIO vio);
void my_net_local_init(struct NET *net);
void net_end(struct NET *net);
void net_clear(struct NET *net, bool check_buffer);
void net_claim_memory_ownership(struct NET *net, bool claim);
bool net_realloc(struct NET *net, size_t length);
bool net_flush(struct NET *net);
bool my_net_write(struct NET *net, const unsigned char *packet, size_t len);
bool net_write_command(struct NET *net, unsigned char command,
const unsigned char *header, size_t head_len,
const unsigned char *packet, size_t len);
bool net_write_packet(struct NET *net, const unsigned char *packet,
size_t length);
unsigned long my_net_read(struct NET *net);
void my_net_set_write_timeout(struct NET *net, unsigned int timeout);
void my_net_set_read_timeout(struct NET *net, unsigned int timeout);
void my_net_set_retry_count(struct NET *net, unsigned int retry_count);
struct rand_struct {
unsigned long seed1, seed2, max_value;
double max_value_dbl;
};
/* Include the types here so existing UDFs can keep compiling */
#include "mysql/udf_registration_types.h"
/**
@addtogroup group_cs_compresson_constants Constants when using compression
@ingroup group_cs
@{
*/
#define NET_HEADER_SIZE 4 /**< standard header size */
#define COMP_HEADER_SIZE 3 /**< compression header extra size */
/** @}*/
/* Prototypes to password functions */
/*
These functions are used for authentication by client and server and
implemented in sql/password.c
*/
void randominit(struct rand_struct *, unsigned long seed1, unsigned long seed2);
double my_rnd(struct rand_struct *);
void create_random_string(char *to, unsigned int length,
struct rand_struct *rand_st);
void hash_password(unsigned long *to, const char *password,
unsigned int password_len);
void make_scrambled_password_323(char *to, const char *password);
void scramble_323(char *to, const char *message, const char *password);
bool check_scramble_323(const unsigned char *reply, const char *message,
unsigned long *salt);
void get_salt_from_password_323(unsigned long *res, const char *password);
void make_password_from_salt_323(char *to, const unsigned long *salt);
void make_scrambled_password(char *to, const char *password);
void scramble(char *to, const char *message, const char *password);
bool check_scramble(const unsigned char *reply, const char *message,
const unsigned char *hash_stage2);
void get_salt_from_password(unsigned char *res, const char *password);
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
char *octet2hex(char *to, const char *str, unsigned int len);
/* end of password.c */
bool generate_sha256_scramble(unsigned char *dst, size_t dst_size,
const char *src, size_t src_size, const char *rnd,
size_t rnd_size);
// extern "C" since it is an (undocumented) part of the libmysql ABI.
#ifdef __cplusplus
extern "C" {
#endif
char *get_tty_password(const char *opt_message);
#ifdef __cplusplus
}
#endif
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */
// Need to be extern "C" for the time being, due to memcached.
#ifdef __cplusplus
extern "C" {
#endif
bool my_thread_init(void);
void my_thread_end(void);
#ifdef __cplusplus
}
#endif
#ifdef STDCALL
unsigned long STDCALL net_field_length(unsigned char **packet);
unsigned long STDCALL net_field_length_checked(unsigned char **packet,
unsigned long max_length);
#endif
uint64_t net_field_length_ll(unsigned char **packet);
unsigned char *net_store_length(unsigned char *pkg, unsigned long long length);
unsigned int net_length_size(unsigned long long num);
unsigned int net_field_length_size(const unsigned char *pos);
#define NULL_LENGTH ((unsigned long)~0) /**< For ::net_store_length() */
#define MYSQL_STMT_HEADER 4
#define MYSQL_LONG_DATA_HEADER 6
#endif
#ifndef ERRMSG_INCLUDED
#define ERRMSG_INCLUDED
/* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file include/errmsg.h
Error messages for MySQL clients.
These are constant and use the CR_ prefix.
<mysqlclient_ername.h> will contain auto-generated mappings
containing the symbolic name and the number from this file,
and the english error messages in libmysql/errmsg.c.
Dynamic error messages for the daemon are in share/language/errmsg.sys.
The server equivalent to <errmsg.h> is <mysqld_error.h>.
The server equivalent to <mysqlclient_ername.h> is <mysqld_ername.h>.
Note that the auth subsystem also uses codes with a CR_ prefix.
*/
void init_client_errs(void);
void finish_client_errs(void);
extern const char *client_errors[]; /* Error messages */
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
/* Do not add error numbers before CR_ERROR_FIRST. */
/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */
#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/
#define CR_UNKNOWN_ERROR 2000
#define CR_SOCKET_CREATE_ERROR 2001
#define CR_CONNECTION_ERROR 2002
#define CR_CONN_HOST_ERROR 2003
#define CR_IPSOCK_ERROR 2004
#define CR_UNKNOWN_HOST 2005
#define CR_SERVER_GONE_ERROR 2006
#define CR_VERSION_ERROR 2007
#define CR_OUT_OF_MEMORY 2008
#define CR_WRONG_HOST_INFO 2009
#define CR_LOCALHOST_CONNECTION 2010
#define CR_TCP_CONNECTION 2011
#define CR_SERVER_HANDSHAKE_ERR 2012
#define CR_SERVER_LOST 2013
#define CR_COMMANDS_OUT_OF_SYNC 2014
#define CR_NAMEDPIPE_CONNECTION 2015
#define CR_NAMEDPIPEWAIT_ERROR 2016
#define CR_NAMEDPIPEOPEN_ERROR 2017
#define CR_NAMEDPIPESETSTATE_ERROR 2018
#define CR_CANT_READ_CHARSET 2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_EMBEDDED_CONNECTION 2021
#define CR_PROBE_REPLICA_STATUS 2022
#define CR_PROBE_REPLICA_HOSTS 2023
#define CR_PROBE_REPLICA_CONNECT 2024
#define CR_PROBE_SOURCE_CONNECT 2025
#define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027
#define CR_WRONG_LICENSE 2028
/* new 4.1 error codes */
#define CR_NULL_POINTER 2029
#define CR_NO_PREPARE_STMT 2030
#define CR_PARAMS_NOT_BOUND 2031
#define CR_DATA_TRUNCATED 2032
#define CR_NO_PARAMETERS_EXISTS 2033
#define CR_INVALID_PARAMETER_NO 2034
#define CR_INVALID_BUFFER_USE 2035
#define CR_UNSUPPORTED_PARAM_TYPE 2036
#define CR_SHARED_MEMORY_CONNECTION 2037
#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038
#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039
#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040
#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041
#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042
#define CR_SHARED_MEMORY_MAP_ERROR 2043
#define CR_SHARED_MEMORY_EVENT_ERROR 2044
#define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046
#define CR_CONN_UNKNOW_PROTOCOL 2047
#define CR_INVALID_CONN_HANDLE 2048
#define CR_UNUSED_1 2049
#define CR_FETCH_CANCELED 2050
#define CR_NO_DATA 2051
#define CR_NO_STMT_METADATA 2052
#define CR_NO_RESULT_SET 2053
#define CR_NOT_IMPLEMENTED 2054
#define CR_SERVER_LOST_EXTENDED 2055
#define CR_STMT_CLOSED 2056
#define CR_NEW_STMT_METADATA 2057
#define CR_ALREADY_CONNECTED 2058
#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059
#define CR_DUPLICATE_CONNECTION_ATTR 2060
#define CR_AUTH_PLUGIN_ERR 2061
#define CR_INSECURE_API_ERR 2062
#define CR_FILE_NAME_TOO_LONG 2063
#define CR_SSL_FIPS_MODE_ERR 2064
#define CR_DEPRECATED_COMPRESSION_NOT_SUPPORTED 2065
#define CR_COMPRESSION_WRONGLY_CONFIGURED 2066
#define CR_KERBEROS_USER_NOT_FOUND 2067
#define CR_LOAD_DATA_LOCAL_INFILE_REJECTED 2068
#define CR_LOAD_DATA_LOCAL_INFILE_REALPATH_FAIL 2069
#define CR_DNS_SRV_LOOKUP_FAILED 2070
#define CR_MANDATORY_TRACKER_NOT_FOUND 2071
#define CR_INVALID_FACTOR_NO 2072
#define CR_CANT_GET_SESSION_DATA 2073
#define CR_INVALID_CLIENT_CHARSET 2074
#define CR_ERROR_LAST /*Copy last error nr:*/ 2074
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
/* Visual Studio requires '__inline' for C code */
static inline const char *ER_CLIENT(int client_errno) {
if (client_errno >= CR_ERROR_FIRST && client_errno <= CR_ERROR_LAST)
return client_errors[client_errno - CR_ERROR_FIRST];
return client_errors[CR_UNKNOWN_ERROR - CR_ERROR_FIRST];
}
#endif /* ERRMSG_INCLUDED */
/* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MY_LIST_INCLUDED
#define MY_LIST_INCLUDED
/**
@file include/my_list.h
*/
typedef struct LIST {
struct LIST *prev, *next;
void *data;
} LIST;
typedef int (*list_walk_action)(void *, void *);
extern LIST *list_add(LIST *root, LIST *element);
extern LIST *list_delete(LIST *root, LIST *element);
extern LIST *list_cons(void *data, LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root, unsigned int free_data);
extern unsigned int list_length(LIST *);
extern int list_walk(LIST *, list_walk_action action, unsigned char *argument);
#define list_rest(a) ((a)->next)
#endif // MY_LIST_INCLUDED
/* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file include/mysql.h
This file defines the client API to MySQL and also the ABI of the
dynamically linked libmysqlclient.
The ABI should never be changed in a released product of MySQL,
thus you need to take great care when changing the file. In case
the file is changed so the ABI is broken, you must also update
the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake
*/
#ifndef _mysql_h
#define _mysql_h
#ifndef MYSQL_ABI_CHECK
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#endif
// Legacy definition for the benefit of old code. Use uint64_t in new code.
// If you get warnings from printf, use the PRIu64 macro, or, if you need
// compatibility with older versions of the client library, cast
// before printing.
typedef uint64_t my_ulonglong;
#ifndef my_socket_defined
#define my_socket_defined
#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
#include <windows.h>
#ifdef WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#endif
#define my_socket SOCKET
#else
typedef int my_socket;
#endif /* _WIN32 && ! MYSQL_ABI_CHECK */
#endif /* my_socket_defined */
// Small extra definition to avoid pulling in my_compiler.h in client code.
// IWYU pragma: no_include "my_compiler.h"
#ifndef MY_COMPILER_INCLUDED
#if !defined(_WIN32) || defined(MYSQL_ABI_CHECK)
#define STDCALL
#else
#define STDCALL __stdcall
#endif
#endif /* MY_COMPILER_INCLUDED */
#include "field_types.h"
#include "my_list.h"
#include "mysql_com.h"
/* Include declarations of plug-in API */
#include "mysql/client_plugin.h" // IWYU pragma: keep
/*
The client should be able to know which version it is compiled against,
even if mysql.h doesn't use this information directly.
*/
#include "mysql_version.h" // IWYU pragma: keep
// MYSQL_TIME is part of our public API.
#include "mysql_time.h" // IWYU pragma: keep
// The error messages are part of our public API.
#include "errmsg.h" // IWYU pragma: keep
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int mysql_port;
extern char *mysql_unix_port;
#define CLIENT_NET_RETRY_COUNT 1 /* Retry count */
#define CLIENT_NET_READ_TIMEOUT 365 * 24 * 3600 /* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365 * 24 * 3600 /* Timeout on write */
#define IS_PRI_KEY(n) ((n)&PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n)&NOT_NULL_FLAG)
#define IS_BLOB(n) ((n)&BLOB_FLAG)
/**
Returns true if the value is a number which does not need quotes for
the sql_lex.cc parser to parse correctly.
*/
#define IS_NUM(t) \
(((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || \
(t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
typedef struct MYSQL_FIELD {
char *name; /* Name of column */
char *org_name; /* Original column name, if an alias */
char *table; /* Table of column if column was a field */
char *org_table; /* Org table name, if table was an alias */
char *db; /* Database for table */
char *catalog; /* Catalog for table */
char *def; /* Default value (set by mysql_list_fields) */
unsigned long length; /* Width of column (create length) */
unsigned long max_length; /* Max width for selected set */
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
unsigned int catalog_length;
unsigned int def_length;
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
unsigned int charsetnr; /* Character set */
enum enum_field_types type; /* Type of field. See mysql_com.h for types */
void *extension;
} MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#define MYSQL_COUNT_ERROR (~(uint64_t)0)
/* backward compatibility define - to be removed eventually */
#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED
typedef struct MYSQL_ROWS {
struct MYSQL_ROWS *next; /* list of rows */
MYSQL_ROW data;
unsigned long length;
} MYSQL_ROWS;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
struct MEM_ROOT;
typedef struct MYSQL_DATA {
MYSQL_ROWS *data;
struct MEM_ROOT *alloc;
uint64_t rows;
unsigned int fields;
} MYSQL_DATA;
enum mysql_option {
MYSQL_OPT_CONNECT_TIMEOUT,
MYSQL_OPT_COMPRESS,
MYSQL_OPT_NAMED_PIPE,
MYSQL_INIT_COMMAND,
MYSQL_READ_DEFAULT_FILE,
MYSQL_READ_DEFAULT_GROUP,
MYSQL_SET_CHARSET_DIR,
MYSQL_SET_CHARSET_NAME,
MYSQL_OPT_LOCAL_INFILE,
MYSQL_OPT_PROTOCOL,
MYSQL_SHARED_MEMORY_BASE_NAME,
MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT,
MYSQL_OPT_USE_RESULT,
MYSQL_REPORT_DATA_TRUNCATION,
MYSQL_OPT_RECONNECT,
MYSQL_PLUGIN_DIR,
MYSQL_DEFAULT_AUTH,
MYSQL_OPT_BIND,
MYSQL_OPT_SSL_KEY,
MYSQL_OPT_SSL_CERT,
MYSQL_OPT_SSL_CA,
MYSQL_OPT_SSL_CAPATH,
MYSQL_OPT_SSL_CIPHER,
MYSQL_OPT_SSL_CRL,
MYSQL_OPT_SSL_CRLPATH,
MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_CONNECT_ATTR_ADD,
MYSQL_OPT_CONNECT_ATTR_DELETE,
MYSQL_SERVER_PUBLIC_KEY,
MYSQL_ENABLE_CLEARTEXT_PLUGIN,
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
MYSQL_OPT_MAX_ALLOWED_PACKET,
MYSQL_OPT_NET_BUFFER_LENGTH,
MYSQL_OPT_TLS_VERSION,
MYSQL_OPT_SSL_MODE,
MYSQL_OPT_GET_SERVER_PUBLIC_KEY,
MYSQL_OPT_RETRY_COUNT,
MYSQL_OPT_OPTIONAL_RESULTSET_METADATA,
MYSQL_OPT_SSL_FIPS_MODE,
MYSQL_OPT_TLS_CIPHERSUITES,
MYSQL_OPT_COMPRESSION_ALGORITHMS,
MYSQL_OPT_ZSTD_COMPRESSION_LEVEL,
MYSQL_OPT_LOAD_DATA_LOCAL_DIR,
MYSQL_OPT_USER_PASSWORD,
MYSQL_OPT_SSL_SESSION_DATA
};
/**
@todo remove the "extension", move st_mysql_options completely
out of mysql.h
*/
struct st_mysql_options_extention;
struct st_mysql_options {
unsigned int connect_timeout, read_timeout, write_timeout;
unsigned int port, protocol;
unsigned long client_flag;
char *host, *user, *password, *unix_socket, *db;
struct Init_commands_array *init_commands;
char *my_cnf_file, *my_cnf_group, *charset_dir, *charset_name;
char *ssl_key; /* PEM key file */
char *ssl_cert; /* PEM cert file */
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
char *shared_memory_base_name;
unsigned long max_allowed_packet;
bool compress, named_pipe;
/**
The local address to bind when connecting to remote server.
*/
char *bind_address;
/* 0 - never report, 1 - always report (default) */
bool report_data_truncation;
/* function pointers for local infile support */
int (*local_infile_init)(void **, const char *, void *);
int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *local_infile_userdata;
struct st_mysql_options_extention *extension;
};
enum mysql_status {
MYSQL_STATUS_READY,
MYSQL_STATUS_GET_RESULT,
MYSQL_STATUS_USE_RESULT,
MYSQL_STATUS_STATEMENT_GET_RESULT
};
enum mysql_protocol_type {
MYSQL_PROTOCOL_DEFAULT,
MYSQL_PROTOCOL_TCP,
MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE,
MYSQL_PROTOCOL_MEMORY
};
enum mysql_ssl_mode {
SSL_MODE_DISABLED = 1,
SSL_MODE_PREFERRED,
SSL_MODE_REQUIRED,
SSL_MODE_VERIFY_CA,
SSL_MODE_VERIFY_IDENTITY
};
enum mysql_ssl_fips_mode {
SSL_FIPS_MODE_OFF = 0,
SSL_FIPS_MODE_ON = 1,
SSL_FIPS_MODE_STRICT
};
typedef struct character_set {
unsigned int number; /* character set number */
unsigned int state; /* character set state */
const char *csname; /* character set name */
const char *name; /* collation name */
const char *comment; /* comment */
const char *dir; /* character set directory */
unsigned int mbminlen; /* min. length for multibyte strings */
unsigned int mbmaxlen; /* max. length for multibyte strings */
} MY_CHARSET_INFO;
struct MYSQL_METHODS;
struct MYSQL_STMT;
typedef struct MYSQL {
NET net; /* Communication parameters */
unsigned char *connector_fd; /* ConnectorFd for SSL */
char *host, *user, *passwd, *unix_socket, *server_version, *host_info;
char *info, *db;
struct CHARSET_INFO *charset;
MYSQL_FIELD *fields;
struct MEM_ROOT *field_alloc;
uint64_t affected_rows;
uint64_t insert_id; /* id if insert on table with NEXTNR */
uint64_t extra_info; /* Not used */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
unsigned long client_flag, server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count;
struct st_mysql_options options;
enum mysql_status status;
enum enum_resultset_metadata resultset_metadata;
bool free_me; /* If free in mysql_close */
bool reconnect; /* set to 1 if automatic reconnect */
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH + 1];
LIST *stmts; /* list of all statements */
const struct MYSQL_METHODS *methods;
void *thd;
/*
Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag
from mysql_stmt_close if close had to cancel result set of this object.
*/
bool *unbuffered_fetch_owner;
void *extension;
} MYSQL;
typedef struct MYSQL_RES {
uint64_t row_count;
MYSQL_FIELD *fields;
struct MYSQL_DATA *data;
MYSQL_ROWS *data_cursor;
unsigned long *lengths; /* column lengths of current row */
MYSQL *handle; /* for unbuffered reads */
const struct MYSQL_METHODS *methods;
MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */
struct MEM_ROOT *field_alloc;
unsigned int field_count, current_field;
bool eof; /* Used by mysql_fetch_row */
/* mysql_stmt_close() had to cancel this result */
bool unbuffered_fetch_cancelled;
enum enum_resultset_metadata metadata;
void *extension;
} MYSQL_RES;
/**
Flag to indicate that COM_BINLOG_DUMP_GTID should
be used rather than COM_BINLOG_DUMP in the @sa mysql_binlog_open().
*/
#define MYSQL_RPL_GTID (1 << 16)
/**
Skip HEARBEAT events in the @sa mysql_binlog_fetch().
*/
#define MYSQL_RPL_SKIP_HEARTBEAT (1 << 17)
/**
Flag to indicate that the heartbeat_event being generated
is using the class Heartbeat_event_v2
*/
#define USE_HEARTBEAT_EVENT_V2 (1 << 1)
/**
Struct for information about a replication stream.
@sa mysql_binlog_open()
@sa mysql_binlog_fetch()
@sa mysql_binlog_close()
*/
typedef struct MYSQL_RPL {
size_t file_name_length; /** Length of the 'file_name' or 0 */
const char *file_name; /** Filename of the binary log to read */
uint64_t start_position; /** Position in the binary log to */
/* start reading from */
unsigned int server_id; /** Server ID to use when identifying */
/* with the master */
unsigned int flags; /** Flags, e.g. MYSQL_RPL_GTID */
/** Size of gtid set data */
size_t gtid_set_encoded_size;
/** Callback function which is called */
/* from @sa mysql_binlog_open() to */
/* fill command packet gtid set */
void (*fix_gtid_set)(struct MYSQL_RPL *rpl, unsigned char *packet_gtid_set);
void *gtid_set_arg; /** GTID set data or an argument for */
/* fix_gtid_set() callback function */
unsigned long size; /** Size of the packet returned by */
/* mysql_binlog_fetch() */
const unsigned char *buffer; /** Pointer to returned data */
} MYSQL_RPL;
/*
Set up and bring down the server; to ensure that applications will
work when linked against either the standard client library or the
embedded server library, these functions should be called.
*/
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
/*
mysql_server_init/end need to be called when using libmysqld or
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
you don't need to call it explicitly; but you need to call
mysql_server_end() to free memory). The names are a bit misleading
(mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
names which suit well whether you're using libmysqld or libmysqlclient. We
intend to promote these aliases over the mysql_server* ones.
*/
#define mysql_library_init mysql_server_init
#define mysql_library_end mysql_server_end
/*
Set up and bring down a thread; these function should be called
for each thread in an application which opens at least one MySQL
connection. All uses of the connection(s) should be between these
function calls.
*/
bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void);
/*
Functions to get information from the MYSQL and MYSQL_RES structures
Should definitely be used if one uses shared libraries.
*/
uint64_t STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
bool STDCALL mysql_eof(MYSQL_RES *res);
MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
unsigned int fieldnr);
MYSQL_FIELD *STDCALL mysql_fetch_fields(MYSQL_RES *res);
MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
enum enum_resultset_metadata STDCALL mysql_result_metadata(MYSQL_RES *result);
unsigned int STDCALL mysql_field_count(MYSQL *mysql);
uint64_t STDCALL mysql_affected_rows(MYSQL *mysql);
uint64_t STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
const char *STDCALL mysql_error(MYSQL *mysql);
const char *STDCALL mysql_sqlstate(MYSQL *mysql);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char *STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char *STDCALL mysql_character_set_name(MYSQL *mysql);
int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
MYSQL *STDCALL mysql_init(MYSQL *mysql);
#if defined(__cplusplus) && (__cplusplus >= 201402L)
[[deprecated("Use mysql_options() instead.")]]
#endif
bool STDCALL
mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca,
const char *capath, const char *cipher);
const char *STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
bool STDCALL mysql_get_ssl_session_reused(MYSQL *mysql);
void *STDCALL mysql_get_ssl_session_data(MYSQL *mysql, unsigned int n_ticket,
unsigned int *out_len);
bool STDCALL mysql_free_ssl_session_data(MYSQL *mysql, void *data);
bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db);
MYSQL *STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd,
const char *db, unsigned int port,
const char *unix_socket,
unsigned long clientflag);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q);
int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length);
MYSQL_RES *STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES *STDCALL mysql_use_result(MYSQL *mysql);
enum net_async_status STDCALL mysql_real_connect_nonblocking(
MYSQL *mysql, const char *host, const char *user, const char *passwd,
const char *db, unsigned int port, const char *unix_socket,
unsigned long clientflag);
enum net_async_status STDCALL mysql_send_query_nonblocking(
MYSQL *mysql, const char *query, unsigned long length);
enum net_async_status STDCALL mysql_real_query_nonblocking(
MYSQL *mysql, const char *query, unsigned long length);
enum net_async_status STDCALL
mysql_store_result_nonblocking(MYSQL *mysql, MYSQL_RES **result);
enum net_async_status STDCALL mysql_next_result_nonblocking(MYSQL *mysql);
enum net_async_status STDCALL mysql_select_db_nonblocking(MYSQL *mysql,
const char *db,
bool *error);
void STDCALL mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset);
int STDCALL mysql_session_track_get_first(MYSQL *mysql,
enum enum_session_state_type type,
const char **data, size_t *length);
int STDCALL mysql_session_track_get_next(MYSQL *mysql,
enum enum_session_state_type type,
const char **data, size_t *length);
/* local infile support */
#define LOCAL_INFILE_ERROR_LEN 512
void mysql_set_local_infile_handler(
MYSQL *mysql, int (*local_infile_init)(void **, const char *, void *),
int (*local_infile_read)(void *, char *, unsigned int),
void (*local_infile_end)(void *),
int (*local_infile_error)(void *, char *, unsigned int), void *);
void mysql_set_local_infile_default(MYSQL *mysql);
int STDCALL mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level shutdown_level);
int STDCALL mysql_dump_debug_info(MYSQL *mysql);
int STDCALL mysql_refresh(MYSQL *mysql, unsigned int refresh_options);
int STDCALL mysql_kill(MYSQL *mysql, unsigned long pid);
int STDCALL mysql_set_server_option(MYSQL *mysql,
enum enum_mysql_set_option option);
int STDCALL mysql_ping(MYSQL *mysql);
const char *STDCALL mysql_stat(MYSQL *mysql);
const char *STDCALL mysql_get_server_info(MYSQL *mysql);
const char *STDCALL mysql_get_client_info(void);
unsigned long STDCALL mysql_get_client_version(void);
const char *STDCALL mysql_get_host_info(MYSQL *mysql);
unsigned long STDCALL mysql_get_server_version(MYSQL *mysql);
unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
MYSQL_RES *STDCALL mysql_list_dbs(MYSQL *mysql, const char *wild);
MYSQL_RES *STDCALL mysql_list_tables(MYSQL *mysql, const char *wild);
MYSQL_RES *STDCALL mysql_list_processes(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
const void *arg);
int STDCALL mysql_options4(MYSQL *mysql, enum mysql_option option,
const void *arg1, const void *arg2);
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option,
const void *arg);
void STDCALL mysql_free_result(MYSQL_RES *result);
enum net_async_status STDCALL mysql_free_result_nonblocking(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result, uint64_t offset);
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
MYSQL_ROW_OFFSET offset);
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_FIELD_OFFSET offset);
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
enum net_async_status STDCALL mysql_fetch_row_nonblocking(MYSQL_RES *res,
MYSQL_ROW *row);
unsigned long *STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD *STDCALL mysql_fetch_field(MYSQL_RES *result);
MYSQL_RES *STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild);
unsigned long STDCALL mysql_escape_string(char *to, const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_hex_string(char *to, const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, char *to,
const char *from,
unsigned long length);
unsigned long STDCALL mysql_real_escape_string_quote(MYSQL *mysql, char *to,
const char *from,
unsigned long length,
char quote);
void STDCALL mysql_debug(const char *debug);
void STDCALL myodbc_remove_escape(MYSQL *mysql, char *name);
unsigned int STDCALL mysql_thread_safe(void);
bool STDCALL mysql_read_query_result(MYSQL *mysql);
int STDCALL mysql_reset_connection(MYSQL *mysql);
int STDCALL mysql_binlog_open(MYSQL *mysql, MYSQL_RPL *rpl);
int STDCALL mysql_binlog_fetch(MYSQL *mysql, MYSQL_RPL *rpl);
void STDCALL mysql_binlog_close(MYSQL *mysql, MYSQL_RPL *rpl);
/*
The following definitions are added for the enhanced
client-server protocol
*/
/* statement state */
enum enum_mysql_stmt_state {
MYSQL_STMT_INIT_DONE = 1,
MYSQL_STMT_PREPARE_DONE,
MYSQL_STMT_EXECUTE_DONE,
MYSQL_STMT_FETCH_DONE
};
/*
This structure is used to define bind information, and
internally by the client library.
Public members with their descriptions are listed below
(conventionally `On input' refers to the binds given to
mysql_stmt_bind_param, `On output' refers to the binds given
to mysql_stmt_bind_result):
buffer_type - One of the MYSQL_* types, used to describe
the host language type of buffer.
On output: if column type is different from
buffer_type, column value is automatically converted
to buffer_type before it is stored in the buffer.
buffer - On input: points to the buffer with input data.
On output: points to the buffer capable to store
output data.
The type of memory pointed by buffer must correspond
to buffer_type. See the correspondence table in
the comment to mysql_stmt_bind_param.
The two above members are mandatory for any kind of bind.
buffer_length - the length of the buffer. You don't have to set
it for any fixed length buffer: float, double,
int, etc. It must be set however for variable-length
types, such as BLOBs or STRINGs.
length - On input: in case when lengths of input values
are different for each execute, you can set this to
point at a variable containing value length. This
way the value length can be different in each execute.
If length is not NULL, buffer_length is not used.
Note, length can even point at buffer_length if
you keep bind structures around while fetching:
this way you can change buffer_length before
each execution, everything will work ok.
On output: if length is set, mysql_stmt_fetch will
write column length into it.
is_null - On input: points to a boolean variable that should
be set to TRUE for NULL values.
This member is useful only if your data may be
NULL in some but not all cases.
If your data is never NULL, is_null should be set to 0.
If your data is always NULL, set buffer_type
to MYSQL_TYPE_NULL, and is_null will not be used.
is_unsigned - On input: used to signify that values provided for one
of numeric types are unsigned.
On output describes signedness of the output buffer.
If, taking into account is_unsigned flag, column data
is out of range of the output buffer, data for this column
is regarded truncated. Note that this has no correspondence
to the sign of result set column, if you need to find it out
use mysql_stmt_result_metadata.
error - where to write a truncation error if it is present.
possible error value is:
0 no truncation
1 value is out of range or buffer is too small
Please note that MYSQL_BIND also has internals members.
*/
typedef struct MYSQL_BIND {
unsigned long *length; /* output length pointer */
bool *is_null; /* Pointer to null indicator */
void *buffer; /* buffer to get/put data */
/* set this if you want to track data truncations happened during fetch */
bool *error;
unsigned char *row_ptr; /* for the current data position */
void (*store_param_func)(NET *net, struct MYSQL_BIND *param);
void (*fetch_result)(struct MYSQL_BIND *, MYSQL_FIELD *, unsigned char **row);
void (*skip_result)(struct MYSQL_BIND *, MYSQL_FIELD *, unsigned char **row);
/* output buffer length, must be set when fetching str/binary */
unsigned long buffer_length;
unsigned long offset; /* offset position for char/binary fetch */
unsigned long length_value; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
unsigned int pack_length; /* Internal length for packed data */
enum enum_field_types buffer_type; /* buffer type */
bool error_value; /* used if error is 0 */
bool is_unsigned; /* set if integer type is unsigned */
bool long_data_used; /* If used with mysql_send_long_data */
bool is_null_value; /* Used if is_null is 0 */
void *extension;
} MYSQL_BIND;
struct MYSQL_STMT_EXT;
/* statement handler */
typedef struct MYSQL_STMT {
struct MEM_ROOT *mem_root; /* root allocations */
LIST list; /* list to keep track of all stmts */
MYSQL *mysql; /* connection handle */
MYSQL_BIND *params; /* input parameters */
MYSQL_BIND *bind; /* output parameters */
MYSQL_FIELD *fields; /* result set metadata */
MYSQL_DATA result; /* cached result set */
MYSQL_ROWS *data_cursor; /* current row in cached result */
/*
mysql_stmt_fetch() calls this function to fetch one row (it's different
for buffered, unbuffered and cursor fetch).
*/
int (*read_row_func)(struct MYSQL_STMT *stmt, unsigned char **row);
/* copy of mysql->affected_rows after statement execution */
uint64_t affected_rows;
uint64_t insert_id; /* copy of mysql->insert_id */
unsigned long stmt_id; /* Id for prepared statement */
unsigned long flags; /* i.e. type of cursor to open */
unsigned long prefetch_rows; /* number of rows per one COM_FETCH */
/*
Copied from mysql->server_status after execute/fetch to know
server-side cursor status for this statement.
*/
unsigned int server_status;
unsigned int last_errno; /* error code */
unsigned int param_count; /* input parameter count */
unsigned int field_count; /* number of columns in result set */
enum enum_mysql_stmt_state state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
char sqlstate[SQLSTATE_LENGTH + 1];
/* Types of input parameters should be sent to server */
bool send_types_to_server;
bool bind_param_done; /* input buffers were supplied */
unsigned char bind_result_done; /* output buffers were supplied */
/* mysql_stmt_close() had to cancel this result */
bool unbuffered_fetch_cancelled;
/*
Is set to true if we need to calculate field->max_length for
metadata fields when doing mysql_stmt_store_result.
*/
bool update_max_length;
struct MYSQL_STMT_EXT *extension;
} MYSQL_STMT;
enum enum_stmt_attr_type {
/*
When doing mysql_stmt_store_result calculate max_length attribute
of statement metadata. This is to be consistent with the old API,
where this was done automatically.
In the new API we do that only by request because it slows down
mysql_stmt_store_result sufficiently.
*/
STMT_ATTR_UPDATE_MAX_LENGTH,
/*
unsigned long with combination of cursor flags (read only, for update,
etc)
*/
STMT_ATTR_CURSOR_TYPE,
/*
Amount of rows to retrieve from server per one fetch if using cursors.
Accepts unsigned long attribute in the range 1 - ulong_max
*/
STMT_ATTR_PREFETCH_ROWS
};
bool STDCALL mysql_bind_param(MYSQL *mysql, unsigned n_params,
MYSQL_BIND *binds, const char **names);
MYSQL_STMT *STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
unsigned long length);
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
unsigned int column, unsigned long offset);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT *stmt);
bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt,
enum enum_stmt_attr_type attr_type,
const void *attr);
bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
enum enum_stmt_attr_type attr_type,
void *attr);
bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bnd);
bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bnd);
bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt);
bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt);
bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data, unsigned long length);
MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT *stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT *stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT *stmt);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, uint64_t offset);
uint64_t STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
uint64_t STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
uint64_t STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
bool STDCALL mysql_commit(MYSQL *mysql);
bool STDCALL mysql_rollback(MYSQL *mysql);
bool STDCALL mysql_autocommit(MYSQL *mysql, bool auto_mode);
bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
void STDCALL mysql_close(MYSQL *sock);
/* Public key reset */
void STDCALL mysql_reset_server_public_key(void);
/* status return codes */
#define MYSQL_NO_DATA 100
#define MYSQL_DATA_TRUNCATED 101
#define mysql_reload(mysql) mysql_refresh((mysql), REFRESH_GRANT)
#define HAVE_MYSQL_REAL_CONNECT
MYSQL *STDCALL mysql_real_connect_dns_srv(MYSQL *mysql,
const char *dns_srv_name,
const char *user, const char *passwd,
const char *db,
unsigned long client_flag);
#ifdef __cplusplus
}
#endif
#endif /* _mysql_h */
/* Copyright (c) 2014, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file field_types.h
@brief This file contains the field type.
@note This file can be imported both from C and C++ code, so the
definitions have to be constructed to support this.
*/
#ifndef FIELD_TYPES_INCLUDED
#define FIELD_TYPES_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Constants exported from this package.
*/
/**
Column types for MySQL
*/
enum enum_field_types {
MYSQL_TYPE_DECIMAL,
MYSQL_TYPE_TINY,
MYSQL_TYPE_SHORT,
MYSQL_TYPE_LONG,
MYSQL_TYPE_FLOAT,
MYSQL_TYPE_DOUBLE,
MYSQL_TYPE_NULL,
MYSQL_TYPE_TIMESTAMP,
MYSQL_TYPE_LONGLONG,
MYSQL_TYPE_INT24,
MYSQL_TYPE_DATE,
MYSQL_TYPE_TIME,
MYSQL_TYPE_DATETIME,
MYSQL_TYPE_YEAR,
MYSQL_TYPE_NEWDATE, /**< Internal to MySQL. Not used in protocol */
MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_BIT,
MYSQL_TYPE_TIMESTAMP2,
MYSQL_TYPE_DATETIME2, /**< Internal to MySQL. Not used in protocol */
MYSQL_TYPE_TIME2, /**< Internal to MySQL. Not used in protocol */
MYSQL_TYPE_TYPED_ARRAY, /**< Used for replication only */
MYSQL_TYPE_INVALID = 243,
MYSQL_TYPE_BOOL = 244, /**< Currently just a placeholder */
MYSQL_TYPE_JSON = 245,
MYSQL_TYPE_NEWDECIMAL = 246,
MYSQL_TYPE_ENUM = 247,
MYSQL_TYPE_SET = 248,
MYSQL_TYPE_TINY_BLOB = 249,
MYSQL_TYPE_MEDIUM_BLOB = 250,
MYSQL_TYPE_LONG_BLOB = 251,
MYSQL_TYPE_BLOB = 252,
MYSQL_TYPE_VAR_STRING = 253,
MYSQL_TYPE_STRING = 254,
MYSQL_TYPE_GEOMETRY = 255
};
#ifdef __cplusplus
} // extern "C"
#else
typedef enum enum_field_types enum_field_types;
#endif /* __cplusplus */
#endif /* FIELD_TYPES_INCLUDED */
/* Copyright (c) 2004, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _mysql_time_h_
#define _mysql_time_h_
/**
@file include/mysql_time.h
Time declarations shared between the server and client API:
you should not add anything to this header unless it's used
(and hence should be visible) in mysql.h.
If you're looking for a place to add new time-related declaration,
it's most likely my_time.h. See also "C API Handling of Date
and Time Values" chapter in documentation.
*/
// Do not not pull in the server header "my_inttypes.h" from client code.
// IWYU pragma: no_include "my_inttypes.h"
enum enum_mysql_timestamp_type {
MYSQL_TIMESTAMP_NONE = -2,
MYSQL_TIMESTAMP_ERROR = -1,
/// Stores year, month and day components.
MYSQL_TIMESTAMP_DATE = 0,
/**
Stores all date and time components.
Value is in UTC for `TIMESTAMP` type.
Value is in local time zone for `DATETIME` type.
*/
MYSQL_TIMESTAMP_DATETIME = 1,
/// Stores hour, minute, second and microsecond.
MYSQL_TIMESTAMP_TIME = 2,
/**
A temporary type for `DATETIME` or `TIMESTAMP` types equipped with time
zone information. After the time zone information is reconciled, the type is
converted to MYSQL_TIMESTAMP_DATETIME.
*/
MYSQL_TIMESTAMP_DATETIME_TZ = 3
};
/*
Structure which is used to represent datetime values inside MySQL.
We assume that values in this structure are normalized, i.e. year <= 9999,
month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
in server such as my_system_gmt_sec() or make_time() family of functions
rely on this (actually now usage of make_*() family relies on a bit weaker
restriction). Also functions that produce MYSQL_TIME as result ensure this.
There is one exception to this rule though if this structure holds time
value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
bigger values.
*/
typedef struct MYSQL_TIME {
unsigned int year, month, day, hour, minute, second;
unsigned long second_part; /**< microseconds */
bool neg;
enum enum_mysql_timestamp_type time_type;
/// The time zone displacement, specified in seconds.
int time_zone_displacement;
} MYSQL_TIME;
#endif /* _mysql_time_h_ */
/* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* Autogenerated file, please don't edit */
#ifndef MYSQLD_ERROR_INCLUDED
#define MYSQLD_ERROR_INCLUDED
static const int errmsg_section_start[] = { 1000, 3000, 3500, 10000 };
static const int errmsg_section_size[] = { 888, 239, 668, 4086 };
static const int total_error_count = 5881;
//#define OBSOLETE_ER_HASHCHK 1000
//#define OBSOLETE_ER_NISAMCHK 1001
#define ER_NO 1002
#define ER_YES 1003
#define ER_CANT_CREATE_FILE 1004
#define ER_CANT_CREATE_TABLE 1005
#define ER_CANT_CREATE_DB 1006
#define ER_DB_CREATE_EXISTS 1007
#define ER_DB_DROP_EXISTS 1008
//#define OBSOLETE_ER_DB_DROP_DELETE 1009
#define ER_DB_DROP_RMDIR 1010
//#define OBSOLETE_ER_CANT_DELETE_FILE 1011
#define ER_CANT_FIND_SYSTEM_REC 1012
#define ER_CANT_GET_STAT 1013
//#define OBSOLETE_ER_CANT_GET_WD 1014
#define ER_CANT_LOCK 1015
#define ER_CANT_OPEN_FILE 1016
#define ER_FILE_NOT_FOUND 1017
#define ER_CANT_READ_DIR 1018
//#define OBSOLETE_ER_CANT_SET_WD 1019
#define ER_CHECKREAD 1020
//#define OBSOLETE_ER_DISK_FULL 1021
#define ER_DUP_KEY 1022
//#define OBSOLETE_ER_ERROR_ON_CLOSE 1023
#define ER_ERROR_ON_READ 1024
#define ER_ERROR_ON_RENAME 1025
#define ER_ERROR_ON_WRITE 1026
#define ER_FILE_USED 1027
//#define OBSOLETE_ER_FILSORT_ABORT 1028
//#define OBSOLETE_ER_FORM_NOT_FOUND 1029
#define ER_GET_ERRNO 1030
#define ER_ILLEGAL_HA 1031
#define ER_KEY_NOT_FOUND 1032
#define ER_NOT_FORM_FILE 1033
#define ER_NOT_KEYFILE 1034
#define ER_OLD_KEYFILE 1035
#define ER_OPEN_AS_READONLY 1036
#define ER_OUTOFMEMORY 1037
#define ER_OUT_OF_SORTMEMORY 1038
//#define OBSOLETE_ER_UNEXPECTED_EOF 1039
#define ER_CON_COUNT_ERROR 1040
#define ER_OUT_OF_RESOURCES 1041
#define ER_BAD_HOST_ERROR 1042
#define ER_HANDSHAKE_ERROR 1043
#define ER_DBACCESS_DENIED_ERROR 1044
#define ER_ACCESS_DENIED_ERROR 1045
#define ER_NO_DB_ERROR 1046
#define ER_UNKNOWN_COM_ERROR 1047
#define ER_BAD_NULL_ERROR 1048
#define ER_BAD_DB_ERROR 1049
#define ER_TABLE_EXISTS_ERROR 1050
#define ER_BAD_TABLE_ERROR 1051
#define ER_NON_UNIQ_ERROR 1052
#define ER_SERVER_SHUTDOWN 1053
#define ER_BAD_FIELD_ERROR 1054
#define ER_WRONG_FIELD_WITH_GROUP 1055
#define ER_WRONG_GROUP_FIELD 1056
#define ER_WRONG_SUM_SELECT 1057
#define ER_WRONG_VALUE_COUNT 1058
#define ER_TOO_LONG_IDENT 1059
#define ER_DUP_FIELDNAME 1060
#define ER_DUP_KEYNAME 1061
#define ER_DUP_ENTRY 1062
#define ER_WRONG_FIELD_SPEC 1063
#define ER_PARSE_ERROR 1064
#define ER_EMPTY_QUERY 1065
#define ER_NONUNIQ_TABLE 1066
#define ER_INVALID_DEFAULT 1067
#define ER_MULTIPLE_PRI_KEY 1068
#define ER_TOO_MANY_KEYS 1069
#define ER_TOO_MANY_KEY_PARTS 1070
#define ER_TOO_LONG_KEY 1071
#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
#define ER_BLOB_USED_AS_KEY 1073
#define ER_TOO_BIG_FIELDLENGTH 1074
#define ER_WRONG_AUTO_KEY 1075
#define ER_READY 1076
//#define OBSOLETE_ER_NORMAL_SHUTDOWN 1077
//#define OBSOLETE_ER_GOT_SIGNAL 1078
#define ER_SHUTDOWN_COMPLETE 1079
#define ER_FORCING_CLOSE 1080
#define ER_IPSOCK_ERROR 1081
#define ER_NO_SUCH_INDEX 1082
#define ER_WRONG_FIELD_TERMINATORS 1083
#define ER_BLOBS_AND_NO_TERMINATED 1084
#define ER_TEXTFILE_NOT_READABLE 1085
#define ER_FILE_EXISTS_ERROR 1086
#define ER_LOAD_INFO 1087
#define ER_ALTER_INFO 1088
#define ER_WRONG_SUB_KEY 1089
#define ER_CANT_REMOVE_ALL_FIELDS 1090
#define ER_CANT_DROP_FIELD_OR_KEY 1091
#define ER_INSERT_INFO 1092
#define ER_UPDATE_TABLE_USED 1093
#define ER_NO_SUCH_THREAD 1094
#define ER_KILL_DENIED_ERROR 1095
#define ER_NO_TABLES_USED 1096
#define ER_TOO_BIG_SET 1097
#define ER_NO_UNIQUE_LOGFILE 1098
#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
#define ER_TABLE_NOT_LOCKED 1100
#define ER_BLOB_CANT_HAVE_DEFAULT 1101
#define ER_WRONG_DB_NAME 1102
#define ER_WRONG_TABLE_NAME 1103
#define ER_TOO_BIG_SELECT 1104
#define ER_UNKNOWN_ERROR 1105
#define ER_UNKNOWN_PROCEDURE 1106
#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
#define ER_UNKNOWN_TABLE 1109
#define ER_FIELD_SPECIFIED_TWICE 1110
#define ER_INVALID_GROUP_FUNC_USE 1111
#define ER_UNSUPPORTED_EXTENSION 1112
#define ER_TABLE_MUST_HAVE_COLUMNS 1113
#define ER_RECORD_FILE_FULL 1114
#define ER_UNKNOWN_CHARACTER_SET 1115
#define ER_TOO_MANY_TABLES 1116
#define ER_TOO_MANY_FIELDS 1117
#define ER_TOO_BIG_ROWSIZE 1118
#define ER_STACK_OVERRUN 1119
#define ER_WRONG_OUTER_JOIN_UNUSED 1120
#define ER_NULL_COLUMN_IN_INDEX 1121
#define ER_CANT_FIND_UDF 1122
#define ER_CANT_INITIALIZE_UDF 1123
#define ER_UDF_NO_PATHS 1124
#define ER_UDF_EXISTS 1125
#define ER_CANT_OPEN_LIBRARY 1126
#define ER_CANT_FIND_DL_ENTRY 1127
#define ER_FUNCTION_NOT_DEFINED 1128
#define ER_HOST_IS_BLOCKED 1129
#define ER_HOST_NOT_PRIVILEGED 1130
#define ER_PASSWORD_ANONYMOUS_USER 1131
#define ER_PASSWORD_NOT_ALLOWED 1132
#define ER_PASSWORD_NO_MATCH 1133
#define ER_UPDATE_INFO 1134
#define ER_CANT_CREATE_THREAD 1135
#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
#define ER_CANT_REOPEN_TABLE 1137
#define ER_INVALID_USE_OF_NULL 1138
#define ER_REGEXP_ERROR 1139
#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
#define ER_NONEXISTING_GRANT 1141
#define ER_TABLEACCESS_DENIED_ERROR 1142
#define ER_COLUMNACCESS_DENIED_ERROR 1143
#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
#define ER_GRANT_WRONG_HOST_OR_USER 1145
#define ER_NO_SUCH_TABLE 1146
#define ER_NONEXISTING_TABLE_GRANT 1147
#define ER_NOT_ALLOWED_COMMAND 1148
#define ER_SYNTAX_ERROR 1149
//#define OBSOLETE_ER_UNUSED1 1150
//#define OBSOLETE_ER_UNUSED2 1151
#define ER_ABORTING_CONNECTION 1152
#define ER_NET_PACKET_TOO_LARGE 1153
#define ER_NET_READ_ERROR_FROM_PIPE 1154
#define ER_NET_FCNTL_ERROR 1155
#define ER_NET_PACKETS_OUT_OF_ORDER 1156
#define ER_NET_UNCOMPRESS_ERROR 1157
#define ER_NET_READ_ERROR 1158
#define ER_NET_READ_INTERRUPTED 1159
#define ER_NET_ERROR_ON_WRITE 1160
#define ER_NET_WRITE_INTERRUPTED 1161
#define ER_TOO_LONG_STRING 1162
#define ER_TABLE_CANT_HANDLE_BLOB 1163
#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
//#define OBSOLETE_ER_UNUSED3 1165
#define ER_WRONG_COLUMN_NAME 1166
#define ER_WRONG_KEY_COLUMN 1167
#define ER_WRONG_MRG_TABLE 1168
#define ER_DUP_UNIQUE 1169
#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
#define ER_PRIMARY_CANT_HAVE_NULL 1171
#define ER_TOO_MANY_ROWS 1172
#define ER_REQUIRES_PRIMARY_KEY 1173
//#define OBSOLETE_ER_NO_RAID_COMPILED 1174
#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
#define ER_KEY_DOES_NOT_EXITS 1176
#define ER_CHECK_NO_SUCH_TABLE 1177
#define ER_CHECK_NOT_IMPLEMENTED 1178
#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
#define ER_ERROR_DURING_COMMIT 1180
#define ER_ERROR_DURING_ROLLBACK 1181
#define ER_ERROR_DURING_FLUSH_LOGS 1182
//#define OBSOLETE_ER_ERROR_DURING_CHECKPOINT 1183
#define ER_NEW_ABORTING_CONNECTION 1184
//#define OBSOLETE_ER_DUMP_NOT_IMPLEMENTED 1185
//#define OBSOLETE_ER_FLUSH_MASTER_BINLOG_CLOSED 1186
//#define OBSOLETE_ER_INDEX_REBUILD 1187
#define ER_SOURCE 1188
#define ER_SOURCE_NET_READ 1189
#define ER_SOURCE_NET_WRITE 1190
#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
#define ER_CRASHED_ON_USAGE 1194
#define ER_CRASHED_ON_REPAIR 1195
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
#define ER_TRANS_CACHE_FULL 1197
//#define OBSOLETE_ER_SLAVE_MUST_STOP 1198
#define ER_REPLICA_NOT_RUNNING 1199
#define ER_BAD_REPLICA 1200
#define ER_CONNECTION_METADATA 1201
#define ER_REPLICA_THREAD 1202
#define ER_TOO_MANY_USER_CONNECTIONS 1203
#define ER_SET_CONSTANTS_ONLY 1204
#define ER_LOCK_WAIT_TIMEOUT 1205
#define ER_LOCK_TABLE_FULL 1206
#define ER_READ_ONLY_TRANSACTION 1207
//#define OBSOLETE_ER_DROP_DB_WITH_READ_LOCK 1208
//#define OBSOLETE_ER_CREATE_DB_WITH_READ_LOCK 1209
#define ER_WRONG_ARGUMENTS 1210
#define ER_NO_PERMISSION_TO_CREATE_USER 1211
//#define OBSOLETE_ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
#define ER_LOCK_DEADLOCK 1213
#define ER_TABLE_CANT_HANDLE_FT 1214
#define ER_CANNOT_ADD_FOREIGN 1215
#define ER_NO_REFERENCED_ROW 1216
#define ER_ROW_IS_REFERENCED 1217
#define ER_CONNECT_TO_SOURCE 1218
//#define OBSOLETE_ER_QUERY_ON_MASTER 1219
#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220
#define ER_WRONG_USAGE 1221
#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222
#define ER_CANT_UPDATE_WITH_READLOCK 1223
#define ER_MIXING_NOT_ALLOWED 1224
#define ER_DUP_ARGUMENT 1225
#define ER_USER_LIMIT_REACHED 1226
#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
#define ER_LOCAL_VARIABLE 1228
#define ER_GLOBAL_VARIABLE 1229
#define ER_NO_DEFAULT 1230
#define ER_WRONG_VALUE_FOR_VAR 1231
#define ER_WRONG_TYPE_FOR_VAR 1232
#define ER_VAR_CANT_BE_READ 1233
#define ER_CANT_USE_OPTION_HERE 1234
#define ER_NOT_SUPPORTED_YET 1235
#define ER_SOURCE_FATAL_ERROR_READING_BINLOG 1236
#define ER_REPLICA_IGNORED_TABLE 1237
#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238
#define ER_WRONG_FK_DEF 1239
#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240
#define ER_OPERAND_COLUMNS 1241
#define ER_SUBQUERY_NO_1_ROW 1242
#define ER_UNKNOWN_STMT_HANDLER 1243
#define ER_CORRUPT_HELP_DB 1244
//#define OBSOLETE_ER_CYCLIC_REFERENCE 1245
#define ER_AUTO_CONVERT 1246
#define ER_ILLEGAL_REFERENCE 1247
#define ER_DERIVED_MUST_HAVE_ALIAS 1248
#define ER_SELECT_REDUCED 1249
#define ER_TABLENAME_NOT_ALLOWED_HERE 1250
#define ER_NOT_SUPPORTED_AUTH_MODE 1251
#define ER_SPATIAL_CANT_HAVE_NULL 1252
#define ER_COLLATION_CHARSET_MISMATCH 1253
//#define OBSOLETE_ER_SLAVE_WAS_RUNNING 1254
//#define OBSOLETE_ER_SLAVE_WAS_NOT_RUNNING 1255
#define ER_TOO_BIG_FOR_UNCOMPRESS 1256
#define ER_ZLIB_Z_MEM_ERROR 1257
#define ER_ZLIB_Z_BUF_ERROR 1258
#define ER_ZLIB_Z_DATA_ERROR 1259
#define ER_CUT_VALUE_GROUP_CONCAT 1260
#define ER_WARN_TOO_FEW_RECORDS 1261
#define ER_WARN_TOO_MANY_RECORDS 1262
#define ER_WARN_NULL_TO_NOTNULL 1263
#define ER_WARN_DATA_OUT_OF_RANGE 1264
#define WARN_DATA_TRUNCATED 1265
#define ER_WARN_USING_OTHER_HANDLER 1266
#define ER_CANT_AGGREGATE_2COLLATIONS 1267
//#define OBSOLETE_ER_DROP_USER 1268
#define ER_REVOKE_GRANTS 1269
#define ER_CANT_AGGREGATE_3COLLATIONS 1270
#define ER_CANT_AGGREGATE_NCOLLATIONS 1271
#define ER_VARIABLE_IS_NOT_STRUCT 1272
#define ER_UNKNOWN_COLLATION 1273
#define ER_REPLICA_IGNORED_SSL_PARAMS 1274
//#define OBSOLETE_ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275
#define ER_WARN_FIELD_RESOLVED 1276
#define ER_BAD_REPLICA_UNTIL_COND 1277
#define ER_MISSING_SKIP_REPLICA 1278
#define ER_UNTIL_COND_IGNORED 1279
#define ER_WRONG_NAME_FOR_INDEX 1280
#define ER_WRONG_NAME_FOR_CATALOG 1281
//#define OBSOLETE_ER_WARN_QC_RESIZE 1282
#define ER_BAD_FT_COLUMN 1283
#define ER_UNKNOWN_KEY_CACHE 1284
#define ER_WARN_HOSTNAME_WONT_WORK 1285
#define ER_UNKNOWN_STORAGE_ENGINE 1286
#define ER_WARN_DEPRECATED_SYNTAX 1287
#define ER_NON_UPDATABLE_TABLE 1288
#define ER_FEATURE_DISABLED 1289
#define ER_OPTION_PREVENTS_STATEMENT 1290
#define ER_DUPLICATED_VALUE_IN_TYPE 1291
#define ER_TRUNCATED_WRONG_VALUE 1292
//#define OBSOLETE_ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293
#define ER_INVALID_ON_UPDATE 1294
#define ER_UNSUPPORTED_PS 1295
#define ER_GET_ERRMSG 1296
#define ER_GET_TEMPORARY_ERRMSG 1297
#define ER_UNKNOWN_TIME_ZONE 1298
#define ER_WARN_INVALID_TIMESTAMP 1299
#define ER_INVALID_CHARACTER_STRING 1300
#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
#define ER_CONFLICTING_DECLARATIONS 1302
#define ER_SP_NO_RECURSIVE_CREATE 1303
#define ER_SP_ALREADY_EXISTS 1304
#define ER_SP_DOES_NOT_EXIST 1305
#define ER_SP_DROP_FAILED 1306
#define ER_SP_STORE_FAILED 1307
#define ER_SP_LILABEL_MISMATCH 1308
#define ER_SP_LABEL_REDEFINE 1309
#define ER_SP_LABEL_MISMATCH 1310
#define ER_SP_UNINIT_VAR 1311
#define ER_SP_BADSELECT 1312
#define ER_SP_BADRETURN 1313
#define ER_SP_BADSTATEMENT 1314
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316
#define ER_QUERY_INTERRUPTED 1317
#define ER_SP_WRONG_NO_OF_ARGS 1318
#define ER_SP_COND_MISMATCH 1319
#define ER_SP_NORETURN 1320
#define ER_SP_NORETURNEND 1321
#define ER_SP_BAD_CURSOR_QUERY 1322
#define ER_SP_BAD_CURSOR_SELECT 1323
#define ER_SP_CURSOR_MISMATCH 1324
#define ER_SP_CURSOR_ALREADY_OPEN 1325
#define ER_SP_CURSOR_NOT_OPEN 1326
#define ER_SP_UNDECLARED_VAR 1327
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328
#define ER_SP_FETCH_NO_DATA 1329
#define ER_SP_DUP_PARAM 1330
#define ER_SP_DUP_VAR 1331
#define ER_SP_DUP_COND 1332
#define ER_SP_DUP_CURS 1333
#define ER_SP_CANT_ALTER 1334
#define ER_SP_SUBSELECT_NYI 1335
#define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337
#define ER_SP_CURSOR_AFTER_HANDLER 1338
#define ER_SP_CASE_NOT_FOUND 1339
#define ER_FPARSER_TOO_BIG_FILE 1340
#define ER_FPARSER_BAD_HEADER 1341
#define ER_FPARSER_EOF_IN_COMMENT 1342
#define ER_FPARSER_ERROR_IN_PARAMETER 1343
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344
#define ER_VIEW_NO_EXPLAIN 1345
//#define OBSOLETE_ER_FRM_UNKNOWN_TYPE 1346
#define ER_WRONG_OBJECT 1347
#define ER_NONUPDATEABLE_COLUMN 1348
//#define OBSOLETE_ER_VIEW_SELECT_DERIVED_UNUSED 1349
#define ER_VIEW_SELECT_CLAUSE 1350
#define ER_VIEW_SELECT_VARIABLE 1351
#define ER_VIEW_SELECT_TMPTABLE 1352
#define ER_VIEW_WRONG_LIST 1353
#define ER_WARN_VIEW_MERGE 1354
#define ER_WARN_VIEW_WITHOUT_KEY 1355
#define ER_VIEW_INVALID 1356
#define ER_SP_NO_DROP_SP 1357
//#define OBSOLETE_ER_SP_GOTO_IN_HNDLR 1358
#define ER_TRG_ALREADY_EXISTS 1359
#define ER_TRG_DOES_NOT_EXIST 1360
#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361
#define ER_TRG_CANT_CHANGE_ROW 1362
#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363
#define ER_NO_DEFAULT_FOR_FIELD 1364
#define ER_DIVISION_BY_ZERO 1365
#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366
#define ER_ILLEGAL_VALUE_FOR_TYPE 1367
#define ER_VIEW_NONUPD_CHECK 1368
#define ER_VIEW_CHECK_FAILED 1369
#define ER_PROCACCESS_DENIED_ERROR 1370
#define ER_RELAY_LOG_FAIL 1371
//#define OBSOLETE_ER_PASSWD_LENGTH 1372
#define ER_UNKNOWN_TARGET_BINLOG 1373
#define ER_IO_ERR_LOG_INDEX_READ 1374
#define ER_BINLOG_PURGE_PROHIBITED 1375
#define ER_FSEEK_FAIL 1376
#define ER_BINLOG_PURGE_FATAL_ERR 1377
#define ER_LOG_IN_USE 1378
#define ER_LOG_PURGE_UNKNOWN_ERR 1379
#define ER_RELAY_LOG_INIT 1380
#define ER_NO_BINARY_LOGGING 1381
#define ER_RESERVED_SYNTAX 1382
//#define OBSOLETE_ER_WSAS_FAILED 1383
//#define OBSOLETE_ER_DIFF_GROUPS_PROC 1384
//#define OBSOLETE_ER_NO_GROUP_FOR_PROC 1385
//#define OBSOLETE_ER_ORDER_WITH_PROC 1386
//#define OBSOLETE_ER_LOGGING_PROHIBIT_CHANGING_OF 1387
//#define OBSOLETE_ER_NO_FILE_MAPPING 1388
//#define OBSOLETE_ER_WRONG_MAGIC 1389
#define ER_PS_MANY_PARAM 1390
#define ER_KEY_PART_0 1391
#define ER_VIEW_CHECKSUM 1392
#define ER_VIEW_MULTIUPDATE 1393
#define ER_VIEW_NO_INSERT_FIELD_LIST 1394
#define ER_VIEW_DELETE_MERGE_VIEW 1395
#define ER_CANNOT_USER 1396
#define ER_XAER_NOTA 1397
#define ER_XAER_INVAL 1398
#define ER_XAER_RMFAIL 1399
#define ER_XAER_OUTSIDE 1400
#define ER_XAER_RMERR 1401
#define ER_XA_RBROLLBACK 1402
#define ER_NONEXISTING_PROC_GRANT 1403
#define ER_PROC_AUTO_GRANT_FAIL 1404
#define ER_PROC_AUTO_REVOKE_FAIL 1405
#define ER_DATA_TOO_LONG 1406
#define ER_SP_BAD_SQLSTATE 1407
#define ER_STARTUP 1408
#define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409
#define ER_CANT_CREATE_USER_WITH_GRANT 1410
#define ER_WRONG_VALUE_FOR_TYPE 1411
#define ER_TABLE_DEF_CHANGED 1412
#define ER_SP_DUP_HANDLER 1413
#define ER_SP_NOT_VAR_ARG 1414
#define ER_SP_NO_RETSET 1415
#define ER_CANT_CREATE_GEOMETRY_OBJECT 1416
//#define OBSOLETE_ER_FAILED_ROUTINE_BREAK_BINLOG 1417
#define ER_BINLOG_UNSAFE_ROUTINE 1418
#define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419
//#define OBSOLETE_ER_EXEC_STMT_WITH_OPEN_CURSOR 1420
#define ER_STMT_HAS_NO_OPEN_CURSOR 1421
#define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422
#define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423
#define ER_SP_NO_RECURSION 1424
#define ER_TOO_BIG_SCALE 1425
#define ER_TOO_BIG_PRECISION 1426
#define ER_M_BIGGER_THAN_D 1427
#define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428
#define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429
#define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430
#define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431
#define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432
#define ER_FOREIGN_DATA_STRING_INVALID 1433
//#define OBSOLETE_ER_CANT_CREATE_FEDERATED_TABLE 1434
#define ER_TRG_IN_WRONG_SCHEMA 1435
#define ER_STACK_OVERRUN_NEED_MORE 1436
#define ER_TOO_LONG_BODY 1437
#define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438
#define ER_TOO_BIG_DISPLAYWIDTH 1439
#define ER_XAER_DUPID 1440
#define ER_DATETIME_FUNCTION_OVERFLOW 1441
#define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442
#define ER_VIEW_PREVENT_UPDATE 1443
#define ER_PS_NO_RECURSION 1444
#define ER_SP_CANT_SET_AUTOCOMMIT 1445
//#define OBSOLETE_ER_MALFORMED_DEFINER 1446
#define ER_VIEW_FRM_NO_USER 1447
#define ER_VIEW_OTHER_USER 1448
#define ER_NO_SUCH_USER 1449
#define ER_FORBID_SCHEMA_CHANGE 1450
#define ER_ROW_IS_REFERENCED_2 1451
#define ER_NO_REFERENCED_ROW_2 1452
#define ER_SP_BAD_VAR_SHADOW 1453
#define ER_TRG_NO_DEFINER 1454
#define ER_OLD_FILE_FORMAT 1455
#define ER_SP_RECURSION_LIMIT 1456
//#define OBSOLETE_ER_SP_PROC_TABLE_CORRUPT 1457
#define ER_SP_WRONG_NAME 1458
#define ER_TABLE_NEEDS_UPGRADE 1459
#define ER_SP_NO_AGGREGATE 1460
#define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461
#define ER_VIEW_RECURSIVE 1462
#define ER_NON_GROUPING_FIELD_USED 1463
#define ER_TABLE_CANT_HANDLE_SPKEYS 1464
#define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465
#define ER_REMOVED_SPACES 1466
#define ER_AUTOINC_READ_FAILED 1467
#define ER_USERNAME 1468
#define ER_HOSTNAME 1469
#define ER_WRONG_STRING_LENGTH 1470
#define ER_NON_INSERTABLE_TABLE 1471
#define ER_ADMIN_WRONG_MRG_TABLE 1472
#define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473
#define ER_NAME_BECOMES_EMPTY 1474
#define ER_AMBIGUOUS_FIELD_TERM 1475
#define ER_FOREIGN_SERVER_EXISTS 1476
#define ER_FOREIGN_SERVER_DOESNT_EXIST 1477
#define ER_ILLEGAL_HA_CREATE_OPTION 1478
#define ER_PARTITION_REQUIRES_VALUES_ERROR 1479
#define ER_PARTITION_WRONG_VALUES_ERROR 1480
#define ER_PARTITION_MAXVALUE_ERROR 1481
//#define OBSOLETE_ER_PARTITION_SUBPARTITION_ERROR 1482
//#define OBSOLETE_ER_PARTITION_SUBPART_MIX_ERROR 1483
#define ER_PARTITION_WRONG_NO_PART_ERROR 1484
#define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485
#define ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR 1486
//#define OBSOLETE_ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR 1487
#define ER_FIELD_NOT_FOUND_PART_ERROR 1488
//#define OBSOLETE_ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489
#define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490
#define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491
#define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492
#define ER_RANGE_NOT_INCREASING_ERROR 1493
#define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494
#define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495
#define ER_PARTITION_ENTRY_ERROR 1496
#define ER_MIX_HANDLER_ERROR 1497
#define ER_PARTITION_NOT_DEFINED_ERROR 1498
#define ER_TOO_MANY_PARTITIONS_ERROR 1499
#define ER_SUBPARTITION_ERROR 1500
#define ER_CANT_CREATE_HANDLER_FILE 1501
#define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502
#define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503
#define ER_NO_PARTS_ERROR 1504
#define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505
#define ER_FOREIGN_KEY_ON_PARTITIONED 1506
#define ER_DROP_PARTITION_NON_EXISTENT 1507
#define ER_DROP_LAST_PARTITION 1508
#define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509
#define ER_REORG_HASH_ONLY_ON_SAME_NO 1510
#define ER_REORG_NO_PARAM_ERROR 1511
#define ER_ONLY_ON_RANGE_LIST_PARTITION 1512
#define ER_ADD_PARTITION_SUBPART_ERROR 1513
#define ER_ADD_PARTITION_NO_NEW_PARTITION 1514
#define ER_COALESCE_PARTITION_NO_PARTITION 1515
#define ER_REORG_PARTITION_NOT_EXIST 1516
#define ER_SAME_NAME_PARTITION 1517
#define ER_NO_BINLOG_ERROR 1518
#define ER_CONSECUTIVE_REORG_PARTITIONS 1519
#define ER_REORG_OUTSIDE_RANGE 1520
#define ER_PARTITION_FUNCTION_FAILURE 1521
//#define OBSOLETE_ER_PART_STATE_ERROR 1522
#define ER_LIMITED_PART_RANGE 1523
#define ER_PLUGIN_IS_NOT_LOADED 1524
#define ER_WRONG_VALUE 1525
#define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526
#define ER_FILEGROUP_OPTION_ONLY_ONCE 1527
#define ER_CREATE_FILEGROUP_FAILED 1528
#define ER_DROP_FILEGROUP_FAILED 1529
#define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530
#define ER_WRONG_SIZE_NUMBER 1531
#define ER_SIZE_OVERFLOW_ERROR 1532
#define ER_ALTER_FILEGROUP_FAILED 1533
#define ER_BINLOG_ROW_LOGGING_FAILED 1534
//#define OBSOLETE_ER_BINLOG_ROW_WRONG_TABLE_DEF 1535
//#define OBSOLETE_ER_BINLOG_ROW_RBR_TO_SBR 1536
#define ER_EVENT_ALREADY_EXISTS 1537
//#define OBSOLETE_ER_EVENT_STORE_FAILED 1538
#define ER_EVENT_DOES_NOT_EXIST 1539
//#define OBSOLETE_ER_EVENT_CANT_ALTER 1540
//#define OBSOLETE_ER_EVENT_DROP_FAILED 1541
#define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542
#define ER_EVENT_ENDS_BEFORE_STARTS 1543
#define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544
//#define OBSOLETE_ER_EVENT_OPEN_TABLE_FAILED 1545
//#define OBSOLETE_ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546
//#define OBSOLETE_ER_COL_COUNT_DOESNT_MATCH_CORRUPTED 1547
//#define OBSOLETE_ER_CANNOT_LOAD_FROM_TABLE 1548
//#define OBSOLETE_ER_EVENT_CANNOT_DELETE 1549
//#define OBSOLETE_ER_EVENT_COMPILE_ERROR 1550
#define ER_EVENT_SAME_NAME 1551
//#define OBSOLETE_ER_EVENT_DATA_TOO_LONG 1552
#define ER_DROP_INDEX_FK 1553
#define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554
//#define OBSOLETE_ER_CANT_WRITE_LOCK_LOG_TABLE 1555
#define ER_CANT_LOCK_LOG_TABLE 1556
#define ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED 1557
#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558
//#define OBSOLETE_ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559
#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560
//#define OBSOLETE_ER_NDB_CANT_SWITCH_BINLOG_FORMAT 1561
#define ER_PARTITION_NO_TEMPORARY 1562
#define ER_PARTITION_CONST_DOMAIN_ERROR 1563
#define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564
//#define OBSOLETE_ER_DDL_LOG_ERROR_UNUSED 1565
#define ER_NULL_IN_VALUES_LESS_THAN 1566
#define ER_WRONG_PARTITION_NAME 1567
#define ER_CANT_CHANGE_TX_CHARACTERISTICS 1568
#define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569
//#define OBSOLETE_ER_EVENT_MODIFY_QUEUE_ERROR 1570
#define ER_EVENT_SET_VAR_ERROR 1571
#define ER_PARTITION_MERGE_ERROR 1572
//#define OBSOLETE_ER_CANT_ACTIVATE_LOG 1573
//#define OBSOLETE_ER_RBR_NOT_AVAILABLE 1574
#define ER_BASE64_DECODE_ERROR 1575
#define ER_EVENT_RECURSION_FORBIDDEN 1576
//#define OBSOLETE_ER_EVENTS_DB_ERROR 1577
#define ER_ONLY_INTEGERS_ALLOWED 1578
#define ER_UNSUPORTED_LOG_ENGINE 1579
#define ER_BAD_LOG_STATEMENT 1580
#define ER_CANT_RENAME_LOG_TABLE 1581
#define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582
#define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583
#define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584
#define ER_NATIVE_FCT_NAME_COLLISION 1585
#define ER_DUP_ENTRY_WITH_KEY_NAME 1586
#define ER_BINLOG_PURGE_EMFILE 1587
#define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588
#define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589
//#define OBSOLETE_ER_SLAVE_INCIDENT 1590
#define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591
#define ER_BINLOG_UNSAFE_STATEMENT 1592
#define ER_BINLOG_FATAL_ERROR 1593
//#define OBSOLETE_ER_SLAVE_RELAY_LOG_READ_FAILURE 1594
//#define OBSOLETE_ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595
//#define OBSOLETE_ER_SLAVE_CREATE_EVENT_FAILURE 1596
//#define OBSOLETE_ER_SLAVE_MASTER_COM_FAILURE 1597
#define ER_BINLOG_LOGGING_IMPOSSIBLE 1598
#define ER_VIEW_NO_CREATION_CTX 1599
#define ER_VIEW_INVALID_CREATION_CTX 1600
//#define OBSOLETE_ER_SR_INVALID_CREATION_CTX 1601
#define ER_TRG_CORRUPTED_FILE 1602
#define ER_TRG_NO_CREATION_CTX 1603
#define ER_TRG_INVALID_CREATION_CTX 1604
#define ER_EVENT_INVALID_CREATION_CTX 1605
#define ER_TRG_CANT_OPEN_TABLE 1606
//#define OBSOLETE_ER_CANT_CREATE_SROUTINE 1607
//#define OBSOLETE_ER_NEVER_USED 1608
#define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609
#define ER_REPLICA_CORRUPT_EVENT 1610
//#define OBSOLETE_ER_LOAD_DATA_INVALID_COLUMN_UNUSED 1611
#define ER_LOG_PURGE_NO_FILE 1612
#define ER_XA_RBTIMEOUT 1613
#define ER_XA_RBDEADLOCK 1614
#define ER_NEED_REPREPARE 1615
//#define OBSOLETE_ER_DELAYED_NOT_SUPPORTED 1616
#define WARN_NO_CONNECTION_METADATA 1617
#define WARN_OPTION_IGNORED 1618
#define ER_PLUGIN_DELETE_BUILTIN 1619
#define WARN_PLUGIN_BUSY 1620
#define ER_VARIABLE_IS_READONLY 1621
#define ER_WARN_ENGINE_TRANSACTION_ROLLBACK 1622
//#define OBSOLETE_ER_SLAVE_HEARTBEAT_FAILURE 1623
#define ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE 1624
#define ER_NDB_REPLICATION_SCHEMA_ERROR 1625
#define ER_CONFLICT_FN_PARSE_ERROR 1626
#define ER_EXCEPTIONS_WRITE_ERROR 1627
#define ER_TOO_LONG_TABLE_COMMENT 1628
#define ER_TOO_LONG_FIELD_COMMENT 1629
#define ER_FUNC_INEXISTENT_NAME_COLLISION 1630
#define ER_DATABASE_NAME 1631
#define ER_TABLE_NAME 1632
#define ER_PARTITION_NAME 1633
#define ER_SUBPARTITION_NAME 1634
#define ER_TEMPORARY_NAME 1635
#define ER_RENAMED_NAME 1636
#define ER_TOO_MANY_CONCURRENT_TRXS 1637
#define WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED 1638
#define ER_DEBUG_SYNC_TIMEOUT 1639
#define ER_DEBUG_SYNC_HIT_LIMIT 1640
#define ER_DUP_SIGNAL_SET 1641
#define ER_SIGNAL_WARN 1642
#define ER_SIGNAL_NOT_FOUND 1643
#define ER_SIGNAL_EXCEPTION 1644
#define ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 1645
#define ER_SIGNAL_BAD_CONDITION_TYPE 1646
#define WARN_COND_ITEM_TRUNCATED 1647
#define ER_COND_ITEM_TOO_LONG 1648
#define ER_UNKNOWN_LOCALE 1649
#define ER_REPLICA_IGNORE_SERVER_IDS 1650
//#define OBSOLETE_ER_QUERY_CACHE_DISABLED 1651
#define ER_SAME_NAME_PARTITION_FIELD 1652
#define ER_PARTITION_COLUMN_LIST_ERROR 1653
#define ER_WRONG_TYPE_COLUMN_VALUE_ERROR 1654
#define ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR 1655
#define ER_MAXVALUE_IN_VALUES_IN 1656
#define ER_TOO_MANY_VALUES_ERROR 1657
#define ER_ROW_SINGLE_PARTITION_FIELD_ERROR 1658
#define ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD 1659
#define ER_PARTITION_FIELDS_TOO_LONG 1660
#define ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE 1661
#define ER_BINLOG_ROW_MODE_AND_STMT_ENGINE 1662
#define ER_BINLOG_UNSAFE_AND_STMT_ENGINE 1663
#define ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE 1664
#define ER_BINLOG_STMT_MODE_AND_ROW_ENGINE 1665
#define ER_BINLOG_ROW_INJECTION_AND_STMT_MODE 1666
#define ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1667
#define ER_BINLOG_UNSAFE_LIMIT 1668
//#define OBSOLETE_ER_UNUSED4 1669
#define ER_BINLOG_UNSAFE_SYSTEM_TABLE 1670
#define ER_BINLOG_UNSAFE_AUTOINC_COLUMNS 1671
#define ER_BINLOG_UNSAFE_UDF 1672
#define ER_BINLOG_UNSAFE_SYSTEM_VARIABLE 1673
#define ER_BINLOG_UNSAFE_SYSTEM_FUNCTION 1674
#define ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS 1675
#define ER_MESSAGE_AND_STATEMENT 1676
//#define OBSOLETE_ER_SLAVE_CONVERSION_FAILED 1677
#define ER_REPLICA_CANT_CREATE_CONVERSION 1678
#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT 1679
#define ER_PATH_LENGTH 1680
#define ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT 1681
#define ER_WRONG_NATIVE_TABLE_STRUCTURE 1682
#define ER_WRONG_PERFSCHEMA_USAGE 1683
#define ER_WARN_I_S_SKIPPED_TABLE 1684
#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT 1685
#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT 1686
#define ER_SPATIAL_MUST_HAVE_GEOM_COL 1687
#define ER_TOO_LONG_INDEX_COMMENT 1688
#define ER_LOCK_ABORTED 1689
#define ER_DATA_OUT_OF_RANGE 1690
//#define OBSOLETE_ER_WRONG_SPVAR_TYPE_IN_LIMIT 1691
#define ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1692
#define ER_BINLOG_UNSAFE_MIXED_STATEMENT 1693
#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN 1694
#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN 1695
#define ER_FAILED_READ_FROM_PAR_FILE 1696
#define ER_VALUES_IS_NOT_INT_TYPE_ERROR 1697
#define ER_ACCESS_DENIED_NO_PASSWORD_ERROR 1698
//#define OBSOLETE_ER_SET_PASSWORD_AUTH_PLUGIN 1699
//#define OBSOLETE_ER_GRANT_PLUGIN_USER_EXISTS 1700
#define ER_TRUNCATE_ILLEGAL_FK 1701
#define ER_PLUGIN_IS_PERMANENT 1702
#define ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN 1703
#define ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX 1704
#define ER_STMT_CACHE_FULL 1705
#define ER_MULTI_UPDATE_KEY_CONFLICT 1706
#define ER_TABLE_NEEDS_REBUILD 1707
#define WARN_OPTION_BELOW_LIMIT 1708
#define ER_INDEX_COLUMN_TOO_LONG 1709
#define ER_ERROR_IN_TRIGGER_BODY 1710
#define ER_ERROR_IN_UNKNOWN_TRIGGER_BODY 1711
#define ER_INDEX_CORRUPT 1712
#define ER_UNDO_RECORD_TOO_BIG 1713
#define ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT 1714
#define ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE 1715
#define ER_BINLOG_UNSAFE_REPLACE_SELECT 1716
#define ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT 1717
#define ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT 1718
#define ER_BINLOG_UNSAFE_UPDATE_IGNORE 1719
#define ER_PLUGIN_NO_UNINSTALL 1720
#define ER_PLUGIN_NO_INSTALL 1721
#define ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT 1722
#define ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC 1723
#define ER_BINLOG_UNSAFE_INSERT_TWO_KEYS 1724
#define ER_TABLE_IN_FK_CHECK 1725
#define ER_UNSUPPORTED_ENGINE 1726
#define ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST 1727
#define ER_CANNOT_LOAD_FROM_TABLE_V2 1728
#define ER_SOURCE_DELAY_VALUE_OUT_OF_RANGE 1729
#define ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT 1730
#define ER_PARTITION_EXCHANGE_DIFFERENT_OPTION 1731
#define ER_PARTITION_EXCHANGE_PART_TABLE 1732
#define ER_PARTITION_EXCHANGE_TEMP_TABLE 1733
#define ER_PARTITION_INSTEAD_OF_SUBPARTITION 1734
#define ER_UNKNOWN_PARTITION 1735
#define ER_TABLES_DIFFERENT_METADATA 1736
#define ER_ROW_DOES_NOT_MATCH_PARTITION 1737
#define ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX 1738
#define ER_WARN_INDEX_NOT_APPLICABLE 1739
#define ER_PARTITION_EXCHANGE_FOREIGN_KEY 1740
//#define OBSOLETE_ER_NO_SUCH_KEY_VALUE 1741
#define ER_RPL_INFO_DATA_TOO_LONG 1742
//#define OBSOLETE_ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 1743
//#define OBSOLETE_ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE 1744
#define ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX 1745
#define ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT 1746
#define ER_PARTITION_CLAUSE_ON_NONPARTITIONED 1747
#define ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET 1748
//#define OBSOLETE_ER_NO_SUCH_PARTITION__UNUSED 1749
#define ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE 1750
#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE 1751
#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE 1752
#define ER_MTA_FEATURE_IS_NOT_SUPPORTED 1753
#define ER_MTA_UPDATED_DBS_GREATER_MAX 1754
#define ER_MTA_CANT_PARALLEL 1755
#define ER_MTA_INCONSISTENT_DATA 1756
#define ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING 1757
#define ER_DA_INVALID_CONDITION_NUMBER 1758
#define ER_INSECURE_PLAIN_TEXT 1759
#define ER_INSECURE_CHANGE_SOURCE 1760
#define ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 1761
#define ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 1762
#define ER_SQLTHREAD_WITH_SECURE_REPLICA 1763
#define ER_TABLE_HAS_NO_FT 1764
#define ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER 1765
#define ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION 1766
//#define OBSOLETE_ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST 1767
//#define OBSOLETE_ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION 1768
#define ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION 1769
#define ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL 1770
//#define OBSOLETE_ER_SKIPPING_LOGGED_TRANSACTION 1771
#define ER_MALFORMED_GTID_SET_SPECIFICATION 1772
#define ER_MALFORMED_GTID_SET_ENCODING 1773
#define ER_MALFORMED_GTID_SPECIFICATION 1774
#define ER_GNO_EXHAUSTED 1775
#define ER_BAD_REPLICA_AUTO_POSITION 1776
#define ER_AUTO_POSITION_REQUIRES_GTID_MODE_NOT_OFF 1777
#define ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET 1778
#define ER_GTID_MODE_ON_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 1779
//#define OBSOLETE_ER_GTID_MODE_REQUIRES_BINLOG 1780
#define ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF 1781
#define ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON 1782
#define ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF 1783
//#define OBSOLETE_ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED 1784
#define ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE 1785
#define ER_GTID_UNSAFE_CREATE_SELECT 1786
//#define OBSOLETE_ER_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRANSACTION 1787
#define ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME 1788
#define ER_SOURCE_HAS_PURGED_REQUIRED_GTIDS 1789
#define ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID 1790
#define ER_UNKNOWN_EXPLAIN_FORMAT 1791
#define ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 1792
#define ER_TOO_LONG_TABLE_PARTITION_COMMENT 1793
#define ER_REPLICA_CONFIGURATION 1794
#define ER_INNODB_FT_LIMIT 1795
#define ER_INNODB_NO_FT_TEMP_TABLE 1796
#define ER_INNODB_FT_WRONG_DOCID_COLUMN 1797
#define ER_INNODB_FT_WRONG_DOCID_INDEX 1798
#define ER_INNODB_ONLINE_LOG_TOO_BIG 1799
#define ER_UNKNOWN_ALTER_ALGORITHM 1800
#define ER_UNKNOWN_ALTER_LOCK 1801
#define ER_MTA_CHANGE_SOURCE_CANT_RUN_WITH_GAPS 1802
#define ER_MTA_RECOVERY_FAILURE 1803
#define ER_MTA_RESET_WORKERS 1804
#define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805
#define ER_REPLICA_SILENT_RETRY_TRANSACTION 1806
#define ER_DISCARD_FK_CHECKS_RUNNING 1807
#define ER_TABLE_SCHEMA_MISMATCH 1808
#define ER_TABLE_IN_SYSTEM_TABLESPACE 1809
#define ER_IO_READ_ERROR 1810
#define ER_IO_WRITE_ERROR 1811
#define ER_TABLESPACE_MISSING 1812
#define ER_TABLESPACE_EXISTS 1813
#define ER_TABLESPACE_DISCARDED 1814
#define ER_INTERNAL_ERROR 1815
#define ER_INNODB_IMPORT_ERROR 1816
#define ER_INNODB_INDEX_CORRUPT 1817
#define ER_INVALID_YEAR_COLUMN_LENGTH 1818
#define ER_NOT_VALID_PASSWORD 1819
#define ER_MUST_CHANGE_PASSWORD 1820
#define ER_FK_NO_INDEX_CHILD 1821
#define ER_FK_NO_INDEX_PARENT 1822
#define ER_FK_FAIL_ADD_SYSTEM 1823
#define ER_FK_CANNOT_OPEN_PARENT 1824
#define ER_FK_INCORRECT_OPTION 1825
#define ER_FK_DUP_NAME 1826
#define ER_PASSWORD_FORMAT 1827
#define ER_FK_COLUMN_CANNOT_DROP 1828
#define ER_FK_COLUMN_CANNOT_DROP_CHILD 1829
#define ER_FK_COLUMN_NOT_NULL 1830
#define ER_DUP_INDEX 1831
#define ER_FK_COLUMN_CANNOT_CHANGE 1832
#define ER_FK_COLUMN_CANNOT_CHANGE_CHILD 1833
//#define OBSOLETE_ER_UNUSED5 1834
#define ER_MALFORMED_PACKET 1835
#define ER_READ_ONLY_MODE 1836
#define ER_GTID_NEXT_TYPE_UNDEFINED_GTID 1837
#define ER_VARIABLE_NOT_SETTABLE_IN_SP 1838
//#define OBSOLETE_ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF 1839
#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY 1840
#define ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY 1841
#define ER_GTID_PURGED_WAS_CHANGED 1842
#define ER_GTID_EXECUTED_WAS_CHANGED 1843
#define ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES 1844
#define ER_ALTER_OPERATION_NOT_SUPPORTED 1845
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 1846
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY 1847
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION 1848
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME 1849
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE 1850
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK 1851
//#define OBSOLETE_ER_UNUSED6 1852
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK 1853
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC 1854
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS 1855
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS 1856
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS 1857
//#define OBSOLETE_ER_SQL_REPLICA_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE 1858
#define ER_DUP_UNKNOWN_IN_INDEX 1859
#define ER_IDENT_CAUSES_TOO_LONG_PATH 1860
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL 1861
#define ER_MUST_CHANGE_PASSWORD_LOGIN 1862
#define ER_ROW_IN_WRONG_PARTITION 1863
#define ER_MTA_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX 1864
//#define OBSOLETE_ER_INNODB_NO_FT_USES_PARSER 1865
#define ER_BINLOG_LOGICAL_CORRUPTION 1866
#define ER_WARN_PURGE_LOG_IN_USE 1867
#define ER_WARN_PURGE_LOG_IS_ACTIVE 1868
#define ER_AUTO_INCREMENT_CONFLICT 1869
#define WARN_ON_BLOCKHOLE_IN_RBR 1870
#define ER_REPLICA_CM_INIT_REPOSITORY 1871
#define ER_REPLICA_AM_INIT_REPOSITORY 1872
#define ER_ACCESS_DENIED_CHANGE_USER_ERROR 1873
#define ER_INNODB_READ_ONLY 1874
#define ER_STOP_REPLICA_SQL_THREAD_TIMEOUT 1875
#define ER_STOP_REPLICA_IO_THREAD_TIMEOUT 1876
#define ER_TABLE_CORRUPT 1877
#define ER_TEMP_FILE_WRITE_FAILURE 1878
#define ER_INNODB_FT_AUX_NOT_HEX_ID 1879
#define ER_OLD_TEMPORALS_UPGRADED 1880
#define ER_INNODB_FORCED_RECOVERY 1881
#define ER_AES_INVALID_IV 1882
#define ER_PLUGIN_CANNOT_BE_UNINSTALLED 1883
#define ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_ASSIGNED_GTID 1884
#define ER_REPLICA_HAS_MORE_GTIDS_THAN_SOURCE 1885
#define ER_MISSING_KEY 1886
#define WARN_NAMED_PIPE_ACCESS_EVERYONE 1887
#define ER_FILE_CORRUPT 3000
#define ER_ERROR_ON_SOURCE 3001
//#define OBSOLETE_ER_INCONSISTENT_ERROR 3002
#define ER_STORAGE_ENGINE_NOT_LOADED 3003
#define ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 3004
#define ER_WARN_LEGACY_SYNTAX_CONVERTED 3005
#define ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN 3006
#define ER_CANNOT_DISCARD_TEMPORARY_TABLE 3007
#define ER_FK_DEPTH_EXCEEDED 3008
#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 3009
#define ER_WARN_TRIGGER_DOESNT_HAVE_CREATED 3010
#define ER_REFERENCED_TRG_DOES_NOT_EXIST 3011
#define ER_EXPLAIN_NOT_SUPPORTED 3012
#define ER_INVALID_FIELD_SIZE 3013
#define ER_MISSING_HA_CREATE_OPTION 3014
#define ER_ENGINE_OUT_OF_MEMORY 3015
#define ER_PASSWORD_EXPIRE_ANONYMOUS_USER 3016
#define ER_REPLICA_SQL_THREAD_MUST_STOP 3017
#define ER_NO_FT_MATERIALIZED_SUBQUERY 3018
#define ER_INNODB_UNDO_LOG_FULL 3019
#define ER_INVALID_ARGUMENT_FOR_LOGARITHM 3020
#define ER_REPLICA_CHANNEL_IO_THREAD_MUST_STOP 3021
#define ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO 3022
#define ER_WARN_ONLY_SOURCE_LOG_FILE_NO_POS 3023
#define ER_QUERY_TIMEOUT 3024
#define ER_NON_RO_SELECT_DISABLE_TIMER 3025
#define ER_DUP_LIST_ENTRY 3026
//#define OBSOLETE_ER_SQL_MODE_NO_EFFECT 3027
#define ER_AGGREGATE_ORDER_FOR_UNION 3028
#define ER_AGGREGATE_ORDER_NON_AGG_QUERY 3029
#define ER_REPLICA_WORKER_STOPPED_PREVIOUS_THD_ERROR 3030
#define ER_DONT_SUPPORT_REPLICA_PRESERVE_COMMIT_ORDER 3031
#define ER_SERVER_OFFLINE_MODE 3032
#define ER_GIS_DIFFERENT_SRIDS 3033
#define ER_GIS_UNSUPPORTED_ARGUMENT 3034
#define ER_GIS_UNKNOWN_ERROR 3035
#define ER_GIS_UNKNOWN_EXCEPTION 3036
#define ER_GIS_INVALID_DATA 3037
#define ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION 3038
#define ER_BOOST_GEOMETRY_CENTROID_EXCEPTION 3039
#define ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION 3040
#define ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION 3041
#define ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION 3042
#define ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION 3043
#define ER_STD_BAD_ALLOC_ERROR 3044
#define ER_STD_DOMAIN_ERROR 3045
#define ER_STD_LENGTH_ERROR 3046
#define ER_STD_INVALID_ARGUMENT 3047
#define ER_STD_OUT_OF_RANGE_ERROR 3048
#define ER_STD_OVERFLOW_ERROR 3049
#define ER_STD_RANGE_ERROR 3050
#define ER_STD_UNDERFLOW_ERROR 3051
#define ER_STD_LOGIC_ERROR 3052
#define ER_STD_RUNTIME_ERROR 3053
#define ER_STD_UNKNOWN_EXCEPTION 3054
#define ER_GIS_DATA_WRONG_ENDIANESS 3055
#define ER_CHANGE_SOURCE_PASSWORD_LENGTH 3056
#define ER_USER_LOCK_WRONG_NAME 3057
#define ER_USER_LOCK_DEADLOCK 3058
#define ER_REPLACE_INACCESSIBLE_ROWS 3059
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS 3060
#define ER_ILLEGAL_USER_VAR 3061
#define ER_GTID_MODE_OFF 3062
//#define OBSOLETE_ER_UNSUPPORTED_BY_REPLICATION_THREAD 3063
#define ER_INCORRECT_TYPE 3064
#define ER_FIELD_IN_ORDER_NOT_SELECT 3065
#define ER_AGGREGATE_IN_ORDER_NOT_SELECT 3066
#define ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN 3067
#define ER_NET_OK_PACKET_TOO_LARGE 3068
#define ER_INVALID_JSON_DATA 3069
#define ER_INVALID_GEOJSON_MISSING_MEMBER 3070
#define ER_INVALID_GEOJSON_WRONG_TYPE 3071
#define ER_INVALID_GEOJSON_UNSPECIFIED 3072
#define ER_DIMENSION_UNSUPPORTED 3073
#define ER_REPLICA_CHANNEL_DOES_NOT_EXIST 3074
//#define OBSOLETE_ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT 3075
#define ER_REPLICA_CHANNEL_NAME_INVALID_OR_TOO_LONG 3076
#define ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY 3077
//#define OBSOLETE_ER_SLAVE_CHANNEL_DELETE 3078
#define ER_REPLICA_MULTIPLE_CHANNELS_CMD 3079
#define ER_REPLICA_MAX_CHANNELS_EXCEEDED 3080
#define ER_REPLICA_CHANNEL_MUST_STOP 3081
#define ER_REPLICA_CHANNEL_NOT_RUNNING 3082
#define ER_REPLICA_CHANNEL_WAS_RUNNING 3083
#define ER_REPLICA_CHANNEL_WAS_NOT_RUNNING 3084
#define ER_REPLICA_CHANNEL_SQL_THREAD_MUST_STOP 3085
#define ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER 3086
#define ER_WRONG_FIELD_WITH_GROUP_V2 3087
#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS_V2 3088
#define ER_WARN_DEPRECATED_SYSVAR_UPDATE 3089
#define ER_WARN_DEPRECATED_SQLMODE 3090
#define ER_CANNOT_LOG_PARTIAL_DROP_DATABASE_WITH_GTID 3091
#define ER_GROUP_REPLICATION_CONFIGURATION 3092
#define ER_GROUP_REPLICATION_RUNNING 3093
#define ER_GROUP_REPLICATION_APPLIER_INIT_ERROR 3094
#define ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT 3095
#define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR 3096
#define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR 3097
#define ER_BEFORE_DML_VALIDATION_ERROR 3098
#define ER_PREVENTS_VARIABLE_WITHOUT_RBR 3099
#define ER_RUN_HOOK_ERROR 3100
#define ER_TRANSACTION_ROLLBACK_DURING_COMMIT 3101
#define ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED 3102
#define ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN 3103
#define ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN 3104
#define ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN 3105
#define ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN 3106
#define ER_GENERATED_COLUMN_NON_PRIOR 3107
#define ER_DEPENDENT_BY_GENERATED_COLUMN 3108
#define ER_GENERATED_COLUMN_REF_AUTO_INC 3109
#define ER_FEATURE_NOT_AVAILABLE 3110
#define ER_CANT_SET_GTID_MODE 3111
#define ER_CANT_USE_AUTO_POSITION_WITH_GTID_MODE_OFF 3112
//#define OBSOLETE_ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION 3113
//#define OBSOLETE_ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON 3114
//#define OBSOLETE_ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF 3115
#define ER_CANT_ENFORCE_GTID_CONSISTENCY_WITH_ONGOING_GTID_VIOLATING_TX 3116
#define ER_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TX 3117
#define ER_ACCOUNT_HAS_BEEN_LOCKED 3118
#define ER_WRONG_TABLESPACE_NAME 3119
#define ER_TABLESPACE_IS_NOT_EMPTY 3120
#define ER_WRONG_FILE_NAME 3121
#define ER_BOOST_GEOMETRY_INCONSISTENT_TURNS_EXCEPTION 3122
#define ER_WARN_OPTIMIZER_HINT_SYNTAX_ERROR 3123
#define ER_WARN_BAD_MAX_EXECUTION_TIME 3124
#define ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME 3125
#define ER_WARN_CONFLICTING_HINT 3126
#define ER_WARN_UNKNOWN_QB_NAME 3127
#define ER_UNRESOLVED_HINT_NAME 3128
#define ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE 3129
#define ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED 3130
#define ER_LOCKING_SERVICE_WRONG_NAME 3131
#define ER_LOCKING_SERVICE_DEADLOCK 3132
#define ER_LOCKING_SERVICE_TIMEOUT 3133
#define ER_GIS_MAX_POINTS_IN_GEOMETRY_OVERFLOWED 3134
#define ER_SQL_MODE_MERGED 3135
#define ER_VTOKEN_PLUGIN_TOKEN_MISMATCH 3136
#define ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND 3137
#define ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID 3138
#define ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED 3139
#define ER_INVALID_JSON_TEXT 3140
#define ER_INVALID_JSON_TEXT_IN_PARAM 3141
#define ER_INVALID_JSON_BINARY_DATA 3142
#define ER_INVALID_JSON_PATH 3143
#define ER_INVALID_JSON_CHARSET 3144
#define ER_INVALID_JSON_CHARSET_IN_FUNCTION 3145
#define ER_INVALID_TYPE_FOR_JSON 3146
#define ER_INVALID_CAST_TO_JSON 3147
#define ER_INVALID_JSON_PATH_CHARSET 3148
#define ER_INVALID_JSON_PATH_WILDCARD 3149
#define ER_JSON_VALUE_TOO_BIG 3150
#define ER_JSON_KEY_TOO_BIG 3151
#define ER_JSON_USED_AS_KEY 3152
#define ER_JSON_VACUOUS_PATH 3153
#define ER_JSON_BAD_ONE_OR_ALL_ARG 3154
#define ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE 3155
#define ER_INVALID_JSON_VALUE_FOR_CAST 3156
#define ER_JSON_DOCUMENT_TOO_DEEP 3157
#define ER_JSON_DOCUMENT_NULL_KEY 3158
#define ER_SECURE_TRANSPORT_REQUIRED 3159
#define ER_NO_SECURE_TRANSPORTS_CONFIGURED 3160
#define ER_DISABLED_STORAGE_ENGINE 3161
#define ER_USER_DOES_NOT_EXIST 3162
#define ER_USER_ALREADY_EXISTS 3163
#define ER_AUDIT_API_ABORT 3164
#define ER_INVALID_JSON_PATH_ARRAY_CELL 3165
#define ER_BUFPOOL_RESIZE_INPROGRESS 3166
#define ER_FEATURE_DISABLED_SEE_DOC 3167
#define ER_SERVER_ISNT_AVAILABLE 3168
#define ER_SESSION_WAS_KILLED 3169
#define ER_CAPACITY_EXCEEDED 3170
#define ER_CAPACITY_EXCEEDED_IN_RANGE_OPTIMIZER 3171
//#define OBSOLETE_ER_TABLE_NEEDS_UPG_PART 3172
#define ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID 3173
#define ER_CANNOT_ADD_FOREIGN_BASE_COL_VIRTUAL 3174
#define ER_CANNOT_CREATE_VIRTUAL_INDEX_CONSTRAINT 3175
#define ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE 3176
#define ER_LOCK_REFUSED_BY_ENGINE 3177
#define ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN 3178
#define ER_MASTER_KEY_ROTATION_NOT_SUPPORTED_BY_SE 3179
//#define OBSOLETE_ER_MASTER_KEY_ROTATION_ERROR_BY_SE 3180
#define ER_MASTER_KEY_ROTATION_BINLOG_FAILED 3181
#define ER_MASTER_KEY_ROTATION_SE_UNAVAILABLE 3182
#define ER_TABLESPACE_CANNOT_ENCRYPT 3183
#define ER_INVALID_ENCRYPTION_OPTION 3184
#define ER_CANNOT_FIND_KEY_IN_KEYRING 3185
#define ER_CAPACITY_EXCEEDED_IN_PARSER 3186
#define ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE 3187
#define ER_KEYRING_UDF_KEYRING_SERVICE_ERROR 3188
#define ER_USER_COLUMN_OLD_LENGTH 3189
#define ER_CANT_RESET_SOURCE 3190
#define ER_GROUP_REPLICATION_MAX_GROUP_SIZE 3191
#define ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED 3192
#define ER_TABLE_REFERENCED 3193
//#define OBSOLETE_ER_PARTITION_ENGINE_DEPRECATED_FOR_TABLE 3194
//#define OBSOLETE_ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID_ZERO 3195
//#define OBSOLETE_ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID 3196
#define ER_XA_RETRY 3197
#define ER_KEYRING_AWS_UDF_AWS_KMS_ERROR 3198
#define ER_BINLOG_UNSAFE_XA 3199
#define ER_UDF_ERROR 3200
#define ER_KEYRING_MIGRATION_FAILURE 3201
#define ER_KEYRING_ACCESS_DENIED_ERROR 3202
#define ER_KEYRING_MIGRATION_STATUS 3203
//#define OBSOLETE_ER_PLUGIN_FAILED_TO_OPEN_TABLES 3204
//#define OBSOLETE_ER_PLUGIN_FAILED_TO_OPEN_TABLE 3205
//#define OBSOLETE_ER_AUDIT_LOG_NO_KEYRING_PLUGIN_INSTALLED 3206
//#define OBSOLETE_ER_AUDIT_LOG_ENCRYPTION_PASSWORD_HAS_NOT_BEEN_SET 3207
//#define OBSOLETE_ER_AUDIT_LOG_COULD_NOT_CREATE_AES_KEY 3208
//#define OBSOLETE_ER_AUDIT_LOG_ENCRYPTION_PASSWORD_CANNOT_BE_FETCHED 3209
//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTERING_NOT_ENABLED 3210
//#define OBSOLETE_ER_AUDIT_LOG_UDF_INSUFFICIENT_PRIVILEGE 3211
//#define OBSOLETE_ER_AUDIT_LOG_SUPER_PRIVILEGE_REQUIRED 3212
//#define OBSOLETE_ER_COULD_NOT_REINITIALIZE_AUDIT_LOG_FILTERS 3213
//#define OBSOLETE_ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_TYPE 3214
//#define OBSOLETE_ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT 3215
//#define OBSOLETE_ER_AUDIT_LOG_HAS_NOT_BEEN_INSTALLED 3216
//#define OBSOLETE_ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE 3217
#define ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_VALUE 3218
//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTER_PARSING_ERROR 3219
//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTER_NAME_CANNOT_BE_EMPTY 3220
//#define OBSOLETE_ER_AUDIT_LOG_JSON_USER_NAME_CANNOT_BE_EMPTY 3221
//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXISTS 3222
//#define OBSOLETE_ER_AUDIT_LOG_USER_FIRST_CHARACTER_MUST_BE_ALPHANUMERIC 3223
//#define OBSOLETE_ER_AUDIT_LOG_USER_NAME_INVALID_CHARACTER 3224
//#define OBSOLETE_ER_AUDIT_LOG_HOST_NAME_INVALID_CHARACTER 3225
#define OBSOLETE_WARN_DEPRECATED_MAXDB_SQL_MODE_FOR_TIMESTAMP 3226
//#define OBSOLETE_ER_XA_REPLICATION_FILTERS 3227
//#define OBSOLETE_ER_CANT_OPEN_ERROR_LOG 3228
//#define OBSOLETE_ER_GROUPING_ON_TIMESTAMP_IN_DST 3229
//#define OBSOLETE_ER_CANT_START_SERVER_NAMED_PIPE 3230
#define ER_WRITE_SET_EXCEEDS_LIMIT 3231
//#define OBSOLETE_ER_DEPRECATED_TLS_VERSION_SESSION_57 3232
//#define OBSOLETE_ER_WARN_DEPRECATED_TLS_VERSION_57 3233
//#define OBSOLETE_ER_WARN_WRONG_NATIVE_TABLE_STRUCTURE 3234
#define ER_AES_INVALID_KDF_NAME 3235
#define ER_AES_INVALID_KDF_ITERATIONS 3236
#define WARN_AES_KEY_SIZE 3237
#define ER_AES_INVALID_KDF_OPTION_SIZE 3238
#define ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE 3500
#define ER_ACL_OPERATION_FAILED 3501
#define ER_UNSUPPORTED_INDEX_ALGORITHM 3502
#define ER_NO_SUCH_DB 3503
#define ER_TOO_BIG_ENUM 3504
#define ER_TOO_LONG_SET_ENUM_VALUE 3505
#define ER_INVALID_DD_OBJECT 3506
#define ER_UPDATING_DD_TABLE 3507
#define ER_INVALID_DD_OBJECT_ID 3508
#define ER_INVALID_DD_OBJECT_NAME 3509
#define ER_TABLESPACE_MISSING_WITH_NAME 3510
#define ER_TOO_LONG_ROUTINE_COMMENT 3511
#define ER_SP_LOAD_FAILED 3512
#define ER_INVALID_BITWISE_OPERANDS_SIZE 3513
#define ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE 3514
#define ER_WARN_UNSUPPORTED_HINT 3515
#define ER_UNEXPECTED_GEOMETRY_TYPE 3516
#define ER_SRS_PARSE_ERROR 3517
#define ER_SRS_PROJ_PARAMETER_MISSING 3518
#define ER_WARN_SRS_NOT_FOUND 3519
#define ER_SRS_NOT_CARTESIAN 3520
#define ER_SRS_NOT_CARTESIAN_UNDEFINED 3521
#define ER_PK_INDEX_CANT_BE_INVISIBLE 3522
#define ER_UNKNOWN_AUTHID 3523
#define ER_FAILED_ROLE_GRANT 3524
#define ER_OPEN_ROLE_TABLES 3525
#define ER_FAILED_DEFAULT_ROLES 3526
#define ER_COMPONENTS_NO_SCHEME 3527
#define ER_COMPONENTS_NO_SCHEME_SERVICE 3528
#define ER_COMPONENTS_CANT_LOAD 3529
#define ER_ROLE_NOT_GRANTED 3530
#define ER_FAILED_REVOKE_ROLE 3531
#define ER_RENAME_ROLE 3532
#define ER_COMPONENTS_CANT_ACQUIRE_SERVICE_IMPLEMENTATION 3533
#define ER_COMPONENTS_CANT_SATISFY_DEPENDENCY 3534
#define ER_COMPONENTS_LOAD_CANT_REGISTER_SERVICE_IMPLEMENTATION 3535
#define ER_COMPONENTS_LOAD_CANT_INITIALIZE 3536
#define ER_COMPONENTS_UNLOAD_NOT_LOADED 3537
#define ER_COMPONENTS_UNLOAD_CANT_DEINITIALIZE 3538
#define ER_COMPONENTS_CANT_RELEASE_SERVICE 3539
#define ER_COMPONENTS_UNLOAD_CANT_UNREGISTER_SERVICE 3540
#define ER_COMPONENTS_CANT_UNLOAD 3541
#define ER_WARN_UNLOAD_THE_NOT_PERSISTED 3542
#define ER_COMPONENT_TABLE_INCORRECT 3543
#define ER_COMPONENT_MANIPULATE_ROW_FAILED 3544
#define ER_COMPONENTS_UNLOAD_DUPLICATE_IN_GROUP 3545
#define ER_CANT_SET_GTID_PURGED_DUE_SETS_CONSTRAINTS 3546
#define ER_CANNOT_LOCK_USER_MANAGEMENT_CACHES 3547
#define ER_SRS_NOT_FOUND 3548
#define ER_VARIABLE_NOT_PERSISTED 3549
#define ER_IS_QUERY_INVALID_CLAUSE 3550
#define ER_UNABLE_TO_STORE_STATISTICS 3551
#define ER_NO_SYSTEM_SCHEMA_ACCESS 3552
#define ER_NO_SYSTEM_TABLESPACE_ACCESS 3553
#define ER_NO_SYSTEM_TABLE_ACCESS 3554
#define ER_NO_SYSTEM_TABLE_ACCESS_FOR_DICTIONARY_TABLE 3555
#define ER_NO_SYSTEM_TABLE_ACCESS_FOR_SYSTEM_TABLE 3556
#define ER_NO_SYSTEM_TABLE_ACCESS_FOR_TABLE 3557
#define ER_INVALID_OPTION_KEY 3558
#define ER_INVALID_OPTION_VALUE 3559
#define ER_INVALID_OPTION_KEY_VALUE_PAIR 3560
#define ER_INVALID_OPTION_START_CHARACTER 3561
#define ER_INVALID_OPTION_END_CHARACTER 3562
#define ER_INVALID_OPTION_CHARACTERS 3563
#define ER_DUPLICATE_OPTION_KEY 3564
#define ER_WARN_SRS_NOT_FOUND_AXIS_ORDER 3565
#define ER_NO_ACCESS_TO_NATIVE_FCT 3566
#define ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE 3567
#define ER_UNRESOLVED_TABLE_LOCK 3568
#define ER_DUPLICATE_TABLE_LOCK 3569
#define ER_BINLOG_UNSAFE_SKIP_LOCKED 3570
#define ER_BINLOG_UNSAFE_NOWAIT 3571
#define ER_LOCK_NOWAIT 3572
#define ER_CTE_RECURSIVE_REQUIRES_UNION 3573
#define ER_CTE_RECURSIVE_REQUIRES_NONRECURSIVE_FIRST 3574
#define ER_CTE_RECURSIVE_FORBIDS_AGGREGATION 3575
#define ER_CTE_RECURSIVE_FORBIDDEN_JOIN_ORDER 3576
#define ER_CTE_RECURSIVE_REQUIRES_SINGLE_REFERENCE 3577
#define ER_SWITCH_TMP_ENGINE 3578
#define ER_WINDOW_NO_SUCH_WINDOW 3579
#define ER_WINDOW_CIRCULARITY_IN_WINDOW_GRAPH 3580
#define ER_WINDOW_NO_CHILD_PARTITIONING 3581
#define ER_WINDOW_NO_INHERIT_FRAME 3582
#define ER_WINDOW_NO_REDEFINE_ORDER_BY 3583
#define ER_WINDOW_FRAME_START_ILLEGAL 3584
#define ER_WINDOW_FRAME_END_ILLEGAL 3585
#define ER_WINDOW_FRAME_ILLEGAL 3586
#define ER_WINDOW_RANGE_FRAME_ORDER_TYPE 3587
#define ER_WINDOW_RANGE_FRAME_TEMPORAL_TYPE 3588
#define ER_WINDOW_RANGE_FRAME_NUMERIC_TYPE 3589
#define ER_WINDOW_RANGE_BOUND_NOT_CONSTANT 3590
#define ER_WINDOW_DUPLICATE_NAME 3591
#define ER_WINDOW_ILLEGAL_ORDER_BY 3592
#define ER_WINDOW_INVALID_WINDOW_FUNC_USE 3593
#define ER_WINDOW_INVALID_WINDOW_FUNC_ALIAS_USE 3594
#define ER_WINDOW_NESTED_WINDOW_FUNC_USE_IN_WINDOW_SPEC 3595
#define ER_WINDOW_ROWS_INTERVAL_USE 3596
#define ER_WINDOW_NO_GROUP_ORDER_UNUSED 3597
#define ER_WINDOW_EXPLAIN_JSON 3598
#define ER_WINDOW_FUNCTION_IGNORES_FRAME 3599
#define ER_WL9236_NOW_UNUSED 3600
#define ER_INVALID_NO_OF_ARGS 3601
#define ER_FIELD_IN_GROUPING_NOT_GROUP_BY 3602
#define ER_TOO_LONG_TABLESPACE_COMMENT 3603
#define ER_ENGINE_CANT_DROP_TABLE 3604
#define ER_ENGINE_CANT_DROP_MISSING_TABLE 3605
#define ER_TABLESPACE_DUP_FILENAME 3606
#define ER_DB_DROP_RMDIR2 3607
#define ER_IMP_NO_FILES_MATCHED 3608
#define ER_IMP_SCHEMA_DOES_NOT_EXIST 3609
#define ER_IMP_TABLE_ALREADY_EXISTS 3610
#define ER_IMP_INCOMPATIBLE_MYSQLD_VERSION 3611
#define ER_IMP_INCOMPATIBLE_DD_VERSION 3612
#define ER_IMP_INCOMPATIBLE_SDI_VERSION 3613
#define ER_WARN_INVALID_HINT 3614
#define ER_VAR_DOES_NOT_EXIST 3615
#define ER_LONGITUDE_OUT_OF_RANGE 3616
#define ER_LATITUDE_OUT_OF_RANGE 3617
#define ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS 3618
#define ER_ILLEGAL_PRIVILEGE_LEVEL 3619
#define ER_NO_SYSTEM_VIEW_ACCESS 3620
#define ER_COMPONENT_FILTER_FLABBERGASTED 3621
#define ER_PART_EXPR_TOO_LONG 3622
#define ER_UDF_DROP_DYNAMICALLY_REGISTERED 3623
#define ER_UNABLE_TO_STORE_COLUMN_STATISTICS 3624
#define ER_UNABLE_TO_UPDATE_COLUMN_STATISTICS 3625
#define ER_UNABLE_TO_DROP_COLUMN_STATISTICS 3626
#define ER_UNABLE_TO_BUILD_HISTOGRAM 3627
#define ER_MANDATORY_ROLE 3628
#define ER_MISSING_TABLESPACE_FILE 3629
#define ER_PERSIST_ONLY_ACCESS_DENIED_ERROR 3630
#define ER_CMD_NEED_SUPER 3631
#define ER_PATH_IN_DATADIR 3632
#define ER_CLONE_DDL_IN_PROGRESS 3633
#define ER_CLONE_TOO_MANY_CONCURRENT_CLONES 3634
#define ER_APPLIER_LOG_EVENT_VALIDATION_ERROR 3635
#define ER_CTE_MAX_RECURSION_DEPTH 3636
#define ER_NOT_HINT_UPDATABLE_VARIABLE 3637
#define ER_CREDENTIALS_CONTRADICT_TO_HISTORY 3638
#define ER_WARNING_PASSWORD_HISTORY_CLAUSES_VOID 3639
#define ER_CLIENT_DOES_NOT_SUPPORT 3640
#define ER_I_S_SKIPPED_TABLESPACE 3641
#define ER_TABLESPACE_ENGINE_MISMATCH 3642
#define ER_WRONG_SRID_FOR_COLUMN 3643
#define ER_CANNOT_ALTER_SRID_DUE_TO_INDEX 3644
#define ER_WARN_BINLOG_PARTIAL_UPDATES_DISABLED 3645
#define ER_WARN_BINLOG_V1_ROW_EVENTS_DISABLED 3646
#define ER_WARN_BINLOG_PARTIAL_UPDATES_SUGGESTS_PARTIAL_IMAGES 3647
#define ER_COULD_NOT_APPLY_JSON_DIFF 3648
#define ER_CORRUPTED_JSON_DIFF 3649
#define ER_RESOURCE_GROUP_EXISTS 3650
#define ER_RESOURCE_GROUP_NOT_EXISTS 3651
#define ER_INVALID_VCPU_ID 3652
#define ER_INVALID_VCPU_RANGE 3653
#define ER_INVALID_THREAD_PRIORITY 3654
#define ER_DISALLOWED_OPERATION 3655
#define ER_RESOURCE_GROUP_BUSY 3656
#define ER_RESOURCE_GROUP_DISABLED 3657
#define ER_FEATURE_UNSUPPORTED 3658
#define ER_ATTRIBUTE_IGNORED 3659
#define ER_INVALID_THREAD_ID 3660
#define ER_RESOURCE_GROUP_BIND_FAILED 3661
#define ER_INVALID_USE_OF_FORCE_OPTION 3662
#define ER_GROUP_REPLICATION_COMMAND_FAILURE 3663
#define ER_SDI_OPERATION_FAILED 3664
#define ER_MISSING_JSON_TABLE_VALUE 3665
#define ER_WRONG_JSON_TABLE_VALUE 3666
#define ER_TF_MUST_HAVE_ALIAS 3667
#define ER_TF_FORBIDDEN_JOIN_TYPE 3668
#define ER_JT_VALUE_OUT_OF_RANGE 3669
#define ER_JT_MAX_NESTED_PATH 3670
#define ER_PASSWORD_EXPIRATION_NOT_SUPPORTED_BY_AUTH_METHOD 3671
#define ER_INVALID_GEOJSON_CRS_NOT_TOP_LEVEL 3672
#define ER_BAD_NULL_ERROR_NOT_IGNORED 3673
#define WARN_USELESS_SPATIAL_INDEX 3674
#define ER_DISK_FULL_NOWAIT 3675
#define ER_PARSE_ERROR_IN_DIGEST_FN 3676
#define ER_UNDISCLOSED_PARSE_ERROR_IN_DIGEST_FN 3677
#define ER_SCHEMA_DIR_EXISTS 3678
#define ER_SCHEMA_DIR_MISSING 3679
#define ER_SCHEMA_DIR_CREATE_FAILED 3680
#define ER_SCHEMA_DIR_UNKNOWN 3681
#define ER_ONLY_IMPLEMENTED_FOR_SRID_0_AND_4326 3682
#define ER_BINLOG_EXPIRE_LOG_DAYS_AND_SECS_USED_TOGETHER 3683
#define ER_REGEXP_BUFFER_OVERFLOW 3684
#define ER_REGEXP_ILLEGAL_ARGUMENT 3685
#define ER_REGEXP_INDEX_OUTOFBOUNDS_ERROR 3686
#define ER_REGEXP_INTERNAL_ERROR 3687
#define ER_REGEXP_RULE_SYNTAX 3688
#define ER_REGEXP_BAD_ESCAPE_SEQUENCE 3689
#define ER_REGEXP_UNIMPLEMENTED 3690
#define ER_REGEXP_MISMATCHED_PAREN 3691
#define ER_REGEXP_BAD_INTERVAL 3692
#define ER_REGEXP_MAX_LT_MIN 3693
#define ER_REGEXP_INVALID_BACK_REF 3694
#define ER_REGEXP_LOOK_BEHIND_LIMIT 3695
#define ER_REGEXP_MISSING_CLOSE_BRACKET 3696
#define ER_REGEXP_INVALID_RANGE 3697
#define ER_REGEXP_STACK_OVERFLOW 3698
#define ER_REGEXP_TIME_OUT 3699
#define ER_REGEXP_PATTERN_TOO_BIG 3700
#define ER_CANT_SET_ERROR_LOG_SERVICE 3701
#define ER_EMPTY_PIPELINE_FOR_ERROR_LOG_SERVICE 3702
#define ER_COMPONENT_FILTER_DIAGNOSTICS 3703
#define ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS 3704
#define ER_NOT_IMPLEMENTED_FOR_PROJECTED_SRS 3705
#define ER_NONPOSITIVE_RADIUS 3706
#define ER_RESTART_SERVER_FAILED 3707
#define ER_SRS_MISSING_MANDATORY_ATTRIBUTE 3708
#define ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS 3709
#define ER_SRS_NAME_CANT_BE_EMPTY_OR_WHITESPACE 3710
#define ER_SRS_ORGANIZATION_CANT_BE_EMPTY_OR_WHITESPACE 3711
#define ER_SRS_ID_ALREADY_EXISTS 3712
#define ER_WARN_SRS_ID_ALREADY_EXISTS 3713
#define ER_CANT_MODIFY_SRID_0 3714
#define ER_WARN_RESERVED_SRID_RANGE 3715
#define ER_CANT_MODIFY_SRS_USED_BY_COLUMN 3716
#define ER_SRS_INVALID_CHARACTER_IN_ATTRIBUTE 3717
#define ER_SRS_ATTRIBUTE_STRING_TOO_LONG 3718
#define ER_DEPRECATED_UTF8_ALIAS 3719
#define ER_DEPRECATED_NATIONAL 3720
#define ER_INVALID_DEFAULT_UTF8MB4_COLLATION 3721
#define ER_UNABLE_TO_COLLECT_LOG_STATUS 3722
#define ER_RESERVED_TABLESPACE_NAME 3723
#define ER_UNABLE_TO_SET_OPTION 3724
#define ER_REPLICA_POSSIBLY_DIVERGED_AFTER_DDL 3725
#define ER_SRS_NOT_GEOGRAPHIC 3726
#define ER_POLYGON_TOO_LARGE 3727
#define ER_SPATIAL_UNIQUE_INDEX 3728
#define ER_INDEX_TYPE_NOT_SUPPORTED_FOR_SPATIAL_INDEX 3729
#define ER_FK_CANNOT_DROP_PARENT 3730
#define ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE 3731
#define ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE 3732
#define ER_FK_CANNOT_USE_VIRTUAL_COLUMN 3733
#define ER_FK_NO_COLUMN_PARENT 3734
#define ER_CANT_SET_ERROR_SUPPRESSION_LIST 3735
#define ER_SRS_GEOGCS_INVALID_AXES 3736
#define ER_SRS_INVALID_SEMI_MAJOR_AXIS 3737
#define ER_SRS_INVALID_INVERSE_FLATTENING 3738
#define ER_SRS_INVALID_ANGULAR_UNIT 3739
#define ER_SRS_INVALID_PRIME_MERIDIAN 3740
#define ER_TRANSFORM_SOURCE_SRS_NOT_SUPPORTED 3741
#define ER_TRANSFORM_TARGET_SRS_NOT_SUPPORTED 3742
#define ER_TRANSFORM_SOURCE_SRS_MISSING_TOWGS84 3743
#define ER_TRANSFORM_TARGET_SRS_MISSING_TOWGS84 3744
#define ER_TEMP_TABLE_PREVENTS_SWITCH_SESSION_BINLOG_FORMAT 3745
#define ER_TEMP_TABLE_PREVENTS_SWITCH_GLOBAL_BINLOG_FORMAT 3746
#define ER_RUNNING_APPLIER_PREVENTS_SWITCH_GLOBAL_BINLOG_FORMAT 3747
#define ER_CLIENT_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRX_IN_SBR 3748
//#define OBSOLETE_ER_XA_CANT_CREATE_MDL_BACKUP 3749
#define ER_TABLE_WITHOUT_PK 3750
#define ER_WARN_DATA_TRUNCATED_FUNCTIONAL_INDEX 3751
#define ER_WARN_DATA_OUT_OF_RANGE_FUNCTIONAL_INDEX 3752
#define ER_FUNCTIONAL_INDEX_ON_JSON_OR_GEOMETRY_FUNCTION 3753
#define ER_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT 3754
#define ER_CANNOT_DROP_COLUMN_FUNCTIONAL_INDEX 3755
#define ER_FUNCTIONAL_INDEX_PRIMARY_KEY 3756
#define ER_FUNCTIONAL_INDEX_ON_LOB 3757
#define ER_FUNCTIONAL_INDEX_FUNCTION_IS_NOT_ALLOWED 3758
#define ER_FULLTEXT_FUNCTIONAL_INDEX 3759
#define ER_SPATIAL_FUNCTIONAL_INDEX 3760
#define ER_WRONG_KEY_COLUMN_FUNCTIONAL_INDEX 3761
#define ER_FUNCTIONAL_INDEX_ON_FIELD 3762
#define ER_GENERATED_COLUMN_NAMED_FUNCTION_IS_NOT_ALLOWED 3763
#define ER_GENERATED_COLUMN_ROW_VALUE 3764
#define ER_GENERATED_COLUMN_VARIABLES 3765
#define ER_DEPENDENT_BY_DEFAULT_GENERATED_VALUE 3766
#define ER_DEFAULT_VAL_GENERATED_NON_PRIOR 3767
#define ER_DEFAULT_VAL_GENERATED_REF_AUTO_INC 3768
#define ER_DEFAULT_VAL_GENERATED_FUNCTION_IS_NOT_ALLOWED 3769
#define ER_DEFAULT_VAL_GENERATED_NAMED_FUNCTION_IS_NOT_ALLOWED 3770
#define ER_DEFAULT_VAL_GENERATED_ROW_VALUE 3771
#define ER_DEFAULT_VAL_GENERATED_VARIABLES 3772
#define ER_DEFAULT_AS_VAL_GENERATED 3773
#define ER_UNSUPPORTED_ACTION_ON_DEFAULT_VAL_GENERATED 3774
#define ER_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION 3775
#define ER_FK_CANNOT_CHANGE_ENGINE 3776
#define ER_WARN_DEPRECATED_USER_SET_EXPR 3777
#define ER_WARN_DEPRECATED_UTF8MB3_COLLATION 3778
#define ER_WARN_DEPRECATED_NESTED_COMMENT_SYNTAX 3779
#define ER_FK_INCOMPATIBLE_COLUMNS 3780
#define ER_GR_HOLD_WAIT_TIMEOUT 3781
#define ER_GR_HOLD_KILLED 3782
#define ER_GR_HOLD_MEMBER_STATUS_ERROR 3783
#define ER_RPL_ENCRYPTION_FAILED_TO_FETCH_KEY 3784
#define ER_RPL_ENCRYPTION_KEY_NOT_FOUND 3785
#define ER_RPL_ENCRYPTION_KEYRING_INVALID_KEY 3786
#define ER_RPL_ENCRYPTION_HEADER_ERROR 3787
#define ER_RPL_ENCRYPTION_FAILED_TO_ROTATE_LOGS 3788
#define ER_RPL_ENCRYPTION_KEY_EXISTS_UNEXPECTED 3789
#define ER_RPL_ENCRYPTION_FAILED_TO_GENERATE_KEY 3790
#define ER_RPL_ENCRYPTION_FAILED_TO_STORE_KEY 3791
#define ER_RPL_ENCRYPTION_FAILED_TO_REMOVE_KEY 3792
#define ER_RPL_ENCRYPTION_UNABLE_TO_CHANGE_OPTION 3793
#define ER_RPL_ENCRYPTION_MASTER_KEY_RECOVERY_FAILED 3794
#define ER_SLOW_LOG_MODE_IGNORED_WHEN_NOT_LOGGING_TO_FILE 3795
#define ER_GRP_TRX_CONSISTENCY_NOT_ALLOWED 3796
#define ER_GRP_TRX_CONSISTENCY_BEFORE 3797
#define ER_GRP_TRX_CONSISTENCY_AFTER_ON_TRX_BEGIN 3798
#define ER_GRP_TRX_CONSISTENCY_BEGIN_NOT_ALLOWED 3799
#define ER_FUNCTIONAL_INDEX_ROW_VALUE_IS_NOT_ALLOWED 3800
#define ER_RPL_ENCRYPTION_FAILED_TO_ENCRYPT 3801
#define ER_PAGE_TRACKING_NOT_STARTED 3802
#define ER_PAGE_TRACKING_RANGE_NOT_TRACKED 3803
#define ER_PAGE_TRACKING_CANNOT_PURGE 3804
#define ER_RPL_ENCRYPTION_CANNOT_ROTATE_BINLOG_MASTER_KEY 3805
#define ER_BINLOG_MASTER_KEY_RECOVERY_OUT_OF_COMBINATION 3806
#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_OPERATE_KEY 3807
#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_ROTATE_LOGS 3808
#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG 3809
#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_CLEANUP_UNUSED_KEYS 3810
#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_CLEANUP_AUX_KEY 3811
#define ER_NON_BOOLEAN_EXPR_FOR_CHECK_CONSTRAINT 3812
#define ER_COLUMN_CHECK_CONSTRAINT_REFERENCES_OTHER_COLUMN 3813
#define ER_CHECK_CONSTRAINT_NAMED_FUNCTION_IS_NOT_ALLOWED 3814
#define ER_CHECK_CONSTRAINT_FUNCTION_IS_NOT_ALLOWED 3815
#define ER_CHECK_CONSTRAINT_VARIABLES 3816
#define ER_CHECK_CONSTRAINT_ROW_VALUE 3817
#define ER_CHECK_CONSTRAINT_REFERS_AUTO_INCREMENT_COLUMN 3818
#define ER_CHECK_CONSTRAINT_VIOLATED 3819
#define ER_CHECK_CONSTRAINT_REFERS_UNKNOWN_COLUMN 3820
#define ER_CHECK_CONSTRAINT_NOT_FOUND 3821
#define ER_CHECK_CONSTRAINT_DUP_NAME 3822
#define ER_CHECK_CONSTRAINT_CLAUSE_USING_FK_REFER_ACTION_COLUMN 3823
#define WARN_UNENCRYPTED_TABLE_IN_ENCRYPTED_DB 3824
#define ER_INVALID_ENCRYPTION_REQUEST 3825
#define ER_CANNOT_SET_TABLE_ENCRYPTION 3826
#define ER_CANNOT_SET_DATABASE_ENCRYPTION 3827
#define ER_CANNOT_SET_TABLESPACE_ENCRYPTION 3828
#define ER_TABLESPACE_CANNOT_BE_ENCRYPTED 3829
#define ER_TABLESPACE_CANNOT_BE_DECRYPTED 3830
#define ER_TABLESPACE_TYPE_UNKNOWN 3831
#define ER_TARGET_TABLESPACE_UNENCRYPTED 3832
#define ER_CANNOT_USE_ENCRYPTION_CLAUSE 3833
#define ER_INVALID_MULTIPLE_CLAUSES 3834
#define ER_UNSUPPORTED_USE_OF_GRANT_AS 3835
#define ER_UKNOWN_AUTH_ID_OR_ACCESS_DENIED_FOR_GRANT_AS 3836
#define ER_DEPENDENT_BY_FUNCTIONAL_INDEX 3837
#define ER_PLUGIN_NOT_EARLY 3838
#define ER_INNODB_REDO_LOG_ARCHIVE_START_SUBDIR_PATH 3839
#define ER_INNODB_REDO_LOG_ARCHIVE_START_TIMEOUT 3840
#define ER_INNODB_REDO_LOG_ARCHIVE_DIRS_INVALID 3841
#define ER_INNODB_REDO_LOG_ARCHIVE_LABEL_NOT_FOUND 3842
#define ER_INNODB_REDO_LOG_ARCHIVE_DIR_EMPTY 3843
#define ER_INNODB_REDO_LOG_ARCHIVE_NO_SUCH_DIR 3844
#define ER_INNODB_REDO_LOG_ARCHIVE_DIR_CLASH 3845
#define ER_INNODB_REDO_LOG_ARCHIVE_DIR_PERMISSIONS 3846
#define ER_INNODB_REDO_LOG_ARCHIVE_FILE_CREATE 3847
#define ER_INNODB_REDO_LOG_ARCHIVE_ACTIVE 3848
#define ER_INNODB_REDO_LOG_ARCHIVE_INACTIVE 3849
#define ER_INNODB_REDO_LOG_ARCHIVE_FAILED 3850
#define ER_INNODB_REDO_LOG_ARCHIVE_SESSION 3851
#define ER_STD_REGEX_ERROR 3852
#define ER_INVALID_JSON_TYPE 3853
#define ER_CANNOT_CONVERT_STRING 3854
#define ER_DEPENDENT_BY_PARTITION_FUNC 3855
#define ER_WARN_DEPRECATED_FLOAT_AUTO_INCREMENT 3856
#define ER_RPL_CANT_STOP_REPLICA_WHILE_LOCKED_BACKUP 3857
#define ER_WARN_DEPRECATED_FLOAT_DIGITS 3858
#define ER_WARN_DEPRECATED_FLOAT_UNSIGNED 3859
#define ER_WARN_DEPRECATED_INTEGER_DISPLAY_WIDTH 3860
#define ER_WARN_DEPRECATED_ZEROFILL 3861
#define ER_CLONE_DONOR 3862
#define ER_CLONE_PROTOCOL 3863
#define ER_CLONE_DONOR_VERSION 3864
#define ER_CLONE_OS 3865
#define ER_CLONE_PLATFORM 3866
#define ER_CLONE_CHARSET 3867
#define ER_CLONE_CONFIG 3868
#define ER_CLONE_SYS_CONFIG 3869
#define ER_CLONE_PLUGIN_MATCH 3870
#define ER_CLONE_LOOPBACK 3871
#define ER_CLONE_ENCRYPTION 3872
#define ER_CLONE_DISK_SPACE 3873
#define ER_CLONE_IN_PROGRESS 3874
#define ER_CLONE_DISALLOWED 3875
#define ER_CANNOT_GRANT_ROLES_TO_ANONYMOUS_USER 3876
#define ER_SECONDARY_ENGINE_PLUGIN 3877
#define ER_SECOND_PASSWORD_CANNOT_BE_EMPTY 3878
#define ER_DB_ACCESS_DENIED 3879
#define ER_DA_AUTH_ID_WITH_SYSTEM_USER_PRIV_IN_MANDATORY_ROLES 3880
#define ER_DA_RPL_GTID_TABLE_CANNOT_OPEN 3881
#define ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT 3882
#define ER_DA_PLUGIN_INSTALL_ERROR 3883
#define ER_NO_SESSION_TEMP 3884
#define ER_DA_UNKNOWN_ERROR_NUMBER 3885
#define ER_COLUMN_CHANGE_SIZE 3886
#define ER_REGEXP_INVALID_CAPTURE_GROUP_NAME 3887
#define ER_DA_SSL_LIBRARY_ERROR 3888
#define ER_SECONDARY_ENGINE 3889
#define ER_SECONDARY_ENGINE_DDL 3890
#define ER_INCORRECT_CURRENT_PASSWORD 3891
#define ER_MISSING_CURRENT_PASSWORD 3892
#define ER_CURRENT_PASSWORD_NOT_REQUIRED 3893
#define ER_PASSWORD_CANNOT_BE_RETAINED_ON_PLUGIN_CHANGE 3894
#define ER_CURRENT_PASSWORD_CANNOT_BE_RETAINED 3895
#define ER_PARTIAL_REVOKES_EXIST 3896
#define ER_CANNOT_GRANT_SYSTEM_PRIV_TO_MANDATORY_ROLE 3897
#define ER_XA_REPLICATION_FILTERS 3898
#define ER_UNSUPPORTED_SQL_MODE 3899
#define ER_REGEXP_INVALID_FLAG 3900
#define ER_PARTIAL_REVOKE_AND_DB_GRANT_BOTH_EXISTS 3901
#define ER_UNIT_NOT_FOUND 3902
#define ER_INVALID_JSON_VALUE_FOR_FUNC_INDEX 3903
#define ER_JSON_VALUE_OUT_OF_RANGE_FOR_FUNC_INDEX 3904
#define ER_EXCEEDED_MV_KEYS_NUM 3905
#define ER_EXCEEDED_MV_KEYS_SPACE 3906
#define ER_FUNCTIONAL_INDEX_DATA_IS_TOO_LONG 3907
#define ER_WRONG_MVI_VALUE 3908
#define ER_WARN_FUNC_INDEX_NOT_APPLICABLE 3909
#define ER_GRP_RPL_UDF_ERROR 3910
#define ER_UPDATE_GTID_PURGED_WITH_GR 3911
#define ER_GROUPING_ON_TIMESTAMP_IN_DST 3912
#define ER_TABLE_NAME_CAUSES_TOO_LONG_PATH 3913
#define ER_AUDIT_LOG_INSUFFICIENT_PRIVILEGE 3914
//#define OBSOLETE_ER_AUDIT_LOG_PASSWORD_HAS_BEEN_COPIED 3915
#define ER_DA_GRP_RPL_STARTED_AUTO_REJOIN 3916
#define ER_SYSVAR_CHANGE_DURING_QUERY 3917
#define ER_GLOBSTAT_CHANGE_DURING_QUERY 3918
#define ER_GRP_RPL_MESSAGE_SERVICE_INIT_FAILURE 3919
#define ER_CHANGE_SOURCE_WRONG_COMPRESSION_ALGORITHM_CLIENT 3920
#define ER_CHANGE_SOURCE_WRONG_COMPRESSION_LEVEL_CLIENT 3921
#define ER_WRONG_COMPRESSION_ALGORITHM_CLIENT 3922
#define ER_WRONG_COMPRESSION_LEVEL_CLIENT 3923
#define ER_CHANGE_SOURCE_WRONG_COMPRESSION_ALGORITHM_LIST_CLIENT 3924
#define ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS 3925
#define ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST 3926
#define ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT 3927
#define ER_CLIENT_PRIVILEGE_CHECKS_USER_NEEDS_RPL_APPLIER_PRIV 3928
#define ER_WARN_DA_PRIVILEGE_NOT_REGISTERED 3929
#define ER_CLIENT_KEYRING_UDF_KEY_INVALID 3930
#define ER_CLIENT_KEYRING_UDF_KEY_TYPE_INVALID 3931
#define ER_CLIENT_KEYRING_UDF_KEY_TOO_LONG 3932
#define ER_CLIENT_KEYRING_UDF_KEY_TYPE_TOO_LONG 3933
#define ER_JSON_SCHEMA_VALIDATION_ERROR_WITH_DETAILED_REPORT 3934
#define ER_DA_UDF_INVALID_CHARSET_SPECIFIED 3935
#define ER_DA_UDF_INVALID_CHARSET 3936
#define ER_DA_UDF_INVALID_COLLATION 3937
#define ER_DA_UDF_INVALID_EXTENSION_ARGUMENT_TYPE 3938
#define ER_MULTIPLE_CONSTRAINTS_WITH_SAME_NAME 3939
#define ER_CONSTRAINT_NOT_FOUND 3940
#define ER_ALTER_CONSTRAINT_ENFORCEMENT_NOT_SUPPORTED 3941
#define ER_TABLE_VALUE_CONSTRUCTOR_MUST_HAVE_COLUMNS 3942
#define ER_TABLE_VALUE_CONSTRUCTOR_CANNOT_HAVE_DEFAULT 3943
#define ER_CLIENT_QUERY_FAILURE_INVALID_NON_ROW_FORMAT 3944
#define ER_REQUIRE_ROW_FORMAT_INVALID_VALUE 3945
#define ER_FAILED_TO_DETERMINE_IF_ROLE_IS_MANDATORY 3946
#define ER_FAILED_TO_FETCH_MANDATORY_ROLE_LIST 3947
#define ER_CLIENT_LOCAL_FILES_DISABLED 3948
#define ER_IMP_INCOMPATIBLE_CFG_VERSION 3949
#define ER_DA_OOM 3950
#define ER_DA_UDF_INVALID_ARGUMENT_TO_SET_CHARSET 3951
#define ER_DA_UDF_INVALID_RETURN_TYPE_TO_SET_CHARSET 3952
#define ER_MULTIPLE_INTO_CLAUSES 3953
#define ER_MISPLACED_INTO 3954
#define ER_USER_ACCESS_DENIED_FOR_USER_ACCOUNT_BLOCKED_BY_PASSWORD_LOCK 3955
#define ER_WARN_DEPRECATED_YEAR_UNSIGNED 3956
#define ER_CLONE_NETWORK_PACKET 3957
#define ER_SDI_OPERATION_FAILED_MISSING_RECORD 3958
#define ER_DEPENDENT_BY_CHECK_CONSTRAINT 3959
#define ER_GRP_OPERATION_NOT_ALLOWED_GR_MUST_STOP 3960
#define ER_WARN_DEPRECATED_JSON_TABLE_ON_ERROR_ON_EMPTY 3961
#define ER_WARN_DEPRECATED_INNER_INTO 3962
#define ER_WARN_DEPRECATED_VALUES_FUNCTION_ALWAYS_NULL 3963
#define ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS 3964
#define ER_WARN_DEPRECATED_FOUND_ROWS 3965
#define ER_MISSING_JSON_VALUE 3966
#define ER_MULTIPLE_JSON_VALUES 3967
#define ER_HOSTNAME_TOO_LONG 3968
#define ER_WARN_CLIENT_DEPRECATED_PARTITION_PREFIX_KEY 3969
#define ER_GROUP_REPLICATION_USER_EMPTY_MSG 3970
#define ER_GROUP_REPLICATION_USER_MANDATORY_MSG 3971
#define ER_GROUP_REPLICATION_PASSWORD_LENGTH 3972
#define ER_SUBQUERY_TRANSFORM_REJECTED 3973
#define ER_DA_GRP_RPL_RECOVERY_ENDPOINT_FORMAT 3974
#define ER_DA_GRP_RPL_RECOVERY_ENDPOINT_INVALID 3975
#define ER_WRONG_VALUE_FOR_VAR_PLUS_ACTIONABLE_PART 3976
#define ER_STATEMENT_NOT_ALLOWED_AFTER_START_TRANSACTION 3977
#define ER_FOREIGN_KEY_WITH_ATOMIC_CREATE_SELECT 3978
#define ER_NOT_ALLOWED_WITH_START_TRANSACTION 3979
#define ER_INVALID_JSON_ATTRIBUTE 3980
#define ER_ENGINE_ATTRIBUTE_NOT_SUPPORTED 3981
#define ER_INVALID_USER_ATTRIBUTE_JSON 3982
#define ER_INNODB_REDO_DISABLED 3983
#define ER_INNODB_REDO_ARCHIVING_ENABLED 3984
#define ER_MDL_OUT_OF_RESOURCES 3985
#define ER_IMPLICIT_COMPARISON_FOR_JSON 3986
#define ER_FUNCTION_DOES_NOT_SUPPORT_CHARACTER_SET 3987
#define ER_IMPOSSIBLE_STRING_CONVERSION 3988
#define ER_SCHEMA_READ_ONLY 3989
#define ER_RPL_ASYNC_RECONNECT_GTID_MODE_OFF 3990
#define ER_RPL_ASYNC_RECONNECT_AUTO_POSITION_OFF 3991
#define ER_DISABLE_GTID_MODE_REQUIRES_ASYNC_RECONNECT_OFF 3992
#define ER_DISABLE_AUTO_POSITION_REQUIRES_ASYNC_RECONNECT_OFF 3993
#define ER_INVALID_PARAMETER_USE 3994
#define ER_CHARACTER_SET_MISMATCH 3995
#define ER_WARN_VAR_VALUE_CHANGE_NOT_SUPPORTED 3996
#define ER_INVALID_TIME_ZONE_INTERVAL 3997
#define ER_INVALID_CAST 3998
#define ER_HYPERGRAPH_NOT_SUPPORTED_YET 3999
#define ER_WARN_HYPERGRAPH_EXPERIMENTAL 4000
#define ER_DA_NO_ERROR_LOG_PARSER_CONFIGURED 4001
#define ER_DA_ERROR_LOG_TABLE_DISABLED 4002
#define ER_DA_ERROR_LOG_MULTIPLE_FILTERS 4003
#define ER_DA_CANT_OPEN_ERROR_LOG 4004
#define ER_USER_REFERENCED_AS_DEFINER 4005
#define ER_CANNOT_USER_REFERENCED_AS_DEFINER 4006
#define ER_REGEX_NUMBER_TOO_BIG 4007
#define ER_SPVAR_NONINTEGER_TYPE 4008
#define WARN_UNSUPPORTED_ACL_TABLES_READ 4009
#define ER_BINLOG_UNSAFE_ACL_TABLE_READ_IN_DML_DDL 4010
#define ER_STOP_REPLICA_MONITOR_IO_THREAD_TIMEOUT 4011
#define ER_STARTING_REPLICA_MONITOR_IO_THREAD 4012
#define ER_CANT_USE_ANONYMOUS_TO_GTID_WITH_GTID_MODE_NOT_ON 4013
#define ER_CANT_COMBINE_ANONYMOUS_TO_GTID_AND_AUTOPOSITION 4014
#define ER_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_REQUIRES_GTID_MODE_ON 4015
#define ER_SQL_REPLICA_SKIP_COUNTER_USED_WITH_GTID_MODE_ON 4016
#define ER_USING_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_AS_LOCAL_OR_UUID 4017
#define ER_CANT_SET_ANONYMOUS_TO_GTID_AND_WAIT_UNTIL_SQL_THD_AFTER_GTIDS 4018
#define ER_CANT_SET_SQL_AFTER_OR_BEFORE_GTIDS_WITH_ANONYMOUS_TO_GTID 4019
#define ER_ANONYMOUS_TO_GTID_UUID_SAME_AS_GROUP_NAME 4020
#define ER_CANT_USE_SAME_UUID_AS_GROUP_NAME 4021
#define ER_GRP_RPL_RECOVERY_CHANNEL_STILL_RUNNING 4022
#define ER_INNODB_INVALID_AUTOEXTEND_SIZE_VALUE 4023
#define ER_INNODB_INCOMPATIBLE_WITH_TABLESPACE 4024
#define ER_INNODB_AUTOEXTEND_SIZE_OUT_OF_RANGE 4025
#define ER_CANNOT_USE_AUTOEXTEND_SIZE_CLAUSE 4026
#define ER_ROLE_GRANTED_TO_ITSELF 4027
#define ER_TABLE_MUST_HAVE_A_VISIBLE_COLUMN 4028
#define ER_INNODB_COMPRESSION_FAILURE 4029
#define ER_WARN_ASYNC_CONN_FAILOVER_NETWORK_NAMESPACE 4030
#define ER_CLIENT_INTERACTION_TIMEOUT 4031
#define ER_INVALID_CAST_TO_GEOMETRY 4032
#define ER_INVALID_CAST_POLYGON_RING_DIRECTION 4033
#define ER_GIS_DIFFERENT_SRIDS_AGGREGATION 4034
#define ER_RELOAD_KEYRING_FAILURE 4035
#define ER_SDI_GET_KEYS_INVALID_TABLESPACE 4036
#define ER_CHANGE_RPL_SRC_WRONG_COMPRESSION_ALGORITHM_SIZE 4037
//#define OBSOLETE_ER_WARN_DEPRECATED_TLS_VERSION_FOR_CHANNEL_CLI 4038
#define ER_CANT_USE_SAME_UUID_AS_VIEW_CHANGE_UUID 4039
#define ER_ANONYMOUS_TO_GTID_UUID_SAME_AS_VIEW_CHANGE_UUID 4040
#define ER_GRP_RPL_VIEW_CHANGE_UUID_FAIL_GET_VARIABLE 4041
#define ER_WARN_ADUIT_LOG_MAX_SIZE_AND_PRUNE_SECONDS 4042
#define ER_WARN_ADUIT_LOG_MAX_SIZE_CLOSE_TO_ROTATE_ON_SIZE 4043
#define ER_KERBEROS_CREATE_USER 4044
#define ER_INSTALL_PLUGIN_CONFLICT_CLIENT 4045
#define ER_DA_ERROR_LOG_COMPONENT_FLUSH_FAILED 4046
#define ER_WARN_SQL_AFTER_MTS_GAPS_GAP_NOT_CALCULATED 4047
#define ER_INVALID_ASSIGNMENT_TARGET 4048
#define ER_OPERATION_NOT_ALLOWED_ON_GR_SECONDARY 4049
#define ER_GRP_RPL_FAILOVER_CHANNEL_STATUS_PROPAGATION 4050
#define ER_WARN_AUDIT_LOG_FORMAT_UNIX_TIMESTAMP_ONLY_WHEN_JSON 4051
#define ER_INVALID_MFA_PLUGIN_SPECIFIED 4052
#define ER_IDENTIFIED_BY_UNSUPPORTED 4053
#define ER_INVALID_PLUGIN_FOR_REGISTRATION 4054
#define ER_PLUGIN_REQUIRES_REGISTRATION 4055
#define ER_MFA_METHOD_EXISTS 4056
#define ER_MFA_METHOD_NOT_EXISTS 4057
#define ER_AUTHENTICATION_POLICY_MISMATCH 4058
#define ER_PLUGIN_REGISTRATION_DONE 4059
#define ER_INVALID_USER_FOR_REGISTRATION 4060
#define ER_USER_REGISTRATION_FAILED 4061
#define ER_MFA_METHODS_INVALID_ORDER 4062
#define ER_MFA_METHODS_IDENTICAL 4063
#define ER_INVALID_MFA_OPERATIONS_FOR_PASSWORDLESS_USER 4064
#define ER_CHANGE_REPLICATION_SOURCE_NO_OPTIONS_FOR_GTID_ONLY 4065
#define ER_CHANGE_REP_SOURCE_CANT_DISABLE_REQ_ROW_FORMAT_WITH_GTID_ONLY 4066
#define ER_CHANGE_REP_SOURCE_CANT_DISABLE_AUTO_POSITION_WITH_GTID_ONLY 4067
#define ER_CHANGE_REP_SOURCE_CANT_DISABLE_GTID_ONLY_WITHOUT_POSITIONS 4068
#define ER_CHANGE_REP_SOURCE_CANT_DISABLE_AUTO_POS_WITHOUT_POSITIONS 4069
#define ER_CHANGE_REP_SOURCE_GR_CHANNEL_WITH_GTID_MODE_NOT_ON 4070
#define ER_CANT_USE_GTID_ONLY_WITH_GTID_MODE_NOT_ON 4071
#define ER_WARN_C_DISABLE_GTID_ONLY_WITH_SOURCE_AUTO_POS_INVALID_POS 4072
#define ER_DA_SSL_FIPS_MODE_ERROR 4073
#define ER_VALUE_OUT_OF_RANGE 4074
#define ER_FULLTEXT_WITH_ROLLUP 4075
#define ER_REGEXP_MISSING_RESOURCE 4076
#define ER_WARN_REGEXP_USING_DEFAULT 4077
#define ER_REGEXP_MISSING_FILE 4078
#define ER_WARN_DEPRECATED_COLLATION 4079
#define ER_CONCURRENT_PROCEDURE_USAGE 4080
#define ER_DA_GLOBAL_CONN_LIMIT 4081
#define ER_DA_CONN_LIMIT 4082
#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE_INSTANT 4083
#define ER_WARN_SF_UDF_NAME_COLLISION 4084
#define ER_CANNOT_PURGE_BINLOG_WITH_BACKUP_LOCK 4085
#define ER_TOO_MANY_WINDOWS 4086
#define ER_MYSQLBACKUP_CLIENT_MSG 4087
#define ER_COMMENT_CONTAINS_INVALID_STRING 4088
#define ER_DEFINITION_CONTAINS_INVALID_STRING 4089
#define ER_CANT_EXECUTE_COMMAND_WITH_ASSIGNED_GTID_NEXT 4090
#define ER_XA_TEMP_TABLE 4091
#define ER_INNODB_MAX_ROW_VERSION 4092
//#define OBSOLETE_ER_INNODB_INSTANT_ADD_NOT_SUPPORTED_MAX_SIZE 4093
#define ER_OPERATION_NOT_ALLOWED_WHILE_PRIMARY_CHANGE_IS_RUNNING 4094
#define ER_WARN_DEPRECATED_DATETIME_DELIMITER 4095
#define ER_WARN_DEPRECATED_SUPERFLUOUS_DELIMITER 4096
#define ER_CANNOT_PERSIST_SENSITIVE_VARIABLES 4097
#define ER_WARN_CANNOT_SECURELY_PERSIST_SENSITIVE_VARIABLES 4098
#define ER_WARN_TRG_ALREADY_EXISTS 4099
#define ER_IF_NOT_EXISTS_UNSUPPORTED_TRG_EXISTS_ON_DIFFERENT_TABLE 4100
#define ER_IF_NOT_EXISTS_UNSUPPORTED_UDF_NATIVE_FCT_NAME_COLLISION 4101
#define ER_SET_PASSWORD_AUTH_PLUGIN_ERROR 4102
//#define OBSOLETE_ER_REDUCED_DBLWR_FILE_CORRUPTED 4103
//#define OBSOLETE_ER_REDUCED_DBLWR_PAGE_FOUND 4104
#define ER_SRS_INVALID_LATITUDE_OF_ORIGIN 4105
#define ER_SRS_INVALID_LONGITUDE_OF_ORIGIN 4106
#define ER_SRS_UNUSED_PROJ_PARAMETER_PRESENT 4107
#define ER_GIPK_COLUMN_EXISTS 4108
#define ER_GIPK_FAILED_AUTOINC_COLUMN_EXISTS 4109
#define ER_GIPK_COLUMN_ALTER_NOT_ALLOWED 4110
#define ER_DROP_PK_COLUMN_TO_DROP_GIPK 4111
#define ER_CREATE_SELECT_WITH_GIPK_DISALLOWED_IN_SBR 4112
#define ER_DA_EXPIRE_LOGS_DAYS_IGNORED 4113
#define ER_CTE_RECURSIVE_NOT_UNION 4114
#define ER_COMMAND_BACKEND_FAILED_TO_FETCH_SECURITY_CTX 4115
#define ER_COMMAND_SERVICE_BACKEND_FAILED 4116
#define ER_CLIENT_FILE_PRIVILEGE_FOR_REPLICATION_CHECKS 4117
#define ER_GROUP_REPLICATION_FORCE_MEMBERS_COMMAND_FAILURE 4118
#define ER_WARN_DEPRECATED_IDENT 4119
#define ER_INTERSECT_ALL_MAX_DUPLICATES_EXCEEDED 4120
#define ER_TP_QUERY_THRS_PER_GRP_EXCEEDS_TXN_THR_LIMIT 4121
#define ER_BAD_TIMESTAMP_FORMAT 4122
#define ER_SHAPE_PRIDICTION_UDF 4123
#define ER_SRS_INVALID_HEIGHT 4124
#define ER_SRS_INVALID_SCALING 4125
#define ER_SRS_INVALID_ZONE_WIDTH 4126
#define ER_SRS_INVALID_LATITUDE_POLAR_STERE_VAR_A 4127
#define ER_WARN_DEPRECATED_CLIENT_NO_SCHEMA_OPTION 4128
#define ER_TABLE_NOT_EMPTY 4129
#define ER_TABLE_NO_PRIMARY_KEY 4130
#define ER_TABLE_IN_SHARED_TABLESPACE 4131
#define ER_INDEX_OTHER_THAN_PK 4132
#define ER_LOAD_BULK_DATA_UNSORTED 4133
#define ER_BULK_EXECUTOR_ERROR 4134
#define ER_BULK_READER_LIBCURL_INIT_FAILED 4135
#define ER_BULK_READER_LIBCURL_ERROR 4136
#define ER_BULK_READER_SERVER_ERROR 4137
#define ER_BULK_READER_COMMUNICATION_ERROR 4138
#define ER_BULK_LOAD_DATA_FAILED 4139
#define ER_BULK_LOADER_COLUMN_TOO_BIG_FOR_LEFTOVER_BUFFER 4140
#define ER_BULK_LOADER_COMPONENT_ERROR 4141
#define ER_BULK_LOADER_FILE_CONTAINS_LESS_LINES_THAN_IGNORE_CLAUSE 4142
#define ER_BULK_PARSER_MISSING_ENCLOSED_BY 4143
#define ER_BULK_PARSER_ROW_BUFFER_MAX_TOTAL_COLS_EXCEEDED 4144
#define ER_BULK_PARSER_COPY_BUFFER_SIZE_EXCEEDED 4145
#define ER_BULK_PARSER_UNEXPECTED_END_OF_INPUT 4146
#define ER_BULK_PARSER_UNEXPECTED_ROW_TERMINATOR 4147
#define ER_BULK_PARSER_UNEXPECTED_CHAR_AFTER_ENDING_ENCLOSED_BY 4148
#define ER_BULK_PARSER_UNEXPECTED_CHAR_AFTER_NULL_ESCAPE 4149
#define ER_BULK_PARSER_UNEXPECTED_CHAR_AFTER_COLUMN_TERMINATOR 4150
#define ER_BULK_PARSER_INCOMPLETE_ESCAPE_SEQUENCE 4151
#define ER_LOAD_BULK_DATA_FAILED 4152
#define ER_LOAD_BULK_DATA_WRONG_VALUE_FOR_FIELD 4153
#define ER_LOAD_BULK_DATA_WARN_NULL_TO_NOTNULL 4154
#define ER_REQUIRE_TABLE_PRIMARY_KEY_CHECK_GENERATE_WITH_GR 4155
#define ER_CANT_CHANGE_SYS_VAR_IN_READ_ONLY_MODE 4156
#define ER_INNODB_INSTANT_ADD_DROP_NOT_SUPPORTED_MAX_SIZE 4157
#define ER_INNODB_INSTANT_ADD_NOT_SUPPORTED_MAX_FIELDS 4158
#define ER_CANT_SET_PERSISTED 4159
#define ER_INSTALL_COMPONENT_SET_NULL_VALUE 4160
#define ER_INSTALL_COMPONENT_SET_UNUSED_VALUE 4161
#define ER_WARN_DEPRECATED_USER_DEFINED_COLLATIONS 4162
#define ER_USER_LOCK_OVERLONG_NAME 4163
#define ER_WARN_NO_SPACE_VERSION_COMMENT 4164
#define ER_VALIDATE_PASSWORD_INSUFFICIENT_CHANGED_CHARACTERS 4165
#define ER_WARN_DEPRECATED_WITH_NOTE 4166
#define ER_CANT_RUN_COMMAND_SERVICES_RECURSIVELY 4167
#define ER_PARSER_TRACE 10000
#define ER_BOOTSTRAP_CANT_THREAD 10001
#define ER_TRIGGER_INVALID_VALUE 10002
#define ER_OPT_WRONG_TREE 10003
#define ER_DD_FAILSAFE 10004
#define ER_DD_NO_WRITES_NO_REPOPULATION 10005
#define ER_DD_VERSION_FOUND 10006
#define ER_DD_VERSION_INSTALLED 10007
#define ER_DD_VERSION_UNSUPPORTED 10008
//#define OBSOLETE_ER_LOG_SYSLOG_FACILITY_FAIL 10009
#define ER_LOG_SYSLOG_CANNOT_OPEN 10010
#define ER_LOG_SLOW_CANNOT_OPEN 10011
#define ER_LOG_GENERAL_CANNOT_OPEN 10012
#define ER_LOG_CANNOT_WRITE 10013
//#define OBSOLETE_ER_RPL_ZOMBIE_ENCOUNTERED 10014
#define ER_RPL_GTID_TABLE_CANNOT_OPEN 10015
#define ER_SYSTEM_SCHEMA_NOT_FOUND 10016
#define ER_DD_INIT_UPGRADE_FAILED 10017
#define ER_VIEW_UNKNOWN_CHARSET_OR_COLLATION 10018
#define ER_DD_VIEW_CANT_ALLOC_CHARSET 10019
#define ER_DD_INIT_FAILED 10020
#define ER_DD_UPDATING_PLUGIN_MD_FAILED 10021
#define ER_DD_POPULATING_TABLES_FAILED 10022
#define ER_DD_VIEW_CANT_CREATE 10023
#define ER_DD_METADATA_NOT_FOUND 10024
#define ER_DD_CACHE_NOT_EMPTY_AT_SHUTDOWN 10025
#define ER_DD_OBJECT_REMAINS 10026
#define ER_DD_OBJECT_REMAINS_IN_RELEASER 10027
#define ER_DD_OBJECT_RELEASER_REMAINS 10028
#define ER_DD_CANT_GET_OBJECT_KEY 10029
#define ER_DD_CANT_CREATE_OBJECT_KEY 10030
#define ER_CANT_CREATE_HANDLE_MGR_THREAD 10031
#define ER_RPL_REPO_HAS_GAPS 10032
#define ER_INVALID_VALUE_FOR_ENFORCE_GTID_CONSISTENCY 10033
#define ER_CHANGED_ENFORCE_GTID_CONSISTENCY 10034
#define ER_CHANGED_GTID_MODE 10035
#define ER_DISABLED_STORAGE_ENGINE_AS_DEFAULT 10036
#define ER_DEBUG_SYNC_HIT 10037
#define ER_DEBUG_SYNC_EXECUTED 10038
#define ER_DEBUG_SYNC_THREAD_MAX 10039
#define ER_DEBUG_SYNC_OOM 10040
#define ER_CANT_INIT_TC_LOG 10041
#define ER_EVENT_CANT_INIT_QUEUE 10042
#define ER_EVENT_PURGING_QUEUE 10043
#define ER_EVENT_LAST_EXECUTION 10044
#define ER_EVENT_MESSAGE_STACK 10045
#define ER_EVENT_EXECUTION_FAILED 10046
#define ER_CANT_INIT_SCHEDULER_THREAD 10047
#define ER_SCHEDULER_STOPPED 10048
#define ER_CANT_CREATE_SCHEDULER_THREAD 10049
#define ER_SCHEDULER_WAITING 10050
#define ER_SCHEDULER_STARTED 10051
#define ER_SCHEDULER_STOPPING_FAILED_TO_GET_EVENT 10052
#define ER_SCHEDULER_STOPPING_FAILED_TO_CREATE_WORKER 10053
#define ER_SCHEDULER_KILLING 10054
#define ER_UNABLE_TO_RESOLVE_IP 10055
#define ER_UNABLE_TO_RESOLVE_HOSTNAME 10056
#define ER_HOSTNAME_RESEMBLES_IPV4 10057
#define ER_HOSTNAME_DOESNT_RESOLVE_TO 10058
#define ER_ADDRESSES_FOR_HOSTNAME_HEADER 10059
#define ER_ADDRESSES_FOR_HOSTNAME_LIST_ITEM 10060
#define ER_TRG_WITHOUT_DEFINER 10061
#define ER_TRG_NO_CLIENT_CHARSET 10062
#define ER_PARSING_VIEW 10063
#define ER_COMPONENTS_INFRASTRUCTURE_BOOTSTRAP 10064
#define ER_COMPONENTS_INFRASTRUCTURE_SHUTDOWN 10065
#define ER_COMPONENTS_PERSIST_LOADER_BOOTSTRAP 10066
#define ER_DEPART_WITH_GRACE 10067
#define ER_CA_SELF_SIGNED 10068
#define ER_SSL_LIBRARY_ERROR 10069
#define ER_NO_THD_NO_UUID 10070
#define ER_UUID_SALT 10071
#define ER_UUID_IS 10072
#define ER_UUID_INVALID 10073
#define ER_UUID_SCRUB 10074
#define ER_CREATING_NEW_UUID 10075
#define ER_CANT_CREATE_UUID 10076
#define ER_UNKNOWN_UNSUPPORTED_STORAGE_ENGINE 10077
#define ER_SECURE_AUTH_VALUE_UNSUPPORTED 10078
#define ER_INVALID_INSTRUMENT 10079
#define ER_INNODB_MANDATORY 10080
//#define OBSOLETE_ER_INNODB_CANNOT_BE_IGNORED 10081
//#define OBSOLETE_ER_OLD_PASSWORDS_NO_MIDDLE_GROUND 10082
#define ER_VERBOSE_REQUIRES_HELP 10083
#define ER_POINTLESS_WITHOUT_SLOWLOG 10084
#define ER_WASTEFUL_NET_BUFFER_SIZE 10085
#define ER_DEPRECATED_TIMESTAMP_IMPLICIT_DEFAULTS 10086
#define ER_FT_BOOL_SYNTAX_INVALID 10087
#define ER_CREDENTIALLESS_AUTO_USER_BAD 10088
#define ER_CONNECTION_HANDLING_OOM 10089
#define ER_THREAD_HANDLING_OOM 10090
#define ER_CANT_CREATE_TEST_FILE 10091
#define ER_CANT_CREATE_PID_FILE 10092
#define ER_CANT_REMOVE_PID_FILE 10093
#define ER_CANT_CREATE_SHUTDOWN_THREAD 10094
#define ER_SEC_FILE_PRIV_CANT_ACCESS_DIR 10095
#define ER_SEC_FILE_PRIV_IGNORED 10096
#define ER_SEC_FILE_PRIV_EMPTY 10097
#define ER_SEC_FILE_PRIV_NULL 10098
#define ER_SEC_FILE_PRIV_DIRECTORY_INSECURE 10099
#define ER_SEC_FILE_PRIV_CANT_STAT 10100
#define ER_SEC_FILE_PRIV_DIRECTORY_PERMISSIONS 10101
#define ER_SEC_FILE_PRIV_ARGUMENT_TOO_LONG 10102
#define ER_CANT_CREATE_NAMED_PIPES_THREAD 10103
#define ER_CANT_CREATE_TCPIP_THREAD 10104
#define ER_CANT_CREATE_SHM_THREAD 10105
#define ER_CANT_CREATE_INTERRUPT_THREAD 10106
#define ER_WRITABLE_CONFIG_REMOVED 10107
#define ER_CORE_VALUES 10108
#define ER_WRONG_DATETIME_SPEC 10109
#define ER_RPL_BINLOG_FILTERS_OOM 10110
#define ER_KEYCACHE_OOM 10111
#define ER_CONFIRMING_THE_FUTURE 10112
#define ER_BACK_IN_TIME 10113
#define ER_FUTURE_DATE 10114
#define ER_UNSUPPORTED_DATE 10115
#define ER_STARTING_AS 10116
#define ER_SHUTTING_DOWN_REPLICA_THREADS 10117
#define ER_DISCONNECTING_REMAINING_CLIENTS 10118
#define ER_ABORTING 10119
#define ER_BINLOG_END 10120
#define ER_CALL_ME_LOCALHOST 10121
#define ER_USER_REQUIRES_ROOT 10122
#define ER_REALLY_RUN_AS_ROOT 10123
#define ER_USER_WHAT_USER 10124
#define ER_TRANSPORTS_WHAT_TRANSPORTS 10125
#define ER_FAIL_SETGID 10126
#define ER_FAIL_SETUID 10127
#define ER_FAIL_SETREGID 10128
#define ER_FAIL_SETREUID 10129
#define ER_FAIL_CHROOT 10130
#define ER_WIN_LISTEN_BUT_HOW 10131
#define ER_NOT_RIGHT_NOW 10132
#define ER_FIXING_CLIENT_CHARSET 10133
#define ER_OOM 10134
#define ER_FAILED_TO_LOCK_MEM 10135
#define ER_MYINIT_FAILED 10136
#define ER_BEG_INITFILE 10137
#define ER_END_INITFILE 10138
#define ER_CHANGED_MAX_OPEN_FILES 10139
#define ER_CANT_INCREASE_MAX_OPEN_FILES 10140
#define ER_CHANGED_MAX_CONNECTIONS 10141
#define ER_CHANGED_TABLE_OPEN_CACHE 10142
#define ER_THE_USER_ABIDES 10143
#define ER_RPL_CANT_ADD_DO_TABLE 10144
#define ER_RPL_CANT_ADD_IGNORE_TABLE 10145
#define ER_TRACK_VARIABLES_BOGUS 10146
#define ER_EXCESS_ARGUMENTS 10147
#define ER_VERBOSE_HINT 10148
#define ER_CANT_READ_ERRMSGS 10149
#define ER_CANT_INIT_DBS 10150
#define ER_LOG_OUTPUT_CONTRADICTORY 10151
#define ER_NO_CSV_NO_LOG_TABLES 10152
#define ER_RPL_REWRITEDB_MISSING_ARROW 10153
#define ER_RPL_REWRITEDB_EMPTY_FROM 10154
#define ER_RPL_REWRITEDB_EMPTY_TO 10155
#define ER_LOG_FILES_GIVEN_LOG_OUTPUT_IS_TABLE 10156
#define ER_LOG_FILE_INVALID 10157
#define ER_LOWER_CASE_TABLE_NAMES_CS_DD_ON_CI_FS_UNSUPPORTED 10158
#define ER_LOWER_CASE_TABLE_NAMES_USING_2 10159
#define ER_LOWER_CASE_TABLE_NAMES_USING_0 10160
#define ER_NEED_LOG_BIN 10161
#define ER_NEED_FILE_INSTEAD_OF_DIR 10162
#define ER_LOG_BIN_BETTER_WITH_NAME 10163
#define ER_BINLOG_NEEDS_SERVERID 10164
#define ER_RPL_CANT_MAKE_PATHS 10165
#define ER_CANT_INITIALIZE_GTID 10166
#define ER_CANT_INITIALIZE_EARLY_PLUGINS 10167
#define ER_CANT_INITIALIZE_BUILTIN_PLUGINS 10168
#define ER_CANT_INITIALIZE_DYNAMIC_PLUGINS 10169
#define ER_PERFSCHEMA_INIT_FAILED 10170
#define ER_STACKSIZE_UNEXPECTED 10171
//#define OBSOLETE_ER_CANT_SET_DATADIR 10172
#define ER_CANT_STAT_DATADIR 10173
#define ER_CANT_CHOWN_DATADIR 10174
#define ER_CANT_SET_UP_PERSISTED_VALUES 10175
#define ER_CANT_SAVE_GTIDS 10176
#define ER_AUTH_CANT_SET_DEFAULT_PLUGIN 10177
#define ER_CANT_JOIN_SHUTDOWN_THREAD 10178
#define ER_CANT_HASH_DO_AND_IGNORE_RULES 10179
#define ER_CANT_OPEN_CA 10180
#define ER_CANT_ACCESS_CAPATH 10181
#define ER_SSL_TRYING_DATADIR_DEFAULTS 10182
#define ER_AUTO_OPTIONS_FAILED 10183
#define ER_CANT_INIT_TIMER 10184
#define ER_SERVERID_TOO_LARGE 10185
#define ER_DEFAULT_SE_UNAVAILABLE 10186
#define ER_CANT_OPEN_ERROR_LOG 10187
#define ER_INVALID_ERROR_LOG_NAME 10188
#define ER_RPL_INFINITY_DENIED 10189
#define ER_RPL_INFINITY_IGNORED 10190
//#define OBSOLETE_ER_NDB_TABLES_NOT_READY 10191
#define ER_TABLE_CHECK_INTACT 10192
#define ER_DD_TABLESPACE_NOT_FOUND 10193
#define ER_DD_TRG_CONNECTION_COLLATION_MISSING 10194
#define ER_DD_TRG_DB_COLLATION_MISSING 10195
#define ER_DD_TRG_DEFINER_OOM 10196
#define ER_DD_TRG_FILE_UNREADABLE 10197
#define ER_TRG_CANT_PARSE 10198
#define ER_DD_TRG_CANT_ADD 10199
#define ER_DD_CANT_RESOLVE_VIEW 10200
#define ER_DD_VIEW_WITHOUT_DEFINER 10201
#define ER_PLUGIN_INIT_FAILED 10202
#define ER_RPL_TRX_DELEGATES_INIT_FAILED 10203
#define ER_RPL_BINLOG_STORAGE_DELEGATES_INIT_FAILED 10204
#define ER_RPL_BINLOG_TRANSMIT_DELEGATES_INIT_FAILED 10205
#define ER_RPL_BINLOG_RELAY_DELEGATES_INIT_FAILED 10206
#define ER_RPL_PLUGIN_FUNCTION_FAILED 10207
#define ER_SQL_HA_READ_FAILED 10208
#define ER_SR_BOGUS_VALUE 10209
#define ER_SR_INVALID_CONTEXT 10210
#define ER_READING_TABLE_FAILED 10211
#define ER_DES_FILE_WRONG_KEY 10212
//#define OBSOLETE_ER_CANT_SET_PERSISTED 10213
#define ER_JSON_PARSE_ERROR 10214
#define ER_CONFIG_OPTION_WITHOUT_GROUP 10215
#define ER_VALGRIND_DO_QUICK_LEAK_CHECK 10216
#define ER_VALGRIND_COUNT_LEAKS 10217
#define ER_LOAD_DATA_INFILE_FAILED_IN_UNEXPECTED_WAY 10218
#define ER_UNKNOWN_ERROR_NUMBER 10219
#define ER_UDF_CANT_ALLOC_FOR_STRUCTURES 10220
#define ER_UDF_CANT_ALLOC_FOR_FUNCTION 10221
#define ER_UDF_INVALID_ROW_IN_FUNCTION_TABLE 10222
#define ER_UDF_CANT_OPEN_FUNCTION_TABLE 10223
#define ER_XA_RECOVER_FOUND_TRX_IN_SE 10224
#define ER_XA_RECOVER_FOUND_XA_TRX 10225
//#define OBSOLETE_ER_XA_IGNORING_XID 10226
//#define OBSOLETE_ER_XA_COMMITTING_XID 10227
//#define OBSOLETE_ER_XA_ROLLING_BACK_XID 10228
#define ER_XA_STARTING_RECOVERY 10229
#define ER_XA_NO_MULTI_2PC_HEURISTIC_RECOVER 10230
#define ER_XA_RECOVER_EXPLANATION 10231
#define ER_XA_RECOVERY_DONE 10232
#define ER_TRX_GTID_COLLECT_REJECT 10233
#define ER_SQL_AUTHOR_DEFAULT_ROLES_FAIL 10234
#define ER_SQL_USER_TABLE_CREATE_WARNING 10235
#define ER_SQL_USER_TABLE_ALTER_WARNING 10236
#define ER_ROW_IN_WRONG_PARTITION_PLEASE_REPAIR 10237
#define ER_MYISAM_CRASHED_ERROR_IN_THREAD 10238
#define ER_MYISAM_CRASHED_ERROR_IN 10239
#define ER_TOO_MANY_STORAGE_ENGINES 10240
#define ER_SE_TYPECODE_CONFLICT 10241
#define ER_TRX_WRITE_SET_OOM 10242
#define ER_HANDLERTON_OOM 10243
#define ER_CONN_SHM_LISTENER 10244
#define ER_CONN_SHM_CANT_CREATE_SERVICE 10245
#define ER_CONN_SHM_CANT_CREATE_CONNECTION 10246
#define ER_CONN_PIP_CANT_CREATE_EVENT 10247
#define ER_CONN_PIP_CANT_CREATE_PIPE 10248
#define ER_CONN_PER_THREAD_NO_THREAD 10249
#define ER_CONN_TCP_NO_SOCKET 10250
#define ER_CONN_TCP_CREATED 10251
#define ER_CONN_TCP_ADDRESS 10252
#define ER_CONN_TCP_IPV6_AVAILABLE 10253
#define ER_CONN_TCP_IPV6_UNAVAILABLE 10254
#define ER_CONN_TCP_ERROR_WITH_STRERROR 10255
#define ER_CONN_TCP_CANT_RESOLVE_HOSTNAME 10256
#define ER_CONN_TCP_IS_THERE_ANOTHER_USING_PORT 10257
#define ER_CONN_UNIX_IS_THERE_ANOTHER_USING_SOCKET 10258
#define ER_CONN_UNIX_PID_CLAIMED_SOCKET_FILE 10259
#define ER_CONN_TCP_CANT_RESET_V6ONLY 10260
#define ER_CONN_TCP_BIND_RETRY 10261
#define ER_CONN_TCP_BIND_FAIL 10262
#define ER_CONN_TCP_IP_NOT_LOGGED 10263
#define ER_CONN_TCP_RESOLVE_INFO 10264
#define ER_CONN_TCP_START_FAIL 10265
#define ER_CONN_TCP_LISTEN_FAIL 10266
#define ER_CONN_UNIX_PATH_TOO_LONG 10267
#define ER_CONN_UNIX_LOCK_FILE_FAIL 10268
#define ER_CONN_UNIX_NO_FD 10269
#define ER_CONN_UNIX_NO_BIND_NO_START 10270
#define ER_CONN_UNIX_LISTEN_FAILED 10271
#define ER_CONN_UNIX_LOCK_FILE_GIVING_UP 10272
#define ER_CONN_UNIX_LOCK_FILE_CANT_CREATE 10273
#define ER_CONN_UNIX_LOCK_FILE_CANT_OPEN 10274
#define ER_CONN_UNIX_LOCK_FILE_CANT_READ 10275
#define ER_CONN_UNIX_LOCK_FILE_EMPTY 10276
#define ER_CONN_UNIX_LOCK_FILE_PIDLESS 10277
#define ER_CONN_UNIX_LOCK_FILE_CANT_WRITE 10278
#define ER_CONN_UNIX_LOCK_FILE_CANT_DELETE 10279
#define ER_CONN_UNIX_LOCK_FILE_CANT_SYNC 10280
#define ER_CONN_UNIX_LOCK_FILE_CANT_CLOSE 10281
#define ER_CONN_SOCKET_SELECT_FAILED 10282
#define ER_CONN_SOCKET_ACCEPT_FAILED 10283
#define ER_AUTH_RSA_CANT_FIND 10284
#define ER_AUTH_RSA_CANT_PARSE 10285
#define ER_AUTH_RSA_CANT_READ 10286
#define ER_AUTH_RSA_FILES_NOT_FOUND 10287
#define ER_CONN_ATTR_TRUNCATED 10288
#define ER_X509_CIPHERS_MISMATCH 10289
#define ER_X509_ISSUER_MISMATCH 10290
#define ER_X509_SUBJECT_MISMATCH 10291
#define ER_AUTH_CANT_ACTIVATE_ROLE 10292
#define ER_X509_NEEDS_RSA_PRIVKEY 10293
#define ER_X509_CANT_WRITE_KEY 10294
#define ER_X509_CANT_CHMOD_KEY 10295
#define ER_X509_CANT_READ_CA_KEY 10296
#define ER_X509_CANT_READ_CA_CERT 10297
#define ER_X509_CANT_CREATE_CERT 10298
#define ER_X509_CANT_WRITE_CERT 10299
#define ER_AUTH_CANT_CREATE_RSA_PAIR 10300
#define ER_AUTH_CANT_WRITE_PRIVKEY 10301
#define ER_AUTH_CANT_WRITE_PUBKEY 10302
#define ER_AUTH_SSL_CONF_PREVENTS_CERT_GENERATION 10303
#define ER_AUTH_USING_EXISTING_CERTS 10304
#define ER_AUTH_CERTS_SAVED_TO_DATADIR 10305
#define ER_AUTH_CERT_GENERATION_DISABLED 10306
#define ER_AUTH_RSA_CONF_PREVENTS_KEY_GENERATION 10307
#define ER_AUTH_KEY_GENERATION_SKIPPED_PAIR_PRESENT 10308
#define ER_AUTH_KEYS_SAVED_TO_DATADIR 10309
#define ER_AUTH_KEY_GENERATION_DISABLED 10310
#define ER_AUTHCACHE_PROXIES_PRIV_SKIPPED_NEEDS_RESOLVE 10311
#define ER_AUTHCACHE_PLUGIN_MISSING 10312
#define ER_AUTHCACHE_PLUGIN_CONFIG 10313
//#define OBSOLETE_ER_AUTHCACHE_ROLE_TABLES_DODGY 10314
#define ER_AUTHCACHE_USER_SKIPPED_NEEDS_RESOLVE 10315
#define ER_AUTHCACHE_USER_TABLE_DODGY 10316
#define ER_AUTHCACHE_USER_IGNORED_DEPRECATED_PASSWORD 10317
#define ER_AUTHCACHE_USER_IGNORED_NEEDS_PLUGIN 10318
#define ER_AUTHCACHE_USER_IGNORED_INVALID_PASSWORD 10319
#define ER_AUTHCACHE_EXPIRED_PASSWORD_UNSUPPORTED 10320
#define ER_NO_SUPER_WITHOUT_USER_PLUGIN 10321
#define ER_AUTHCACHE_DB_IGNORED_EMPTY_NAME 10322
#define ER_AUTHCACHE_DB_SKIPPED_NEEDS_RESOLVE 10323
#define ER_AUTHCACHE_DB_ENTRY_LOWERCASED_REVOKE_WILL_FAIL 10324
#define ER_AUTHCACHE_TABLE_PROXIES_PRIV_MISSING 10325
#define ER_AUTHCACHE_CANT_OPEN_AND_LOCK_PRIVILEGE_TABLES 10326
#define ER_AUTHCACHE_CANT_INIT_GRANT_SUBSYSTEM 10327
#define ER_AUTHCACHE_PROCS_PRIV_SKIPPED_NEEDS_RESOLVE 10328
#define ER_AUTHCACHE_PROCS_PRIV_ENTRY_IGNORED_BAD_ROUTINE_TYPE 10329
#define ER_AUTHCACHE_TABLES_PRIV_SKIPPED_NEEDS_RESOLVE 10330
#define ER_USER_NOT_IN_EXTRA_USERS_BINLOG_POSSIBLY_INCOMPLETE 10331
#define ER_DD_SCHEMA_NOT_FOUND 10332
#define ER_DD_TABLE_NOT_FOUND 10333
#define ER_DD_SE_INIT_FAILED 10334
#define ER_DD_ABORTING_PARTIAL_UPGRADE 10335
#define ER_DD_FRM_EXISTS_FOR_TABLE 10336
#define ER_DD_CREATED_FOR_UPGRADE 10337
#define ER_ERRMSG_CANT_FIND_FILE 10338
#define ER_ERRMSG_LOADING_55_STYLE 10339
#define ER_ERRMSG_MISSING_IN_FILE 10340
#define ER_ERRMSG_OOM 10341
#define ER_ERRMSG_CANT_READ 10342
#define ER_TABLE_INCOMPATIBLE_DECIMAL_FIELD 10343
#define ER_TABLE_INCOMPATIBLE_YEAR_FIELD 10344
#define ER_INVALID_CHARSET_AND_DEFAULT_IS_MB 10345
#define ER_TABLE_WRONG_KEY_DEFINITION 10346
#define ER_CANT_OPEN_FRM_FILE 10347
#define ER_CANT_READ_FRM_FILE 10348
#define ER_TABLE_CREATED_WITH_DIFFERENT_VERSION 10349
#define ER_VIEW_UNPARSABLE 10350
#define ER_FILE_TYPE_UNKNOWN 10351
#define ER_INVALID_INFO_IN_FRM 10352
#define ER_CANT_OPEN_AND_LOCK_PRIVILEGE_TABLES 10353
#define ER_AUDIT_PLUGIN_DOES_NOT_SUPPORT_AUDIT_AUTH_EVENTS 10354
#define ER_AUDIT_PLUGIN_HAS_INVALID_DATA 10355
#define ER_TZ_OOM_INITIALIZING_TIME_ZONES 10356
#define ER_TZ_CANT_OPEN_AND_LOCK_TIME_ZONE_TABLE 10357
#define ER_TZ_OOM_LOADING_LEAP_SECOND_TABLE 10358
#define ER_TZ_TOO_MANY_LEAPS_IN_LEAP_SECOND_TABLE 10359
#define ER_TZ_ERROR_LOADING_LEAP_SECOND_TABLE 10360
#define ER_TZ_UNKNOWN_OR_ILLEGAL_DEFAULT_TIME_ZONE 10361
#define ER_TZ_CANT_FIND_DESCRIPTION_FOR_TIME_ZONE 10362
#define ER_TZ_CANT_FIND_DESCRIPTION_FOR_TIME_ZONE_ID 10363
#define ER_TZ_TRANSITION_TYPE_TABLE_TYPE_TOO_LARGE 10364
#define ER_TZ_TRANSITION_TYPE_TABLE_ABBREVIATIONS_EXCEED_SPACE 10365
#define ER_TZ_TRANSITION_TYPE_TABLE_LOAD_ERROR 10366
#define ER_TZ_TRANSITION_TABLE_TOO_MANY_TRANSITIONS 10367
#define ER_TZ_TRANSITION_TABLE_BAD_TRANSITION_TYPE 10368
#define ER_TZ_TRANSITION_TABLE_LOAD_ERROR 10369
#define ER_TZ_NO_TRANSITION_TYPES_IN_TIME_ZONE 10370
#define ER_TZ_OOM_LOADING_TIME_ZONE_DESCRIPTION 10371
#define ER_TZ_CANT_BUILD_MKTIME_MAP 10372
#define ER_TZ_OOM_WHILE_LOADING_TIME_ZONE 10373
#define ER_TZ_OOM_WHILE_SETTING_TIME_ZONE 10374
#define ER_REPLICA_SQL_THREAD_STOPPED_UNTIL_CONDITION_BAD 10375
#define ER_REPLICA_SQL_THREAD_STOPPED_UNTIL_POSITION_REACHED 10376
#define ER_REPLICA_SQL_THREAD_STOPPED_BEFORE_GTIDS_ALREADY_APPLIED 10377
#define ER_REPLICA_SQL_THREAD_STOPPED_BEFORE_GTIDS_REACHED 10378
#define ER_REPLICA_SQL_THREAD_STOPPED_AFTER_GTIDS_REACHED 10379
#define ER_REPLICA_SQL_THREAD_STOPPED_GAP_TRX_PROCESSED 10380
#define ER_GROUP_REPLICATION_PLUGIN_NOT_INSTALLED 10381
#define ER_GTID_ALREADY_ADDED_BY_USER 10382
#define ER_FAILED_TO_DELETE_FROM_GTID_EXECUTED_TABLE 10383
#define ER_FAILED_TO_COMPRESS_GTID_EXECUTED_TABLE 10384
#define ER_FAILED_TO_COMPRESS_GTID_EXECUTED_TABLE_OOM 10385
#define ER_FAILED_TO_INIT_THREAD_ATTR_FOR_GTID_TABLE_COMPRESSION 10386
#define ER_FAILED_TO_CREATE_GTID_TABLE_COMPRESSION_THREAD 10387
#define ER_FAILED_TO_JOIN_GTID_TABLE_COMPRESSION_THREAD 10388
#define ER_NPIPE_FAILED_TO_INIT_SECURITY_DESCRIPTOR 10389
#define ER_NPIPE_FAILED_TO_SET_SECURITY_DESCRIPTOR 10390
#define ER_NPIPE_PIPE_ALREADY_IN_USE 10391
//#define OBSOLETE_ER_NDB_SLAVE_SAW_EPOCH_LOWER_THAN_PREVIOUS_ON_START 10392
//#define OBSOLETE_ER_NDB_SLAVE_SAW_EPOCH_LOWER_THAN_PREVIOUS 10393
//#define OBSOLETE_ER_NDB_SLAVE_SAW_ALREADY_COMMITTED_EPOCH 10394
//#define OBSOLETE_ER_NDB_SLAVE_PREVIOUS_EPOCH_NOT_COMMITTED 10395
//#define OBSOLETE_ER_NDB_SLAVE_MISSING_DATA_FOR_TIMESTAMP_COLUMN 10396
//#define OBSOLETE_ER_NDB_SLAVE_LOGGING_EXCEPTIONS_TO 10397
//#define OBSOLETE_ER_NDB_SLAVE_LOW_EPOCH_RESOLUTION 10398
//#define OBSOLETE_ER_NDB_INFO_FOUND_UNEXPECTED_FIELD_TYPE 10399
//#define OBSOLETE_ER_NDB_INFO_FAILED_TO_CREATE_NDBINFO 10400
//#define OBSOLETE_ER_NDB_INFO_FAILED_TO_INIT_NDBINFO 10401
//#define OBSOLETE_ER_NDB_CLUSTER_WRONG_NUMBER_OF_FUNCTION_ARGUMENTS 10402
//#define OBSOLETE_ER_NDB_CLUSTER_SCHEMA_INFO 10403
//#define OBSOLETE_ER_NDB_CLUSTER_GENERIC_MESSAGE 10404
#define ER_RPL_CANT_OPEN_INFO_TABLE 10405
#define ER_RPL_CANT_SCAN_INFO_TABLE 10406
#define ER_RPL_CORRUPTED_INFO_TABLE 10407
#define ER_RPL_CORRUPTED_KEYS_IN_INFO_TABLE 10408
#define ER_RPL_WORKER_ID_IS 10409
#define ER_RPL_INCONSISTENT_TIMESTAMPS_IN_TRX 10410
#define ER_RPL_INCONSISTENT_SEQUENCE_NO_IN_TRX 10411
#define ER_RPL_CHANNELS_REQUIRE_TABLES_AS_INFO_REPOSITORIES 10412
#define ER_RPL_CHANNELS_REQUIRE_NON_ZERO_SERVER_ID 10413
#define ER_RPL_REPO_SHOULD_BE_TABLE 10414
#define ER_RPL_ERROR_CREATING_CONNECTION_METADATA 10415
#define ER_RPL_ERROR_CHANGING_CONNECTION_METADATA_REPO_TYPE 10416
#define ER_RPL_CHANGING_APPLIER_METADATA_REPO_TYPE_FAILED_DUE_TO_GAPS 10417
#define ER_RPL_ERROR_CREATING_APPLIER_METADATA 10418
#define ER_RPL_ERROR_CHANGING_APPLIER_METADATA_REPO_TYPE 10419
#define ER_RPL_FAILED_TO_DELETE_FROM_REPLICA_WORKERS_INFO_REPOSITORY 10420
#define ER_RPL_FAILED_TO_RESET_STATE_IN_REPLICA_INFO_REPOSITORY 10421
#define ER_RPL_ERROR_CHECKING_REPOSITORY 10422
#define ER_RPL_REPLICA_GENERIC_MESSAGE 10423
#define ER_RPL_REPLICA_COULD_NOT_CREATE_CHANNEL_LIST 10424
#define ER_RPL_MULTISOURCE_REQUIRES_TABLE_TYPE_REPOSITORIES 10425
#define ER_RPL_REPLICA_FAILED_TO_INIT_A_CONNECTION_METADATA_STRUCTURE 10426
#define ER_RPL_REPLICA_FAILED_TO_INIT_CONNECTION_METADATA_STRUCTURE 10427
#define ER_RPL_REPLICA_FAILED_TO_CREATE_CHANNEL_FROM_CONNECTION_METADATA 10428
#define ER_RPL_FAILED_TO_CREATE_NEW_INFO_FILE 10429
#define ER_RPL_FAILED_TO_CREATE_CACHE_FOR_INFO_FILE 10430
#define ER_RPL_FAILED_TO_OPEN_INFO_FILE 10431
#define ER_RPL_GTID_MEMORY_FINALLY_AVAILABLE 10432
#define ER_SERVER_COST_UNKNOWN_COST_CONSTANT 10433
#define ER_SERVER_COST_INVALID_COST_CONSTANT 10434
#define ER_ENGINE_COST_UNKNOWN_COST_CONSTANT 10435
#define ER_ENGINE_COST_UNKNOWN_STORAGE_ENGINE 10436
#define ER_ENGINE_COST_INVALID_DEVICE_TYPE_FOR_SE 10437
#define ER_ENGINE_COST_INVALID_CONST_CONSTANT_FOR_SE_AND_DEVICE 10438
#define ER_SERVER_COST_FAILED_TO_READ 10439
#define ER_ENGINE_COST_FAILED_TO_READ 10440
#define ER_FAILED_TO_OPEN_COST_CONSTANT_TABLES 10441
#define ER_RPL_UNSUPPORTED_UNIGNORABLE_EVENT_IN_STREAM 10442
#define ER_RPL_GTID_LOG_EVENT_IN_STREAM 10443
#define ER_RPL_UNEXPECTED_BEGIN_IN_STREAM 10444
#define ER_RPL_UNEXPECTED_COMMIT_ROLLBACK_OR_XID_LOG_EVENT_IN_STREAM 10445
#define ER_RPL_UNEXPECTED_XA_ROLLBACK_IN_STREAM 10446
#define ER_EVENT_EXECUTION_FAILED_CANT_AUTHENTICATE_USER 10447
#define ER_EVENT_EXECUTION_FAILED_USER_LOST_EVEN_PRIVILEGE 10448
#define ER_EVENT_ERROR_DURING_COMPILATION 10449
#define ER_EVENT_DROPPING 10450
//#define OBSOLETE_ER_NDB_SCHEMA_GENERIC_MESSAGE 10451
#define ER_RPL_INCOMPATIBLE_DECIMAL_IN_RBR 10452
#define ER_INIT_ROOT_WITHOUT_PASSWORD 10453
#define ER_INIT_GENERATING_TEMP_PASSWORD_FOR_ROOT 10454
#define ER_INIT_CANT_OPEN_BOOTSTRAP_FILE 10455
#define ER_INIT_BOOTSTRAP_COMPLETE 10456
#define ER_INIT_DATADIR_NOT_EMPTY_WONT_INITIALIZE 10457
#define ER_INIT_DATADIR_EXISTS_WONT_INITIALIZE 10458
#define ER_INIT_DATADIR_EXISTS_AND_PATH_TOO_LONG_WONT_INITIALIZE 10459
#define ER_INIT_DATADIR_EXISTS_AND_NOT_WRITABLE_WONT_INITIALIZE 10460
#define ER_INIT_CREATING_DD 10461
#define ER_RPL_BINLOG_STARTING_DUMP 10462
#define ER_RPL_BINLOG_SOURCE_SENDS_HEARTBEAT 10463
#define ER_RPL_BINLOG_SKIPPING_REMAINING_HEARTBEAT_INFO 10464
#define ER_RPL_BINLOG_SOURCE_USES_CHECKSUM_AND_REPLICA_CANT 10465
//#define OBSOLETE_ER_NDB_QUERY_FAILED 10466
#define ER_KILLING_THREAD 10467
#define ER_DETACHING_SESSION_LEFT_BY_PLUGIN 10468
#define ER_CANT_DETACH_SESSION_LEFT_BY_PLUGIN 10469
#define ER_DETACHED_SESSIONS_LEFT_BY_PLUGIN 10470
#define ER_FAILED_TO_DECREMENT_NUMBER_OF_THREADS 10471
#define ER_PLUGIN_DID_NOT_DEINITIALIZE_THREADS 10472
#define ER_KILLED_THREADS_OF_PLUGIN 10473
//#define OBSOLETE_ER_NDB_SLAVE_MAX_REPLICATED_EPOCH_UNKNOWN 10474
//#define OBSOLETE_ER_NDB_SLAVE_MAX_REPLICATED_EPOCH_SET_TO 10475
//#define OBSOLETE_ER_NDB_NODE_ID_AND_MANAGEMENT_SERVER_INFO 10476
//#define OBSOLETE_ER_NDB_DISCONNECT_INFO 10477
//#define OBSOLETE_ER_NDB_COLUMN_DEFAULTS_DIFFER 10478
//#define OBSOLETE_ER_NDB_COLUMN_SHOULD_NOT_HAVE_NATIVE_DEFAULT 10479
//#define OBSOLETE_ER_NDB_FIELD_INFO 10480
//#define OBSOLETE_ER_NDB_COLUMN_INFO 10481
//#define OBSOLETE_ER_NDB_OOM_IN_FIX_UNIQUE_INDEX_ATTR_ORDER 10482
//#define OBSOLETE_ER_NDB_SLAVE_MALFORMED_EVENT_RECEIVED_ON_TABLE 10483
//#define OBSOLETE_ER_NDB_SLAVE_CONFLICT_FUNCTION_REQUIRES_ROLE 10484
//#define OBSOLETE_ER_NDB_SLAVE_CONFLICT_TRANSACTION_IDS 10485
//#define OBSOLETE_ER_NDB_SLAVE_BINLOG_MISSING_INFO_FOR_CONFLICT_DETECTION 10486
//#define OBSOLETE_ER_NDB_ERROR_IN_READAUTOINCREMENTVALUE 10487
//#define OBSOLETE_ER_NDB_FOUND_UNCOMMITTED_AUTOCOMMIT 10488
//#define OBSOLETE_ER_NDB_SLAVE_TOO_MANY_RETRIES 10489
//#define OBSOLETE_ER_NDB_SLAVE_ERROR_IN_UPDATE_CREATE_INFO 10490
//#define OBSOLETE_ER_NDB_SLAVE_CANT_ALLOCATE_TABLE_SHARE 10491
//#define OBSOLETE_ER_NDB_BINLOG_ERROR_INFO_FROM_DA 10492
//#define OBSOLETE_ER_NDB_BINLOG_CREATE_TABLE_EVENT 10493
//#define OBSOLETE_ER_NDB_BINLOG_FAILED_CREATE_TABLE_EVENT_OPERATIONS 10494
//#define OBSOLETE_ER_NDB_BINLOG_RENAME_EVENT 10495
//#define OBSOLETE_ER_NDB_BINLOG_FAILED_CREATE_DURING_RENAME 10496
//#define OBSOLETE_ER_NDB_UNEXPECTED_RENAME_TYPE 10497
//#define OBSOLETE_ER_NDB_ERROR_IN_GET_AUTO_INCREMENT 10498
//#define OBSOLETE_ER_NDB_CREATING_SHARE_IN_OPEN 10499
//#define OBSOLETE_ER_NDB_TABLE_OPENED_READ_ONLY 10500
//#define OBSOLETE_ER_NDB_INITIALIZE_GIVEN_CLUSTER_PLUGIN_DISABLED 10501
//#define OBSOLETE_ER_NDB_BINLOG_FORMAT_CHANGED_FROM_STMT_TO_MIXED 10502
//#define OBSOLETE_ER_NDB_TRAILING_SHARE_RELEASED_BY_CLOSE_CACHED_TABLES 10503
//#define OBSOLETE_ER_NDB_SHARE_ALREADY_EXISTS 10504
//#define OBSOLETE_ER_NDB_HANDLE_TRAILING_SHARE_INFO 10505
//#define OBSOLETE_ER_NDB_CLUSTER_GET_SHARE_INFO 10506
//#define OBSOLETE_ER_NDB_CLUSTER_REAL_FREE_SHARE_INFO 10507
//#define OBSOLETE_ER_NDB_CLUSTER_REAL_FREE_SHARE_DROP_FAILED 10508
//#define OBSOLETE_ER_NDB_CLUSTER_FREE_SHARE_INFO 10509
//#define OBSOLETE_ER_NDB_CLUSTER_MARK_SHARE_DROPPED_INFO 10510
//#define OBSOLETE_ER_NDB_CLUSTER_MARK_SHARE_DROPPED_DESTROYING_SHARE 10511
//#define OBSOLETE_ER_NDB_CLUSTER_OOM_THD_NDB 10512
//#define OBSOLETE_ER_NDB_BINLOG_NDB_TABLES_INITIALLY_READ_ONLY 10513
//#define OBSOLETE_ER_NDB_UTIL_THREAD_OOM 10514
//#define OBSOLETE_ER_NDB_ILLEGAL_VALUE_FOR_NDB_RECV_THREAD_CPU_MASK 10515
//#define OBSOLETE_ER_NDB_TOO_MANY_CPUS_IN_NDB_RECV_THREAD_CPU_MASK 10516
#define ER_DBUG_CHECK_SHARES_OPEN 10517
#define ER_DBUG_CHECK_SHARES_INFO 10518
#define ER_DBUG_CHECK_SHARES_DROPPED 10519
#define ER_INVALID_OR_OLD_TABLE_OR_DB_NAME 10520
#define ER_TC_RECOVERING_AFTER_CRASH_USING 10521
#define ER_TC_CANT_AUTO_RECOVER_WITH_TC_HEURISTIC_RECOVER 10522
#define ER_TC_BAD_MAGIC_IN_TC_LOG 10523
#define ER_TC_NEED_N_SE_SUPPORTING_2PC_FOR_RECOVERY 10524
#define ER_TC_RECOVERY_FAILED_THESE_ARE_YOUR_OPTIONS 10525
#define ER_TC_HEURISTIC_RECOVERY_MODE 10526
#define ER_TC_HEURISTIC_RECOVERY_FAILED 10527
#define ER_TC_RESTART_WITHOUT_TC_HEURISTIC_RECOVER 10528
#define ER_RPL_REPLICA_FAILED_TO_CREATE_OR_RECOVER_INFO_REPOSITORIES 10529
#define ER_RPL_REPLICA_AUTO_POSITION_IS_1_AND_GTID_MODE_IS_OFF 10530
#define ER_RPL_REPLICA_CANT_START_REPLICA_FOR_CHANNEL 10531
#define ER_RPL_REPLICA_CANT_STOP_REPLICA_FOR_CHANNEL 10532
#define ER_RPL_RECOVERY_NO_ROTATE_EVENT_FROM_SOURCE 10533
#define ER_RPL_RECOVERY_ERROR_READ_RELAY_LOG 10534
//#define OBSOLETE_ER_RPL_RECOVERY_ERROR_FREEING_IO_CACHE 10535
#define ER_RPL_RECOVERY_SKIPPED_GROUP_REPLICATION_CHANNEL 10536
#define ER_RPL_RECOVERY_ERROR 10537
#define ER_RPL_RECOVERY_IO_ERROR_READING_RELAY_LOG_INDEX 10538
#define ER_RPL_RECOVERY_FILE_SOURCE_POS_INFO 10539
#define ER_RPL_RECOVERY_REPLICATE_SAME_SERVER_ID_REQUIRES_POSITION 10540
#define ER_RPL_MTA_RECOVERY_STARTING_COORDINATOR 10541
#define ER_RPL_MTA_RECOVERY_FAILED_TO_START_COORDINATOR 10542
#define ER_RPL_MTA_AUTOMATIC_RECOVERY_FAILED 10543
#define ER_RPL_MTA_RECOVERY_CANT_OPEN_RELAY_LOG 10544
#define ER_RPL_MTA_RECOVERY_SUCCESSFUL 10545
#define ER_RPL_SERVER_ID_MISSING 10546
#define ER_RPL_CANT_CREATE_REPLICA_THREAD 10547
#define ER_RPL_REPLICA_IO_THREAD_WAS_KILLED 10548
//#define OBSOLETE_ER_RPL_REPLICA_SOURCE_UUID_HAS_CHANGED 10549
#define ER_RPL_REPLICA_USES_CHECKSUM_AND_SOURCE_PRE_50 10550
#define ER_RPL_REPLICA_SECONDS_BEHIND_SOURCE_DUBIOUS 10551
#define ER_RPL_REPLICA_CANT_FLUSH_CONNECTION_METADATA_REPOS 10552
#define ER_RPL_REPLICA_REPORT_HOST_TOO_LONG 10553
#define ER_RPL_REPLICA_REPORT_USER_TOO_LONG 10554
#define ER_RPL_REPLICA_REPORT_PASSWORD_TOO_LONG 10555
#define ER_RPL_REPLICA_ERROR_RETRYING 10556
#define ER_RPL_REPLICA_ERROR_READING_FROM_SERVER 10557
#define ER_RPL_REPLICA_DUMP_THREAD_KILLED_BY_SOURCE 10558
#define ER_RPL_MTA_STATISTICS 10559
#define ER_RPL_MTA_RECOVERY_COMPLETE 10560
#define ER_RPL_REPLICA_CANT_INIT_RELAY_LOG_POSITION 10561
//#define OBSOLETE_ER_RPL_REPLICA_CONNECTED_TO_SOURCE_REPLICATION_STARTED 10562
#define ER_RPL_REPLICA_IO_THREAD_KILLED 10563
#define ER_RPL_REPLICA_IO_THREAD_CANT_REGISTER_ON_SOURCE 10564
#define ER_RPL_REPLICA_FORCING_TO_RECONNECT_IO_THREAD 10565
#define ER_RPL_REPLICA_ERROR_REQUESTING_BINLOG_DUMP 10566
#define ER_RPL_LOG_ENTRY_EXCEEDS_REPLICA_MAX_ALLOWED_PACKET 10567
#define ER_RPL_REPLICA_STOPPING_AS_SOURCE_OOM 10568
#define ER_RPL_REPLICA_IO_THREAD_ABORTED_WAITING_FOR_RELAY_LOG_SPACE 10569
#define ER_RPL_REPLICA_IO_THREAD_EXITING 10570
#define ER_RPL_REPLICA_CANT_INITIALIZE_REPLICA_WORKER 10571
#define ER_RPL_MTA_GROUP_RECOVERY_APPLIER_METADATA_FOR_WORKER 10572
#define ER_RPL_ERROR_LOOKING_FOR_LOG 10573
#define ER_RPL_MTA_GROUP_RECOVERY_APPLIER_METADATA 10574
#define ER_RPL_CANT_FIND_FOLLOWUP_FILE 10575
#define ER_RPL_MTA_CHECKPOINT_PERIOD_DIFFERS_FROM_CNT 10576
#define ER_RPL_REPLICA_WORKER_THREAD_CREATION_FAILED 10577
#define ER_RPL_REPLICA_WORKER_THREAD_CREATION_FAILED_WITH_ERRNO 10578
#define ER_RPL_REPLICA_FAILED_TO_INIT_PARTITIONS_HASH 10579
//#define OBSOLETE_ER_RPL_SLAVE_NDB_TABLES_NOT_AVAILABLE 10580
#define ER_RPL_REPLICA_SQL_THREAD_STARTING 10581
#define ER_RPL_REPLICA_SKIP_COUNTER_EXECUTED 10582
#define ER_RPL_REPLICA_ADDITIONAL_ERROR_INFO_FROM_DA 10583
#define ER_RPL_REPLICA_ERROR_INFO_FROM_DA 10584
#define ER_RPL_REPLICA_ERROR_LOADING_USER_DEFINED_LIBRARY 10585
#define ER_RPL_REPLICA_ERROR_RUNNING_QUERY 10586
#define ER_RPL_REPLICA_SQL_THREAD_EXITING 10587
#define ER_RPL_REPLICA_READ_INVALID_EVENT_FROM_SOURCE 10588
#define ER_RPL_REPLICA_QUEUE_EVENT_FAILED_INVALID_CONFIGURATION 10589
#define ER_RPL_REPLICA_IO_THREAD_DETECTED_UNEXPECTED_EVENT_SEQUENCE 10590
#define ER_RPL_REPLICA_CANT_USE_CHARSET 10591
#define ER_RPL_REPLICA_CONNECTED_TO_SOURCE_REPLICATION_RESUMED 10592
#define ER_RPL_REPLICA_NEXT_LOG_IS_ACTIVE 10593
#define ER_RPL_REPLICA_NEXT_LOG_IS_INACTIVE 10594
#define ER_RPL_REPLICA_SQL_THREAD_IO_ERROR_READING_EVENT 10595
#define ER_RPL_REPLICA_ERROR_READING_RELAY_LOG_EVENTS 10596
#define ER_REPLICA_CHANGE_SOURCE_TO_EXECUTED 10597
#define ER_RPL_REPLICA_NEW_C_M_NEEDS_REPOS_TYPE_OTHER_THAN_FILE 10598
#define ER_RPL_FAILED_TO_STAT_LOG_IN_INDEX 10599
#define ER_RPL_LOG_NOT_FOUND_WHILE_COUNTING_RELAY_LOG_SPACE 10600
#define ER_REPLICA_CANT_USE_TEMPDIR 10601
#define ER_RPL_RELAY_LOG_NEEDS_FILE_NOT_DIRECTORY 10602
#define ER_RPL_RELAY_LOG_INDEX_NEEDS_FILE_NOT_DIRECTORY 10603
#define ER_RPL_PLEASE_USE_OPTION_RELAY_LOG 10604
#define ER_RPL_OPEN_INDEX_FILE_FAILED 10605
#define ER_RPL_CANT_INITIALIZE_GTID_SETS_IN_AM_INIT_INFO 10606
#define ER_RPL_CANT_OPEN_LOG_IN_AM_INIT_INFO 10607
#define ER_RPL_ERROR_WRITING_RELAY_LOG_CONFIGURATION 10608
//#define OBSOLETE_ER_NDB_OOM_GET_NDB_BLOBS_VALUE 10609
//#define OBSOLETE_ER_NDB_THREAD_TIMED_OUT 10610
//#define OBSOLETE_ER_NDB_TABLE_IS_NOT_DISTRIBUTED 10611
//#define OBSOLETE_ER_NDB_CREATING_TABLE 10612
//#define OBSOLETE_ER_NDB_FLUSHING_TABLE_INFO 10613
//#define OBSOLETE_ER_NDB_CLEANING_STRAY_TABLES 10614
//#define OBSOLETE_ER_NDB_DISCOVERED_MISSING_DB 10615
//#define OBSOLETE_ER_NDB_DISCOVERED_REMAINING_DB 10616
//#define OBSOLETE_ER_NDB_CLUSTER_FIND_ALL_DBS_RETRY 10617
//#define OBSOLETE_ER_NDB_CLUSTER_FIND_ALL_DBS_FAIL 10618
//#define OBSOLETE_ER_NDB_SKIPPING_SETUP_TABLE 10619
//#define OBSOLETE_ER_NDB_FAILED_TO_SET_UP_TABLE 10620
//#define OBSOLETE_ER_NDB_MISSING_FRM_DISCOVERING 10621
//#define OBSOLETE_ER_NDB_MISMATCH_IN_FRM_DISCOVERING 10622
//#define OBSOLETE_ER_NDB_BINLOG_CLEANING_UP_SETUP_LEFTOVERS 10623
//#define OBSOLETE_ER_NDB_WAITING_INFO 10624
//#define OBSOLETE_ER_NDB_WAITING_INFO_WITH_MAP 10625
//#define OBSOLETE_ER_NDB_TIMEOUT_WHILE_DISTRIBUTING 10626
//#define OBSOLETE_ER_NDB_NOT_WAITING_FOR_DISTRIBUTING 10627
//#define OBSOLETE_ER_NDB_DISTRIBUTED_INFO 10628
//#define OBSOLETE_ER_NDB_DISTRIBUTION_COMPLETE 10629
//#define OBSOLETE_ER_NDB_SCHEMA_DISTRIBUTION_FAILED 10630
//#define OBSOLETE_ER_NDB_SCHEMA_DISTRIBUTION_REPORTS_SUBSCRIBE 10631
//#define OBSOLETE_ER_NDB_SCHEMA_DISTRIBUTION_REPORTS_UNSUBSCRIBE 10632
//#define OBSOLETE_ER_NDB_BINLOG_CANT_DISCOVER_TABLE_FROM_SCHEMA_EVENT 10633
//#define OBSOLETE_ER_NDB_BINLOG_SIGNALLING_UNKNOWN_VALUE 10634
//#define OBSOLETE_ER_NDB_BINLOG_REPLY_TO 10635
//#define OBSOLETE_ER_NDB_BINLOG_CANT_RELEASE_SLOCK 10636
//#define OBSOLETE_ER_NDB_CANT_FIND_TABLE 10637
//#define OBSOLETE_ER_NDB_DISCARDING_EVENT_NO_OBJ 10638
//#define OBSOLETE_ER_NDB_DISCARDING_EVENT_ID_VERSION_MISMATCH 10639
//#define OBSOLETE_ER_NDB_CLEAR_SLOCK_INFO 10640
//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_LOCAL_TABLE 10641
//#define OBSOLETE_ER_NDB_BINLOG_ONLINE_ALTER_RENAME 10642
//#define OBSOLETE_ER_NDB_BINLOG_CANT_REOPEN_SHADOW_TABLE 10643
//#define OBSOLETE_ER_NDB_BINLOG_ONLINE_ALTER_RENAME_COMPLETE 10644
//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_DROP_OF_LOCAL_TABLE 10645
//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_RENAME_OF_LOCAL_TABLE 10646
//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_DROP_OF_TABLES 10647
//#define OBSOLETE_ER_NDB_BINLOG_GOT_DIST_PRIV_EVENT_FLUSHING_PRIVILEGES 10648
//#define OBSOLETE_ER_NDB_BINLOG_GOT_SCHEMA_EVENT 10649
//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_OLD_SCHEMA_OPERATION 10650
//#define OBSOLETE_ER_NDB_CLUSTER_FAILURE 10651
//#define OBSOLETE_ER_NDB_TABLES_INITIALLY_READ_ONLY_ON_RECONNECT 10652
//#define OBSOLETE_ER_NDB_IGNORING_UNKNOWN_EVENT 10653
//#define OBSOLETE_ER_NDB_BINLOG_OPENING_INDEX 10654
//#define OBSOLETE_ER_NDB_BINLOG_CANT_LOCK_NDB_BINLOG_INDEX 10655
//#define OBSOLETE_ER_NDB_BINLOG_INJECTING_RANDOM_WRITE_FAILURE 10656
//#define OBSOLETE_ER_NDB_BINLOG_CANT_WRITE_TO_NDB_BINLOG_INDEX 10657
//#define OBSOLETE_ER_NDB_BINLOG_WRITING_TO_NDB_BINLOG_INDEX 10658
//#define OBSOLETE_ER_NDB_BINLOG_CANT_COMMIT_TO_NDB_BINLOG_INDEX 10659
//#define OBSOLETE_ER_NDB_BINLOG_WRITE_INDEX_FAILED_AFTER_KILL 10660
//#define OBSOLETE_ER_NDB_BINLOG_USING_SERVER_ID_0_SLAVES_WILL_NOT 10661
//#define OBSOLETE_ER_NDB_SERVER_ID_RESERVED_OR_TOO_LARGE 10662
//#define OBSOLETE_ER_NDB_BINLOG_REQUIRES_V2_ROW_EVENTS 10663
//#define OBSOLETE_ER_NDB_BINLOG_STATUS_FORCING_FULL_USE_WRITE 10664
//#define OBSOLETE_ER_NDB_BINLOG_GENERIC_MESSAGE 10665
//#define OBSOLETE_ER_NDB_CONFLICT_GENERIC_MESSAGE 10666
//#define OBSOLETE_ER_NDB_TRANS_DEPENDENCY_TRACKER_ERROR 10667
//#define OBSOLETE_ER_NDB_CONFLICT_FN_PARSE_ERROR 10668
//#define OBSOLETE_ER_NDB_CONFLICT_FN_SETUP_ERROR 10669
//#define OBSOLETE_ER_NDB_BINLOG_FAILED_TO_GET_TABLE 10670
//#define OBSOLETE_ER_NDB_BINLOG_NOT_LOGGING 10671
//#define OBSOLETE_ER_NDB_BINLOG_CREATE_TABLE_EVENT_FAILED 10672
//#define OBSOLETE_ER_NDB_BINLOG_CREATE_TABLE_EVENT_INFO 10673
//#define OBSOLETE_ER_NDB_BINLOG_DISCOVER_TABLE_EVENT_INFO 10674
//#define OBSOLETE_ER_NDB_BINLOG_BLOB_REQUIRES_PK 10675
//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_EVENT_IN_DB 10676
//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_EVENT_IN_DB_AND_CANT_DROP 10677
//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_EVENT_IN_DB_DROPPED 10678
//#define OBSOLETE_ER_NDB_BINLOG_DISCOVER_REUSING_OLD_EVENT_OPS 10679
//#define OBSOLETE_ER_NDB_BINLOG_CREATING_NDBEVENTOPERATION_FAILED 10680
//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_BLOB 10681
//#define OBSOLETE_ER_NDB_BINLOG_NDBEVENT_EXECUTE_FAILED 10682
//#define OBSOLETE_ER_NDB_CREATE_EVENT_OPS_LOGGING_INFO 10683
//#define OBSOLETE_ER_NDB_BINLOG_CANT_DROP_EVENT_FROM_DB 10684
//#define OBSOLETE_ER_NDB_TIMED_OUT_IN_DROP_TABLE 10685
//#define OBSOLETE_ER_NDB_BINLOG_UNHANDLED_ERROR_FOR_TABLE 10686
//#define OBSOLETE_ER_NDB_BINLOG_CLUSTER_FAILURE 10687
//#define OBSOLETE_ER_NDB_BINLOG_UNKNOWN_NON_DATA_EVENT 10688
//#define OBSOLETE_ER_NDB_BINLOG_INJECTOR_DISCARDING_ROW_EVENT_METADATA 10689
//#define OBSOLETE_ER_NDB_REMAINING_OPEN_TABLES 10690
//#define OBSOLETE_ER_NDB_REMAINING_OPEN_TABLE_INFO 10691
//#define OBSOLETE_ER_NDB_COULD_NOT_GET_APPLY_STATUS_SHARE 10692
//#define OBSOLETE_ER_NDB_BINLOG_SERVER_SHUTDOWN_DURING_NDB_CLUSTER_START 10693
//#define OBSOLETE_ER_NDB_BINLOG_CLUSTER_RESTARTED_RESET_MASTER_SUGGESTED 10694
//#define OBSOLETE_ER_NDB_BINLOG_CLUSTER_HAS_RECONNECTED 10695
//#define OBSOLETE_ER_NDB_BINLOG_STARTING_LOG_AT_EPOCH 10696
//#define OBSOLETE_ER_NDB_BINLOG_NDB_TABLES_WRITABLE 10697
//#define OBSOLETE_ER_NDB_BINLOG_SHUTDOWN_DETECTED 10698
//#define OBSOLETE_ER_NDB_BINLOG_LOST_SCHEMA_CONNECTION_WAITING 10699
//#define OBSOLETE_ER_NDB_BINLOG_LOST_SCHEMA_CONNECTION_CONTINUING 10700
//#define OBSOLETE_ER_NDB_BINLOG_ERROR_HANDLING_SCHEMA_EVENT 10701
//#define OBSOLETE_ER_NDB_BINLOG_CANT_INJECT_APPLY_STATUS_WRITE_ROW 10702
//#define OBSOLETE_ER_NDB_BINLOG_ERROR_DURING_GCI_ROLLBACK 10703
//#define OBSOLETE_ER_NDB_BINLOG_ERROR_DURING_GCI_COMMIT 10704
//#define OBSOLETE_ER_NDB_BINLOG_LATEST_TRX_IN_EPOCH_NOT_IN_BINLOG 10705
//#define OBSOLETE_ER_NDB_BINLOG_RELEASING_EXTRA_SHARE_REFERENCES 10706
//#define OBSOLETE_ER_NDB_BINLOG_REMAINING_OPEN_TABLES 10707
//#define OBSOLETE_ER_NDB_BINLOG_REMAINING_OPEN_TABLE_INFO 10708
#define ER_TREE_CORRUPT_PARENT_SHOULD_POINT_AT_PARENT 10709
#define ER_TREE_CORRUPT_ROOT_SHOULD_BE_BLACK 10710
#define ER_TREE_CORRUPT_2_CONSECUTIVE_REDS 10711
#define ER_TREE_CORRUPT_RIGHT_IS_LEFT 10712
#define ER_TREE_CORRUPT_INCORRECT_BLACK_COUNT 10713
#define ER_WRONG_COUNT_FOR_ORIGIN 10714
#define ER_WRONG_COUNT_FOR_KEY 10715
#define ER_WRONG_COUNT_OF_ELEMENTS 10716
#define ER_RPL_ERROR_READING_REPLICA_WORKER_CONFIGURATION 10717
//#define OBSOLETE_ER_RPL_ERROR_WRITING_SLAVE_WORKER_CONFIGURATION 10718
#define ER_RPL_FAILED_TO_OPEN_RELAY_LOG 10719
#define ER_RPL_WORKER_CANT_READ_RELAY_LOG 10720
#define ER_RPL_WORKER_CANT_FIND_NEXT_RELAY_LOG 10721
#define ER_RPL_MTA_REPLICA_COORDINATOR_HAS_WAITED 10722
#define ER_BINLOG_FAILED_TO_WRITE_DROP_FOR_TEMP_TABLES 10723
#define ER_BINLOG_OOM_WRITING_DELETE_WHILE_OPENING_HEAP_TABLE 10724
#define ER_FAILED_TO_REPAIR_TABLE 10725
#define ER_FAILED_TO_REMOVE_TEMP_TABLE 10726
#define ER_SYSTEM_TABLE_NOT_TRANSACTIONAL 10727
#define ER_RPL_ERROR_WRITING_SOURCE_CONFIGURATION 10728
#define ER_RPL_ERROR_READING_SOURCE_CONFIGURATION 10729
#define ER_RPL_SSL_INFO_IN_CONNECTION_METADATA_IGNORED 10730
#define ER_PLUGIN_FAILED_DEINITIALIZATION 10731
#define ER_PLUGIN_HAS_NONZERO_REFCOUNT_AFTER_DEINITIALIZATION 10732
#define ER_PLUGIN_SHUTTING_DOWN_PLUGIN 10733
#define ER_PLUGIN_REGISTRATION_FAILED 10734
#define ER_PLUGIN_CANT_OPEN_PLUGIN_TABLE 10735
#define ER_PLUGIN_CANT_LOAD 10736
#define ER_PLUGIN_LOAD_PARAMETER_TOO_LONG 10737
#define ER_PLUGIN_FORCING_SHUTDOWN 10738
#define ER_PLUGIN_HAS_NONZERO_REFCOUNT_AFTER_SHUTDOWN 10739
#define ER_PLUGIN_UNKNOWN_VARIABLE_TYPE 10740
#define ER_PLUGIN_VARIABLE_SET_READ_ONLY 10741
#define ER_PLUGIN_VARIABLE_MISSING_NAME 10742
#define ER_PLUGIN_VARIABLE_NOT_ALLOCATED_THREAD_LOCAL 10743
#define ER_PLUGIN_OOM 10744
#define ER_PLUGIN_BAD_OPTIONS 10745
#define ER_PLUGIN_PARSING_OPTIONS_FAILED 10746
#define ER_PLUGIN_DISABLED 10747
#define ER_PLUGIN_HAS_CONFLICTING_SYSTEM_VARIABLES 10748
#define ER_PLUGIN_CANT_SET_PERSISTENT_OPTIONS 10749
#define ER_MY_NET_WRITE_FAILED_FALLING_BACK_ON_STDERR 10750
#define ER_RETRYING_REPAIR_WITHOUT_QUICK 10751
#define ER_RETRYING_REPAIR_WITH_KEYCACHE 10752
#define ER_FOUND_ROWS_WHILE_REPAIRING 10753
#define ER_ERROR_DURING_OPTIMIZE_TABLE 10754
#define ER_ERROR_ENABLING_KEYS 10755
#define ER_CHECKING_TABLE 10756
#define ER_RECOVERING_TABLE 10757
#define ER_CANT_CREATE_TABLE_SHARE_FROM_FRM 10758
#define ER_CANT_LOCK_TABLE 10759
#define ER_CANT_ALLOC_TABLE_OBJECT 10760
#define ER_CANT_CREATE_HANDLER_OBJECT_FOR_TABLE 10761
#define ER_CANT_SET_HANDLER_REFERENCE_FOR_TABLE 10762
#define ER_CANT_LOCK_TABLESPACE 10763
#define ER_CANT_UPGRADE_GENERATED_COLUMNS_TO_DD 10764
#define ER_DD_ERROR_CREATING_ENTRY 10765
#define ER_DD_CANT_FETCH_TABLE_DATA 10766
#define ER_DD_CANT_FIX_SE_DATA 10767
#define ER_DD_CANT_CREATE_SP 10768
#define ER_CANT_OPEN_DB_OPT_USING_DEFAULT_CHARSET 10769
#define ER_CANT_CREATE_CACHE_FOR_DB_OPT 10770
#define ER_CANT_IDENTIFY_CHARSET_USING_DEFAULT 10771
#define ER_DB_OPT_NOT_FOUND_USING_DEFAULT_CHARSET 10772
#define ER_EVENT_CANT_GET_TIMEZONE_FROM_FIELD 10773
#define ER_EVENT_CANT_FIND_TIMEZONE 10774
#define ER_EVENT_CANT_GET_CHARSET 10775
#define ER_EVENT_CANT_GET_COLLATION 10776
#define ER_EVENT_CANT_OPEN_TABLE_MYSQL_EVENT 10777
#define ER_CANT_PARSE_STORED_ROUTINE_BODY 10778
#define ER_CANT_OPEN_TABLE_MYSQL_PROC 10779
#define ER_CANT_READ_TABLE_MYSQL_PROC 10780
#define ER_FILE_EXISTS_DURING_UPGRADE 10781
#define ER_CANT_OPEN_DATADIR_AFTER_UPGRADE_FAILURE 10782
#define ER_CANT_SET_PATH_FOR 10783
#define ER_CANT_OPEN_DIR 10784
//#define OBSOLETE_ER_NDB_CLUSTER_CONNECTION_POOL_NODEIDS 10785
//#define OBSOLETE_ER_NDB_CANT_PARSE_NDB_CLUSTER_CONNECTION_POOL_NODEIDS 10786
//#define OBSOLETE_ER_NDB_INVALID_CLUSTER_CONNECTION_POOL_NODEIDS 10787
//#define OBSOLETE_ER_NDB_DUPLICATE_CLUSTER_CONNECTION_POOL_NODEIDS 10788
//#define OBSOLETE_ER_NDB_POOL_SIZE_CLUSTER_CONNECTION_POOL_NODEIDS 10789
//#define OBSOLETE_ER_NDB_NODEID_NOT_FIRST_CONNECTION_POOL_NODEIDS 10790
//#define OBSOLETE_ER_NDB_USING_NODEID 10791
//#define OBSOLETE_ER_NDB_CANT_ALLOC_GLOBAL_NDB_CLUSTER_CONNECTION 10792
//#define OBSOLETE_ER_NDB_CANT_ALLOC_GLOBAL_NDB_OBJECT 10793
//#define OBSOLETE_ER_NDB_USING_NODEID_LIST 10794
//#define OBSOLETE_ER_NDB_CANT_ALLOC_NDB_CLUSTER_CONNECTION 10795
//#define OBSOLETE_ER_NDB_STARTING_CONNECT_THREAD 10796
//#define OBSOLETE_ER_NDB_NODE_INFO 10797
//#define OBSOLETE_ER_NDB_CANT_START_CONNECT_THREAD 10798
//#define OBSOLETE_ER_NDB_GENERIC_ERROR 10799
//#define OBSOLETE_ER_NDB_CPU_MASK_TOO_SHORT 10800
#define ER_EVENT_ERROR_CREATING_QUERY_TO_WRITE_TO_BINLOG 10801
#define ER_EVENT_SCHEDULER_ERROR_LOADING_FROM_DB 10802
#define ER_EVENT_SCHEDULER_ERROR_GETTING_EVENT_OBJECT 10803
#define ER_EVENT_SCHEDULER_GOT_BAD_DATA_FROM_TABLE 10804
#define ER_EVENT_CANT_GET_LOCK_FOR_DROPPING_EVENT 10805
#define ER_EVENT_UNABLE_TO_DROP_EVENT 10806
//#define OBSOLETE_ER_BINLOG_ATTACHING_THREAD_MEMORY_FINALLY_AVAILABLE 10807
#define ER_BINLOG_CANT_RESIZE_CACHE 10808
#define ER_BINLOG_FILE_BEING_READ_NOT_PURGED 10809
#define ER_BINLOG_IO_ERROR_READING_HEADER 10810
//#define OBSOLETE_ER_BINLOG_CANT_OPEN_LOG 10811
//#define OBSOLETE_ER_BINLOG_CANT_CREATE_CACHE_FOR_LOG 10812
#define ER_BINLOG_FILE_EXTENSION_NUMBER_EXHAUSTED 10813
#define ER_BINLOG_FILE_NAME_TOO_LONG 10814
#define ER_BINLOG_FILE_EXTENSION_NUMBER_RUNNING_LOW 10815
#define ER_BINLOG_CANT_OPEN_FOR_LOGGING 10816
#define ER_BINLOG_FAILED_TO_SYNC_INDEX_FILE 10817
#define ER_BINLOG_ERROR_READING_GTIDS_FROM_RELAY_LOG 10818
#define ER_BINLOG_EVENTS_READ_FROM_APPLIER_METADATA 10819
#define ER_BINLOG_ERROR_READING_GTIDS_FROM_BINARY_LOG 10820
#define ER_BINLOG_EVENTS_READ_FROM_BINLOG_INFO 10821
#define ER_BINLOG_CANT_GENERATE_NEW_FILE_NAME 10822
#define ER_BINLOG_FAILED_TO_SYNC_INDEX_FILE_IN_OPEN 10823
#define ER_BINLOG_CANT_USE_FOR_LOGGING 10824
#define ER_BINLOG_FAILED_TO_CLOSE_INDEX_FILE_WHILE_REBUILDING 10825
#define ER_BINLOG_FAILED_TO_DELETE_INDEX_FILE_WHILE_REBUILDING 10826
#define ER_BINLOG_FAILED_TO_RENAME_INDEX_FILE_WHILE_REBUILDING 10827
#define ER_BINLOG_FAILED_TO_OPEN_INDEX_FILE_AFTER_REBUILDING 10828
#define ER_BINLOG_CANT_APPEND_LOG_TO_TMP_INDEX 10829
#define ER_BINLOG_CANT_LOCATE_OLD_BINLOG_OR_RELAY_LOG_FILES 10830
#define ER_BINLOG_CANT_DELETE_FILE 10831
#define ER_BINLOG_CANT_SET_TMP_INDEX_NAME 10832
#define ER_BINLOG_FAILED_TO_OPEN_TEMPORARY_INDEX_FILE 10833
//#define OBSOLETE_ER_BINLOG_ERROR_GETTING_NEXT_LOG_FROM_INDEX 10834
#define ER_BINLOG_CANT_OPEN_TMP_INDEX 10835
#define ER_BINLOG_CANT_COPY_INDEX_TO_TMP 10836
#define ER_BINLOG_CANT_CLOSE_TMP_INDEX 10837
#define ER_BINLOG_CANT_MOVE_TMP_TO_INDEX 10838
#define ER_BINLOG_PURGE_LOGS_CALLED_WITH_FILE_NOT_IN_INDEX 10839
#define ER_BINLOG_PURGE_LOGS_CANT_SYNC_INDEX_FILE 10840
#define ER_BINLOG_PURGE_LOGS_CANT_COPY_TO_REGISTER_FILE 10841
#define ER_BINLOG_PURGE_LOGS_CANT_FLUSH_REGISTER_FILE 10842
#define ER_BINLOG_PURGE_LOGS_CANT_UPDATE_INDEX_FILE 10843
#define ER_BINLOG_PURGE_LOGS_FAILED_TO_PURGE_LOG 10844
#define ER_BINLOG_FAILED_TO_SET_PURGE_INDEX_FILE_NAME 10845
#define ER_BINLOG_FAILED_TO_OPEN_REGISTER_FILE 10846
#define ER_BINLOG_FAILED_TO_REINIT_REGISTER_FILE 10847
#define ER_BINLOG_FAILED_TO_READ_REGISTER_FILE 10848
#define ER_CANT_STAT_FILE 10849
#define ER_BINLOG_CANT_DELETE_LOG_FILE_DOES_INDEX_MATCH_FILES 10850
#define ER_BINLOG_CANT_DELETE_FILE_AND_READ_BINLOG_INDEX 10851
#define ER_BINLOG_FAILED_TO_DELETE_LOG_FILE 10852
#define ER_BINLOG_LOGGING_INCIDENT_TO_STOP_REPLICAS 10853
#define ER_BINLOG_CANT_FIND_LOG_IN_INDEX 10854
#define ER_BINLOG_RECOVERING_AFTER_CRASH_USING 10855
#define ER_BINLOG_CANT_OPEN_CRASHED_BINLOG 10856
#define ER_BINLOG_CANT_TRIM_CRASHED_BINLOG 10857
#define ER_BINLOG_CRASHED_BINLOG_TRIMMED 10858
#define ER_BINLOG_CANT_CLEAR_IN_USE_FLAG_FOR_CRASHED_BINLOG 10859
#define ER_BINLOG_FAILED_TO_RUN_AFTER_SYNC_HOOK 10860
#define ER_TURNING_LOGGING_OFF_FOR_THE_DURATION 10861
#define ER_BINLOG_FAILED_TO_RUN_AFTER_FLUSH_HOOK 10862
//#define OBSOLETE_ER_BINLOG_CRASH_RECOVERY_FAILED 10863
#define ER_BINLOG_WARNING_SUPPRESSED 10864
#define ER_NDB_LOG_ENTRY 10865
#define ER_NDB_LOG_ENTRY_WITH_PREFIX 10866
//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_PURGE_THD 10867
#define ER_INNODB_UNKNOWN_COLLATION 10868
#define ER_INNODB_INVALID_LOG_GROUP_HOME_DIR 10869
#define ER_INNODB_INVALID_INNODB_UNDO_DIRECTORY 10870
#define ER_INNODB_ILLEGAL_COLON_IN_POOL 10871
#define ER_INNODB_INVALID_PAGE_SIZE 10872
#define ER_INNODB_DIRTY_WATER_MARK_NOT_LOW 10873
#define ER_INNODB_IO_CAPACITY_EXCEEDS_MAX 10874
#define ER_INNODB_FILES_SAME 10875
#define ER_INNODB_UNREGISTERED_TRX_ACTIVE 10876
#define ER_INNODB_CLOSING_CONNECTION_ROLLS_BACK 10877
#define ER_INNODB_TRX_XLATION_TABLE_OOM 10878
#define ER_INNODB_CANT_FIND_INDEX_IN_INNODB_DD 10879
#define ER_INNODB_INDEX_COLUMN_INFO_UNLIKE_MYSQLS 10880
//#define OBSOLETE_ER_INNODB_CANT_OPEN_TABLE 10881
#define ER_INNODB_CANT_BUILD_INDEX_XLATION_TABLE_FOR 10882
#define ER_INNODB_PK_NOT_IN_MYSQL 10883
#define ER_INNODB_PK_ONLY_IN_MYSQL 10884
#define ER_INNODB_CLUSTERED_INDEX_PRIVATE 10885
//#define OBSOLETE_ER_INNODB_PARTITION_TABLE_LOWERCASED 10886
#define ER_ERRMSG_REPLACEMENT_DODGY 10887
#define ER_ERRMSG_REPLACEMENTS_FAILED 10888
#define ER_NPIPE_CANT_CREATE 10889
#define ER_PARTITION_MOVE_CREATED_DUPLICATE_ROW_PLEASE_FIX 10890
#define ER_AUDIT_CANT_ABORT_COMMAND 10891
#define ER_AUDIT_CANT_ABORT_EVENT 10892
#define ER_AUDIT_WARNING 10893
//#define OBSOLETE_ER_NDB_NUMBER_OF_CHANNELS 10894
//#define OBSOLETE_ER_NDB_REPLICA_PARALLEL_WORKERS 10895
//#define OBSOLETE_ER_NDB_DISTRIBUTING_ERR 10896
#define ER_RPL_REPLICA_INSECURE_CHANGE_SOURCE 10897
//#define OBSOLETE_ER_RPL_SLAVE_FLUSH_RELAY_LOGS_NOT_ALLOWED 10898
#define ER_RPL_REPLICA_INCORRECT_CHANNEL 10899
#define ER_FAILED_TO_FIND_DL_ENTRY 10900
#define ER_FAILED_TO_OPEN_SHARED_LIBRARY 10901
#define ER_THREAD_PRIORITY_IGNORED 10902
#define ER_BINLOG_CACHE_SIZE_TOO_LARGE 10903
#define ER_BINLOG_STMT_CACHE_SIZE_TOO_LARGE 10904
#define ER_FAILED_TO_GENERATE_UNIQUE_LOGFILE 10905
#define ER_FAILED_TO_READ_FILE 10906
#define ER_FAILED_TO_WRITE_TO_FILE 10907
#define ER_BINLOG_UNSAFE_MESSAGE_AND_STATEMENT 10908
#define ER_FORCE_CLOSE_THREAD 10909
#define ER_SERVER_SHUTDOWN_COMPLETE 10910
#define ER_RPL_CANT_HAVE_SAME_BASENAME 10911
#define ER_RPL_GTID_MODE_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 10912
#define ER_WARN_NO_SERVERID_SPECIFIED 10913
#define ER_ABORTING_USER_CONNECTION 10914
#define ER_SQL_MODE_MERGED_WITH_STRICT_MODE 10915
#define ER_GTID_PURGED_WAS_UPDATED 10916
#define ER_GTID_EXECUTED_WAS_UPDATED 10917
#define ER_DEPRECATE_MSG_WITH_REPLACEMENT 10918
#define ER_TRG_CREATION_CTX_NOT_SET 10919
#define ER_FILE_HAS_OLD_FORMAT 10920
#define ER_VIEW_CREATION_CTX_NOT_SET 10921
//#define OBSOLETE_ER_TABLE_NAME_CAUSES_TOO_LONG_PATH 10922
#define ER_TABLE_UPGRADE_REQUIRED 10923
#define ER_GET_ERRNO_FROM_STORAGE_ENGINE 10924
#define ER_ACCESS_DENIED_ERROR_WITHOUT_PASSWORD 10925
#define ER_ACCESS_DENIED_ERROR_WITH_PASSWORD 10926
#define ER_ACCESS_DENIED_FOR_USER_ACCOUNT_LOCKED 10927
//#define OBSOLETE_ER_MUST_CHANGE_EXPIRED_PASSWORD 10928
#define ER_SYSTEM_TABLES_NOT_SUPPORTED_BY_STORAGE_ENGINE 10929
//#define OBSOLETE_ER_FILESORT_TERMINATED 10930
#define ER_SERVER_STARTUP_MSG 10931
#define ER_FAILED_TO_FIND_LOCALE_NAME 10932
#define ER_FAILED_TO_FIND_COLLATION_NAME 10933
#define ER_SERVER_OUT_OF_RESOURCES 10934
#define ER_SERVER_OUTOFMEMORY 10935
#define ER_INVALID_COLLATION_FOR_CHARSET 10936
#define ER_CANT_START_ERROR_LOG_SERVICE 10937
#define ER_CREATING_NEW_UUID_FIRST_START 10938
#define ER_FAILED_TO_GET_ABSOLUTE_PATH 10939
#define ER_PERFSCHEMA_COMPONENTS_INFRASTRUCTURE_BOOTSTRAP 10940
#define ER_PERFSCHEMA_COMPONENTS_INFRASTRUCTURE_SHUTDOWN 10941
#define ER_DUP_FD_OPEN_FAILED 10942
#define ER_SYSTEM_VIEW_INIT_FAILED 10943
#define ER_RESOURCE_GROUP_POST_INIT_FAILED 10944
#define ER_RESOURCE_GROUP_SUBSYSTEM_INIT_FAILED 10945
#define ER_FAILED_START_MYSQLD_DAEMON 10946
#define ER_CANNOT_CHANGE_TO_ROOT_DIR 10947
#define ER_PERSISTENT_PRIVILEGES_BOOTSTRAP 10948
#define ER_BASEDIR_SET_TO 10949
#define ER_RPL_FILTER_ADD_WILD_DO_TABLE_FAILED 10950
#define ER_RPL_FILTER_ADD_WILD_IGNORE_TABLE_FAILED 10951
#define ER_PRIVILEGE_SYSTEM_INIT_FAILED 10952
#define ER_CANNOT_SET_LOG_ERROR_SERVICES 10953
#define ER_PERFSCHEMA_TABLES_INIT_FAILED 10954
#define ER_TX_EXTRACTION_ALGORITHM_FOR_BINLOG_TX_DEPEDENCY_TRACKING 10955
//#define OBSOLETE_ER_INVALID_REPLICATION_TIMESTAMPS 10956
//#define OBSOLETE_ER_RPL_TIMESTAMPS_RETURNED_TO_NORMAL 10957
#define ER_BINLOG_FILE_OPEN_FAILED 10958
#define ER_BINLOG_EVENT_WRITE_TO_STMT_CACHE_FAILED 10959
#define ER_REPLICA_RELAY_LOG_TRUNCATE_INFO 10960
#define ER_REPLICA_RELAY_LOG_PURGE_FAILED 10961
#define ER_RPL_REPLICA_FILTER_CREATE_FAILED 10962
#define ER_RPL_REPLICA_GLOBAL_FILTERS_COPY_FAILED 10963
#define ER_RPL_REPLICA_RESET_FILTER_OPTIONS 10964
#define ER_MISSING_GRANT_SYSTEM_TABLE 10965
#define ER_MISSING_ACL_SYSTEM_TABLE 10966
#define ER_ANONYMOUS_AUTH_ID_NOT_ALLOWED_IN_MANDATORY_ROLES 10967
#define ER_UNKNOWN_AUTH_ID_IN_MANDATORY_ROLE 10968
#define ER_WRITE_ROW_TO_PARTITION_FAILED 10969
#define ER_RESOURCE_GROUP_METADATA_UPDATE_SKIPPED 10970
#define ER_FAILED_TO_PERSIST_RESOURCE_GROUP_METADATA 10971
#define ER_FAILED_TO_DESERIALIZE_RESOURCE_GROUP 10972
#define ER_FAILED_TO_UPDATE_RESOURCE_GROUP 10973
#define ER_RESOURCE_GROUP_VALIDATION_FAILED 10974
#define ER_FAILED_TO_ALLOCATE_MEMORY_FOR_RESOURCE_GROUP 10975
#define ER_FAILED_TO_ALLOCATE_MEMORY_FOR_RESOURCE_GROUP_HASH 10976
#define ER_FAILED_TO_ADD_RESOURCE_GROUP_TO_MAP 10977
#define ER_RESOURCE_GROUP_IS_DISABLED 10978
#define ER_FAILED_TO_APPLY_RESOURCE_GROUP_CONTROLLER 10979
#define ER_FAILED_TO_ACQUIRE_LOCK_ON_RESOURCE_GROUP 10980
#define ER_PFS_NOTIFICATION_FUNCTION_REGISTER_FAILED 10981
#define ER_RES_GRP_SET_THR_AFFINITY_FAILED 10982
#define ER_RES_GRP_SET_THR_AFFINITY_TO_CPUS_FAILED 10983
#define ER_RES_GRP_THD_UNBIND_FROM_CPU_FAILED 10984
#define ER_RES_GRP_SET_THREAD_PRIORITY_FAILED 10985
#define ER_RES_GRP_FAILED_TO_DETERMINE_NICE_CAPABILITY 10986
#define ER_RES_GRP_FAILED_TO_GET_THREAD_HANDLE 10987
#define ER_RES_GRP_GET_THREAD_PRIO_NOT_SUPPORTED 10988
#define ER_RES_GRP_FAILED_DETERMINE_CPU_COUNT 10989
#define ER_RES_GRP_FEATURE_NOT_AVAILABLE 10990
#define ER_RES_GRP_INVALID_THREAD_PRIORITY 10991
#define ER_RES_GRP_SOLARIS_PROCESSOR_BIND_TO_CPUID_FAILED 10992
#define ER_RES_GRP_SOLARIS_PROCESSOR_BIND_TO_THREAD_FAILED 10993
#define ER_RES_GRP_SOLARIS_PROCESSOR_AFFINITY_FAILED 10994
#define ER_DD_UPGRADE_RENAME_IDX_STATS_FILE_FAILED 10995
#define ER_DD_UPGRADE_DD_OPEN_FAILED 10996
#define ER_DD_UPGRADE_FAILED_TO_FETCH_TABLESPACES 10997
#define ER_DD_UPGRADE_FAILED_TO_ACQUIRE_TABLESPACE 10998
#define ER_DD_UPGRADE_FAILED_TO_RESOLVE_TABLESPACE_ENGINE 10999
#define ER_FAILED_TO_CREATE_SDI_FOR_TABLESPACE 11000
#define ER_FAILED_TO_STORE_SDI_FOR_TABLESPACE 11001
#define ER_DD_UPGRADE_FAILED_TO_FETCH_TABLES 11002
#define ER_DD_UPGRADE_DD_POPULATED 11003
#define ER_DD_UPGRADE_INFO_FILE_OPEN_FAILED 11004
#define ER_DD_UPGRADE_INFO_FILE_CLOSE_FAILED 11005
#define ER_DD_UPGRADE_TABLESPACE_MIGRATION_FAILED 11006
#define ER_DD_UPGRADE_FAILED_TO_CREATE_TABLE_STATS 11007
#define ER_DD_UPGRADE_TABLE_STATS_MIGRATE_COMPLETED 11008
#define ER_DD_UPGRADE_FAILED_TO_CREATE_INDEX_STATS 11009
#define ER_DD_UPGRADE_INDEX_STATS_MIGRATE_COMPLETED 11010
#define ER_DD_UPGRADE_FAILED_FIND_VALID_DATA_DIR 11011
#define ER_DD_UPGRADE_START 11012
#define ER_DD_UPGRADE_FAILED_INIT_DD_SE 11013
#define ER_DD_UPGRADE_FOUND_PARTIALLY_UPGRADED_DD_ABORT 11014
#define ER_DD_UPGRADE_FOUND_PARTIALLY_UPGRADED_DD_CONTINUE 11015
#define ER_DD_UPGRADE_SE_LOGS_FAILED 11016
#define ER_DD_UPGRADE_SDI_INFO_UPDATE_FAILED 11017
#define ER_SKIP_UPDATING_METADATA_IN_SE_RO_MODE 11018
#define ER_CREATED_SYSTEM_WITH_VERSION 11019
#define ER_UNKNOWN_ERROR_DETECTED_IN_SE 11020
#define ER_READ_LOG_EVENT_FAILED 11021
#define ER_ROW_DATA_TOO_BIG_TO_WRITE_IN_BINLOG 11022
#define ER_FAILED_TO_CONSTRUCT_DROP_EVENT_QUERY 11023
#define ER_FAILED_TO_BINLOG_DROP_EVENT 11024
#define ER_FAILED_TO_START_REPLICA_THREAD 11025
#define ER_RPL_IO_THREAD_KILLED 11026
#define ER_REPLICA_RECONNECT_FAILED 11027
#define ER_REPLICA_KILLED_AFTER_RECONNECT 11028
#define ER_REPLICA_NOT_STARTED_ON_SOME_CHANNELS 11029
#define ER_FAILED_TO_ADD_RPL_FILTER 11030
#define ER_PER_CHANNEL_RPL_FILTER_CONF_FOR_GRP_RPL 11031
#define ER_RPL_FILTERS_NOT_ATTACHED_TO_CHANNEL 11032
#define ER_FAILED_TO_BUILD_DO_AND_IGNORE_TABLE_HASHES 11033
#define ER_CLONE_PLUGIN_NOT_LOADED_TRACE 11034
#define ER_CLONE_HANDLER_EXIST_TRACE 11035
#define ER_CLONE_CREATE_HANDLER_FAIL_TRACE 11036
#define ER_CYCLE_TIMER_IS_NOT_AVAILABLE 11037
#define ER_NANOSECOND_TIMER_IS_NOT_AVAILABLE 11038
#define ER_MICROSECOND_TIMER_IS_NOT_AVAILABLE 11039
#define ER_PFS_MALLOC_ARRAY_OVERFLOW 11040
#define ER_PFS_MALLOC_ARRAY_OOM 11041
#define ER_INNODB_FAILED_TO_FIND_IDX_WITH_KEY_NO 11042
#define ER_INNODB_FAILED_TO_FIND_IDX 11043
#define ER_INNODB_FAILED_TO_FIND_IDX_FROM_DICT_CACHE 11044
#define ER_INNODB_ACTIVE_INDEX_CHANGE_FAILED 11045
#define ER_INNODB_DIFF_IN_REF_LEN 11046
#define ER_WRONG_TYPE_FOR_COLUMN_PREFIX_IDX_FLD 11047
#define ER_INNODB_CANNOT_CREATE_TABLE 11048
#define ER_INNODB_INTERNAL_INDEX 11049
#define ER_INNODB_IDX_CNT_MORE_THAN_DEFINED_IN_MYSQL 11050
#define ER_INNODB_IDX_CNT_FEWER_THAN_DEFINED_IN_MYSQL 11051
#define ER_INNODB_IDX_COLUMN_CNT_DIFF 11052
#define ER_INNODB_USE_MONITOR_GROUP_NAME 11053
#define ER_INNODB_MONITOR_DEFAULT_VALUE_NOT_DEFINED 11054
#define ER_INNODB_MONITOR_IS_ENABLED 11055
#define ER_INNODB_INVALID_MONITOR_COUNTER_NAME 11056
#define ER_WIN_LOAD_LIBRARY_FAILED 11057
#define ER_PARTITION_HANDLER_ADMIN_MSG 11058
#define ER_RPL_AM_INIT_INFO_MSG 11059
#define ER_DD_UPGRADE_TABLE_INTACT_ERROR 11060
#define ER_SERVER_INIT_COMPILED_IN_COMMANDS 11061
#define ER_MYISAM_CHECK_METHOD_ERROR 11062
#define ER_MYISAM_CRASHED_ERROR 11063
#define ER_WAITPID_FAILED 11064
#define ER_FAILED_TO_FIND_MYSQLD_STATUS 11065
#define ER_INNODB_ERROR_LOGGER_MSG 11066
#define ER_INNODB_ERROR_LOGGER_FATAL_MSG 11067
#define ER_DEPRECATED_SYNTAX_WITH_REPLACEMENT 11068
#define ER_DEPRECATED_SYNTAX_NO_REPLACEMENT 11069
#define ER_DEPRECATE_MSG_NO_REPLACEMENT 11070
#define ER_LOG_PRINTF_MSG 11071
#define ER_BINLOG_LOGGING_NOT_POSSIBLE 11072
#define ER_FAILED_TO_SET_PERSISTED_OPTIONS 11073
#define ER_COMPONENTS_FAILED_TO_ACQUIRE_SERVICE_IMPLEMENTATION 11074
#define ER_RES_GRP_INVALID_VCPU_RANGE 11075
#define ER_RES_GRP_INVALID_VCPU_ID 11076
#define ER_ERROR_DURING_FLUSH_LOG_COMMIT_PHASE 11077
#define ER_DROP_DATABASE_FAILED_RMDIR_MANUALLY 11078
#define ER_EXPIRE_LOGS_DAYS_IGNORED 11079
#define ER_BINLOG_MALFORMED_OR_OLD_RELAY_LOG 11080
#define ER_DD_UPGRADE_VIEW_COLUMN_NAME_TOO_LONG 11081
#define ER_TABLE_NEEDS_DUMP_UPGRADE 11082
#define ER_DD_UPGRADE_FAILED_TO_UPDATE_VER_NO_IN_TABLESPACE 11083
#define ER_KEYRING_MIGRATION_FAILED 11084
#define ER_KEYRING_MIGRATION_SUCCESSFUL 11085
#define ER_RESTART_RECEIVED_INFO 11086
#define ER_LCTN_CHANGED 11087
#define ER_DD_INITIALIZE 11088
#define ER_DD_RESTART 11089
#define ER_DD_UPGRADE 11090
#define ER_DD_UPGRADE_OFF 11091
#define ER_DD_UPGRADE_VERSION_NOT_SUPPORTED 11092
#define ER_DD_UPGRADE_SCHEMA_UNAVAILABLE 11093
#define ER_DD_MINOR_DOWNGRADE 11094
#define ER_DD_MINOR_DOWNGRADE_VERSION_NOT_SUPPORTED 11095
#define ER_DD_NO_VERSION_FOUND 11096
#define ER_THREAD_POOL_NOT_SUPPORTED_ON_PLATFORM 11097
#define ER_THREAD_POOL_SIZE_TOO_LOW 11098
#define ER_THREAD_POOL_SIZE_TOO_HIGH 11099
#define ER_THREAD_POOL_ALGORITHM_INVALID 11100
#define ER_THREAD_POOL_INVALID_STALL_LIMIT 11101
#define ER_THREAD_POOL_INVALID_PRIO_KICKUP_TIMER 11102
#define ER_THREAD_POOL_MAX_UNUSED_THREADS_INVALID 11103
#define ER_THREAD_POOL_CON_HANDLER_INIT_FAILED 11104
#define ER_THREAD_POOL_INIT_FAILED 11105
//#define OBSOLETE_ER_THREAD_POOL_PLUGIN_STARTED 11106
#define ER_THREAD_POOL_CANNOT_SET_THREAD_SPECIFIC_DATA 11107
#define ER_THREAD_POOL_FAILED_TO_CREATE_CONNECT_HANDLER_THD 11108
#define ER_THREAD_POOL_FAILED_TO_CREATE_THD_AND_AUTH_CONN 11109
#define ER_THREAD_POOL_FAILED_PROCESS_CONNECT_EVENT 11110
#define ER_THREAD_POOL_FAILED_TO_CREATE_POOL 11111
#define ER_THREAD_POOL_RATE_LIMITED_ERROR_MSGS 11112
#define ER_TRHEAD_POOL_LOW_LEVEL_INIT_FAILED 11113
#define ER_THREAD_POOL_LOW_LEVEL_REARM_FAILED 11114
#define ER_THREAD_POOL_BUFFER_TOO_SMALL 11115
#define ER_MECAB_NOT_SUPPORTED 11116
#define ER_MECAB_NOT_VERIFIED 11117
#define ER_MECAB_CREATING_MODEL 11118
#define ER_MECAB_FAILED_TO_CREATE_MODEL 11119
#define ER_MECAB_FAILED_TO_CREATE_TRIGGER 11120
#define ER_MECAB_UNSUPPORTED_CHARSET 11121
#define ER_MECAB_CHARSET_LOADED 11122
#define ER_MECAB_PARSE_FAILED 11123
#define ER_MECAB_OOM_WHILE_PARSING_TEXT 11124
#define ER_MECAB_CREATE_LATTICE_FAILED 11125
#define ER_SEMISYNC_TRACE_ENTER_FUNC 11126
#define ER_SEMISYNC_TRACE_EXIT_WITH_INT_EXIT_CODE 11127
#define ER_SEMISYNC_TRACE_EXIT_WITH_BOOL_EXIT_CODE 11128
#define ER_SEMISYNC_TRACE_EXIT 11129
#define ER_SEMISYNC_RPL_INIT_FOR_TRX 11130
#define ER_SEMISYNC_FAILED_TO_ALLOCATE_TRX_NODE 11131
#define ER_SEMISYNC_BINLOG_WRITE_OUT_OF_ORDER 11132
#define ER_SEMISYNC_INSERT_LOG_INFO_IN_ENTRY 11133
#define ER_SEMISYNC_PROBE_LOG_INFO_IN_ENTRY 11134
#define ER_SEMISYNC_CLEARED_ALL_ACTIVE_TRANSACTION_NODES 11135
#define ER_SEMISYNC_CLEARED_ACTIVE_TRANSACTION_TILL_POS 11136
#define ER_SEMISYNC_REPLY_MAGIC_NO_ERROR 11137
#define ER_SEMISYNC_REPLY_PKT_LENGTH_TOO_SMALL 11138
#define ER_SEMISYNC_REPLY_BINLOG_FILE_TOO_LARGE 11139
#define ER_SEMISYNC_SERVER_REPLY 11140
#define ER_SEMISYNC_FUNCTION_CALLED_TWICE 11141
#define ER_SEMISYNC_RPL_ENABLED_ON_SOURCE 11142
#define ER_SEMISYNC_SOURCE_OOM 11143
#define ER_SEMISYNC_DISABLED_ON_SOURCE 11144
#define ER_SEMISYNC_FORCED_SHUTDOWN 11145
#define ER_SEMISYNC_SOURCE_GOT_REPLY_AT_POS 11146
#define ER_SEMISYNC_SOURCE_SIGNAL_ALL_WAITING_THREADS 11147
#define ER_SEMISYNC_SOURCE_TRX_WAIT_POS 11148
#define ER_SEMISYNC_BINLOG_REPLY_IS_AHEAD 11149
#define ER_SEMISYNC_MOVE_BACK_WAIT_POS 11150
#define ER_SEMISYNC_INIT_WAIT_POS 11151
#define ER_SEMISYNC_WAIT_TIME_FOR_BINLOG_SENT 11152
#define ER_SEMISYNC_WAIT_FOR_BINLOG_TIMEDOUT 11153
#define ER_SEMISYNC_WAIT_TIME_ASSESSMENT_FOR_COMMIT_TRX_FAILED 11154
#define ER_SEMISYNC_RPL_SWITCHED_OFF 11155
#define ER_SEMISYNC_RPL_SWITCHED_ON 11156
#define ER_SEMISYNC_NO_SPACE_IN_THE_PKT 11157
#define ER_SEMISYNC_SYNC_HEADER_UPDATE_INFO 11158
#define ER_SEMISYNC_FAILED_TO_INSERT_TRX_NODE 11159
#define ER_SEMISYNC_TRX_SKIPPED_AT_POS 11160
#define ER_SEMISYNC_SOURCE_FAILED_ON_NET_FLUSH 11161
#define ER_SEMISYNC_RECEIVED_ACK_IS_SMALLER 11162
#define ER_SEMISYNC_ADD_ACK_TO_SLOT 11163
#define ER_SEMISYNC_UPDATE_EXISTING_REPLICA_ACK 11164
#define ER_SEMISYNC_FAILED_TO_START_ACK_RECEIVER_THD 11165
#define ER_SEMISYNC_STARTING_ACK_RECEIVER_THD 11166
#define ER_SEMISYNC_FAILED_TO_WAIT_ON_DUMP_SOCKET 11167
#define ER_SEMISYNC_STOPPING_ACK_RECEIVER_THREAD 11168
#define ER_SEMISYNC_FAILED_REGISTER_REPLICA_TO_RECEIVER 11169
#define ER_SEMISYNC_START_BINLOG_DUMP_TO_REPLICA 11170
#define ER_SEMISYNC_STOP_BINLOG_DUMP_TO_REPLICA 11171
#define ER_SEMISYNC_UNREGISTER_TRX_OBSERVER_FAILED 11172
#define ER_SEMISYNC_UNREGISTER_BINLOG_STORAGE_OBSERVER_FAILED 11173
#define ER_SEMISYNC_UNREGISTER_BINLOG_TRANSMIT_OBSERVER_FAILED 11174
#define ER_SEMISYNC_UNREGISTERED_REPLICATOR 11175
#define ER_SEMISYNC_SOCKET_FD_TOO_LARGE 11176
#define ER_SEMISYNC_REPLICA_REPLY 11177
#define ER_SEMISYNC_MISSING_MAGIC_NO_FOR_SEMISYNC_PKT 11178
#define ER_SEMISYNC_REPLICA_START 11179
#define ER_SEMISYNC_REPLICA_REPLY_WITH_BINLOG_INFO 11180
#define ER_SEMISYNC_REPLICA_NET_FLUSH_REPLY_FAILED 11181
#define ER_SEMISYNC_REPLICA_SEND_REPLY_FAILED 11182
#define ER_SEMISYNC_EXECUTION_FAILED_ON_SOURCE 11183
#define ER_SEMISYNC_NOT_SUPPORTED_BY_SOURCE 11184
#define ER_SEMISYNC_REPLICA_SET_FAILED 11185
#define ER_SEMISYNC_FAILED_TO_STOP_ACK_RECEIVER_THD 11186
#define ER_FIREWALL_FAILED_TO_READ_FIREWALL_TABLES 11187
#define ER_FIREWALL_FAILED_TO_REG_DYNAMIC_PRIVILEGES 11188
#define ER_FIREWALL_RECORDING_STMT_WAS_TRUNCATED 11189
#define ER_FIREWALL_RECORDING_STMT_WITHOUT_TEXT 11190
#define ER_FIREWALL_SUSPICIOUS_STMT 11191
#define ER_FIREWALL_ACCESS_DENIED 11192
#define ER_FIREWALL_SKIPPED_UNKNOWN_USER_MODE 11193
#define ER_FIREWALL_RELOADING_CACHE 11194
#define ER_FIREWALL_RESET_FOR_USER 11195
#define ER_FIREWALL_STATUS_FLUSHED 11196
#define ER_KEYRING_LOGGER_ERROR_MSG 11197
#define ER_AUDIT_LOG_FILTER_IS_NOT_INSTALLED 11198
#define ER_AUDIT_LOG_SWITCHING_TO_INCLUDE_LIST 11199
#define ER_AUDIT_LOG_CANNOT_SET_LOG_POLICY_WITH_OTHER_POLICIES 11200
#define ER_AUDIT_LOG_ONLY_INCLUDE_LIST_USED 11201
#define ER_AUDIT_LOG_INDEX_MAP_CANNOT_ACCESS_DIR 11202
#define ER_AUDIT_LOG_WRITER_RENAME_FILE_FAILED 11203
#define ER_AUDIT_LOG_WRITER_DEST_FILE_ALREADY_EXISTS 11204
#define ER_AUDIT_LOG_WRITER_RENAME_FILE_FAILED_REMOVE_FILE_MANUALLY 11205
#define ER_AUDIT_LOG_WRITER_INCOMPLETE_FILE_RENAMED 11206
#define ER_AUDIT_LOG_WRITER_FAILED_TO_WRITE_TO_FILE 11207
#define ER_AUDIT_LOG_EC_WRITER_FAILED_TO_INIT_ENCRYPTION 11208
#define ER_AUDIT_LOG_EC_WRITER_FAILED_TO_INIT_COMPRESSION 11209
#define ER_AUDIT_LOG_EC_WRITER_FAILED_TO_CREATE_FILE 11210
#define ER_AUDIT_LOG_RENAME_LOG_FILE_BEFORE_FLUSH 11211
#define ER_AUDIT_LOG_FILTER_RESULT_MSG 11212
#define ER_AUDIT_LOG_JSON_READER_FAILED_TO_PARSE 11213
#define ER_AUDIT_LOG_JSON_READER_BUF_TOO_SMALL 11214
#define ER_AUDIT_LOG_JSON_READER_FAILED_TO_OPEN_FILE 11215
#define ER_AUDIT_LOG_JSON_READER_FILE_PARSING_ERROR 11216
//#define OBSOLETE_ER_AUDIT_LOG_FILTER_INVALID_COLUMN_COUNT 11217
//#define OBSOLETE_ER_AUDIT_LOG_FILTER_INVALID_COLUMN_DEFINITION 11218
#define ER_AUDIT_LOG_FILTER_FAILED_TO_STORE_TABLE_FLDS 11219
#define ER_AUDIT_LOG_FILTER_FAILED_TO_UPDATE_TABLE 11220
#define ER_AUDIT_LOG_FILTER_FAILED_TO_INSERT_INTO_TABLE 11221
#define ER_AUDIT_LOG_FILTER_FAILED_TO_DELETE_FROM_TABLE 11222
#define ER_AUDIT_LOG_FILTER_FAILED_TO_INIT_TABLE_FOR_READ 11223
#define ER_AUDIT_LOG_FILTER_FAILED_TO_READ_TABLE 11224
#define ER_AUDIT_LOG_FILTER_FAILED_TO_CLOSE_TABLE_AFTER_READING 11225
#define ER_AUDIT_LOG_FILTER_USER_AND_HOST_CANNOT_BE_EMPTY 11226
#define ER_AUDIT_LOG_FILTER_FLD_FILTERNAME_CANNOT_BE_EMPTY 11227
#define ER_VALIDATE_PWD_DICT_FILE_NOT_SPECIFIED 11228
#define ER_VALIDATE_PWD_DICT_FILE_NOT_LOADED 11229
#define ER_VALIDATE_PWD_DICT_FILE_TOO_BIG 11230
#define ER_VALIDATE_PWD_FAILED_TO_READ_DICT_FILE 11231
#define ER_VALIDATE_PWD_FAILED_TO_GET_FLD_FROM_SECURITY_CTX 11232
#define ER_VALIDATE_PWD_FAILED_TO_GET_SECURITY_CTX 11233
#define ER_VALIDATE_PWD_LENGTH_CHANGED 11234
#define ER_REWRITER_QUERY_ERROR_MSG 11235
#define ER_REWRITER_QUERY_FAILED 11236
#define ER_XPLUGIN_STARTUP_FAILED 11237
//#define OBSOLETE_ER_XPLUGIN_SERVER_EXITING 11238
//#define OBSOLETE_ER_XPLUGIN_SERVER_EXITED 11239
#define ER_XPLUGIN_USING_SSL_CONF_FROM_SERVER 11240
#define ER_XPLUGIN_USING_SSL_CONF_FROM_MYSQLX 11241
#define ER_XPLUGIN_FAILED_TO_USE_SSL_CONF 11242
#define ER_XPLUGIN_USING_SSL_FOR_TLS_CONNECTION 11243
#define ER_XPLUGIN_REFERENCE_TO_SECURE_CONN_WITH_XPLUGIN 11244
#define ER_XPLUGIN_ERROR_MSG 11245
#define ER_SHA_PWD_FAILED_TO_PARSE_AUTH_STRING 11246
#define ER_SHA_PWD_FAILED_TO_GENERATE_MULTI_ROUND_HASH 11247
#define ER_SHA_PWD_AUTH_REQUIRES_RSA_OR_SSL 11248
#define ER_SHA_PWD_RSA_KEY_TOO_LONG 11249
#define ER_PLUGIN_COMMON_FAILED_TO_OPEN_FILTER_TABLES 11250
#define ER_PLUGIN_COMMON_FAILED_TO_OPEN_TABLE 11251
#define ER_AUTH_LDAP_ERROR_LOGGER_ERROR_MSG 11252
#define ER_CONN_CONTROL_ERROR_MSG 11253
#define ER_GRP_RPL_ERROR_MSG 11254
#define ER_SHA_PWD_SALT_FOR_USER_CORRUPT 11255
#define ER_SYS_VAR_COMPONENT_OOM 11256
#define ER_SYS_VAR_COMPONENT_VARIABLE_SET_READ_ONLY 11257
#define ER_SYS_VAR_COMPONENT_UNKNOWN_VARIABLE_TYPE 11258
#define ER_SYS_VAR_COMPONENT_FAILED_TO_PARSE_VARIABLE_OPTIONS 11259
#define ER_SYS_VAR_COMPONENT_FAILED_TO_MAKE_VARIABLE_PERSISTENT 11260
#define ER_COMPONENT_FILTER_CONFUSED 11261
#define ER_STOP_REPLICA_IO_THREAD_DISK_SPACE 11262
#define ER_LOG_FILE_CANNOT_OPEN 11263
//#define OBSOLETE_ER_UNABLE_TO_COLLECT_LOG_STATUS 11264
//#define OBSOLETE_ER_DEPRECATED_UTF8_ALIAS 11265
//#define OBSOLETE_ER_DEPRECATED_NATIONAL 11266
//#define OBSOLETE_ER_SLAVE_POSSIBLY_DIVERGED_AFTER_DDL 11267
#define ER_PERSIST_OPTION_STATUS 11268
#define ER_NOT_IMPLEMENTED_GET_TABLESPACE_STATISTICS 11269
//#define OBSOLETE_ER_UNABLE_TO_SET_OPTION 11270
//#define OBSOLETE_ER_RESERVED_TABLESPACE_NAME 11271
#define ER_SSL_FIPS_MODE_ERROR 11272
#define ER_CONN_INIT_CONNECT_IGNORED 11273
//#define OBSOLETE_ER_UNSUPPORTED_SQL_MODE 11274
#define ER_REWRITER_OOM 11275
#define ER_REWRITER_TABLE_MALFORMED_ERROR 11276
#define ER_REWRITER_LOAD_FAILED 11277
#define ER_REWRITER_READ_FAILED 11278
#define ER_CONN_CONTROL_EVENT_COORDINATOR_INIT_FAILED 11279
#define ER_CONN_CONTROL_STAT_CONN_DELAY_TRIGGERED_UPDATE_FAILED 11280
#define ER_CONN_CONTROL_STAT_CONN_DELAY_TRIGGERED_RESET_FAILED 11281
#define ER_CONN_CONTROL_INVALID_CONN_DELAY_TYPE 11282
#define ER_CONN_CONTROL_DELAY_ACTION_INIT_FAILED 11283
#define ER_CONN_CONTROL_FAILED_TO_SET_CONN_DELAY 11284
#define ER_CONN_CONTROL_FAILED_TO_UPDATE_CONN_DELAY_HASH 11285
#define ER_XPLUGIN_FORCE_STOP_CLIENT 11286
#define ER_XPLUGIN_MAX_AUTH_ATTEMPTS_REACHED 11287
#define ER_XPLUGIN_BUFFER_PAGE_ALLOC_FAILED 11288
#define ER_XPLUGIN_DETECTED_HANGING_CLIENTS 11289
#define ER_XPLUGIN_FAILED_TO_ACCEPT_CLIENT 11290
#define ER_XPLUGIN_FAILED_TO_SCHEDULE_CLIENT 11291
#define ER_XPLUGIN_FAILED_TO_PREPARE_IO_INTERFACES 11292
#define ER_XPLUGIN_SRV_SESSION_INIT_THREAD_FAILED 11293
#define ER_XPLUGIN_UNABLE_TO_USE_USER_SESSION_ACCOUNT 11294
#define ER_XPLUGIN_REFERENCE_TO_USER_ACCOUNT_DOC_SECTION 11295
#define ER_XPLUGIN_UNEXPECTED_EXCEPTION_DISPATCHING_CMD 11296
#define ER_XPLUGIN_EXCEPTION_IN_TASK_SCHEDULER 11297
#define ER_XPLUGIN_TASK_SCHEDULING_FAILED 11298
#define ER_XPLUGIN_EXCEPTION_IN_EVENT_LOOP 11299
#define ER_XPLUGIN_LISTENER_SETUP_FAILED 11300
#define ER_XPLUING_NET_STARTUP_FAILED 11301
#define ER_XPLUGIN_FAILED_AT_SSL_CONF 11302
//#define OBSOLETE_ER_XPLUGIN_CLIENT_SSL_HANDSHAKE_FAILED 11303
//#define OBSOLETE_ER_XPLUGIN_SSL_HANDSHAKE_WITH_SERVER_FAILED 11304
#define ER_XPLUGIN_FAILED_TO_CREATE_SESSION_FOR_CONN 11305
#define ER_XPLUGIN_FAILED_TO_INITIALIZE_SESSION 11306
#define ER_XPLUGIN_MESSAGE_TOO_LONG 11307
#define ER_XPLUGIN_UNINITIALIZED_MESSAGE 11308
#define ER_XPLUGIN_FAILED_TO_SET_MIN_NUMBER_OF_WORKERS 11309
#define ER_XPLUGIN_UNABLE_TO_ACCEPT_CONNECTION 11310
#define ER_XPLUGIN_ALL_IO_INTERFACES_DISABLED 11311
//#define OBSOLETE_ER_XPLUGIN_INVALID_MSG_DURING_CLIENT_INIT 11312
//#define OBSOLETE_ER_XPLUGIN_CLOSING_CLIENTS_ON_SHUTDOWN 11313
#define ER_XPLUGIN_ERROR_READING_SOCKET 11314
#define ER_XPLUGIN_PEER_DISCONNECTED_WHILE_READING_MSG_BODY 11315
#define ER_XPLUGIN_READ_FAILED_CLOSING_CONNECTION 11316
//#define OBSOLETE_ER_XPLUGIN_INVALID_AUTH_METHOD 11317
//#define OBSOLETE_ER_XPLUGIN_UNEXPECTED_MSG_DURING_AUTHENTICATION 11318
//#define OBSOLETE_ER_XPLUGIN_ERROR_WRITING_TO_CLIENT 11319
//#define OBSOLETE_ER_XPLUGIN_SCHEDULER_STARTED 11320
//#define OBSOLETE_ER_XPLUGIN_SCHEDULER_STOPPED 11321
#define ER_XPLUGIN_LISTENER_SYS_VARIABLE_ERROR 11322
#define ER_XPLUGIN_LISTENER_STATUS_MSG 11323
#define ER_XPLUGIN_RETRYING_BIND_ON_PORT 11324
//#define OBSOLETE_ER_XPLUGIN_SHUTDOWN_TRIGGERED 11325
//#define OBSOLETE_ER_XPLUGIN_USER_ACCOUNT_WITH_ALL_PERMISSIONS 11326
#define ER_XPLUGIN_EXISTING_USER_ACCOUNT_WITH_INCOMPLETE_GRANTS 11327
//#define OBSOLETE_ER_XPLUGIN_SERVER_STARTS_HANDLING_CONNECTIONS 11328
//#define OBSOLETE_ER_XPLUGIN_SERVER_STOPPED_HANDLING_CONNECTIONS 11329
//#define OBSOLETE_ER_XPLUGIN_FAILED_TO_INTERRUPT_SESSION 11330
//#define OBSOLETE_ER_XPLUGIN_CLIENT_RELEASE_TRIGGERED 11331
#define ER_XPLUGIN_IPv6_AVAILABLE 11332
//#define OBSOLETE_ER_XPLUGIN_UNIX_SOCKET_NOT_CONFIGURED 11333
#define ER_XPLUGIN_CLIENT_KILL_MSG 11334
#define ER_XPLUGIN_FAILED_TO_GET_SECURITY_CTX 11335
//#define OBSOLETE_ER_XPLUGIN_FAILED_TO_SWITCH_SECURITY_CTX_TO_ROOT 11336
#define ER_XPLUGIN_FAILED_TO_CLOSE_SQL_SESSION 11337
#define ER_XPLUGIN_FAILED_TO_EXECUTE_ADMIN_CMD 11338
#define ER_XPLUGIN_EMPTY_ADMIN_CMD 11339
#define ER_XPLUGIN_FAILED_TO_GET_SYS_VAR 11340
#define ER_XPLUGIN_FAILED_TO_GET_CREATION_STMT 11341
#define ER_XPLUGIN_FAILED_TO_GET_ENGINE_INFO 11342
//#define OBSOLETE_ER_XPLUGIN_FAIL_TO_GET_RESULT_DATA 11343
//#define OBSOLETE_ER_XPLUGIN_CAPABILITY_EXPIRED_PASSWORD 11344
#define ER_XPLUGIN_FAILED_TO_SET_SO_REUSEADDR_FLAG 11345
#define ER_XPLUGIN_FAILED_TO_OPEN_INTERNAL_SESSION 11346
#define ER_XPLUGIN_FAILED_TO_SWITCH_CONTEXT 11347
#define ER_XPLUGIN_FAILED_TO_UNREGISTER_UDF 11348
//#define OBSOLETE_ER_XPLUGIN_GET_PEER_ADDRESS_FAILED 11349
//#define OBSOLETE_ER_XPLUGIN_CAPABILITY_CLIENT_INTERACTIVE_FAILED 11350
#define ER_XPLUGIN_FAILED_TO_RESET_IPV6_V6ONLY_FLAG 11351
#define ER_KEYRING_INVALID_KEY_TYPE 11352
#define ER_KEYRING_INVALID_KEY_LENGTH 11353
#define ER_KEYRING_FAILED_TO_CREATE_KEYRING_DIR 11354
#define ER_KEYRING_FILE_INIT_FAILED 11355
#define ER_KEYRING_INTERNAL_EXCEPTION_FAILED_FILE_INIT 11356
#define ER_KEYRING_FAILED_TO_GENERATE_KEY 11357
#define ER_KEYRING_CHECK_KEY_FAILED_DUE_TO_INVALID_KEY 11358
#define ER_KEYRING_CHECK_KEY_FAILED_DUE_TO_EMPTY_KEY_ID 11359
#define ER_KEYRING_OPERATION_FAILED_DUE_TO_INTERNAL_ERROR 11360
#define ER_KEYRING_INCORRECT_FILE 11361
#define ER_KEYRING_FOUND_MALFORMED_BACKUP_FILE 11362
#define ER_KEYRING_FAILED_TO_RESTORE_FROM_BACKUP_FILE 11363
#define ER_KEYRING_FAILED_TO_FLUSH_KEYRING_TO_FILE 11364
#define ER_KEYRING_FAILED_TO_GET_FILE_STAT 11365
#define ER_KEYRING_FAILED_TO_REMOVE_FILE 11366
#define ER_KEYRING_FAILED_TO_TRUNCATE_FILE 11367
#define ER_KEYRING_UNKNOWN_ERROR 11368
#define ER_KEYRING_FAILED_TO_SET_KEYRING_FILE_DATA 11369
#define ER_KEYRING_FILE_IO_ERROR 11370
#define ER_KEYRING_FAILED_TO_LOAD_KEYRING_CONTENT 11371
#define ER_KEYRING_FAILED_TO_FLUSH_KEYS_TO_KEYRING 11372
#define ER_KEYRING_FAILED_TO_FLUSH_KEYS_TO_KEYRING_BACKUP 11373
#define ER_KEYRING_KEY_FETCH_FAILED_DUE_TO_EMPTY_KEY_ID 11374
#define ER_KEYRING_FAILED_TO_REMOVE_KEY_DUE_TO_EMPTY_ID 11375
#define ER_KEYRING_OKV_INCORRECT_KEY_VAULT_CONFIGURED 11376
#define ER_KEYRING_OKV_INIT_FAILED_DUE_TO_INCORRECT_CONF 11377
#define ER_KEYRING_OKV_INIT_FAILED_DUE_TO_INTERNAL_ERROR 11378
#define ER_KEYRING_OKV_INVALID_KEY_TYPE 11379
#define ER_KEYRING_OKV_INVALID_KEY_LENGTH_FOR_CIPHER 11380
#define ER_KEYRING_OKV_FAILED_TO_GENERATE_KEY_DUE_TO_INTERNAL_ERROR 11381
#define ER_KEYRING_OKV_FAILED_TO_FIND_SERVER_ENTRY 11382
#define ER_KEYRING_OKV_FAILED_TO_FIND_STANDBY_SERVER_ENTRY 11383
#define ER_KEYRING_OKV_FAILED_TO_PARSE_CONF_FILE 11384
#define ER_KEYRING_OKV_FAILED_TO_LOAD_KEY_UID 11385
#define ER_KEYRING_OKV_FAILED_TO_INIT_SSL_LAYER 11386
#define ER_KEYRING_OKV_FAILED_TO_INIT_CLIENT 11387
#define ER_KEYRING_OKV_CONNECTION_TO_SERVER_FAILED 11388
#define ER_KEYRING_OKV_FAILED_TO_REMOVE_KEY 11389
#define ER_KEYRING_OKV_FAILED_TO_ADD_ATTRIBUTE 11390
#define ER_KEYRING_OKV_FAILED_TO_GENERATE_KEY 11391
#define ER_KEYRING_OKV_FAILED_TO_STORE_KEY 11392
#define ER_KEYRING_OKV_FAILED_TO_ACTIVATE_KEYS 11393
#define ER_KEYRING_OKV_FAILED_TO_FETCH_KEY 11394
#define ER_KEYRING_OKV_FAILED_TO_STORE_OR_GENERATE_KEY 11395
#define ER_KEYRING_OKV_FAILED_TO_RETRIEVE_KEY_SIGNATURE 11396
#define ER_KEYRING_OKV_FAILED_TO_RETRIEVE_KEY 11397
#define ER_KEYRING_OKV_FAILED_TO_LOAD_SSL_TRUST_STORE 11398
#define ER_KEYRING_OKV_FAILED_TO_SET_CERTIFICATE_FILE 11399
#define ER_KEYRING_OKV_FAILED_TO_SET_KEY_FILE 11400
#define ER_KEYRING_OKV_KEY_MISMATCH 11401
#define ER_KEYRING_ENCRYPTED_FILE_INCORRECT_KEYRING_FILE 11402
#define ER_KEYRING_ENCRYPTED_FILE_DECRYPTION_FAILED 11403
#define ER_KEYRING_ENCRYPTED_FILE_FOUND_MALFORMED_BACKUP_FILE 11404
#define ER_KEYRING_ENCRYPTED_FILE_FAILED_TO_RESTORE_KEYRING 11405
#define ER_KEYRING_ENCRYPTED_FILE_FAILED_TO_FLUSH_KEYRING 11406
#define ER_KEYRING_ENCRYPTED_FILE_ENCRYPTION_FAILED 11407
#define ER_KEYRING_ENCRYPTED_FILE_INVALID_KEYRING_DIR 11408
#define ER_KEYRING_ENCRYPTED_FILE_FAILED_TO_CREATE_KEYRING_DIR 11409
#define ER_KEYRING_ENCRYPTED_FILE_PASSWORD_IS_INVALID 11410
#define ER_KEYRING_ENCRYPTED_FILE_PASSWORD_IS_TOO_LONG 11411
#define ER_KEYRING_ENCRYPTED_FILE_INIT_FAILURE 11412
#define ER_KEYRING_ENCRYPTED_FILE_INIT_FAILED_DUE_TO_INTERNAL_ERROR 11413
#define ER_KEYRING_ENCRYPTED_FILE_GEN_KEY_FAILED_DUE_TO_INTERNAL_ERROR 11414
#define ER_KEYRING_AWS_FAILED_TO_SET_CMK_ID 11415
#define ER_KEYRING_AWS_FAILED_TO_SET_REGION 11416
#define ER_KEYRING_AWS_FAILED_TO_OPEN_CONF_FILE 11417
#define ER_KEYRING_AWS_FAILED_TO_ACCESS_KEY_ID_FROM_CONF_FILE 11418
#define ER_KEYRING_AWS_FAILED_TO_ACCESS_KEY_FROM_CONF_FILE 11419
#define ER_KEYRING_AWS_INVALID_CONF_FILE_PATH 11420
#define ER_KEYRING_AWS_INVALID_DATA_FILE_PATH 11421
#define ER_KEYRING_AWS_FAILED_TO_ACCESS_OR_CREATE_KEYRING_DIR 11422
#define ER_KEYRING_AWS_FAILED_TO_ACCESS_OR_CREATE_KEYRING_DATA_FILE 11423
#define ER_KEYRING_AWS_FAILED_TO_INIT_DUE_TO_INTERNAL_ERROR 11424
#define ER_KEYRING_AWS_FAILED_TO_ACCESS_DATA_FILE 11425
#define ER_KEYRING_AWS_CMK_ID_NOT_SET 11426
#define ER_KEYRING_AWS_FAILED_TO_GET_KMS_CREDENTIAL_FROM_CONF_FILE 11427
#define ER_KEYRING_AWS_INIT_FAILURE 11428
#define ER_KEYRING_AWS_FAILED_TO_INIT_DUE_TO_PLUGIN_INTERNAL_ERROR 11429
#define ER_KEYRING_AWS_INVALID_KEY_LENGTH_FOR_CIPHER 11430
#define ER_KEYRING_AWS_FAILED_TO_GENERATE_KEY_DUE_TO_INTERNAL_ERROR 11431
#define ER_KEYRING_AWS_INCORRECT_FILE 11432
#define ER_KEYRING_AWS_FOUND_MALFORMED_BACKUP_FILE 11433
#define ER_KEYRING_AWS_FAILED_TO_RESTORE_FROM_BACKUP_FILE 11434
#define ER_KEYRING_AWS_FAILED_TO_FLUSH_KEYRING_TO_FILE 11435
#define ER_KEYRING_AWS_INCORRECT_REGION 11436
#define ER_KEYRING_AWS_FAILED_TO_CONNECT_KMS 11437
#define ER_KEYRING_AWS_FAILED_TO_GENERATE_NEW_KEY 11438
#define ER_KEYRING_AWS_FAILED_TO_ENCRYPT_KEY 11439
#define ER_KEYRING_AWS_FAILED_TO_RE_ENCRYPT_KEY 11440
#define ER_KEYRING_AWS_FAILED_TO_DECRYPT_KEY 11441
#define ER_KEYRING_AWS_FAILED_TO_ROTATE_CMK 11442
#define ER_GRP_RPL_GTID_ALREADY_USED 11443
#define ER_GRP_RPL_APPLIER_THD_KILLED 11444
#define ER_GRP_RPL_EVENT_HANDLING_ERROR 11445
#define ER_GRP_RPL_ERROR_GTID_EXECUTION_INFO 11446
#define ER_GRP_RPL_CERTIFICATE_SIZE_ERROR 11447
#define ER_GRP_RPL_CREATE_APPLIER_CACHE_ERROR 11448
#define ER_GRP_RPL_UNBLOCK_WAITING_THD 11449
#define ER_GRP_RPL_APPLIER_PIPELINE_NOT_DISPOSED 11450
#define ER_GRP_RPL_APPLIER_THD_EXECUTION_ABORTED 11451
#define ER_GRP_RPL_APPLIER_EXECUTION_FATAL_ERROR 11452
#define ER_GRP_RPL_ERROR_STOPPING_CHANNELS 11453
#define ER_GRP_RPL_ERROR_SENDING_SINGLE_PRIMARY_MSSG 11454
#define ER_GRP_RPL_UPDATE_TRANS_SNAPSHOT_VER_ERROR 11455
#define ER_GRP_RPL_SIDNO_FETCH_ERROR 11456
#define ER_GRP_RPL_BROADCAST_COMMIT_TRANS_MSSG_FAILED 11457
#define ER_GRP_RPL_GROUP_NAME_PARSE_ERROR 11458
#define ER_GRP_RPL_ADD_GRPSID_TO_GRPGTIDSID_MAP_ERROR 11459
#define ER_GRP_RPL_UPDATE_GRPGTID_EXECUTED_ERROR 11460
#define ER_GRP_RPL_DONOR_TRANS_INFO_ERROR 11461
#define ER_GRP_RPL_SERVER_CONN_ERROR 11462
#define ER_GRP_RPL_ERROR_FETCHING_GTID_EXECUTED_SET 11463
#define ER_GRP_RPL_ADD_GTID_TO_GRPGTID_EXECUTED_ERROR 11464
#define ER_GRP_RPL_ERROR_FETCHING_GTID_SET 11465
#define ER_GRP_RPL_ADD_RETRIEVED_SET_TO_GRP_GTID_EXECUTED_ERROR 11466
#define ER_GRP_RPL_CERTIFICATION_INITIALIZATION_FAILURE 11467
#define ER_GRP_RPL_UPDATE_LAST_CONFLICT_FREE_TRANS_ERROR 11468
#define ER_GRP_RPL_UPDATE_TRANS_SNAPSHOT_REF_VER_ERROR 11469
#define ER_GRP_RPL_FETCH_TRANS_SIDNO_ERROR 11470
#define ER_GRP_RPL_ERROR_VERIFYING_SIDNO 11471
#define ER_GRP_RPL_CANT_GENERATE_GTID 11472
#define ER_GRP_RPL_INVALID_GTID_SET 11473
#define ER_GRP_RPL_UPDATE_GTID_SET_ERROR 11474
#define ER_GRP_RPL_RECEIVED_SET_MISSING_GTIDS 11475
//#define OBSOLETE_ER_GRP_RPL_SKIP_COMPUTATION_TRANS_COMMITTED 11476
#define ER_GRP_RPL_NULL_PACKET 11477
#define ER_GRP_RPL_CANT_READ_GTID 11478
#define ER_GRP_RPL_PROCESS_GTID_SET_ERROR 11479
#define ER_GRP_RPL_PROCESS_INTERSECTION_GTID_SET_ERROR 11480
#define ER_GRP_RPL_SET_STABLE_TRANS_ERROR 11481
#define ER_GRP_RPL_CANT_READ_GRP_GTID_EXTRACTED 11482
#define ER_GRP_RPL_CANT_READ_WRITE_SET_ITEM 11483
#define ER_GRP_RPL_INIT_CERTIFICATION_INFO_FAILURE 11484
#define ER_GRP_RPL_CONFLICT_DETECTION_DISABLED 11485
#define ER_GRP_RPL_MSG_DISCARDED 11486
#define ER_GRP_RPL_MISSING_GRP_RPL_APPLIER 11487
#define ER_GRP_RPL_CERTIFIER_MSSG_PROCESS_ERROR 11488
#define ER_GRP_RPL_SRV_NOT_ONLINE 11489
#define ER_GRP_RPL_SRV_ONLINE 11490
#define ER_GRP_RPL_DISABLE_SRV_READ_MODE_RESTRICTED 11491
#define ER_GRP_RPL_MEM_ONLINE 11492
#define ER_GRP_RPL_MEM_UNREACHABLE 11493
#define ER_GRP_RPL_MEM_REACHABLE 11494
#define ER_GRP_RPL_SRV_BLOCKED 11495
#define ER_GRP_RPL_SRV_BLOCKED_FOR_SECS 11496
#define ER_GRP_RPL_CHANGE_GRP_MEM_NOT_PROCESSED 11497
#define ER_GRP_RPL_MEMBER_CONTACT_RESTORED 11498
#define ER_GRP_RPL_MEMBER_REMOVED 11499
#define ER_GRP_RPL_PRIMARY_MEMBER_LEFT_GRP 11500
#define ER_GRP_RPL_MEMBER_ADDED 11501
#define ER_GRP_RPL_MEMBER_EXIT_PLUGIN_ERROR 11502
#define ER_GRP_RPL_MEMBER_CHANGE 11503
#define ER_GRP_RPL_MEMBER_LEFT_GRP 11504
#define ER_GRP_RPL_MEMBER_EXPELLED 11505
#define ER_GRP_RPL_SESSION_OPEN_FAILED 11506
#define ER_GRP_RPL_NEW_PRIMARY_ELECTED 11507
#define ER_GRP_RPL_DISABLE_READ_ONLY_FAILED 11508
#define ER_GRP_RPL_ENABLE_READ_ONLY_FAILED 11509
#define ER_GRP_RPL_SRV_PRIMARY_MEM 11510
#define ER_GRP_RPL_SRV_SECONDARY_MEM 11511
#define ER_GRP_RPL_NO_SUITABLE_PRIMARY_MEM 11512
#define ER_GRP_RPL_SUPER_READ_ONLY_ACTIVATE_ERROR 11513
#define ER_GRP_RPL_EXCEEDS_AUTO_INC_VALUE 11514
#define ER_GRP_RPL_DATA_NOT_PROVIDED_BY_MEM 11515
#define ER_GRP_RPL_MEMBER_ALREADY_EXISTS 11516
//#define OBSOLETE_ER_GRP_RPL_GRP_CHANGE_INFO_EXTRACT_ERROR 11517
#define ER_GRP_RPL_GTID_EXECUTED_EXTRACT_ERROR 11518
#define ER_GRP_RPL_GTID_SET_EXTRACT_ERROR 11519
#define ER_GRP_RPL_START_FAILED 11520
#define ER_GRP_RPL_MEMBER_VER_INCOMPATIBLE 11521
#define ER_GRP_RPL_TRANS_NOT_PRESENT_IN_GRP 11522
#define ER_GRP_RPL_TRANS_GREATER_THAN_GRP 11523
#define ER_GRP_RPL_MEMBER_VERSION_LOWER_THAN_GRP 11524
#define ER_GRP_RPL_LOCAL_GTID_SETS_PROCESS_ERROR 11525
#define ER_GRP_RPL_MEMBER_TRANS_GREATER_THAN_GRP 11526
#define ER_GRP_RPL_BLOCK_SIZE_DIFF_FROM_GRP 11527
#define ER_GRP_RPL_TRANS_WRITE_SET_EXTRACT_DIFF_FROM_GRP 11528
#define ER_GRP_RPL_MEMBER_CFG_INCOMPATIBLE_WITH_GRP_CFG 11529
#define ER_GRP_RPL_MEMBER_STOP_RPL_CHANNELS_ERROR 11530
#define ER_GRP_RPL_PURGE_APPLIER_LOGS 11531
#define ER_GRP_RPL_RESET_APPLIER_MODULE_LOGS_ERROR 11532
#define ER_GRP_RPL_APPLIER_THD_SETUP_ERROR 11533
#define ER_GRP_RPL_APPLIER_THD_START_ERROR 11534
#define ER_GRP_RPL_APPLIER_THD_STOP_ERROR 11535
#define ER_GRP_RPL_FETCH_TRANS_DATA_FAILED 11536
#define ER_GRP_RPL_REPLICA_IO_THD_PRIMARY_UNKNOWN 11537
#define ER_GRP_RPL_SALVE_IO_THD_ON_SECONDARY_MEMBER 11538
#define ER_GRP_RPL_REPLICA_SQL_THD_PRIMARY_UNKNOWN 11539
#define ER_GRP_RPL_REPLICA_SQL_THD_ON_SECONDARY_MEMBER 11540
#define ER_GRP_RPL_NEEDS_INNODB_TABLE 11541
#define ER_GRP_RPL_PRIMARY_KEY_NOT_DEFINED 11542
#define ER_GRP_RPL_FK_WITH_CASCADE_UNSUPPORTED 11543
#define ER_GRP_RPL_AUTO_INC_RESET 11544
#define ER_GRP_RPL_AUTO_INC_OFFSET_RESET 11545
#define ER_GRP_RPL_AUTO_INC_SET 11546
#define ER_GRP_RPL_AUTO_INC_OFFSET_SET 11547
#define ER_GRP_RPL_FETCH_TRANS_CONTEXT_FAILED 11548
#define ER_GRP_RPL_FETCH_FORMAT_DESC_LOG_EVENT_FAILED 11549
#define ER_GRP_RPL_FETCH_TRANS_CONTEXT_LOG_EVENT_FAILED 11550
#define ER_GRP_RPL_FETCH_SNAPSHOT_VERSION_FAILED 11551
#define ER_GRP_RPL_FETCH_GTID_LOG_EVENT_FAILED 11552
#define ER_GRP_RPL_UPDATE_SERV_CERTIFICATE_FAILED 11553
#define ER_GRP_RPL_ADD_GTID_INFO_WITH_LOCAL_GTID_FAILED 11554
#define ER_GRP_RPL_ADD_GTID_INFO_WITHOUT_LOCAL_GTID_FAILED 11555
#define ER_GRP_RPL_NOTIFY_CERTIFICATION_OUTCOME_FAILED 11556
#define ER_GRP_RPL_ADD_GTID_INFO_WITH_REMOTE_GTID_FAILED 11557
#define ER_GRP_RPL_ADD_GTID_INFO_WITHOUT_REMOTE_GTID_FAILED 11558
#define ER_GRP_RPL_FETCH_VIEW_CHANGE_LOG_EVENT_FAILED 11559
//#define OBSOLETE_ER_GRP_RPL_CONTACT_WITH_SRV_FAILED 11560
//#define OBSOLETE_ER_GRP_RPL_SRV_WAIT_TIME_OUT 11561
#define ER_GRP_RPL_FETCH_LOG_EVENT_FAILED 11562
#define ER_GRP_RPL_START_GRP_RPL_FAILED 11563
#define ER_GRP_RPL_CONN_INTERNAL_PLUGIN_FAIL 11564
#define ER_GRP_RPL_SUPER_READ_ON 11565
#define ER_GRP_RPL_SUPER_READ_OFF 11566
#define ER_GRP_RPL_KILLED_SESSION_ID 11567
#define ER_GRP_RPL_KILLED_FAILED_ID 11568
#define ER_GRP_RPL_INTERNAL_QUERY 11569
#define ER_GRP_RPL_COPY_FROM_EMPTY_STRING 11570
#define ER_GRP_RPL_QUERY_FAIL 11571
#define ER_GRP_RPL_CREATE_SESSION_UNABLE 11572
#define ER_GRP_RPL_MEMBER_NOT_FOUND 11573
#define ER_GRP_RPL_MAXIMUM_CONNECTION_RETRIES_REACHED 11574
#define ER_GRP_RPL_ALL_DONORS_LEFT_ABORT_RECOVERY 11575
#define ER_GRP_RPL_ESTABLISH_RECOVERY_WITH_DONOR 11576
#define ER_GRP_RPL_ESTABLISH_RECOVERY_WITH_ANOTHER_DONOR 11577
#define ER_GRP_RPL_NO_VALID_DONOR 11578
#define ER_GRP_RPL_CONFIG_RECOVERY 11579
#define ER_GRP_RPL_ESTABLISHING_CONN_GRP_REC_DONOR 11580
#define ER_GRP_RPL_CREATE_GRP_RPL_REC_CHANNEL 11581
#define ER_GRP_RPL_DONOR_SERVER_CONN 11582
#define ER_GRP_RPL_CHECK_STATUS_TABLE 11583
#define ER_GRP_RPL_STARTING_GRP_REC 11584
#define ER_GRP_RPL_DONOR_CONN_TERMINATION 11585
#define ER_GRP_RPL_STOPPING_GRP_REC 11586
#define ER_GRP_RPL_PURGE_REC 11587
#define ER_GRP_RPL_UNABLE_TO_KILL_CONN_REC_DONOR_APPLIER 11588
#define ER_GRP_RPL_UNABLE_TO_KILL_CONN_REC_DONOR_FAILOVER 11589
#define ER_GRP_RPL_FAILED_TO_NOTIFY_GRP_MEMBERSHIP_EVENT 11590
#define ER_GRP_RPL_FAILED_TO_BROADCAST_GRP_MEMBERSHIP_NOTIFICATION 11591
#define ER_GRP_RPL_FAILED_TO_BROADCAST_MEMBER_STATUS_NOTIFICATION 11592
#define ER_GRP_RPL_OOM_FAILED_TO_GENERATE_IDENTIFICATION_HASH 11593
#define ER_GRP_RPL_WRITE_IDENT_HASH_BASE64_ENCODING_FAILED 11594
#define ER_GRP_RPL_INVALID_BINLOG_FORMAT 11595
//#define OBSOLETE_ER_GRP_RPL_BINLOG_CHECKSUM_SET 11596
#define ER_GRP_RPL_TRANS_WRITE_SET_EXTRACTION_NOT_SET 11597
#define ER_GRP_RPL_UNSUPPORTED_TRANS_ISOLATION 11598
#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_WHILE_STOPPING 11599
#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_WHILE_RECOVERING 11600
#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_IN_ERROR_STATE 11601
#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_IN_OFFLINE_MODE 11602
#define ER_GRP_RPL_MULTIPLE_CACHE_TYPE_NOT_SUPPORTED_FOR_SESSION 11603
#define ER_GRP_RPL_FAILED_TO_REINIT_BINLOG_CACHE_FOR_READ 11604
#define ER_GRP_RPL_FAILED_TO_CREATE_TRANS_CONTEXT 11605
#define ER_GRP_RPL_FAILED_TO_EXTRACT_TRANS_WRITE_SET 11606
#define ER_GRP_RPL_FAILED_TO_GATHER_TRANS_WRITE_SET 11607
#define ER_GRP_RPL_TRANS_SIZE_EXCEEDS_LIMIT 11608
//#define OBSOLETE_ER_GRP_RPL_REINIT_OF_INTERNAL_CACHE_FOR_READ_FAILED 11609
//#define OBSOLETE_ER_GRP_RPL_APPENDING_DATA_TO_INTERNAL_CACHE_FAILED 11610
#define ER_GRP_RPL_WRITE_TO_TRANSACTION_MESSAGE_FAILED 11611
#define ER_GRP_RPL_FAILED_TO_REGISTER_TRANS_OUTCOME_NOTIFICTION 11612
#define ER_GRP_RPL_MSG_TOO_LONG_BROADCASTING_TRANS_FAILED 11613
#define ER_GRP_RPL_BROADCASTING_TRANS_TO_GRP_FAILED 11614
#define ER_GRP_RPL_ERROR_WHILE_WAITING_FOR_CONFLICT_DETECTION 11615
//#define OBSOLETE_ER_GRP_RPL_REINIT_OF_INTERNAL_CACHE_FOR_WRITE_FAILED 11616
//#define OBSOLETE_ER_GRP_RPL_FAILED_TO_CREATE_COMMIT_CACHE 11617
//#define OBSOLETE_ER_GRP_RPL_REINIT_OF_COMMIT_CACHE_FOR_WRITE_FAILED 11618
//#define OBSOLETE_ER_GRP_RPL_PREV_REC_SESSION_RUNNING 11619
#define ER_GRP_RPL_FATAL_REC_PROCESS 11620
//#define OBSOLETE_ER_GRP_RPL_WHILE_STOPPING_REP_CHANNEL 11621
#define ER_GRP_RPL_UNABLE_TO_EVALUATE_APPLIER_STATUS 11622
#define ER_GRP_RPL_ONLY_ONE_SERVER_ALIVE 11623
#define ER_GRP_RPL_CERTIFICATION_REC_PROCESS 11624
#define ER_GRP_RPL_UNABLE_TO_ENSURE_EXECUTION_REC 11625
#define ER_GRP_RPL_WHILE_SENDING_MSG_REC 11626
//#define OBSOLETE_ER_GRP_RPL_READ_UNABLE_FOR_SUPER_READ_ONLY 11627
#define ER_GRP_RPL_READ_UNABLE_FOR_READ_ONLY_SUPER_READ_ONLY 11628
#define ER_GRP_RPL_UNABLE_TO_RESET_SERVER_READ_MODE 11629
#define ER_GRP_RPL_UNABLE_TO_CERTIFY_PLUGIN_TRANS 11630
#define ER_GRP_RPL_UNBLOCK_CERTIFIED_TRANS 11631
//#define OBSOLETE_ER_GRP_RPL_SERVER_WORKING_AS_SECONDARY 11632
#define ER_GRP_RPL_FAILED_TO_START_WITH_INVALID_SERVER_ID 11633
#define ER_GRP_RPL_FORCE_MEMBERS_MUST_BE_EMPTY 11634
#define ER_GRP_RPL_PLUGIN_STRUCT_INIT_NOT_POSSIBLE_ON_SERVER_START 11635
#define ER_GRP_RPL_FAILED_TO_ENABLE_SUPER_READ_ONLY_MODE 11636
#define ER_GRP_RPL_FAILED_TO_INIT_COMMUNICATION_ENGINE 11637
#define ER_GRP_RPL_FAILED_TO_START_ON_SECONDARY_WITH_ASYNC_CHANNELS 11638
#define ER_GRP_RPL_FAILED_TO_START_COMMUNICATION_ENGINE 11639
#define ER_GRP_RPL_TIMEOUT_ON_VIEW_AFTER_JOINING_GRP 11640
#define ER_GRP_RPL_FAILED_TO_CALL_GRP_COMMUNICATION_INTERFACE 11641
#define ER_GRP_RPL_MEMBER_SERVER_UUID_IS_INCOMPATIBLE_WITH_GRP 11642
#define ER_GRP_RPL_MEMBER_CONF_INFO 11643
#define ER_GRP_RPL_FAILED_TO_CONFIRM_IF_SERVER_LEFT_GRP 11644
#define ER_GRP_RPL_SERVER_IS_ALREADY_LEAVING 11645
#define ER_GRP_RPL_SERVER_ALREADY_LEFT 11646
#define ER_GRP_RPL_WAITING_FOR_VIEW_UPDATE 11647
#define ER_GRP_RPL_TIMEOUT_RECEIVING_VIEW_CHANGE_ON_SHUTDOWN 11648
#define ER_GRP_RPL_REQUESTING_NON_MEMBER_SERVER_TO_LEAVE 11649
#define ER_GRP_RPL_IS_STOPPING 11650
#define ER_GRP_RPL_IS_STOPPED 11651
#define ER_GRP_RPL_FAILED_TO_ENABLE_READ_ONLY_MODE_ON_SHUTDOWN 11652
#define ER_GRP_RPL_RECOVERY_MODULE_TERMINATION_TIMED_OUT_ON_SHUTDOWN 11653
#define ER_GRP_RPL_APPLIER_TERMINATION_TIMED_OUT_ON_SHUTDOWN 11654
#define ER_GRP_RPL_FAILED_TO_SHUTDOWN_REGISTRY_MODULE 11655
#define ER_GRP_RPL_FAILED_TO_INIT_HANDLER 11656
#define ER_GRP_RPL_FAILED_TO_REGISTER_SERVER_STATE_OBSERVER 11657
#define ER_GRP_RPL_FAILED_TO_REGISTER_TRANS_STATE_OBSERVER 11658
#define ER_GRP_RPL_FAILED_TO_REGISTER_BINLOG_STATE_OBSERVER 11659
#define ER_GRP_RPL_FAILED_TO_START_ON_BOOT 11660
#define ER_GRP_RPL_FAILED_TO_STOP_ON_PLUGIN_UNINSTALL 11661
#define ER_GRP_RPL_FAILED_TO_UNREGISTER_SERVER_STATE_OBSERVER 11662
#define ER_GRP_RPL_FAILED_TO_UNREGISTER_TRANS_STATE_OBSERVER 11663
#define ER_GRP_RPL_FAILED_TO_UNREGISTER_BINLOG_STATE_OBSERVER 11664
#define ER_GRP_RPL_ALL_OBSERVERS_UNREGISTERED 11665
#define ER_GRP_RPL_FAILED_TO_PARSE_THE_GRP_NAME 11666
#define ER_GRP_RPL_FAILED_TO_GENERATE_SIDNO_FOR_GRP 11667
#define ER_GRP_RPL_APPLIER_NOT_STARTED_DUE_TO_RUNNING_PREV_SHUTDOWN 11668
#define ER_GRP_RPL_FAILED_TO_INIT_APPLIER_MODULE 11669
#define ER_GRP_RPL_APPLIER_INITIALIZED 11670
#define ER_GRP_RPL_COMMUNICATION_SSL_CONF_INFO 11671
#define ER_GRP_RPL_ABORTS_AS_SSL_NOT_SUPPORTED_BY_MYSQLD 11672
#define ER_GRP_RPL_SSL_DISABLED 11673
#define ER_GRP_RPL_UNABLE_TO_INIT_COMMUNICATION_ENGINE 11674
#define ER_GRP_RPL_BINLOG_DISABLED 11675
#define ER_GRP_RPL_GTID_MODE_OFF 11676
#define ER_GRP_RPL_LOG_REPLICA_UPDATES_NOT_SET 11677
#define ER_GRP_RPL_INVALID_TRANS_WRITE_SET_EXTRACTION_VALUE 11678
#define ER_GRP_RPL_APPLIER_METADATA_REPO_MUST_BE_TABLE 11679
#define ER_GRP_RPL_CONNECTION_METADATA_REPO_MUST_BE_TABLE 11680
#define ER_GRP_RPL_INCORRECT_TYPE_SET_FOR_PARALLEL_APPLIER 11681
#define ER_GRP_RPL_REPLICA_PRESERVE_COMMIT_ORDER_NOT_SET 11682
#define ER_GRP_RPL_SINGLE_PRIM_MODE_NOT_ALLOWED_WITH_UPDATE_EVERYWHERE 11683
#define ER_GRP_RPL_MODULE_TERMINATE_ERROR 11684
#define ER_GRP_RPL_GRP_NAME_OPTION_MANDATORY 11685
#define ER_GRP_RPL_GRP_NAME_IS_TOO_LONG 11686
#define ER_GRP_RPL_GRP_NAME_IS_NOT_VALID_UUID 11687
#define ER_GRP_RPL_FLOW_CTRL_MIN_QUOTA_GREATER_THAN_MAX_QUOTA 11688
#define ER_GRP_RPL_FLOW_CTRL_MIN_RECOVERY_QUOTA_GREATER_THAN_MAX_QUOTA 11689
#define ER_GRP_RPL_FLOW_CTRL_MAX_QUOTA_SMALLER_THAN_MIN_QUOTAS 11690
#define ER_GRP_RPL_INVALID_SSL_RECOVERY_STRING 11691
//#define OBSOLETE_ER_GRP_RPL_SUPPORTS_ONLY_ONE_FORCE_MEMBERS_SET 11692
//#define OBSOLETE_ER_GRP_RPL_FORCE_MEMBERS_SET_UPDATE_NOT_ALLOWED 11693
#define ER_GRP_RPL_GRP_COMMUNICATION_INIT_WITH_CONF 11694
#define ER_GRP_RPL_UNKNOWN_GRP_RPL_APPLIER_PIPELINE_REQUESTED 11695
#define ER_GRP_RPL_FAILED_TO_BOOTSTRAP_EVENT_HANDLING_INFRASTRUCTURE 11696
#define ER_GRP_RPL_APPLIER_HANDLER_NOT_INITIALIZED 11697
#define ER_GRP_RPL_APPLIER_HANDLER_IS_IN_USE 11698
#define ER_GRP_RPL_APPLIER_HANDLER_ROLE_IS_IN_USE 11699
#define ER_GRP_RPL_FAILED_TO_INIT_APPLIER_HANDLER 11700
#define ER_GRP_RPL_SQL_SERVICE_FAILED_TO_INIT_SESSION_THREAD 11701
#define ER_GRP_RPL_SQL_SERVICE_COMM_SESSION_NOT_INITIALIZED 11702
#define ER_GRP_RPL_SQL_SERVICE_SERVER_SESSION_KILLED 11703
#define ER_GRP_RPL_SQL_SERVICE_FAILED_TO_RUN_SQL_QUERY 11704
#define ER_GRP_RPL_SQL_SERVICE_SERVER_INTERNAL_FAILURE 11705
#define ER_GRP_RPL_SQL_SERVICE_RETRIES_EXCEEDED_ON_SESSION_STATE 11706
#define ER_GRP_RPL_SQL_SERVICE_FAILED_TO_FETCH_SECURITY_CTX 11707
#define ER_GRP_RPL_SQL_SERVICE_SERVER_ACCESS_DENIED_FOR_USER 11708
#define ER_GRP_RPL_SQL_SERVICE_MAX_CONN_ERROR_FROM_SERVER 11709
#define ER_GRP_RPL_SQL_SERVICE_SERVER_ERROR_ON_CONN 11710
#define ER_GRP_RPL_UNREACHABLE_MAJORITY_TIMEOUT_FOR_MEMBER 11711
#define ER_GRP_RPL_SERVER_SET_TO_READ_ONLY_DUE_TO_ERRORS 11712
#define ER_GRP_RPL_GMS_LISTENER_FAILED_TO_LOG_NOTIFICATION 11713
#define ER_GRP_RPL_GRP_COMMUNICATION_ENG_INIT_FAILED 11714
#define ER_GRP_RPL_SET_GRP_COMMUNICATION_ENG_LOGGER_FAILED 11715
#define ER_GRP_RPL_DEBUG_OPTIONS 11716
#define ER_GRP_RPL_INVALID_DEBUG_OPTIONS 11717
#define ER_GRP_RPL_EXIT_GRP_GCS_ERROR 11718
#define ER_GRP_RPL_GRP_MEMBER_OFFLINE 11719
#define ER_GRP_RPL_GCS_INTERFACE_ERROR 11720
#define ER_GRP_RPL_FORCE_MEMBER_VALUE_SET_ERROR 11721
#define ER_GRP_RPL_FORCE_MEMBER_VALUE_SET 11722
#define ER_GRP_RPL_FORCE_MEMBER_VALUE_TIME_OUT 11723
#define ER_GRP_RPL_BROADCAST_COMMIT_MSSG_TOO_BIG 11724
#define ER_GRP_RPL_SEND_STATS_ERROR 11725
#define ER_GRP_RPL_MEMBER_STATS_INFO 11726
#define ER_GRP_RPL_FLOW_CONTROL_STATS 11727
#define ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT 11728
#define ER_GRP_RPL_PIPELINE_CREATE_FAILED 11729
#define ER_GRP_RPL_PIPELINE_REINIT_FAILED_WRITE 11730
#define ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET 11731
#define ER_GRP_RPL_PIPELINE_FLUSH_FAIL 11732
#define ER_GRP_RPL_PIPELINE_REINIT_FAILED_READ 11733
//#define OBSOLETE_ER_GRP_RPL_STOP_REP_CHANNEL 11734
#define ER_GRP_RPL_GCS_GR_ERROR_MSG 11735
#define ER_GRP_RPL_REPLICA_IO_THREAD_UNBLOCKED 11736
#define ER_GRP_RPL_REPLICA_IO_THREAD_ERROR_OUT 11737
#define ER_GRP_RPL_REPLICA_APPLIER_THREAD_UNBLOCKED 11738
#define ER_GRP_RPL_REPLICA_APPLIER_THREAD_ERROR_OUT 11739
#define ER_LDAP_AUTH_FAILED_TO_CREATE_OR_GET_CONNECTION 11740
#define ER_LDAP_AUTH_DEINIT_FAILED 11741
#define ER_LDAP_AUTH_SKIPPING_USER_GROUP_SEARCH 11742
#define ER_LDAP_AUTH_POOL_DISABLE_MAX_SIZE_ZERO 11743
#define ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_OBJECT_CREATOR 11744
#define ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_OBJECT 11745
#define ER_LDAP_AUTH_TLS_CONF 11746
#define ER_LDAP_AUTH_TLS_CONNECTION 11747
#define ER_LDAP_AUTH_CONN_POOL_NOT_CREATED 11748
#define ER_LDAP_AUTH_CONN_POOL_INITIALIZING 11749
#define ER_LDAP_AUTH_CONN_POOL_DEINITIALIZING 11750
#define ER_LDAP_AUTH_ZERO_MAX_POOL_SIZE_UNCHANGED 11751
#define ER_LDAP_AUTH_POOL_REINITIALIZING 11752
#define ER_LDAP_AUTH_FAILED_TO_WRITE_PACKET 11753
#define ER_LDAP_AUTH_SETTING_USERNAME 11754
#define ER_LDAP_AUTH_USER_AUTH_DATA 11755
#define ER_LDAP_AUTH_INFO_FOR_USER 11756
#define ER_LDAP_AUTH_USER_GROUP_SEARCH_INFO 11757
#define ER_LDAP_AUTH_GRP_SEARCH_SPECIAL_HDL 11758
#define ER_LDAP_AUTH_GRP_IS_FULL_DN 11759
#define ER_LDAP_AUTH_USER_NOT_FOUND_IN_ANY_GRP 11760
#define ER_LDAP_AUTH_USER_FOUND_IN_MANY_GRPS 11761
#define ER_LDAP_AUTH_USER_HAS_MULTIPLE_GRP_NAMES 11762
#define ER_LDAP_AUTH_SEARCHED_USER_GRP_NAME 11763
#define ER_LDAP_AUTH_OBJECT_CREATE_TIMESTAMP 11764
#define ER_LDAP_AUTH_CERTIFICATE_NAME 11765
#define ER_LDAP_AUTH_FAILED_TO_POOL_DEINIT 11766
#define ER_LDAP_AUTH_FAILED_TO_INITIALIZE_POOL_IN_RECONSTRUCTING 11767
#define ER_LDAP_AUTH_FAILED_TO_INITIALIZE_POOL_IN_INIT_STATE 11768
#define ER_LDAP_AUTH_FAILED_TO_INITIALIZE_POOL_IN_DEINIT_STATE 11769
#define ER_LDAP_AUTH_FAILED_TO_DEINITIALIZE_POOL_IN_RECONSTRUCT_STATE 11770
#define ER_LDAP_AUTH_FAILED_TO_DEINITIALIZE_NOT_READY_POOL 11771
#define ER_LDAP_AUTH_FAILED_TO_GET_CONNECTION_AS_PLUGIN_NOT_READY 11772
#define ER_LDAP_AUTH_CONNECTION_POOL_INIT_FAILED 11773
#define ER_LDAP_AUTH_MAX_ALLOWED_CONNECTION_LIMIT_HIT 11774
#define ER_LDAP_AUTH_MAX_POOL_SIZE_SET_FAILED 11775
#define ER_LDAP_AUTH_PLUGIN_FAILED_TO_READ_PACKET 11776
#define ER_LDAP_AUTH_CREATING_LDAP_CONNECTION 11777
#define ER_LDAP_AUTH_GETTING_CONNECTION_FROM_POOL 11778
#define ER_LDAP_AUTH_RETURNING_CONNECTION_TO_POOL 11779
#define ER_LDAP_AUTH_SEARCH_USER_GROUP_ATTR_NOT_FOUND 11780
#define ER_LDAP_AUTH_LDAP_INFO_NULL 11781
#define ER_LDAP_AUTH_FREEING_CONNECTION 11782
#define ER_LDAP_AUTH_CONNECTION_PUSHED_TO_POOL 11783
#define ER_LDAP_AUTH_CONNECTION_CREATOR_ENTER 11784
#define ER_LDAP_AUTH_STARTING_TLS 11785
#define ER_LDAP_AUTH_CONNECTION_GET_LDAP_INFO_NULL 11786
#define ER_LDAP_AUTH_DELETING_CONNECTION_KEY 11787
#define ER_LDAP_AUTH_POOLED_CONNECTION_KEY 11788
#define ER_LDAP_AUTH_CREATE_CONNECTION_KEY 11789
#define ER_LDAP_AUTH_COMMUNICATION_HOST_INFO 11790
#define ER_LDAP_AUTH_METHOD_TO_CLIENT 11791
#define ER_LDAP_AUTH_SASL_REQUEST_FROM_CLIENT 11792
#define ER_LDAP_AUTH_SASL_PROCESS_SASL 11793
#define ER_LDAP_AUTH_SASL_BIND_SUCCESS_INFO 11794
#define ER_LDAP_AUTH_STARTED_FOR_USER 11795
#define ER_LDAP_AUTH_DISTINGUISHED_NAME 11796
#define ER_LDAP_AUTH_INIT_FAILED 11797
#define ER_LDAP_AUTH_OR_GROUP_RETRIEVAL_FAILED 11798
#define ER_LDAP_AUTH_USER_GROUP_SEARCH_FAILED 11799
#define ER_LDAP_AUTH_USER_BIND_FAILED 11800
#define ER_LDAP_AUTH_POOL_GET_FAILED_TO_CREATE_CONNECTION 11801
#define ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_CONNECTION 11802
#define ER_LDAP_AUTH_FAILED_TO_ESTABLISH_TLS_CONNECTION 11803
#define ER_LDAP_AUTH_FAILED_TO_SEARCH_DN 11804
#define ER_LDAP_AUTH_CONNECTION_POOL_REINIT_ENTER 11805
#define ER_SYSTEMD_NOTIFY_PATH_TOO_LONG 11806
#define ER_SYSTEMD_NOTIFY_CONNECT_FAILED 11807
#define ER_SYSTEMD_NOTIFY_WRITE_FAILED 11808
#define ER_FOUND_MISSING_GTIDS 11809
#define ER_PID_FILE_PRIV_DIRECTORY_INSECURE 11810
#define ER_CANT_CHECK_PID_PATH 11811
#define ER_VALIDATE_PWD_STATUS_VAR_REGISTRATION_FAILED 11812
#define ER_VALIDATE_PWD_STATUS_VAR_UNREGISTRATION_FAILED 11813
#define ER_VALIDATE_PWD_DICT_FILE_OPEN_FAILED 11814
#define ER_VALIDATE_PWD_COULD_BE_NULL 11815
#define ER_VALIDATE_PWD_STRING_CONV_TO_LOWERCASE_FAILED 11816
#define ER_VALIDATE_PWD_STRING_CONV_TO_BUFFER_FAILED 11817
#define ER_VALIDATE_PWD_STRING_HANDLER_MEM_ALLOCATION_FAILED 11818
#define ER_VALIDATE_PWD_STRONG_POLICY_DICT_FILE_UNSPECIFIED 11819
#define ER_VALIDATE_PWD_CONVERT_TO_BUFFER_FAILED 11820
#define ER_VALIDATE_PWD_VARIABLE_REGISTRATION_FAILED 11821
#define ER_VALIDATE_PWD_VARIABLE_UNREGISTRATION_FAILED 11822
#define ER_KEYRING_MIGRATION_EXTRA_OPTIONS 11823
//#define OBSOLETE_ER_INVALID_DEFAULT_UTF8MB4_COLLATION 11824
#define ER_IB_MSG_0 11825
#define ER_IB_MSG_1 11826
#define ER_IB_MSG_2 11827
#define ER_IB_MSG_3 11828
#define ER_IB_MSG_4 11829
#define ER_IB_MSG_5 11830
#define ER_IB_MSG_6 11831
#define ER_IB_MSG_7 11832
#define ER_IB_MSG_8 11833
#define ER_IB_MSG_9 11834
#define ER_IB_MSG_10 11835
#define ER_IB_MSG_11 11836
#define ER_IB_MSG_12 11837
#define ER_IB_MSG_13 11838
#define ER_IB_MSG_14 11839
#define ER_IB_MSG_15 11840
#define ER_IB_MSG_16 11841
#define ER_IB_MSG_17 11842
#define ER_IB_MSG_18 11843
#define ER_IB_MSG_19 11844
#define ER_IB_MSG_20 11845
#define ER_IB_MSG_21 11846
#define ER_IB_MSG_22 11847
#define ER_IB_MSG_23 11848
#define ER_IB_MSG_24 11849
#define ER_IB_MSG_25 11850
#define ER_IB_MSG_26 11851
#define ER_IB_MSG_27 11852
#define ER_IB_MSG_28 11853
#define ER_IB_MSG_29 11854
#define ER_IB_MSG_30 11855
#define ER_IB_MSG_31 11856
#define ER_IB_MSG_32 11857
#define ER_IB_MSG_33 11858
#define ER_IB_MSG_34 11859
#define ER_IB_MSG_35 11860
#define ER_IB_MSG_36 11861
#define ER_IB_MSG_37 11862
#define ER_IB_MSG_38 11863
#define ER_IB_MSG_39 11864
#define ER_IB_MSG_40 11865
#define ER_IB_MSG_41 11866
#define ER_IB_MSG_42 11867
#define ER_IB_MSG_43 11868
#define ER_IB_MSG_44 11869
#define ER_IB_MSG_45 11870
#define ER_IB_MSG_46 11871
#define ER_IB_MSG_47 11872
#define ER_IB_MSG_48 11873
#define ER_IB_MSG_49 11874
#define ER_IB_MSG_50 11875
#define ER_IB_MSG_51 11876
#define ER_IB_MSG_52 11877
#define ER_IB_MSG_53 11878
#define ER_IB_MSG_54 11879
#define ER_IB_MSG_55 11880
#define ER_IB_MSG_56 11881
#define ER_IB_MSG_57 11882
#define ER_IB_MSG_58 11883
#define ER_IB_MSG_59 11884
#define ER_IB_MSG_60 11885
#define ER_IB_MSG_61 11886
#define ER_IB_MSG_62 11887
#define ER_IB_MSG_63 11888
#define ER_IB_MSG_64 11889
#define ER_IB_MSG_65 11890
#define ER_IB_MSG_66 11891
#define ER_IB_MSG_67 11892
#define ER_IB_MSG_68 11893
#define ER_IB_MSG_69 11894
#define ER_IB_MSG_70 11895
#define ER_IB_MSG_71 11896
#define ER_IB_MSG_72 11897
#define ER_IB_MSG_73 11898
#define ER_IB_MSG_74 11899
#define ER_IB_MSG_75 11900
#define ER_IB_MSG_76 11901
#define ER_IB_MSG_77 11902
#define ER_IB_MSG_78 11903
#define ER_IB_MSG_79 11904
#define ER_IB_MSG_80 11905
#define ER_IB_MSG_81 11906
#define ER_IB_MSG_82 11907
#define ER_IB_ERR_PAGE_DIRTY_AT_SHUTDOWN 11908
#define ER_IB_MSG_84 11909
#define ER_IB_MSG_85 11910
#define ER_IB_MSG_86 11911
//#define OBSOLETE_ER_IB_MSG_87 11912
//#define OBSOLETE_ER_IB_MSG_88 11913
//#define OBSOLETE_ER_IB_MSG_89 11914
//#define OBSOLETE_ER_IB_MSG_90 11915
//#define OBSOLETE_ER_IB_MSG_91 11916
//#define OBSOLETE_ER_IB_MSG_92 11917
//#define OBSOLETE_ER_IB_MSG_93 11918
//#define OBSOLETE_ER_IB_MSG_94 11919
#define ER_IB_MSG_95 11920
#define ER_IB_MSG_96 11921
#define ER_IB_MSG_97 11922
#define ER_IB_MSG_98 11923
#define ER_IB_MSG_99 11924
#define ER_IB_MSG_100 11925
#define ER_IB_MSG_101 11926
#define ER_IB_MSG_102 11927
#define ER_IB_MSG_103 11928
#define ER_IB_MSG_104 11929
#define ER_IB_MSG_105 11930
#define ER_IB_MSG_106 11931
#define ER_IB_MSG_107 11932
#define ER_IB_MSG_108 11933
#define ER_IB_MSG_109 11934
#define ER_IB_MSG_110 11935
#define ER_IB_MSG_111 11936
#define ER_IB_MSG_112 11937
//#define OBSOLETE_ER_IB_MSG_113 11938
//#define OBSOLETE_ER_IB_MSG_114 11939
//#define OBSOLETE_ER_IB_MSG_115 11940
//#define OBSOLETE_ER_IB_MSG_116 11941
//#define OBSOLETE_ER_IB_MSG_117 11942
//#define OBSOLETE_ER_IB_MSG_118 11943
#define ER_IB_MSG_119 11944
#define ER_IB_MSG_120 11945
#define ER_IB_MSG_121 11946
#define ER_IB_MSG_122 11947
#define ER_IB_MSG_123 11948
#define ER_IB_MSG_124 11949
#define ER_IB_MSG_125 11950
#define ER_IB_MSG_126 11951
#define ER_IB_MSG_127 11952
#define ER_IB_MSG_128 11953
#define ER_IB_MSG_129 11954
#define ER_IB_MSG_130 11955
#define ER_IB_MSG_131 11956
#define ER_IB_MSG_132 11957
#define ER_IB_MSG_133 11958
#define ER_IB_MSG_134 11959
#define ER_IB_MSG_135 11960
#define ER_IB_MSG_136 11961
#define ER_IB_MSG_137 11962
#define ER_IB_MSG_138 11963
#define ER_IB_MSG_139 11964
#define ER_IB_MSG_140 11965
#define ER_IB_MSG_141 11966
#define ER_IB_MSG_142 11967
#define ER_IB_MSG_143 11968
#define ER_IB_MSG_144 11969
#define ER_IB_MSG_145 11970
#define ER_IB_MSG_146 11971
#define ER_IB_MSG_147 11972
#define ER_IB_MSG_148 11973
#define ER_IB_CLONE_INTERNAL 11974
#define ER_IB_CLONE_TIMEOUT 11975
#define ER_IB_CLONE_STATUS_FILE 11976
#define ER_IB_CLONE_SQL 11977
#define ER_IB_CLONE_VALIDATE 11978
#define ER_IB_CLONE_PUNCH_HOLE 11979
#define ER_IB_CLONE_GTID_PERSIST 11980
#define ER_IB_MSG_156 11981
#define ER_IB_MSG_157 11982
#define ER_IB_MSG_158 11983
#define ER_IB_MSG_159 11984
#define ER_IB_MSG_160 11985
#define ER_IB_MSG_161 11986
#define ER_IB_MSG_162 11987
#define ER_IB_MSG_163 11988
#define ER_IB_MSG_164 11989
#define ER_IB_MSG_165 11990
#define ER_IB_MSG_166 11991
#define ER_IB_MSG_167 11992
#define ER_IB_MSG_168 11993
#define ER_IB_MSG_169 11994
#define ER_IB_MSG_170 11995
#define ER_IB_MSG_171 11996
#define ER_IB_MSG_172 11997
#define ER_IB_MSG_173 11998
#define ER_IB_MSG_174 11999
#define ER_IB_MSG_175 12000
#define ER_IB_MSG_176 12001
#define ER_IB_MSG_177 12002
#define ER_IB_MSG_178 12003
#define ER_IB_MSG_179 12004
#define ER_IB_MSG_180 12005
#define ER_IB_LONG_AHI_DISABLE_WAIT 12006
#define ER_IB_MSG_182 12007
#define ER_IB_MSG_183 12008
#define ER_IB_MSG_184 12009
#define ER_IB_MSG_185 12010
#define ER_IB_MSG_186 12011
#define ER_IB_MSG_187 12012
#define ER_IB_MSG_188 12013
#define ER_IB_MSG_189 12014
#define ER_IB_MSG_190 12015
#define ER_IB_MSG_191 12016
#define ER_IB_MSG_192 12017
#define ER_IB_MSG_193 12018
#define ER_IB_MSG_194 12019
#define ER_IB_MSG_195 12020
#define ER_IB_MSG_196 12021
#define ER_IB_MSG_197 12022
#define ER_IB_MSG_198 12023
#define ER_IB_MSG_199 12024
#define ER_IB_MSG_200 12025
#define ER_IB_MSG_201 12026
#define ER_IB_MSG_202 12027
#define ER_IB_MSG_203 12028
#define ER_IB_MSG_204 12029
#define ER_IB_MSG_205 12030
#define ER_IB_MSG_206 12031
#define ER_IB_MSG_207 12032
#define ER_IB_MSG_208 12033
#define ER_IB_MSG_209 12034
#define ER_IB_MSG_210 12035
#define ER_IB_MSG_211 12036
#define ER_IB_MSG_212 12037
#define ER_IB_MSG_213 12038
#define ER_IB_MSG_214 12039
#define ER_IB_MSG_215 12040
#define ER_IB_MSG_216 12041
#define ER_IB_MSG_217 12042
#define ER_IB_MSG_218 12043
#define ER_IB_MSG_219 12044
#define ER_IB_MSG_220 12045
#define ER_IB_MSG_221 12046
#define ER_IB_MSG_222 12047
#define ER_IB_MSG_223 12048
#define ER_IB_MSG_224 12049
#define ER_IB_MSG_225 12050
#define ER_IB_MSG_226 12051
#define ER_IB_MSG_227 12052
#define ER_IB_MSG_228 12053
#define ER_IB_MSG_229 12054
#define ER_IB_MSG_230 12055
#define ER_IB_MSG_231 12056
#define ER_IB_MSG_232 12057
#define ER_IB_MSG_233 12058
#define ER_IB_MSG_234 12059
#define ER_IB_MSG_235 12060
#define ER_IB_MSG_236 12061
#define ER_IB_MSG_237 12062
#define ER_IB_MSG_238 12063
#define ER_IB_MSG_239 12064
#define ER_IB_MSG_240 12065
#define ER_IB_MSG_241 12066
#define ER_IB_MSG_242 12067
#define ER_IB_MSG_243 12068
#define ER_IB_MSG_244 12069
#define ER_IB_MSG_245 12070
#define ER_IB_MSG_246 12071
#define ER_IB_MSG_247 12072
#define ER_IB_MSG_248 12073
#define ER_IB_MSG_249 12074
#define ER_IB_MSG_250 12075
#define ER_IB_MSG_251 12076
#define ER_IB_MSG_252 12077
#define ER_IB_MSG_253 12078
#define ER_IB_MSG_254 12079
#define ER_IB_MSG_255 12080
#define ER_IB_MSG_256 12081
#define ER_IB_MSG_257 12082
#define ER_IB_MSG_258 12083
#define ER_IB_MSG_259 12084
#define ER_IB_MSG_260 12085
#define ER_IB_MSG_261 12086
#define ER_IB_MSG_262 12087
#define ER_IB_MSG_263 12088
#define ER_IB_MSG_264 12089
#define ER_IB_MSG_265 12090
#define ER_IB_MSG_266 12091
#define ER_IB_MSG_267 12092
#define ER_IB_MSG_268 12093
#define ER_IB_MSG_269 12094
#define ER_IB_MSG_270 12095
#define ER_IB_MSG_271 12096
#define ER_IB_MSG_272 12097
#define ER_IB_MSG_273 12098
//#define OBSOLETE_ER_IB_MSG_274 12099
//#define OBSOLETE_ER_IB_MSG_275 12100
//#define OBSOLETE_ER_IB_MSG_276 12101
//#define OBSOLETE_ER_IB_MSG_277 12102
#define ER_IB_MSG_278 12103
//#define OBSOLETE_ER_IB_MSG_279 12104
#define ER_IB_MSG_280 12105
#define ER_IB_MSG_281 12106
#define ER_IB_MSG_282 12107
#define ER_IB_MSG_283 12108
#define ER_IB_MSG_284 12109
#define ER_IB_MSG_285 12110
#define ER_IB_WARN_ACCESSING_NONEXISTINC_SPACE 12111
#define ER_IB_MSG_287 12112
#define ER_IB_MSG_288 12113
#define ER_IB_MSG_289 12114
//#define OBSOLETE_ER_IB_MSG_290 12115
#define ER_IB_MSG_291 12116
#define ER_IB_MSG_292 12117
#define ER_IB_MSG_293 12118
#define ER_IB_MSG_294 12119
#define ER_IB_MSG_295 12120
#define ER_IB_MSG_296 12121
#define ER_IB_MSG_297 12122
#define ER_IB_MSG_298 12123
#define ER_IB_MSG_299 12124
#define ER_IB_MSG_300 12125
#define ER_IB_MSG_301 12126
#define ER_IB_MSG_UNEXPECTED_FILE_EXISTS 12127
#define ER_IB_MSG_303 12128
#define ER_IB_MSG_304 12129
#define ER_IB_MSG_305 12130
#define ER_IB_MSG_306 12131
#define ER_IB_MSG_307 12132
#define ER_IB_MSG_308 12133
#define ER_IB_MSG_309 12134
#define ER_IB_MSG_310 12135
#define ER_IB_MSG_311 12136
#define ER_IB_MSG_312 12137
#define ER_IB_MSG_313 12138
#define ER_IB_MSG_314 12139
#define ER_IB_MSG_315 12140
#define ER_IB_MSG_316 12141
#define ER_IB_MSG_317 12142
#define ER_IB_MSG_318 12143
#define ER_IB_MSG_319 12144
#define ER_IB_MSG_320 12145
#define ER_IB_MSG_321 12146
#define ER_IB_MSG_322 12147
#define ER_IB_MSG_323 12148
#define ER_IB_MSG_324 12149
#define ER_IB_MSG_325 12150
#define ER_IB_MSG_326 12151
//#define OBSOLETE_ER_IB_MSG_327 12152
#define ER_IB_MSG_328 12153
#define ER_IB_MSG_329 12154
#define ER_IB_MSG_330 12155
#define ER_IB_MSG_331 12156
#define ER_IB_MSG_332 12157
#define ER_IB_MSG_333 12158
#define ER_IB_MSG_334 12159
#define ER_IB_MSG_335 12160
#define ER_IB_MSG_336 12161
#define ER_IB_MSG_337 12162
#define ER_IB_MSG_338 12163
#define ER_IB_MSG_339 12164
#define ER_IB_MSG_340 12165
#define ER_IB_MSG_341 12166
#define ER_IB_MSG_342 12167
#define ER_IB_MSG_343 12168
#define ER_IB_MSG_344 12169
#define ER_IB_MSG_345 12170
#define ER_IB_MSG_346 12171
#define ER_IB_MSG_347 12172
#define ER_IB_MSG_348 12173
#define ER_IB_MSG_349 12174
#define ER_IB_MSG_350 12175
//#define OBSOLETE_ER_IB_MSG_351 12176
#define ER_IB_MSG_UNPROTECTED_LOCATION_ALLOWED 12177
//#define OBSOLETE_ER_IB_MSG_353 12178
#define ER_IB_MSG_354 12179
#define ER_IB_MSG_355 12180
#define ER_IB_MSG_356 12181
#define ER_IB_MSG_357 12182
#define ER_IB_MSG_358 12183
#define ER_IB_MSG_359 12184
#define ER_IB_MSG_360 12185
#define ER_IB_MSG_361 12186
#define ER_IB_MSG_362 12187
//#define OBSOLETE_ER_IB_MSG_363 12188
#define ER_IB_MSG_364 12189
#define ER_IB_MSG_365 12190
#define ER_IB_MSG_IGNORE_SCAN_PATH 12191
#define ER_IB_MSG_367 12192
#define ER_IB_MSG_368 12193
#define ER_IB_MSG_369 12194
#define ER_IB_MSG_370 12195
#define ER_IB_MSG_371 12196
#define ER_IB_MSG_372 12197
#define ER_IB_MSG_373 12198
#define ER_IB_MSG_374 12199
#define ER_IB_MSG_375 12200
#define ER_IB_MSG_376 12201
#define ER_IB_MSG_377 12202
#define ER_IB_MSG_378 12203
#define ER_IB_MSG_379 12204
#define ER_IB_MSG_380 12205
#define ER_IB_MSG_381 12206
#define ER_IB_MSG_382 12207
#define ER_IB_MSG_383 12208
#define ER_IB_MSG_384 12209
#define ER_IB_MSG_385 12210
#define ER_IB_MSG_386 12211
#define ER_IB_MSG_387 12212
#define ER_IB_MSG_GENERAL_TABLESPACE_UNDER_DATADIR 12213
#define ER_IB_MSG_IMPLICIT_TABLESPACE_IN_DATADIR 12214
#define ER_IB_MSG_390 12215
#define ER_IB_MSG_391 12216
#define ER_IB_MSG_392 12217
#define ER_IB_MSG_393 12218
#define ER_IB_MSG_394 12219
#define ER_IB_MSG_395 12220
#define ER_IB_MSG_396 12221
#define ER_IB_MSG_397 12222
#define ER_IB_MSG_398 12223
#define ER_IB_MSG_399 12224
//#define OBSOLETE_ER_IB_MSG_400 12225
#define ER_IB_MSG_401 12226
#define ER_IB_MSG_402 12227
#define ER_IB_MSG_403 12228
#define ER_IB_MSG_404 12229
#define ER_IB_MSG_405 12230
#define ER_IB_MSG_406 12231
#define ER_IB_MSG_407 12232
#define ER_IB_MSG_408 12233
#define ER_IB_MSG_409 12234
#define ER_IB_MSG_410 12235
#define ER_IB_MSG_411 12236
#define ER_IB_MSG_412 12237
#define ER_IB_MSG_413 12238
#define ER_IB_MSG_414 12239
#define ER_IB_MSG_415 12240
#define ER_IB_MSG_416 12241
#define ER_IB_MSG_417 12242
#define ER_IB_MSG_418 12243
#define ER_IB_MSG_419 12244
#define ER_IB_MSG_420 12245
#define ER_IB_MSG_421 12246
#define ER_IB_MSG_422 12247
#define ER_IB_MSG_423 12248
#define ER_IB_MSG_424 12249
#define ER_IB_MSG_425 12250
#define ER_IB_MSG_426 12251
#define ER_IB_MSG_427 12252
#define ER_IB_MSG_428 12253
#define ER_IB_MSG_429 12254
#define ER_IB_MSG_430 12255
#define ER_IB_MSG_431 12256
#define ER_IB_MSG_432 12257
#define ER_IB_MSG_433 12258
#define ER_IB_MSG_434 12259
#define ER_IB_MSG_435 12260
#define ER_IB_MSG_436 12261
#define ER_IB_MSG_437 12262
#define ER_IB_MSG_438 12263
#define ER_IB_MSG_439 12264
#define ER_IB_MSG_440 12265
#define ER_IB_MSG_441 12266
#define ER_IB_MSG_442 12267
#define ER_IB_MSG_443 12268
//#define OBSOLETE_ER_IB_MSG_444 12269
#define ER_IB_MSG_445 12270
#define ER_IB_MSG_446 12271
#define ER_IB_MSG_447 12272
#define ER_IB_MSG_448 12273
#define ER_IB_MSG_449 12274
#define ER_IB_MSG_450 12275
#define ER_IB_MSG_451 12276
#define ER_IB_MSG_452 12277
#define ER_IB_MSG_453 12278
#define ER_IB_MSG_454 12279
#define ER_IB_MSG_455 12280
#define ER_IB_MSG_456 12281
#define ER_IB_MSG_457 12282
#define ER_IB_MSG_458 12283
#define ER_IB_MSG_459 12284
#define ER_IB_MSG_460 12285
#define ER_IB_MSG_461 12286
#define ER_IB_MSG_462 12287
#define ER_IB_MSG_463 12288
#define ER_IB_MSG_464 12289
#define ER_IB_MSG_465 12290
#define ER_IB_MSG_466 12291
#define ER_IB_MSG_467 12292
#define ER_IB_MSG_468 12293
#define ER_IB_MSG_469 12294
#define ER_IB_MSG_470 12295
#define ER_IB_MSG_471 12296
#define ER_IB_MSG_472 12297
#define ER_IB_MSG_473 12298
#define ER_IB_MSG_474 12299
#define ER_IB_MSG_475 12300
#define ER_IB_MSG_476 12301
#define ER_IB_MSG_477 12302
#define ER_IB_MSG_478 12303
#define ER_IB_MSG_479 12304
#define ER_IB_MSG_480 12305
#define ER_IB_MSG_481 12306
#define ER_IB_MSG_482 12307
#define ER_IB_MSG_483 12308
#define ER_IB_MSG_484 12309
#define ER_IB_MSG_485 12310
#define ER_IB_MSG_486 12311
#define ER_IB_MSG_487 12312
#define ER_IB_MSG_488 12313
#define ER_IB_MSG_489 12314
#define ER_IB_MSG_490 12315
#define ER_IB_MSG_491 12316
#define ER_IB_MSG_492 12317
#define ER_IB_MSG_493 12318
#define ER_IB_MSG_494 12319
#define ER_IB_MSG_495 12320
#define ER_IB_MSG_496 12321
#define ER_IB_MSG_497 12322
#define ER_IB_MSG_498 12323
#define ER_IB_MSG_499 12324
#define ER_IB_MSG_500 12325
#define ER_IB_MSG_501 12326
#define ER_IB_MSG_502 12327
#define ER_IB_MSG_503 12328
#define ER_IB_MSG_504 12329
#define ER_IB_MSG_505 12330
#define ER_IB_MSG_506 12331
#define ER_IB_MSG_507 12332
#define ER_IB_MSG_508 12333
#define ER_IB_MSG_509 12334
#define ER_IB_MSG_510 12335
#define ER_IB_MSG_511 12336
#define ER_IB_MSG_512 12337
#define ER_IB_MSG_513 12338
#define ER_IB_MSG_514 12339
#define ER_IB_MSG_515 12340
#define ER_IB_MSG_516 12341
#define ER_IB_MSG_517 12342
#define ER_IB_MSG_518 12343
#define ER_IB_MSG_519 12344
#define ER_IB_MSG_520 12345
#define ER_IB_MSG_521 12346
#define ER_IB_MSG_522 12347
#define ER_IB_MSG_523 12348
#define ER_IB_MSG_524 12349
#define ER_IB_MSG_525 12350
#define ER_IB_MSG_526 12351
#define ER_IB_MSG_527 12352
//#define OBSOLETE_ER_IB_MSG_528 12353
//#define OBSOLETE_ER_IB_MSG_529 12354
#define ER_IB_MSG_530 12355
#define ER_IB_MSG_531 12356
#define ER_IB_MSG_532 12357
#define ER_IB_MSG_533 12358
#define ER_IB_MSG_534 12359
//#define OBSOLETE_ER_IB_MSG_535 12360
//#define OBSOLETE_ER_IB_MSG_536 12361
#define ER_IB_MSG_537 12362
#define ER_IB_MSG_538 12363
#define ER_IB_MSG_539 12364
#define ER_IB_MSG_540 12365
#define ER_IB_MSG_541 12366
#define ER_IB_MSG_542 12367
#define ER_IB_MSG_543 12368
#define ER_IB_MSG_544 12369
#define ER_IB_MSG_545 12370
#define ER_IB_MSG_546 12371
#define ER_IB_MSG_547 12372
#define ER_IB_MSG_548 12373
#define ER_IB_MSG_549 12374
#define ER_IB_MSG_550 12375
#define ER_IB_MSG_551 12376
#define ER_IB_MSG_552 12377
#define ER_IB_MSG_553 12378
#define ER_IB_MSG_554 12379
#define ER_IB_MSG_555 12380
#define ER_IB_MSG_556 12381
#define ER_IB_MSG_557 12382
#define ER_IB_MSG_558 12383
#define ER_IB_MSG_559 12384
#define ER_IB_MSG_560 12385
#define ER_IB_MSG_561 12386
#define ER_IB_MSG_562 12387
#define ER_IB_MSG_563 12388
#define ER_IB_MSG_564 12389
#define ER_IB_MSG_INVALID_LOCATION_FOR_TABLE 12390
#define ER_IB_MSG_566 12391
#define ER_IB_MSG_567 12392
#define ER_IB_MSG_568 12393
#define ER_IB_MSG_569 12394
#define ER_IB_MSG_570 12395
#define ER_IB_MSG_571 12396
//#define OBSOLETE_ER_IB_MSG_572 12397
#define ER_IB_MSG_573 12398
#define ER_IB_MSG_574 12399
//#define OBSOLETE_ER_IB_MSG_575 12400
//#define OBSOLETE_ER_IB_MSG_576 12401
//#define OBSOLETE_ER_IB_MSG_577 12402
#define ER_IB_MSG_578 12403
#define ER_IB_MSG_579 12404
#define ER_IB_MSG_580 12405
#define ER_IB_MSG_581 12406
#define ER_IB_MSG_582 12407
#define ER_IB_MSG_583 12408
#define ER_IB_MSG_584 12409
#define ER_IB_MSG_585 12410
#define ER_IB_MSG_586 12411
#define ER_IB_MSG_587 12412
#define ER_IB_MSG_588 12413
#define ER_IB_MSG_589 12414
#define ER_IB_MSG_590 12415
#define ER_IB_MSG_591 12416
#define ER_IB_MSG_592 12417
#define ER_IB_MSG_593 12418
#define ER_IB_MSG_594 12419
#define ER_IB_MSG_595 12420
#define ER_IB_MSG_596 12421
#define ER_IB_MSG_597 12422
#define ER_IB_MSG_598 12423
#define ER_IB_MSG_599 12424
#define ER_IB_MSG_600 12425
#define ER_IB_MSG_601 12426
#define ER_IB_MSG_602 12427
#define ER_IB_MSG_603 12428
#define ER_IB_MSG_604 12429
#define ER_IB_MSG_605 12430
#define ER_IB_MSG_606 12431
#define ER_IB_MSG_607 12432
#define ER_IB_MSG_608 12433
#define ER_IB_MSG_609 12434
#define ER_IB_MSG_610 12435
#define ER_IB_MSG_611 12436
#define ER_IB_MSG_612 12437
#define ER_IB_MSG_613 12438
#define ER_IB_MSG_614 12439
#define ER_IB_MSG_615 12440
#define ER_IB_MSG_616 12441
#define ER_IB_MSG_617 12442
#define ER_IB_MSG_618 12443
#define ER_IB_MSG_619 12444
#define ER_IB_MSG_620 12445
#define ER_IB_MSG_621 12446
#define ER_IB_MSG_622 12447
#define ER_IB_MSG_623 12448
#define ER_IB_MSG_624 12449
#define ER_IB_MSG_625 12450
#define ER_IB_MSG_626 12451
#define ER_IB_MSG_627 12452
#define ER_IB_MSG_628 12453
#define ER_IB_MSG_629 12454
#define ER_IB_MSG_630 12455
#define ER_IB_MSG_631 12456
#define ER_IB_MSG_632 12457
#define ER_IB_MSG_633 12458
#define ER_IB_MSG_634 12459
#define ER_IB_MSG_635 12460
#define ER_IB_MSG_636 12461
#define ER_IB_MSG_637 12462
#define ER_IB_MSG_638 12463
#define ER_IB_MSG_639 12464
//#define OBSOLETE_ER_IB_MSG_640 12465
//#define OBSOLETE_ER_IB_MSG_641 12466
#define ER_IB_MSG_642 12467
#define ER_IB_MSG_643 12468
#define ER_IB_MSG_644 12469
#define ER_IB_MSG_645 12470
#define ER_IB_MSG_646 12471
#define ER_IB_MSG_647 12472
#define ER_IB_MSG_648 12473
#define ER_IB_MSG_649 12474
#define ER_IB_MSG_650 12475
#define ER_IB_MSG_651 12476
#define ER_IB_MSG_652 12477
#define ER_IB_MSG_DDL_LOG_DELETE_BY_ID_OK 12478
#define ER_IB_MSG_654 12479
#define ER_IB_MSG_655 12480
#define ER_IB_MSG_656 12481
#define ER_IB_MSG_657 12482
#define ER_IB_MSG_658 12483
#define ER_IB_MSG_659 12484
#define ER_IB_MSG_660 12485
#define ER_IB_MSG_661 12486
#define ER_IB_MSG_662 12487
#define ER_IB_MSG_663 12488
//#define OBSOLETE_ER_IB_MSG_664 12489
//#define OBSOLETE_ER_IB_MSG_665 12490
//#define OBSOLETE_ER_IB_MSG_666 12491
//#define OBSOLETE_ER_IB_MSG_667 12492
//#define OBSOLETE_ER_IB_MSG_668 12493
//#define OBSOLETE_ER_IB_MSG_669 12494
//#define OBSOLETE_ER_IB_MSG_670 12495
//#define OBSOLETE_ER_IB_MSG_671 12496
//#define OBSOLETE_ER_IB_MSG_672 12497
//#define OBSOLETE_ER_IB_MSG_673 12498
//#define OBSOLETE_ER_IB_MSG_674 12499
//#define OBSOLETE_ER_IB_MSG_675 12500
//#define OBSOLETE_ER_IB_MSG_676 12501
//#define OBSOLETE_ER_IB_MSG_677 12502
//#define OBSOLETE_ER_IB_MSG_678 12503
//#define OBSOLETE_ER_IB_MSG_679 12504
//#define OBSOLETE_ER_IB_MSG_680 12505
//#define OBSOLETE_ER_IB_MSG_681 12506
//#define OBSOLETE_ER_IB_MSG_682 12507
//#define OBSOLETE_ER_IB_MSG_683 12508
//#define OBSOLETE_ER_IB_MSG_684 12509
//#define OBSOLETE_ER_IB_MSG_685 12510
//#define OBSOLETE_ER_IB_MSG_686 12511
//#define OBSOLETE_ER_IB_MSG_687 12512
//#define OBSOLETE_ER_IB_MSG_688 12513
//#define OBSOLETE_ER_IB_MSG_689 12514
//#define OBSOLETE_ER_IB_MSG_690 12515
//#define OBSOLETE_ER_IB_MSG_691 12516
//#define OBSOLETE_ER_IB_MSG_692 12517
//#define OBSOLETE_ER_IB_MSG_693 12518
#define ER_IB_MSG_694 12519
#define ER_IB_MSG_695 12520
#define ER_IB_MSG_696 12521
#define ER_IB_MSG_697 12522
#define ER_IB_MSG_LOG_CORRUPT 12523
#define ER_IB_MSG_699 12524
#define ER_IB_MSG_LOG_FORMAT_OLD_AND_LOG_CORRUPTED 12525
#define ER_IB_MSG_LOG_FORMAT_OLD_AND_NO_CLEAN_SHUTDOWN 12526
//#define OBSOLETE_ER_IB_MSG_702 12527
//#define OBSOLETE_ER_IB_MSG_703 12528
#define ER_IB_MSG_LOG_FORMAT_BEFORE_8_0_30 12529
#define ER_IB_MSG_LOG_FILE_FORMAT_UNKNOWN 12530
#define ER_IB_MSG_RECOVERY_CHECKPOINT_NOT_FOUND 12531
#define ER_IB_MSG_707 12532
#define ER_IB_MSG_708 12533
#define ER_IB_MSG_709 12534
#define ER_IB_MSG_710 12535
#define ER_IB_MSG_711 12536
#define ER_IB_MSG_712 12537
#define ER_IB_MSG_713 12538
#define ER_IB_MSG_714 12539
#define ER_IB_MSG_715 12540
#define ER_IB_MSG_716 12541
#define ER_IB_MSG_717 12542
#define ER_IB_MSG_718 12543
#define ER_IB_MSG_719 12544
#define ER_IB_MSG_720 12545
#define ER_IB_MSG_RECOVERY_SKIPPED_IN_READ_ONLY_MODE 12546
#define ER_IB_MSG_722 12547
#define ER_IB_MSG_723 12548
#define ER_IB_MSG_724 12549
#define ER_IB_MSG_725 12550
#define ER_IB_MSG_726 12551
#define ER_IB_MSG_727 12552
#define ER_IB_MSG_728 12553
#define ER_IB_MSG_LOG_FILES_CREATED_BY_MEB_AND_READ_ONLY_MODE 12554
#define ER_IB_MSG_LOG_FILES_CREATED_BY_MEB 12555
#define ER_IB_MSG_LOG_FILES_CREATED_BY_CLONE 12556
#define ER_IB_MSG_LOG_FORMAT_OLD 12557
//#define OBSOLETE_ER_IB_MSG_LOG_FORMAT_NOT_SUPPORTED 12558
#define ER_IB_MSG_RECOVERY_CHECKPOINT_FROM_BEFORE_CLEAN_SHUTDOWN 12559
#define ER_IB_MSG_RECOVERY_IS_NEEDED 12560
#define ER_IB_MSG_RECOVERY_IN_READ_ONLY 12561
#define ER_IB_MSG_737 12562
#define ER_IB_MSG_738 12563
#define ER_IB_MSG_739 12564
#define ER_IB_MSG_740 12565
#define ER_IB_MSG_741 12566
#define ER_IB_MSG_742 12567
#define ER_IB_MSG_743 12568
#define ER_IB_MSG_744 12569
#define ER_IB_MSG_745 12570
#define ER_IB_MSG_746 12571
#define ER_IB_MSG_747 12572
#define ER_IB_MSG_748 12573
#define ER_IB_MSG_749 12574
#define ER_IB_MSG_750 12575
#define ER_IB_MSG_751 12576
#define ER_IB_MSG_752 12577
#define ER_IB_MSG_753 12578
#define ER_IB_MSG_754 12579
#define ER_IB_MSG_755 12580
#define ER_IB_MSG_756 12581
#define ER_IB_MSG_757 12582
#define ER_IB_MSG_758 12583
#define ER_IB_MSG_759 12584
#define ER_IB_MSG_760 12585
#define ER_IB_MSG_761 12586
#define ER_IB_MSG_762 12587
#define ER_IB_MSG_763 12588
#define ER_IB_MSG_764 12589
#define ER_IB_MSG_765 12590
#define ER_IB_MSG_766 12591
#define ER_IB_MSG_767 12592
#define ER_IB_MSG_768 12593
#define ER_IB_MSG_769 12594
#define ER_IB_MSG_770 12595
#define ER_IB_MSG_771 12596
#define ER_IB_MSG_772 12597
#define ER_IB_MSG_773 12598
#define ER_IB_MSG_774 12599
#define ER_IB_MSG_775 12600
#define ER_IB_MSG_776 12601
#define ER_IB_MSG_777 12602
#define ER_IB_MSG_778 12603
#define ER_IB_MSG_779 12604
#define ER_IB_MSG_780 12605
#define ER_IB_MSG_781 12606
#define ER_IB_MSG_782 12607
#define ER_IB_MSG_783 12608
#define ER_IB_MSG_784 12609
#define ER_IB_MSG_785 12610
#define ER_IB_MSG_786 12611
#define ER_IB_MSG_787 12612
#define ER_IB_MSG_788 12613
#define ER_IB_MSG_789 12614
#define ER_IB_MSG_790 12615
#define ER_IB_MSG_791 12616
#define ER_IB_MSG_792 12617
#define ER_IB_MSG_793 12618
#define ER_IB_MSG_794 12619
#define ER_IB_MSG_795 12620
#define ER_IB_MSG_796 12621
#define ER_IB_MSG_797 12622
#define ER_IB_MSG_798 12623
#define ER_IB_MSG_799 12624
//#define OBSOLETE_ER_IB_MSG_800 12625
#define ER_IB_MSG_801 12626
#define ER_IB_MSG_802 12627
#define ER_IB_MSG_803 12628
#define ER_IB_MSG_804 12629
#define ER_IB_MSG_805 12630
#define ER_IB_MSG_806 12631
#define ER_IB_MSG_807 12632
#define ER_IB_MSG_808 12633
#define ER_IB_MSG_809 12634
#define ER_IB_MSG_810 12635
#define ER_IB_MSG_811 12636
#define ER_IB_MSG_812 12637
#define ER_IB_MSG_813 12638
#define ER_IB_MSG_814 12639
#define ER_IB_MSG_815 12640
#define ER_IB_MSG_816 12641
#define ER_IB_MSG_817 12642
#define ER_IB_MSG_818 12643
#define ER_IB_MSG_819 12644
#define ER_IB_MSG_820 12645
#define ER_IB_MSG_821 12646
#define ER_IB_MSG_822 12647
#define ER_IB_MSG_823 12648
#define ER_IB_MSG_824 12649
#define ER_IB_MSG_825 12650
#define ER_IB_MSG_826 12651
#define ER_IB_MSG_827 12652
#define ER_IB_MSG_828 12653
#define ER_IB_MSG_829 12654
#define ER_IB_MSG_830 12655
#define ER_IB_MSG_831 12656
#define ER_IB_MSG_832 12657
#define ER_IB_MSG_833 12658
#define ER_IB_MSG_834 12659
#define ER_IB_MSG_835 12660
#define ER_IB_MSG_836 12661
#define ER_IB_MSG_837 12662
#define ER_IB_MSG_838 12663
#define ER_IB_MSG_839 12664
#define ER_IB_MSG_840 12665
#define ER_IB_MSG_841 12666
#define ER_IB_MSG_842 12667
#define ER_IB_MSG_CANT_ENCRYPT_REDO_LOG_DATA 12668
#define ER_IB_MSG_844 12669
#define ER_IB_MSG_845 12670
#define ER_IB_MSG_CANT_DECRYPT_REDO_LOG 12671
#define ER_IB_MSG_847 12672
#define ER_IB_MSG_848 12673
#define ER_IB_MSG_849 12674
#define ER_IB_MSG_850 12675
#define ER_IB_MSG_851 12676
#define ER_IB_MSG_852 12677
#define ER_IB_MSG_853 12678
#define ER_IB_MSG_854 12679
#define ER_IB_MSG_855 12680
#define ER_IB_MSG_856 12681
#define ER_IB_MSG_857 12682
#define ER_IB_MSG_858 12683
#define ER_IB_MSG_859 12684
#define ER_IB_MSG_860 12685
#define ER_IB_MSG_861 12686
#define ER_IB_MSG_862 12687
#define ER_IB_MSG_863 12688
#define ER_IB_MSG_864 12689
#define ER_IB_MSG_865 12690
#define ER_IB_MSG_866 12691
#define ER_IB_MSG_867 12692
#define ER_IB_MSG_868 12693
#define ER_IB_MSG_869 12694
#define ER_IB_MSG_870 12695
#define ER_IB_MSG_871 12696
#define ER_IB_MSG_872 12697
#define ER_IB_MSG_873 12698
#define ER_IB_MSG_874 12699
#define ER_IB_MSG_875 12700
#define ER_IB_MSG_876 12701
#define ER_IB_MSG_877 12702
#define ER_IB_MSG_878 12703
#define ER_IB_MSG_879 12704
#define ER_IB_MSG_880 12705
#define ER_IB_MSG_881 12706
#define ER_IB_MSG_882 12707
#define ER_IB_MSG_883 12708
#define ER_IB_MSG_884 12709
#define ER_IB_MSG_885 12710
#define ER_IB_MSG_886 12711
#define ER_IB_MSG_887 12712
#define ER_IB_MSG_888 12713
#define ER_IB_MSG_889 12714
#define ER_IB_MSG_890 12715
#define ER_IB_MSG_891 12716
#define ER_IB_MSG_892 12717
#define ER_IB_MSG_893 12718
#define ER_IB_MSG_894 12719
#define ER_IB_MSG_895 12720
#define ER_IB_MSG_896 12721
#define ER_IB_MSG_897 12722
#define ER_IB_MSG_898 12723
#define ER_IB_MSG_899 12724
#define ER_IB_MSG_900 12725
#define ER_IB_MSG_901 12726
#define ER_IB_MSG_902 12727
#define ER_IB_MSG_903 12728
#define ER_IB_MSG_904 12729
#define ER_IB_MSG_905 12730
#define ER_IB_MSG_906 12731
#define ER_IB_MSG_907 12732
#define ER_IB_MSG_908 12733
#define ER_IB_MSG_909 12734
#define ER_IB_MSG_910 12735
#define ER_IB_MSG_911 12736
#define ER_IB_MSG_912 12737
#define ER_IB_MSG_913 12738
#define ER_IB_MSG_914 12739
#define ER_IB_MSG_915 12740
#define ER_IB_MSG_916 12741
#define ER_IB_MSG_917 12742
#define ER_IB_MSG_918 12743
#define ER_IB_MSG_919 12744
#define ER_IB_MSG_920 12745
#define ER_IB_MSG_921 12746
#define ER_IB_MSG_922 12747
#define ER_IB_MSG_923 12748
#define ER_IB_MSG_924 12749
#define ER_IB_MSG_925 12750
#define ER_IB_MSG_926 12751
#define ER_IB_MSG_927 12752
#define ER_IB_MSG_928 12753
#define ER_IB_MSG_929 12754
#define ER_IB_MSG_930 12755
#define ER_IB_MSG_931 12756
#define ER_IB_MSG_932 12757
#define ER_IB_MSG_933 12758
#define ER_IB_MSG_934 12759
#define ER_IB_MSG_935 12760
#define ER_IB_MSG_936 12761
#define ER_IB_MSG_937 12762
#define ER_IB_MSG_938 12763
#define ER_IB_MSG_939 12764
#define ER_IB_MSG_940 12765
#define ER_IB_MSG_941 12766
#define ER_IB_MSG_942 12767
#define ER_IB_MSG_943 12768
#define ER_IB_MSG_944 12769
#define ER_IB_MSG_945 12770
#define ER_IB_MSG_946 12771
#define ER_IB_MSG_947 12772
#define ER_IB_MSG_948 12773
#define ER_IB_MSG_949 12774
#define ER_IB_MSG_950 12775
#define ER_IB_MSG_951 12776
#define ER_IB_MSG_952 12777
#define ER_IB_MSG_953 12778
#define ER_IB_MSG_954 12779
#define ER_IB_MSG_955 12780
#define ER_IB_MSG_956 12781
#define ER_IB_MSG_957 12782
#define ER_IB_MSG_958 12783
#define ER_IB_MSG_959 12784
#define ER_IB_MSG_960 12785
#define ER_IB_MSG_961 12786
#define ER_IB_MSG_962 12787
#define ER_IB_MSG_963 12788
#define ER_IB_MSG_964 12789
#define ER_IB_MSG_965 12790
#define ER_IB_MSG_966 12791
#define ER_IB_MSG_967 12792
#define ER_IB_MSG_968 12793
#define ER_IB_MSG_969 12794
#define ER_IB_MSG_970 12795
#define ER_IB_MSG_971 12796
#define ER_IB_MSG_972 12797
#define ER_IB_MSG_973 12798
#define ER_IB_MSG_974 12799
#define ER_IB_MSG_975 12800
#define ER_IB_MSG_976 12801
#define ER_IB_MSG_977 12802
#define ER_IB_MSG_978 12803
#define ER_IB_MSG_979 12804
#define ER_IB_MSG_980 12805
#define ER_IB_MSG_981 12806
#define ER_IB_MSG_982 12807
#define ER_IB_MSG_983 12808
#define ER_IB_MSG_984 12809
#define ER_IB_MSG_985 12810
#define ER_IB_MSG_986 12811
#define ER_IB_MSG_987 12812
#define ER_IB_MSG_988 12813
#define ER_IB_MSG_989 12814
#define ER_IB_MSG_990 12815
#define ER_IB_MSG_991 12816
#define ER_IB_MSG_992 12817
#define ER_IB_MSG_993 12818
#define ER_IB_MSG_994 12819
#define ER_IB_MSG_995 12820
#define ER_IB_MSG_996 12821
#define ER_IB_MSG_997 12822
#define ER_IB_MSG_998 12823
#define ER_IB_MSG_999 12824
#define ER_IB_MSG_1000 12825
#define ER_IB_MSG_1001 12826
#define ER_IB_MSG_1002 12827
#define ER_IB_MSG_1003 12828
#define ER_IB_MSG_1004 12829
#define ER_IB_MSG_1005 12830
#define ER_IB_MSG_1006 12831
#define ER_IB_MSG_1007 12832
#define ER_IB_MSG_1008 12833
#define ER_IB_MSG_1009 12834
#define ER_IB_MSG_1010 12835
#define ER_IB_MSG_1011 12836
#define ER_IB_MSG_1012 12837
#define ER_IB_MSG_1013 12838
#define ER_IB_MSG_1014 12839
#define ER_IB_MSG_1015 12840
#define ER_IB_MSG_1016 12841
#define ER_IB_MSG_1017 12842
#define ER_IB_MSG_1018 12843
#define ER_IB_MSG_1019 12844
#define ER_IB_MSG_1020 12845
#define ER_IB_MSG_1021 12846
#define ER_IB_MSG_1022 12847
#define ER_IB_MSG_1023 12848
#define ER_IB_MSG_1024 12849
#define ER_IB_MSG_1025 12850
#define ER_IB_MSG_1026 12851
#define ER_IB_MSG_1027 12852
#define ER_IB_MSG_1028 12853
#define ER_IB_MSG_1029 12854
#define ER_IB_MSG_1030 12855
#define ER_IB_MSG_1031 12856
#define ER_IB_MSG_1032 12857
#define ER_IB_MSG_1033 12858
#define ER_IB_MSG_1034 12859
#define ER_IB_MSG_1035 12860
#define ER_IB_MSG_1036 12861
#define ER_IB_MSG_1037 12862
#define ER_IB_MSG_1038 12863
#define ER_IB_MSG_1039 12864
#define ER_IB_MSG_1040 12865
#define ER_IB_MSG_1041 12866
#define ER_IB_MSG_1042 12867
#define ER_IB_MSG_1043 12868
#define ER_IB_MSG_1044 12869
#define ER_IB_MSG_1045 12870
#define ER_IB_MSG_1046 12871
#define ER_IB_MSG_1047 12872
#define ER_IB_MSG_1048 12873
#define ER_IB_MSG_1049 12874
//#define OBSOLETE_ER_IB_MSG_1050 12875
#define ER_IB_MSG_1051 12876
#define ER_IB_MSG_1052 12877
#define ER_IB_MSG_1053 12878
#define ER_IB_MSG_1054 12879
#define ER_IB_MSG_1055 12880
#define ER_IB_MSG_1056 12881
#define ER_IB_MSG_1057 12882
#define ER_IB_MSG_1058 12883
#define ER_IB_MSG_1059 12884
#define ER_IB_MSG_1060 12885
#define ER_IB_MSG_LOG_FILE_OS_CREATE_FAILED 12886
#define ER_IB_MSG_FILE_RESIZE 12887
#define ER_IB_MSG_LOG_FILE_RESIZE_FAILED 12888
#define ER_IB_MSG_LOG_FILES_CREATE_AND_READ_ONLY_MODE 12889
#define ER_IB_MSG_1065 12890
#define ER_IB_MSG_LOG_FILE_PREPARE_ON_CREATE_FAILED 12891
//#define OBSOLETE_ER_IB_MSG_1067 12892
#define ER_IB_MSG_LOG_FILES_INITIALIZED 12893
#define ER_IB_MSG_LOG_FILE_OPEN_FAILED 12894
#define ER_IB_MSG_1070 12895
#define ER_IB_MSG_1071 12896
#define ER_IB_MSG_1072 12897
#define ER_IB_MSG_1073 12898
#define ER_IB_MSG_1074 12899
#define ER_IB_MSG_1075 12900
#define ER_IB_MSG_1076 12901
#define ER_IB_MSG_1077 12902
#define ER_IB_MSG_1078 12903
#define ER_IB_MSG_1079 12904
#define ER_IB_MSG_1080 12905
#define ER_IB_MSG_1081 12906
#define ER_IB_MSG_1082 12907
#define ER_IB_MSG_1083 12908
#define ER_IB_MSG_CANNOT_OPEN_57_UNDO 12909
#define ER_IB_MSG_1085 12910
#define ER_IB_MSG_1086 12911
#define ER_IB_MSG_1087 12912
#define ER_IB_MSG_1088 12913
#define ER_IB_MSG_1089 12914
#define ER_IB_MSG_1090 12915
#define ER_IB_MSG_1091 12916
#define ER_IB_MSG_1092 12917
#define ER_IB_MSG_1093 12918
#define ER_IB_MSG_1094 12919
#define ER_IB_MSG_1095 12920
#define ER_IB_MSG_1096 12921
#define ER_IB_MSG_1097 12922
#define ER_IB_MSG_1098 12923
#define ER_IB_MSG_1099 12924
#define ER_IB_MSG_1100 12925
#define ER_IB_MSG_1101 12926
#define ER_IB_MSG_1102 12927
#define ER_IB_MSG_1103 12928
#define ER_IB_MSG_1104 12929
#define ER_IB_MSG_1105 12930
#define ER_IB_MSG_BUF_PENDING_IO 12931
#define ER_IB_MSG_1107 12932
#define ER_IB_MSG_1108 12933
#define ER_IB_MSG_1109 12934
#define ER_IB_MSG_1110 12935
#define ER_IB_MSG_1111 12936
#define ER_IB_MSG_1112 12937
#define ER_IB_MSG_1113 12938
#define ER_IB_MSG_1114 12939
#define ER_IB_MSG_1115 12940
#define ER_IB_MSG_1116 12941
#define ER_IB_MSG_1117 12942
//#define OBSOLETE_ER_IB_MSG_1118 12943
#define ER_IB_MSG_1119 12944
#define ER_IB_MSG_1120 12945
#define ER_IB_MSG_1121 12946
#define ER_IB_MSG_1122 12947
#define ER_IB_MSG_1123 12948
#define ER_IB_MSG_1124 12949
#define ER_IB_MSG_1125 12950
#define ER_IB_MSG_1126 12951
#define ER_IB_MSG_1127 12952
#define ER_IB_MSG_1128 12953
#define ER_IB_MSG_1129 12954
#define ER_IB_MSG_1130 12955
#define ER_IB_MSG_1131 12956
#define ER_IB_MSG_1132 12957
#define ER_IB_MSG_1133 12958
#define ER_IB_MSG_1134 12959
#define ER_IB_MSG_DATA_DIRECTORY_NOT_INITIALIZED_OR_CORRUPTED 12960
#define ER_IB_MSG_LOG_FILES_INVALID_SET 12961
#define ER_IB_MSG_LOG_FILE_SIZE_INVALID 12962
#define ER_IB_MSG_LOG_FILES_DIFFERENT_SIZES 12963
#define ER_IB_MSG_1139 12964
#define ER_IB_MSG_RECOVERY_CORRUPT 12965
//#define OBSOLETE_ER_IB_MSG_LOG_FILES_RESIZE_ON_START_IN_READ_ONLY_MODE 12966
#define ER_IB_MSG_1142 12967
#define ER_IB_MSG_LOG_FILES_REWRITING 12968
#define ER_IB_MSG_1144 12969
#define ER_IB_MSG_1145 12970
#define ER_IB_MSG_1146 12971
#define ER_IB_MSG_1147 12972
#define ER_IB_MSG_1148 12973
#define ER_IB_MSG_1149 12974
#define ER_IB_MSG_1150 12975
#define ER_IB_MSG_1151 12976
#define ER_IB_MSG_1152 12977
//#define OBSOLETE_ER_IB_MSG_1153 12978
#define ER_IB_MSG_1154 12979
#define ER_IB_MSG_1155 12980
#define ER_IB_MSG_1156 12981
#define ER_IB_MSG_1157 12982
#define ER_IB_MSG_1158 12983
#define ER_IB_MSG_1159 12984
#define ER_IB_MSG_1160 12985
#define ER_IB_MSG_1161 12986
#define ER_IB_MSG_1162 12987
#define ER_IB_MSG_1163 12988
#define ER_IB_MSG_1164 12989
#define ER_IB_MSG_1165 12990
#define ER_IB_MSG_UNDO_TRUNCATE_FAIL_TO_READ_LOG_FILE 12991
#define ER_IB_MSG_UNDO_MARKED_FOR_TRUNCATE 12992
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_MDL 12993
#define ER_IB_MSG_UNDO_TRUNCATE_START 12994
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_DDL_LOG_START 12995
#define ER_IB_MSG_UNDO_TRUNCATE_DELAY_BY_LOG_CREATE 12996
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_TRUNCATE 12997
#define ER_IB_MSG_UNDO_TRUNCATE_DELAY_BY_FAILURE 12998
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_STATE_UPDATE 12999
#define ER_IB_MSG_UNDO_TRUNCATE_COMPLETE 13000
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_TRUNCATE_DONE 13001
#define ER_IB_MSG_1177 13002
#define ER_IB_MSG_1178 13003
#define ER_IB_MSG_1179 13004
#define ER_IB_MSG_1180 13005
#define ER_IB_MSG_1181 13006
#define ER_IB_MSG_1182 13007
#define ER_IB_MSG_1183 13008
#define ER_IB_MSG_1184 13009
#define ER_IB_MSG_1185 13010
#define ER_IB_MSG_1186 13011
#define ER_IB_MSG_1187 13012
#define ER_IB_MSG_1188 13013
#define ER_IB_MSG_1189 13014
#define ER_IB_MSG_TRX_RECOVERY_ROLLBACK_COMPLETED 13015
#define ER_IB_MSG_1191 13016
#define ER_IB_MSG_1192 13017
#define ER_IB_MSG_1193 13018
#define ER_IB_MSG_1194 13019
#define ER_IB_MSG_1195 13020
#define ER_IB_MSG_1196 13021
#define ER_IB_MSG_1197 13022
#define ER_IB_MSG_1198 13023
#define ER_IB_MSG_1199 13024
#define ER_IB_MSG_1200 13025
#define ER_IB_MSG_1201 13026
#define ER_IB_MSG_1202 13027
#define ER_IB_MSG_1203 13028
#define ER_IB_MSG_1204 13029
#define ER_IB_MSG_1205 13030
#define ER_IB_MSG_1206 13031
#define ER_IB_MSG_1207 13032
#define ER_IB_MSG_1208 13033
#define ER_IB_MSG_1209 13034
#define ER_IB_MSG_1210 13035
#define ER_IB_MSG_1211 13036
#define ER_IB_MSG_1212 13037
#define ER_IB_MSG_1213 13038
#define ER_IB_MSG_1214 13039
#define ER_IB_MSG_1215 13040
#define ER_IB_MSG_LOG_FILES_RESIZE_ON_START 13041
#define ER_IB_MSG_1217 13042
#define ER_IB_MSG_1218 13043
#define ER_IB_MSG_1219 13044
#define ER_IB_MSG_1220 13045
#define ER_IB_MSG_1221 13046
#define ER_IB_MSG_1222 13047
#define ER_IB_MSG_1223 13048
#define ER_IB_MSG_1224 13049
#define ER_IB_MSG_1225 13050
#define ER_IB_MSG_1226 13051
#define ER_IB_MSG_1227 13052
#define ER_IB_MSG_1228 13053
#define ER_IB_MSG_1229 13054
//#define OBSOLETE_ER_IB_MSG_1230 13055
#define ER_IB_MSG_1231 13056
//#define OBSOLETE_ER_IB_MSG_1232 13057
#define ER_IB_MSG_1233 13058
#define ER_IB_MSG_LOG_WRITER_OUT_OF_SPACE 13059
#define ER_IB_MSG_1235 13060
#define ER_IB_MSG_LOG_WRITER_ABORTS_LOG_ARCHIVER 13061
#define ER_IB_MSG_LOG_WRITER_WAITING_FOR_ARCHIVER 13062
#define ER_IB_MSG_1238 13063
#define ER_IB_MSG_1239 13064
//#define OBSOLETE_ER_IB_MSG_1240 13065
#define ER_IB_MSG_1241 13066
#define ER_IB_MSG_LOG_FILES_CANNOT_ENCRYPT_IN_READ_ONLY 13067
#define ER_IB_MSG_LOG_FILES_ENCRYPTION_INIT_FAILED 13068
//#define OBSOLETE_ER_IB_MSG_1244 13069
#define ER_IB_MSG_1245 13070
#define ER_IB_MSG_1246 13071
#define ER_IB_MSG_1247 13072
#define ER_IB_MSG_1248 13073
#define ER_IB_MSG_1249 13074
#define ER_IB_MSG_1250 13075
#define ER_IB_MSG_1251 13076
#define ER_IB_MSG_BUF_PENDING_IO_ON_SHUTDOWN 13077
#define ER_IB_MSG_1253 13078
//#define OBSOLETE_ER_IB_MSG_1254 13079
#define ER_IB_MSG_1255 13080
#define ER_IB_MSG_1256 13081
#define ER_IB_MSG_1257 13082
#define ER_IB_MSG_1258 13083
#define ER_IB_MSG_1259 13084
#define ER_IB_MSG_1260 13085
#define ER_IB_MSG_1261 13086
#define ER_IB_MSG_1262 13087
#define ER_IB_MSG_1263 13088
#define ER_IB_MSG_LOG_FILE_HEADER_INVALID_CHECKSUM 13089
#define ER_IB_MSG_LOG_FORMAT_BEFORE_5_7_9 13090
#define ER_IB_MSG_1266 13091
#define ER_IB_MSG_LOG_PARAMS_CONCURRENCY_MARGIN_UNSAFE 13092
#define ER_IB_MSG_1268 13093
#define ER_IB_MSG_1269 13094
#define ER_IB_MSG_THREAD_CONCURRENCY_CHANGED 13095
#define ER_RPL_REPLICA_SQL_THREAD_STOP_CMD_EXEC_TIMEOUT 13096
#define ER_RPL_REPLICA_IO_THREAD_STOP_CMD_EXEC_TIMEOUT 13097
#define ER_RPL_GTID_UNSAFE_STMT_ON_NON_TRANS_TABLE 13098
#define ER_RPL_GTID_UNSAFE_STMT_CREATE_SELECT 13099
//#define OBSOLETE_ER_RPL_GTID_UNSAFE_STMT_ON_TEMPORARY_TABLE 13100
#define ER_BINLOG_ROW_VALUE_OPTION_IGNORED 13101
#define ER_BINLOG_USE_V1_ROW_EVENTS_IGNORED 13102
#define ER_BINLOG_ROW_VALUE_OPTION_USED_ONLY_FOR_AFTER_IMAGES 13103
#define ER_CONNECTION_ABORTED 13104
#define ER_NORMAL_SERVER_SHUTDOWN 13105
#define ER_KEYRING_MIGRATE_FAILED 13106
#define ER_GRP_RPL_LOWER_CASE_TABLE_NAMES_DIFF_FROM_GRP 13107
#define ER_OOM_SAVE_GTIDS 13108
#define ER_LCTN_NOT_FOUND 13109
//#define OBSOLETE_ER_REGEXP_INVALID_CAPTURE_GROUP_NAME 13110
#define ER_COMPONENT_FILTER_WRONG_VALUE 13111
#define ER_XPLUGIN_FAILED_TO_STOP_SERVICES 13112
#define ER_INCONSISTENT_ERROR 13113
#define ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG 13114
#define ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 13115
#define ER_REPLICA_CREATE_EVENT_FAILURE 13116
#define ER_REPLICA_FATAL_ERROR 13117
#define ER_REPLICA_HEARTBEAT_FAILURE 13118
#define ER_REPLICA_INCIDENT 13119
#define ER_REPLICA_SOURCE_COM_FAILURE 13120
#define ER_REPLICA_RELAY_LOG_READ_FAILURE 13121
#define ER_REPLICA_RELAY_LOG_WRITE_FAILURE 13122
#define ER_SERVER_REPLICA_CM_INIT_REPOSITORY 13123
#define ER_SERVER_REPLICA_AM_INIT_REPOSITORY 13124
#define ER_SERVER_NET_PACKET_TOO_LARGE 13125
#define ER_SERVER_NO_SYSTEM_TABLE_ACCESS 13126
//#define OBSOLETE_ER_SERVER_UNKNOWN_ERROR 13127
#define ER_SERVER_UNKNOWN_SYSTEM_VARIABLE 13128
#define ER_SERVER_NO_SESSION_TO_SEND_TO 13129
#define ER_SERVER_NEW_ABORTING_CONNECTION 13130
#define ER_SERVER_OUT_OF_SORTMEMORY 13131
#define ER_SERVER_RECORD_FILE_FULL 13132
#define ER_SERVER_DISK_FULL_NOWAIT 13133
#define ER_SERVER_HANDLER_ERROR 13134
#define ER_SERVER_NOT_FORM_FILE 13135
#define ER_SERVER_CANT_OPEN_FILE 13136
#define ER_SERVER_FILE_NOT_FOUND 13137
#define ER_SERVER_FILE_USED 13138
#define ER_SERVER_CANNOT_LOAD_FROM_TABLE_V2 13139
#define ER_ERROR_INFO_FROM_DA 13140
#define ER_SERVER_TABLE_CHECK_FAILED 13141
#define ER_SERVER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 13142
#define ER_SERVER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 13143
#define ER_SERVER_ACL_TABLE_ERROR 13144
#define ER_SERVER_REPLICA_INIT_QUERY_FAILED 13145
#define ER_SERVER_REPLICA_CONVERSION_FAILED 13146
#define ER_SERVER_REPLICA_IGNORED_TABLE 13147
#define ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION 13148
#define ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON 13149
#define ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF 13150
#define ER_SERVER_TEST_MESSAGE 13151
#define ER_AUDIT_LOG_JSON_FILTER_PARSING_ERROR 13152
#define ER_AUDIT_LOG_JSON_FILTERING_NOT_ENABLED 13153
#define ER_PLUGIN_FAILED_TO_OPEN_TABLES 13154
#define ER_PLUGIN_FAILED_TO_OPEN_TABLE 13155
#define ER_AUDIT_LOG_JSON_FILTER_NAME_CANNOT_BE_EMPTY 13156
#define ER_AUDIT_LOG_USER_NAME_INVALID_CHARACTER 13157
#define ER_AUDIT_LOG_UDF_INSUFFICIENT_PRIVILEGE 13158
#define ER_AUDIT_LOG_NO_KEYRING_PLUGIN_INSTALLED 13159
#define ER_AUDIT_LOG_HOST_NAME_INVALID_CHARACTER 13160
#define ER_AUDIT_LOG_ENCRYPTION_PASSWORD_HAS_NOT_BEEN_SET 13161
#define ER_AUDIT_LOG_COULD_NOT_CREATE_AES_KEY 13162
#define ER_AUDIT_LOG_ENCRYPTION_PASSWORD_CANNOT_BE_FETCHED 13163
#define ER_COULD_NOT_REINITIALIZE_AUDIT_LOG_FILTERS 13164
#define ER_AUDIT_LOG_JSON_USER_NAME_CANNOT_BE_EMPTY 13165
#define ER_AUDIT_LOG_USER_FIRST_CHARACTER_MUST_BE_ALPHANUMERIC 13166
#define ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXIST 13167
#define ER_IB_MSG_1271 13168
#define ER_STARTING_INIT 13169
#define ER_ENDING_INIT 13170
#define ER_IB_MSG_1272 13171
#define ER_SERVER_SHUTDOWN_INFO 13172
#define ER_GRP_RPL_PLUGIN_ABORT 13173
//#define OBSOLETE_ER_REGEXP_INVALID_FLAG 13174
//#define OBSOLETE_ER_XA_REPLICATION_FILTERS 13175
//#define OBSOLETE_ER_UPDATE_GTID_PURGED_WITH_GR 13176
#define ER_AUDIT_LOG_TABLE_DEFINITION_NOT_UPDATED 13177
#define ER_DD_INITIALIZE_SQL_ERROR 13178
#define ER_NO_PATH_FOR_SHARED_LIBRARY 13179
#define ER_UDF_ALREADY_EXISTS 13180
#define ER_SET_EVENT_FAILED 13181
#define ER_FAILED_TO_ALLOCATE_SSL_BIO 13182
#define ER_IB_MSG_1273 13183
#define ER_PID_FILEPATH_LOCATIONS_INACCESSIBLE 13184
#define ER_UNKNOWN_VARIABLE_IN_PERSISTED_CONFIG_FILE 13185
#define ER_FAILED_TO_HANDLE_DEFAULTS_FILE 13186
#define ER_DUPLICATE_SYS_VAR 13187
#define ER_FAILED_TO_INIT_SYS_VAR 13188
#define ER_SYS_VAR_NOT_FOUND 13189
#define ER_IB_MSG_1274 13190
#define ER_IB_MSG_1275 13191
//#define OBSOLETE_ER_TARGET_TS_UNENCRYPTED 13192
#define ER_IB_MSG_WAIT_FOR_ENCRYPT_THREAD 13193
#define ER_IB_MSG_1277 13194
#define ER_IB_MSG_NO_ENCRYPT_PROGRESS_FOUND 13195
#define ER_IB_MSG_RESUME_OP_FOR_SPACE 13196
#define ER_IB_MSG_1280 13197
#define ER_IB_MSG_1281 13198
#define ER_IB_MSG_1282 13199
#define ER_IB_MSG_1283 13200
#define ER_IB_MSG_1284 13201
#define ER_CANT_SET_ERROR_SUPPRESSION_LIST_FROM_COMMAND_LINE 13202
#define ER_INVALID_VALUE_OF_BIND_ADDRESSES 13203
#define ER_RELAY_LOG_SPACE_LIMIT_DISABLED 13204
#define ER_GRP_RPL_ERROR_GTID_SET_EXTRACTION 13205
#define ER_GRP_RPL_MISSING_GRP_RPL_ACTION_COORDINATOR 13206
#define ER_GRP_RPL_JOIN_WHEN_GROUP_ACTION_RUNNING 13207
#define ER_GRP_RPL_JOINER_EXIT_WHEN_GROUP_ACTION_RUNNING 13208
#define ER_GRP_RPL_CHANNEL_THREAD_WHEN_GROUP_ACTION_RUNNING 13209
#define ER_GRP_RPL_APPOINTED_PRIMARY_NOT_PRESENT 13210
#define ER_GRP_RPL_ERROR_ON_MESSAGE_SENDING 13211
#define ER_GRP_RPL_CONFIGURATION_ACTION_ERROR 13212
#define ER_GRP_RPL_CONFIGURATION_ACTION_LOCAL_TERMINATION 13213
#define ER_GRP_RPL_CONFIGURATION_ACTION_START 13214
#define ER_GRP_RPL_CONFIGURATION_ACTION_END 13215
#define ER_GRP_RPL_CONFIGURATION_ACTION_KILLED_ERROR 13216
#define ER_GRP_RPL_PRIMARY_ELECTION_PROCESS_ERROR 13217
#define ER_GRP_RPL_PRIMARY_ELECTION_STOP_ERROR 13218
#define ER_GRP_RPL_NO_STAGE_SERVICE 13219
#define ER_GRP_RPL_UDF_REGISTER_ERROR 13220
#define ER_GRP_RPL_UDF_UNREGISTER_ERROR 13221
#define ER_GRP_RPL_UDF_REGISTER_SERVICE_ERROR 13222
#define ER_GRP_RPL_SERVER_UDF_ERROR 13223
//#define OBSOLETE_ER_CURRENT_PASSWORD_NOT_REQUIRED 13224
//#define OBSOLETE_ER_INCORRECT_CURRENT_PASSWORD 13225
//#define OBSOLETE_ER_MISSING_CURRENT_PASSWORD 13226
#define ER_SERVER_WRONG_VALUE_FOR_VAR 13227
#define ER_COULD_NOT_CREATE_WINDOWS_REGISTRY_KEY 13228
#define ER_SERVER_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRX_IN_SBR 13229
//#define OBSOLETE_ER_SECONDARY_ENGINE 13230
//#define OBSOLETE_ER_SECONDARY_ENGINE_DDL 13231
//#define OBSOLETE_ER_NO_SESSION_TEMP 13232
#define ER_XPLUGIN_FAILED_TO_SWITCH_SECURITY_CTX 13233
#define ER_RPL_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION 13234
#define ER_UPGRADE_PARSE_ERROR 13235
#define ER_DATA_DIRECTORY_UNUSABLE 13236
#define ER_LDAP_AUTH_USER_GROUP_SEARCH_ROOT_BIND 13237
#define ER_PLUGIN_INSTALL_ERROR 13238
#define ER_PLUGIN_UNINSTALL_ERROR 13239
#define ER_SHARED_TABLESPACE_USED_BY_PARTITIONED_TABLE 13240
#define ER_UNKNOWN_TABLESPACE_TYPE 13241
#define ER_WARN_DEPRECATED_UTF8_ALIAS_OPTION 13242
#define ER_WARN_DEPRECATED_UTF8MB3_CHARSET_OPTION 13243
#define ER_WARN_DEPRECATED_UTF8MB3_COLLATION_OPTION 13244
#define ER_SSL_MEMORY_INSTRUMENTATION_INIT_FAILED 13245
#define ER_IB_MSG_MADV_DONTDUMP_UNSUPPORTED 13246
#define ER_IB_MSG_MADVISE_FAILED 13247
//#define OBSOLETE_ER_COLUMN_CHANGE_SIZE 13248
#define ER_WARN_REMOVED_SQL_MODE 13249
#define ER_IB_MSG_FAILED_TO_ALLOCATE_WAIT 13250
//#define OBSOLETE_ER_IB_MSG_NUM_POOLS 13251
#define ER_IB_MSG_USING_UNDO_SPACE 13252
#define ER_IB_MSG_FAIL_TO_SAVE_SPACE_STATE 13253
#define ER_IB_MSG_MAX_UNDO_SPACES_REACHED 13254
#define ER_IB_MSG_ERROR_OPENING_NEW_UNDO_SPACE 13255
#define ER_IB_MSG_FAILED_SDI_Z_BUF_ERROR 13256
#define ER_IB_MSG_FAILED_SDI_Z_MEM_ERROR 13257
#define ER_IB_MSG_SDI_Z_STREAM_ERROR 13258
#define ER_IB_MSG_SDI_Z_UNKNOWN_ERROR 13259
#define ER_IB_MSG_FOUND_WRONG_UNDO_SPACE 13260
#define ER_IB_MSG_NOT_END_WITH_IBU 13261
//#define OBSOLETE_ER_IB_MSG_UNDO_TRUNCATE_EMPTY_FILE 13262
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_DD_UPDATE 13263
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_UNDO_LOGGING 13264
//#define OBSOLETE_ER_IB_MSG_UNDO_INJECT_BEFORE_RSEG 13265
#define ER_IB_MSG_FAILED_TO_FINISH_TRUNCATE 13266
#define ER_IB_MSG_DEPRECATED_INNODB_UNDO_TABLESPACES 13267
#define ER_IB_MSG_WRONG_TABLESPACE_DIR 13268
#define ER_IB_MSG_LOCK_FREE_HASH_USAGE_STATS 13269
#define ER_CLONE_DONOR_TRACE 13270
#define ER_CLONE_PROTOCOL_TRACE 13271
#define ER_CLONE_CLIENT_TRACE 13272
#define ER_CLONE_SERVER_TRACE 13273
#define ER_THREAD_POOL_PFS_TABLES_INIT_FAILED 13274
#define ER_THREAD_POOL_PFS_TABLES_ADD_FAILED 13275
#define ER_CANT_SET_DATA_DIR 13276
#define ER_INNODB_INVALID_INNODB_UNDO_DIRECTORY_LOCATION 13277
#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_FETCH_KEY 13278
#define ER_SERVER_RPL_ENCRYPTION_KEY_NOT_FOUND 13279
#define ER_SERVER_RPL_ENCRYPTION_KEYRING_INVALID_KEY 13280
#define ER_SERVER_RPL_ENCRYPTION_HEADER_ERROR 13281
#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_ROTATE_LOGS 13282
#define ER_SERVER_RPL_ENCRYPTION_KEY_EXISTS_UNEXPECTED 13283
#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_GENERATE_KEY 13284
#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_STORE_KEY 13285
#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_REMOVE_KEY 13286
#define ER_SERVER_RPL_ENCRYPTION_MASTER_KEY_RECOVERY_FAILED 13287
#define ER_SERVER_RPL_ENCRYPTION_UNABLE_TO_INITIALIZE 13288
#define ER_SERVER_RPL_ENCRYPTION_UNABLE_TO_ROTATE_MASTER_KEY_AT_STARTUP 13289
#define ER_SERVER_RPL_ENCRYPTION_IGNORE_ROTATE_MASTER_KEY_AT_STARTUP 13290
#define ER_INVALID_ADMIN_ADDRESS 13291
#define ER_SERVER_STARTUP_ADMIN_INTERFACE 13292
#define ER_CANT_CREATE_ADMIN_THREAD 13293
#define ER_WARNING_RETAIN_CURRENT_PASSWORD_CLAUSE_VOID 13294
#define ER_WARNING_DISCARD_OLD_PASSWORD_CLAUSE_VOID 13295
//#define OBSOLETE_ER_SECOND_PASSWORD_CANNOT_BE_EMPTY 13296
//#define OBSOLETE_ER_PASSWORD_CANNOT_BE_RETAINED_ON_PLUGIN_CHANGE 13297
//#define OBSOLETE_ER_CURRENT_PASSWORD_CANNOT_BE_RETAINED 13298
#define ER_WARNING_AUTHCACHE_INVALID_USER_ATTRIBUTES 13299
#define ER_MYSQL_NATIVE_PASSWORD_SECOND_PASSWORD_USED_INFORMATION 13300
#define ER_SHA256_PASSWORD_SECOND_PASSWORD_USED_INFORMATION 13301
#define ER_CACHING_SHA2_PASSWORD_SECOND_PASSWORD_USED_INFORMATION 13302
#define ER_GRP_RPL_SEND_TRX_PREPARED_MESSAGE_FAILED 13303
#define ER_GRP_RPL_RELEASE_COMMIT_AFTER_GROUP_PREPARE_FAILED 13304
#define ER_GRP_RPL_TRX_ALREADY_EXISTS_ON_TCM_ON_AFTER_CERTIFICATION 13305
#define ER_GRP_RPL_FAILED_TO_INSERT_TRX_ON_TCM_ON_AFTER_CERTIFICATION 13306
#define ER_GRP_RPL_REGISTER_TRX_TO_WAIT_FOR_GROUP_PREPARE_FAILED 13307
#define ER_GRP_RPL_TRX_WAIT_FOR_GROUP_PREPARE_FAILED 13308
#define ER_GRP_RPL_TRX_DOES_NOT_EXIST_ON_TCM_ON_HANDLE_REMOTE_PREPARE 13309
#define ER_GRP_RPL_RELEASE_BEGIN_TRX_AFTER_DEPENDENCIES_COMMIT_FAILED 13310
#define ER_GRP_RPL_REGISTER_TRX_TO_WAIT_FOR_DEPENDENCIES_FAILED 13311
#define ER_GRP_RPL_WAIT_FOR_DEPENDENCIES_FAILED 13312
#define ER_GRP_RPL_REGISTER_TRX_TO_WAIT_FOR_SYNC_BEFORE_EXECUTION_FAILED 13313
#define ER_GRP_RPL_SEND_TRX_SYNC_BEFORE_EXECUTION_FAILED 13314
#define ER_GRP_RPL_TRX_WAIT_FOR_SYNC_BEFORE_EXECUTION_FAILED 13315
#define ER_GRP_RPL_RELEASE_BEGIN_TRX_AFTER_WAIT_FOR_SYNC_BEFORE_EXEC 13316
#define ER_GRP_RPL_TRX_WAIT_FOR_GROUP_GTID_EXECUTED 13317
//#define OBSOLETE_ER_UNIT_NOT_FOUND 13318
//#define OBSOLETE_ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT 13319
#define ER_WARN_PROPERTY_STRING_PARSE_FAILED 13320
#define ER_INVALID_PROPERTY_KEY 13321
#define ER_GRP_RPL_GTID_SET_EXTRACT_ERROR_DURING_RECOVERY 13322
#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_ENCRYPT 13323
#define ER_CANNOT_GET_SERVER_VERSION_FROM_TABLESPACE_HEADER 13324
#define ER_CANNOT_SET_SERVER_VERSION_IN_TABLESPACE_HEADER 13325
#define ER_SERVER_UPGRADE_VERSION_NOT_SUPPORTED 13326
#define ER_SERVER_UPGRADE_FROM_VERSION 13327
#define ER_GRP_RPL_ERROR_ON_CERT_DB_INSTALL 13328
#define ER_GRP_RPL_FORCE_MEMBERS_WHEN_LEAVING 13329
#define ER_TRG_WRONG_ORDER 13330
//#define OBSOLETE_ER_SECONDARY_ENGINE_PLUGIN 13331
#define ER_LDAP_AUTH_GRP_SEARCH_NOT_SPECIAL_HDL 13332
#define ER_LDAP_AUTH_GRP_USER_OBJECT_HAS_GROUP_INFO 13333
#define ER_LDAP_AUTH_GRP_INFO_FOUND_IN_MANY_OBJECTS 13334
#define ER_LDAP_AUTH_GRP_INCORRECT_ATTRIBUTE 13335
#define ER_LDAP_AUTH_GRP_NULL_ATTRIBUTE_VALUE 13336
#define ER_LDAP_AUTH_GRP_DN_PARSING_FAILED 13337
#define ER_LDAP_AUTH_GRP_OBJECT_HAS_USER_INFO 13338
#define ER_LDAP_AUTH_LDAPS 13339
#define ER_LDAP_MAPPING_GET_USER_PROXY 13340
#define ER_LDAP_MAPPING_USER_DONT_BELONG_GROUP 13341
#define ER_LDAP_MAPPING_INFO 13342
#define ER_LDAP_MAPPING_EMPTY_MAPPING 13343
#define ER_LDAP_MAPPING_PROCESS_MAPPING 13344
#define ER_LDAP_MAPPING_CHECK_DELIMI_QUOTE 13345
#define ER_LDAP_MAPPING_PROCESS_DELIMITER 13346
#define ER_LDAP_MAPPING_PROCESS_DELIMITER_EQUAL_NOT_FOUND 13347
#define ER_LDAP_MAPPING_PROCESS_DELIMITER_TRY_COMMA 13348
#define ER_LDAP_MAPPING_PROCESS_DELIMITER_COMMA_NOT_FOUND 13349
#define ER_LDAP_MAPPING_NO_SEPEARATOR_END_OF_GROUP 13350
#define ER_LDAP_MAPPING_GETTING_NEXT_MAPPING 13351
#define ER_LDAP_MAPPING_PARSING_CURRENT_STATE 13352
#define ER_LDAP_MAPPING_PARSING_MAPPING_INFO 13353
#define ER_LDAP_MAPPING_PARSING_ERROR 13354
#define ER_LDAP_MAPPING_TRIMMING_SPACES 13355
#define ER_LDAP_MAPPING_IS_QUOTE 13356
#define ER_LDAP_MAPPING_NON_DESIRED_STATE 13357
#define ER_INVALID_NAMED_PIPE_FULL_ACCESS_GROUP 13358
#define ER_PREPARE_FOR_SECONDARY_ENGINE 13359
#define ER_SERVER_WARN_DEPRECATED 13360
#define ER_AUTH_ID_WITH_SYSTEM_USER_PRIV_IN_MANDATORY_ROLES 13361
#define ER_SERVER_BINLOG_MASTER_KEY_RECOVERY_OUT_OF_COMBINATION 13362
#define ER_SERVER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_CLEANUP_AUX_KEY 13363
//#define OBSOLETE_ER_CANNOT_GRANT_SYSTEM_PRIV_TO_MANDATORY_ROLE 13364
//#define OBSOLETE_ER_PARTIAL_REVOKE_AND_DB_GRANT_BOTH_EXISTS 13365
//#define OBSOLETE_ER_DB_ACCESS_DENIED 13366
//#define OBSOLETE_ER_PARTIAL_REVOKES_EXIST 13367
#define ER_TURNING_ON_PARTIAL_REVOKES 13368
#define ER_WARN_PARTIAL_REVOKE_AND_DB_GRANT 13369
#define ER_WARN_INCORRECT_PRIVILEGE_FOR_DB_RESTRICTIONS 13370
#define ER_WARN_INVALID_DB_RESTRICTIONS 13371
#define ER_GRP_RPL_INVALID_COMMUNICATION_PROTOCOL 13372
#define ER_GRP_RPL_STARTED_AUTO_REJOIN 13373
#define ER_GRP_RPL_TIMEOUT_RECEIVED_VC_ON_REJOIN 13374
#define ER_GRP_RPL_FINISHED_AUTO_REJOIN 13375
#define ER_GRP_RPL_DEFAULT_TABLE_ENCRYPTION_DIFF_FROM_GRP 13376
#define ER_SERVER_UPGRADE_OFF 13377
#define ER_SERVER_UPGRADE_SKIP 13378
#define ER_SERVER_UPGRADE_PENDING 13379
#define ER_SERVER_UPGRADE_FAILED 13380
#define ER_SERVER_UPGRADE_STATUS 13381
#define ER_SERVER_UPGRADE_REPAIR_REQUIRED 13382
#define ER_SERVER_UPGRADE_REPAIR_STATUS 13383
#define ER_SERVER_UPGRADE_INFO_FILE 13384
#define ER_SERVER_UPGRADE_SYS_SCHEMA 13385
#define ER_SERVER_UPGRADE_MYSQL_TABLES 13386
#define ER_SERVER_UPGRADE_SYSTEM_TABLES 13387
#define ER_SERVER_UPGRADE_EMPTY_SYS 13388
#define ER_SERVER_UPGRADE_NO_SYS_VERSION 13389
#define ER_SERVER_UPGRADE_SYS_VERSION_EMPTY 13390
#define ER_SERVER_UPGRADE_SYS_SCHEMA_OUTDATED 13391
#define ER_SERVER_UPGRADE_SYS_SCHEMA_UP_TO_DATE 13392
#define ER_SERVER_UPGRADE_SYS_SCHEMA_OBJECT_COUNT 13393
#define ER_SERVER_UPGRADE_CHECKING_DB 13394
#define ER_IB_MSG_DDL_LOG_DELETE_BY_ID_TMCT 13395
#define ER_IB_MSG_POST_RECOVER_DDL_LOG_RECOVER 13396
#define ER_IB_MSG_POST_RECOVER_POST_TS_ENCRYPT 13397
#define ER_IB_MSG_DDL_LOG_FAIL_POST_DDL 13398
#define ER_SERVER_BINLOG_UNSAFE_SYSTEM_FUNCTION 13399
#define ER_SERVER_UPGRADE_HELP_TABLE_STATUS 13400
//#define OBSOLETE_ER_GRP_RPL_SRV_GTID_WAIT_ERROR 13401
//#define OBSOLETE_ER_GRP_DELAYED_VCLE_LOGGING 13402
//#define OBSOLETE_ER_CANNOT_GRANT_ROLES_TO_ANONYMOUS_USER 13403
#define ER_BINLOG_UNABLE_TO_ROTATE_GTID_TABLE_READONLY 13404
#define ER_NETWORK_NAMESPACES_NOT_SUPPORTED 13405
#define ER_UNKNOWN_NETWORK_NAMESPACE 13406
#define ER_NETWORK_NAMESPACE_NOT_ALLOWED_FOR_WILDCARD_ADDRESS 13407
#define ER_SETNS_FAILED 13408
#define ER_WILDCARD_NOT_ALLOWED_FOR_MULTIADDRESS_BIND 13409
#define ER_NETWORK_NAMESPACE_FILE_PATH_TOO_LONG 13410
#define ER_IB_MSG_TOO_LONG_PATH 13411
#define ER_IB_RECV_FIRST_REC_GROUP_INVALID 13412
#define ER_DD_UPGRADE_COMPLETED 13413
#define ER_SSL_SERVER_CERT_VERIFY_FAILED 13414
#define ER_PERSIST_OPTION_USER_TRUNCATED 13415
#define ER_PERSIST_OPTION_HOST_TRUNCATED 13416
#define ER_NET_WAIT_ERROR 13417
#define ER_IB_MSG_1285 13418
#define ER_IB_MSG_CLOCK_MONOTONIC_UNSUPPORTED 13419
#define ER_IB_MSG_CLOCK_GETTIME_FAILED 13420
#define ER_PLUGIN_NOT_EARLY_DUP 13421
#define ER_PLUGIN_NO_INSTALL_DUP 13422
//#define OBSOLETE_ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS 13423
//#define OBSOLETE_ER_WARN_DEPRECATED_FOUND_ROWS 13424
#define ER_BINLOG_UNSAFE_DEFAULT_EXPRESSION_IN_SUBSTATEMENT 13425
#define ER_GRP_RPL_MEMBER_VER_READ_COMPATIBLE 13426
#define ER_LOCK_ORDER_INIT_FAILED 13427
#define ER_AUDIT_LOG_KEYRING_ID_TIMESTAMP_VALUE_IS_INVALID 13428
#define ER_AUDIT_LOG_FILE_NAME_TIMESTAMP_VALUE_IS_MISSING_OR_INVALID 13429
#define ER_AUDIT_LOG_FILE_NAME_DOES_NOT_HAVE_REQUIRED_FORMAT 13430
#define ER_AUDIT_LOG_FILE_NAME_KEYRING_ID_VALUE_IS_MISSING 13431
#define ER_AUDIT_LOG_FILE_HAS_BEEN_SUCCESSFULLY_PROCESSED 13432
#define ER_AUDIT_LOG_COULD_NOT_OPEN_FILE_FOR_READING 13433
#define ER_AUDIT_LOG_INVALID_FILE_CONTENT 13434
#define ER_AUDIT_LOG_CANNOT_READ_PASSWORD 13435
#define ER_AUDIT_LOG_CANNOT_STORE_PASSWORD 13436
#define ER_AUDIT_LOG_CANNOT_REMOVE_PASSWORD 13437
#define ER_AUDIT_LOG_PASSWORD_HAS_BEEN_COPIED 13438
//#define OBSOLETE_ER_AUDIT_LOG_INSUFFICIENT_PRIVILEGE 13439
//#define OBSOLETE_ER_WRONG_MVI_VALUE 13440
//#define OBSOLETE_ER_WARN_FUNC_INDEX_NOT_APPLICABLE 13441
//#define OBSOLETE_ER_EXCEEDED_MV_KEYS_NUM 13442
//#define OBSOLETE_ER_EXCEEDED_MV_KEYS_SPACE 13443
//#define OBSOLETE_ER_FUNCTIONAL_INDEX_DATA_IS_TOO_LONG 13444
//#define OBSOLETE_ER_INVALID_JSON_VALUE_FOR_FUNC_INDEX 13445
//#define OBSOLETE_ER_JSON_VALUE_OUT_OF_RANGE_FOR_FUNC_INDEX 13446
#define ER_LDAP_EMPTY_USERDN_PASSWORD 13447
//#define OBSOLETE_ER_GROUPING_ON_TIMESTAMP_IN_DST 13448
#define ER_ACL_WRONG_OR_MISSING_ACL_TABLES_LOG 13449
#define ER_LOCK_ORDER_FAILED_WRITE_FILE 13450
#define ER_LOCK_ORDER_FAILED_READ_FILE 13451
#define ER_LOCK_ORDER_MESSAGE 13452
#define ER_LOCK_ORDER_DEPENDENCIES_SYNTAX 13453
#define ER_LOCK_ORDER_SCANNER_SYNTAX 13454
#define ER_DATA_DIRECTORY_UNUSABLE_DELETABLE 13455
#define ER_IB_MSG_BTREE_LEVEL_LIMIT_EXCEEDED 13456
#define ER_IB_CLONE_START_STOP 13457
#define ER_IB_CLONE_OPERATION 13458
#define ER_IB_CLONE_RESTART 13459
#define ER_IB_CLONE_USER_DATA 13460
#define ER_IB_CLONE_NON_INNODB_TABLE 13461
#define ER_CLONE_SHUTDOWN_TRACE 13462
#define ER_GRP_RPL_GTID_PURGED_EXTRACT_ERROR 13463
#define ER_GRP_RPL_CLONE_PROCESS_PREPARE_ERROR 13464
#define ER_GRP_RPL_CLONE_PROCESS_EXEC_ERROR 13465
#define ER_GRP_RPL_RECOVERY_EVAL_ERROR 13466
#define ER_GRP_RPL_NO_POSSIBLE_RECOVERY 13467
#define ER_GRP_RPL_CANT_KILL_THREAD 13468
#define ER_GRP_RPL_RECOVERY_STRAT_CLONE_THRESHOLD 13469
#define ER_GRP_RPL_RECOVERY_STRAT_CLONE_PURGED 13470
#define ER_GRP_RPL_RECOVERY_STRAT_CHOICE 13471
#define ER_GRP_RPL_RECOVERY_STRAT_FALLBACK 13472
#define ER_GRP_RPL_RECOVERY_STRAT_NO_FALLBACK 13473
#define ER_GRP_RPL_REPLICA_THREAD_ERROR_ON_CLONE 13474
#define ER_UNKNOWN_TABLE_IN_UPGRADE 13475
#define ER_IDENT_CAUSES_TOO_LONG_PATH_IN_UPGRADE 13476
#define ER_XA_CANT_CREATE_MDL_BACKUP 13477
#define ER_AUDIT_LOG_SUPER_PRIVILEGE_REQUIRED 13478
#define ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_TYPE 13479
#define ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT 13480
#define ER_AUDIT_LOG_HAS_NOT_BEEN_INSTALLED 13481
#define ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE 13482
#define ER_LOG_CANNOT_WRITE_EXTENDED 13483
//#define OBSOLETE_ER_UPGRADE_WITH_PARTITIONED_TABLES_REJECTED 13484
#define ER_KEYRING_AWS_INCORRECT_PROXY 13485
#define ER_GRP_RPL_SERVER_SET_TO_OFFLINE_MODE_DUE_TO_ERRORS 13486
#define ER_GRP_RPL_MESSAGE_SERVICE_FATAL_ERROR 13487
#define ER_WARN_WRONG_COMPRESSION_ALGORITHM_LOG 13488
#define ER_WARN_WRONG_COMPRESSION_LEVEL_LOG 13489
#define ER_PROTOCOL_COMPRESSION_RESET_LOG 13490
#define ER_XPLUGIN_COMPRESSION_ERROR 13491
#define ER_MYSQLBACKUP_MSG 13492
#define ER_WARN_UNKNOWN_KEYRING_AWS_REGION 13493
#define ER_WARN_LOG_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST 13494
#define ER_WARN_LOG_PRIVILEGE_CHECKS_USER_CORRUPT 13495
#define ER_WARN_LOG_PRIVILEGE_CHECKS_USER_NEEDS_RPL_APPLIER_PRIV 13496
#define ER_OBSOLETE_FILE_PRIVILEGE_FOR_REPLICATION_CHECKS 13497
#define ER_RPL_REPLICA_SQL_THREAD_STARTING_WITH_PRIVILEGE_CHECKS 13498
#define ER_AUDIT_LOG_CANNOT_GENERATE_PASSWORD 13499
#define ER_INIT_FAILED_TO_GENERATE_ROOT_PASSWORD 13500
#define ER_PLUGIN_LOAD_OPTIONS_IGNORED 13501
#define ER_WARN_AUTH_ID_WITH_SYSTEM_USER_PRIV_IN_MANDATORY_ROLES 13502
#define ER_IB_MSG_SKIP_HIDDEN_DIR 13503
#define ER_WARN_RPL_RECOVERY_NO_ROTATE_EVENT_FROM_SOURCE_EOF 13504
#define ER_IB_LOB_ROLLBACK_INDEX_LEN 13505
#define ER_CANT_PROCESS_EXPRESSION_FOR_GENERATED_COLUMN_TO_DD 13506
#define ER_RPL_REPLICA_QUEUE_EVENT_FAILED_INVALID_NON_ROW_FORMAT 13507
#define ER_OBSOLETE_REQUIRE_ROW_FORMAT_VIOLATION 13508
#define ER_LOG_PRIV_CHECKS_REQUIRE_ROW_FORMAT_NOT_SET 13509
#define ER_RPL_REPLICA_SQL_THREAD_DETECTED_UNEXPECTED_EVENT_SEQUENCE 13510
#define ER_IB_MSG_UPGRADE_PARTITION_FILE 13511
#define ER_IB_MSG_DOWNGRADE_PARTITION_FILE 13512
#define ER_IB_MSG_UPGRADE_PARTITION_FILE_IMPORT 13513
#define ER_IB_WARN_OPEN_PARTITION_FILE 13514
#define ER_IB_MSG_FIL_STATE_MOVED_CORRECTED 13515
#define ER_IB_MSG_FIL_STATE_MOVED_CHANGED_PATH 13516
#define ER_IB_MSG_FIL_STATE_MOVED_CHANGED_NAME 13517
#define ER_IB_MSG_FIL_STATE_MOVED_TOO_MANY 13518
#define ER_GR_ELECTED_PRIMARY_GTID_INFORMATION 13519
#define ER_SCHEMA_NAME_IN_UPPER_CASE_NOT_ALLOWED 13520
#define ER_TABLE_NAME_IN_UPPER_CASE_NOT_ALLOWED 13521
#define ER_SCHEMA_NAME_IN_UPPER_CASE_NOT_ALLOWED_FOR_FK 13522
#define ER_TABLE_NAME_IN_UPPER_CASE_NOT_ALLOWED_FOR_FK 13523
#define ER_IB_MSG_DICT_PARTITION_NOT_FOUND 13524
#define ER_ACCESS_DENIED_FOR_USER_ACCOUNT_BLOCKED_BY_PASSWORD_LOCK 13525
#define ER_INNODB_OUT_OF_RESOURCES 13526
#define ER_DD_UPGRADE_FOUND_PREPARED_XA_TRANSACTION 13527
#define ER_MIGRATE_TABLE_TO_DD_OOM 13528
#define ER_RPL_RELAY_LOG_RECOVERY_INFO_AFTER_CLONE 13529
#define ER_IB_MSG_57_UNDO_SPACE_DELETE_FAIL 13530
#define ER_IB_MSG_DBLWR_1285 13531
#define ER_IB_MSG_DBLWR_1286 13532
#define ER_IB_MSG_DBLWR_1287 13533
#define ER_IB_MSG_DBLWR_1288 13534
#define ER_IB_MSG_DBLWR_1290 13535
#define ER_IB_MSG_BAD_DBLWR_FILE_NAME 13536
//#define OBSOLETE_ER_IB_MSG_DBLWR_1292 13537
#define ER_IB_MSG_DBLWR_1293 13538
#define ER_IB_MSG_DBLWR_1294 13539
#define ER_IB_MSG_DBLWR_1295 13540
#define ER_IB_MSG_DBLWR_1296 13541
#define ER_IB_MSG_DBLWR_1297 13542
#define ER_IB_MSG_DBLWR_1298 13543
#define ER_IB_MSG_DBLWR_1300 13544
#define ER_IB_MSG_DBLWR_1301 13545
#define ER_IB_MSG_DBLWR_1304 13546
#define ER_IB_MSG_DBLWR_1305 13547
#define ER_IB_MSG_DBLWR_1306 13548
#define ER_IB_MSG_DBLWR_1307 13549
#define ER_IB_MSG_DBLWR_1308 13550
#define ER_IB_MSG_DBLWR_1309 13551
#define ER_IB_MSG_DBLWR_1310 13552
#define ER_IB_MSG_DBLWR_1311 13553
#define ER_IB_MSG_DBLWR_1312 13554
#define ER_IB_MSG_DBLWR_1313 13555
#define ER_IB_MSG_DBLWR_1314 13556
#define ER_IB_MSG_DBLWR_1315 13557
#define ER_IB_MSG_DBLWR_1316 13558
#define ER_IB_MSG_DBLWR_1317 13559
#define ER_IB_MSG_DBLWR_1318 13560
#define ER_IB_MSG_DBLWR_1319 13561
#define ER_IB_MSG_DBLWR_1320 13562
#define ER_IB_MSG_DBLWR_1321 13563
#define ER_IB_MSG_DBLWR_1322 13564
#define ER_IB_MSG_DBLWR_1323 13565
#define ER_IB_MSG_DBLWR_1324 13566
#define ER_IB_MSG_DBLWR_1325 13567
#define ER_IB_MSG_DBLWR_1326 13568
#define ER_IB_MSG_DBLWR_1327 13569
#define ER_IB_MSG_GTID_FLUSH_AT_SHUTDOWN 13570
#define ER_IB_MSG_57_STAT_SPACE_DELETE_FAIL 13571
#define ER_NDBINFO_UPGRADING_SCHEMA 13572
#define ER_NDBINFO_NOT_UPGRADING_SCHEMA 13573
#define ER_NDBINFO_UPGRADING_SCHEMA_FAIL 13574
//#define OBSOLETE_ER_IB_MSG_CREATE_LOG_FILE 13575
#define ER_IB_MSG_INNODB_START_INITIALIZE 13576
#define ER_IB_MSG_INNODB_END_INITIALIZE 13577
#define ER_IB_MSG_PAGE_ARCH_NO_RESET_POINTS 13578
#define ER_IB_WRN_PAGE_ARCH_FLUSH_DATA 13579
#define ER_IB_ERR_PAGE_ARCH_INVALID_DOUBLE_WRITE_BUF 13580
#define ER_IB_ERR_PAGE_ARCH_RECOVERY_FAILED 13581
#define ER_IB_ERR_PAGE_ARCH_INVALID_FORMAT 13582
#define ER_INVALID_XPLUGIN_SOCKET_SAME_AS_SERVER 13583
#define ER_INNODB_UNABLE_TO_ACQUIRE_DD_OBJECT 13584
#define ER_WARN_LOG_DEPRECATED_PARTITION_PREFIX_KEY 13585
#define ER_IB_MSG_UNDO_TRUNCATE_TOO_OFTEN 13586
#define ER_GRP_RPL_IS_STARTING 13587
#define ER_IB_MSG_INVALID_LOCATION_FOR_TABLESPACE 13588
#define ER_IB_MSG_INVALID_LOCATION_WRONG_DB 13589
#define ER_IB_MSG_CANNOT_FIND_DD_UNDO_SPACE 13590
#define ER_GRP_RPL_RECOVERY_ENDPOINT_FORMAT 13591
#define ER_GRP_RPL_RECOVERY_ENDPOINT_INVALID 13592
#define ER_GRP_RPL_RECOVERY_ENDPOINT_INVALID_DONOR_ENDPOINT 13593
#define ER_GRP_RPL_RECOVERY_ENDPOINT_INTERFACES_IPS 13594
#define ER_WARN_TLS_CHANNEL_INITIALIZATION_ERROR 13595
#define ER_XPLUGIN_FAILED_TO_VALIDATE_ADDRESS 13596
#define ER_XPLUGIN_FAILED_TO_BIND_INTERFACE_ADDRESS 13597
#define ER_IB_ERR_RECOVERY_REDO_DISABLED 13598
#define ER_IB_WRN_FAST_SHUTDOWN_REDO_DISABLED 13599
#define ER_IB_WRN_REDO_DISABLED 13600
#define ER_IB_WRN_REDO_ENABLED 13601
#define ER_TLS_CONFIGURED_FOR_CHANNEL 13602
#define ER_TLS_CONFIGURATION_REUSED 13603
#define ER_IB_TABLESPACE_PATH_VALIDATION_SKIPPED 13604
#define ER_IB_CANNOT_UPGRADE_WITH_DISCARDED_TABLESPACES 13605
#define ER_USERNAME_TRUNKATED 13606
#define ER_HOSTNAME_TRUNKATED 13607
#define ER_IB_MSG_TRX_RECOVERY_ROLLBACK_NOT_COMPLETED 13608
#define ER_AUTHCACHE_ROLE_EDGES_IGNORED_EMPTY_NAME 13609
#define ER_AUTHCACHE_ROLE_EDGES_UNKNOWN_AUTHORIZATION_ID 13610
#define ER_AUTHCACHE_DEFAULT_ROLES_IGNORED_EMPTY_NAME 13611
#define ER_AUTHCACHE_DEFAULT_ROLES_UNKNOWN_AUTHORIZATION_ID 13612
#define ER_IB_ERR_DDL_LOG_INSERT_FAILURE 13613
#define ER_IB_LOCK_VALIDATE_LATCH_ORDER_VIOLATION 13614
#define ER_IB_RELOCK_LATCH_ORDER_VIOLATION 13615
//#define OBSOLETE_ER_IB_MSG_1352 13616
//#define OBSOLETE_ER_IB_MSG_1353 13617
//#define OBSOLETE_ER_IB_MSG_1354 13618
//#define OBSOLETE_ER_IB_MSG_1355 13619
//#define OBSOLETE_ER_IB_MSG_1356 13620
#define ER_IB_MSG_1357 13621
#define ER_IB_MSG_1358 13622
#define ER_IB_MSG_1359 13623
#define ER_IB_FAILED_TO_DELETE_TABLESPACE_FILE 13624
#define ER_IB_UNABLE_TO_EXPAND_TEMPORARY_TABLESPACE_POOL 13625
#define ER_IB_TMP_TABLESPACE_CANNOT_CREATE_DIRECTORY 13626
#define ER_IB_MSG_SCANNING_TEMP_TABLESPACE_DIR 13627
#define ER_IB_ERR_TEMP_TABLESPACE_DIR_DOESNT_EXIST 13628
#define ER_IB_ERR_TEMP_TABLESPACE_DIR_EMPTY 13629
#define ER_IB_ERR_TEMP_TABLESPACE_DIR_CONTAINS_SEMICOLON 13630
#define ER_IB_ERR_TEMP_TABLESPACE_DIR_SUBDIR_OF_DATADIR 13631
#define ER_IB_ERR_SCHED_SETAFFNINITY_FAILED 13632
#define ER_IB_ERR_UNKNOWN_PAGE_FETCH_MODE 13633
#define ER_IB_ERR_LOG_PARSING_BUFFER_OVERFLOW 13634
#define ER_IB_ERR_NOT_ENOUGH_MEMORY_FOR_PARSE_BUFFER 13635
#define ER_IB_MSG_1372 13636
#define ER_IB_MSG_1373 13637
#define ER_IB_MSG_1374 13638
#define ER_IB_MSG_1375 13639
#define ER_IB_ERR_ZLIB_UNCOMPRESS_FAILED 13640
#define ER_IB_ERR_ZLIB_BUF_ERROR 13641
#define ER_IB_ERR_ZLIB_MEM_ERROR 13642
#define ER_IB_ERR_ZLIB_DATA_ERROR 13643
#define ER_IB_ERR_ZLIB_UNKNOWN_ERROR 13644
#define ER_IB_MSG_1381 13645
#define ER_IB_ERR_INDEX_RECORDS_WRONG_ORDER 13646
#define ER_IB_ERR_INDEX_DUPLICATE_KEY 13647
#define ER_IB_ERR_FOUND_N_DUPLICATE_KEYS 13648
#define ER_IB_ERR_FOUND_N_RECORDS_WRONG_ORDER 13649
#define ER_IB_ERR_PARALLEL_READ_OOM 13650
#define ER_IB_MSG_UNDO_MARKED_ACTIVE 13651
#define ER_IB_MSG_UNDO_ALTERED_ACTIVE 13652
#define ER_IB_MSG_UNDO_ALTERED_INACTIVE 13653
#define ER_IB_MSG_UNDO_MARKED_EMPTY 13654
#define ER_IB_MSG_UNDO_TRUNCATE_DELAY_BY_CLONE 13655
#define ER_IB_MSG_UNDO_TRUNCATE_DELAY_BY_MDL 13656
#define ER_IB_MSG_INJECT_CRASH 13657
#define ER_IB_MSG_INJECT_FAILURE 13658
#define ER_GRP_RPL_TIMEOUT_RECEIVED_VC_LEAVE_ON_REJOIN 13659
#define ER_RPL_ASYNC_RECONNECT_FAIL_NO_SOURCE 13660
#define ER_UDF_REGISTER_SERVICE_ERROR 13661
#define ER_UDF_REGISTER_ERROR 13662
#define ER_UDF_UNREGISTER_ERROR 13663
#define ER_EMPTY_PRIVILEGE_NAME_IGNORED 13664
#define ER_IB_MSG_INCORRECT_SIZE 13665
#define ER_TMPDIR_PATH_TOO_LONG 13666
#define ER_ERROR_LOG_DESTINATION_NOT_A_FILE 13667
#define ER_NO_ERROR_LOG_PARSER_CONFIGURED 13668
#define ER_UPGRADE_NONEXISTENT_SCHEMA 13669
#define ER_IB_MSG_CREATED_UNDO_SPACE 13670
#define ER_IB_MSG_DROPPED_UNDO_SPACE 13671
#define ER_IB_MSG_MASTER_KEY_ROTATED 13672
#define ER_IB_DBLWR_DECOMPRESS_FAILED 13673
#define ER_IB_DBLWR_DECRYPT_FAILED 13674
#define ER_IB_DBLWR_KEY_MISSING 13675
#define ER_INNODB_IO_WRITE_ERROR_RETRYING 13676
#define ER_INNODB_IO_WRITE_FAILED 13677
#define ER_LOG_COMPONENT_CANNOT_INIT 13678
#define ER_RPL_ASYNC_CHANNEL_CANT_CONNECT 13679
#define ER_RPL_ASYNC_SENDER_ADDED 13680
#define ER_RPL_ASYNC_SENDER_REMOVED 13681
#define ER_RPL_ASYNC_CHANNEL_STOPPED_QUORUM_LOST 13682
#define ER_RPL_ASYNC_CHANNEL_CANT_CONNECT_NO_QUORUM 13683
#define ER_RPL_ASYNC_EXECUTING_QUERY 13684
#define ER_RPL_REPLICA_MONITOR_IO_THREAD_EXITING 13685
#define ER_RPL_ASYNC_MANAGED_NAME_REMOVED 13686
#define ER_RPL_ASYNC_MANAGED_NAME_ADDED 13687
#define ER_RPL_ASYNC_READ_FAILOVER_TABLE 13688
#define ER_RPL_REPLICA_MONITOR_IO_THREAD_RECONNECT_CHANNEL 13689
#define ER_REPLICA_ANON_TO_GTID_IS_LOCAL_OR_UUID_AND_GTID_MODE_NOT_ON 13690
#define ER_REPLICA_ANONYMOUS_TO_GTID_UUID_SAME_AS_GROUP_NAME 13691
#define ER_GRP_RPL_GRP_NAME_IS_SAME_AS_ANONYMOUS_TO_GTID_UUID 13692
#define ER_WARN_GTID_THRESHOLD_BREACH 13693
#define ER_HEALTH_INFO 13694
#define ER_HEALTH_WARNING 13695
#define ER_HEALTH_ERROR 13696
#define ER_HEALTH_WARNING_DISK_USAGE_LEVEL_1 13697
#define ER_HEALTH_WARNING_DISK_USAGE_LEVEL_2 13698
#define ER_HEALTH_WARNING_DISK_USAGE_LEVEL_3 13699
#define ER_IB_INNODB_TBSP_OUT_OF_SPACE 13700
#define ER_GRP_RPL_APPLIER_CHANNEL_STILL_RUNNING 13701
#define ER_RPL_ASYNC_RECONNECT_GTID_MODE_OFF_CHANNEL 13702
#define ER_FIREWALL_SERVICES_NOT_ACQUIRED 13703
#define ER_FIREWALL_UDF_REGISTER_FAILED 13704
#define ER_FIREWALL_PFS_TABLE_REGISTER_FAILED 13705
#define ER_IB_MSG_STATS_SAMPLING_TOO_LARGE 13706
#define ER_AUDIT_LOG_FILE_PRUNE_FAILED 13707
#define ER_AUDIT_LOG_FILE_AUTO_PRUNED 13708
#define ER_COMPONENTS_INFRASTRUCTURE_MANIFEST_INIT 13709
#define ER_COMPONENTS_INFRASTRUCTURE_MANIFEST_DEINIT 13710
#define ER_WARN_COMPONENTS_INFRASTRUCTURE_MANIFEST_NOT_RO 13711
#define ER_WARN_NO_KEYRING_COMPONENT_SERVICE_FOUND 13712
#define ER_NOTE_KEYRING_COMPONENT_INITIALIZED 13713
#define ER_KEYRING_COMPONENT_NOT_INITIALIZED 13714
#define ER_KEYRING_COMPONENT_EXCEPTION 13715
#define ER_KEYRING_COMPONENT_MEMORY_ALLOCATION_ERROR 13716
#define ER_NOTE_KEYRING_COMPONENT_AES_INVALID_MODE_BLOCK_SIZE 13717
#define ER_NOTE_KEYRING_COMPONENT_AES_DATA_IDENTIFIER_EMPTY 13718
#define ER_NOTE_KEYRING_COMPONENT_AES_INVALID_KEY 13719
#define ER_NOTE_KEYRING_COMPONENT_AES_OPERATION_ERROR 13720
#define ER_NOTE_KEYRING_COMPONENT_READ_DATA_NOT_FOUND 13721
#define ER_NOTE_KEYRING_COMPONENT_WRITE_MAXIMUM_DATA_LENGTH 13722
#define ER_NOTE_KEYRING_COMPONENT_STORE_FAILED 13723
#define ER_NOTE_KEYRING_COMPONENT_REMOVE_FAILED 13724
#define ER_NOTE_KEYRING_COMPONENT_GENERATE_FAILED 13725
#define ER_NOTE_KEYRING_COMPONENT_KEYS_METADATA_ITERATOR_FETCH_FAILED 13726
#define ER_NOTE_KEYRING_COMPONENT_METADATA_ITERATOR_INVALID_OUT_PARAM 13727
#define ER_IB_WRN_FAILED_TO_ACQUIRE_SERVICE 13728
#define ER_IB_WRN_OLD_GEOMETRY_TYPE 13729
#define ER_NET_WAIT_ERROR2 13730
#define ER_GRP_RPL_MEMBER_ACTION_TRIGGERED 13731
#define ER_GRP_RPL_MEMBER_ACTION_FAILURE_IGNORE 13732
#define ER_GRP_RPL_MEMBER_ACTION_FAILURE 13733
#define ER_GRP_RPL_MEMBER_ACTION_PARSE_ON_RECEIVE 13734
#define ER_GRP_RPL_MEMBER_ACTION_UPDATE_ACTIONS 13735
#define ER_GRP_RPL_MEMBER_ACTION_GET_EXCHANGEABLE_DATA 13736
#define ER_GRP_RPL_MEMBER_ACTION_DEFAULT_CONFIGURATION 13737
#define ER_GRP_RPL_MEMBER_ACTION_UNABLE_TO_SET_DEFAULT_CONFIGURATION 13738
#define ER_GRP_RPL_MEMBER_ACTION_PARSE_ON_MEMBER_JOIN 13739
#define ER_GRP_RPL_MEMBER_ACTION_UPDATE_ACTIONS_ON_MEMBER_JOIN 13740
#define ER_GRP_RPL_MEMBER_ACTION_INVALID_ACTIONS_ON_MEMBER_JOIN 13741
#define ER_GRP_RPL_MEMBER_ACTION_ENABLED 13742
#define ER_GRP_RPL_MEMBER_ACTION_DISABLED 13743
#define ER_GRP_RPL_MEMBER_ACTIONS_RESET 13744
//#define OBSOLETE_ER_DEPRECATED_TLS_VERSION_SESSION 13745
//#define OBSOLETE_ER_WARN_DEPRECATED_TLS_VERSION_FOR_CHANNEL 13746
#define ER_FIREWALL_DEPRECATED_USER_PROFILE 13747
#define ER_GRP_RPL_VIEW_CHANGE_UUID_INVALID 13748
#define ER_GRP_RPL_VIEW_CHANGE_UUID_SAME_AS_GROUP_NAME 13749
#define ER_GRP_RPL_GROUP_NAME_SAME_AS_VIEW_CHANGE_UUID 13750
#define ER_GRP_RPL_VIEW_CHANGE_UUID_IS_SAME_AS_ANONYMOUS_TO_GTID_UUID 13751
#define ER_GRP_RPL_GRP_VIEW_CHANGE_UUID_IS_INCOMPATIBLE_WITH_SERVER_UUID 13752
#define ER_GRP_RPL_VIEW_CHANGE_UUID_DIFF_FROM_GRP 13753
#define ER_WARN_REPLICA_ANONYMOUS_TO_GTID_UUID_SAME_AS_VIEW_CHANGE_UUID 13754
#define ER_GRP_RPL_FAILED_TO_PARSE_THE_VIEW_CHANGE_UUID 13755
#define ER_GRP_RPL_FAILED_TO_GENERATE_SIDNO_FOR_VIEW_CHANGE_UUID 13756
#define ER_GRP_RPL_VIEW_CHANGE_UUID_PARSE_ERROR 13757
#define ER_GRP_RPL_UPDATE_GRPGTID_VIEW_CHANGE_UUID_EXECUTED_ERROR 13758
#define ER_GRP_RPL_ADD_VIEW_CHANGE_UUID_TO_GRP_SID_MAP_ERROR 13759
#define ER_GRP_RPL_DONOR_VIEW_CHANGE_UUID_TRANS_INFO_ERROR 13760
#define ER_WARN_GRP_RPL_VIEW_CHANGE_UUID_FAIL_GET_VARIABLE 13761
#define ER_WARN_ADUIT_LOG_MAX_SIZE_AND_PRUNE_SECONDS_LOG 13762
#define ER_WARN_ADUIT_LOG_MAX_SIZE_CLOSE_TO_ROTATE_ON_SIZE_LOG 13763
#define ER_PLUGIN_INVALID_TABLE_DEFINITION 13764
#define ER_AUTH_KERBEROS_LOGGER_GENERIC_MSG 13765
#define ER_INSTALL_PLUGIN_CONFLICT_LOG 13766
#define ER_DEPRECATED_PERSISTED_VARIABLE_WITH_ALIAS 13767
#define ER_LOG_COMPONENT_FLUSH_FAILED 13768
#define ER_IB_MSG_REENCRYPTED_TABLESPACE_KEY 13769
#define ER_IB_MSG_REENCRYPTED_GENERAL_TABLESPACE_KEY 13770
#define ER_IB_ERR_PAGE_ARCH_DBLWR_INIT_FAILED 13771
#define ER_IB_MSG_RECOVERY_NO_SPACE_IN_REDO_LOG__SKIP_IBUF_MERGES 13772
#define ER_IB_MSG_RECOVERY_NO_SPACE_IN_REDO_LOG__UNEXPECTED 13773
#define ER_WARN_AUDIT_LOG_FORMAT_UNIX_TIMESTAMP_ONLY_WHEN_JSON_LOG 13774
#define ER_PREPARE_FOR_PRIMARY_ENGINE 13775
#define ER_IB_MSG_PAR_RSEG_INIT_COMPLETE_MSG 13776
#define ER_IB_MSG_PAR_RSEG_INIT_TIME_MSG 13777
#define ER_DDL_MSG_1 13778
#define ER_MTR_MSG_1 13779
#define ER_GRP_RPL_MYSQL_NETWORK_PROVIDER_CLIENT_ERROR_CONN_ERR 13780
#define ER_GRP_RPL_MYSQL_NETWORK_PROVIDER_CLIENT_ERROR_COMMAND_ERR 13781
#define ER_GRP_RPL_FAILOVER_CONF_GET_EXCHANGEABLE_DATA 13782
#define ER_GRP_RPL_FAILOVER_CONF_DEFAULT_CONFIGURATION 13783
#define ER_GRP_RPL_FAILOVER_CONF_UNABLE_TO_SET_DEFAULT_CONFIGURATION 13784
#define ER_GRP_RPL_FAILOVER_CONF_PARSE_ON_MEMBER_JOIN 13785
#define ER_GRP_RPL_FAILOVER_CONF_CHANNEL_DOES_NOT_EXIST 13786
#define ER_GRP_RPL_FAILOVER_REGISTER_MESSAGE_LISTENER_SERVICE 13787
#define ER_GRP_RPL_FAILOVER_PRIMARY_WITHOUT_MAJORITY 13788
#define ER_GRP_RPL_FAILOVER_PRIMARY_BACK_TO_MAJORITY 13789
#define ER_RPL_INCREMENTING_MEMBER_ACTION_VERSION 13790
#define ER_GRP_RPL_REPLICA_THREAD_ERROR_ON_SECONDARY_MEMBER 13791
#define ER_IB_MSG_CLONE_DDL_NTFN 13792
#define ER_IB_MSG_CLONE_DDL_APPLY 13793
#define ER_IB_MSG_CLONE_DDL_INVALIDATE 13794
#define ER_IB_MSG_UNDO_ENCRYPTION_INFO_LOADED 13795
#define ER_IB_WRN_ENCRYPTION_INFO_SIZE_MISMATCH 13796
#define ER_INVALID_AUTHENTICATION_POLICY 13797
#define ER_AUTHENTICATION_PLUGIN_REGISTRATION_FAILED 13798
#define ER_AUTHENTICATION_PLUGIN_REGISTRATION_INSUFFICIENT_BUFFER 13799
#define ER_AUTHENTICATION_PLUGIN_AUTH_DATA_CORRUPT 13800
#define ER_AUTHENTICATION_PLUGIN_SIGNATURE_CORRUPT 13801
#define ER_AUTHENTICATION_PLUGIN_VERIFY_SIGNATURE_FAILED 13802
#define ER_AUTHENTICATION_PLUGIN_OOM 13803
#define ER_AUTHENTICATION_PLUGIN_LOG 13804
#define ER_WARN_REPLICA_GTID_ONLY_AND_GTID_MODE_NOT_ON 13805
#define ER_WARN_L_DISABLE_GTID_ONLY_WITH_SOURCE_AUTO_POS_INVALID_POS 13806
#define ER_RPL_CANNOT_OPEN_RELAY_LOG 13807
#define ER_AUTHENTICATION_OCI_PLUGIN_NOT_INITIALIZED 13808
#define ER_AUTHENTICATION_OCI_PRIVATE_KEY_ERROR 13809
#define ER_AUTHENTICATION_OCI_DOWNLOAD_PUBLIC_KEY 13810
#define ER_AUTHENTICATION_OCI_IMDS 13811
#define ER_AUTHENTICATION_OCI_IAM 13812
#define ER_AUTHENTICATION_OCI_INVALID_AUTHENTICATION_STRING 13813
#define ER_AUTHENTICATION_OCI_NO_MATCHING_GROUPS 13814
#define ER_AUTHENTICATION_OCI_NO_GROUPS_FOUND 13815
#define ER_AUTHENTICATION_OCI_NONCE 13816
#define ER_HEALTH_WARNING_MEMORY_USAGE_LEVEL_1 13817
#define ER_HEALTH_WARNING_MEMORY_USAGE_LEVEL_2 13818
#define ER_HEALTH_WARNING_MEMORY_USAGE_LEVEL_3 13819
#define ER_GRP_RPL_SET_SINGLE_CONSENSUS_LEADER 13820
#define ER_GRP_RPL_ERROR_SET_SINGLE_CONSENSUS_LEADER 13821
#define ER_GRP_RPL_SET_MULTI_CONSENSUS_LEADER 13822
#define ER_GRP_RPL_ERROR_SET_MULTI_CONSENSUS_LEADER 13823
#define ER_GRP_RPL_PAXOS_SINGLE_LEADER_DIFF_FROM_GRP 13824
#define ER_MFA_USER_ATTRIBUTES_CORRUPT 13825
#define ER_MFA_PLUGIN_NOT_LOADED 13826
#define ER_WARN_DEPRECATED_CHARSET_OPTION 13827
#define ER_WARN_DEPRECATED_COLLATION_OPTION 13828
#define ER_REGEXP_MISSING_ICU_DATADIR 13829
#define ER_IB_WARN_MANY_NON_LRU_FILES_OPENED 13830
#define ER_IB_MSG_TRYING_TO_OPEN_FILE_FOR_LONG_TIME 13831
#define ER_GLOBAL_CONN_LIMIT 13832
#define ER_CONN_LIMIT 13833
#define ER_WARN_AUDIT_LOG_DISABLED 13834
#define ER_INVALID_TLS_VERSION 13835
#define ER_RPL_RELAY_LOG_RECOVERY_GTID_ONLY 13836
#define ER_KEYRING_OKV_STANDBY_SERVER_COUNT_EXCEEDED 13837
#define ER_WARN_MIGRATION_EMPTY_SOURCE_KEYRING 13838
#define ER_WARN_CANNOT_PERSIST_SENSITIVE_VARIABLES 13839
#define ER_CANNOT_INTERPRET_PERSISTED_SENSITIVE_VARIABLES 13840
#define ER_PERSISTED_VARIABLES_KEYRING_SUPPORT_REQUIRED 13841
#define ER_PERSISTED_VARIABLES_MASTER_KEY_NOT_FOUND 13842
#define ER_PERSISTED_VARIABLES_MASTER_KEY_CANNOT_BE_GENERATED 13843
#define ER_PERSISTED_VARIABLES_ENCRYPTION_FAILED 13844
#define ER_PERSISTED_VARIABLES_DECRYPTION_FAILED 13845
#define ER_PERSISTED_VARIABLES_LACK_KEYRING_SUPPORT 13846
#define ER_MY_MALLOC_USING_JEMALLOC 13847
#define ER_MY_MALLOC_USING_STD_MALLOC 13848
#define ER_MY_MALLOC_LOADLIBRARY_FAILED 13849
#define ER_MY_MALLOC_GETPROCADDRESS_FAILED 13850
#define ER_ACCOUNT_WITH_EXPIRED_PASSWORD 13851
#define ER_THREAD_POOL_PLUGIN_STARTED 13852
#define ER_THREAD_POOL_DEDICATED_LISTENERS_INVALID 13853
#define ER_IB_DBLWR_BYTES_INFO 13854
#define ER_IB_RDBLWR_BYTES_INFO 13855
#define ER_IB_MSG_LOG_FILE_IS_EMPTY 13856
#define ER_IB_MSG_LOG_FILE_TOO_SMALL 13857
#define ER_IB_MSG_LOG_FILE_TOO_BIG 13858
#define ER_IB_MSG_LOG_FILE_HEADER_READ_FAILED 13859
#define ER_IB_MSG_LOG_INIT_DIR_NOT_EMPTY_WONT_INITIALIZE 13860
#define ER_IB_MSG_LOG_INIT_DIR_LIST_FAILED 13861
#define ER_IB_MSG_LOG_INIT_DIR_MISSING_SUBDIR 13862
#define ER_IB_MSG_LOG_FILES_CREATED_BY_CLONE_AND_READ_ONLY_MODE 13863
#define ER_IB_MSG_LOG_WRITER_WRITE_FAILED 13864
#define ER_IB_MSG_LOG_WRITER_WAIT_ON_NEW_LOG_FILE 13865
#define ER_IB_MSG_RECOVERY_CHECKPOINT_OUTSIDE_LOG_FILE 13866
#define ER_IB_MSG_LOG_WRITER_ENTERED_EXTRA_MARGIN 13867
#define ER_IB_MSG_LOG_WRITER_EXITED_EXTRA_MARGIN 13868
#define ER_IB_MSG_LOG_PARAMS_FILE_SIZE_UNUSED 13869
#define ER_IB_MSG_LOG_PARAMS_N_FILES_UNUSED 13870
#define ER_IB_MSG_LOG_UPGRADE_FORCED_RECV 13871
#define ER_IB_MSG_LOG_UPGRADE_IN_READ_ONLY_MODE 13872
#define ER_IB_MSG_LOG_UPGRADE_CLONED_DB 13873
#define ER_IB_MSG_LOG_UPGRADE_UNINITIALIZED_FILES 13874
#define ER_IB_MSG_LOG_UPGRADE_CORRUPTION__UNEXPECTED 13875
//#define OBSOLETE_ER_IB_MSG_LOG_UPGRADE_NON_PERSISTED_DD_METADATA 13876
//#define OBSOLETE_ER_IB_MSG_LOG_UPGRADE_FLUSH_FAILED__UNEXPECTED 13877
//#define OBSOLETE_ER_IB_MSG_LOG_FILES_RESIZE_ON_START_FAILED__UNEXPECTED 13878
#define ER_IB_MSG_LOG_FILE_FOREIGN_UUID 13879
#define ER_IB_MSG_LOG_FILE_INVALID_START_LSN 13880
#define ER_IB_MSG_LOG_FILE_INVALID_LSN_RANGES 13881
#define ER_IB_MSG_LOG_FILE_MISSING_FOR_ID 13882
#define ER_IB_MSG_LOG_CHECKPOINT_FOUND 13883
#define ER_IB_MSG_LOG_FILES_CAPACITY_CHANGED 13884
#define ER_IB_MSG_LOG_FILES_RESIZE_REQUESTED 13885
#define ER_IB_MSG_LOG_FILES_RESIZE_CANCELLED 13886
#define ER_IB_MSG_LOG_FILES_RESIZE_FINISHED 13887
#define ER_IB_MSG_LOG_FILES_UPGRADE 13888
#define ER_IB_MSG_LOG_FILE_MARK_CURRENT_AS_INCOMPLETE 13889
#define ER_IB_MSG_LOG_FILE_REMOVE_FAILED 13890
#define ER_IB_MSG_LOG_FILE_RENAME_ON_CREATE_FAILED 13891
#define ER_IB_MSG_LOG_FILES_CREATED_BY_UNKNOWN_CREATOR 13892
#define ER_IB_MSG_LOG_FILES_FOUND_MISSING 13893
#define ER_IB_MSG_LOG_FILE_FORMAT_TOO_NEW 13894
#define ER_IB_MSG_LOG_FILE_FORMAT_TOO_OLD 13895
#define ER_IB_MSG_LOG_FILE_DIFFERENT_FORMATS 13896
#define ER_IB_MSG_LOG_PRE_8_0_30_MISSING_FILE0 13897
#define ER_IB_MSG_LOG_PFS_ACQUIRE_SERVICES_FAILED 13898
#define ER_IB_MSG_LOG_PFS_CREATE_TABLES_FAILED 13899
#define ER_IB_MSG_LOG_FILE_TRUNCATE 13900
#define ER_IB_MSG_LOG_FILE_UNUSED_RESIZE_FAILED 13901
#define ER_IB_MSG_LOG_FILE_UNUSED_REMOVE_FAILED 13902
#define ER_IB_MSG_LOG_FILE_UNUSED_RENAME_FAILED 13903
#define ER_IB_MSG_LOG_FILE_UNUSED_MARK_AS_IN_USE_FAILED 13904
#define ER_IB_MSG_LOG_FILE_MARK_AS_UNUSED_FAILED 13905
#define ER_IB_MSG_LOG_PARAMS_DEDICATED_SERVER_IGNORED 13906
#define ER_IB_MSG_LOG_PARAMS_LEGACY_USAGE 13907
#define ER_GRP_RPL_FAILED_TO_LOG_VIEW_CHANGE 13908
#define ER_BINLOG_CRASH_RECOVERY_MALFORMED_LOG 13909
#define ER_BINLOG_CRASH_RECOVERY_ERROR_RETURNED_SE 13910
#define ER_BINLOG_CRASH_RECOVERY_ENGINE_RESULTS 13911
#define ER_BINLOG_CRASH_RECOVERY_COMMIT_FAILED 13912
#define ER_BINLOG_CRASH_RECOVERY_ROLLBACK_FAILED 13913
#define ER_BINLOG_CRASH_RECOVERY_PREPARE_FAILED 13914
#define ER_COMPONENT_EE_SYS_VAR_REGISTRATION_FAILURE 13915
#define ER_COMPONENT_EE_SYS_VAR_DEREGISTRATION_FAILURE 13916
#define ER_COMPONENT_EE_FUNCTION_REGISTRATION_FAILURE 13917
#define ER_COMPONENT_EE_FUNCTION_DEREGISTRATION_FAILURE 13918
#define ER_COMPONENT_EE_FUNCTION_INVALID_ARGUMENTS 13919
#define ER_COMPONENT_EE_FUNCTION_INVALID_ALGORITHM 13920
#define ER_COMPONENT_EE_FUNCTION_KEY_LENGTH_OUT_OF_RANGE 13921
#define ER_COMPONENT_EE_FUNCTION_PRIVATE_KEY_GENERATION_FAILURE 13922
#define ER_COMPONENT_EE_FUNCTION_PUBLIC_KEY_GENERATION_FAILURE 13923
#define ER_COMPONENT_EE_DATA_LENGTH_OUT_OF_RAGE 13924
#define ER_COMPONENT_EE_DATA_ENCRYPTION_ERROR 13925
#define ER_COMPONENT_EE_DATA_DECRYPTION_ERROR 13926
#define ER_COMPONENT_EE_DATA_SIGN_ERROR 13927
#define ER_COMPONENT_EE_OPENSSL_ERROR 13928
#define ER_COMPONENT_EE_INSUFFICIENT_LENGTH 13929
#define ER_SYSTEMD_NOTIFY_DEBUG 13930
#define ER_TMP_SESSION_FOR_VAR 13931
#define ER_BUILD_ID 13932
#define ER_THREAD_POOL_CANNOT_REGISTER_DYNAMIC_PRIVILEGE 13933
#define ER_IB_MSG_LOG_WRITER_WAIT_ON_CONSUMER 13934
#define ER_CONDITIONAL_DEBUG 13935
#define ER_IB_MSG_PARSE_OLD_REDO_INDEX_VERSION 13936
//#define OBSOLETE_ER_RES_GRP_FAILED_TO_SWITCH_RESOURCE_GROUP 13937
//#define OBSOLETE_ER_RES_GRP_SWITCH_FAILED_COULD_NOT_ACQUIRE_GLOBAL_LOCK 13938
//#define OBSOLETE_ER_RES_GRP_SWITCH_FAILED_COULD_NOT_ACQUIRE_LOCK 13939
//#define OBSOLETE_ER_RES_GRP_SWITCH_FAILED_UNABLE_TO_APPLY_RES_GRP 13940
#define ER_IB_MSG_CLEAR_INSTANT_DROP_COLUMN_METADATA 13941
#define ER_COMPONENT_KEYRING_OCI_OPEN_KEY_FILE 13942
#define ER_COMPONENT_KEYRING_OCI_CREATE_PRIVATE_KEY 13943
#define ER_COMPONENT_KEYRING_OCI_READ_KEY_FILE 13944
#define ER_NOTE_COMPONENT_KEYRING_OCI_MISSING_NAME_OR_TYPE 13945
#define ER_WARN_COMPONENT_KEYRING_OCI_DUPLICATE_KEY 13946
#define ER_KEYRING_OCI_PARSE_JSON 13947
#define ER_KEYRING_OCI_INVALID_JSON 13948
#define ER_KEYRING_OCI_HTTP_REQUEST 13949
#define ER_THREAD_POOL_SYSVAR_CHANGE 13950
#define ER_STACK_BACKTRACE 13951
#define ER_IB_MSG_BUF_POOL_RESIZE_COMPLETE_CUR_CODE 13952
#define ER_IB_MSG_BUF_POOL_RESIZE_PROGRESS_UPDATE 13953
#define ER_IB_MSG_BUF_POOL_RESIZE_CODE_STATUS 13954
#define ER_THREAD_POOL_QUERY_THREADS_PER_GROUP_INVALID 13955
#define ER_THREAD_POOL_QUERY_THRS_PER_GRP_EXCEEDS_TXN_THR_LIMIT 13956
#define ER_IB_MSG_INVALID_PAGE_TYPE 13957
#define ER_IB_PARALLEL_READER_WORKER_INFO 13958
#define ER_IB_BULK_LOAD_SUBTREE_INFO 13959
#define ER_IB_BULK_FLUSHER_INFO 13960
#define ER_IB_BUFFER_POOL_OVERUSE 13961
#define ER_IB_BUFFER_POOL_FULL 13962
#define ER_IB_DUPLICATE_KEY 13963
#define ER_REPLICATION_INCOMPATIBLE_TABLE_WITH_GIPK 13964
#define ER_BULK_EXECUTOR_INFO 13965
#define ER_BULK_LOADER_INFO 13966
#define ER_BULK_LOADER_FILE_CONTAINS_LESS_LINES_THAN_IGNORE_CLAUSE_LOG 13967
#define ER_BULK_READER_INFO 13968
#define ER_BULK_READER_LIBCURL_INIT_FAILED_LOG 13969
#define ER_BULK_READER_LIBCURL_ERROR_LOG 13970
#define ER_BULK_READER_SERVER_ERROR_LOG 13971
#define ER_BULK_READER_COMMUNICATION_ERROR_LOG 13972
#define ER_BULK_PARSER_MISSING_ENCLOSED_BY_LOG 13973
#define ER_BULK_PARSER_ROW_BUFFER_MAX_TOTAL_COLS_EXCEEDED_LOG 13974
#define ER_BULK_PARSER_COPY_BUFFER_SIZE_EXCEEDED_LOG 13975
#define ER_BULK_PARSER_UNEXPECTED_END_OF_INPUT_LOG 13976
#define ER_BULK_PARSER_UNEXPECTED_ROW_TERMINATOR_LOG 13977
#define ER_BULK_PARSER_UNEXPECTED_CHAR_AFTER_ENDING_ENCLOSED_BY_LOG 13978
#define ER_BULK_PARSER_UNEXPECTED_CHAR_AFTER_NULL_ESCAPE_LOG 13979
#define ER_BULK_PARSER_UNEXPECTED_CHAR_AFTER_COLUMN_TERMINATOR_LOG 13980
#define ER_BULK_PARSER_INCOMPLETE_ESCAPE_SEQUENCE_LOG 13981
#define ER_LOAD_BULK_DATA_WRONG_VALUE_FOR_FIELD_LOG 13982
#define ER_LOAD_BULK_DATA_WARN_NULL_TO_NOTNULL_LOG 13983
#define ER_IB_BULK_LOAD_THREAD_FAIL 13984
#define ER_IB_BULK_LOAD_MERGE_FAIL 13985
#define ER_IB_LOAD_BULK_CONCURRENCY_REDUCED 13986
#define ER_PLUGIN_EXCEPTION_OPERATION_FAILED 13987
#define ER_REQUIRE_TABLE_PRIMARY_KEY_CHECK_GENERATE_WITH_GR_IN_REPO 13988
#define ER_CHECK_TABLE_INSTANT_VERSION_BIT_SET 13989
#define ER_GRP_RPL_PAXOS_SINGLE_LEADER_DIFF_FROM_OLD_GRP 13990
#define ER_IB_WRN_IGNORE_REDO_LOG_CAPACITY 13991
#define ER_IB_PRIMARY_KEY_IS_INSTANT 13992
#define ER_THREAD_POOL_IDLE_CONNECTION_CLOSED 13993
#define ER_IB_HIDDEN_NAME_CONFLICT 13994
#define ER_IB_DICT_INVALID_COLUMN_POSITION 13995
#define ER_IB_DICT_LOG_TABLE_INFO 13996
#define ER_RPL_ASYNC_NEXT_FAILOVER_CHANNEL_SELECTED 13997
#define ER_RPL_REPLICA_SOURCE_UUID_HAS_NOT_CHANGED 13998
#define ER_RPL_REPLICA_SOURCE_UUID_HAS_CHANGED_HOST_PORT_UNCHANGED 13999
#define ER_RPL_REPLICA_SOURCE_UUID_HOST_PORT_HAS_CHANGED 14000
#define ER_RPL_REPLICA_CONNECTED_TO_SOURCE_RPL_STARTED_FILE_BASED 14001
#define ER_RPL_REPLICA_CONNECTED_TO_SOURCE_RPL_STARTED_GTID_BASED 14002
#define ER_IB_INDEX_LOADER_DONE 14003
#define ER_IB_INDEX_BUILDER_DONE 14004
#define ER_WARN_DEPRECATED_USER_DEFINED_COLLATIONS_OPTION 14005
#define ER_IB_INDEX_BUILDER_INIT 14006
#define ER_IB_SELECT_COUNT_STAR 14007
#define ER_IB_INDEX_LOG_VERSION_MISMATCH 14008
#define ER_WARN_COMPONENTS_INFRASTRUCTURE_MANIFEST_MULTIPLE_KEYRING 14009
#define ER_GRP_RPL_HAS_STARTED 14010
#define ER_CHECK_TABLE_MIN_REC_FLAG_SET 14011
#define ER_CHECK_TABLE_MIN_REC_FLAG_NOT_SET 14012
#define ER_NOTE_COMPONENT_SLOT_REGISTRATION_SUCCESS 14013
#define ER_NOTE_COMPONENT_SLOT_DEREGISTRATION_SUCCESS 14014
#define ER_WARN_CANNOT_FREE_COMPONENT_DATA_DEALLOCATION_FAILED 14015
#define ER_IB_RESURRECT_TRX_INSERT 14016
#define ER_IB_RESURRECT_TRX_UPDATE 14017
#define ER_IB_RESURRECT_IDENTIFY_TABLE_TO_LOCK 14018
#define ER_IB_RESURRECT_ACQUIRE_TABLE_LOCK 14019
#define ER_IB_RESURRECT_RECORD_PROGRESS 14020
#define ER_IB_RESURRECT_RECORD_COMPLETE 14021
#define ER_IB_RESURRECT_TRX_INSERT_COMPLETE 14022
#define ER_IB_RESURRECT_TRX_UPDATE_COMPLETE 14023
#define ER_AUTHENTICATION_OCI_INVALID_TOKEN 14024
#define ER_AUTHENTICATION_OCI_TOKEN_DETAILS_MISMATCH 14025
#define ER_AUTHENTICATION_OCI_TOKEN_NOT_VERIFIED 14026
#define ER_AUTHENTICATION_OCI_DOWNLOAD_IDDP_PUBLIC_KEY 14027
//#define OBSOLETE_ER_AUTHENTICATION_OCI_NO_MATCHING_GROUPS_IN_TOKEN 14028
#define ER_SYS_VAR_REGISTRATION 14029
#define ER_SYS_VAR_DEREGISTRATION 14030
#define ER_UDF_REGISTRATION 14031
#define ER_UDF_DEREGISTRATION 14032
#define ER_PRIVILEGE_REGISTRATION 14033
#define ER_PRIVILEGE_DEREGISTRATION 14034
#define ER_UDF_EXEC_FAILURE 14035
#define ER_UDF_EXEC_FAILURE_REASON 14036
#define ER_COMPONENT_SERVICE_CALL 14037
#define ER_COMPONENT_SERVICE_CALL_RESULT 14038
#define ER_COMPONENT_LOCK 14039
#define ER_COMPONENT_UNLOCK 14040
#define ER_COMPONENT_MASKING_OTHER_ERROR 14041
#define ER_COMPONENT_MASKING_ABI 14042
#define ER_COMPONENT_MASKING_ABI_REASON 14043
#define ER_COMPONENT_MASKING_RANDOM_CREATE 14044
#define ER_COMPONENT_MASKING_RANDOM_CREATE_REASON 14045
#define ER_COMPONENT_MASKING_CANNOT_ACCESS_TABLE 14046
#define ER_REDUCED_DBLWR_FILE_CORRUPTED 14047
#define ER_REDUCED_DBLWR_PAGE_FOUND 14048
#define ER_CONN_INIT_CONNECT_IGNORED_MFA 14049
#define ER_SECONDARY_ENGINE_DDL_FAILED 14050
#define ER_THREAD_POOL_CONNECTION_REPORT 14051
#define ER_WARN_SCHEDULED_TASK_RUN_FAILED 14052
#define ER_AUDIT_LOG_INVALID_FLUSH_INTERVAL_VALUE 14053
#define ER_LOG_CANNOT_PURGE_BINLOG_WITH_BACKUP_LOCK 14054
#define ER_CONVERT_MULTI_VALUE 14055
#define ER_IB_DDL_CONVERT_HEAP_NOT_FOUND 14056
#define ER_SERVER_DOWNGRADE_FROM_VERSION 14057
#define ER_BEYOND_SERVER_DOWNGRADE_THRESHOLD 14058
#define ER_BEYOND_SERVER_UPGRADE_THRESHOLD 14059
#define ER_INVALID_SERVER_UPGRADE_NOT_LTS 14060
#define ER_INVALID_SERVER_DOWNGRADE_NOT_PATCH 14061
#define ER_FAILED_GET_DD_PROPERTY 14062
#define ER_FAILED_SET_DD_PROPERTY 14063
#define ER_SERVER_DOWNGRADE_STATUS 14064
#define ER_INFORMATION_SCHEMA_VERSION_CHANGE 14065
#define ER_PERFORMANCE_SCHEMA_VERSION_CHANGE 14066
#define ER_WARN_DEPRECATED_OR_BLOCKED_CIPHER 14067
#define ER_IB_MSG_DDL_FAIL_NO_BUILDER 14068
#define ER_GRP_RPL_MEMBER_INFO_DOES_NOT_EXIST 14069
#define ER_USAGE_DEPRECATION_COUNTER 14070
#define ER_WAITING_FOR_NO_CONNECTIONS 14071
#define ER_WAITING_FOR_NO_THDS 14072
#define ER_IB_INDEX_PART_TOO_LONG 14073
#define ER_DD_UPDATE_DATADIR_FLAG_FAIL 14074
#define ER_IB_MSG_FIL_STATE_MOVED_PREV 14075
#define ER_RPL_KILL_OLD_DUMP_THREAD_ENCOUNTERED 14076
#define ER_RPL_MTA_ALLOW_COMMIT_OUT_OF_ORDER 14077
#define ER_CHECK_TABLE_FUNCTIONS 14078
#define ER_CHECK_TABLE_FUNCTIONS_DETAIL 14079
#define ER_GRP_RPL_CERT_BROADCAST_THREAD_CREATE_FAILED 14080
#define ER_GRP_RPL_CERT_BROADCAST_THREAD_STARTED 14081
#define ER_GRP_RPL_CERT_BROADCAST_THREAD_STOPPED 14082
#define ER_GRP_RPL_APPLIER_THD_KILLED_BY_SQL_KILL 14083
#define ER_IB_MSG_WAITING_ON_LAGGING_REDO_LOG_CONSUMER 14084
#define ER_IB_MSG_ABORTING_LOG_ARCHIVER 14085
static const int obsolete_error_count = 557;
static const int pfs_no_error_stat_count = 2;
static const int pfs_session_error_stat_count = 1640;
static const int pfs_global_error_stat_count = 3682;
#endif
/* Copyright (c) 2015, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _mysql_command_h
#define _mysql_command_h
/**
@file include/my_command.h
*/
/**
@enum enum_server_command
@brief A list of all MySQL protocol commands.
These are the top level commands the server can receive
while it listens for a new command in ::dispatch_command
@par Warning
Add new commands to the end of this list, otherwise old
servers won't be able to handle them as 'unsupported'.
*/
enum enum_server_command {
/**
Currently refused by the server. See ::dispatch_command.
Also used internally to mark the start of a session.
*/
COM_SLEEP,
COM_QUIT, /**< See @ref page_protocol_com_quit */
COM_INIT_DB, /**< See @ref page_protocol_com_init_db */
COM_QUERY, /**< See @ref page_protocol_com_query */
COM_FIELD_LIST, /**< Deprecated. See @ref page_protocol_com_field_list */
COM_CREATE_DB, /**< Currently refused by the server. See ::dispatch_command */
COM_DROP_DB, /**< Currently refused by the server. See ::dispatch_command */
COM_REFRESH, /**< Deprecated. See @ref page_protocol_com_refresh */
COM_DEPRECATED_1, /**< Deprecated, used to be COM_SHUTDOWN */
COM_STATISTICS, /**< See @ref page_protocol_com_statistics */
COM_PROCESS_INFO, /**< Deprecated. See @ref page_protocol_com_process_info */
COM_CONNECT, /**< Currently refused by the server. */
COM_PROCESS_KILL, /**< Deprecated. See @ref page_protocol_com_process_kill */
COM_DEBUG, /**< See @ref page_protocol_com_debug */
COM_PING, /**< See @ref page_protocol_com_ping */
COM_TIME, /**< Currently refused by the server. */
COM_DELAYED_INSERT, /**< Functionality removed. */
COM_CHANGE_USER, /**< See @ref page_protocol_com_change_user */
COM_BINLOG_DUMP, /**< See @ref page_protocol_com_binlog_dump */
COM_TABLE_DUMP,
COM_CONNECT_OUT,
COM_REGISTER_SLAVE,
COM_STMT_PREPARE, /**< See @ref page_protocol_com_stmt_prepare */
COM_STMT_EXECUTE, /**< See @ref page_protocol_com_stmt_execute */
/** See @ref page_protocol_com_stmt_send_long_data */
COM_STMT_SEND_LONG_DATA,
COM_STMT_CLOSE, /**< See @ref page_protocol_com_stmt_close */
COM_STMT_RESET, /**< See @ref page_protocol_com_stmt_reset */
COM_SET_OPTION, /**< See @ref page_protocol_com_set_option */
COM_STMT_FETCH, /**< See @ref page_protocol_com_stmt_fetch */
/**
Currently refused by the server. See ::dispatch_command.
Also used internally to mark the session as a "daemon",
i.e. non-client THD. Currently the scheduler and the GTID
code does use this state.
These threads won't be killed by `KILL`
@sa Event_scheduler::start, ::init_thd, ::kill_one_thread,
::Find_thd_with_id
*/
COM_DAEMON,
COM_BINLOG_DUMP_GTID,
COM_RESET_CONNECTION, /**< See @ref page_protocol_com_reset_connection */
COM_CLONE,
COM_SUBSCRIBE_GROUP_REPLICATION_STREAM,
/* don't forget to update std::string Command_names::m_names[] in sql_parse.cc
*/
/* Must be last */
COM_END /**< Not a real command. Refused. */
};
#endif /* _mysql_command_h */
/* Copyright (c) 2015, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _MYSQLX_ERROR_H_
#define _MYSQLX_ERROR_H_
#define ER_X_BAD_MESSAGE 5000
#define ER_X_CAPABILITIES_PREPARE_FAILED 5001
#define ER_X_CAPABILITY_NOT_FOUND 5002
#define ER_X_INVALID_PROTOCOL_DATA 5003
#define ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_VALUE_LENGTH 5004
#define ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_KEY_LENGTH 5005
#define ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_EMPTY_KEY 5006
#define ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_LENGTH 5007
#define ER_X_BAD_CONNECTION_SESSION_ATTRIBUTE_TYPE 5008
#define ER_X_CAPABILITY_SET_NOT_ALLOWED 5009
#define ER_X_SERVICE_ERROR 5010
#define ER_X_SESSION 5011
#define ER_X_INVALID_ARGUMENT 5012
#define ER_X_MISSING_ARGUMENT 5013
#define ER_X_BAD_INSERT_DATA 5014
#define ER_X_CMD_NUM_ARGUMENTS 5015
#define ER_X_CMD_ARGUMENT_TYPE 5016
#define ER_X_CMD_ARGUMENT_VALUE 5017
#define ER_X_BAD_UPSERT_DATA 5018
#define ER_X_DUPLICATED_CAPABILITIES 5019
#define ER_X_CMD_ARGUMENT_OBJECT_EMPTY 5020
#define ER_X_CMD_INVALID_ARGUMENT 5021
#define ER_X_BAD_UPDATE_DATA 5050
#define ER_X_BAD_TYPE_OF_UPDATE 5051
#define ER_X_BAD_COLUMN_TO_UPDATE 5052
#define ER_X_BAD_MEMBER_TO_UPDATE 5053
#define ER_X_BAD_STATEMENT_ID 5110
#define ER_X_BAD_CURSOR_ID 5111
#define ER_X_BAD_SCHEMA 5112
#define ER_X_BAD_TABLE 5113
#define ER_X_BAD_PROJECTION 5114
#define ER_X_DOC_ID_MISSING 5115
#define ER_X_DUPLICATE_ENTRY 5116
#define ER_X_DOC_REQUIRED_FIELD_MISSING 5117
#define ER_X_PROJ_BAD_KEY_NAME 5120
#define ER_X_BAD_DOC_PATH 5121
#define ER_X_CURSOR_EXISTS 5122
#define ER_X_CURSOR_REACHED_EOF 5123
#define ER_X_PREPARED_STATMENT_CAN_HAVE_ONE_CURSOR 5131
#define ER_X_PREPARED_EXECUTE_ARGUMENT_NOT_SUPPORTED 5133
#define ER_X_PREPARED_EXECUTE_ARGUMENT_CONSISTENCY 5134
#define ER_X_EXPR_BAD_OPERATOR 5150
#define ER_X_EXPR_BAD_NUM_ARGS 5151
#define ER_X_EXPR_MISSING_ARG 5152
#define ER_X_EXPR_BAD_TYPE_VALUE 5153
#define ER_X_EXPR_BAD_VALUE 5154
#define ER_X_INVALID_COLLECTION 5156
#define ER_X_INVALID_ADMIN_COMMAND 5157
#define ER_X_EXPECT_NOT_OPEN 5158
#define ER_X_EXPECT_NO_ERROR_FAILED 5159
#define ER_X_EXPECT_BAD_CONDITION 5160
#define ER_X_EXPECT_BAD_CONDITION_VALUE 5161
#define ER_X_INVALID_NAMESPACE 5162
#define ER_X_BAD_NOTICE 5163
#define ER_X_CANNOT_DISABLE_NOTICE 5164
#define ER_X_BAD_CONFIGURATION 5165
#define ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS 5167
#define ER_X_EXPECT_FIELD_EXISTS_FAILED 5168
#define ER_X_BAD_LOCKING 5169
#define ER_X_FRAME_COMPRESSION_DISABLED 5170
#define ER_X_DECOMPRESSION_FAILED 5171
#define ER_X_BAD_COMPRESSED_FRAME 5174
#define ER_X_CAPABILITY_COMPRESSION_INVALID_ALGORITHM 5175
#define ER_X_CAPABILITY_COMPRESSION_INVALID_SERVER_STYLE 5176
#define ER_X_CAPABILITY_COMPRESSION_INVALID_CLIENT_STYLE 5177
#define ER_X_CAPABILITY_COMPRESSION_INVALID_OPTION 5178
#define ER_X_CAPABILITY_COMPRESSION_MISSING_REQUIRED_FIELDS 5179
#define ER_X_DOCUMENT_DOESNT_MATCH_EXPECTED_SCHEMA 5180
#define ER_X_COLLECTION_OPTION_DOESNT_EXISTS 5181
#define ER_X_INVALID_VALIDATION_SCHEMA 5182
#endif // _MYSQLX_ERROR_H_
/* Copyright (c) 2019, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MY_COMPRESS_INCLUDED
#define MY_COMPRESS_INCLUDED
/* List of valid values for compression_algorithm */
enum enum_compression_algorithm {
MYSQL_UNCOMPRESSED = 1,
MYSQL_ZLIB,
MYSQL_ZSTD,
MYSQL_INVALID
};
/**
Compress context information. relating to zlib compression.
*/
typedef struct mysql_zlib_compress_context {
/**
Compression level to use in zlib compression.
*/
unsigned int compression_level;
} mysql_zlib_compress_context;
typedef struct ZSTD_CCtx_s ZSTD_CCtx;
typedef struct ZSTD_DCtx_s ZSTD_DCtx;
/**
Compress context information relating to zstd compression.
*/
typedef struct mysql_zstd_compress_context {
/**
Pointer to compressor context.
*/
ZSTD_CCtx *cctx;
/**
Pointer to decompressor context.
*/
ZSTD_DCtx *dctx;
/**
Compression level to use in zstd compression.
*/
unsigned int compression_level;
} mysql_zstd_compress_context;
/**
Compression context information.
It encapsulate the context information based on compression method and
presents a generic struct.
*/
typedef struct mysql_compress_context {
enum enum_compression_algorithm algorithm; ///< Compression algorithm name.
union {
mysql_zlib_compress_context zlib_ctx; ///< Context information of zlib.
mysql_zstd_compress_context zstd_ctx; ///< Context information of zstd.
} u;
} mysql_compress_context;
/**
Get default compression level corresponding to a given compression method.
@param algorithm Compression Method. Possible values are zlib or zstd.
@return an unsigned int representing default compression level.
6 is the default compression level for zlib and 3 is the
default compression level for zstd.
*/
unsigned int mysql_default_compression_level(
enum enum_compression_algorithm algorithm);
/**
Initialize a compress context object to be associated with a NET object.
@param cmp_ctx Pointer to compression context.
@param algorithm Compression algorithm.
@param compression_level Compression level corresponding to the compression
algorithm.
*/
void mysql_compress_context_init(mysql_compress_context *cmp_ctx,
enum enum_compression_algorithm algorithm,
unsigned int compression_level);
/**
Deinitialize the compression context allocated.
@param mysql_compress_ctx Pointer to Compression context.
*/
void mysql_compress_context_deinit(mysql_compress_context *mysql_compress_ctx);
#endif // MY_COMPRESS_INCLUDED
// Exception Handling support header for -*- C++ -*-
// Copyright (C) 1995-2018 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
// GCC is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// GCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file exception
* This is a Standard C++ Library header.
*/
#ifndef __EXCEPTION__
#define __EXCEPTION__
#pragma GCC system_header
#pragma GCC visibility push(default)
#include <bits/c++config.h>
#include <bits/exception.h>
extern "C++" {
namespace std
{
/** If an %exception is thrown which is not listed in a function's
* %exception specification, one of these may be thrown. */
class bad_exception : public exception
{
public:
bad_exception() _GLIBCXX_USE_NOEXCEPT { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
// See comment in eh_exception.cc.
virtual const char*
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
};
/// If you write a replacement %terminate handler, it must be of this type.
typedef void (*terminate_handler) ();
/// If you write a replacement %unexpected handler, it must be of this type.
typedef void (*unexpected_handler) ();
/// Takes a new handler function as an argument, returns the old function.
terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT;
#if __cplusplus >= 201103L
/// Return the current terminate handler.
terminate_handler get_terminate() noexcept;
#endif
/** The runtime will call this function if %exception handling must be
* abandoned for any reason. It can also be called by the user. */
void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));
/// Takes a new handler function as an argument, returns the old function.
unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT;
#if __cplusplus >= 201103L
/// Return the current unexpected handler.
unexpected_handler get_unexpected() noexcept;
#endif
/** The runtime will call this function if an %exception is thrown which
* violates the function's %exception specification. */
void unexpected() __attribute__ ((__noreturn__));
/** [18.6.4]/1: 'Returns true after completing evaluation of a
* throw-expression until either completing initialization of the
* exception-declaration in the matching handler or entering @c unexpected()
* due to the throw; or after entering @c terminate() for any reason
* other than an explicit call to @c terminate(). [Note: This includes
* stack unwinding [15.2]. end note]'
*
* 2: 'When @c uncaught_exception() is true, throwing an
* %exception can result in a call of @c terminate()
* (15.5.1).'
*/
_GLIBCXX17_DEPRECATED
bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++98
#define __cpp_lib_uncaught_exceptions 201411L
/// The number of uncaught exceptions.
int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
#endif
// @} group exceptions
} // namespace std
namespace __gnu_cxx
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief A replacement for the standard terminate_handler which
* prints more information about the terminating exception (if any)
* on stderr.
*
* @ingroup exceptions
*
* Call
* @code
* std::set_terminate(__gnu_cxx::__verbose_terminate_handler)
* @endcode
* to use. For more info, see
* http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html
*
* In 3.4 and later, this is on by default.
*/
void __verbose_terminate_handler();
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
} // extern "C++"
#pragma GCC visibility pop
#if (__cplusplus >= 201103L)
#include <bits/exception_ptr.h>
#include <bits/nested_exception.h>
#endif
#endif
// <deque> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file include/deque
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_DEQUE
#define _GLIBCXX_DEQUE 1
#pragma GCC system_header
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_deque.h>
#include <bits/range_access.h>
#include <bits/deque.tcc>
#ifdef _GLIBCXX_DEBUG
# include <debug/deque>
#endif
#ifdef _GLIBCXX_PROFILE
# include <profile/deque>
#endif
#endif /* _GLIBCXX_DEQUE */
// <scoped_allocator> -*- C++ -*-
// Copyright (C) 2011-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/scoped_allocator
* This is a Standard C++ Library header.
*/
#ifndef _SCOPED_ALLOCATOR
#define _SCOPED_ALLOCATOR 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <utility>
#include <tuple>
#include <bits/alloc_traits.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @addtogroup allocators
* @{
*/
template<typename _Alloc>
using __outer_allocator_t
= decltype(std::declval<_Alloc>().outer_allocator());
template<typename _Alloc, typename = void>
struct __outermost_type
{
using type = _Alloc;
static type& _S_outermost(_Alloc& __a) { return __a; }
};
template<typename _Alloc>
struct __outermost_type<_Alloc, __void_t<__outer_allocator_t<_Alloc>>>
: __outermost_type<
typename remove_reference<__outer_allocator_t<_Alloc>>::type
>
{
using __base = __outermost_type<
typename remove_reference<__outer_allocator_t<_Alloc>>::type
>;
static typename __base::type&
_S_outermost(_Alloc& __a)
{ return __base::_S_outermost(__a.outer_allocator()); }
};
template<typename _Alloc>
inline typename __outermost_type<_Alloc>::type&
__outermost(_Alloc& __a)
{ return __outermost_type<_Alloc>::_S_outermost(__a); }
template<typename _OuterAlloc, typename... _InnerAllocs>
class scoped_allocator_adaptor;
template<typename...>
struct __inner_type_impl;
template<typename _Outer>
struct __inner_type_impl<_Outer>
{
typedef scoped_allocator_adaptor<_Outer> __type;
__inner_type_impl() = default;
__inner_type_impl(const __inner_type_impl&) = default;
__inner_type_impl(__inner_type_impl&&) = default;
__inner_type_impl& operator=(const __inner_type_impl&) = default;
__inner_type_impl& operator=(__inner_type_impl&&) = default;
template<typename _Alloc>
__inner_type_impl(const __inner_type_impl<_Alloc>& __other)
{ }
template<typename _Alloc>
__inner_type_impl(__inner_type_impl<_Alloc>&& __other)
{ }
__type&
_M_get(__type* __p) noexcept { return *__p; }
const __type&
_M_get(const __type* __p) const noexcept { return *__p; }
tuple<>
_M_tie() const noexcept { return tuple<>(); }
bool
operator==(const __inner_type_impl&) const noexcept
{ return true; }
};
template<typename _Outer, typename _InnerHead, typename... _InnerTail>
struct __inner_type_impl<_Outer, _InnerHead, _InnerTail...>
{
typedef scoped_allocator_adaptor<_InnerHead, _InnerTail...> __type;
__inner_type_impl() = default;
__inner_type_impl(const __inner_type_impl&) = default;
__inner_type_impl(__inner_type_impl&&) = default;
__inner_type_impl& operator=(const __inner_type_impl&) = default;
__inner_type_impl& operator=(__inner_type_impl&&) = default;
template<typename... _Allocs>
__inner_type_impl(const __inner_type_impl<_Allocs...>& __other)
: _M_inner(__other._M_inner) { }
template<typename... _Allocs>
__inner_type_impl(__inner_type_impl<_Allocs...>&& __other)
: _M_inner(std::move(__other._M_inner)) { }
template<typename... _Args>
explicit
__inner_type_impl(_Args&&... __args)
: _M_inner(std::forward<_Args>(__args)...) { }
__type&
_M_get(void*) noexcept { return _M_inner; }
const __type&
_M_get(const void*) const noexcept { return _M_inner; }
tuple<const _InnerHead&, const _InnerTail&...>
_M_tie() const noexcept
{ return _M_inner._M_tie(); }
bool
operator==(const __inner_type_impl& __other) const noexcept
{ return _M_inner == __other._M_inner; }
private:
template<typename...> friend class __inner_type_impl;
template<typename, typename...> friend class scoped_allocator_adaptor;
__type _M_inner;
};
/// Primary class template.
template<typename _OuterAlloc, typename... _InnerAllocs>
class scoped_allocator_adaptor
: public _OuterAlloc
{
typedef allocator_traits<_OuterAlloc> __traits;
typedef __inner_type_impl<_OuterAlloc, _InnerAllocs...> __inner_type;
__inner_type _M_inner;
template<typename _Outer, typename... _Inner>
friend class scoped_allocator_adaptor;
template<typename...>
friend class __inner_type_impl;
tuple<const _OuterAlloc&, const _InnerAllocs&...>
_M_tie() const noexcept
{ return std::tuple_cat(std::tie(outer_allocator()), _M_inner._M_tie()); }
template<typename _Alloc>
using __outermost_alloc_traits
= allocator_traits<typename __outermost_type<_Alloc>::type>;
template<typename _Tp, typename... _Args>
void
_M_construct(__uses_alloc0, _Tp* __p, _Args&&... __args)
{
typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits;
_O_traits::construct(__outermost(*this), __p,
std::forward<_Args>(__args)...);
}
typedef __uses_alloc1<typename __inner_type::__type> __uses_alloc1_;
typedef __uses_alloc2<typename __inner_type::__type> __uses_alloc2_;
template<typename _Tp, typename... _Args>
void
_M_construct(__uses_alloc1_, _Tp* __p, _Args&&... __args)
{
typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits;
_O_traits::construct(__outermost(*this), __p,
allocator_arg, inner_allocator(),
std::forward<_Args>(__args)...);
}
template<typename _Tp, typename... _Args>
void
_M_construct(__uses_alloc2_, _Tp* __p, _Args&&... __args)
{
typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits;
_O_traits::construct(__outermost(*this), __p,
std::forward<_Args>(__args)...,
inner_allocator());
}
template<typename _Alloc>
static _Alloc
_S_select_on_copy(const _Alloc& __a)
{
typedef allocator_traits<_Alloc> __a_traits;
return __a_traits::select_on_container_copy_construction(__a);
}
template<std::size_t... _Indices>
scoped_allocator_adaptor(tuple<const _OuterAlloc&,
const _InnerAllocs&...> __refs,
_Index_tuple<_Indices...>)
: _OuterAlloc(_S_select_on_copy(std::get<0>(__refs))),
_M_inner(_S_select_on_copy(std::get<_Indices+1>(__refs))...)
{ }
// Used to constrain constructors to disallow invalid conversions.
template<typename _Alloc>
using _Constructible = typename enable_if<
is_constructible<_OuterAlloc, _Alloc>::value
>::type;
public:
typedef _OuterAlloc outer_allocator_type;
typedef typename __inner_type::__type inner_allocator_type;
typedef typename __traits::value_type value_type;
typedef typename __traits::size_type size_type;
typedef typename __traits::difference_type difference_type;
typedef typename __traits::pointer pointer;
typedef typename __traits::const_pointer const_pointer;
typedef typename __traits::void_pointer void_pointer;
typedef typename __traits::const_void_pointer const_void_pointer;
typedef typename __or_<
typename __traits::propagate_on_container_copy_assignment,
typename allocator_traits<_InnerAllocs>::
propagate_on_container_copy_assignment...>::type
propagate_on_container_copy_assignment;
typedef typename __or_<
typename __traits::propagate_on_container_move_assignment,
typename allocator_traits<_InnerAllocs>::
propagate_on_container_move_assignment...>::type
propagate_on_container_move_assignment;
typedef typename __or_<
typename __traits::propagate_on_container_swap,
typename allocator_traits<_InnerAllocs>::
propagate_on_container_swap...>::type
propagate_on_container_swap;
typedef typename __and_<
typename __traits::is_always_equal,
typename allocator_traits<_InnerAllocs>::is_always_equal...>::type
is_always_equal;
template <class _Tp>
struct rebind
{
typedef scoped_allocator_adaptor<
typename __traits::template rebind_alloc<_Tp>,
_InnerAllocs...> other;
};
scoped_allocator_adaptor() : _OuterAlloc(), _M_inner() { }
template<typename _Outer2, typename = _Constructible<_Outer2>>
scoped_allocator_adaptor(_Outer2&& __outer,
const _InnerAllocs&... __inner)
: _OuterAlloc(std::forward<_Outer2>(__outer)),
_M_inner(__inner...)
{ }
scoped_allocator_adaptor(const scoped_allocator_adaptor& __other)
: _OuterAlloc(__other.outer_allocator()),
_M_inner(__other._M_inner)
{ }
scoped_allocator_adaptor(scoped_allocator_adaptor&& __other)
: _OuterAlloc(std::move(__other.outer_allocator())),
_M_inner(std::move(__other._M_inner))
{ }
template<typename _Outer2, typename = _Constructible<const _Outer2&>>
scoped_allocator_adaptor(
const scoped_allocator_adaptor<_Outer2, _InnerAllocs...>& __other)
: _OuterAlloc(__other.outer_allocator()),
_M_inner(__other._M_inner)
{ }
template<typename _Outer2, typename = _Constructible<_Outer2>>
scoped_allocator_adaptor(
scoped_allocator_adaptor<_Outer2, _InnerAllocs...>&& __other)
: _OuterAlloc(std::move(__other.outer_allocator())),
_M_inner(std::move(__other._M_inner))
{ }
scoped_allocator_adaptor&
operator=(const scoped_allocator_adaptor&) = default;
scoped_allocator_adaptor&
operator=(scoped_allocator_adaptor&&) = default;
inner_allocator_type& inner_allocator() noexcept
{ return _M_inner._M_get(this); }
const inner_allocator_type& inner_allocator() const noexcept
{ return _M_inner._M_get(this); }
outer_allocator_type& outer_allocator() noexcept
{ return static_cast<_OuterAlloc&>(*this); }
const outer_allocator_type& outer_allocator() const noexcept
{ return static_cast<const _OuterAlloc&>(*this); }
pointer allocate(size_type __n)
{ return __traits::allocate(outer_allocator(), __n); }
pointer allocate(size_type __n, const_void_pointer __hint)
{ return __traits::allocate(outer_allocator(), __n, __hint); }
void deallocate(pointer __p, size_type __n)
{ return __traits::deallocate(outer_allocator(), __p, __n); }
size_type max_size() const
{ return __traits::max_size(outer_allocator()); }
template<typename _Tp, typename... _Args>
void construct(_Tp* __p, _Args&&... __args)
{
auto& __inner = inner_allocator();
auto __use_tag
= __use_alloc<_Tp, inner_allocator_type, _Args...>(__inner);
_M_construct(__use_tag, __p, std::forward<_Args>(__args)...);
}
template<typename _T1, typename _T2, typename... _Args1,
typename... _Args2>
void
construct(pair<_T1, _T2>* __p, piecewise_construct_t,
tuple<_Args1...> __x, tuple<_Args2...> __y)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2203. wrong argument types for piecewise construction
auto& __inner = inner_allocator();
auto __x_use_tag
= __use_alloc<_T1, inner_allocator_type, _Args1...>(__inner);
auto __y_use_tag
= __use_alloc<_T2, inner_allocator_type, _Args2...>(__inner);
typename _Build_index_tuple<sizeof...(_Args1)>::__type __x_indices;
typename _Build_index_tuple<sizeof...(_Args2)>::__type __y_indices;
typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits;
_O_traits::construct(__outermost(*this), __p, piecewise_construct,
_M_construct_p(__x_use_tag, __x_indices, __x),
_M_construct_p(__y_use_tag, __y_indices, __y));
}
template<typename _T1, typename _T2>
void
construct(pair<_T1, _T2>* __p)
{ construct(__p, piecewise_construct, tuple<>(), tuple<>()); }
template<typename _T1, typename _T2, typename _Up, typename _Vp>
void
construct(pair<_T1, _T2>* __p, _Up&& __u, _Vp&& __v)
{
construct(__p, piecewise_construct,
std::forward_as_tuple(std::forward<_Up>(__u)),
std::forward_as_tuple(std::forward<_Vp>(__v)));
}
template<typename _T1, typename _T2, typename _Up, typename _Vp>
void
construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x)
{
construct(__p, piecewise_construct,
std::forward_as_tuple(__x.first),
std::forward_as_tuple(__x.second));
}
template<typename _T1, typename _T2, typename _Up, typename _Vp>
void
construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x)
{
construct(__p, piecewise_construct,
std::forward_as_tuple(std::forward<_Up>(__x.first)),
std::forward_as_tuple(std::forward<_Vp>(__x.second)));
}
template<typename _Tp>
void destroy(_Tp* __p)
{
typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits;
_O_traits::destroy(__outermost(*this), __p);
}
scoped_allocator_adaptor
select_on_container_copy_construction() const
{
typedef typename _Build_index_tuple<sizeof...(_InnerAllocs)>::__type
_Indices;
return scoped_allocator_adaptor(_M_tie(), _Indices());
}
template <typename _OutA1, typename _OutA2, typename... _InA>
friend bool
operator==(const scoped_allocator_adaptor<_OutA1, _InA...>& __a,
const scoped_allocator_adaptor<_OutA2, _InA...>& __b) noexcept;
private:
template<typename _Ind, typename... _Args>
tuple<_Args&&...>
_M_construct_p(__uses_alloc0, _Ind, tuple<_Args...>& __t)
{ return std::move(__t); }
template<size_t... _Ind, typename... _Args>
tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
_M_construct_p(__uses_alloc1_, _Index_tuple<_Ind...>,
tuple<_Args...>& __t)
{
return { allocator_arg, inner_allocator(),
std::get<_Ind>(std::move(__t))...
};
}
template<size_t... _Ind, typename... _Args>
tuple<_Args&&..., inner_allocator_type&>
_M_construct_p(__uses_alloc2_, _Index_tuple<_Ind...>,
tuple<_Args...>& __t)
{
return { std::get<_Ind>(std::move(__t))..., inner_allocator() };
}
};
template <typename _OutA1, typename _OutA2, typename... _InA>
inline bool
operator==(const scoped_allocator_adaptor<_OutA1, _InA...>& __a,
const scoped_allocator_adaptor<_OutA2, _InA...>& __b) noexcept
{
return __a.outer_allocator() == __b.outer_allocator()
&& __a._M_inner == __b._M_inner;
}
template <typename _OutA1, typename _OutA2, typename... _InA>
inline bool
operator!=(const scoped_allocator_adaptor<_OutA1, _InA...>& __a,
const scoped_allocator_adaptor<_OutA2, _InA...>& __b) noexcept
{ return !(__a == __b); }
/// @}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // C++11
#endif // _SCOPED_ALLOCATOR
// <shared_mutex> -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/shared_mutex
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_SHARED_MUTEX
#define _GLIBCXX_SHARED_MUTEX 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <bits/c++config.h>
#include <condition_variable>
#include <bits/functexcept.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @ingroup mutexes
* @{
*/
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
#ifdef _GLIBCXX_HAS_GTHREADS
#if __cplusplus >= 201703L
#define __cpp_lib_shared_mutex 201505
class shared_mutex;
#endif
#define __cpp_lib_shared_timed_mutex 201402
class shared_timed_mutex;
#if _GLIBCXX_USE_PTHREAD_RWLOCK_T
/// A shared mutex type implemented using pthread_rwlock_t.
class __shared_mutex_pthread
{
friend class shared_timed_mutex;
#ifdef PTHREAD_RWLOCK_INITIALIZER
pthread_rwlock_t _M_rwlock = PTHREAD_RWLOCK_INITIALIZER;
public:
__shared_mutex_pthread() = default;
~__shared_mutex_pthread() = default;
#else
pthread_rwlock_t _M_rwlock;
public:
__shared_mutex_pthread()
{
int __ret = pthread_rwlock_init(&_M_rwlock, NULL);
if (__ret == ENOMEM)
__throw_bad_alloc();
else if (__ret == EAGAIN)
__throw_system_error(int(errc::resource_unavailable_try_again));
else if (__ret == EPERM)
__throw_system_error(int(errc::operation_not_permitted));
// Errors not handled: EBUSY, EINVAL
__glibcxx_assert(__ret == 0);
}
~__shared_mutex_pthread()
{
int __ret __attribute((__unused__)) = pthread_rwlock_destroy(&_M_rwlock);
// Errors not handled: EBUSY, EINVAL
__glibcxx_assert(__ret == 0);
}
#endif
__shared_mutex_pthread(const __shared_mutex_pthread&) = delete;
__shared_mutex_pthread& operator=(const __shared_mutex_pthread&) = delete;
void
lock()
{
int __ret = pthread_rwlock_wrlock(&_M_rwlock);
if (__ret == EDEADLK)
__throw_system_error(int(errc::resource_deadlock_would_occur));
// Errors not handled: EINVAL
__glibcxx_assert(__ret == 0);
}
bool
try_lock()
{
int __ret = pthread_rwlock_trywrlock(&_M_rwlock);
if (__ret == EBUSY) return false;
// Errors not handled: EINVAL
__glibcxx_assert(__ret == 0);
return true;
}
void
unlock()
{
int __ret __attribute((__unused__)) = pthread_rwlock_unlock(&_M_rwlock);
// Errors not handled: EPERM, EBUSY, EINVAL
__glibcxx_assert(__ret == 0);
}
// Shared ownership
void
lock_shared()
{
int __ret;
// We retry if we exceeded the maximum number of read locks supported by
// the POSIX implementation; this can result in busy-waiting, but this
// is okay based on the current specification of forward progress
// guarantees by the standard.
do
__ret = pthread_rwlock_rdlock(&_M_rwlock);
while (__ret == EAGAIN);
if (__ret == EDEADLK)
__throw_system_error(int(errc::resource_deadlock_would_occur));
// Errors not handled: EINVAL
__glibcxx_assert(__ret == 0);
}
bool
try_lock_shared()
{
int __ret = pthread_rwlock_tryrdlock(&_M_rwlock);
// If the maximum number of read locks has been exceeded, we just fail
// to acquire the lock. Unlike for lock(), we are not allowed to throw
// an exception.
if (__ret == EBUSY || __ret == EAGAIN) return false;
// Errors not handled: EINVAL
__glibcxx_assert(__ret == 0);
return true;
}
void
unlock_shared()
{
unlock();
}
void* native_handle() { return &_M_rwlock; }
};
#endif
#if ! (_GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK)
/// A shared mutex type implemented using std::condition_variable.
class __shared_mutex_cv
{
friend class shared_timed_mutex;
// Based on Howard Hinnant's reference implementation from N2406.
// The high bit of _M_state is the write-entered flag which is set to
// indicate a writer has taken the lock or is queuing to take the lock.
// The remaining bits are the count of reader locks.
//
// To take a reader lock, block on gate1 while the write-entered flag is
// set or the maximum number of reader locks is held, then increment the
// reader lock count.
// To release, decrement the count, then if the write-entered flag is set
// and the count is zero then signal gate2 to wake a queued writer,
// otherwise if the maximum number of reader locks was held signal gate1
// to wake a reader.
//
// To take a writer lock, block on gate1 while the write-entered flag is
// set, then set the write-entered flag to start queueing, then block on
// gate2 while the number of reader locks is non-zero.
// To release, unset the write-entered flag and signal gate1 to wake all
// blocked readers and writers.
//
// This means that when no reader locks are held readers and writers get
// equal priority. When one or more reader locks is held a writer gets
// priority and no more reader locks can be taken while the writer is
// queued.
// Only locked when accessing _M_state or waiting on condition variables.
mutex _M_mut;
// Used to block while write-entered is set or reader count at maximum.
condition_variable _M_gate1;
// Used to block queued writers while reader count is non-zero.
condition_variable _M_gate2;
// The write-entered flag and reader count.
unsigned _M_state;
static constexpr unsigned _S_write_entered
= 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1);
static constexpr unsigned _S_max_readers = ~_S_write_entered;
// Test whether the write-entered flag is set. _M_mut must be locked.
bool _M_write_entered() const { return _M_state & _S_write_entered; }
// The number of reader locks currently held. _M_mut must be locked.
unsigned _M_readers() const { return _M_state & _S_max_readers; }
public:
__shared_mutex_cv() : _M_state(0) {}
~__shared_mutex_cv()
{
__glibcxx_assert( _M_state == 0 );
}
__shared_mutex_cv(const __shared_mutex_cv&) = delete;
__shared_mutex_cv& operator=(const __shared_mutex_cv&) = delete;
// Exclusive ownership
void
lock()
{
unique_lock<mutex> __lk(_M_mut);
// Wait until we can set the write-entered flag.
_M_gate1.wait(__lk, [=]{ return !_M_write_entered(); });
_M_state |= _S_write_entered;
// Then wait until there are no more readers.
_M_gate2.wait(__lk, [=]{ return _M_readers() == 0; });
}
bool
try_lock()
{
unique_lock<mutex> __lk(_M_mut, try_to_lock);
if (__lk.owns_lock() && _M_state == 0)
{
_M_state = _S_write_entered;
return true;
}
return false;
}
void
unlock()
{
lock_guard<mutex> __lk(_M_mut);
__glibcxx_assert( _M_write_entered() );
_M_state = 0;
// call notify_all() while mutex is held so that another thread can't
// lock and unlock the mutex then destroy *this before we make the call.
_M_gate1.notify_all();
}
// Shared ownership
void
lock_shared()
{
unique_lock<mutex> __lk(_M_mut);
_M_gate1.wait(__lk, [=]{ return _M_state < _S_max_readers; });
++_M_state;
}
bool
try_lock_shared()
{
unique_lock<mutex> __lk(_M_mut, try_to_lock);
if (!__lk.owns_lock())
return false;
if (_M_state < _S_max_readers)
{
++_M_state;
return true;
}
return false;
}
void
unlock_shared()
{
lock_guard<mutex> __lk(_M_mut);
__glibcxx_assert( _M_readers() > 0 );
auto __prev = _M_state--;
if (_M_write_entered())
{
// Wake the queued writer if there are no more readers.
if (_M_readers() == 0)
_M_gate2.notify_one();
// No need to notify gate1 because we give priority to the queued
// writer, and that writer will eventually notify gate1 after it
// clears the write-entered flag.
}
else
{
// Wake any thread that was blocked on reader overflow.
if (__prev == _S_max_readers)
_M_gate1.notify_one();
}
}
};
#endif
#if __cplusplus > 201402L
/// The standard shared mutex type.
class shared_mutex
{
public:
shared_mutex() = default;
~shared_mutex() = default;
shared_mutex(const shared_mutex&) = delete;
shared_mutex& operator=(const shared_mutex&) = delete;
// Exclusive ownership
void lock() { _M_impl.lock(); }
bool try_lock() { return _M_impl.try_lock(); }
void unlock() { _M_impl.unlock(); }
// Shared ownership
void lock_shared() { _M_impl.lock_shared(); }
bool try_lock_shared() { return _M_impl.try_lock_shared(); }
void unlock_shared() { _M_impl.unlock_shared(); }
#if _GLIBCXX_USE_PTHREAD_RWLOCK_T
typedef void* native_handle_type;
native_handle_type native_handle() { return _M_impl.native_handle(); }
private:
__shared_mutex_pthread _M_impl;
#else
private:
__shared_mutex_cv _M_impl;
#endif
};
#endif // C++17
#if _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK
using __shared_timed_mutex_base = __shared_mutex_pthread;
#else
using __shared_timed_mutex_base = __shared_mutex_cv;
#endif
/// The standard shared timed mutex type.
class shared_timed_mutex
: private __shared_timed_mutex_base
{
using _Base = __shared_timed_mutex_base;
// Must use the same clock as condition_variable for __shared_mutex_cv.
typedef chrono::system_clock __clock_t;
public:
shared_timed_mutex() = default;
~shared_timed_mutex() = default;
shared_timed_mutex(const shared_timed_mutex&) = delete;
shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
// Exclusive ownership
void lock() { _Base::lock(); }
bool try_lock() { return _Base::try_lock(); }
void unlock() { _Base::unlock(); }
template<typename _Rep, typename _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
{
return try_lock_until(__clock_t::now() + __rel_time);
}
// Shared ownership
void lock_shared() { _Base::lock_shared(); }
bool try_lock_shared() { return _Base::try_lock_shared(); }
void unlock_shared() { _Base::unlock_shared(); }
template<typename _Rep, typename _Period>
bool
try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
{
return try_lock_shared_until(__clock_t::now() + __rel_time);
}
#if _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK
// Exclusive ownership
template<typename _Duration>
bool
try_lock_until(const chrono::time_point<__clock_t, _Duration>& __atime)
{
auto __s = chrono::time_point_cast<chrono::seconds>(__atime);
auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
__gthread_time_t __ts =
{
static_cast<std::time_t>(__s.time_since_epoch().count()),
static_cast<long>(__ns.count())
};
int __ret = pthread_rwlock_timedwrlock(&_M_rwlock, &__ts);
// On self-deadlock, we just fail to acquire the lock. Technically,
// the program violated the precondition.
if (__ret == ETIMEDOUT || __ret == EDEADLK)
return false;
// Errors not handled: EINVAL
__glibcxx_assert(__ret == 0);
return true;
}
template<typename _Clock, typename _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time)
{
// DR 887 - Sync unknown clock to known clock.
const typename _Clock::time_point __c_entry = _Clock::now();
const __clock_t::time_point __s_entry = __clock_t::now();
const auto __delta = __abs_time - __c_entry;
const auto __s_atime = __s_entry + __delta;
return try_lock_until(__s_atime);
}
// Shared ownership
template<typename _Duration>
bool
try_lock_shared_until(const chrono::time_point<__clock_t,
_Duration>& __atime)
{
auto __s = chrono::time_point_cast<chrono::seconds>(__atime);
auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
__gthread_time_t __ts =
{
static_cast<std::time_t>(__s.time_since_epoch().count()),
static_cast<long>(__ns.count())
};
int __ret;
// Unlike for lock(), we are not allowed to throw an exception so if
// the maximum number of read locks has been exceeded, or we would
// deadlock, we just try to acquire the lock again (and will time out
// eventually).
// In cases where we would exceed the maximum number of read locks
// throughout the whole time until the timeout, we will fail to
// acquire the lock even if it would be logically free; however, this
// is allowed by the standard, and we made a "strong effort"
// (see C++14 30.4.1.4p26).
// For cases where the implementation detects a deadlock we
// intentionally block and timeout so that an early return isn't
// mistaken for a spurious failure, which might help users realise
// there is a deadlock.
do
__ret = pthread_rwlock_timedrdlock(&_M_rwlock, &__ts);
while (__ret == EAGAIN || __ret == EDEADLK);
if (__ret == ETIMEDOUT)
return false;
// Errors not handled: EINVAL
__glibcxx_assert(__ret == 0);
return true;
}
template<typename _Clock, typename _Duration>
bool
try_lock_shared_until(const chrono::time_point<_Clock,
_Duration>& __abs_time)
{
// DR 887 - Sync unknown clock to known clock.
const typename _Clock::time_point __c_entry = _Clock::now();
const __clock_t::time_point __s_entry = __clock_t::now();
const auto __delta = __abs_time - __c_entry;
const auto __s_atime = __s_entry + __delta;
return try_lock_shared_until(__s_atime);
}
#else // ! (_GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK)
// Exclusive ownership
template<typename _Clock, typename _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time)
{
unique_lock<mutex> __lk(_M_mut);
if (!_M_gate1.wait_until(__lk, __abs_time,
[=]{ return !_M_write_entered(); }))
{
return false;
}
_M_state |= _S_write_entered;
if (!_M_gate2.wait_until(__lk, __abs_time,
[=]{ return _M_readers() == 0; }))
{
_M_state ^= _S_write_entered;
// Wake all threads blocked while the write-entered flag was set.
_M_gate1.notify_all();
return false;
}
return true;
}
// Shared ownership
template <typename _Clock, typename _Duration>
bool
try_lock_shared_until(const chrono::time_point<_Clock,
_Duration>& __abs_time)
{
unique_lock<mutex> __lk(_M_mut);
if (!_M_gate1.wait_until(__lk, __abs_time,
[=]{ return _M_state < _S_max_readers; }))
{
return false;
}
++_M_state;
return true;
}
#endif // _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK
};
#endif // _GLIBCXX_HAS_GTHREADS
/// shared_lock
template<typename _Mutex>
class shared_lock
{
public:
typedef _Mutex mutex_type;
// Shared locking
shared_lock() noexcept : _M_pm(nullptr), _M_owns(false) { }
explicit
shared_lock(mutex_type& __m)
: _M_pm(std::__addressof(__m)), _M_owns(true)
{ __m.lock_shared(); }
shared_lock(mutex_type& __m, defer_lock_t) noexcept
: _M_pm(std::__addressof(__m)), _M_owns(false) { }
shared_lock(mutex_type& __m, try_to_lock_t)
: _M_pm(std::__addressof(__m)), _M_owns(__m.try_lock_shared()) { }
shared_lock(mutex_type& __m, adopt_lock_t)
: _M_pm(std::__addressof(__m)), _M_owns(true) { }
template<typename _Clock, typename _Duration>
shared_lock(mutex_type& __m,
const chrono::time_point<_Clock, _Duration>& __abs_time)
: _M_pm(std::__addressof(__m)),
_M_owns(__m.try_lock_shared_until(__abs_time)) { }
template<typename _Rep, typename _Period>
shared_lock(mutex_type& __m,
const chrono::duration<_Rep, _Period>& __rel_time)
: _M_pm(std::__addressof(__m)),
_M_owns(__m.try_lock_shared_for(__rel_time)) { }
~shared_lock()
{
if (_M_owns)
_M_pm->unlock_shared();
}
shared_lock(shared_lock const&) = delete;
shared_lock& operator=(shared_lock const&) = delete;
shared_lock(shared_lock&& __sl) noexcept : shared_lock()
{ swap(__sl); }
shared_lock&
operator=(shared_lock&& __sl) noexcept
{
shared_lock(std::move(__sl)).swap(*this);
return *this;
}
void
lock()
{
_M_lockable();
_M_pm->lock_shared();
_M_owns = true;
}
bool
try_lock()
{
_M_lockable();
return _M_owns = _M_pm->try_lock_shared();
}
template<typename _Rep, typename _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
{
_M_lockable();
return _M_owns = _M_pm->try_lock_shared_for(__rel_time);
}
template<typename _Clock, typename _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time)
{
_M_lockable();
return _M_owns = _M_pm->try_lock_shared_until(__abs_time);
}
void
unlock()
{
if (!_M_owns)
__throw_system_error(int(errc::resource_deadlock_would_occur));
_M_pm->unlock_shared();
_M_owns = false;
}
// Setters
void
swap(shared_lock& __u) noexcept
{
std::swap(_M_pm, __u._M_pm);
std::swap(_M_owns, __u._M_owns);
}
mutex_type*
release() noexcept
{
_M_owns = false;
return std::exchange(_M_pm, nullptr);
}
// Getters
bool owns_lock() const noexcept { return _M_owns; }
explicit operator bool() const noexcept { return _M_owns; }
mutex_type* mutex() const noexcept { return _M_pm; }
private:
void
_M_lockable() const
{
if (_M_pm == nullptr)
__throw_system_error(int(errc::operation_not_permitted));
if (_M_owns)
__throw_system_error(int(errc::resource_deadlock_would_occur));
}
mutex_type* _M_pm;
bool _M_owns;
};
/// Swap specialization for shared_lock
template<typename _Mutex>
void
swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept
{ __x.swap(__y); }
#endif // _GLIBCXX_USE_C99_STDINT_TR1
// @} group mutexes
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // C++14
#endif // _GLIBCXX_SHARED_MUTEX
// <ctgmath> -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/ctgmath
* This is a Standard C++ Library header.
*/
#pragma GCC system_header
#ifndef _GLIBCXX_CTGMATH
#define _GLIBCXX_CTGMATH 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
# include <cmath>
extern "C++" {
# include <complex>
}
#endif
#endif
// <chrono> -*- C++ -*-
// Copyright (C) 2008-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/chrono
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_CHRONO
#define _GLIBCXX_CHRONO 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <ratio>
#include <type_traits>
#include <limits>
#include <ctime>
#include <bits/parse_numbers.h> // for literals support.
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup chrono Time
* @ingroup utilities
*
* Classes and functions for time.
* @{
*/
/** @namespace std::chrono
* @brief ISO C++ 2011 entities sub-namespace for time and date.
*/
namespace chrono
{
template<typename _Rep, typename _Period = ratio<1>>
struct duration;
template<typename _Clock, typename _Dur = typename _Clock::duration>
struct time_point;
}
// 20.11.4.3 specialization of common_type (for duration, sfinae-friendly)
template<typename _CT, typename _Period1, typename _Period2>
struct __duration_common_type_wrapper
{
private:
typedef __static_gcd<_Period1::num, _Period2::num> __gcd_num;
typedef __static_gcd<_Period1::den, _Period2::den> __gcd_den;
typedef typename _CT::type __cr;
typedef ratio<__gcd_num::value,
(_Period1::den / __gcd_den::value) * _Period2::den> __r;
public:
typedef __success_type<chrono::duration<__cr, __r>> type;
};
template<typename _Period1, typename _Period2>
struct __duration_common_type_wrapper<__failure_type, _Period1, _Period2>
{ typedef __failure_type type; };
template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2>
struct common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2>>
: public __duration_common_type_wrapper<typename __member_type_wrapper<
common_type<_Rep1, _Rep2>>::type, _Period1, _Period2>::type
{ };
// 20.11.4.3 specialization of common_type (for time_point, sfinae-friendly)
template<typename _CT, typename _Clock>
struct __timepoint_common_type_wrapper
{
typedef __success_type<chrono::time_point<_Clock, typename _CT::type>>
type;
};
template<typename _Clock>
struct __timepoint_common_type_wrapper<__failure_type, _Clock>
{ typedef __failure_type type; };
template<typename _Clock, typename _Duration1, typename _Duration2>
struct common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2>>
: public __timepoint_common_type_wrapper<typename __member_type_wrapper<
common_type<_Duration1, _Duration2>>::type, _Clock>::type
{ };
namespace chrono
{
// Primary template for duration_cast impl.
template<typename _ToDur, typename _CF, typename _CR,
bool _NumIsOne = false, bool _DenIsOne = false>
struct __duration_cast_impl
{
template<typename _Rep, typename _Period>
static constexpr _ToDur
__cast(const duration<_Rep, _Period>& __d)
{
typedef typename _ToDur::rep __to_rep;
return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
* static_cast<_CR>(_CF::num)
/ static_cast<_CR>(_CF::den)));
}
};
template<typename _ToDur, typename _CF, typename _CR>
struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
{
template<typename _Rep, typename _Period>
static constexpr _ToDur
__cast(const duration<_Rep, _Period>& __d)
{
typedef typename _ToDur::rep __to_rep;
return _ToDur(static_cast<__to_rep>(__d.count()));
}
};
template<typename _ToDur, typename _CF, typename _CR>
struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
{
template<typename _Rep, typename _Period>
static constexpr _ToDur
__cast(const duration<_Rep, _Period>& __d)
{
typedef typename _ToDur::rep __to_rep;
return _ToDur(static_cast<__to_rep>(
static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
}
};
template<typename _ToDur, typename _CF, typename _CR>
struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
{
template<typename _Rep, typename _Period>
static constexpr _ToDur
__cast(const duration<_Rep, _Period>& __d)
{
typedef typename _ToDur::rep __to_rep;
return _ToDur(static_cast<__to_rep>(
static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
}
};
template<typename _Tp>
struct __is_duration
: std::false_type
{ };
template<typename _Rep, typename _Period>
struct __is_duration<duration<_Rep, _Period>>
: std::true_type
{ };
template<typename _Tp>
using __enable_if_is_duration
= typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
template<typename _Tp>
using __disable_if_is_duration
= typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
/// duration_cast
template<typename _ToDur, typename _Rep, typename _Period>
constexpr __enable_if_is_duration<_ToDur>
duration_cast(const duration<_Rep, _Period>& __d)
{
typedef typename _ToDur::period __to_period;
typedef typename _ToDur::rep __to_rep;
typedef ratio_divide<_Period, __to_period> __cf;
typedef typename common_type<__to_rep, _Rep, intmax_t>::type
__cr;
typedef __duration_cast_impl<_ToDur, __cf, __cr,
__cf::num == 1, __cf::den == 1> __dc;
return __dc::__cast(__d);
}
/// treat_as_floating_point
template<typename _Rep>
struct treat_as_floating_point
: is_floating_point<_Rep>
{ };
#if __cplusplus > 201402L
template <typename _Rep>
inline constexpr bool treat_as_floating_point_v =
treat_as_floating_point<_Rep>::value;
#endif // C++17
#if __cplusplus >= 201703L
# define __cpp_lib_chrono 201611
template<typename _ToDur, typename _Rep, typename _Period>
constexpr __enable_if_is_duration<_ToDur>
floor(const duration<_Rep, _Period>& __d)
{
auto __to = chrono::duration_cast<_ToDur>(__d);
if (__to > __d)
return __to - _ToDur{1};
return __to;
}
template<typename _ToDur, typename _Rep, typename _Period>
constexpr __enable_if_is_duration<_ToDur>
ceil(const duration<_Rep, _Period>& __d)
{
auto __to = chrono::duration_cast<_ToDur>(__d);
if (__to < __d)
return __to + _ToDur{1};
return __to;
}
template <typename _ToDur, typename _Rep, typename _Period>
constexpr enable_if_t<
__and_<__is_duration<_ToDur>,
__not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
_ToDur>
round(const duration<_Rep, _Period>& __d)
{
_ToDur __t0 = chrono::floor<_ToDur>(__d);
_ToDur __t1 = __t0 + _ToDur{1};
auto __diff0 = __d - __t0;
auto __diff1 = __t1 - __d;
if (__diff0 == __diff1)
{
if (__t0.count() & 1)
return __t1;
return __t0;
}
else if (__diff0 < __diff1)
return __t0;
return __t1;
}
template<typename _Rep, typename _Period>
constexpr
enable_if_t<numeric_limits<_Rep>::is_signed, duration<_Rep, _Period>>
abs(duration<_Rep, _Period> __d)
{
if (__d >= __d.zero())
return __d;
return -__d;
}
#endif // C++17
/// duration_values
template<typename _Rep>
struct duration_values
{
static constexpr _Rep
zero() noexcept
{ return _Rep(0); }
static constexpr _Rep
max() noexcept
{ return numeric_limits<_Rep>::max(); }
static constexpr _Rep
min() noexcept
{ return numeric_limits<_Rep>::lowest(); }
};
template<typename _Tp>
struct __is_ratio
: std::false_type
{ };
template<intmax_t _Num, intmax_t _Den>
struct __is_ratio<ratio<_Num, _Den>>
: std::true_type
{ };
/// duration
template<typename _Rep, typename _Period>
struct duration
{
private:
template<typename _Rep2>
using __is_float = treat_as_floating_point<_Rep2>;
// _Period2 is an exact multiple of _Period
template<typename _Period2>
using __is_harmonic
= __bool_constant<ratio_divide<_Period2, _Period>::den == 1>;
public:
typedef _Rep rep;
typedef _Period period;
static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
static_assert(__is_ratio<_Period>::value,
"period must be a specialization of ratio");
static_assert(_Period::num > 0, "period must be positive");
// 20.11.5.1 construction / copy / destroy
constexpr duration() = default;
duration(const duration&) = default;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3050. Conversion specification problem in chrono::duration
template<typename _Rep2, typename = _Require<
is_convertible<const _Rep2&, rep>,
__or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
constexpr explicit duration(const _Rep2& __rep)
: __r(static_cast<rep>(__rep)) { }
template<typename _Rep2, typename _Period2, typename = _Require<
__or_<__is_float<rep>,
__and_<__is_harmonic<_Period2>,
__not_<__is_float<_Rep2>>>>>>
constexpr duration(const duration<_Rep2, _Period2>& __d)
: __r(duration_cast<duration>(__d).count()) { }
~duration() = default;
duration& operator=(const duration&) = default;
// 20.11.5.2 observer
constexpr rep
count() const
{ return __r; }
// 20.11.5.3 arithmetic
constexpr duration
operator+() const
{ return *this; }
constexpr duration
operator-() const
{ return duration(-__r); }
_GLIBCXX17_CONSTEXPR duration&
operator++()
{
++__r;
return *this;
}
_GLIBCXX17_CONSTEXPR duration
operator++(int)
{ return duration(__r++); }
_GLIBCXX17_CONSTEXPR duration&
operator--()
{
--__r;
return *this;
}
_GLIBCXX17_CONSTEXPR duration
operator--(int)
{ return duration(__r--); }
_GLIBCXX17_CONSTEXPR duration&
operator+=(const duration& __d)
{
__r += __d.count();
return *this;
}
_GLIBCXX17_CONSTEXPR duration&
operator-=(const duration& __d)
{
__r -= __d.count();
return *this;
}
_GLIBCXX17_CONSTEXPR duration&
operator*=(const rep& __rhs)
{
__r *= __rhs;
return *this;
}
_GLIBCXX17_CONSTEXPR duration&
operator/=(const rep& __rhs)
{
__r /= __rhs;
return *this;
}
// DR 934.
template<typename _Rep2 = rep>
_GLIBCXX17_CONSTEXPR
typename enable_if<!treat_as_floating_point<_Rep2>::value,
duration&>::type
operator%=(const rep& __rhs)
{
__r %= __rhs;
return *this;
}
template<typename _Rep2 = rep>
_GLIBCXX17_CONSTEXPR
typename enable_if<!treat_as_floating_point<_Rep2>::value,
duration&>::type
operator%=(const duration& __d)
{
__r %= __d.count();
return *this;
}
// 20.11.5.4 special values
static constexpr duration
zero() noexcept
{ return duration(duration_values<rep>::zero()); }
static constexpr duration
min() noexcept
{ return duration(duration_values<rep>::min()); }
static constexpr duration
max() noexcept
{ return duration(duration_values<rep>::max()); }
private:
rep __r;
};
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator+(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<__dur1,__dur2>::type __cd;
return __cd(__cd(__lhs).count() + __cd(__rhs).count());
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator-(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<__dur1,__dur2>::type __cd;
return __cd(__cd(__lhs).count() - __cd(__rhs).count());
}
// SFINAE helper to obtain common_type<_Rep1, _Rep2> only if _Rep2
// is implicitly convertible to it.
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3050. Conversion specification problem in chrono::duration constructor
template<typename _Rep1, typename _Rep2,
typename _CRep = typename common_type<_Rep1, _Rep2>::type>
using __common_rep_t = typename
enable_if<is_convertible<const _Rep2&, _CRep>::value, _CRep>::type;
template<typename _Rep1, typename _Period, typename _Rep2>
constexpr duration<__common_rep_t<_Rep1, _Rep2>, _Period>
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
__cd;
return __cd(__cd(__d).count() * __s);
}
template<typename _Rep1, typename _Rep2, typename _Period>
constexpr duration<__common_rep_t<_Rep2, _Rep1>, _Period>
operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
{ return __d * __s; }
template<typename _Rep1, typename _Period, typename _Rep2>
constexpr
duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
__cd;
return __cd(__cd(__d).count() / __s);
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<__dur1,__dur2>::type __cd;
return __cd(__lhs).count() / __cd(__rhs).count();
}
// DR 934.
template<typename _Rep1, typename _Period, typename _Rep2>
constexpr
duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
__cd;
return __cd(__cd(__d).count() % __s);
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator%(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<__dur1,__dur2>::type __cd;
return __cd(__cd(__lhs).count() % __cd(__rhs).count());
}
// comparisons
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr bool
operator==(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<__dur1,__dur2>::type __ct;
return __ct(__lhs).count() == __ct(__rhs).count();
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr bool
operator<(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<__dur1,__dur2>::type __ct;
return __ct(__lhs).count() < __ct(__rhs).count();
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr bool
operator!=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr bool
operator<=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr bool
operator>(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return __rhs < __lhs; }
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
constexpr bool
operator>=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs < __rhs); }
/// nanoseconds
typedef duration<int64_t, nano> nanoseconds;
/// microseconds
typedef duration<int64_t, micro> microseconds;
/// milliseconds
typedef duration<int64_t, milli> milliseconds;
/// seconds
typedef duration<int64_t> seconds;
/// minutes
typedef duration<int64_t, ratio< 60>> minutes;
/// hours
typedef duration<int64_t, ratio<3600>> hours;
/// time_point
template<typename _Clock, typename _Dur>
struct time_point
{
typedef _Clock clock;
typedef _Dur duration;
typedef typename duration::rep rep;
typedef typename duration::period period;
constexpr time_point() : __d(duration::zero())
{ }
constexpr explicit time_point(const duration& __dur)
: __d(__dur)
{ }
// conversions
template<typename _Dur2,
typename = _Require<is_convertible<_Dur2, _Dur>>>
constexpr time_point(const time_point<clock, _Dur2>& __t)
: __d(__t.time_since_epoch())
{ }
// observer
constexpr duration
time_since_epoch() const
{ return __d; }
// arithmetic
_GLIBCXX17_CONSTEXPR time_point&
operator+=(const duration& __dur)
{
__d += __dur;
return *this;
}
_GLIBCXX17_CONSTEXPR time_point&
operator-=(const duration& __dur)
{
__d -= __dur;
return *this;
}
// special values
static constexpr time_point
min() noexcept
{ return time_point(duration::min()); }
static constexpr time_point
max() noexcept
{ return time_point(duration::max()); }
private:
duration __d;
};
/// time_point_cast
template<typename _ToDur, typename _Clock, typename _Dur>
constexpr typename enable_if<__is_duration<_ToDur>::value,
time_point<_Clock, _ToDur>>::type
time_point_cast(const time_point<_Clock, _Dur>& __t)
{
typedef time_point<_Clock, _ToDur> __time_point;
return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
}
#if __cplusplus > 201402L
template<typename _ToDur, typename _Clock, typename _Dur>
constexpr
enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
floor(const time_point<_Clock, _Dur>& __tp)
{
return time_point<_Clock, _ToDur>{
chrono::floor<_ToDur>(__tp.time_since_epoch())};
}
template<typename _ToDur, typename _Clock, typename _Dur>
constexpr
enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
ceil(const time_point<_Clock, _Dur>& __tp)
{
return time_point<_Clock, _ToDur>{
chrono::ceil<_ToDur>(__tp.time_since_epoch())};
}
template<typename _ToDur, typename _Clock, typename _Dur>
constexpr enable_if_t<
__and_<__is_duration<_ToDur>,
__not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
time_point<_Clock, _ToDur>>
round(const time_point<_Clock, _Dur>& __tp)
{
return time_point<_Clock, _ToDur>{
chrono::round<_ToDur>(__tp.time_since_epoch())};
}
#endif // C++17
template<typename _Clock, typename _Dur1,
typename _Rep2, typename _Period2>
constexpr time_point<_Clock,
typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
operator+(const time_point<_Clock, _Dur1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<_Dur1,__dur2>::type __ct;
typedef time_point<_Clock, __ct> __time_point;
return __time_point(__lhs.time_since_epoch() + __rhs);
}
template<typename _Rep1, typename _Period1,
typename _Clock, typename _Dur2>
constexpr time_point<_Clock,
typename common_type<duration<_Rep1, _Period1>, _Dur2>::type>
operator+(const duration<_Rep1, _Period1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{
typedef duration<_Rep1, _Period1> __dur1;
typedef typename common_type<__dur1,_Dur2>::type __ct;
typedef time_point<_Clock, __ct> __time_point;
return __time_point(__rhs.time_since_epoch() + __lhs);
}
template<typename _Clock, typename _Dur1,
typename _Rep2, typename _Period2>
constexpr time_point<_Clock,
typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
operator-(const time_point<_Clock, _Dur1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef duration<_Rep2, _Period2> __dur2;
typedef typename common_type<_Dur1,__dur2>::type __ct;
typedef time_point<_Clock, __ct> __time_point;
return __time_point(__lhs.time_since_epoch() -__rhs);
}
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr typename common_type<_Dur1, _Dur2>::type
operator-(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr bool
operator==(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr bool
operator!=(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr bool
operator<(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr bool
operator<=(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr bool
operator>(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return __rhs < __lhs; }
template<typename _Clock, typename _Dur1, typename _Dur2>
constexpr bool
operator>=(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs)
{ return !(__lhs < __rhs); }
// Clocks.
// Why nanosecond resolution as the default?
// Why have std::system_clock always count in the highest
// resolution (ie nanoseconds), even if on some OSes the low 3
// or 9 decimal digits will be always zero? This allows later
// implementations to change the system_clock::now()
// implementation any time to provide better resolution without
// changing function signature or units.
// To support the (forward) evolution of the library's defined
// clocks, wrap inside inline namespace so that the current
// defintions of system_clock, steady_clock, and
// high_resolution_clock types are uniquely mangled. This way, new
// code can use the latests clocks, while the library can contain
// compatibility definitions for previous versions. At some
// point, when these clocks settle down, the inlined namespaces
// can be removed. XXX GLIBCXX_ABI Deprecated
inline namespace _V2 {
/**
* @brief System clock.
*
* Time returned represents wall time from the system-wide clock.
*/
struct system_clock
{
typedef chrono::nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock, duration> time_point;
static_assert(system_clock::duration::min()
< system_clock::duration::zero(),
"a clock's minimum duration cannot be less than its epoch");
static constexpr bool is_steady = false;
static time_point
now() noexcept;
// Map to C API
static std::time_t
to_time_t(const time_point& __t) noexcept
{
return std::time_t(duration_cast<chrono::seconds>
(__t.time_since_epoch()).count());
}
static time_point
from_time_t(std::time_t __t) noexcept
{
typedef chrono::time_point<system_clock, seconds> __from;
return time_point_cast<system_clock::duration>
(__from(chrono::seconds(__t)));
}
};
/**
* @brief Monotonic clock
*
* Time returned has the property of only increasing at a uniform rate.
*/
struct steady_clock
{
typedef chrono::nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static constexpr bool is_steady = true;
static time_point
now() noexcept;
};
/**
* @brief Highest-resolution clock
*
* This is the clock "with the shortest tick period." Alias to
* std::system_clock until higher-than-nanosecond definitions
* become feasible.
*/
using high_resolution_clock = system_clock;
} // end inline namespace _V2
} // namespace chrono
#if __cplusplus > 201103L
#define __cpp_lib_chrono_udls 201304
inline namespace literals
{
inline namespace chrono_literals
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
template<typename _Rep, unsigned long long _Val>
struct _Checked_integral_constant
: integral_constant<_Rep, static_cast<_Rep>(_Val)>
{
static_assert(_Checked_integral_constant::value >= 0
&& _Checked_integral_constant::value == _Val,
"literal value cannot be represented by duration type");
};
template<typename _Dur, char... _Digits>
constexpr _Dur __check_overflow()
{
using _Val = __parse_int::_Parse_int<_Digits...>;
using _Rep = typename _Dur::rep;
// TODO: should be simply integral_constant<_Rep, _Val::value>
// but GCC doesn't reject narrowing conversions to _Rep.
using _CheckedVal = _Checked_integral_constant<_Rep, _Val::value>;
return _Dur{_CheckedVal::value};
}
constexpr chrono::duration<long double, ratio<3600,1>>
operator""h(long double __hours)
{ return chrono::duration<long double, ratio<3600,1>>{__hours}; }
template <char... _Digits>
constexpr chrono::hours
operator""h()
{ return __check_overflow<chrono::hours, _Digits...>(); }
constexpr chrono::duration<long double, ratio<60,1>>
operator""min(long double __mins)
{ return chrono::duration<long double, ratio<60,1>>{__mins}; }
template <char... _Digits>
constexpr chrono::minutes
operator""min()
{ return __check_overflow<chrono::minutes, _Digits...>(); }
constexpr chrono::duration<long double>
operator""s(long double __secs)
{ return chrono::duration<long double>{__secs}; }
template <char... _Digits>
constexpr chrono::seconds
operator""s()
{ return __check_overflow<chrono::seconds, _Digits...>(); }
constexpr chrono::duration<long double, milli>
operator""ms(long double __msecs)
{ return chrono::duration<long double, milli>{__msecs}; }
template <char... _Digits>
constexpr chrono::milliseconds
operator""ms()
{ return __check_overflow<chrono::milliseconds, _Digits...>(); }
constexpr chrono::duration<long double, micro>
operator""us(long double __usecs)
{ return chrono::duration<long double, micro>{__usecs}; }
template <char... _Digits>
constexpr chrono::microseconds
operator""us()
{ return __check_overflow<chrono::microseconds, _Digits...>(); }
constexpr chrono::duration<long double, nano>
operator""ns(long double __nsecs)
{ return chrono::duration<long double, nano>{__nsecs}; }
template <char... _Digits>
constexpr chrono::nanoseconds
operator""ns()
{ return __check_overflow<chrono::nanoseconds, _Digits...>(); }
#pragma GCC diagnostic pop
} // inline namespace chrono_literals
} // inline namespace literals
namespace chrono
{
using namespace literals::chrono_literals;
} // namespace chrono
#endif // C++14
// @} group chrono
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif //_GLIBCXX_USE_C99_STDINT_TR1
#endif // C++11
#endif //_GLIBCXX_CHRONO
// <forward_list> -*- C++ -*-
// Copyright (C) 2008-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/forward_list
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_FORWARD_LIST
#define _GLIBCXX_FORWARD_LIST 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <bits/forward_list.h>
#include <bits/range_access.h>
#include <bits/forward_list.tcc>
#ifdef _GLIBCXX_DEBUG
# include <debug/forward_list>
#endif
#ifdef _GLIBCXX_PROFILE
# include <profile/forward_list>
#endif
#endif // C++11
#endif // _GLIBCXX_FORWARD_LIST
// Optimizations for random number extensions, x86 version -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/random.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/random}
*/
#ifndef _EXT_OPT_RANDOM_H
#define _EXT_OPT_RANDOM_H 1
#pragma GCC system_header
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifdef __SSE2__
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace {
template<size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4>
inline __m128i __sse2_recursion(__m128i __a, __m128i __b,
__m128i __c, __m128i __d)
{
__m128i __y = _mm_srli_epi32(__b, __sr1);
__m128i __z = _mm_srli_si128(__c, __sr2);
__m128i __v = _mm_slli_epi32(__d, __sl1);
__z = _mm_xor_si128(__z, __a);
__z = _mm_xor_si128(__z, __v);
__m128i __x = _mm_slli_si128(__a, __sl2);
__y = _mm_and_si128(__y, _mm_set_epi32(__msk4, __msk3, __msk2, __msk1));
__z = _mm_xor_si128(__z, __x);
return _mm_xor_si128(__z, __y);
}
}
#define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_GEN_READ 1
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
void simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
_M_gen_rand(void)
{
__m128i __r1 = _mm_load_si128(&_M_state[_M_nstate - 2]);
__m128i __r2 = _mm_load_si128(&_M_state[_M_nstate - 1]);
size_t __i;
for (__i = 0; __i < _M_nstate - __pos1; ++__i)
{
__m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4>
(_M_state[__i], _M_state[__i + __pos1], __r1, __r2);
_mm_store_si128(&_M_state[__i], __r);
__r1 = __r2;
__r2 = __r;
}
for (; __i < _M_nstate; ++__i)
{
__m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4>
(_M_state[__i], _M_state[__i + __pos1 - _M_nstate], __r1, __r2);
_mm_store_si128(&_M_state[__i], __r);
__r1 = __r2;
__r2 = __r;
}
_M_pos = 0;
}
#define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_OPERATOREQUAL 1
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
bool
operator==(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __lhs,
const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __rhs)
{
__m128i __res = _mm_cmpeq_epi8(__lhs._M_state[0], __rhs._M_state[0]);
for (size_t __i = 1; __i < __lhs._M_nstate; ++__i)
__res = _mm_and_si128(__res, _mm_cmpeq_epi8(__lhs._M_state[__i],
__rhs._M_state[__i]));
return (_mm_movemask_epi8(__res) == 0xffff
&& __lhs._M_pos == __rhs._M_pos);
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // __SSE2__
#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#endif // _EXT_OPT_RANDOM_H
// C++ includes used for precompiling extensions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file extc++.h
* This is an implementation file for a precompiled header.
*/
#if __cplusplus < 201103L
#include <bits/stdtr1c++.h>
#else
#include <bits/stdc++.h>
#endif
#include <ext/algorithm>
#if __cplusplus >= 201103L
# include <ext/aligned_buffer.h>
#endif
#include <ext/alloc_traits.h>
#include <ext/array_allocator.h>
#include <ext/atomicity.h>
#include <ext/bitmap_allocator.h>
#include <ext/cast.h>
#if __cplusplus >= 201103L
# include <ext/cmath>
#endif
#include <ext/concurrence.h>
#include <ext/debug_allocator.h>
#include <ext/extptr_allocator.h>
#include <ext/functional>
#include <ext/iterator>
#include <ext/malloc_allocator.h>
#include <ext/memory>
#include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/numeric>
#include <ext/numeric_traits.h>
#include <ext/pod_char_traits.h>
#include <ext/pointer.h>
#include <ext/pool_allocator.h>
#if __cplusplus >= 201103L
# include <ext/random>
#endif
#include <ext/rb_tree>
#include <ext/rope>
#include <ext/slist>
#include <ext/stdio_filebuf.h>
#include <ext/stdio_sync_filebuf.h>
#include <ext/throw_allocator.h>
#include <ext/typelist.h>
#include <ext/type_traits.h>
#include <ext/vstring.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/list_update_policy.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#ifdef _GLIBCXX_HAVE_ICONV
#include <ext/codecvt_specializations.h>
#include <ext/enc_filebuf.h>
#endif
// Underlying io library details -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++io.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ios}
*/
// c_io_stdio.h - Defines for using "C" stdio.h
#ifndef _GLIBCXX_CXX_IO_H
#define _GLIBCXX_CXX_IO_H 1
#include <cstdio>
#include <bits/gthr.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __gthread_mutex_t __c_lock;
// for basic_file.h
typedef FILE __c_file;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Specific definitions for generic platforms -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/error_constants.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{system_error}
*/
#ifndef _GLIBCXX_ERROR_CONSTANTS
#define _GLIBCXX_ERROR_CONSTANTS 1
#include <bits/c++config.h>
#include <cerrno>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
enum class errc
{
address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL,
already_connected = EISCONN,
argument_list_too_long = E2BIG,
argument_out_of_domain = EDOM,
bad_address = EFAULT,
bad_file_descriptor = EBADF,
#ifdef _GLIBCXX_HAVE_EBADMSG
bad_message = EBADMSG,
#endif
broken_pipe = EPIPE,
connection_aborted = ECONNABORTED,
connection_already_in_progress = EALREADY,
connection_refused = ECONNREFUSED,
connection_reset = ECONNRESET,
cross_device_link = EXDEV,
destination_address_required = EDESTADDRREQ,
device_or_resource_busy = EBUSY,
directory_not_empty = ENOTEMPTY,
executable_format_error = ENOEXEC,
file_exists = EEXIST,
file_too_large = EFBIG,
filename_too_long = ENAMETOOLONG,
function_not_supported = ENOSYS,
host_unreachable = EHOSTUNREACH,
#ifdef _GLIBCXX_HAVE_EIDRM
identifier_removed = EIDRM,
#endif
illegal_byte_sequence = EILSEQ,
inappropriate_io_control_operation = ENOTTY,
interrupted = EINTR,
invalid_argument = EINVAL,
invalid_seek = ESPIPE,
io_error = EIO,
is_a_directory = EISDIR,
message_size = EMSGSIZE,
network_down = ENETDOWN,
network_reset = ENETRESET,
network_unreachable = ENETUNREACH,
no_buffer_space = ENOBUFS,
no_child_process = ECHILD,
#ifdef _GLIBCXX_HAVE_ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
#ifdef _GLIBCXX_HAVE_ENODATA
no_message_available = ENODATA,
#endif
no_message = ENOMSG,
no_protocol_option = ENOPROTOOPT,
no_space_on_device = ENOSPC,
#ifdef _GLIBCXX_HAVE_ENOSR
no_stream_resources = ENOSR,
#endif
no_such_device_or_address = ENXIO,
no_such_device = ENODEV,
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
not_a_socket = ENOTSOCK,
#ifdef _GLIBCXX_HAVE_ENOSTR
not_a_stream = ENOSTR,
#endif
not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
#ifdef _GLIBCXX_HAVE_ENOTSUP
not_supported = ENOTSUP,
#endif
#ifdef _GLIBCXX_HAVE_ECANCELED
operation_canceled = ECANCELED,
#endif
operation_in_progress = EINPROGRESS,
operation_not_permitted = EPERM,
operation_not_supported = EOPNOTSUPP,
operation_would_block = EWOULDBLOCK,
#ifdef _GLIBCXX_HAVE_EOWNERDEAD
owner_dead = EOWNERDEAD,
#endif
permission_denied = EACCES,
#ifdef _GLIBCXX_HAVE_EPROTO
protocol_error = EPROTO,
#endif
protocol_not_supported = EPROTONOSUPPORT,
read_only_file_system = EROFS,
resource_deadlock_would_occur = EDEADLK,
resource_unavailable_try_again = EAGAIN,
result_out_of_range = ERANGE,
#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
state_not_recoverable = ENOTRECOVERABLE,
#endif
#ifdef _GLIBCXX_HAVE_ETIME
stream_timeout = ETIME,
#endif
#ifdef _GLIBCXX_HAVE_ETXTBSY
text_file_busy = ETXTBSY,
#endif
timed_out = ETIMEDOUT,
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK,
too_many_symbolic_link_levels = ELOOP,
#ifdef _GLIBCXX_HAVE_EOVERFLOW
value_too_large = EOVERFLOW,
#endif
wrong_protocol_type = EPROTOTYPE
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// std::messages implementation details, GNU version -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/messages_members.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.2.7.1.2 messages functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <libintl.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Non-virtual member functions.
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
: facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
_M_name_messages(_S_get_c_name())
{ }
template<typename _CharT>
messages<_CharT>::messages(__c_locale __cloc, const char* __s,
size_t __refs)
: facet(__refs), _M_c_locale_messages(0), _M_name_messages(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
const size_t __len = __builtin_strlen(__s) + 1;
char* __tmp = new char[__len];
__builtin_memcpy(__tmp, __s, __len);
_M_name_messages = __tmp;
}
else
_M_name_messages = _S_get_c_name();
// Last to avoid leaking memory if new throws.
_M_c_locale_messages = _S_clone_c_locale(__cloc);
}
template<typename _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
const char* __dir) const
{
bindtextdomain(__s.c_str(), __dir);
return this->do_open(__s, __loc);
}
// Virtual member functions.
template<typename _CharT>
messages<_CharT>::~messages()
{
if (_M_name_messages != _S_get_c_name())
delete [] _M_name_messages;
_S_destroy_c_locale(_M_c_locale_messages);
}
template<typename _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __s,
const locale&) const
{
// No error checking is done, assume the catalog exists and can
// be used.
textdomain(__s.c_str());
return 0;
}
template<typename _CharT>
void
messages<_CharT>::do_close(catalog) const
{ }
// messages_byname
template<typename _CharT>
messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
: messages<_CharT>(__refs)
{
if (this->_M_name_messages != locale::facet::_S_get_c_name())
{
delete [] this->_M_name_messages;
if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0)
{
const size_t __len = __builtin_strlen(__s) + 1;
char* __tmp = new char[__len];
__builtin_memcpy(__tmp, __s, __len);
this->_M_name_messages = __tmp;
}
else
this->_M_name_messages = locale::facet::_S_get_c_name();
}
if (__builtin_strcmp(__s, "C") != 0
&& __builtin_strcmp(__s, "POSIX") != 0)
{
this->_S_destroy_c_locale(this->_M_c_locale_messages);
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
}
}
//Specializations.
template<>
typename messages<char>::catalog
messages<char>::do_open(const basic_string<char>&,
const locale&) const;
template<>
void
messages<char>::do_close(catalog) const;
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
typename messages<wchar_t>::catalog
messages<wchar_t>::do_open(const basic_string<char>&,
const locale&) const;
template<>
void
messages<wchar_t>::do_close(catalog) const;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
#define _GLIBCXX_GCC_GTHR_POSIX_H
/* POSIX threads specific definitions.
Easy, since the interface is just one-to-one mapping. */
#define __GTHREADS 1
#define __GTHREADS_CXX0X 1
#include <pthread.h>
#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
|| !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
# include <unistd.h>
# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
# else
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
# endif
#endif
typedef pthread_t __gthread_t;
typedef pthread_key_t __gthread_key_t;
typedef pthread_once_t __gthread_once_t;
typedef pthread_mutex_t __gthread_mutex_t;
typedef pthread_mutex_t __gthread_recursive_mutex_t;
typedef pthread_cond_t __gthread_cond_t;
typedef struct timespec __gthread_time_t;
/* POSIX like conditional variables are supported. Please look at comments
in gthr.h for details. */
#define __GTHREAD_HAS_COND 1
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
#else
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
#define __GTHREAD_TIME_INIT {0,0}
#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
# undef __GTHREAD_MUTEX_INIT
#endif
#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
# undef __GTHREAD_RECURSIVE_MUTEX_INIT
# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#ifdef _GTHREAD_USE_COND_INIT_FUNC
# undef __GTHREAD_COND_INIT
# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
#endif
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
# ifndef __gthrw_pragma
# define __gthrw_pragma(pragma)
# endif
# define __gthrw2(name,name2,type) \
static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
__gthrw_pragma(weak type)
# define __gthrw_(name) __gthrw_ ## name
#else
# define __gthrw2(name,name2,type)
# define __gthrw_(name) name
#endif
/* Typically, __gthrw_foo is a weak reference to symbol foo. */
#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
__gthrw(pthread_once)
__gthrw(pthread_getspecific)
__gthrw(pthread_setspecific)
__gthrw(pthread_create)
__gthrw(pthread_join)
__gthrw(pthread_equal)
__gthrw(pthread_self)
__gthrw(pthread_detach)
#ifndef __BIONIC__
__gthrw(pthread_cancel)
#endif
__gthrw(sched_yield)
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
__gthrw(pthread_mutex_timedlock)
#endif
__gthrw(pthread_mutex_unlock)
__gthrw(pthread_mutex_init)
__gthrw(pthread_mutex_destroy)
__gthrw(pthread_cond_init)
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_signal)
__gthrw(pthread_cond_wait)
__gthrw(pthread_cond_timedwait)
__gthrw(pthread_cond_destroy)
__gthrw(pthread_key_create)
__gthrw(pthread_key_delete)
__gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_settype)
__gthrw(pthread_mutexattr_destroy)
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
/* Objective-C. */
__gthrw(pthread_exit)
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(sched_get_priority_max)
__gthrw(sched_get_priority_min)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
__gthrw(pthread_attr_destroy)
__gthrw(pthread_attr_init)
__gthrw(pthread_attr_setdetachstate)
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(pthread_getschedparam)
__gthrw(pthread_setschedparam)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _LIBOBJC || _LIBOBJC_WEAK */
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
-pthreads is not specified. The functions are dummies and most return an
error value. However pthread_once returns 0 without invoking the routine
it is passed so we cannot pretend that the interface is active if -pthreads
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
we need to play the usual game with weak symbols. On Solaris 10 and up, a
working interface is always exposed. On FreeBSD 6 and later, libc also
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
which means the alternate __gthread_active_p below cannot be used there. */
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
static volatile int __gthread_active = -1;
static void
__gthread_trigger (void)
{
__gthread_active = 1;
}
static inline int
__gthread_active_p (void)
{
static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
/* This test is not protected to avoid taking a lock on the main code
path so every update of __gthread_active in a threaded program must
be atomic with regard to the result of the test. */
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
if (__gthrw_(pthread_once))
{
/* If this really is a threaded program, then we must ensure that
__gthread_active has been set to 1 before exiting this block. */
__gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
__gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
__gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
}
/* Make sure we'll never enter this block again. */
if (__gthread_active < 0)
__gthread_active = 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* neither FreeBSD nor Solaris */
/* For a program to be multi-threaded the only thing that it certainly must
be using is pthread_create. However, there may be other libraries that
intercept pthread_create with their own definitions to wrap pthreads
functionality for some purpose. In those cases, pthread_create being
defined might not necessarily mean that libpthread is actually linked
in.
For the GNU C library, we can use a known internal name. This is always
available in the ABI, but no other library would define it. That is
ideal, since any public pthread function might be intercepted just as
pthread_create might be. __pthread_key_create is an "internal"
implementation symbol, but it is part of the public exported ABI. Also,
it's among the symbols that the static libpthread.a always links in
whenever pthread_create is used, so there is no danger of a false
negative result in any statically-linked, multi-threaded program.
For others, we choose pthread_cancel as a function that seems unlikely
to be redefined by an interceptor library. The bionic (Android) C
library does not provide pthread_cancel, so we do use pthread_create
there (and interceptor libraries lose). */
#ifdef __GLIBC__
__gthrw2(__gthrw_(__pthread_key_create),
__pthread_key_create,
pthread_key_create)
# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
#elif defined (__BIONIC__)
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
#else
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
#endif
static inline int
__gthread_active_p (void)
{
static void *const __gthread_active_ptr
= __extension__ (void *) >HR_ACTIVE_PROXY;
return __gthread_active_ptr != 0;
}
#endif /* FreeBSD or Solaris */
#else /* not __GXX_WEAK__ */
/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
calls in shared flavors of the HP-UX C library. Most of the stubs
have no functionality. The details are described in the "libc cumulative
patch" for each subversion of HP-UX 11. There are two special interfaces
provided for checking whether an application is linked to a shared pthread
library or not. However, these interfaces aren't available in early
libpthread libraries. We also need a test that works for archive
libraries. We can't use pthread_once as some libc versions call the
init function. We also can't use pthread_create or pthread_attr_init
as these create a thread and thereby prevent changing the default stack
size. The function pthread_default_stacksize_np is available in both
the archive and shared versions of libpthread. It can be used to
determine the default pthread stack size. There is a stub in some
shared libc versions which returns a zero size if pthreads are not
active. We provide an equivalent stub to handle cases where libc
doesn't provide one. */
#if defined(__hppa__) && defined(__hpux__)
static volatile int __gthread_active = -1;
static inline int
__gthread_active_p (void)
{
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
size_t __s;
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
pthread_default_stacksize_np (0, &__s);
__gthread_active = __s ? 1 : 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* not hppa-hpux */
static inline int
__gthread_active_p (void)
{
return 1;
}
#endif /* hppa-hpux */
#endif /* __GXX_WEAK__ */
#ifdef _LIBOBJC
/* This is the config.h file in libobjc/ */
#include <config.h>
#ifdef HAVE_SCHED_H
# include <sched.h>
#endif
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;
static pthread_attr_t _objc_thread_attribs;
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
static inline int
__gthread_objc_init_thread_system (void)
{
if (__gthread_active_p ())
{
/* Initialize the thread storage key. */
if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
{
/* The normal default detach state for threads is
* PTHREAD_CREATE_JOINABLE which causes threads to not die
* when you think they should. */
if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
&& __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
PTHREAD_CREATE_DETACHED) == 0)
return 0;
}
}
return -1;
}
/* Close the threads subsystem. */
static inline int
__gthread_objc_close_thread_system (void)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
&& __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
return 0;
return -1;
}
/* Backend thread functions */
/* Create a new thread of execution. */
static inline objc_thread_t
__gthread_objc_thread_detach (void (*func)(void *), void *arg)
{
objc_thread_t thread_id;
pthread_t new_thread_handle;
if (!__gthread_active_p ())
return NULL;
if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
(void *) func, arg)))
thread_id = (objc_thread_t) new_thread_handle;
else
thread_id = NULL;
return thread_id;
}
/* Set the current thread's priority. */
static inline int
__gthread_objc_thread_set_priority (int priority)
{
if (!__gthread_active_p ())
return -1;
else
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_t thread_id = __gthrw_(pthread_self) ();
int policy;
struct sched_param params;
int priority_min, priority_max;
if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0)
{
if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
return -1;
if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
return -1;
if (priority > priority_max)
priority = priority_max;
else if (priority < priority_min)
priority = priority_min;
params.sched_priority = priority;
/*
* The solaris 7 and several other man pages incorrectly state that
* this should be a pointer to policy but pthread.h is universally
* at odds with this.
*/
if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0)
return 0;
}
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return -1;
}
}
/* Return the current thread's priority. */
static inline int
__gthread_objc_thread_get_priority (void)
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
if (__gthread_active_p ())
{
int policy;
struct sched_param params;
if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0)
return params.sched_priority;
else
return -1;
}
else
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return OBJC_THREAD_INTERACTIVE_PRIORITY;
}
/* Yield our process time to another thread. */
static inline void
__gthread_objc_thread_yield (void)
{
if (__gthread_active_p ())
__gthrw_(sched_yield) ();
}
/* Terminate the current thread. */
static inline int
__gthread_objc_thread_exit (void)
{
if (__gthread_active_p ())
/* exit the thread */
__gthrw_(pthread_exit) (&__objc_thread_exit_status);
/* Failed if we reached here */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
static inline objc_thread_t
__gthread_objc_thread_id (void)
{
if (__gthread_active_p ())
return (objc_thread_t) __gthrw_(pthread_self) ();
else
return (objc_thread_t) 1;
}
/* Sets the thread's local storage pointer. */
static inline int
__gthread_objc_thread_set_data (void *value)
{
if (__gthread_active_p ())
return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
else
{
thread_local_storage = value;
return 0;
}
}
/* Returns the thread's local storage pointer. */
static inline void *
__gthread_objc_thread_get_data (void)
{
if (__gthread_active_p ())
return __gthrw_(pthread_getspecific) (_objc_thread_storage);
else
return thread_local_storage;
}
/* Backend mutex functions */
/* Allocate a mutex. */
static inline int
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
{
objc_free (mutex->backend);
mutex->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a mutex. */
static inline int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
int count;
/*
* Posix Threads specifically require that the thread be unlocked
* for __gthrw_(pthread_mutex_destroy) to work.
*/
do
{
count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
if (count < 0)
return -1;
}
while (count);
if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
return -1;
objc_free (mutex->backend);
mutex->backend = NULL;
}
return 0;
}
/* Grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_lock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Try to grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Unlock the mutex */
static inline int
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
static inline int
__gthread_objc_condition_allocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
condition->backend = objc_malloc (sizeof (pthread_cond_t));
if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
{
objc_free (condition->backend);
condition->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a condition. */
static inline int
__gthread_objc_condition_deallocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
return -1;
objc_free (condition->backend);
condition->backend = NULL;
}
return 0;
}
/* Wait on the condition */
static inline int
__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
(pthread_mutex_t *) mutex->backend);
else
return 0;
}
/* Wake up all threads waiting on this condition. */
static inline int
__gthread_objc_condition_broadcast (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
else
return 0;
}
/* Wake up one thread waiting on this condition. */
static inline int
__gthread_objc_condition_signal (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
else
return 0;
}
#else /* _LIBOBJC */
static inline int
__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
void *__args)
{
return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
}
static inline int
__gthread_join (__gthread_t __threadid, void **__value_ptr)
{
return __gthrw_(pthread_join) (__threadid, __value_ptr);
}
static inline int
__gthread_detach (__gthread_t __threadid)
{
return __gthrw_(pthread_detach) (__threadid);
}
static inline int
__gthread_equal (__gthread_t __t1, __gthread_t __t2)
{
return __gthrw_(pthread_equal) (__t1, __t2);
}
static inline __gthread_t
__gthread_self (void)
{
return __gthrw_(pthread_self) ();
}
static inline int
__gthread_yield (void)
{
return __gthrw_(sched_yield) ();
}
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(pthread_key_create) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return __gthrw_(pthread_key_delete) (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return __gthrw_(pthread_getspecific) (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(pthread_setspecific) (__key, __ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
__gthrw_(pthread_mutex_init) (__mutex, NULL);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
else
return 0;
}
#endif
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
|| defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_mutexattr_t __attr;
int __r;
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
PTHREAD_MUTEX_RECURSIVE);
if (!__r)
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
return __r;
}
return 0;
}
#endif
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (__mutex);
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
}
#endif
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (__mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
#ifdef _GTHREAD_USE_COND_INIT_FUNC
static inline void
__gthread_cond_init_function (__gthread_cond_t *__cond)
{
if (__gthread_active_p ())
__gthrw_(pthread_cond_init) (__cond, NULL);
}
#endif
static inline int
__gthread_cond_broadcast (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_broadcast) (__cond);
}
static inline int
__gthread_cond_signal (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_signal) (__cond);
}
static inline int
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
{
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
}
static inline int
__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
}
static inline int
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
__gthread_recursive_mutex_t *__mutex)
{
return __gthread_cond_wait (__cond, __mutex);
}
static inline int
__gthread_cond_destroy (__gthread_cond_t* __cond)
{
return __gthrw_(pthread_cond_destroy) (__cond);
}
#endif /* _LIBOBJC */
#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
// C++ includes used for precompiling TR1 -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdtr1c++.h
* This is an implementation file for a precompiled header.
*/
#include <bits/stdc++.h>
#include <tr1/array>
#include <tr1/cctype>
#include <tr1/cfenv>
#include <tr1/cfloat>
#include <tr1/cinttypes>
#include <tr1/climits>
#include <tr1/cmath>
#include <tr1/complex>
#include <tr1/cstdarg>
#include <tr1/cstdbool>
#include <tr1/cstdint>
#include <tr1/cstdio>
#include <tr1/cstdlib>
#include <tr1/ctgmath>
#include <tr1/ctime>
#include <tr1/cwchar>
#include <tr1/cwctype>
#include <tr1/functional>
#include <tr1/random>
#include <tr1/tuple>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#include <tr1/utility>
// Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 27.8 File-based streams
//
/** @file bits/basic_file.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ios}
*/
#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
#define _GLIBCXX_BASIC_FILE_STDIO_H 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/c++io.h> // for __c_lock and __c_file
#include <bits/move.h> // for swap
#include <ios>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Generic declaration.
template<typename _CharT>
class __basic_file;
// Specialization.
template<>
class __basic_file<char>
{
// Underlying data source/sink.
__c_file* _M_cfile;
// True iff we opened _M_cfile, and thus must close it ourselves.
bool _M_cfile_created;
public:
__basic_file(__c_lock* __lock = 0) throw ();
#if __cplusplus >= 201103L
__basic_file(__basic_file&& __rv, __c_lock* = 0) noexcept
: _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created)
{
__rv._M_cfile = nullptr;
__rv._M_cfile_created = false;
}
__basic_file& operator=(const __basic_file&) = delete;
__basic_file& operator=(__basic_file&&) = delete;
void
swap(__basic_file& __f) noexcept
{
std::swap(_M_cfile, __f._M_cfile);
std::swap(_M_cfile_created, __f._M_cfile_created);
}
#endif
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
__basic_file*
sys_open(__c_file* __file, ios_base::openmode);
__basic_file*
sys_open(int __fd, ios_base::openmode __mode) throw ();
__basic_file*
close();
_GLIBCXX_PURE bool
is_open() const throw ();
_GLIBCXX_PURE int
fd() throw ();
_GLIBCXX_PURE __c_file*
file() throw ();
~__basic_file();
streamsize
xsputn(const char* __s, streamsize __n);
streamsize
xsputn_2(const char* __s1, streamsize __n1,
const char* __s2, streamsize __n2);
streamsize
xsgetn(char* __s, streamsize __n);
streamoff
seekoff(streamoff __off, ios_base::seekdir __way) throw ();
int
sync();
streamsize
showmanyc();
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Optimizations for random number functions, x86 version -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/opt_random.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{random}
*/
#ifndef _BITS_OPT_RANDOM_H
#define _BITS_OPT_RANDOM_H 1
#ifdef __SSE3__
#include <pmmintrin.h>
#endif
#pragma GCC system_header
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __SSE3__
template<>
template<typename _UniformRandomNumberGenerator>
void
normal_distribution<double>::
__generate(typename normal_distribution<double>::result_type* __f,
typename normal_distribution<double>::result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
typedef uint64_t __uctype;
if (__f == __t)
return;
if (_M_saved_available)
{
_M_saved_available = false;
*__f++ = _M_saved * __param.stddev() + __param.mean();
if (__f == __t)
return;
}
constexpr uint64_t __maskval = 0xfffffffffffffull;
static const __m128i __mask = _mm_set1_epi64x(__maskval);
static const __m128i __two = _mm_set1_epi64x(0x4000000000000000ull);
static const __m128d __three = _mm_set1_pd(3.0);
const __m128d __av = _mm_set1_pd(__param.mean());
const __uctype __urngmin = __urng.min();
const __uctype __urngmax = __urng.max();
const __uctype __urngrange = __urngmax - __urngmin;
const __uctype __uerngrange = __urngrange + 1;
while (__f + 1 < __t)
{
double __le;
__m128d __x;
do
{
union
{
__m128i __i;
__m128d __d;
} __v;
if (__urngrange > __maskval)
{
if (__detail::_Power_of_2(__uerngrange))
__v.__i = _mm_and_si128(_mm_set_epi64x(__urng(),
__urng()),
__mask);
else
{
const __uctype __uerange = __maskval + 1;
const __uctype __scaling = __urngrange / __uerange;
const __uctype __past = __uerange * __scaling;
uint64_t __v1;
do
__v1 = __uctype(__urng()) - __urngmin;
while (__v1 >= __past);
__v1 /= __scaling;
uint64_t __v2;
do
__v2 = __uctype(__urng()) - __urngmin;
while (__v2 >= __past);
__v2 /= __scaling;
__v.__i = _mm_set_epi64x(__v1, __v2);
}
}
else if (__urngrange == __maskval)
__v.__i = _mm_set_epi64x(__urng(), __urng());
else if ((__urngrange + 2) * __urngrange >= __maskval
&& __detail::_Power_of_2(__uerngrange))
{
uint64_t __v1 = __urng() * __uerngrange + __urng();
uint64_t __v2 = __urng() * __uerngrange + __urng();
__v.__i = _mm_and_si128(_mm_set_epi64x(__v1, __v2),
__mask);
}
else
{
size_t __nrng = 2;
__uctype __high = __maskval / __uerngrange / __uerngrange;
while (__high > __uerngrange)
{
++__nrng;
__high /= __uerngrange;
}
const __uctype __highrange = __high + 1;
const __uctype __scaling = __urngrange / __highrange;
const __uctype __past = __highrange * __scaling;
__uctype __tmp;
uint64_t __v1;
do
{
do
__tmp = __uctype(__urng()) - __urngmin;
while (__tmp >= __past);
__v1 = __tmp / __scaling;
for (size_t __cnt = 0; __cnt < __nrng; ++__cnt)
{
__tmp = __v1;
__v1 *= __uerngrange;
__v1 += __uctype(__urng()) - __urngmin;
}
}
while (__v1 > __maskval || __v1 < __tmp);
uint64_t __v2;
do
{
do
__tmp = __uctype(__urng()) - __urngmin;
while (__tmp >= __past);
__v2 = __tmp / __scaling;
for (size_t __cnt = 0; __cnt < __nrng; ++__cnt)
{
__tmp = __v2;
__v2 *= __uerngrange;
__v2 += __uctype(__urng()) - __urngmin;
}
}
while (__v2 > __maskval || __v2 < __tmp);
__v.__i = _mm_set_epi64x(__v1, __v2);
}
__v.__i = _mm_or_si128(__v.__i, __two);
__x = _mm_sub_pd(__v.__d, __three);
__m128d __m = _mm_mul_pd(__x, __x);
__le = _mm_cvtsd_f64(_mm_hadd_pd (__m, __m));
}
while (__le == 0.0 || __le >= 1.0);
double __mult = (std::sqrt(-2.0 * std::log(__le) / __le)
* __param.stddev());
__x = _mm_add_pd(_mm_mul_pd(__x, _mm_set1_pd(__mult)), __av);
_mm_storeu_pd(__f, __x);
__f += 2;
}
if (__f != __t)
{
result_type __x, __y, __r2;
__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
do
{
__x = result_type(2.0) * __aurng() - 1.0;
__y = result_type(2.0) * __aurng() - 1.0;
__r2 = __x * __x + __y * __y;
}
while (__r2 > 1.0 || __r2 == 0.0);
const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);
_M_saved = __x * __mult;
_M_saved_available = true;
*__f = __y * __mult * __param.stddev() + __param.mean();
}
}
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // _BITS_OPT_RANDOM_H
// Base to std::allocator -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++allocator.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{memory}
*/
#ifndef _GLIBCXX_CXX_ALLOCATOR_H
#define _GLIBCXX_CXX_ALLOCATOR_H 1
#include <ext/new_allocator.h>
#if __cplusplus >= 201103L
namespace std
{
/**
* @brief An alias to the base class for std::allocator.
* @ingroup allocators
*
* Used to set the std::allocator base class to
* __gnu_cxx::new_allocator.
*
* @tparam _Tp Type of allocated object.
*/
template<typename _Tp>
using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
}
#else
// Define new_allocator as the base class to std::allocator.
# define __allocator_base __gnu_cxx::new_allocator
#endif
#if defined(__SANITIZE_ADDRESS__) && !defined(_GLIBCXX_SANITIZE_STD_ALLOCATOR)
# define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1
#endif
#endif
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_SINGLE_H
#define _GLIBCXX_GCC_GTHR_SINGLE_H
/* Just provide compatibility for mutex handling. */
typedef int __gthread_key_t;
typedef int __gthread_once_t;
typedef int __gthread_mutex_t;
typedef int __gthread_recursive_mutex_t;
#define __GTHREAD_ONCE_INIT 0
#define __GTHREAD_MUTEX_INIT 0
#define __GTHREAD_MUTEX_INIT_FUNCTION(mx) do {} while (0)
#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
#define _GLIBCXX_UNUSED __attribute__((__unused__))
#ifdef _LIBOBJC
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
static inline int
__gthread_objc_init_thread_system (void)
{
/* No thread support available */
return -1;
}
/* Close the threads subsystem. */
static inline int
__gthread_objc_close_thread_system (void)
{
/* No thread support available */
return -1;
}
/* Backend thread functions */
/* Create a new thread of execution. */
static inline objc_thread_t
__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
{
/* No thread support available */
return NULL;
}
/* Set the current thread's priority. */
static inline int
__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
{
/* No thread support available */
return -1;
}
/* Return the current thread's priority. */
static inline int
__gthread_objc_thread_get_priority (void)
{
return OBJC_THREAD_INTERACTIVE_PRIORITY;
}
/* Yield our process time to another thread. */
static inline void
__gthread_objc_thread_yield (void)
{
return;
}
/* Terminate the current thread. */
static inline int
__gthread_objc_thread_exit (void)
{
/* No thread support available */
/* Should we really exit the program */
/* exit (&__objc_thread_exit_status); */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
static inline objc_thread_t
__gthread_objc_thread_id (void)
{
/* No thread support, use 1. */
return (objc_thread_t) 1;
}
/* Sets the thread's local storage pointer. */
static inline int
__gthread_objc_thread_set_data (void *value)
{
thread_local_storage = value;
return 0;
}
/* Returns the thread's local storage pointer. */
static inline void *
__gthread_objc_thread_get_data (void)
{
return thread_local_storage;
}
/* Backend mutex functions */
/* Allocate a mutex. */
static inline int
__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Deallocate a mutex. */
static inline int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
/* There can only be one thread, so we always get the lock */
return 0;
}
/* Try to grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
/* There can only be one thread, so we always get the lock */
return 0;
}
/* Unlock the mutex */
static inline int
__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
static inline int
__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
/* Deallocate a condition. */
static inline int
__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
/* Wait on the condition */
static inline int
__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Wake up all threads waiting on this condition. */
static inline int
__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
/* Wake up one thread waiting on this condition. */
static inline int
__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
#else /* _LIBOBJC */
static inline int
__gthread_active_p (void)
{
return 0;
}
static inline int
__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
{
return 0;
}
static inline int _GLIBCXX_UNUSED
__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
{
return 0;
}
static int _GLIBCXX_UNUSED
__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
{
return 0;
}
static inline void *
__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (__mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
#endif /* _LIBOBJC */
#undef _GLIBCXX_UNUSED
#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
// Specific definitions for generic platforms -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/cpu_defines.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_CPU_DEFINES
#define _GLIBCXX_CPU_DEFINES 1
#endif
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
// 17.4.1.2 Headers
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cuchar>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif
#if __cplusplus >= 201703L
#include <charconv>
#include <filesystem>
#endif
/* Threads compatibility routines for libgcc2. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_H
#define _GLIBCXX_GCC_GTHR_H
#ifndef _GLIBCXX_HIDE_EXPORTS
#pragma GCC visibility push(default)
#endif
/* If this file is compiled with threads support, it must
#define __GTHREADS 1
to indicate that threads support is present. Also it has define
function
int __gthread_active_p ()
that returns 1 if thread system is active, 0 if not.
The threads interface must define the following types:
__gthread_key_t
__gthread_once_t
__gthread_mutex_t
__gthread_recursive_mutex_t
The threads interface must define the following macros:
__GTHREAD_ONCE_INIT
to initialize __gthread_once_t
__GTHREAD_MUTEX_INIT
to initialize __gthread_mutex_t to get a fast
non-recursive mutex.
__GTHREAD_MUTEX_INIT_FUNCTION
to initialize __gthread_mutex_t to get a fast
non-recursive mutex.
Define this to a function which looks like this:
void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
Some systems can't initialize a mutex without a
function call. Don't define __GTHREAD_MUTEX_INIT in this case.
__GTHREAD_RECURSIVE_MUTEX_INIT
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
as above, but for a recursive mutex.
The threads interface must define the following static functions:
int __gthread_once (__gthread_once_t *once, void (*func) ())
int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
int __gthread_key_delete (__gthread_key_t key)
void *__gthread_getspecific (__gthread_key_t key)
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
int __gthread_mutex_lock (__gthread_mutex_t *mutex);
int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
The following are supported in POSIX threads only. They are required to
fix a deadlock in static initialization inside libsupc++. The header file
gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
features are supported.
Types:
__gthread_cond_t
Macros:
__GTHREAD_COND_INIT
__GTHREAD_COND_INIT_FUNCTION
Interface:
int __gthread_cond_broadcast (__gthread_cond_t *cond);
int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
__gthread_recursive_mutex_t *mutex);
All functions returning int should return zero on success or the error
number. If the operation is not supported, -1 is returned.
If the following are also defined, you should
#define __GTHREADS_CXX0X 1
to enable the c++0x thread library.
Types:
__gthread_t
__gthread_time_t
Interface:
int __gthread_create (__gthread_t *thread, void *(*func) (void*),
void *args);
int __gthread_join (__gthread_t thread, void **value_ptr);
int __gthread_detach (__gthread_t thread);
int __gthread_equal (__gthread_t t1, __gthread_t t2);
__gthread_t __gthread_self (void);
int __gthread_yield (void);
int __gthread_mutex_timedlock (__gthread_mutex_t *m,
const __gthread_time_t *abs_timeout);
int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
const __gthread_time_t *abs_time);
int __gthread_cond_signal (__gthread_cond_t *cond);
int __gthread_cond_timedwait (__gthread_cond_t *cond,
__gthread_mutex_t *mutex,
const __gthread_time_t *abs_timeout);
*/
#if __GXX_WEAK__
/* The pe-coff weak support isn't fully compatible to ELF's weak.
For static libraries it might would work, but as we need to deal
with shared versions too, we disable it for mingw-targets. */
#ifdef __MINGW32__
#undef _GLIBCXX_GTHREAD_USE_WEAK
#define _GLIBCXX_GTHREAD_USE_WEAK 0
#endif
#ifndef _GLIBCXX_GTHREAD_USE_WEAK
#define _GLIBCXX_GTHREAD_USE_WEAK 1
#endif
#endif
#include <bits/gthr-default.h>
#ifndef _GLIBCXX_HIDE_EXPORTS
#pragma GCC visibility pop
#endif
#endif /* ! _GLIBCXX_GCC_GTHR_H */
// Wrapper for underlying C-language localization -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++locale.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.8 Standard locale categories.
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#ifndef _GLIBCXX_CXX_LOCALE_H
#define _GLIBCXX_CXX_LOCALE_H 1
#pragma GCC system_header
#include <clocale>
#define _GLIBCXX_C_LOCALE_GNU 1
#define _GLIBCXX_NUM_CATEGORIES 6
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
extern "C" __typeof(uselocale) __uselocale;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __locale_t __c_locale;
// Convert numeric value of type double and long double to string and
// return length of string. If vsnprintf is available use it, otherwise
// fall back to the unsafe vsprintf which, in general, can be dangerous
// and should be avoided.
inline int
__convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)),
char* __out,
const int __size __attribute__ ((__unused__)),
const char* __fmt, ...)
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
char* __old = std::setlocale(LC_NUMERIC, 0);
char* __sav = 0;
if (__builtin_strcmp(__old, "C"))
{
const size_t __len = __builtin_strlen(__old) + 1;
__sav = new char[__len];
__builtin_memcpy(__sav, __old, __len);
std::setlocale(LC_NUMERIC, "C");
}
#endif
__builtin_va_list __args;
__builtin_va_start(__args, __fmt);
#if _GLIBCXX_USE_C99_STDIO
const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
#else
const int __ret = __builtin_vsprintf(__out, __fmt, __args);
#endif
__builtin_va_end(__args);
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__gnu_cxx::__uselocale(__old);
#else
if (__sav)
{
std::setlocale(LC_NUMERIC, __sav);
delete [] __sav;
}
#endif
return __ret;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Control various target specific ABI tweaks. Generic version.
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/cxxabi_tweaks.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{cxxabi.h}
*/
#ifndef _CXXABI_TWEAKS_H
#define _CXXABI_TWEAKS_H 1
#ifdef __cplusplus
namespace __cxxabiv1
{
extern "C"
{
#endif
// The generic ABI uses the first byte of a 64-bit guard variable.
#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
__extension__ typedef int __guard __attribute__((mode (__DI__)));
// __cxa_vec_ctor has void return type.
typedef void __cxa_vec_ctor_return_type;
#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
// Constructors and destructors do not return a value.
typedef void __cxa_cdtor_return_type;
#ifdef __cplusplus
}
} // namespace __cxxabiv1
#endif
#endif
// Low-level type for atomic operations -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file atomic_word.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_ATOMIC_WORD_H
#define _GLIBCXX_ATOMIC_WORD_H 1
typedef int _Atomic_word;
// This is a memory order acquire fence.
#define _GLIBCXX_READ_MEM_BARRIER __atomic_thread_fence (__ATOMIC_ACQUIRE)
// This is a memory order release fence.
#define _GLIBCXX_WRITE_MEM_BARRIER __atomic_thread_fence (__ATOMIC_RELEASE)
#endif
// Predefined symbols and macros -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++config.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_CXX_CONFIG_H
#define _GLIBCXX_CXX_CONFIG_H 1
// The major release number for the GCC release the C++ library belongs to.
#define _GLIBCXX_RELEASE 8
// The datestamp of the C++ library in compressed ISO date format.
#define __GLIBCXX__ 20210514
// Macros for various attributes.
// _GLIBCXX_PURE
// _GLIBCXX_CONST
// _GLIBCXX_NORETURN
// _GLIBCXX_NOTHROW
// _GLIBCXX_VISIBILITY
#ifndef _GLIBCXX_PURE
# define _GLIBCXX_PURE __attribute__ ((__pure__))
#endif
#ifndef _GLIBCXX_CONST
# define _GLIBCXX_CONST __attribute__ ((__const__))
#endif
#ifndef _GLIBCXX_NORETURN
# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
#endif
// See below for C++
#ifndef _GLIBCXX_NOTHROW
# ifndef __cplusplus
# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
# endif
#endif
// Macros for visibility attributes.
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
// _GLIBCXX_VISIBILITY
# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
#else
// If this is not supplied by the OS-specific or CPU-specific
// headers included below, it will be defined to an empty default.
# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
#endif
// Macros for deprecated attributes.
// _GLIBCXX_USE_DEPRECATED
// _GLIBCXX_DEPRECATED
// _GLIBCXX17_DEPRECATED
#ifndef _GLIBCXX_USE_DEPRECATED
# define _GLIBCXX_USE_DEPRECATED 1
#endif
#if defined(__DEPRECATED) && (__cplusplus >= 201103L)
# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
#else
# define _GLIBCXX_DEPRECATED
#endif
#if defined(__DEPRECATED) && (__cplusplus >= 201703L)
# define _GLIBCXX17_DEPRECATED [[__deprecated__]]
#else
# define _GLIBCXX17_DEPRECATED
#endif
// Macros for ABI tag attributes.
#ifndef _GLIBCXX_ABI_TAG_CXX11
# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
#endif
// Macro to warn about unused results.
#if __cplusplus >= 201703L
# define _GLIBCXX_NODISCARD [[__nodiscard__]]
#else
# define _GLIBCXX_NODISCARD
#endif
#if __cplusplus
// Macro for constexpr, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_CONSTEXPR
# if __cplusplus >= 201103L
# define _GLIBCXX_CONSTEXPR constexpr
# define _GLIBCXX_USE_CONSTEXPR constexpr
# else
# define _GLIBCXX_CONSTEXPR
# define _GLIBCXX_USE_CONSTEXPR const
# endif
#endif
#ifndef _GLIBCXX14_CONSTEXPR
# if __cplusplus >= 201402L
# define _GLIBCXX14_CONSTEXPR constexpr
# else
# define _GLIBCXX14_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX17_CONSTEXPR
# if __cplusplus > 201402L
# define _GLIBCXX17_CONSTEXPR constexpr
# else
# define _GLIBCXX17_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX17_INLINE
# if __cplusplus > 201402L
# define _GLIBCXX17_INLINE inline
# else
# define _GLIBCXX17_INLINE
# endif
#endif
// Macro for noexcept, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_NOEXCEPT
# if __cplusplus >= 201103L
# define _GLIBCXX_NOEXCEPT noexcept
# define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND)
# define _GLIBCXX_USE_NOEXCEPT noexcept
# define _GLIBCXX_THROW(_EXC)
# else
# define _GLIBCXX_NOEXCEPT
# define _GLIBCXX_NOEXCEPT_IF(_COND)
# define _GLIBCXX_USE_NOEXCEPT throw()
# define _GLIBCXX_THROW(_EXC) throw(_EXC)
# endif
#endif
#ifndef _GLIBCXX_NOTHROW
# define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT
#endif
#ifndef _GLIBCXX_THROW_OR_ABORT
# if __cpp_exceptions
# define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC))
# else
# define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort())
# endif
#endif
#if __cpp_noexcept_function_type
#define _GLIBCXX_NOEXCEPT_PARM , bool _NE
#define _GLIBCXX_NOEXCEPT_QUAL noexcept (_NE)
#else
#define _GLIBCXX_NOEXCEPT_PARM
#define _GLIBCXX_NOEXCEPT_QUAL
#endif
// Macro for extern template, ie controlling template linkage via use
// of extern keyword on template declaration. As documented in the g++
// manual, it inhibits all implicit instantiations and is used
// throughout the library to avoid multiple weak definitions for
// required types that are already explicitly instantiated in the
// library binary. This substantially reduces the binary size of
// resulting executables.
// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
// templates only in basic_string, thus activating its debug-mode
// checks even at -O0.
# define _GLIBCXX_EXTERN_TEMPLATE 1
/*
Outline of libstdc++ namespaces.
namespace std
{
namespace __debug { }
namespace __parallel { }
namespace __profile { }
namespace __cxx1998 { }
namespace __detail {
namespace __variant { } // C++17
}
namespace rel_ops { }
namespace tr1
{
namespace placeholders { }
namespace regex_constants { }
namespace __detail { }
}
namespace tr2 { }
namespace decimal { }
namespace chrono { } // C++11
namespace placeholders { } // C++11
namespace regex_constants { } // C++11
namespace this_thread { } // C++11
inline namespace literals { // C++14
inline namespace chrono_literals { } // C++14
inline namespace complex_literals { } // C++14
inline namespace string_literals { } // C++14
inline namespace string_view_literals { } // C++17
}
}
namespace abi { }
namespace __gnu_cxx
{
namespace __detail { }
}
For full details see:
http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
*/
namespace std
{
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#if __cplusplus >= 201103L
typedef decltype(nullptr) nullptr_t;
#endif
}
# define _GLIBCXX_USE_DUAL_ABI 1
#if ! _GLIBCXX_USE_DUAL_ABI
// Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI
# undef _GLIBCXX_USE_CXX11_ABI
#endif
#ifndef _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#if _GLIBCXX_USE_CXX11_ABI
namespace std
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
namespace __gnu_cxx
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
# define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
# define _GLIBCXX_END_NAMESPACE_CXX11 }
# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11
#else
# define _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_CXX11
# define _GLIBCXX_DEFAULT_ABI_TAG
#endif
// Defined if inline namespaces are used for versioning.
# define _GLIBCXX_INLINE_VERSION 0
// Inline namespace for symbol versioning.
#if _GLIBCXX_INLINE_VERSION
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 {
# define _GLIBCXX_END_NAMESPACE_VERSION }
namespace std
{
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201402L
inline namespace literals {
inline namespace chrono_literals { }
inline namespace complex_literals { }
inline namespace string_literals { }
#if __cplusplus > 201402L
inline namespace string_view_literals { }
#endif // C++17
}
#endif // C++14
_GLIBCXX_END_NAMESPACE_VERSION
}
namespace __gnu_cxx
{
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
#else
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
# define _GLIBCXX_END_NAMESPACE_VERSION
#endif
// Inline namespaces for special modes: debug, parallel, profile.
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
|| defined(_GLIBCXX_PROFILE)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Non-inline namespace for components replaced by alternates in active mode.
namespace __cxx1998
{
# if _GLIBCXX_USE_CXX11_ABI
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
# endif
}
_GLIBCXX_END_NAMESPACE_VERSION
// Inline namespace for debug mode.
# ifdef _GLIBCXX_DEBUG
inline namespace __debug { }
# endif
// Inline namespaces for parallel mode.
# ifdef _GLIBCXX_PARALLEL
inline namespace __parallel { }
# endif
// Inline namespaces for profile mode
# ifdef _GLIBCXX_PROFILE
inline namespace __profile { }
# endif
}
// Check for invalid usage and unsupported mixed-mode use.
# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
# error illegal use of multiple inlined namespaces
# endif
# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
# error illegal use of multiple inlined namespaces
# endif
# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
# error illegal use of multiple inlined namespaces
# endif
// Check for invalid use due to lack for weak symbols.
# if __NO_INLINE__ && !__GXX_WEAK__
# warning currently using inlined namespace mode which may fail \
without inlining due to lack of weak symbols
# endif
#endif
// Macros for namespace scope. Either namespace std:: or the name
// of some nested namespace within it corresponding to the active mode.
// _GLIBCXX_STD_A
// _GLIBCXX_STD_C
//
// Macros for opening/closing conditional namespaces.
// _GLIBCXX_BEGIN_NAMESPACE_ALGO
// _GLIBCXX_END_NAMESPACE_ALGO
// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// _GLIBCXX_END_NAMESPACE_CONTAINER
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
# define _GLIBCXX_STD_C __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
namespace _GLIBCXX_STD_C {
# define _GLIBCXX_END_NAMESPACE_CONTAINER }
#else
# define _GLIBCXX_STD_C std
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
# define _GLIBCXX_END_NAMESPACE_CONTAINER
#endif
#ifdef _GLIBCXX_PARALLEL
# define _GLIBCXX_STD_A __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
namespace _GLIBCXX_STD_A {
# define _GLIBCXX_END_NAMESPACE_ALGO }
#else
# define _GLIBCXX_STD_A std
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
# define _GLIBCXX_END_NAMESPACE_ALGO
#endif
// GLIBCXX_ABI Deprecated
// Define if compatibility should be provided for -mlong-double-64.
#undef _GLIBCXX_LONG_DOUBLE_COMPAT
// Inline namespace for long double 128 mode.
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
namespace std
{
inline namespace __gnu_cxx_ldbl128 { }
}
# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
# define _GLIBCXX_END_NAMESPACE_LDBL }
#else
# define _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL
#endif
#if _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11
#else
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL
#endif
// Debug Mode implies checking assertions.
#if defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_ASSERTIONS)
# define _GLIBCXX_ASSERTIONS 1
#endif
// Disable std::string explicit instantiation declarations in order to assert.
#ifdef _GLIBCXX_ASSERTIONS
# undef _GLIBCXX_EXTERN_TEMPLATE
# define _GLIBCXX_EXTERN_TEMPLATE -1
#endif
// Assert.
#if defined(_GLIBCXX_ASSERTIONS) \
|| defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS)
namespace std
{
// Avoid the use of assert, because we're trying to keep the <cassert>
// include out of the mix.
inline void
__replacement_assert(const char* __file, int __line,
const char* __function, const char* __condition)
{
__builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
__function, __condition);
__builtin_abort();
}
}
#define __glibcxx_assert_impl(_Condition) \
do \
{ \
if (! (_Condition)) \
std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
#_Condition); \
} while (false)
#endif
#if defined(_GLIBCXX_ASSERTIONS)
# define __glibcxx_assert(_Condition) __glibcxx_assert_impl(_Condition)
#else
# define __glibcxx_assert(_Condition)
#endif
// Macros for race detectors.
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
// atomic (lock-free) synchronization to race detectors:
// the race detector will infer a happens-before arc from the former to the
// latter when they share the same argument pointer.
//
// The most frequent use case for these macros (and the only case in the
// current implementation of the library) is atomic reference counting:
// void _M_remove_reference()
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
// _M_destroy(__a);
// }
// }
// The annotations in this example tell the race detector that all memory
// accesses occurred when the refcount was positive do not race with
// memory accesses which occurred after the refcount became zero.
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
#endif
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
#endif
// Macros for C linkage: define extern "C" linkage only when using C++.
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
# define _GLIBCXX_END_EXTERN_C }
# define _GLIBCXX_USE_ALLOCATOR_NEW 1
#else // !__cplusplus
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
#endif
// First includes.
// Pick up any OS-specific definitions.
#include <bits/os_defines.h>
// Pick up any CPU-specific definitions.
#include <bits/cpu_defines.h>
// If platform uses neither visibility nor psuedo-visibility,
// specify empty default for namespace annotation macros.
#ifndef _GLIBCXX_PSEUDO_VISIBILITY
# define _GLIBCXX_PSEUDO_VISIBILITY(V)
#endif
// Certain function definitions that are meant to be overridable from
// user code are decorated with this macro. For some targets, this
// macro causes these definitions to be weak.
#ifndef _GLIBCXX_WEAK_DEFINITION
# define _GLIBCXX_WEAK_DEFINITION
#endif
// By default, we assume that __GXX_WEAK__ also means that there is support
// for declaring functions as weak while not defining such functions. This
// allows for referring to functions provided by other libraries (e.g.,
// libitm) without depending on them if the respective features are not used.
#ifndef _GLIBCXX_USE_WEAK_REF
# define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__
#endif
// Conditionally enable annotations for the Transactional Memory TS on C++11.
// Most of the following conditions are due to limitations in the current
// implementation.
#if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \
&& _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \
&& !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF \
&& _GLIBCXX_USE_ALLOCATOR_NEW
#define _GLIBCXX_TXN_SAFE transaction_safe
#define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic
#else
#define _GLIBCXX_TXN_SAFE
#define _GLIBCXX_TXN_SAFE_DYN
#endif
#if __cplusplus > 201402L
// In C++17 mathematical special functions are in namespace std.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
// For C++11 and C++14 they are in namespace std when requested.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#endif
// The remainder of the prewritten config is automatic; all the
// user hooks are listed above.
// Create a boolean flag to be used to determine if --fast-math is set.
#ifdef __FAST_MATH__
# define _GLIBCXX_FAST_MATH 1
#else
# define _GLIBCXX_FAST_MATH 0
#endif
// This marks string literals in header files to be extracted for eventual
// translation. It is primarily used for messages in thrown exceptions; see
// src/functexcept.cc. We use __N because the more traditional _N is used
// for something else under certain OSes (see BADNAMES).
#define __N(msgid) (msgid)
// For example, <windows.h> is known to #define min and max as macros...
#undef min
#undef max
// N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally
// so they should be tested with #if not with #ifdef.
#if __cplusplus >= 201103L
# ifndef _GLIBCXX_USE_C99_MATH
# define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH
# endif
# ifndef _GLIBCXX_USE_C99_COMPLEX
# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX
# endif
# ifndef _GLIBCXX_USE_C99_STDIO
# define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO
# endif
# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB
# endif
# ifndef _GLIBCXX_USE_C99_WCHAR
# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR
# endif
#else
# ifndef _GLIBCXX_USE_C99_MATH
# define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH
# endif
# ifndef _GLIBCXX_USE_C99_COMPLEX
# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX
# endif
# ifndef _GLIBCXX_USE_C99_STDIO
# define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO
# endif
# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB
# endif
# ifndef _GLIBCXX_USE_C99_WCHAR
# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR
# endif
#endif
/* Define if __float128 is supported on this host. */
#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
#define _GLIBCXX_USE_FLOAT128 1
#endif
// End of prewritten config; the settings discovered at configure time follow.
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `acosf' function. */
#define _GLIBCXX_HAVE_ACOSF 1
/* Define to 1 if you have the `acosl' function. */
#define _GLIBCXX_HAVE_ACOSL 1
/* Define to 1 if you have the `aligned_alloc' function. */
#define _GLIBCXX_HAVE_ALIGNED_ALLOC 1
/* Define to 1 if you have the `asinf' function. */
#define _GLIBCXX_HAVE_ASINF 1
/* Define to 1 if you have the `asinl' function. */
#define _GLIBCXX_HAVE_ASINL 1
/* Define to 1 if the target assembler supports .symver directive. */
#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
/* Define to 1 if you have the `atan2f' function. */
#define _GLIBCXX_HAVE_ATAN2F 1
/* Define to 1 if you have the `atan2l' function. */
#define _GLIBCXX_HAVE_ATAN2L 1
/* Define to 1 if you have the `atanf' function. */
#define _GLIBCXX_HAVE_ATANF 1
/* Define to 1 if you have the `atanl' function. */
#define _GLIBCXX_HAVE_ATANL 1
/* Define to 1 if you have the `at_quick_exit' function. */
#define _GLIBCXX_HAVE_AT_QUICK_EXIT 1
/* Define to 1 if the target assembler supports thread-local storage. */
/* #undef _GLIBCXX_HAVE_CC_TLS */
/* Define to 1 if you have the `ceilf' function. */
#define _GLIBCXX_HAVE_CEILF 1
/* Define to 1 if you have the `ceill' function. */
#define _GLIBCXX_HAVE_CEILL 1
/* Define to 1 if you have the <complex.h> header file. */
#define _GLIBCXX_HAVE_COMPLEX_H 1
/* Define to 1 if you have the `cosf' function. */
#define _GLIBCXX_HAVE_COSF 1
/* Define to 1 if you have the `coshf' function. */
#define _GLIBCXX_HAVE_COSHF 1
/* Define to 1 if you have the `coshl' function. */
#define _GLIBCXX_HAVE_COSHL 1
/* Define to 1 if you have the `cosl' function. */
#define _GLIBCXX_HAVE_COSL 1
/* Define to 1 if you have the <dirent.h> header file. */
#define _GLIBCXX_HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define _GLIBCXX_HAVE_DLFCN_H 1
/* Define if EBADMSG exists. */
#define _GLIBCXX_HAVE_EBADMSG 1
/* Define if ECANCELED exists. */
#define _GLIBCXX_HAVE_ECANCELED 1
/* Define if ECHILD exists. */
#define _GLIBCXX_HAVE_ECHILD 1
/* Define if EIDRM exists. */
#define _GLIBCXX_HAVE_EIDRM 1
/* Define to 1 if you have the <endian.h> header file. */
#define _GLIBCXX_HAVE_ENDIAN_H 1
/* Define if ENODATA exists. */
#define _GLIBCXX_HAVE_ENODATA 1
/* Define if ENOLINK exists. */
#define _GLIBCXX_HAVE_ENOLINK 1
/* Define if ENOSPC exists. */
#define _GLIBCXX_HAVE_ENOSPC 1
/* Define if ENOSR exists. */
#define _GLIBCXX_HAVE_ENOSR 1
/* Define if ENOSTR exists. */
#define _GLIBCXX_HAVE_ENOSTR 1
/* Define if ENOTRECOVERABLE exists. */
#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
/* Define if ENOTSUP exists. */
#define _GLIBCXX_HAVE_ENOTSUP 1
/* Define if EOVERFLOW exists. */
#define _GLIBCXX_HAVE_EOVERFLOW 1
/* Define if EOWNERDEAD exists. */
#define _GLIBCXX_HAVE_EOWNERDEAD 1
/* Define if EPERM exists. */
#define _GLIBCXX_HAVE_EPERM 1
/* Define if EPROTO exists. */
#define _GLIBCXX_HAVE_EPROTO 1
/* Define if ETIME exists. */
#define _GLIBCXX_HAVE_ETIME 1
/* Define if ETIMEDOUT exists. */
#define _GLIBCXX_HAVE_ETIMEDOUT 1
/* Define if ETXTBSY exists. */
#define _GLIBCXX_HAVE_ETXTBSY 1
/* Define if EWOULDBLOCK exists. */
#define _GLIBCXX_HAVE_EWOULDBLOCK 1
/* Define to 1 if GCC 4.6 supported std::exception_ptr for the target */
#define _GLIBCXX_HAVE_EXCEPTION_PTR_SINCE_GCC46 1
/* Define to 1 if you have the <execinfo.h> header file. */
#define _GLIBCXX_HAVE_EXECINFO_H 1
/* Define to 1 if you have the `expf' function. */
#define _GLIBCXX_HAVE_EXPF 1
/* Define to 1 if you have the `expl' function. */
#define _GLIBCXX_HAVE_EXPL 1
/* Define to 1 if you have the `fabsf' function. */
#define _GLIBCXX_HAVE_FABSF 1
/* Define to 1 if you have the `fabsl' function. */
#define _GLIBCXX_HAVE_FABSL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define _GLIBCXX_HAVE_FCNTL_H 1
/* Define to 1 if you have the <fenv.h> header file. */
#define _GLIBCXX_HAVE_FENV_H 1
/* Define to 1 if you have the `finite' function. */
#define _GLIBCXX_HAVE_FINITE 1
/* Define to 1 if you have the `finitef' function. */
#define _GLIBCXX_HAVE_FINITEF 1
/* Define to 1 if you have the `finitel' function. */
#define _GLIBCXX_HAVE_FINITEL 1
/* Define to 1 if you have the <float.h> header file. */
#define _GLIBCXX_HAVE_FLOAT_H 1
/* Define to 1 if you have the `floorf' function. */
#define _GLIBCXX_HAVE_FLOORF 1
/* Define to 1 if you have the `floorl' function. */
#define _GLIBCXX_HAVE_FLOORL 1
/* Define to 1 if you have the `fmodf' function. */
#define _GLIBCXX_HAVE_FMODF 1
/* Define to 1 if you have the `fmodl' function. */
#define _GLIBCXX_HAVE_FMODL 1
/* Define to 1 if you have the `fpclass' function. */
/* #undef _GLIBCXX_HAVE_FPCLASS */
/* Define to 1 if you have the <fp.h> header file. */
/* #undef _GLIBCXX_HAVE_FP_H */
/* Define to 1 if you have the `frexpf' function. */
#define _GLIBCXX_HAVE_FREXPF 1
/* Define to 1 if you have the `frexpl' function. */
#define _GLIBCXX_HAVE_FREXPL 1
/* Define if _Unwind_GetIPInfo is available. */
#define _GLIBCXX_HAVE_GETIPINFO 1
/* Define if gets is available in <stdio.h> before C++14. */
#define _GLIBCXX_HAVE_GETS 1
/* Define to 1 if you have the `hypot' function. */
#define _GLIBCXX_HAVE_HYPOT 1
/* Define to 1 if you have the `hypotf' function. */
#define _GLIBCXX_HAVE_HYPOTF 1
/* Define to 1 if you have the `hypotl' function. */
#define _GLIBCXX_HAVE_HYPOTL 1
/* Define if you have the iconv() function. */
#define _GLIBCXX_HAVE_ICONV 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef _GLIBCXX_HAVE_IEEEFP_H */
/* Define if int64_t is available in <stdint.h>. */
#define _GLIBCXX_HAVE_INT64_T 1
/* Define if int64_t is a long. */
/* #undef _GLIBCXX_HAVE_INT64_T_LONG */
/* Define if int64_t is a long long. */
#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define _GLIBCXX_HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isinf' function. */
/* #undef _GLIBCXX_HAVE_ISINF */
/* Define to 1 if you have the `isinff' function. */
#define _GLIBCXX_HAVE_ISINFF 1
/* Define to 1 if you have the `isinfl' function. */
#define _GLIBCXX_HAVE_ISINFL 1
/* Define to 1 if you have the `isnan' function. */
/* #undef _GLIBCXX_HAVE_ISNAN */
/* Define to 1 if you have the `isnanf' function. */
#define _GLIBCXX_HAVE_ISNANF 1
/* Define to 1 if you have the `isnanl' function. */
#define _GLIBCXX_HAVE_ISNANL 1
/* Defined if iswblank exists. */
#define _GLIBCXX_HAVE_ISWBLANK 1
/* Define if LC_MESSAGES is available in <locale.h>. */
#define _GLIBCXX_HAVE_LC_MESSAGES 1
/* Define to 1 if you have the `ldexpf' function. */
#define _GLIBCXX_HAVE_LDEXPF 1
/* Define to 1 if you have the `ldexpl' function. */
#define _GLIBCXX_HAVE_LDEXPL 1
/* Define to 1 if you have the <libintl.h> header file. */
#define _GLIBCXX_HAVE_LIBINTL_H 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_AS 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_DATA 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_FSIZE 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_RSS 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_VMEM 0
/* Define if futex syscall is available. */
#define _GLIBCXX_HAVE_LINUX_FUTEX 1
/* Define to 1 if you have the <linux/random.h> header file. */
#define _GLIBCXX_HAVE_LINUX_RANDOM_H 1
/* Define to 1 if you have the <linux/types.h> header file. */
#define _GLIBCXX_HAVE_LINUX_TYPES_H 1
/* Define to 1 if you have the <locale.h> header file. */
#define _GLIBCXX_HAVE_LOCALE_H 1
/* Define to 1 if you have the `log10f' function. */
#define _GLIBCXX_HAVE_LOG10F 1
/* Define to 1 if you have the `log10l' function. */
#define _GLIBCXX_HAVE_LOG10L 1
/* Define to 1 if you have the `logf' function. */
#define _GLIBCXX_HAVE_LOGF 1
/* Define to 1 if you have the `logl' function. */
#define _GLIBCXX_HAVE_LOGL 1
/* Define to 1 if you have the <machine/endian.h> header file. */
/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
/* Define to 1 if you have the <machine/param.h> header file. */
/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
/* Define if mbstate_t exists in wchar.h. */
#define _GLIBCXX_HAVE_MBSTATE_T 1
/* Define to 1 if you have the `memalign' function. */
#define _GLIBCXX_HAVE_MEMALIGN 1
/* Define to 1 if you have the <memory.h> header file. */
#define _GLIBCXX_HAVE_MEMORY_H 1
/* Define to 1 if you have the `modf' function. */
#define _GLIBCXX_HAVE_MODF 1
/* Define to 1 if you have the `modff' function. */
#define _GLIBCXX_HAVE_MODFF 1
/* Define to 1 if you have the `modfl' function. */
#define _GLIBCXX_HAVE_MODFL 1
/* Define to 1 if you have the <nan.h> header file. */
/* #undef _GLIBCXX_HAVE_NAN_H */
/* Define if <math.h> defines obsolete isinf function. */
/* #undef _GLIBCXX_HAVE_OBSOLETE_ISINF */
/* Define if <math.h> defines obsolete isnan function. */
/* #undef _GLIBCXX_HAVE_OBSOLETE_ISNAN */
/* Define if poll is available in <poll.h>. */
#define _GLIBCXX_HAVE_POLL 1
/* Define to 1 if you have the `posix_memalign' function. */
#define _GLIBCXX_HAVE_POSIX_MEMALIGN 1
/* Define to 1 if you have the `powf' function. */
#define _GLIBCXX_HAVE_POWF 1
/* Define to 1 if you have the `powl' function. */
#define _GLIBCXX_HAVE_POWL 1
/* Define to 1 if you have the `qfpclass' function. */
/* #undef _GLIBCXX_HAVE_QFPCLASS */
/* Define to 1 if you have the `quick_exit' function. */
#define _GLIBCXX_HAVE_QUICK_EXIT 1
/* Define to 1 if you have the `setenv' function. */
#define _GLIBCXX_HAVE_SETENV 1
/* Define to 1 if you have the `sincos' function. */
#define _GLIBCXX_HAVE_SINCOS 1
/* Define to 1 if you have the `sincosf' function. */
#define _GLIBCXX_HAVE_SINCOSF 1
/* Define to 1 if you have the `sincosl' function. */
#define _GLIBCXX_HAVE_SINCOSL 1
/* Define to 1 if you have the `sinf' function. */
#define _GLIBCXX_HAVE_SINF 1
/* Define to 1 if you have the `sinhf' function. */
#define _GLIBCXX_HAVE_SINHF 1
/* Define to 1 if you have the `sinhl' function. */
#define _GLIBCXX_HAVE_SINHL 1
/* Define to 1 if you have the `sinl' function. */
#define _GLIBCXX_HAVE_SINL 1
/* Defined if sleep exists. */
/* #undef _GLIBCXX_HAVE_SLEEP */
/* Define to 1 if you have the `sqrtf' function. */
#define _GLIBCXX_HAVE_SQRTF 1
/* Define to 1 if you have the `sqrtl' function. */
#define _GLIBCXX_HAVE_SQRTL 1
/* Define to 1 if you have the <stdalign.h> header file. */
#define _GLIBCXX_HAVE_STDALIGN_H 1
/* Define to 1 if you have the <stdbool.h> header file. */
#define _GLIBCXX_HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define _GLIBCXX_HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define _GLIBCXX_HAVE_STDLIB_H 1
/* Define if strerror_l is available in <string.h>. */
#define _GLIBCXX_HAVE_STRERROR_L 1
/* Define if strerror_r is available in <string.h>. */
#define _GLIBCXX_HAVE_STRERROR_R 1
/* Define to 1 if you have the <strings.h> header file. */
#define _GLIBCXX_HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define _GLIBCXX_HAVE_STRING_H 1
/* Define to 1 if you have the `strtof' function. */
#define _GLIBCXX_HAVE_STRTOF 1
/* Define to 1 if you have the `strtold' function. */
#define _GLIBCXX_HAVE_STRTOLD 1
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1
/* Define if strxfrm_l is available in <string.h>. */
#define _GLIBCXX_HAVE_STRXFRM_L 1
/* Define to 1 if the target runtime linker supports binding the same symbol
to different versions. */
#define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1
/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/ipc.h> header file. */
#define _GLIBCXX_HAVE_SYS_IPC_H 1
/* Define to 1 if you have the <sys/isa_defs.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
/* Define to 1 if you have the <sys/machine.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define _GLIBCXX_HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have a suitable <sys/sdt.h> header file */
#define _GLIBCXX_HAVE_SYS_SDT_H 1
/* Define to 1 if you have the <sys/sem.h> header file. */
#define _GLIBCXX_HAVE_SYS_SEM_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define _GLIBCXX_HAVE_SYS_STATVFS_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define _GLIBCXX_HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysinfo.h> header file. */
#define _GLIBCXX_HAVE_SYS_SYSINFO_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define _GLIBCXX_HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define _GLIBCXX_HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define _GLIBCXX_HAVE_SYS_UIO_H 1
/* Define if S_IFREG is available in <sys/stat.h>. */
/* #undef _GLIBCXX_HAVE_S_IFREG */
/* Define if S_ISREG is available in <sys/stat.h>. */
#define _GLIBCXX_HAVE_S_ISREG 1
/* Define to 1 if you have the `tanf' function. */
#define _GLIBCXX_HAVE_TANF 1
/* Define to 1 if you have the `tanhf' function. */
#define _GLIBCXX_HAVE_TANHF 1
/* Define to 1 if you have the `tanhl' function. */
#define _GLIBCXX_HAVE_TANHL 1
/* Define to 1 if you have the `tanl' function. */
#define _GLIBCXX_HAVE_TANL 1
/* Define to 1 if you have the <tgmath.h> header file. */
#define _GLIBCXX_HAVE_TGMATH_H 1
/* Define to 1 if the target supports thread-local storage. */
#define _GLIBCXX_HAVE_TLS 1
/* Define to 1 if you have the <uchar.h> header file. */
#define _GLIBCXX_HAVE_UCHAR_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define _GLIBCXX_HAVE_UNISTD_H 1
/* Defined if usleep exists. */
/* #undef _GLIBCXX_HAVE_USLEEP */
/* Define to 1 if you have the <utime.h> header file. */
#define _GLIBCXX_HAVE_UTIME_H 1
/* Defined if vfwscanf exists. */
#define _GLIBCXX_HAVE_VFWSCANF 1
/* Defined if vswscanf exists. */
#define _GLIBCXX_HAVE_VSWSCANF 1
/* Defined if vwscanf exists. */
#define _GLIBCXX_HAVE_VWSCANF 1
/* Define to 1 if you have the <wchar.h> header file. */
#define _GLIBCXX_HAVE_WCHAR_H 1
/* Defined if wcstof exists. */
#define _GLIBCXX_HAVE_WCSTOF 1
/* Define to 1 if you have the <wctype.h> header file. */
#define _GLIBCXX_HAVE_WCTYPE_H 1
/* Defined if Sleep exists. */
/* #undef _GLIBCXX_HAVE_WIN32_SLEEP */
/* Define if writev is available in <sys/uio.h>. */
#define _GLIBCXX_HAVE_WRITEV 1
/* Define to 1 if you have the `_acosf' function. */
/* #undef _GLIBCXX_HAVE__ACOSF */
/* Define to 1 if you have the `_acosl' function. */
/* #undef _GLIBCXX_HAVE__ACOSL */
/* Define to 1 if you have the `_aligned_malloc' function. */
/* #undef _GLIBCXX_HAVE__ALIGNED_MALLOC */
/* Define to 1 if you have the `_asinf' function. */
/* #undef _GLIBCXX_HAVE__ASINF */
/* Define to 1 if you have the `_asinl' function. */
/* #undef _GLIBCXX_HAVE__ASINL */
/* Define to 1 if you have the `_atan2f' function. */
/* #undef _GLIBCXX_HAVE__ATAN2F */
/* Define to 1 if you have the `_atan2l' function. */
/* #undef _GLIBCXX_HAVE__ATAN2L */
/* Define to 1 if you have the `_atanf' function. */
/* #undef _GLIBCXX_HAVE__ATANF */
/* Define to 1 if you have the `_atanl' function. */
/* #undef _GLIBCXX_HAVE__ATANL */
/* Define to 1 if you have the `_ceilf' function. */
/* #undef _GLIBCXX_HAVE__CEILF */
/* Define to 1 if you have the `_ceill' function. */
/* #undef _GLIBCXX_HAVE__CEILL */
/* Define to 1 if you have the `_cosf' function. */
/* #undef _GLIBCXX_HAVE__COSF */
/* Define to 1 if you have the `_coshf' function. */
/* #undef _GLIBCXX_HAVE__COSHF */
/* Define to 1 if you have the `_coshl' function. */
/* #undef _GLIBCXX_HAVE__COSHL */
/* Define to 1 if you have the `_cosl' function. */
/* #undef _GLIBCXX_HAVE__COSL */
/* Define to 1 if you have the `_expf' function. */
/* #undef _GLIBCXX_HAVE__EXPF */
/* Define to 1 if you have the `_expl' function. */
/* #undef _GLIBCXX_HAVE__EXPL */
/* Define to 1 if you have the `_fabsf' function. */
/* #undef _GLIBCXX_HAVE__FABSF */
/* Define to 1 if you have the `_fabsl' function. */
/* #undef _GLIBCXX_HAVE__FABSL */
/* Define to 1 if you have the `_finite' function. */
/* #undef _GLIBCXX_HAVE__FINITE */
/* Define to 1 if you have the `_finitef' function. */
/* #undef _GLIBCXX_HAVE__FINITEF */
/* Define to 1 if you have the `_finitel' function. */
/* #undef _GLIBCXX_HAVE__FINITEL */
/* Define to 1 if you have the `_floorf' function. */
/* #undef _GLIBCXX_HAVE__FLOORF */
/* Define to 1 if you have the `_floorl' function. */
/* #undef _GLIBCXX_HAVE__FLOORL */
/* Define to 1 if you have the `_fmodf' function. */
/* #undef _GLIBCXX_HAVE__FMODF */
/* Define to 1 if you have the `_fmodl' function. */
/* #undef _GLIBCXX_HAVE__FMODL */
/* Define to 1 if you have the `_fpclass' function. */
/* #undef _GLIBCXX_HAVE__FPCLASS */
/* Define to 1 if you have the `_frexpf' function. */
/* #undef _GLIBCXX_HAVE__FREXPF */
/* Define to 1 if you have the `_frexpl' function. */
/* #undef _GLIBCXX_HAVE__FREXPL */
/* Define to 1 if you have the `_hypot' function. */
/* #undef _GLIBCXX_HAVE__HYPOT */
/* Define to 1 if you have the `_hypotf' function. */
/* #undef _GLIBCXX_HAVE__HYPOTF */
/* Define to 1 if you have the `_hypotl' function. */
/* #undef _GLIBCXX_HAVE__HYPOTL */
/* Define to 1 if you have the `_isinf' function. */
/* #undef _GLIBCXX_HAVE__ISINF */
/* Define to 1 if you have the `_isinff' function. */
/* #undef _GLIBCXX_HAVE__ISINFF */
/* Define to 1 if you have the `_isinfl' function. */
/* #undef _GLIBCXX_HAVE__ISINFL */
/* Define to 1 if you have the `_isnan' function. */
/* #undef _GLIBCXX_HAVE__ISNAN */
/* Define to 1 if you have the `_isnanf' function. */
/* #undef _GLIBCXX_HAVE__ISNANF */
/* Define to 1 if you have the `_isnanl' function. */
/* #undef _GLIBCXX_HAVE__ISNANL */
/* Define to 1 if you have the `_ldexpf' function. */
/* #undef _GLIBCXX_HAVE__LDEXPF */
/* Define to 1 if you have the `_ldexpl' function. */
/* #undef _GLIBCXX_HAVE__LDEXPL */
/* Define to 1 if you have the `_log10f' function. */
/* #undef _GLIBCXX_HAVE__LOG10F */
/* Define to 1 if you have the `_log10l' function. */
/* #undef _GLIBCXX_HAVE__LOG10L */
/* Define to 1 if you have the `_logf' function. */
/* #undef _GLIBCXX_HAVE__LOGF */
/* Define to 1 if you have the `_logl' function. */
/* #undef _GLIBCXX_HAVE__LOGL */
/* Define to 1 if you have the `_modf' function. */
/* #undef _GLIBCXX_HAVE__MODF */
/* Define to 1 if you have the `_modff' function. */
/* #undef _GLIBCXX_HAVE__MODFF */
/* Define to 1 if you have the `_modfl' function. */
/* #undef _GLIBCXX_HAVE__MODFL */
/* Define to 1 if you have the `_powf' function. */
/* #undef _GLIBCXX_HAVE__POWF */
/* Define to 1 if you have the `_powl' function. */
/* #undef _GLIBCXX_HAVE__POWL */
/* Define to 1 if you have the `_qfpclass' function. */
/* #undef _GLIBCXX_HAVE__QFPCLASS */
/* Define to 1 if you have the `_sincos' function. */
/* #undef _GLIBCXX_HAVE__SINCOS */
/* Define to 1 if you have the `_sincosf' function. */
/* #undef _GLIBCXX_HAVE__SINCOSF */
/* Define to 1 if you have the `_sincosl' function. */
/* #undef _GLIBCXX_HAVE__SINCOSL */
/* Define to 1 if you have the `_sinf' function. */
/* #undef _GLIBCXX_HAVE__SINF */
/* Define to 1 if you have the `_sinhf' function. */
/* #undef _GLIBCXX_HAVE__SINHF */
/* Define to 1 if you have the `_sinhl' function. */
/* #undef _GLIBCXX_HAVE__SINHL */
/* Define to 1 if you have the `_sinl' function. */
/* #undef _GLIBCXX_HAVE__SINL */
/* Define to 1 if you have the `_sqrtf' function. */
/* #undef _GLIBCXX_HAVE__SQRTF */
/* Define to 1 if you have the `_sqrtl' function. */
/* #undef _GLIBCXX_HAVE__SQRTL */
/* Define to 1 if you have the `_tanf' function. */
/* #undef _GLIBCXX_HAVE__TANF */
/* Define to 1 if you have the `_tanhf' function. */
/* #undef _GLIBCXX_HAVE__TANHF */
/* Define to 1 if you have the `_tanhl' function. */
/* #undef _GLIBCXX_HAVE__TANHL */
/* Define to 1 if you have the `_tanl' function. */
/* #undef _GLIBCXX_HAVE__TANL */
/* Define to 1 if you have the `__cxa_thread_atexit' function. */
/* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT */
/* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */
#define _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL 1
/* Define as const if the declaration of iconv() needs const. */
#define _GLIBCXX_ICONV_CONST
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
/* #undef _GLIBCXX_PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define _GLIBCXX_PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define _GLIBCXX_PACKAGE_NAME "package-unused"
/* Define to the full name and version of this package. */
#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
/* Define to the one symbol short name of this package. */
#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
/* Define to the home page for this package. */
#define _GLIBCXX_PACKAGE_URL ""
/* Define to the version of this package. */
#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
/* The size of `char', as computed by sizeof. */
/* #undef SIZEOF_CHAR */
/* The size of `int', as computed by sizeof. */
/* #undef SIZEOF_INT */
/* The size of `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* The size of `short', as computed by sizeof. */
/* #undef SIZEOF_SHORT */
/* The size of `void *', as computed by sizeof. */
/* #undef SIZEOF_VOID_P */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
/* #undef _GLIBCXX_VERSION */
/* Number of bits in a file offset, on hosts where this is settable. */
#define _GLIBCXX_FILE_OFFSET_BITS 64
/* Define if C99 functions in <complex.h> should be used in <complex> for
C++11. Using compiler builtins for these functions requires corresponding
C99 library functions to be present. */
#define _GLIBCXX11_USE_C99_COMPLEX 1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_MATH 1
/* Define if C99 functions or macros in <stdio.h> should be imported in
<cstdio> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_STDIO 1
/* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_WCHAR 1
/* Define if C99 functions in <complex.h> should be used in <complex> for
C++98. Using compiler builtins for these functions requires corresponding
C99 library functions to be present. */
#define _GLIBCXX98_USE_C99_COMPLEX 1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_MATH 1
/* Define if C99 functions or macros in <stdio.h> should be imported in
<cstdio> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_STDIO 1
/* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_WCHAR 1
/* Define if the compiler supports C++11 atomics. */
#define _GLIBCXX_ATOMIC_BUILTINS 1
/* Define to use concept checking code from the boost libraries. */
/* #undef _GLIBCXX_CONCEPT_CHECKS */
/* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable,
undefined for platform defaults */
#define _GLIBCXX_FULLY_DYNAMIC_STRING 0
/* Define if gthreads library is available. */
#define _GLIBCXX_HAS_GTHREADS 1
/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
#define _GLIBCXX_HOSTED 1
/* Define if compatibility should be provided for -mlong-double-64. */
/* Define to the letter to which size_t is mangled. */
#define _GLIBCXX_MANGLE_SIZE_T j
/* Define if C99 llrint and llround functions are missing from <math.h>. */
/* #undef _GLIBCXX_NO_C99_ROUNDING_FUNCS */
/* Define if ptrdiff_t is int. */
#define _GLIBCXX_PTRDIFF_T_IS_INT 1
/* Define if using setrlimit to set resource limits during "make check" */
#define _GLIBCXX_RES_LIMITS 1
/* Define if size_t is unsigned int. */
#define _GLIBCXX_SIZE_T_IS_UINT 1
/* Define to the value of the EOF integer constant. */
#define _GLIBCXX_STDIO_EOF -1
/* Define to the value of the SEEK_CUR integer constant. */
#define _GLIBCXX_STDIO_SEEK_CUR 1
/* Define to the value of the SEEK_END integer constant. */
#define _GLIBCXX_STDIO_SEEK_END 2
/* Define to use symbol versioning in the shared library. */
#define _GLIBCXX_SYMVER 1
/* Define to use darwin versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_DARWIN */
/* Define to use GNU versioning in the shared library. */
#define _GLIBCXX_SYMVER_GNU 1
/* Define to use GNU namespace versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
/* Define to use Sun versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_SUN */
/* Define if C11 functions in <uchar.h> should be imported into namespace std
in <cuchar>. */
#define _GLIBCXX_USE_C11_UCHAR_CXX11 1
/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
<stdio.h>, and <stdlib.h> can be used or exposed. */
#define _GLIBCXX_USE_C99 1
/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
Using compiler builtins for these functions requires corresponding C99
library functions to be present. */
#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_CTYPE_TR1 1
/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_FENV_TR1 1
/* Define if C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1
/* Define if C99 functions or macros in <math.h> should be imported in
<tr1/cmath> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_MATH_TR1 1
/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_STDINT_TR1 1
/* Defined if clock_gettime syscall has monotonic and realtime clock support.
*/
/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */
/* Defined if clock_gettime has monotonic clock support. */
#define _GLIBCXX_USE_CLOCK_MONOTONIC 1
/* Defined if clock_gettime has realtime clock support. */
#define _GLIBCXX_USE_CLOCK_REALTIME 1
/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
this host. */
#define _GLIBCXX_USE_DECIMAL_FLOAT 1
/* Define if fchmod is available in <sys/stat.h>. */
#define _GLIBCXX_USE_FCHMOD 1
/* Define if fchmodat is available in <sys/stat.h>. */
#define _GLIBCXX_USE_FCHMODAT 1
/* Defined if gettimeofday is available. */
#define _GLIBCXX_USE_GETTIMEOFDAY 1
/* Define if get_nprocs is available in <sys/sysinfo.h>. */
#define _GLIBCXX_USE_GET_NPROCS 1
/* Define if __int128 is supported on this host. */
/* #undef _GLIBCXX_USE_INT128 */
/* Define if LFS support is available. */
#define _GLIBCXX_USE_LFS 1
/* Define if code specialized for long long should be used. */
#define _GLIBCXX_USE_LONG_LONG 1
/* Defined if nanosleep is available. */
#define _GLIBCXX_USE_NANOSLEEP 1
/* Define if NLS translations are to be used. */
#define _GLIBCXX_USE_NLS 1
/* Define if pthreads_num_processors_np is available in <pthread.h>. */
/* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */
/* Define if POSIX read/write locks are available in <gthr.h>. */
#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1
/* Define if /dev/random and /dev/urandom are available for the random_device
of TR1 (Chapter 5.1). */
#define _GLIBCXX_USE_RANDOM_TR1 1
/* Define if usable realpath is available in <stdlib.h>. */
#define _GLIBCXX_USE_REALPATH 1
/* Defined if sched_yield is available. */
#define _GLIBCXX_USE_SCHED_YIELD 1
/* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */
#define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1
/* Define if _SC_NPROC_ONLN is available in <unistd.h>. */
/* #undef _GLIBCXX_USE_SC_NPROC_ONLN */
/* Define if sendfile is available in <sys/sendfile.h>. */
#define _GLIBCXX_USE_SENDFILE 1
/* Define if struct stat has timespec members. */
#define _GLIBCXX_USE_ST_MTIM 1
/* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */
/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */
/* Define if obsolescent tmpnam is available in <stdio.h>. */
#define _GLIBCXX_USE_TMPNAM 1
/* Define if utimensat and UTIME_OMIT are available in <sys/stat.h> and
AT_FDCWD in <fcntl.h>. */
#define _GLIBCXX_USE_UTIMENSAT 1
/* Define if code specialized for wchar_t should be used. */
#define _GLIBCXX_USE_WCHAR_T 1
/* Define to 1 if a verbose library is built, or 0 otherwise. */
#define _GLIBCXX_VERBOSE 1
/* Defined if as can handle rdrand. */
#define _GLIBCXX_X86_RDRAND 1
/* Define to 1 if mutex_timedlock is available. */
#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
/* Define for large files, on AIX-style hosts. */
/* #undef _GLIBCXX_LARGE_FILES */
/* Define if all C++11 floating point overloads are available in <math.h>. */
#if __cplusplus >= 201103L
/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP */
#endif
/* Define if all C++11 integral type overloads are available in <math.h>. */
#if __cplusplus >= 201103L
/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT */
#endif
#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
# define _GLIBCXX_HAVE_ACOSF 1
# define acosf _acosf
#endif
#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
# define _GLIBCXX_HAVE_ACOSL 1
# define acosl _acosl
#endif
#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
# define _GLIBCXX_HAVE_ASINF 1
# define asinf _asinf
#endif
#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
# define _GLIBCXX_HAVE_ASINL 1
# define asinl _asinl
#endif
#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
# define _GLIBCXX_HAVE_ATAN2F 1
# define atan2f _atan2f
#endif
#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
# define _GLIBCXX_HAVE_ATAN2L 1
# define atan2l _atan2l
#endif
#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
# define _GLIBCXX_HAVE_ATANF 1
# define atanf _atanf
#endif
#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
# define _GLIBCXX_HAVE_ATANL 1
# define atanl _atanl
#endif
#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
# define _GLIBCXX_HAVE_CEILF 1
# define ceilf _ceilf
#endif
#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
# define _GLIBCXX_HAVE_CEILL 1
# define ceill _ceill
#endif
#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
# define _GLIBCXX_HAVE_COSF 1
# define cosf _cosf
#endif
#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
# define _GLIBCXX_HAVE_COSHF 1
# define coshf _coshf
#endif
#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
# define _GLIBCXX_HAVE_COSHL 1
# define coshl _coshl
#endif
#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
# define _GLIBCXX_HAVE_COSL 1
# define cosl _cosl
#endif
#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
# define _GLIBCXX_HAVE_EXPF 1
# define expf _expf
#endif
#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
# define _GLIBCXX_HAVE_EXPL 1
# define expl _expl
#endif
#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
# define _GLIBCXX_HAVE_FABSF 1
# define fabsf _fabsf
#endif
#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
# define _GLIBCXX_HAVE_FABSL 1
# define fabsl _fabsl
#endif
#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
# define _GLIBCXX_HAVE_FINITE 1
# define finite _finite
#endif
#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
# define _GLIBCXX_HAVE_FINITEF 1
# define finitef _finitef
#endif
#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
# define _GLIBCXX_HAVE_FINITEL 1
# define finitel _finitel
#endif
#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
# define _GLIBCXX_HAVE_FLOORF 1
# define floorf _floorf
#endif
#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
# define _GLIBCXX_HAVE_FLOORL 1
# define floorl _floorl
#endif
#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
# define _GLIBCXX_HAVE_FMODF 1
# define fmodf _fmodf
#endif
#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
# define _GLIBCXX_HAVE_FMODL 1
# define fmodl _fmodl
#endif
#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
# define _GLIBCXX_HAVE_FPCLASS 1
# define fpclass _fpclass
#endif
#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
# define _GLIBCXX_HAVE_FREXPF 1
# define frexpf _frexpf
#endif
#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
# define _GLIBCXX_HAVE_FREXPL 1
# define frexpl _frexpl
#endif
#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
# define _GLIBCXX_HAVE_HYPOT 1
# define hypot _hypot
#endif
#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
# define _GLIBCXX_HAVE_HYPOTF 1
# define hypotf _hypotf
#endif
#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
# define _GLIBCXX_HAVE_HYPOTL 1
# define hypotl _hypotl
#endif
#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
# define _GLIBCXX_HAVE_ISINF 1
# define isinf _isinf
#endif
#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
# define _GLIBCXX_HAVE_ISINFF 1
# define isinff _isinff
#endif
#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
# define _GLIBCXX_HAVE_ISINFL 1
# define isinfl _isinfl
#endif
#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
# define _GLIBCXX_HAVE_ISNAN 1
# define isnan _isnan
#endif
#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
# define _GLIBCXX_HAVE_ISNANF 1
# define isnanf _isnanf
#endif
#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
# define _GLIBCXX_HAVE_ISNANL 1
# define isnanl _isnanl
#endif
#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
# define _GLIBCXX_HAVE_LDEXPF 1
# define ldexpf _ldexpf
#endif
#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
# define _GLIBCXX_HAVE_LDEXPL 1
# define ldexpl _ldexpl
#endif
#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
# define _GLIBCXX_HAVE_LOG10F 1
# define log10f _log10f
#endif
#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
# define _GLIBCXX_HAVE_LOG10L 1
# define log10l _log10l
#endif
#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
# define _GLIBCXX_HAVE_LOGF 1
# define logf _logf
#endif
#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
# define _GLIBCXX_HAVE_LOGL 1
# define logl _logl
#endif
#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
# define _GLIBCXX_HAVE_MODF 1
# define modf _modf
#endif
#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
# define _GLIBCXX_HAVE_MODFF 1
# define modff _modff
#endif
#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
# define _GLIBCXX_HAVE_MODFL 1
# define modfl _modfl
#endif
#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
# define _GLIBCXX_HAVE_POWF 1
# define powf _powf
#endif
#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
# define _GLIBCXX_HAVE_POWL 1
# define powl _powl
#endif
#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
# define _GLIBCXX_HAVE_QFPCLASS 1
# define qfpclass _qfpclass
#endif
#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
# define _GLIBCXX_HAVE_SINCOS 1
# define sincos _sincos
#endif
#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
# define _GLIBCXX_HAVE_SINCOSF 1
# define sincosf _sincosf
#endif
#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
# define _GLIBCXX_HAVE_SINCOSL 1
# define sincosl _sincosl
#endif
#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
# define _GLIBCXX_HAVE_SINF 1
# define sinf _sinf
#endif
#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
# define _GLIBCXX_HAVE_SINHF 1
# define sinhf _sinhf
#endif
#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
# define _GLIBCXX_HAVE_SINHL 1
# define sinhl _sinhl
#endif
#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
# define _GLIBCXX_HAVE_SINL 1
# define sinl _sinl
#endif
#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
# define _GLIBCXX_HAVE_SQRTF 1
# define sqrtf _sqrtf
#endif
#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
# define _GLIBCXX_HAVE_SQRTL 1
# define sqrtl _sqrtl
#endif
#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
# define _GLIBCXX_HAVE_STRTOF 1
# define strtof _strtof
#endif
#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
# define _GLIBCXX_HAVE_STRTOLD 1
# define strtold _strtold
#endif
#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
# define _GLIBCXX_HAVE_TANF 1
# define tanf _tanf
#endif
#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
# define _GLIBCXX_HAVE_TANHF 1
# define tanhf _tanhf
#endif
#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
# define _GLIBCXX_HAVE_TANHL 1
# define tanhl _tanhl
#endif
#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
# define _GLIBCXX_HAVE_TANL 1
# define tanl _tanl
#endif
#endif // _GLIBCXX_CXX_CONFIG_H
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
#define _GLIBCXX_GCC_GTHR_POSIX_H
/* POSIX threads specific definitions.
Easy, since the interface is just one-to-one mapping. */
#define __GTHREADS 1
#define __GTHREADS_CXX0X 1
#include <pthread.h>
#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
|| !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
# include <unistd.h>
# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
# else
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
# endif
#endif
typedef pthread_t __gthread_t;
typedef pthread_key_t __gthread_key_t;
typedef pthread_once_t __gthread_once_t;
typedef pthread_mutex_t __gthread_mutex_t;
typedef pthread_mutex_t __gthread_recursive_mutex_t;
typedef pthread_cond_t __gthread_cond_t;
typedef struct timespec __gthread_time_t;
/* POSIX like conditional variables are supported. Please look at comments
in gthr.h for details. */
#define __GTHREAD_HAS_COND 1
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
#else
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
#define __GTHREAD_TIME_INIT {0,0}
#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
# undef __GTHREAD_MUTEX_INIT
#endif
#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
# undef __GTHREAD_RECURSIVE_MUTEX_INIT
# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#ifdef _GTHREAD_USE_COND_INIT_FUNC
# undef __GTHREAD_COND_INIT
# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
#endif
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
# ifndef __gthrw_pragma
# define __gthrw_pragma(pragma)
# endif
# define __gthrw2(name,name2,type) \
static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
__gthrw_pragma(weak type)
# define __gthrw_(name) __gthrw_ ## name
#else
# define __gthrw2(name,name2,type)
# define __gthrw_(name) name
#endif
/* Typically, __gthrw_foo is a weak reference to symbol foo. */
#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
__gthrw(pthread_once)
__gthrw(pthread_getspecific)
__gthrw(pthread_setspecific)
__gthrw(pthread_create)
__gthrw(pthread_join)
__gthrw(pthread_equal)
__gthrw(pthread_self)
__gthrw(pthread_detach)
#ifndef __BIONIC__
__gthrw(pthread_cancel)
#endif
__gthrw(sched_yield)
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
__gthrw(pthread_mutex_timedlock)
#endif
__gthrw(pthread_mutex_unlock)
__gthrw(pthread_mutex_init)
__gthrw(pthread_mutex_destroy)
__gthrw(pthread_cond_init)
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_signal)
__gthrw(pthread_cond_wait)
__gthrw(pthread_cond_timedwait)
__gthrw(pthread_cond_destroy)
__gthrw(pthread_key_create)
__gthrw(pthread_key_delete)
__gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_settype)
__gthrw(pthread_mutexattr_destroy)
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
/* Objective-C. */
__gthrw(pthread_exit)
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(sched_get_priority_max)
__gthrw(sched_get_priority_min)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
__gthrw(pthread_attr_destroy)
__gthrw(pthread_attr_init)
__gthrw(pthread_attr_setdetachstate)
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(pthread_getschedparam)
__gthrw(pthread_setschedparam)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _LIBOBJC || _LIBOBJC_WEAK */
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
-pthreads is not specified. The functions are dummies and most return an
error value. However pthread_once returns 0 without invoking the routine
it is passed so we cannot pretend that the interface is active if -pthreads
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
we need to play the usual game with weak symbols. On Solaris 10 and up, a
working interface is always exposed. On FreeBSD 6 and later, libc also
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
which means the alternate __gthread_active_p below cannot be used there. */
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
static volatile int __gthread_active = -1;
static void
__gthread_trigger (void)
{
__gthread_active = 1;
}
static inline int
__gthread_active_p (void)
{
static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
/* This test is not protected to avoid taking a lock on the main code
path so every update of __gthread_active in a threaded program must
be atomic with regard to the result of the test. */
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
if (__gthrw_(pthread_once))
{
/* If this really is a threaded program, then we must ensure that
__gthread_active has been set to 1 before exiting this block. */
__gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
__gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
__gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
}
/* Make sure we'll never enter this block again. */
if (__gthread_active < 0)
__gthread_active = 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* neither FreeBSD nor Solaris */
/* For a program to be multi-threaded the only thing that it certainly must
be using is pthread_create. However, there may be other libraries that
intercept pthread_create with their own definitions to wrap pthreads
functionality for some purpose. In those cases, pthread_create being
defined might not necessarily mean that libpthread is actually linked
in.
For the GNU C library, we can use a known internal name. This is always
available in the ABI, but no other library would define it. That is
ideal, since any public pthread function might be intercepted just as
pthread_create might be. __pthread_key_create is an "internal"
implementation symbol, but it is part of the public exported ABI. Also,
it's among the symbols that the static libpthread.a always links in
whenever pthread_create is used, so there is no danger of a false
negative result in any statically-linked, multi-threaded program.
For others, we choose pthread_cancel as a function that seems unlikely
to be redefined by an interceptor library. The bionic (Android) C
library does not provide pthread_cancel, so we do use pthread_create
there (and interceptor libraries lose). */
#ifdef __GLIBC__
__gthrw2(__gthrw_(__pthread_key_create),
__pthread_key_create,
pthread_key_create)
# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
#elif defined (__BIONIC__)
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
#else
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
#endif
static inline int
__gthread_active_p (void)
{
static void *const __gthread_active_ptr
= __extension__ (void *) >HR_ACTIVE_PROXY;
return __gthread_active_ptr != 0;
}
#endif /* FreeBSD or Solaris */
#else /* not __GXX_WEAK__ */
/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
calls in shared flavors of the HP-UX C library. Most of the stubs
have no functionality. The details are described in the "libc cumulative
patch" for each subversion of HP-UX 11. There are two special interfaces
provided for checking whether an application is linked to a shared pthread
library or not. However, these interfaces aren't available in early
libpthread libraries. We also need a test that works for archive
libraries. We can't use pthread_once as some libc versions call the
init function. We also can't use pthread_create or pthread_attr_init
as these create a thread and thereby prevent changing the default stack
size. The function pthread_default_stacksize_np is available in both
the archive and shared versions of libpthread. It can be used to
determine the default pthread stack size. There is a stub in some
shared libc versions which returns a zero size if pthreads are not
active. We provide an equivalent stub to handle cases where libc
doesn't provide one. */
#if defined(__hppa__) && defined(__hpux__)
static volatile int __gthread_active = -1;
static inline int
__gthread_active_p (void)
{
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
size_t __s;
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
pthread_default_stacksize_np (0, &__s);
__gthread_active = __s ? 1 : 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* not hppa-hpux */
static inline int
__gthread_active_p (void)
{
return 1;
}
#endif /* hppa-hpux */
#endif /* __GXX_WEAK__ */
#ifdef _LIBOBJC
/* This is the config.h file in libobjc/ */
#include <config.h>
#ifdef HAVE_SCHED_H
# include <sched.h>
#endif
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;
static pthread_attr_t _objc_thread_attribs;
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
static inline int
__gthread_objc_init_thread_system (void)
{
if (__gthread_active_p ())
{
/* Initialize the thread storage key. */
if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
{
/* The normal default detach state for threads is
* PTHREAD_CREATE_JOINABLE which causes threads to not die
* when you think they should. */
if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
&& __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
PTHREAD_CREATE_DETACHED) == 0)
return 0;
}
}
return -1;
}
/* Close the threads subsystem. */
static inline int
__gthread_objc_close_thread_system (void)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
&& __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
return 0;
return -1;
}
/* Backend thread functions */
/* Create a new thread of execution. */
static inline objc_thread_t
__gthread_objc_thread_detach (void (*func)(void *), void *arg)
{
objc_thread_t thread_id;
pthread_t new_thread_handle;
if (!__gthread_active_p ())
return NULL;
if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
(void *) func, arg)))
thread_id = (objc_thread_t) new_thread_handle;
else
thread_id = NULL;
return thread_id;
}
/* Set the current thread's priority. */
static inline int
__gthread_objc_thread_set_priority (int priority)
{
if (!__gthread_active_p ())
return -1;
else
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_t thread_id = __gthrw_(pthread_self) ();
int policy;
struct sched_param params;
int priority_min, priority_max;
if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0)
{
if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
return -1;
if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
return -1;
if (priority > priority_max)
priority = priority_max;
else if (priority < priority_min)
priority = priority_min;
params.sched_priority = priority;
/*
* The solaris 7 and several other man pages incorrectly state that
* this should be a pointer to policy but pthread.h is universally
* at odds with this.
*/
if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0)
return 0;
}
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return -1;
}
}
/* Return the current thread's priority. */
static inline int
__gthread_objc_thread_get_priority (void)
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
if (__gthread_active_p ())
{
int policy;
struct sched_param params;
if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0)
return params.sched_priority;
else
return -1;
}
else
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return OBJC_THREAD_INTERACTIVE_PRIORITY;
}
/* Yield our process time to another thread. */
static inline void
__gthread_objc_thread_yield (void)
{
if (__gthread_active_p ())
__gthrw_(sched_yield) ();
}
/* Terminate the current thread. */
static inline int
__gthread_objc_thread_exit (void)
{
if (__gthread_active_p ())
/* exit the thread */
__gthrw_(pthread_exit) (&__objc_thread_exit_status);
/* Failed if we reached here */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
static inline objc_thread_t
__gthread_objc_thread_id (void)
{
if (__gthread_active_p ())
return (objc_thread_t) __gthrw_(pthread_self) ();
else
return (objc_thread_t) 1;
}
/* Sets the thread's local storage pointer. */
static inline int
__gthread_objc_thread_set_data (void *value)
{
if (__gthread_active_p ())
return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
else
{
thread_local_storage = value;
return 0;
}
}
/* Returns the thread's local storage pointer. */
static inline void *
__gthread_objc_thread_get_data (void)
{
if (__gthread_active_p ())
return __gthrw_(pthread_getspecific) (_objc_thread_storage);
else
return thread_local_storage;
}
/* Backend mutex functions */
/* Allocate a mutex. */
static inline int
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
{
objc_free (mutex->backend);
mutex->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a mutex. */
static inline int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
int count;
/*
* Posix Threads specifically require that the thread be unlocked
* for __gthrw_(pthread_mutex_destroy) to work.
*/
do
{
count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
if (count < 0)
return -1;
}
while (count);
if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
return -1;
objc_free (mutex->backend);
mutex->backend = NULL;
}
return 0;
}
/* Grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_lock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Try to grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Unlock the mutex */
static inline int
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
static inline int
__gthread_objc_condition_allocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
condition->backend = objc_malloc (sizeof (pthread_cond_t));
if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
{
objc_free (condition->backend);
condition->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a condition. */
static inline int
__gthread_objc_condition_deallocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
return -1;
objc_free (condition->backend);
condition->backend = NULL;
}
return 0;
}
/* Wait on the condition */
static inline int
__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
(pthread_mutex_t *) mutex->backend);
else
return 0;
}
/* Wake up all threads waiting on this condition. */
static inline int
__gthread_objc_condition_broadcast (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
else
return 0;
}
/* Wake up one thread waiting on this condition. */
static inline int
__gthread_objc_condition_signal (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
else
return 0;
}
#else /* _LIBOBJC */
static inline int
__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
void *__args)
{
return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
}
static inline int
__gthread_join (__gthread_t __threadid, void **__value_ptr)
{
return __gthrw_(pthread_join) (__threadid, __value_ptr);
}
static inline int
__gthread_detach (__gthread_t __threadid)
{
return __gthrw_(pthread_detach) (__threadid);
}
static inline int
__gthread_equal (__gthread_t __t1, __gthread_t __t2)
{
return __gthrw_(pthread_equal) (__t1, __t2);
}
static inline __gthread_t
__gthread_self (void)
{
return __gthrw_(pthread_self) ();
}
static inline int
__gthread_yield (void)
{
return __gthrw_(sched_yield) ();
}
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(pthread_key_create) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return __gthrw_(pthread_key_delete) (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return __gthrw_(pthread_getspecific) (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(pthread_setspecific) (__key, __ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
__gthrw_(pthread_mutex_init) (__mutex, NULL);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
else
return 0;
}
#endif
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
|| defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_mutexattr_t __attr;
int __r;
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
PTHREAD_MUTEX_RECURSIVE);
if (!__r)
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
return __r;
}
return 0;
}
#endif
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (__mutex);
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
}
#endif
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (__mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
#ifdef _GTHREAD_USE_COND_INIT_FUNC
static inline void
__gthread_cond_init_function (__gthread_cond_t *__cond)
{
if (__gthread_active_p ())
__gthrw_(pthread_cond_init) (__cond, NULL);
}
#endif
static inline int
__gthread_cond_broadcast (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_broadcast) (__cond);
}
static inline int
__gthread_cond_signal (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_signal) (__cond);
}
static inline int
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
{
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
}
static inline int
__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
}
static inline int
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
__gthread_recursive_mutex_t *__mutex)
{
return __gthread_cond_wait (__cond, __mutex);
}
static inline int
__gthread_cond_destroy (__gthread_cond_t* __cond)
{
return __gthrw_(pthread_cond_destroy) (__cond);
}
#endif /* _LIBOBJC */
#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
// Locale support -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/ctype_inline.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.1 Locales
//
// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
// functions go in ctype.cc
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
ctype<char>::
is(mask __m, char __c) const
{ return _M_table[static_cast<unsigned char>(__c)] & __m; }
const char*
ctype<char>::
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
return __high;
}
const char*
ctype<char>::
scan_is(mask __m, const char* __low, const char* __high) const
{
while (__low < __high
&& !(_M_table[static_cast<unsigned char>(*__low)] & __m))
++__low;
return __low;
}
const char*
ctype<char>::
scan_not(mask __m, const char* __low, const char* __high) const
{
while (__low < __high
&& (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
++__low;
return __low;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// Locale support -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/ctype_base.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.1 Locales
//
// Information as gleaned from /usr/include/ctype.h
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @brief Base class for ctype.
struct ctype_base
{
// Non-standard typedefs.
typedef const int* __to_type;
// NB: Offsets into ctype<char>::_M_table force a particular size
// on the mask type. Because of this, we don't use an enum.
typedef unsigned short mask;
static const mask upper = _ISupper;
static const mask lower = _ISlower;
static const mask alpha = _ISalpha;
static const mask digit = _ISdigit;
static const mask xdigit = _ISxdigit;
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask graph = _ISalpha | _ISdigit | _ISpunct;
static const mask cntrl = _IScntrl;
static const mask punct = _ISpunct;
static const mask alnum = _ISalpha | _ISdigit;
#if __cplusplus >= 201103L
static const mask blank = _ISblank;
#endif
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// Specific definitions for GNU/Linux -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/os_defines.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_OS_DEFINES
#define _GLIBCXX_OS_DEFINES 1
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
// This keeps isanum, et al from being propagated as macros.
#define __NO_CTYPE 1
#include <features.h>
// Provide a declaration for the possibly deprecated gets function, as
// glibc 2.15 and later does not declare gets for ISO C11 when
// __GNU_SOURCE is defined.
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
# undef _GLIBCXX_HAVE_GETS
#endif
// Glibc 2.23 removed the obsolete isinf and isnan declarations. Check the
// version dynamically in case it has changed since libstdc++ was configured.
#define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23)
#endif
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/time_members.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.2.5.1.2 - time_get functions
// ISO C++ 14882: 22.2.5.3.2 - time_put functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
_M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0),
_M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
: facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
_M_name_timepunct(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
const size_t __len = __builtin_strlen(__s) + 1;
char* __tmp = new char[__len];
__builtin_memcpy(__tmp, __s, __len);
_M_name_timepunct = __tmp;
}
else
_M_name_timepunct = _S_get_c_name();
__try
{ _M_initialize_timepunct(__cloc); }
__catch(...)
{
if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct;
__throw_exception_again;
}
}
template<typename _CharT>
__timepunct<_CharT>::~__timepunct()
{
if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct;
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// Optimizations for random number extensions, x86 version -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/random.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/random}
*/
#ifndef _EXT_OPT_RANDOM_H
#define _EXT_OPT_RANDOM_H 1
#pragma GCC system_header
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifdef __SSE2__
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace {
template<size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4>
inline __m128i __sse2_recursion(__m128i __a, __m128i __b,
__m128i __c, __m128i __d)
{
__m128i __y = _mm_srli_epi32(__b, __sr1);
__m128i __z = _mm_srli_si128(__c, __sr2);
__m128i __v = _mm_slli_epi32(__d, __sl1);
__z = _mm_xor_si128(__z, __a);
__z = _mm_xor_si128(__z, __v);
__m128i __x = _mm_slli_si128(__a, __sl2);
__y = _mm_and_si128(__y, _mm_set_epi32(__msk4, __msk3, __msk2, __msk1));
__z = _mm_xor_si128(__z, __x);
return _mm_xor_si128(__z, __y);
}
}
#define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_GEN_READ 1
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
void simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
_M_gen_rand(void)
{
__m128i __r1 = _mm_load_si128(&_M_state[_M_nstate - 2]);
__m128i __r2 = _mm_load_si128(&_M_state[_M_nstate - 1]);
size_t __i;
for (__i = 0; __i < _M_nstate - __pos1; ++__i)
{
__m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4>
(_M_state[__i], _M_state[__i + __pos1], __r1, __r2);
_mm_store_si128(&_M_state[__i], __r);
__r1 = __r2;
__r2 = __r;
}
for (; __i < _M_nstate; ++__i)
{
__m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4>
(_M_state[__i], _M_state[__i + __pos1 - _M_nstate], __r1, __r2);
_mm_store_si128(&_M_state[__i], __r);
__r1 = __r2;
__r2 = __r;
}
_M_pos = 0;
}
#define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_OPERATOREQUAL 1
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
bool
operator==(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __lhs,
const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __rhs)
{
__m128i __res = _mm_cmpeq_epi8(__lhs._M_state[0], __rhs._M_state[0]);
for (size_t __i = 1; __i < __lhs._M_nstate; ++__i)
__res = _mm_and_si128(__res, _mm_cmpeq_epi8(__lhs._M_state[__i],
__rhs._M_state[__i]));
return (_mm_movemask_epi8(__res) == 0xffff
&& __lhs._M_pos == __rhs._M_pos);
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // __SSE2__
#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#endif // _EXT_OPT_RANDOM_H
// C++ includes used for precompiling extensions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file extc++.h
* This is an implementation file for a precompiled header.
*/
#if __cplusplus < 201103L
#include <bits/stdtr1c++.h>
#else
#include <bits/stdc++.h>
#endif
#include <ext/algorithm>
#if __cplusplus >= 201103L
# include <ext/aligned_buffer.h>
#endif
#include <ext/alloc_traits.h>
#include <ext/array_allocator.h>
#include <ext/atomicity.h>
#include <ext/bitmap_allocator.h>
#include <ext/cast.h>
#if __cplusplus >= 201103L
# include <ext/cmath>
#endif
#include <ext/concurrence.h>
#include <ext/debug_allocator.h>
#include <ext/extptr_allocator.h>
#include <ext/functional>
#include <ext/iterator>
#include <ext/malloc_allocator.h>
#include <ext/memory>
#include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/numeric>
#include <ext/numeric_traits.h>
#include <ext/pod_char_traits.h>
#include <ext/pointer.h>
#include <ext/pool_allocator.h>
#if __cplusplus >= 201103L
# include <ext/random>
#endif
#include <ext/rb_tree>
#include <ext/rope>
#include <ext/slist>
#include <ext/stdio_filebuf.h>
#include <ext/stdio_sync_filebuf.h>
#include <ext/throw_allocator.h>
#include <ext/typelist.h>
#include <ext/type_traits.h>
#include <ext/vstring.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/list_update_policy.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#ifdef _GLIBCXX_HAVE_ICONV
#include <ext/codecvt_specializations.h>
#include <ext/enc_filebuf.h>
#endif
// Underlying io library details -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++io.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ios}
*/
// c_io_stdio.h - Defines for using "C" stdio.h
#ifndef _GLIBCXX_CXX_IO_H
#define _GLIBCXX_CXX_IO_H 1
#include <cstdio>
#include <bits/gthr.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __gthread_mutex_t __c_lock;
// for basic_file.h
typedef FILE __c_file;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Specific definitions for generic platforms -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/error_constants.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{system_error}
*/
#ifndef _GLIBCXX_ERROR_CONSTANTS
#define _GLIBCXX_ERROR_CONSTANTS 1
#include <bits/c++config.h>
#include <cerrno>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
enum class errc
{
address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL,
already_connected = EISCONN,
argument_list_too_long = E2BIG,
argument_out_of_domain = EDOM,
bad_address = EFAULT,
bad_file_descriptor = EBADF,
#ifdef _GLIBCXX_HAVE_EBADMSG
bad_message = EBADMSG,
#endif
broken_pipe = EPIPE,
connection_aborted = ECONNABORTED,
connection_already_in_progress = EALREADY,
connection_refused = ECONNREFUSED,
connection_reset = ECONNRESET,
cross_device_link = EXDEV,
destination_address_required = EDESTADDRREQ,
device_or_resource_busy = EBUSY,
directory_not_empty = ENOTEMPTY,
executable_format_error = ENOEXEC,
file_exists = EEXIST,
file_too_large = EFBIG,
filename_too_long = ENAMETOOLONG,
function_not_supported = ENOSYS,
host_unreachable = EHOSTUNREACH,
#ifdef _GLIBCXX_HAVE_EIDRM
identifier_removed = EIDRM,
#endif
illegal_byte_sequence = EILSEQ,
inappropriate_io_control_operation = ENOTTY,
interrupted = EINTR,
invalid_argument = EINVAL,
invalid_seek = ESPIPE,
io_error = EIO,
is_a_directory = EISDIR,
message_size = EMSGSIZE,
network_down = ENETDOWN,
network_reset = ENETRESET,
network_unreachable = ENETUNREACH,
no_buffer_space = ENOBUFS,
no_child_process = ECHILD,
#ifdef _GLIBCXX_HAVE_ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
#ifdef _GLIBCXX_HAVE_ENODATA
no_message_available = ENODATA,
#endif
no_message = ENOMSG,
no_protocol_option = ENOPROTOOPT,
no_space_on_device = ENOSPC,
#ifdef _GLIBCXX_HAVE_ENOSR
no_stream_resources = ENOSR,
#endif
no_such_device_or_address = ENXIO,
no_such_device = ENODEV,
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
not_a_socket = ENOTSOCK,
#ifdef _GLIBCXX_HAVE_ENOSTR
not_a_stream = ENOSTR,
#endif
not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
#ifdef _GLIBCXX_HAVE_ENOTSUP
not_supported = ENOTSUP,
#endif
#ifdef _GLIBCXX_HAVE_ECANCELED
operation_canceled = ECANCELED,
#endif
operation_in_progress = EINPROGRESS,
operation_not_permitted = EPERM,
operation_not_supported = EOPNOTSUPP,
operation_would_block = EWOULDBLOCK,
#ifdef _GLIBCXX_HAVE_EOWNERDEAD
owner_dead = EOWNERDEAD,
#endif
permission_denied = EACCES,
#ifdef _GLIBCXX_HAVE_EPROTO
protocol_error = EPROTO,
#endif
protocol_not_supported = EPROTONOSUPPORT,
read_only_file_system = EROFS,
resource_deadlock_would_occur = EDEADLK,
resource_unavailable_try_again = EAGAIN,
result_out_of_range = ERANGE,
#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
state_not_recoverable = ENOTRECOVERABLE,
#endif
#ifdef _GLIBCXX_HAVE_ETIME
stream_timeout = ETIME,
#endif
#ifdef _GLIBCXX_HAVE_ETXTBSY
text_file_busy = ETXTBSY,
#endif
timed_out = ETIMEDOUT,
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK,
too_many_symbolic_link_levels = ELOOP,
#ifdef _GLIBCXX_HAVE_EOVERFLOW
value_too_large = EOVERFLOW,
#endif
wrong_protocol_type = EPROTOTYPE
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// std::messages implementation details, GNU version -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/messages_members.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.2.7.1.2 messages functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#include <libintl.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Non-virtual member functions.
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
: facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
_M_name_messages(_S_get_c_name())
{ }
template<typename _CharT>
messages<_CharT>::messages(__c_locale __cloc, const char* __s,
size_t __refs)
: facet(__refs), _M_c_locale_messages(0), _M_name_messages(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
const size_t __len = __builtin_strlen(__s) + 1;
char* __tmp = new char[__len];
__builtin_memcpy(__tmp, __s, __len);
_M_name_messages = __tmp;
}
else
_M_name_messages = _S_get_c_name();
// Last to avoid leaking memory if new throws.
_M_c_locale_messages = _S_clone_c_locale(__cloc);
}
template<typename _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
const char* __dir) const
{
bindtextdomain(__s.c_str(), __dir);
return this->do_open(__s, __loc);
}
// Virtual member functions.
template<typename _CharT>
messages<_CharT>::~messages()
{
if (_M_name_messages != _S_get_c_name())
delete [] _M_name_messages;
_S_destroy_c_locale(_M_c_locale_messages);
}
template<typename _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __s,
const locale&) const
{
// No error checking is done, assume the catalog exists and can
// be used.
textdomain(__s.c_str());
return 0;
}
template<typename _CharT>
void
messages<_CharT>::do_close(catalog) const
{ }
// messages_byname
template<typename _CharT>
messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
: messages<_CharT>(__refs)
{
if (this->_M_name_messages != locale::facet::_S_get_c_name())
{
delete [] this->_M_name_messages;
if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0)
{
const size_t __len = __builtin_strlen(__s) + 1;
char* __tmp = new char[__len];
__builtin_memcpy(__tmp, __s, __len);
this->_M_name_messages = __tmp;
}
else
this->_M_name_messages = locale::facet::_S_get_c_name();
}
if (__builtin_strcmp(__s, "C") != 0
&& __builtin_strcmp(__s, "POSIX") != 0)
{
this->_S_destroy_c_locale(this->_M_c_locale_messages);
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
}
}
//Specializations.
template<>
typename messages<char>::catalog
messages<char>::do_open(const basic_string<char>&,
const locale&) const;
template<>
void
messages<char>::do_close(catalog) const;
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
typename messages<wchar_t>::catalog
messages<wchar_t>::do_open(const basic_string<char>&,
const locale&) const;
template<>
void
messages<wchar_t>::do_close(catalog) const;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
#define _GLIBCXX_GCC_GTHR_POSIX_H
/* POSIX threads specific definitions.
Easy, since the interface is just one-to-one mapping. */
#define __GTHREADS 1
#define __GTHREADS_CXX0X 1
#include <pthread.h>
#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
|| !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
# include <unistd.h>
# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
# else
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
# endif
#endif
typedef pthread_t __gthread_t;
typedef pthread_key_t __gthread_key_t;
typedef pthread_once_t __gthread_once_t;
typedef pthread_mutex_t __gthread_mutex_t;
typedef pthread_mutex_t __gthread_recursive_mutex_t;
typedef pthread_cond_t __gthread_cond_t;
typedef struct timespec __gthread_time_t;
/* POSIX like conditional variables are supported. Please look at comments
in gthr.h for details. */
#define __GTHREAD_HAS_COND 1
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
#else
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
#define __GTHREAD_TIME_INIT {0,0}
#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
# undef __GTHREAD_MUTEX_INIT
#endif
#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
# undef __GTHREAD_RECURSIVE_MUTEX_INIT
# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#ifdef _GTHREAD_USE_COND_INIT_FUNC
# undef __GTHREAD_COND_INIT
# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
#endif
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
# ifndef __gthrw_pragma
# define __gthrw_pragma(pragma)
# endif
# define __gthrw2(name,name2,type) \
static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
__gthrw_pragma(weak type)
# define __gthrw_(name) __gthrw_ ## name
#else
# define __gthrw2(name,name2,type)
# define __gthrw_(name) name
#endif
/* Typically, __gthrw_foo is a weak reference to symbol foo. */
#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
__gthrw(pthread_once)
__gthrw(pthread_getspecific)
__gthrw(pthread_setspecific)
__gthrw(pthread_create)
__gthrw(pthread_join)
__gthrw(pthread_equal)
__gthrw(pthread_self)
__gthrw(pthread_detach)
#ifndef __BIONIC__
__gthrw(pthread_cancel)
#endif
__gthrw(sched_yield)
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
__gthrw(pthread_mutex_timedlock)
#endif
__gthrw(pthread_mutex_unlock)
__gthrw(pthread_mutex_init)
__gthrw(pthread_mutex_destroy)
__gthrw(pthread_cond_init)
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_signal)
__gthrw(pthread_cond_wait)
__gthrw(pthread_cond_timedwait)
__gthrw(pthread_cond_destroy)
__gthrw(pthread_key_create)
__gthrw(pthread_key_delete)
__gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_settype)
__gthrw(pthread_mutexattr_destroy)
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
/* Objective-C. */
__gthrw(pthread_exit)
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(sched_get_priority_max)
__gthrw(sched_get_priority_min)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
__gthrw(pthread_attr_destroy)
__gthrw(pthread_attr_init)
__gthrw(pthread_attr_setdetachstate)
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(pthread_getschedparam)
__gthrw(pthread_setschedparam)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _LIBOBJC || _LIBOBJC_WEAK */
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
-pthreads is not specified. The functions are dummies and most return an
error value. However pthread_once returns 0 without invoking the routine
it is passed so we cannot pretend that the interface is active if -pthreads
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
we need to play the usual game with weak symbols. On Solaris 10 and up, a
working interface is always exposed. On FreeBSD 6 and later, libc also
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
which means the alternate __gthread_active_p below cannot be used there. */
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
static volatile int __gthread_active = -1;
static void
__gthread_trigger (void)
{
__gthread_active = 1;
}
static inline int
__gthread_active_p (void)
{
static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
/* This test is not protected to avoid taking a lock on the main code
path so every update of __gthread_active in a threaded program must
be atomic with regard to the result of the test. */
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
if (__gthrw_(pthread_once))
{
/* If this really is a threaded program, then we must ensure that
__gthread_active has been set to 1 before exiting this block. */
__gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
__gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
__gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
}
/* Make sure we'll never enter this block again. */
if (__gthread_active < 0)
__gthread_active = 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* neither FreeBSD nor Solaris */
/* For a program to be multi-threaded the only thing that it certainly must
be using is pthread_create. However, there may be other libraries that
intercept pthread_create with their own definitions to wrap pthreads
functionality for some purpose. In those cases, pthread_create being
defined might not necessarily mean that libpthread is actually linked
in.
For the GNU C library, we can use a known internal name. This is always
available in the ABI, but no other library would define it. That is
ideal, since any public pthread function might be intercepted just as
pthread_create might be. __pthread_key_create is an "internal"
implementation symbol, but it is part of the public exported ABI. Also,
it's among the symbols that the static libpthread.a always links in
whenever pthread_create is used, so there is no danger of a false
negative result in any statically-linked, multi-threaded program.
For others, we choose pthread_cancel as a function that seems unlikely
to be redefined by an interceptor library. The bionic (Android) C
library does not provide pthread_cancel, so we do use pthread_create
there (and interceptor libraries lose). */
#ifdef __GLIBC__
__gthrw2(__gthrw_(__pthread_key_create),
__pthread_key_create,
pthread_key_create)
# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
#elif defined (__BIONIC__)
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
#else
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
#endif
static inline int
__gthread_active_p (void)
{
static void *const __gthread_active_ptr
= __extension__ (void *) >HR_ACTIVE_PROXY;
return __gthread_active_ptr != 0;
}
#endif /* FreeBSD or Solaris */
#else /* not __GXX_WEAK__ */
/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
calls in shared flavors of the HP-UX C library. Most of the stubs
have no functionality. The details are described in the "libc cumulative
patch" for each subversion of HP-UX 11. There are two special interfaces
provided for checking whether an application is linked to a shared pthread
library or not. However, these interfaces aren't available in early
libpthread libraries. We also need a test that works for archive
libraries. We can't use pthread_once as some libc versions call the
init function. We also can't use pthread_create or pthread_attr_init
as these create a thread and thereby prevent changing the default stack
size. The function pthread_default_stacksize_np is available in both
the archive and shared versions of libpthread. It can be used to
determine the default pthread stack size. There is a stub in some
shared libc versions which returns a zero size if pthreads are not
active. We provide an equivalent stub to handle cases where libc
doesn't provide one. */
#if defined(__hppa__) && defined(__hpux__)
static volatile int __gthread_active = -1;
static inline int
__gthread_active_p (void)
{
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
size_t __s;
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
pthread_default_stacksize_np (0, &__s);
__gthread_active = __s ? 1 : 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* not hppa-hpux */
static inline int
__gthread_active_p (void)
{
return 1;
}
#endif /* hppa-hpux */
#endif /* __GXX_WEAK__ */
#ifdef _LIBOBJC
/* This is the config.h file in libobjc/ */
#include <config.h>
#ifdef HAVE_SCHED_H
# include <sched.h>
#endif
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;
static pthread_attr_t _objc_thread_attribs;
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
static inline int
__gthread_objc_init_thread_system (void)
{
if (__gthread_active_p ())
{
/* Initialize the thread storage key. */
if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
{
/* The normal default detach state for threads is
* PTHREAD_CREATE_JOINABLE which causes threads to not die
* when you think they should. */
if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
&& __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
PTHREAD_CREATE_DETACHED) == 0)
return 0;
}
}
return -1;
}
/* Close the threads subsystem. */
static inline int
__gthread_objc_close_thread_system (void)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
&& __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
return 0;
return -1;
}
/* Backend thread functions */
/* Create a new thread of execution. */
static inline objc_thread_t
__gthread_objc_thread_detach (void (*func)(void *), void *arg)
{
objc_thread_t thread_id;
pthread_t new_thread_handle;
if (!__gthread_active_p ())
return NULL;
if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
(void *) func, arg)))
thread_id = (objc_thread_t) new_thread_handle;
else
thread_id = NULL;
return thread_id;
}
/* Set the current thread's priority. */
static inline int
__gthread_objc_thread_set_priority (int priority)
{
if (!__gthread_active_p ())
return -1;
else
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_t thread_id = __gthrw_(pthread_self) ();
int policy;
struct sched_param params;
int priority_min, priority_max;
if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0)
{
if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
return -1;
if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
return -1;
if (priority > priority_max)
priority = priority_max;
else if (priority < priority_min)
priority = priority_min;
params.sched_priority = priority;
/*
* The solaris 7 and several other man pages incorrectly state that
* this should be a pointer to policy but pthread.h is universally
* at odds with this.
*/
if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0)
return 0;
}
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return -1;
}
}
/* Return the current thread's priority. */
static inline int
__gthread_objc_thread_get_priority (void)
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
if (__gthread_active_p ())
{
int policy;
struct sched_param params;
if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0)
return params.sched_priority;
else
return -1;
}
else
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return OBJC_THREAD_INTERACTIVE_PRIORITY;
}
/* Yield our process time to another thread. */
static inline void
__gthread_objc_thread_yield (void)
{
if (__gthread_active_p ())
__gthrw_(sched_yield) ();
}
/* Terminate the current thread. */
static inline int
__gthread_objc_thread_exit (void)
{
if (__gthread_active_p ())
/* exit the thread */
__gthrw_(pthread_exit) (&__objc_thread_exit_status);
/* Failed if we reached here */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
static inline objc_thread_t
__gthread_objc_thread_id (void)
{
if (__gthread_active_p ())
return (objc_thread_t) __gthrw_(pthread_self) ();
else
return (objc_thread_t) 1;
}
/* Sets the thread's local storage pointer. */
static inline int
__gthread_objc_thread_set_data (void *value)
{
if (__gthread_active_p ())
return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
else
{
thread_local_storage = value;
return 0;
}
}
/* Returns the thread's local storage pointer. */
static inline void *
__gthread_objc_thread_get_data (void)
{
if (__gthread_active_p ())
return __gthrw_(pthread_getspecific) (_objc_thread_storage);
else
return thread_local_storage;
}
/* Backend mutex functions */
/* Allocate a mutex. */
static inline int
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
{
objc_free (mutex->backend);
mutex->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a mutex. */
static inline int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
int count;
/*
* Posix Threads specifically require that the thread be unlocked
* for __gthrw_(pthread_mutex_destroy) to work.
*/
do
{
count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
if (count < 0)
return -1;
}
while (count);
if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
return -1;
objc_free (mutex->backend);
mutex->backend = NULL;
}
return 0;
}
/* Grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_lock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Try to grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Unlock the mutex */
static inline int
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
static inline int
__gthread_objc_condition_allocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
condition->backend = objc_malloc (sizeof (pthread_cond_t));
if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
{
objc_free (condition->backend);
condition->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a condition. */
static inline int
__gthread_objc_condition_deallocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
return -1;
objc_free (condition->backend);
condition->backend = NULL;
}
return 0;
}
/* Wait on the condition */
static inline int
__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
(pthread_mutex_t *) mutex->backend);
else
return 0;
}
/* Wake up all threads waiting on this condition. */
static inline int
__gthread_objc_condition_broadcast (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
else
return 0;
}
/* Wake up one thread waiting on this condition. */
static inline int
__gthread_objc_condition_signal (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
else
return 0;
}
#else /* _LIBOBJC */
static inline int
__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
void *__args)
{
return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
}
static inline int
__gthread_join (__gthread_t __threadid, void **__value_ptr)
{
return __gthrw_(pthread_join) (__threadid, __value_ptr);
}
static inline int
__gthread_detach (__gthread_t __threadid)
{
return __gthrw_(pthread_detach) (__threadid);
}
static inline int
__gthread_equal (__gthread_t __t1, __gthread_t __t2)
{
return __gthrw_(pthread_equal) (__t1, __t2);
}
static inline __gthread_t
__gthread_self (void)
{
return __gthrw_(pthread_self) ();
}
static inline int
__gthread_yield (void)
{
return __gthrw_(sched_yield) ();
}
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(pthread_key_create) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return __gthrw_(pthread_key_delete) (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return __gthrw_(pthread_getspecific) (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(pthread_setspecific) (__key, __ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
__gthrw_(pthread_mutex_init) (__mutex, NULL);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
else
return 0;
}
#endif
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
|| defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_mutexattr_t __attr;
int __r;
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
PTHREAD_MUTEX_RECURSIVE);
if (!__r)
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
return __r;
}
return 0;
}
#endif
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (__mutex);
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
}
#endif
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (__mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
#ifdef _GTHREAD_USE_COND_INIT_FUNC
static inline void
__gthread_cond_init_function (__gthread_cond_t *__cond)
{
if (__gthread_active_p ())
__gthrw_(pthread_cond_init) (__cond, NULL);
}
#endif
static inline int
__gthread_cond_broadcast (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_broadcast) (__cond);
}
static inline int
__gthread_cond_signal (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_signal) (__cond);
}
static inline int
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
{
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
}
static inline int
__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
}
static inline int
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
__gthread_recursive_mutex_t *__mutex)
{
return __gthread_cond_wait (__cond, __mutex);
}
static inline int
__gthread_cond_destroy (__gthread_cond_t* __cond)
{
return __gthrw_(pthread_cond_destroy) (__cond);
}
#endif /* _LIBOBJC */
#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
// C++ includes used for precompiling TR1 -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdtr1c++.h
* This is an implementation file for a precompiled header.
*/
#include <bits/stdc++.h>
#include <tr1/array>
#include <tr1/cctype>
#include <tr1/cfenv>
#include <tr1/cfloat>
#include <tr1/cinttypes>
#include <tr1/climits>
#include <tr1/cmath>
#include <tr1/complex>
#include <tr1/cstdarg>
#include <tr1/cstdbool>
#include <tr1/cstdint>
#include <tr1/cstdio>
#include <tr1/cstdlib>
#include <tr1/ctgmath>
#include <tr1/ctime>
#include <tr1/cwchar>
#include <tr1/cwctype>
#include <tr1/functional>
#include <tr1/random>
#include <tr1/tuple>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#include <tr1/utility>
// Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 27.8 File-based streams
//
/** @file bits/basic_file.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ios}
*/
#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
#define _GLIBCXX_BASIC_FILE_STDIO_H 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/c++io.h> // for __c_lock and __c_file
#include <bits/move.h> // for swap
#include <ios>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Generic declaration.
template<typename _CharT>
class __basic_file;
// Specialization.
template<>
class __basic_file<char>
{
// Underlying data source/sink.
__c_file* _M_cfile;
// True iff we opened _M_cfile, and thus must close it ourselves.
bool _M_cfile_created;
public:
__basic_file(__c_lock* __lock = 0) throw ();
#if __cplusplus >= 201103L
__basic_file(__basic_file&& __rv, __c_lock* = 0) noexcept
: _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created)
{
__rv._M_cfile = nullptr;
__rv._M_cfile_created = false;
}
__basic_file& operator=(const __basic_file&) = delete;
__basic_file& operator=(__basic_file&&) = delete;
void
swap(__basic_file& __f) noexcept
{
std::swap(_M_cfile, __f._M_cfile);
std::swap(_M_cfile_created, __f._M_cfile_created);
}
#endif
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
__basic_file*
sys_open(__c_file* __file, ios_base::openmode);
__basic_file*
sys_open(int __fd, ios_base::openmode __mode) throw ();
__basic_file*
close();
_GLIBCXX_PURE bool
is_open() const throw ();
_GLIBCXX_PURE int
fd() throw ();
_GLIBCXX_PURE __c_file*
file() throw ();
~__basic_file();
streamsize
xsputn(const char* __s, streamsize __n);
streamsize
xsputn_2(const char* __s1, streamsize __n1,
const char* __s2, streamsize __n2);
streamsize
xsgetn(char* __s, streamsize __n);
streamoff
seekoff(streamoff __off, ios_base::seekdir __way) throw ();
int
sync();
streamsize
showmanyc();
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Optimizations for random number functions, x86 version -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/opt_random.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{random}
*/
#ifndef _BITS_OPT_RANDOM_H
#define _BITS_OPT_RANDOM_H 1
#ifdef __SSE3__
#include <pmmintrin.h>
#endif
#pragma GCC system_header
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __SSE3__
template<>
template<typename _UniformRandomNumberGenerator>
void
normal_distribution<double>::
__generate(typename normal_distribution<double>::result_type* __f,
typename normal_distribution<double>::result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
typedef uint64_t __uctype;
if (__f == __t)
return;
if (_M_saved_available)
{
_M_saved_available = false;
*__f++ = _M_saved * __param.stddev() + __param.mean();
if (__f == __t)
return;
}
constexpr uint64_t __maskval = 0xfffffffffffffull;
static const __m128i __mask = _mm_set1_epi64x(__maskval);
static const __m128i __two = _mm_set1_epi64x(0x4000000000000000ull);
static const __m128d __three = _mm_set1_pd(3.0);
const __m128d __av = _mm_set1_pd(__param.mean());
const __uctype __urngmin = __urng.min();
const __uctype __urngmax = __urng.max();
const __uctype __urngrange = __urngmax - __urngmin;
const __uctype __uerngrange = __urngrange + 1;
while (__f + 1 < __t)
{
double __le;
__m128d __x;
do
{
union
{
__m128i __i;
__m128d __d;
} __v;
if (__urngrange > __maskval)
{
if (__detail::_Power_of_2(__uerngrange))
__v.__i = _mm_and_si128(_mm_set_epi64x(__urng(),
__urng()),
__mask);
else
{
const __uctype __uerange = __maskval + 1;
const __uctype __scaling = __urngrange / __uerange;
const __uctype __past = __uerange * __scaling;
uint64_t __v1;
do
__v1 = __uctype(__urng()) - __urngmin;
while (__v1 >= __past);
__v1 /= __scaling;
uint64_t __v2;
do
__v2 = __uctype(__urng()) - __urngmin;
while (__v2 >= __past);
__v2 /= __scaling;
__v.__i = _mm_set_epi64x(__v1, __v2);
}
}
else if (__urngrange == __maskval)
__v.__i = _mm_set_epi64x(__urng(), __urng());
else if ((__urngrange + 2) * __urngrange >= __maskval
&& __detail::_Power_of_2(__uerngrange))
{
uint64_t __v1 = __urng() * __uerngrange + __urng();
uint64_t __v2 = __urng() * __uerngrange + __urng();
__v.__i = _mm_and_si128(_mm_set_epi64x(__v1, __v2),
__mask);
}
else
{
size_t __nrng = 2;
__uctype __high = __maskval / __uerngrange / __uerngrange;
while (__high > __uerngrange)
{
++__nrng;
__high /= __uerngrange;
}
const __uctype __highrange = __high + 1;
const __uctype __scaling = __urngrange / __highrange;
const __uctype __past = __highrange * __scaling;
__uctype __tmp;
uint64_t __v1;
do
{
do
__tmp = __uctype(__urng()) - __urngmin;
while (__tmp >= __past);
__v1 = __tmp / __scaling;
for (size_t __cnt = 0; __cnt < __nrng; ++__cnt)
{
__tmp = __v1;
__v1 *= __uerngrange;
__v1 += __uctype(__urng()) - __urngmin;
}
}
while (__v1 > __maskval || __v1 < __tmp);
uint64_t __v2;
do
{
do
__tmp = __uctype(__urng()) - __urngmin;
while (__tmp >= __past);
__v2 = __tmp / __scaling;
for (size_t __cnt = 0; __cnt < __nrng; ++__cnt)
{
__tmp = __v2;
__v2 *= __uerngrange;
__v2 += __uctype(__urng()) - __urngmin;
}
}
while (__v2 > __maskval || __v2 < __tmp);
__v.__i = _mm_set_epi64x(__v1, __v2);
}
__v.__i = _mm_or_si128(__v.__i, __two);
__x = _mm_sub_pd(__v.__d, __three);
__m128d __m = _mm_mul_pd(__x, __x);
__le = _mm_cvtsd_f64(_mm_hadd_pd (__m, __m));
}
while (__le == 0.0 || __le >= 1.0);
double __mult = (std::sqrt(-2.0 * std::log(__le) / __le)
* __param.stddev());
__x = _mm_add_pd(_mm_mul_pd(__x, _mm_set1_pd(__mult)), __av);
_mm_storeu_pd(__f, __x);
__f += 2;
}
if (__f != __t)
{
result_type __x, __y, __r2;
__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
do
{
__x = result_type(2.0) * __aurng() - 1.0;
__y = result_type(2.0) * __aurng() - 1.0;
__r2 = __x * __x + __y * __y;
}
while (__r2 > 1.0 || __r2 == 0.0);
const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);
_M_saved = __x * __mult;
_M_saved_available = true;
*__f = __y * __mult * __param.stddev() + __param.mean();
}
}
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // _BITS_OPT_RANDOM_H
// Base to std::allocator -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++allocator.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{memory}
*/
#ifndef _GLIBCXX_CXX_ALLOCATOR_H
#define _GLIBCXX_CXX_ALLOCATOR_H 1
#include <ext/new_allocator.h>
#if __cplusplus >= 201103L
namespace std
{
/**
* @brief An alias to the base class for std::allocator.
* @ingroup allocators
*
* Used to set the std::allocator base class to
* __gnu_cxx::new_allocator.
*
* @tparam _Tp Type of allocated object.
*/
template<typename _Tp>
using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
}
#else
// Define new_allocator as the base class to std::allocator.
# define __allocator_base __gnu_cxx::new_allocator
#endif
#if defined(__SANITIZE_ADDRESS__) && !defined(_GLIBCXX_SANITIZE_STD_ALLOCATOR)
# define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1
#endif
#endif
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_SINGLE_H
#define _GLIBCXX_GCC_GTHR_SINGLE_H
/* Just provide compatibility for mutex handling. */
typedef int __gthread_key_t;
typedef int __gthread_once_t;
typedef int __gthread_mutex_t;
typedef int __gthread_recursive_mutex_t;
#define __GTHREAD_ONCE_INIT 0
#define __GTHREAD_MUTEX_INIT 0
#define __GTHREAD_MUTEX_INIT_FUNCTION(mx) do {} while (0)
#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
#define _GLIBCXX_UNUSED __attribute__((__unused__))
#ifdef _LIBOBJC
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
static inline int
__gthread_objc_init_thread_system (void)
{
/* No thread support available */
return -1;
}
/* Close the threads subsystem. */
static inline int
__gthread_objc_close_thread_system (void)
{
/* No thread support available */
return -1;
}
/* Backend thread functions */
/* Create a new thread of execution. */
static inline objc_thread_t
__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
{
/* No thread support available */
return NULL;
}
/* Set the current thread's priority. */
static inline int
__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
{
/* No thread support available */
return -1;
}
/* Return the current thread's priority. */
static inline int
__gthread_objc_thread_get_priority (void)
{
return OBJC_THREAD_INTERACTIVE_PRIORITY;
}
/* Yield our process time to another thread. */
static inline void
__gthread_objc_thread_yield (void)
{
return;
}
/* Terminate the current thread. */
static inline int
__gthread_objc_thread_exit (void)
{
/* No thread support available */
/* Should we really exit the program */
/* exit (&__objc_thread_exit_status); */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
static inline objc_thread_t
__gthread_objc_thread_id (void)
{
/* No thread support, use 1. */
return (objc_thread_t) 1;
}
/* Sets the thread's local storage pointer. */
static inline int
__gthread_objc_thread_set_data (void *value)
{
thread_local_storage = value;
return 0;
}
/* Returns the thread's local storage pointer. */
static inline void *
__gthread_objc_thread_get_data (void)
{
return thread_local_storage;
}
/* Backend mutex functions */
/* Allocate a mutex. */
static inline int
__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Deallocate a mutex. */
static inline int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
/* There can only be one thread, so we always get the lock */
return 0;
}
/* Try to grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
/* There can only be one thread, so we always get the lock */
return 0;
}
/* Unlock the mutex */
static inline int
__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
static inline int
__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
/* Deallocate a condition. */
static inline int
__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
/* Wait on the condition */
static inline int
__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
objc_mutex_t mutex _GLIBCXX_UNUSED)
{
return 0;
}
/* Wake up all threads waiting on this condition. */
static inline int
__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
/* Wake up one thread waiting on this condition. */
static inline int
__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
{
return 0;
}
#else /* _LIBOBJC */
static inline int
__gthread_active_p (void)
{
return 0;
}
static inline int
__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
{
return 0;
}
static inline int _GLIBCXX_UNUSED
__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
{
return 0;
}
static int _GLIBCXX_UNUSED
__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
{
return 0;
}
static inline void *
__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
{
return 0;
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (__mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
#endif /* _LIBOBJC */
#undef _GLIBCXX_UNUSED
#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
// Specific definitions for generic platforms -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/cpu_defines.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_CPU_DEFINES
#define _GLIBCXX_CPU_DEFINES 1
#endif
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
// 17.4.1.2 Headers
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cuchar>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif
#if __cplusplus >= 201703L
#include <charconv>
#include <filesystem>
#endif
/* Threads compatibility routines for libgcc2. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_H
#define _GLIBCXX_GCC_GTHR_H
#ifndef _GLIBCXX_HIDE_EXPORTS
#pragma GCC visibility push(default)
#endif
/* If this file is compiled with threads support, it must
#define __GTHREADS 1
to indicate that threads support is present. Also it has define
function
int __gthread_active_p ()
that returns 1 if thread system is active, 0 if not.
The threads interface must define the following types:
__gthread_key_t
__gthread_once_t
__gthread_mutex_t
__gthread_recursive_mutex_t
The threads interface must define the following macros:
__GTHREAD_ONCE_INIT
to initialize __gthread_once_t
__GTHREAD_MUTEX_INIT
to initialize __gthread_mutex_t to get a fast
non-recursive mutex.
__GTHREAD_MUTEX_INIT_FUNCTION
to initialize __gthread_mutex_t to get a fast
non-recursive mutex.
Define this to a function which looks like this:
void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
Some systems can't initialize a mutex without a
function call. Don't define __GTHREAD_MUTEX_INIT in this case.
__GTHREAD_RECURSIVE_MUTEX_INIT
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
as above, but for a recursive mutex.
The threads interface must define the following static functions:
int __gthread_once (__gthread_once_t *once, void (*func) ())
int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
int __gthread_key_delete (__gthread_key_t key)
void *__gthread_getspecific (__gthread_key_t key)
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
int __gthread_mutex_lock (__gthread_mutex_t *mutex);
int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
The following are supported in POSIX threads only. They are required to
fix a deadlock in static initialization inside libsupc++. The header file
gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
features are supported.
Types:
__gthread_cond_t
Macros:
__GTHREAD_COND_INIT
__GTHREAD_COND_INIT_FUNCTION
Interface:
int __gthread_cond_broadcast (__gthread_cond_t *cond);
int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
__gthread_recursive_mutex_t *mutex);
All functions returning int should return zero on success or the error
number. If the operation is not supported, -1 is returned.
If the following are also defined, you should
#define __GTHREADS_CXX0X 1
to enable the c++0x thread library.
Types:
__gthread_t
__gthread_time_t
Interface:
int __gthread_create (__gthread_t *thread, void *(*func) (void*),
void *args);
int __gthread_join (__gthread_t thread, void **value_ptr);
int __gthread_detach (__gthread_t thread);
int __gthread_equal (__gthread_t t1, __gthread_t t2);
__gthread_t __gthread_self (void);
int __gthread_yield (void);
int __gthread_mutex_timedlock (__gthread_mutex_t *m,
const __gthread_time_t *abs_timeout);
int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
const __gthread_time_t *abs_time);
int __gthread_cond_signal (__gthread_cond_t *cond);
int __gthread_cond_timedwait (__gthread_cond_t *cond,
__gthread_mutex_t *mutex,
const __gthread_time_t *abs_timeout);
*/
#if __GXX_WEAK__
/* The pe-coff weak support isn't fully compatible to ELF's weak.
For static libraries it might would work, but as we need to deal
with shared versions too, we disable it for mingw-targets. */
#ifdef __MINGW32__
#undef _GLIBCXX_GTHREAD_USE_WEAK
#define _GLIBCXX_GTHREAD_USE_WEAK 0
#endif
#ifndef _GLIBCXX_GTHREAD_USE_WEAK
#define _GLIBCXX_GTHREAD_USE_WEAK 1
#endif
#endif
#include <bits/gthr-default.h>
#ifndef _GLIBCXX_HIDE_EXPORTS
#pragma GCC visibility pop
#endif
#endif /* ! _GLIBCXX_GCC_GTHR_H */
// Wrapper for underlying C-language localization -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++locale.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.8 Standard locale categories.
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
#ifndef _GLIBCXX_CXX_LOCALE_H
#define _GLIBCXX_CXX_LOCALE_H 1
#pragma GCC system_header
#include <clocale>
#define _GLIBCXX_C_LOCALE_GNU 1
#define _GLIBCXX_NUM_CATEGORIES 6
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
extern "C" __typeof(uselocale) __uselocale;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __locale_t __c_locale;
// Convert numeric value of type double and long double to string and
// return length of string. If vsnprintf is available use it, otherwise
// fall back to the unsafe vsprintf which, in general, can be dangerous
// and should be avoided.
inline int
__convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)),
char* __out,
const int __size __attribute__ ((__unused__)),
const char* __fmt, ...)
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
char* __old = std::setlocale(LC_NUMERIC, 0);
char* __sav = 0;
if (__builtin_strcmp(__old, "C"))
{
const size_t __len = __builtin_strlen(__old) + 1;
__sav = new char[__len];
__builtin_memcpy(__sav, __old, __len);
std::setlocale(LC_NUMERIC, "C");
}
#endif
__builtin_va_list __args;
__builtin_va_start(__args, __fmt);
#if _GLIBCXX_USE_C99_STDIO
const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
#else
const int __ret = __builtin_vsprintf(__out, __fmt, __args);
#endif
__builtin_va_end(__args);
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__gnu_cxx::__uselocale(__old);
#else
if (__sav)
{
std::setlocale(LC_NUMERIC, __sav);
delete [] __sav;
}
#endif
return __ret;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Control various target specific ABI tweaks. Generic version.
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/cxxabi_tweaks.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{cxxabi.h}
*/
#ifndef _CXXABI_TWEAKS_H
#define _CXXABI_TWEAKS_H 1
#ifdef __cplusplus
namespace __cxxabiv1
{
extern "C"
{
#endif
// The generic ABI uses the first byte of a 64-bit guard variable.
#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
__extension__ typedef int __guard __attribute__((mode (__DI__)));
// __cxa_vec_ctor has void return type.
typedef void __cxa_vec_ctor_return_type;
#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
// Constructors and destructors do not return a value.
typedef void __cxa_cdtor_return_type;
#ifdef __cplusplus
}
} // namespace __cxxabiv1
#endif
#endif
// Low-level type for atomic operations -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file atomic_word.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_ATOMIC_WORD_H
#define _GLIBCXX_ATOMIC_WORD_H 1
typedef int _Atomic_word;
// This is a memory order acquire fence.
#define _GLIBCXX_READ_MEM_BARRIER __atomic_thread_fence (__ATOMIC_ACQUIRE)
// This is a memory order release fence.
#define _GLIBCXX_WRITE_MEM_BARRIER __atomic_thread_fence (__ATOMIC_RELEASE)
#endif
#ifndef _CPP_CPPCONFIG_WRAPPER
#define _CPP_CPPCONFIG_WRAPPER 1
#include <bits/wordsize.h>
#if __WORDSIZE == 32
// Predefined symbols and macros -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++config.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_CXX_CONFIG_H
#define _GLIBCXX_CXX_CONFIG_H 1
// The major release number for the GCC release the C++ library belongs to.
#define _GLIBCXX_RELEASE 8
// The datestamp of the C++ library in compressed ISO date format.
#define __GLIBCXX__ 20210514
// Macros for various attributes.
// _GLIBCXX_PURE
// _GLIBCXX_CONST
// _GLIBCXX_NORETURN
// _GLIBCXX_NOTHROW
// _GLIBCXX_VISIBILITY
#ifndef _GLIBCXX_PURE
# define _GLIBCXX_PURE __attribute__ ((__pure__))
#endif
#ifndef _GLIBCXX_CONST
# define _GLIBCXX_CONST __attribute__ ((__const__))
#endif
#ifndef _GLIBCXX_NORETURN
# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
#endif
// See below for C++
#ifndef _GLIBCXX_NOTHROW
# ifndef __cplusplus
# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
# endif
#endif
// Macros for visibility attributes.
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
// _GLIBCXX_VISIBILITY
# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
#else
// If this is not supplied by the OS-specific or CPU-specific
// headers included below, it will be defined to an empty default.
# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
#endif
// Macros for deprecated attributes.
// _GLIBCXX_USE_DEPRECATED
// _GLIBCXX_DEPRECATED
// _GLIBCXX17_DEPRECATED
#ifndef _GLIBCXX_USE_DEPRECATED
# define _GLIBCXX_USE_DEPRECATED 1
#endif
#if defined(__DEPRECATED) && (__cplusplus >= 201103L)
# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
#else
# define _GLIBCXX_DEPRECATED
#endif
#if defined(__DEPRECATED) && (__cplusplus >= 201703L)
# define _GLIBCXX17_DEPRECATED [[__deprecated__]]
#else
# define _GLIBCXX17_DEPRECATED
#endif
// Macros for ABI tag attributes.
#ifndef _GLIBCXX_ABI_TAG_CXX11
# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
#endif
// Macro to warn about unused results.
#if __cplusplus >= 201703L
# define _GLIBCXX_NODISCARD [[__nodiscard__]]
#else
# define _GLIBCXX_NODISCARD
#endif
#if __cplusplus
// Macro for constexpr, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_CONSTEXPR
# if __cplusplus >= 201103L
# define _GLIBCXX_CONSTEXPR constexpr
# define _GLIBCXX_USE_CONSTEXPR constexpr
# else
# define _GLIBCXX_CONSTEXPR
# define _GLIBCXX_USE_CONSTEXPR const
# endif
#endif
#ifndef _GLIBCXX14_CONSTEXPR
# if __cplusplus >= 201402L
# define _GLIBCXX14_CONSTEXPR constexpr
# else
# define _GLIBCXX14_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX17_CONSTEXPR
# if __cplusplus > 201402L
# define _GLIBCXX17_CONSTEXPR constexpr
# else
# define _GLIBCXX17_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX17_INLINE
# if __cplusplus > 201402L
# define _GLIBCXX17_INLINE inline
# else
# define _GLIBCXX17_INLINE
# endif
#endif
// Macro for noexcept, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_NOEXCEPT
# if __cplusplus >= 201103L
# define _GLIBCXX_NOEXCEPT noexcept
# define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND)
# define _GLIBCXX_USE_NOEXCEPT noexcept
# define _GLIBCXX_THROW(_EXC)
# else
# define _GLIBCXX_NOEXCEPT
# define _GLIBCXX_NOEXCEPT_IF(_COND)
# define _GLIBCXX_USE_NOEXCEPT throw()
# define _GLIBCXX_THROW(_EXC) throw(_EXC)
# endif
#endif
#ifndef _GLIBCXX_NOTHROW
# define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT
#endif
#ifndef _GLIBCXX_THROW_OR_ABORT
# if __cpp_exceptions
# define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC))
# else
# define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort())
# endif
#endif
#if __cpp_noexcept_function_type
#define _GLIBCXX_NOEXCEPT_PARM , bool _NE
#define _GLIBCXX_NOEXCEPT_QUAL noexcept (_NE)
#else
#define _GLIBCXX_NOEXCEPT_PARM
#define _GLIBCXX_NOEXCEPT_QUAL
#endif
// Macro for extern template, ie controlling template linkage via use
// of extern keyword on template declaration. As documented in the g++
// manual, it inhibits all implicit instantiations and is used
// throughout the library to avoid multiple weak definitions for
// required types that are already explicitly instantiated in the
// library binary. This substantially reduces the binary size of
// resulting executables.
// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
// templates only in basic_string, thus activating its debug-mode
// checks even at -O0.
# define _GLIBCXX_EXTERN_TEMPLATE 1
/*
Outline of libstdc++ namespaces.
namespace std
{
namespace __debug { }
namespace __parallel { }
namespace __profile { }
namespace __cxx1998 { }
namespace __detail {
namespace __variant { } // C++17
}
namespace rel_ops { }
namespace tr1
{
namespace placeholders { }
namespace regex_constants { }
namespace __detail { }
}
namespace tr2 { }
namespace decimal { }
namespace chrono { } // C++11
namespace placeholders { } // C++11
namespace regex_constants { } // C++11
namespace this_thread { } // C++11
inline namespace literals { // C++14
inline namespace chrono_literals { } // C++14
inline namespace complex_literals { } // C++14
inline namespace string_literals { } // C++14
inline namespace string_view_literals { } // C++17
}
}
namespace abi { }
namespace __gnu_cxx
{
namespace __detail { }
}
For full details see:
http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
*/
namespace std
{
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#if __cplusplus >= 201103L
typedef decltype(nullptr) nullptr_t;
#endif
}
# define _GLIBCXX_USE_DUAL_ABI 1
#if ! _GLIBCXX_USE_DUAL_ABI
// Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI
# undef _GLIBCXX_USE_CXX11_ABI
#endif
#ifndef _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#if _GLIBCXX_USE_CXX11_ABI
namespace std
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
namespace __gnu_cxx
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
# define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
# define _GLIBCXX_END_NAMESPACE_CXX11 }
# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11
#else
# define _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_CXX11
# define _GLIBCXX_DEFAULT_ABI_TAG
#endif
// Defined if inline namespaces are used for versioning.
# define _GLIBCXX_INLINE_VERSION 0
// Inline namespace for symbol versioning.
#if _GLIBCXX_INLINE_VERSION
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 {
# define _GLIBCXX_END_NAMESPACE_VERSION }
namespace std
{
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201402L
inline namespace literals {
inline namespace chrono_literals { }
inline namespace complex_literals { }
inline namespace string_literals { }
#if __cplusplus > 201402L
inline namespace string_view_literals { }
#endif // C++17
}
#endif // C++14
_GLIBCXX_END_NAMESPACE_VERSION
}
namespace __gnu_cxx
{
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
#else
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
# define _GLIBCXX_END_NAMESPACE_VERSION
#endif
// Inline namespaces for special modes: debug, parallel, profile.
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
|| defined(_GLIBCXX_PROFILE)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Non-inline namespace for components replaced by alternates in active mode.
namespace __cxx1998
{
# if _GLIBCXX_USE_CXX11_ABI
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
# endif
}
_GLIBCXX_END_NAMESPACE_VERSION
// Inline namespace for debug mode.
# ifdef _GLIBCXX_DEBUG
inline namespace __debug { }
# endif
// Inline namespaces for parallel mode.
# ifdef _GLIBCXX_PARALLEL
inline namespace __parallel { }
# endif
// Inline namespaces for profile mode
# ifdef _GLIBCXX_PROFILE
inline namespace __profile { }
# endif
}
// Check for invalid usage and unsupported mixed-mode use.
# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
# error illegal use of multiple inlined namespaces
# endif
# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
# error illegal use of multiple inlined namespaces
# endif
# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
# error illegal use of multiple inlined namespaces
# endif
// Check for invalid use due to lack for weak symbols.
# if __NO_INLINE__ && !__GXX_WEAK__
# warning currently using inlined namespace mode which may fail \
without inlining due to lack of weak symbols
# endif
#endif
// Macros for namespace scope. Either namespace std:: or the name
// of some nested namespace within it corresponding to the active mode.
// _GLIBCXX_STD_A
// _GLIBCXX_STD_C
//
// Macros for opening/closing conditional namespaces.
// _GLIBCXX_BEGIN_NAMESPACE_ALGO
// _GLIBCXX_END_NAMESPACE_ALGO
// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// _GLIBCXX_END_NAMESPACE_CONTAINER
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
# define _GLIBCXX_STD_C __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
namespace _GLIBCXX_STD_C {
# define _GLIBCXX_END_NAMESPACE_CONTAINER }
#else
# define _GLIBCXX_STD_C std
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
# define _GLIBCXX_END_NAMESPACE_CONTAINER
#endif
#ifdef _GLIBCXX_PARALLEL
# define _GLIBCXX_STD_A __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
namespace _GLIBCXX_STD_A {
# define _GLIBCXX_END_NAMESPACE_ALGO }
#else
# define _GLIBCXX_STD_A std
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
# define _GLIBCXX_END_NAMESPACE_ALGO
#endif
// GLIBCXX_ABI Deprecated
// Define if compatibility should be provided for -mlong-double-64.
#undef _GLIBCXX_LONG_DOUBLE_COMPAT
// Inline namespace for long double 128 mode.
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
namespace std
{
inline namespace __gnu_cxx_ldbl128 { }
}
# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
# define _GLIBCXX_END_NAMESPACE_LDBL }
#else
# define _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL
#endif
#if _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11
#else
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL
#endif
// Debug Mode implies checking assertions.
#if defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_ASSERTIONS)
# define _GLIBCXX_ASSERTIONS 1
#endif
// Disable std::string explicit instantiation declarations in order to assert.
#ifdef _GLIBCXX_ASSERTIONS
# undef _GLIBCXX_EXTERN_TEMPLATE
# define _GLIBCXX_EXTERN_TEMPLATE -1
#endif
// Assert.
#if defined(_GLIBCXX_ASSERTIONS) \
|| defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS)
namespace std
{
// Avoid the use of assert, because we're trying to keep the <cassert>
// include out of the mix.
inline void
__replacement_assert(const char* __file, int __line,
const char* __function, const char* __condition)
{
__builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
__function, __condition);
__builtin_abort();
}
}
#define __glibcxx_assert_impl(_Condition) \
do \
{ \
if (! (_Condition)) \
std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
#_Condition); \
} while (false)
#endif
#if defined(_GLIBCXX_ASSERTIONS)
# define __glibcxx_assert(_Condition) __glibcxx_assert_impl(_Condition)
#else
# define __glibcxx_assert(_Condition)
#endif
// Macros for race detectors.
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
// atomic (lock-free) synchronization to race detectors:
// the race detector will infer a happens-before arc from the former to the
// latter when they share the same argument pointer.
//
// The most frequent use case for these macros (and the only case in the
// current implementation of the library) is atomic reference counting:
// void _M_remove_reference()
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
// _M_destroy(__a);
// }
// }
// The annotations in this example tell the race detector that all memory
// accesses occurred when the refcount was positive do not race with
// memory accesses which occurred after the refcount became zero.
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
#endif
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
#endif
// Macros for C linkage: define extern "C" linkage only when using C++.
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
# define _GLIBCXX_END_EXTERN_C }
# define _GLIBCXX_USE_ALLOCATOR_NEW 1
#else // !__cplusplus
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
#endif
// First includes.
// Pick up any OS-specific definitions.
#include <bits/os_defines.h>
// Pick up any CPU-specific definitions.
#include <bits/cpu_defines.h>
// If platform uses neither visibility nor psuedo-visibility,
// specify empty default for namespace annotation macros.
#ifndef _GLIBCXX_PSEUDO_VISIBILITY
# define _GLIBCXX_PSEUDO_VISIBILITY(V)
#endif
// Certain function definitions that are meant to be overridable from
// user code are decorated with this macro. For some targets, this
// macro causes these definitions to be weak.
#ifndef _GLIBCXX_WEAK_DEFINITION
# define _GLIBCXX_WEAK_DEFINITION
#endif
// By default, we assume that __GXX_WEAK__ also means that there is support
// for declaring functions as weak while not defining such functions. This
// allows for referring to functions provided by other libraries (e.g.,
// libitm) without depending on them if the respective features are not used.
#ifndef _GLIBCXX_USE_WEAK_REF
# define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__
#endif
// Conditionally enable annotations for the Transactional Memory TS on C++11.
// Most of the following conditions are due to limitations in the current
// implementation.
#if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \
&& _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \
&& !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF \
&& _GLIBCXX_USE_ALLOCATOR_NEW
#define _GLIBCXX_TXN_SAFE transaction_safe
#define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic
#else
#define _GLIBCXX_TXN_SAFE
#define _GLIBCXX_TXN_SAFE_DYN
#endif
#if __cplusplus > 201402L
// In C++17 mathematical special functions are in namespace std.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
// For C++11 and C++14 they are in namespace std when requested.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#endif
// The remainder of the prewritten config is automatic; all the
// user hooks are listed above.
// Create a boolean flag to be used to determine if --fast-math is set.
#ifdef __FAST_MATH__
# define _GLIBCXX_FAST_MATH 1
#else
# define _GLIBCXX_FAST_MATH 0
#endif
// This marks string literals in header files to be extracted for eventual
// translation. It is primarily used for messages in thrown exceptions; see
// src/functexcept.cc. We use __N because the more traditional _N is used
// for something else under certain OSes (see BADNAMES).
#define __N(msgid) (msgid)
// For example, <windows.h> is known to #define min and max as macros...
#undef min
#undef max
// N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally
// so they should be tested with #if not with #ifdef.
#if __cplusplus >= 201103L
# ifndef _GLIBCXX_USE_C99_MATH
# define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH
# endif
# ifndef _GLIBCXX_USE_C99_COMPLEX
# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX
# endif
# ifndef _GLIBCXX_USE_C99_STDIO
# define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO
# endif
# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB
# endif
# ifndef _GLIBCXX_USE_C99_WCHAR
# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR
# endif
#else
# ifndef _GLIBCXX_USE_C99_MATH
# define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH
# endif
# ifndef _GLIBCXX_USE_C99_COMPLEX
# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX
# endif
# ifndef _GLIBCXX_USE_C99_STDIO
# define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO
# endif
# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB
# endif
# ifndef _GLIBCXX_USE_C99_WCHAR
# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR
# endif
#endif
/* Define if __float128 is supported on this host. */
#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
#define _GLIBCXX_USE_FLOAT128 1
#endif
// End of prewritten config; the settings discovered at configure time follow.
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `acosf' function. */
#define _GLIBCXX_HAVE_ACOSF 1
/* Define to 1 if you have the `acosl' function. */
#define _GLIBCXX_HAVE_ACOSL 1
/* Define to 1 if you have the `aligned_alloc' function. */
#define _GLIBCXX_HAVE_ALIGNED_ALLOC 1
/* Define to 1 if you have the `asinf' function. */
#define _GLIBCXX_HAVE_ASINF 1
/* Define to 1 if you have the `asinl' function. */
#define _GLIBCXX_HAVE_ASINL 1
/* Define to 1 if the target assembler supports .symver directive. */
#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
/* Define to 1 if you have the `atan2f' function. */
#define _GLIBCXX_HAVE_ATAN2F 1
/* Define to 1 if you have the `atan2l' function. */
#define _GLIBCXX_HAVE_ATAN2L 1
/* Define to 1 if you have the `atanf' function. */
#define _GLIBCXX_HAVE_ATANF 1
/* Define to 1 if you have the `atanl' function. */
#define _GLIBCXX_HAVE_ATANL 1
/* Define to 1 if you have the `at_quick_exit' function. */
#define _GLIBCXX_HAVE_AT_QUICK_EXIT 1
/* Define to 1 if the target assembler supports thread-local storage. */
/* #undef _GLIBCXX_HAVE_CC_TLS */
/* Define to 1 if you have the `ceilf' function. */
#define _GLIBCXX_HAVE_CEILF 1
/* Define to 1 if you have the `ceill' function. */
#define _GLIBCXX_HAVE_CEILL 1
/* Define to 1 if you have the <complex.h> header file. */
#define _GLIBCXX_HAVE_COMPLEX_H 1
/* Define to 1 if you have the `cosf' function. */
#define _GLIBCXX_HAVE_COSF 1
/* Define to 1 if you have the `coshf' function. */
#define _GLIBCXX_HAVE_COSHF 1
/* Define to 1 if you have the `coshl' function. */
#define _GLIBCXX_HAVE_COSHL 1
/* Define to 1 if you have the `cosl' function. */
#define _GLIBCXX_HAVE_COSL 1
/* Define to 1 if you have the <dirent.h> header file. */
#define _GLIBCXX_HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define _GLIBCXX_HAVE_DLFCN_H 1
/* Define if EBADMSG exists. */
#define _GLIBCXX_HAVE_EBADMSG 1
/* Define if ECANCELED exists. */
#define _GLIBCXX_HAVE_ECANCELED 1
/* Define if ECHILD exists. */
#define _GLIBCXX_HAVE_ECHILD 1
/* Define if EIDRM exists. */
#define _GLIBCXX_HAVE_EIDRM 1
/* Define to 1 if you have the <endian.h> header file. */
#define _GLIBCXX_HAVE_ENDIAN_H 1
/* Define if ENODATA exists. */
#define _GLIBCXX_HAVE_ENODATA 1
/* Define if ENOLINK exists. */
#define _GLIBCXX_HAVE_ENOLINK 1
/* Define if ENOSPC exists. */
#define _GLIBCXX_HAVE_ENOSPC 1
/* Define if ENOSR exists. */
#define _GLIBCXX_HAVE_ENOSR 1
/* Define if ENOSTR exists. */
#define _GLIBCXX_HAVE_ENOSTR 1
/* Define if ENOTRECOVERABLE exists. */
#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
/* Define if ENOTSUP exists. */
#define _GLIBCXX_HAVE_ENOTSUP 1
/* Define if EOVERFLOW exists. */
#define _GLIBCXX_HAVE_EOVERFLOW 1
/* Define if EOWNERDEAD exists. */
#define _GLIBCXX_HAVE_EOWNERDEAD 1
/* Define if EPERM exists. */
#define _GLIBCXX_HAVE_EPERM 1
/* Define if EPROTO exists. */
#define _GLIBCXX_HAVE_EPROTO 1
/* Define if ETIME exists. */
#define _GLIBCXX_HAVE_ETIME 1
/* Define if ETIMEDOUT exists. */
#define _GLIBCXX_HAVE_ETIMEDOUT 1
/* Define if ETXTBSY exists. */
#define _GLIBCXX_HAVE_ETXTBSY 1
/* Define if EWOULDBLOCK exists. */
#define _GLIBCXX_HAVE_EWOULDBLOCK 1
/* Define to 1 if GCC 4.6 supported std::exception_ptr for the target */
#define _GLIBCXX_HAVE_EXCEPTION_PTR_SINCE_GCC46 1
/* Define to 1 if you have the <execinfo.h> header file. */
#define _GLIBCXX_HAVE_EXECINFO_H 1
/* Define to 1 if you have the `expf' function. */
#define _GLIBCXX_HAVE_EXPF 1
/* Define to 1 if you have the `expl' function. */
#define _GLIBCXX_HAVE_EXPL 1
/* Define to 1 if you have the `fabsf' function. */
#define _GLIBCXX_HAVE_FABSF 1
/* Define to 1 if you have the `fabsl' function. */
#define _GLIBCXX_HAVE_FABSL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define _GLIBCXX_HAVE_FCNTL_H 1
/* Define to 1 if you have the <fenv.h> header file. */
#define _GLIBCXX_HAVE_FENV_H 1
/* Define to 1 if you have the `finite' function. */
#define _GLIBCXX_HAVE_FINITE 1
/* Define to 1 if you have the `finitef' function. */
#define _GLIBCXX_HAVE_FINITEF 1
/* Define to 1 if you have the `finitel' function. */
#define _GLIBCXX_HAVE_FINITEL 1
/* Define to 1 if you have the <float.h> header file. */
#define _GLIBCXX_HAVE_FLOAT_H 1
/* Define to 1 if you have the `floorf' function. */
#define _GLIBCXX_HAVE_FLOORF 1
/* Define to 1 if you have the `floorl' function. */
#define _GLIBCXX_HAVE_FLOORL 1
/* Define to 1 if you have the `fmodf' function. */
#define _GLIBCXX_HAVE_FMODF 1
/* Define to 1 if you have the `fmodl' function. */
#define _GLIBCXX_HAVE_FMODL 1
/* Define to 1 if you have the `fpclass' function. */
/* #undef _GLIBCXX_HAVE_FPCLASS */
/* Define to 1 if you have the <fp.h> header file. */
/* #undef _GLIBCXX_HAVE_FP_H */
/* Define to 1 if you have the `frexpf' function. */
#define _GLIBCXX_HAVE_FREXPF 1
/* Define to 1 if you have the `frexpl' function. */
#define _GLIBCXX_HAVE_FREXPL 1
/* Define if _Unwind_GetIPInfo is available. */
#define _GLIBCXX_HAVE_GETIPINFO 1
/* Define if gets is available in <stdio.h> before C++14. */
#define _GLIBCXX_HAVE_GETS 1
/* Define to 1 if you have the `hypot' function. */
#define _GLIBCXX_HAVE_HYPOT 1
/* Define to 1 if you have the `hypotf' function. */
#define _GLIBCXX_HAVE_HYPOTF 1
/* Define to 1 if you have the `hypotl' function. */
#define _GLIBCXX_HAVE_HYPOTL 1
/* Define if you have the iconv() function. */
#define _GLIBCXX_HAVE_ICONV 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef _GLIBCXX_HAVE_IEEEFP_H */
/* Define if int64_t is available in <stdint.h>. */
#define _GLIBCXX_HAVE_INT64_T 1
/* Define if int64_t is a long. */
/* #undef _GLIBCXX_HAVE_INT64_T_LONG */
/* Define if int64_t is a long long. */
#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define _GLIBCXX_HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isinf' function. */
/* #undef _GLIBCXX_HAVE_ISINF */
/* Define to 1 if you have the `isinff' function. */
#define _GLIBCXX_HAVE_ISINFF 1
/* Define to 1 if you have the `isinfl' function. */
#define _GLIBCXX_HAVE_ISINFL 1
/* Define to 1 if you have the `isnan' function. */
/* #undef _GLIBCXX_HAVE_ISNAN */
/* Define to 1 if you have the `isnanf' function. */
#define _GLIBCXX_HAVE_ISNANF 1
/* Define to 1 if you have the `isnanl' function. */
#define _GLIBCXX_HAVE_ISNANL 1
/* Defined if iswblank exists. */
#define _GLIBCXX_HAVE_ISWBLANK 1
/* Define if LC_MESSAGES is available in <locale.h>. */
#define _GLIBCXX_HAVE_LC_MESSAGES 1
/* Define to 1 if you have the `ldexpf' function. */
#define _GLIBCXX_HAVE_LDEXPF 1
/* Define to 1 if you have the `ldexpl' function. */
#define _GLIBCXX_HAVE_LDEXPL 1
/* Define to 1 if you have the <libintl.h> header file. */
#define _GLIBCXX_HAVE_LIBINTL_H 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_AS 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_DATA 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_FSIZE 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_RSS 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_VMEM 0
/* Define if futex syscall is available. */
#define _GLIBCXX_HAVE_LINUX_FUTEX 1
/* Define to 1 if you have the <linux/random.h> header file. */
#define _GLIBCXX_HAVE_LINUX_RANDOM_H 1
/* Define to 1 if you have the <linux/types.h> header file. */
#define _GLIBCXX_HAVE_LINUX_TYPES_H 1
/* Define to 1 if you have the <locale.h> header file. */
#define _GLIBCXX_HAVE_LOCALE_H 1
/* Define to 1 if you have the `log10f' function. */
#define _GLIBCXX_HAVE_LOG10F 1
/* Define to 1 if you have the `log10l' function. */
#define _GLIBCXX_HAVE_LOG10L 1
/* Define to 1 if you have the `logf' function. */
#define _GLIBCXX_HAVE_LOGF 1
/* Define to 1 if you have the `logl' function. */
#define _GLIBCXX_HAVE_LOGL 1
/* Define to 1 if you have the <machine/endian.h> header file. */
/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
/* Define to 1 if you have the <machine/param.h> header file. */
/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
/* Define if mbstate_t exists in wchar.h. */
#define _GLIBCXX_HAVE_MBSTATE_T 1
/* Define to 1 if you have the `memalign' function. */
#define _GLIBCXX_HAVE_MEMALIGN 1
/* Define to 1 if you have the <memory.h> header file. */
#define _GLIBCXX_HAVE_MEMORY_H 1
/* Define to 1 if you have the `modf' function. */
#define _GLIBCXX_HAVE_MODF 1
/* Define to 1 if you have the `modff' function. */
#define _GLIBCXX_HAVE_MODFF 1
/* Define to 1 if you have the `modfl' function. */
#define _GLIBCXX_HAVE_MODFL 1
/* Define to 1 if you have the <nan.h> header file. */
/* #undef _GLIBCXX_HAVE_NAN_H */
/* Define if <math.h> defines obsolete isinf function. */
/* #undef _GLIBCXX_HAVE_OBSOLETE_ISINF */
/* Define if <math.h> defines obsolete isnan function. */
/* #undef _GLIBCXX_HAVE_OBSOLETE_ISNAN */
/* Define if poll is available in <poll.h>. */
#define _GLIBCXX_HAVE_POLL 1
/* Define to 1 if you have the `posix_memalign' function. */
#define _GLIBCXX_HAVE_POSIX_MEMALIGN 1
/* Define to 1 if you have the `powf' function. */
#define _GLIBCXX_HAVE_POWF 1
/* Define to 1 if you have the `powl' function. */
#define _GLIBCXX_HAVE_POWL 1
/* Define to 1 if you have the `qfpclass' function. */
/* #undef _GLIBCXX_HAVE_QFPCLASS */
/* Define to 1 if you have the `quick_exit' function. */
#define _GLIBCXX_HAVE_QUICK_EXIT 1
/* Define to 1 if you have the `setenv' function. */
#define _GLIBCXX_HAVE_SETENV 1
/* Define to 1 if you have the `sincos' function. */
#define _GLIBCXX_HAVE_SINCOS 1
/* Define to 1 if you have the `sincosf' function. */
#define _GLIBCXX_HAVE_SINCOSF 1
/* Define to 1 if you have the `sincosl' function. */
#define _GLIBCXX_HAVE_SINCOSL 1
/* Define to 1 if you have the `sinf' function. */
#define _GLIBCXX_HAVE_SINF 1
/* Define to 1 if you have the `sinhf' function. */
#define _GLIBCXX_HAVE_SINHF 1
/* Define to 1 if you have the `sinhl' function. */
#define _GLIBCXX_HAVE_SINHL 1
/* Define to 1 if you have the `sinl' function. */
#define _GLIBCXX_HAVE_SINL 1
/* Defined if sleep exists. */
/* #undef _GLIBCXX_HAVE_SLEEP */
/* Define to 1 if you have the `sqrtf' function. */
#define _GLIBCXX_HAVE_SQRTF 1
/* Define to 1 if you have the `sqrtl' function. */
#define _GLIBCXX_HAVE_SQRTL 1
/* Define to 1 if you have the <stdalign.h> header file. */
#define _GLIBCXX_HAVE_STDALIGN_H 1
/* Define to 1 if you have the <stdbool.h> header file. */
#define _GLIBCXX_HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define _GLIBCXX_HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define _GLIBCXX_HAVE_STDLIB_H 1
/* Define if strerror_l is available in <string.h>. */
#define _GLIBCXX_HAVE_STRERROR_L 1
/* Define if strerror_r is available in <string.h>. */
#define _GLIBCXX_HAVE_STRERROR_R 1
/* Define to 1 if you have the <strings.h> header file. */
#define _GLIBCXX_HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define _GLIBCXX_HAVE_STRING_H 1
/* Define to 1 if you have the `strtof' function. */
#define _GLIBCXX_HAVE_STRTOF 1
/* Define to 1 if you have the `strtold' function. */
#define _GLIBCXX_HAVE_STRTOLD 1
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1
/* Define if strxfrm_l is available in <string.h>. */
#define _GLIBCXX_HAVE_STRXFRM_L 1
/* Define to 1 if the target runtime linker supports binding the same symbol
to different versions. */
#define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1
/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/ipc.h> header file. */
#define _GLIBCXX_HAVE_SYS_IPC_H 1
/* Define to 1 if you have the <sys/isa_defs.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
/* Define to 1 if you have the <sys/machine.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define _GLIBCXX_HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have a suitable <sys/sdt.h> header file */
#define _GLIBCXX_HAVE_SYS_SDT_H 1
/* Define to 1 if you have the <sys/sem.h> header file. */
#define _GLIBCXX_HAVE_SYS_SEM_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define _GLIBCXX_HAVE_SYS_STATVFS_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define _GLIBCXX_HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysinfo.h> header file. */
#define _GLIBCXX_HAVE_SYS_SYSINFO_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define _GLIBCXX_HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define _GLIBCXX_HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define _GLIBCXX_HAVE_SYS_UIO_H 1
/* Define if S_IFREG is available in <sys/stat.h>. */
/* #undef _GLIBCXX_HAVE_S_IFREG */
/* Define if S_ISREG is available in <sys/stat.h>. */
#define _GLIBCXX_HAVE_S_ISREG 1
/* Define to 1 if you have the `tanf' function. */
#define _GLIBCXX_HAVE_TANF 1
/* Define to 1 if you have the `tanhf' function. */
#define _GLIBCXX_HAVE_TANHF 1
/* Define to 1 if you have the `tanhl' function. */
#define _GLIBCXX_HAVE_TANHL 1
/* Define to 1 if you have the `tanl' function. */
#define _GLIBCXX_HAVE_TANL 1
/* Define to 1 if you have the <tgmath.h> header file. */
#define _GLIBCXX_HAVE_TGMATH_H 1
/* Define to 1 if the target supports thread-local storage. */
#define _GLIBCXX_HAVE_TLS 1
/* Define to 1 if you have the <uchar.h> header file. */
#define _GLIBCXX_HAVE_UCHAR_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define _GLIBCXX_HAVE_UNISTD_H 1
/* Defined if usleep exists. */
/* #undef _GLIBCXX_HAVE_USLEEP */
/* Define to 1 if you have the <utime.h> header file. */
#define _GLIBCXX_HAVE_UTIME_H 1
/* Defined if vfwscanf exists. */
#define _GLIBCXX_HAVE_VFWSCANF 1
/* Defined if vswscanf exists. */
#define _GLIBCXX_HAVE_VSWSCANF 1
/* Defined if vwscanf exists. */
#define _GLIBCXX_HAVE_VWSCANF 1
/* Define to 1 if you have the <wchar.h> header file. */
#define _GLIBCXX_HAVE_WCHAR_H 1
/* Defined if wcstof exists. */
#define _GLIBCXX_HAVE_WCSTOF 1
/* Define to 1 if you have the <wctype.h> header file. */
#define _GLIBCXX_HAVE_WCTYPE_H 1
/* Defined if Sleep exists. */
/* #undef _GLIBCXX_HAVE_WIN32_SLEEP */
/* Define if writev is available in <sys/uio.h>. */
#define _GLIBCXX_HAVE_WRITEV 1
/* Define to 1 if you have the `_acosf' function. */
/* #undef _GLIBCXX_HAVE__ACOSF */
/* Define to 1 if you have the `_acosl' function. */
/* #undef _GLIBCXX_HAVE__ACOSL */
/* Define to 1 if you have the `_aligned_malloc' function. */
/* #undef _GLIBCXX_HAVE__ALIGNED_MALLOC */
/* Define to 1 if you have the `_asinf' function. */
/* #undef _GLIBCXX_HAVE__ASINF */
/* Define to 1 if you have the `_asinl' function. */
/* #undef _GLIBCXX_HAVE__ASINL */
/* Define to 1 if you have the `_atan2f' function. */
/* #undef _GLIBCXX_HAVE__ATAN2F */
/* Define to 1 if you have the `_atan2l' function. */
/* #undef _GLIBCXX_HAVE__ATAN2L */
/* Define to 1 if you have the `_atanf' function. */
/* #undef _GLIBCXX_HAVE__ATANF */
/* Define to 1 if you have the `_atanl' function. */
/* #undef _GLIBCXX_HAVE__ATANL */
/* Define to 1 if you have the `_ceilf' function. */
/* #undef _GLIBCXX_HAVE__CEILF */
/* Define to 1 if you have the `_ceill' function. */
/* #undef _GLIBCXX_HAVE__CEILL */
/* Define to 1 if you have the `_cosf' function. */
/* #undef _GLIBCXX_HAVE__COSF */
/* Define to 1 if you have the `_coshf' function. */
/* #undef _GLIBCXX_HAVE__COSHF */
/* Define to 1 if you have the `_coshl' function. */
/* #undef _GLIBCXX_HAVE__COSHL */
/* Define to 1 if you have the `_cosl' function. */
/* #undef _GLIBCXX_HAVE__COSL */
/* Define to 1 if you have the `_expf' function. */
/* #undef _GLIBCXX_HAVE__EXPF */
/* Define to 1 if you have the `_expl' function. */
/* #undef _GLIBCXX_HAVE__EXPL */
/* Define to 1 if you have the `_fabsf' function. */
/* #undef _GLIBCXX_HAVE__FABSF */
/* Define to 1 if you have the `_fabsl' function. */
/* #undef _GLIBCXX_HAVE__FABSL */
/* Define to 1 if you have the `_finite' function. */
/* #undef _GLIBCXX_HAVE__FINITE */
/* Define to 1 if you have the `_finitef' function. */
/* #undef _GLIBCXX_HAVE__FINITEF */
/* Define to 1 if you have the `_finitel' function. */
/* #undef _GLIBCXX_HAVE__FINITEL */
/* Define to 1 if you have the `_floorf' function. */
/* #undef _GLIBCXX_HAVE__FLOORF */
/* Define to 1 if you have the `_floorl' function. */
/* #undef _GLIBCXX_HAVE__FLOORL */
/* Define to 1 if you have the `_fmodf' function. */
/* #undef _GLIBCXX_HAVE__FMODF */
/* Define to 1 if you have the `_fmodl' function. */
/* #undef _GLIBCXX_HAVE__FMODL */
/* Define to 1 if you have the `_fpclass' function. */
/* #undef _GLIBCXX_HAVE__FPCLASS */
/* Define to 1 if you have the `_frexpf' function. */
/* #undef _GLIBCXX_HAVE__FREXPF */
/* Define to 1 if you have the `_frexpl' function. */
/* #undef _GLIBCXX_HAVE__FREXPL */
/* Define to 1 if you have the `_hypot' function. */
/* #undef _GLIBCXX_HAVE__HYPOT */
/* Define to 1 if you have the `_hypotf' function. */
/* #undef _GLIBCXX_HAVE__HYPOTF */
/* Define to 1 if you have the `_hypotl' function. */
/* #undef _GLIBCXX_HAVE__HYPOTL */
/* Define to 1 if you have the `_isinf' function. */
/* #undef _GLIBCXX_HAVE__ISINF */
/* Define to 1 if you have the `_isinff' function. */
/* #undef _GLIBCXX_HAVE__ISINFF */
/* Define to 1 if you have the `_isinfl' function. */
/* #undef _GLIBCXX_HAVE__ISINFL */
/* Define to 1 if you have the `_isnan' function. */
/* #undef _GLIBCXX_HAVE__ISNAN */
/* Define to 1 if you have the `_isnanf' function. */
/* #undef _GLIBCXX_HAVE__ISNANF */
/* Define to 1 if you have the `_isnanl' function. */
/* #undef _GLIBCXX_HAVE__ISNANL */
/* Define to 1 if you have the `_ldexpf' function. */
/* #undef _GLIBCXX_HAVE__LDEXPF */
/* Define to 1 if you have the `_ldexpl' function. */
/* #undef _GLIBCXX_HAVE__LDEXPL */
/* Define to 1 if you have the `_log10f' function. */
/* #undef _GLIBCXX_HAVE__LOG10F */
/* Define to 1 if you have the `_log10l' function. */
/* #undef _GLIBCXX_HAVE__LOG10L */
/* Define to 1 if you have the `_logf' function. */
/* #undef _GLIBCXX_HAVE__LOGF */
/* Define to 1 if you have the `_logl' function. */
/* #undef _GLIBCXX_HAVE__LOGL */
/* Define to 1 if you have the `_modf' function. */
/* #undef _GLIBCXX_HAVE__MODF */
/* Define to 1 if you have the `_modff' function. */
/* #undef _GLIBCXX_HAVE__MODFF */
/* Define to 1 if you have the `_modfl' function. */
/* #undef _GLIBCXX_HAVE__MODFL */
/* Define to 1 if you have the `_powf' function. */
/* #undef _GLIBCXX_HAVE__POWF */
/* Define to 1 if you have the `_powl' function. */
/* #undef _GLIBCXX_HAVE__POWL */
/* Define to 1 if you have the `_qfpclass' function. */
/* #undef _GLIBCXX_HAVE__QFPCLASS */
/* Define to 1 if you have the `_sincos' function. */
/* #undef _GLIBCXX_HAVE__SINCOS */
/* Define to 1 if you have the `_sincosf' function. */
/* #undef _GLIBCXX_HAVE__SINCOSF */
/* Define to 1 if you have the `_sincosl' function. */
/* #undef _GLIBCXX_HAVE__SINCOSL */
/* Define to 1 if you have the `_sinf' function. */
/* #undef _GLIBCXX_HAVE__SINF */
/* Define to 1 if you have the `_sinhf' function. */
/* #undef _GLIBCXX_HAVE__SINHF */
/* Define to 1 if you have the `_sinhl' function. */
/* #undef _GLIBCXX_HAVE__SINHL */
/* Define to 1 if you have the `_sinl' function. */
/* #undef _GLIBCXX_HAVE__SINL */
/* Define to 1 if you have the `_sqrtf' function. */
/* #undef _GLIBCXX_HAVE__SQRTF */
/* Define to 1 if you have the `_sqrtl' function. */
/* #undef _GLIBCXX_HAVE__SQRTL */
/* Define to 1 if you have the `_tanf' function. */
/* #undef _GLIBCXX_HAVE__TANF */
/* Define to 1 if you have the `_tanhf' function. */
/* #undef _GLIBCXX_HAVE__TANHF */
/* Define to 1 if you have the `_tanhl' function. */
/* #undef _GLIBCXX_HAVE__TANHL */
/* Define to 1 if you have the `_tanl' function. */
/* #undef _GLIBCXX_HAVE__TANL */
/* Define to 1 if you have the `__cxa_thread_atexit' function. */
/* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT */
/* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */
#define _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL 1
/* Define as const if the declaration of iconv() needs const. */
#define _GLIBCXX_ICONV_CONST
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
/* #undef _GLIBCXX_PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define _GLIBCXX_PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define _GLIBCXX_PACKAGE_NAME "package-unused"
/* Define to the full name and version of this package. */
#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
/* Define to the one symbol short name of this package. */
#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
/* Define to the home page for this package. */
#define _GLIBCXX_PACKAGE_URL ""
/* Define to the version of this package. */
#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
/* The size of `char', as computed by sizeof. */
/* #undef SIZEOF_CHAR */
/* The size of `int', as computed by sizeof. */
/* #undef SIZEOF_INT */
/* The size of `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* The size of `short', as computed by sizeof. */
/* #undef SIZEOF_SHORT */
/* The size of `void *', as computed by sizeof. */
/* #undef SIZEOF_VOID_P */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
/* #undef _GLIBCXX_VERSION */
/* Number of bits in a file offset, on hosts where this is settable. */
#define _GLIBCXX_FILE_OFFSET_BITS 64
/* Define if C99 functions in <complex.h> should be used in <complex> for
C++11. Using compiler builtins for these functions requires corresponding
C99 library functions to be present. */
#define _GLIBCXX11_USE_C99_COMPLEX 1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_MATH 1
/* Define if C99 functions or macros in <stdio.h> should be imported in
<cstdio> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_STDIO 1
/* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_WCHAR 1
/* Define if C99 functions in <complex.h> should be used in <complex> for
C++98. Using compiler builtins for these functions requires corresponding
C99 library functions to be present. */
#define _GLIBCXX98_USE_C99_COMPLEX 1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_MATH 1
/* Define if C99 functions or macros in <stdio.h> should be imported in
<cstdio> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_STDIO 1
/* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_WCHAR 1
/* Define if the compiler supports C++11 atomics. */
#define _GLIBCXX_ATOMIC_BUILTINS 1
/* Define to use concept checking code from the boost libraries. */
/* #undef _GLIBCXX_CONCEPT_CHECKS */
/* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable,
undefined for platform defaults */
#define _GLIBCXX_FULLY_DYNAMIC_STRING 0
/* Define if gthreads library is available. */
#define _GLIBCXX_HAS_GTHREADS 1
/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
#define _GLIBCXX_HOSTED 1
/* Define if compatibility should be provided for -mlong-double-64. */
/* Define to the letter to which size_t is mangled. */
#define _GLIBCXX_MANGLE_SIZE_T j
/* Define if C99 llrint and llround functions are missing from <math.h>. */
/* #undef _GLIBCXX_NO_C99_ROUNDING_FUNCS */
/* Define if ptrdiff_t is int. */
#define _GLIBCXX_PTRDIFF_T_IS_INT 1
/* Define if using setrlimit to set resource limits during "make check" */
#define _GLIBCXX_RES_LIMITS 1
/* Define if size_t is unsigned int. */
#define _GLIBCXX_SIZE_T_IS_UINT 1
/* Define to the value of the EOF integer constant. */
#define _GLIBCXX_STDIO_EOF -1
/* Define to the value of the SEEK_CUR integer constant. */
#define _GLIBCXX_STDIO_SEEK_CUR 1
/* Define to the value of the SEEK_END integer constant. */
#define _GLIBCXX_STDIO_SEEK_END 2
/* Define to use symbol versioning in the shared library. */
#define _GLIBCXX_SYMVER 1
/* Define to use darwin versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_DARWIN */
/* Define to use GNU versioning in the shared library. */
#define _GLIBCXX_SYMVER_GNU 1
/* Define to use GNU namespace versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
/* Define to use Sun versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_SUN */
/* Define if C11 functions in <uchar.h> should be imported into namespace std
in <cuchar>. */
#define _GLIBCXX_USE_C11_UCHAR_CXX11 1
/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
<stdio.h>, and <stdlib.h> can be used or exposed. */
#define _GLIBCXX_USE_C99 1
/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
Using compiler builtins for these functions requires corresponding C99
library functions to be present. */
#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_CTYPE_TR1 1
/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_FENV_TR1 1
/* Define if C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1
/* Define if C99 functions or macros in <math.h> should be imported in
<tr1/cmath> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_MATH_TR1 1
/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_STDINT_TR1 1
/* Defined if clock_gettime syscall has monotonic and realtime clock support.
*/
/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */
/* Defined if clock_gettime has monotonic clock support. */
#define _GLIBCXX_USE_CLOCK_MONOTONIC 1
/* Defined if clock_gettime has realtime clock support. */
#define _GLIBCXX_USE_CLOCK_REALTIME 1
/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
this host. */
#define _GLIBCXX_USE_DECIMAL_FLOAT 1
/* Define if fchmod is available in <sys/stat.h>. */
#define _GLIBCXX_USE_FCHMOD 1
/* Define if fchmodat is available in <sys/stat.h>. */
#define _GLIBCXX_USE_FCHMODAT 1
/* Defined if gettimeofday is available. */
#define _GLIBCXX_USE_GETTIMEOFDAY 1
/* Define if get_nprocs is available in <sys/sysinfo.h>. */
#define _GLIBCXX_USE_GET_NPROCS 1
/* Define if __int128 is supported on this host. */
/* #undef _GLIBCXX_USE_INT128 */
/* Define if LFS support is available. */
#define _GLIBCXX_USE_LFS 1
/* Define if code specialized for long long should be used. */
#define _GLIBCXX_USE_LONG_LONG 1
/* Defined if nanosleep is available. */
#define _GLIBCXX_USE_NANOSLEEP 1
/* Define if NLS translations are to be used. */
#define _GLIBCXX_USE_NLS 1
/* Define if pthreads_num_processors_np is available in <pthread.h>. */
/* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */
/* Define if POSIX read/write locks are available in <gthr.h>. */
#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1
/* Define if /dev/random and /dev/urandom are available for the random_device
of TR1 (Chapter 5.1). */
#define _GLIBCXX_USE_RANDOM_TR1 1
/* Define if usable realpath is available in <stdlib.h>. */
#define _GLIBCXX_USE_REALPATH 1
/* Defined if sched_yield is available. */
#define _GLIBCXX_USE_SCHED_YIELD 1
/* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */
#define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1
/* Define if _SC_NPROC_ONLN is available in <unistd.h>. */
/* #undef _GLIBCXX_USE_SC_NPROC_ONLN */
/* Define if sendfile is available in <sys/sendfile.h>. */
#define _GLIBCXX_USE_SENDFILE 1
/* Define if struct stat has timespec members. */
#define _GLIBCXX_USE_ST_MTIM 1
/* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */
/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */
/* Define if obsolescent tmpnam is available in <stdio.h>. */
#define _GLIBCXX_USE_TMPNAM 1
/* Define if utimensat and UTIME_OMIT are available in <sys/stat.h> and
AT_FDCWD in <fcntl.h>. */
#define _GLIBCXX_USE_UTIMENSAT 1
/* Define if code specialized for wchar_t should be used. */
#define _GLIBCXX_USE_WCHAR_T 1
/* Define to 1 if a verbose library is built, or 0 otherwise. */
#define _GLIBCXX_VERBOSE 1
/* Defined if as can handle rdrand. */
#define _GLIBCXX_X86_RDRAND 1
/* Define to 1 if mutex_timedlock is available. */
#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
/* Define for large files, on AIX-style hosts. */
/* #undef _GLIBCXX_LARGE_FILES */
/* Define if all C++11 floating point overloads are available in <math.h>. */
#if __cplusplus >= 201103L
/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP */
#endif
/* Define if all C++11 integral type overloads are available in <math.h>. */
#if __cplusplus >= 201103L
/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT */
#endif
#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
# define _GLIBCXX_HAVE_ACOSF 1
# define acosf _acosf
#endif
#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
# define _GLIBCXX_HAVE_ACOSL 1
# define acosl _acosl
#endif
#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
# define _GLIBCXX_HAVE_ASINF 1
# define asinf _asinf
#endif
#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
# define _GLIBCXX_HAVE_ASINL 1
# define asinl _asinl
#endif
#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
# define _GLIBCXX_HAVE_ATAN2F 1
# define atan2f _atan2f
#endif
#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
# define _GLIBCXX_HAVE_ATAN2L 1
# define atan2l _atan2l
#endif
#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
# define _GLIBCXX_HAVE_ATANF 1
# define atanf _atanf
#endif
#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
# define _GLIBCXX_HAVE_ATANL 1
# define atanl _atanl
#endif
#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
# define _GLIBCXX_HAVE_CEILF 1
# define ceilf _ceilf
#endif
#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
# define _GLIBCXX_HAVE_CEILL 1
# define ceill _ceill
#endif
#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
# define _GLIBCXX_HAVE_COSF 1
# define cosf _cosf
#endif
#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
# define _GLIBCXX_HAVE_COSHF 1
# define coshf _coshf
#endif
#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
# define _GLIBCXX_HAVE_COSHL 1
# define coshl _coshl
#endif
#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
# define _GLIBCXX_HAVE_COSL 1
# define cosl _cosl
#endif
#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
# define _GLIBCXX_HAVE_EXPF 1
# define expf _expf
#endif
#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
# define _GLIBCXX_HAVE_EXPL 1
# define expl _expl
#endif
#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
# define _GLIBCXX_HAVE_FABSF 1
# define fabsf _fabsf
#endif
#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
# define _GLIBCXX_HAVE_FABSL 1
# define fabsl _fabsl
#endif
#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
# define _GLIBCXX_HAVE_FINITE 1
# define finite _finite
#endif
#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
# define _GLIBCXX_HAVE_FINITEF 1
# define finitef _finitef
#endif
#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
# define _GLIBCXX_HAVE_FINITEL 1
# define finitel _finitel
#endif
#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
# define _GLIBCXX_HAVE_FLOORF 1
# define floorf _floorf
#endif
#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
# define _GLIBCXX_HAVE_FLOORL 1
# define floorl _floorl
#endif
#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
# define _GLIBCXX_HAVE_FMODF 1
# define fmodf _fmodf
#endif
#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
# define _GLIBCXX_HAVE_FMODL 1
# define fmodl _fmodl
#endif
#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
# define _GLIBCXX_HAVE_FPCLASS 1
# define fpclass _fpclass
#endif
#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
# define _GLIBCXX_HAVE_FREXPF 1
# define frexpf _frexpf
#endif
#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
# define _GLIBCXX_HAVE_FREXPL 1
# define frexpl _frexpl
#endif
#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
# define _GLIBCXX_HAVE_HYPOT 1
# define hypot _hypot
#endif
#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
# define _GLIBCXX_HAVE_HYPOTF 1
# define hypotf _hypotf
#endif
#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
# define _GLIBCXX_HAVE_HYPOTL 1
# define hypotl _hypotl
#endif
#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
# define _GLIBCXX_HAVE_ISINF 1
# define isinf _isinf
#endif
#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
# define _GLIBCXX_HAVE_ISINFF 1
# define isinff _isinff
#endif
#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
# define _GLIBCXX_HAVE_ISINFL 1
# define isinfl _isinfl
#endif
#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
# define _GLIBCXX_HAVE_ISNAN 1
# define isnan _isnan
#endif
#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
# define _GLIBCXX_HAVE_ISNANF 1
# define isnanf _isnanf
#endif
#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
# define _GLIBCXX_HAVE_ISNANL 1
# define isnanl _isnanl
#endif
#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
# define _GLIBCXX_HAVE_LDEXPF 1
# define ldexpf _ldexpf
#endif
#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
# define _GLIBCXX_HAVE_LDEXPL 1
# define ldexpl _ldexpl
#endif
#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
# define _GLIBCXX_HAVE_LOG10F 1
# define log10f _log10f
#endif
#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
# define _GLIBCXX_HAVE_LOG10L 1
# define log10l _log10l
#endif
#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
# define _GLIBCXX_HAVE_LOGF 1
# define logf _logf
#endif
#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
# define _GLIBCXX_HAVE_LOGL 1
# define logl _logl
#endif
#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
# define _GLIBCXX_HAVE_MODF 1
# define modf _modf
#endif
#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
# define _GLIBCXX_HAVE_MODFF 1
# define modff _modff
#endif
#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
# define _GLIBCXX_HAVE_MODFL 1
# define modfl _modfl
#endif
#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
# define _GLIBCXX_HAVE_POWF 1
# define powf _powf
#endif
#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
# define _GLIBCXX_HAVE_POWL 1
# define powl _powl
#endif
#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
# define _GLIBCXX_HAVE_QFPCLASS 1
# define qfpclass _qfpclass
#endif
#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
# define _GLIBCXX_HAVE_SINCOS 1
# define sincos _sincos
#endif
#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
# define _GLIBCXX_HAVE_SINCOSF 1
# define sincosf _sincosf
#endif
#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
# define _GLIBCXX_HAVE_SINCOSL 1
# define sincosl _sincosl
#endif
#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
# define _GLIBCXX_HAVE_SINF 1
# define sinf _sinf
#endif
#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
# define _GLIBCXX_HAVE_SINHF 1
# define sinhf _sinhf
#endif
#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
# define _GLIBCXX_HAVE_SINHL 1
# define sinhl _sinhl
#endif
#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
# define _GLIBCXX_HAVE_SINL 1
# define sinl _sinl
#endif
#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
# define _GLIBCXX_HAVE_SQRTF 1
# define sqrtf _sqrtf
#endif
#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
# define _GLIBCXX_HAVE_SQRTL 1
# define sqrtl _sqrtl
#endif
#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
# define _GLIBCXX_HAVE_STRTOF 1
# define strtof _strtof
#endif
#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
# define _GLIBCXX_HAVE_STRTOLD 1
# define strtold _strtold
#endif
#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
# define _GLIBCXX_HAVE_TANF 1
# define tanf _tanf
#endif
#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
# define _GLIBCXX_HAVE_TANHF 1
# define tanhf _tanhf
#endif
#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
# define _GLIBCXX_HAVE_TANHL 1
# define tanhl _tanhl
#endif
#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
# define _GLIBCXX_HAVE_TANL 1
# define tanl _tanl
#endif
#endif // _GLIBCXX_CXX_CONFIG_H
#else
// Predefined symbols and macros -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/c++config.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_CXX_CONFIG_H
#define _GLIBCXX_CXX_CONFIG_H 1
// The major release number for the GCC release the C++ library belongs to.
#define _GLIBCXX_RELEASE 8
// The datestamp of the C++ library in compressed ISO date format.
#define __GLIBCXX__ 20210514
// Macros for various attributes.
// _GLIBCXX_PURE
// _GLIBCXX_CONST
// _GLIBCXX_NORETURN
// _GLIBCXX_NOTHROW
// _GLIBCXX_VISIBILITY
#ifndef _GLIBCXX_PURE
# define _GLIBCXX_PURE __attribute__ ((__pure__))
#endif
#ifndef _GLIBCXX_CONST
# define _GLIBCXX_CONST __attribute__ ((__const__))
#endif
#ifndef _GLIBCXX_NORETURN
# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
#endif
// See below for C++
#ifndef _GLIBCXX_NOTHROW
# ifndef __cplusplus
# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
# endif
#endif
// Macros for visibility attributes.
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
// _GLIBCXX_VISIBILITY
# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
#else
// If this is not supplied by the OS-specific or CPU-specific
// headers included below, it will be defined to an empty default.
# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
#endif
// Macros for deprecated attributes.
// _GLIBCXX_USE_DEPRECATED
// _GLIBCXX_DEPRECATED
// _GLIBCXX17_DEPRECATED
#ifndef _GLIBCXX_USE_DEPRECATED
# define _GLIBCXX_USE_DEPRECATED 1
#endif
#if defined(__DEPRECATED) && (__cplusplus >= 201103L)
# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
#else
# define _GLIBCXX_DEPRECATED
#endif
#if defined(__DEPRECATED) && (__cplusplus >= 201703L)
# define _GLIBCXX17_DEPRECATED [[__deprecated__]]
#else
# define _GLIBCXX17_DEPRECATED
#endif
// Macros for ABI tag attributes.
#ifndef _GLIBCXX_ABI_TAG_CXX11
# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
#endif
// Macro to warn about unused results.
#if __cplusplus >= 201703L
# define _GLIBCXX_NODISCARD [[__nodiscard__]]
#else
# define _GLIBCXX_NODISCARD
#endif
#if __cplusplus
// Macro for constexpr, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_CONSTEXPR
# if __cplusplus >= 201103L
# define _GLIBCXX_CONSTEXPR constexpr
# define _GLIBCXX_USE_CONSTEXPR constexpr
# else
# define _GLIBCXX_CONSTEXPR
# define _GLIBCXX_USE_CONSTEXPR const
# endif
#endif
#ifndef _GLIBCXX14_CONSTEXPR
# if __cplusplus >= 201402L
# define _GLIBCXX14_CONSTEXPR constexpr
# else
# define _GLIBCXX14_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX17_CONSTEXPR
# if __cplusplus > 201402L
# define _GLIBCXX17_CONSTEXPR constexpr
# else
# define _GLIBCXX17_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX17_INLINE
# if __cplusplus > 201402L
# define _GLIBCXX17_INLINE inline
# else
# define _GLIBCXX17_INLINE
# endif
#endif
// Macro for noexcept, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_NOEXCEPT
# if __cplusplus >= 201103L
# define _GLIBCXX_NOEXCEPT noexcept
# define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND)
# define _GLIBCXX_USE_NOEXCEPT noexcept
# define _GLIBCXX_THROW(_EXC)
# else
# define _GLIBCXX_NOEXCEPT
# define _GLIBCXX_NOEXCEPT_IF(_COND)
# define _GLIBCXX_USE_NOEXCEPT throw()
# define _GLIBCXX_THROW(_EXC) throw(_EXC)
# endif
#endif
#ifndef _GLIBCXX_NOTHROW
# define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT
#endif
#ifndef _GLIBCXX_THROW_OR_ABORT
# if __cpp_exceptions
# define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC))
# else
# define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort())
# endif
#endif
#if __cpp_noexcept_function_type
#define _GLIBCXX_NOEXCEPT_PARM , bool _NE
#define _GLIBCXX_NOEXCEPT_QUAL noexcept (_NE)
#else
#define _GLIBCXX_NOEXCEPT_PARM
#define _GLIBCXX_NOEXCEPT_QUAL
#endif
// Macro for extern template, ie controlling template linkage via use
// of extern keyword on template declaration. As documented in the g++
// manual, it inhibits all implicit instantiations and is used
// throughout the library to avoid multiple weak definitions for
// required types that are already explicitly instantiated in the
// library binary. This substantially reduces the binary size of
// resulting executables.
// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
// templates only in basic_string, thus activating its debug-mode
// checks even at -O0.
# define _GLIBCXX_EXTERN_TEMPLATE 1
/*
Outline of libstdc++ namespaces.
namespace std
{
namespace __debug { }
namespace __parallel { }
namespace __profile { }
namespace __cxx1998 { }
namespace __detail {
namespace __variant { } // C++17
}
namespace rel_ops { }
namespace tr1
{
namespace placeholders { }
namespace regex_constants { }
namespace __detail { }
}
namespace tr2 { }
namespace decimal { }
namespace chrono { } // C++11
namespace placeholders { } // C++11
namespace regex_constants { } // C++11
namespace this_thread { } // C++11
inline namespace literals { // C++14
inline namespace chrono_literals { } // C++14
inline namespace complex_literals { } // C++14
inline namespace string_literals { } // C++14
inline namespace string_view_literals { } // C++17
}
}
namespace abi { }
namespace __gnu_cxx
{
namespace __detail { }
}
For full details see:
http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
*/
namespace std
{
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#if __cplusplus >= 201103L
typedef decltype(nullptr) nullptr_t;
#endif
}
# define _GLIBCXX_USE_DUAL_ABI 1
#if ! _GLIBCXX_USE_DUAL_ABI
// Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI
# undef _GLIBCXX_USE_CXX11_ABI
#endif
#ifndef _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#if _GLIBCXX_USE_CXX11_ABI
namespace std
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
namespace __gnu_cxx
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
# define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
# define _GLIBCXX_END_NAMESPACE_CXX11 }
# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11
#else
# define _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_CXX11
# define _GLIBCXX_DEFAULT_ABI_TAG
#endif
// Defined if inline namespaces are used for versioning.
# define _GLIBCXX_INLINE_VERSION 0
// Inline namespace for symbol versioning.
#if _GLIBCXX_INLINE_VERSION
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 {
# define _GLIBCXX_END_NAMESPACE_VERSION }
namespace std
{
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201402L
inline namespace literals {
inline namespace chrono_literals { }
inline namespace complex_literals { }
inline namespace string_literals { }
#if __cplusplus > 201402L
inline namespace string_view_literals { }
#endif // C++17
}
#endif // C++14
_GLIBCXX_END_NAMESPACE_VERSION
}
namespace __gnu_cxx
{
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
#else
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
# define _GLIBCXX_END_NAMESPACE_VERSION
#endif
// Inline namespaces for special modes: debug, parallel, profile.
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
|| defined(_GLIBCXX_PROFILE)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Non-inline namespace for components replaced by alternates in active mode.
namespace __cxx1998
{
# if _GLIBCXX_USE_CXX11_ABI
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
# endif
}
_GLIBCXX_END_NAMESPACE_VERSION
// Inline namespace for debug mode.
# ifdef _GLIBCXX_DEBUG
inline namespace __debug { }
# endif
// Inline namespaces for parallel mode.
# ifdef _GLIBCXX_PARALLEL
inline namespace __parallel { }
# endif
// Inline namespaces for profile mode
# ifdef _GLIBCXX_PROFILE
inline namespace __profile { }
# endif
}
// Check for invalid usage and unsupported mixed-mode use.
# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
# error illegal use of multiple inlined namespaces
# endif
# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
# error illegal use of multiple inlined namespaces
# endif
# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
# error illegal use of multiple inlined namespaces
# endif
// Check for invalid use due to lack for weak symbols.
# if __NO_INLINE__ && !__GXX_WEAK__
# warning currently using inlined namespace mode which may fail \
without inlining due to lack of weak symbols
# endif
#endif
// Macros for namespace scope. Either namespace std:: or the name
// of some nested namespace within it corresponding to the active mode.
// _GLIBCXX_STD_A
// _GLIBCXX_STD_C
//
// Macros for opening/closing conditional namespaces.
// _GLIBCXX_BEGIN_NAMESPACE_ALGO
// _GLIBCXX_END_NAMESPACE_ALGO
// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// _GLIBCXX_END_NAMESPACE_CONTAINER
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
# define _GLIBCXX_STD_C __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
namespace _GLIBCXX_STD_C {
# define _GLIBCXX_END_NAMESPACE_CONTAINER }
#else
# define _GLIBCXX_STD_C std
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
# define _GLIBCXX_END_NAMESPACE_CONTAINER
#endif
#ifdef _GLIBCXX_PARALLEL
# define _GLIBCXX_STD_A __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
namespace _GLIBCXX_STD_A {
# define _GLIBCXX_END_NAMESPACE_ALGO }
#else
# define _GLIBCXX_STD_A std
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
# define _GLIBCXX_END_NAMESPACE_ALGO
#endif
// GLIBCXX_ABI Deprecated
// Define if compatibility should be provided for -mlong-double-64.
#undef _GLIBCXX_LONG_DOUBLE_COMPAT
// Inline namespace for long double 128 mode.
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
namespace std
{
inline namespace __gnu_cxx_ldbl128 { }
}
# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
# define _GLIBCXX_END_NAMESPACE_LDBL }
#else
# define _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL
#endif
#if _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11
#else
# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL
# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL
# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL
#endif
// Debug Mode implies checking assertions.
#if defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_ASSERTIONS)
# define _GLIBCXX_ASSERTIONS 1
#endif
// Disable std::string explicit instantiation declarations in order to assert.
#ifdef _GLIBCXX_ASSERTIONS
# undef _GLIBCXX_EXTERN_TEMPLATE
# define _GLIBCXX_EXTERN_TEMPLATE -1
#endif
// Assert.
#if defined(_GLIBCXX_ASSERTIONS) \
|| defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS)
namespace std
{
// Avoid the use of assert, because we're trying to keep the <cassert>
// include out of the mix.
inline void
__replacement_assert(const char* __file, int __line,
const char* __function, const char* __condition)
{
__builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
__function, __condition);
__builtin_abort();
}
}
#define __glibcxx_assert_impl(_Condition) \
do \
{ \
if (! (_Condition)) \
std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
#_Condition); \
} while (false)
#endif
#if defined(_GLIBCXX_ASSERTIONS)
# define __glibcxx_assert(_Condition) __glibcxx_assert_impl(_Condition)
#else
# define __glibcxx_assert(_Condition)
#endif
// Macros for race detectors.
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
// atomic (lock-free) synchronization to race detectors:
// the race detector will infer a happens-before arc from the former to the
// latter when they share the same argument pointer.
//
// The most frequent use case for these macros (and the only case in the
// current implementation of the library) is atomic reference counting:
// void _M_remove_reference()
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
// _M_destroy(__a);
// }
// }
// The annotations in this example tell the race detector that all memory
// accesses occurred when the refcount was positive do not race with
// memory accesses which occurred after the refcount became zero.
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
#endif
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
#endif
// Macros for C linkage: define extern "C" linkage only when using C++.
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
# define _GLIBCXX_END_EXTERN_C }
# define _GLIBCXX_USE_ALLOCATOR_NEW 1
#else // !__cplusplus
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
#endif
// First includes.
// Pick up any OS-specific definitions.
#include <bits/os_defines.h>
// Pick up any CPU-specific definitions.
#include <bits/cpu_defines.h>
// If platform uses neither visibility nor psuedo-visibility,
// specify empty default for namespace annotation macros.
#ifndef _GLIBCXX_PSEUDO_VISIBILITY
# define _GLIBCXX_PSEUDO_VISIBILITY(V)
#endif
// Certain function definitions that are meant to be overridable from
// user code are decorated with this macro. For some targets, this
// macro causes these definitions to be weak.
#ifndef _GLIBCXX_WEAK_DEFINITION
# define _GLIBCXX_WEAK_DEFINITION
#endif
// By default, we assume that __GXX_WEAK__ also means that there is support
// for declaring functions as weak while not defining such functions. This
// allows for referring to functions provided by other libraries (e.g.,
// libitm) without depending on them if the respective features are not used.
#ifndef _GLIBCXX_USE_WEAK_REF
# define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__
#endif
// Conditionally enable annotations for the Transactional Memory TS on C++11.
// Most of the following conditions are due to limitations in the current
// implementation.
#if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \
&& _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \
&& !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF \
&& _GLIBCXX_USE_ALLOCATOR_NEW
#define _GLIBCXX_TXN_SAFE transaction_safe
#define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic
#else
#define _GLIBCXX_TXN_SAFE
#define _GLIBCXX_TXN_SAFE_DYN
#endif
#if __cplusplus > 201402L
// In C++17 mathematical special functions are in namespace std.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
// For C++11 and C++14 they are in namespace std when requested.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#endif
// The remainder of the prewritten config is automatic; all the
// user hooks are listed above.
// Create a boolean flag to be used to determine if --fast-math is set.
#ifdef __FAST_MATH__
# define _GLIBCXX_FAST_MATH 1
#else
# define _GLIBCXX_FAST_MATH 0
#endif
// This marks string literals in header files to be extracted for eventual
// translation. It is primarily used for messages in thrown exceptions; see
// src/functexcept.cc. We use __N because the more traditional _N is used
// for something else under certain OSes (see BADNAMES).
#define __N(msgid) (msgid)
// For example, <windows.h> is known to #define min and max as macros...
#undef min
#undef max
// N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally
// so they should be tested with #if not with #ifdef.
#if __cplusplus >= 201103L
# ifndef _GLIBCXX_USE_C99_MATH
# define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH
# endif
# ifndef _GLIBCXX_USE_C99_COMPLEX
# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX
# endif
# ifndef _GLIBCXX_USE_C99_STDIO
# define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO
# endif
# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB
# endif
# ifndef _GLIBCXX_USE_C99_WCHAR
# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR
# endif
#else
# ifndef _GLIBCXX_USE_C99_MATH
# define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH
# endif
# ifndef _GLIBCXX_USE_C99_COMPLEX
# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX
# endif
# ifndef _GLIBCXX_USE_C99_STDIO
# define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO
# endif
# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB
# endif
# ifndef _GLIBCXX_USE_C99_WCHAR
# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR
# endif
#endif
/* Define if __float128 is supported on this host. */
#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
#define _GLIBCXX_USE_FLOAT128 1
#endif
// End of prewritten config; the settings discovered at configure time follow.
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `acosf' function. */
#define _GLIBCXX_HAVE_ACOSF 1
/* Define to 1 if you have the `acosl' function. */
#define _GLIBCXX_HAVE_ACOSL 1
/* Define to 1 if you have the `aligned_alloc' function. */
#define _GLIBCXX_HAVE_ALIGNED_ALLOC 1
/* Define to 1 if you have the `asinf' function. */
#define _GLIBCXX_HAVE_ASINF 1
/* Define to 1 if you have the `asinl' function. */
#define _GLIBCXX_HAVE_ASINL 1
/* Define to 1 if the target assembler supports .symver directive. */
#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
/* Define to 1 if you have the `atan2f' function. */
#define _GLIBCXX_HAVE_ATAN2F 1
/* Define to 1 if you have the `atan2l' function. */
#define _GLIBCXX_HAVE_ATAN2L 1
/* Define to 1 if you have the `atanf' function. */
#define _GLIBCXX_HAVE_ATANF 1
/* Define to 1 if you have the `atanl' function. */
#define _GLIBCXX_HAVE_ATANL 1
/* Define to 1 if you have the `at_quick_exit' function. */
#define _GLIBCXX_HAVE_AT_QUICK_EXIT 1
/* Define to 1 if the target assembler supports thread-local storage. */
/* #undef _GLIBCXX_HAVE_CC_TLS */
/* Define to 1 if you have the `ceilf' function. */
#define _GLIBCXX_HAVE_CEILF 1
/* Define to 1 if you have the `ceill' function. */
#define _GLIBCXX_HAVE_CEILL 1
/* Define to 1 if you have the <complex.h> header file. */
#define _GLIBCXX_HAVE_COMPLEX_H 1
/* Define to 1 if you have the `cosf' function. */
#define _GLIBCXX_HAVE_COSF 1
/* Define to 1 if you have the `coshf' function. */
#define _GLIBCXX_HAVE_COSHF 1
/* Define to 1 if you have the `coshl' function. */
#define _GLIBCXX_HAVE_COSHL 1
/* Define to 1 if you have the `cosl' function. */
#define _GLIBCXX_HAVE_COSL 1
/* Define to 1 if you have the <dirent.h> header file. */
#define _GLIBCXX_HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define _GLIBCXX_HAVE_DLFCN_H 1
/* Define if EBADMSG exists. */
#define _GLIBCXX_HAVE_EBADMSG 1
/* Define if ECANCELED exists. */
#define _GLIBCXX_HAVE_ECANCELED 1
/* Define if ECHILD exists. */
#define _GLIBCXX_HAVE_ECHILD 1
/* Define if EIDRM exists. */
#define _GLIBCXX_HAVE_EIDRM 1
/* Define to 1 if you have the <endian.h> header file. */
#define _GLIBCXX_HAVE_ENDIAN_H 1
/* Define if ENODATA exists. */
#define _GLIBCXX_HAVE_ENODATA 1
/* Define if ENOLINK exists. */
#define _GLIBCXX_HAVE_ENOLINK 1
/* Define if ENOSPC exists. */
#define _GLIBCXX_HAVE_ENOSPC 1
/* Define if ENOSR exists. */
#define _GLIBCXX_HAVE_ENOSR 1
/* Define if ENOSTR exists. */
#define _GLIBCXX_HAVE_ENOSTR 1
/* Define if ENOTRECOVERABLE exists. */
#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
/* Define if ENOTSUP exists. */
#define _GLIBCXX_HAVE_ENOTSUP 1
/* Define if EOVERFLOW exists. */
#define _GLIBCXX_HAVE_EOVERFLOW 1
/* Define if EOWNERDEAD exists. */
#define _GLIBCXX_HAVE_EOWNERDEAD 1
/* Define if EPERM exists. */
#define _GLIBCXX_HAVE_EPERM 1
/* Define if EPROTO exists. */
#define _GLIBCXX_HAVE_EPROTO 1
/* Define if ETIME exists. */
#define _GLIBCXX_HAVE_ETIME 1
/* Define if ETIMEDOUT exists. */
#define _GLIBCXX_HAVE_ETIMEDOUT 1
/* Define if ETXTBSY exists. */
#define _GLIBCXX_HAVE_ETXTBSY 1
/* Define if EWOULDBLOCK exists. */
#define _GLIBCXX_HAVE_EWOULDBLOCK 1
/* Define to 1 if GCC 4.6 supported std::exception_ptr for the target */
#define _GLIBCXX_HAVE_EXCEPTION_PTR_SINCE_GCC46 1
/* Define to 1 if you have the <execinfo.h> header file. */
#define _GLIBCXX_HAVE_EXECINFO_H 1
/* Define to 1 if you have the `expf' function. */
#define _GLIBCXX_HAVE_EXPF 1
/* Define to 1 if you have the `expl' function. */
#define _GLIBCXX_HAVE_EXPL 1
/* Define to 1 if you have the `fabsf' function. */
#define _GLIBCXX_HAVE_FABSF 1
/* Define to 1 if you have the `fabsl' function. */
#define _GLIBCXX_HAVE_FABSL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define _GLIBCXX_HAVE_FCNTL_H 1
/* Define to 1 if you have the <fenv.h> header file. */
#define _GLIBCXX_HAVE_FENV_H 1
/* Define to 1 if you have the `finite' function. */
#define _GLIBCXX_HAVE_FINITE 1
/* Define to 1 if you have the `finitef' function. */
#define _GLIBCXX_HAVE_FINITEF 1
/* Define to 1 if you have the `finitel' function. */
#define _GLIBCXX_HAVE_FINITEL 1
/* Define to 1 if you have the <float.h> header file. */
#define _GLIBCXX_HAVE_FLOAT_H 1
/* Define to 1 if you have the `floorf' function. */
#define _GLIBCXX_HAVE_FLOORF 1
/* Define to 1 if you have the `floorl' function. */
#define _GLIBCXX_HAVE_FLOORL 1
/* Define to 1 if you have the `fmodf' function. */
#define _GLIBCXX_HAVE_FMODF 1
/* Define to 1 if you have the `fmodl' function. */
#define _GLIBCXX_HAVE_FMODL 1
/* Define to 1 if you have the `fpclass' function. */
/* #undef _GLIBCXX_HAVE_FPCLASS */
/* Define to 1 if you have the <fp.h> header file. */
/* #undef _GLIBCXX_HAVE_FP_H */
/* Define to 1 if you have the `frexpf' function. */
#define _GLIBCXX_HAVE_FREXPF 1
/* Define to 1 if you have the `frexpl' function. */
#define _GLIBCXX_HAVE_FREXPL 1
/* Define if _Unwind_GetIPInfo is available. */
#define _GLIBCXX_HAVE_GETIPINFO 1
/* Define if gets is available in <stdio.h> before C++14. */
#define _GLIBCXX_HAVE_GETS 1
/* Define to 1 if you have the `hypot' function. */
#define _GLIBCXX_HAVE_HYPOT 1
/* Define to 1 if you have the `hypotf' function. */
#define _GLIBCXX_HAVE_HYPOTF 1
/* Define to 1 if you have the `hypotl' function. */
#define _GLIBCXX_HAVE_HYPOTL 1
/* Define if you have the iconv() function. */
#define _GLIBCXX_HAVE_ICONV 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef _GLIBCXX_HAVE_IEEEFP_H */
/* Define if int64_t is available in <stdint.h>. */
#define _GLIBCXX_HAVE_INT64_T 1
/* Define if int64_t is a long. */
#define _GLIBCXX_HAVE_INT64_T_LONG 1
/* Define if int64_t is a long long. */
/* #undef _GLIBCXX_HAVE_INT64_T_LONG_LONG */
/* Define to 1 if you have the <inttypes.h> header file. */
#define _GLIBCXX_HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isinf' function. */
/* #undef _GLIBCXX_HAVE_ISINF */
/* Define to 1 if you have the `isinff' function. */
#define _GLIBCXX_HAVE_ISINFF 1
/* Define to 1 if you have the `isinfl' function. */
#define _GLIBCXX_HAVE_ISINFL 1
/* Define to 1 if you have the `isnan' function. */
/* #undef _GLIBCXX_HAVE_ISNAN */
/* Define to 1 if you have the `isnanf' function. */
#define _GLIBCXX_HAVE_ISNANF 1
/* Define to 1 if you have the `isnanl' function. */
#define _GLIBCXX_HAVE_ISNANL 1
/* Defined if iswblank exists. */
#define _GLIBCXX_HAVE_ISWBLANK 1
/* Define if LC_MESSAGES is available in <locale.h>. */
#define _GLIBCXX_HAVE_LC_MESSAGES 1
/* Define to 1 if you have the `ldexpf' function. */
#define _GLIBCXX_HAVE_LDEXPF 1
/* Define to 1 if you have the `ldexpl' function. */
#define _GLIBCXX_HAVE_LDEXPL 1
/* Define to 1 if you have the <libintl.h> header file. */
#define _GLIBCXX_HAVE_LIBINTL_H 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_AS 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_DATA 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_FSIZE 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_RSS 1
/* Only used in build directory testsuite_hooks.h. */
#define _GLIBCXX_HAVE_LIMIT_VMEM 0
/* Define if futex syscall is available. */
#define _GLIBCXX_HAVE_LINUX_FUTEX 1
/* Define to 1 if you have the <linux/random.h> header file. */
#define _GLIBCXX_HAVE_LINUX_RANDOM_H 1
/* Define to 1 if you have the <linux/types.h> header file. */
#define _GLIBCXX_HAVE_LINUX_TYPES_H 1
/* Define to 1 if you have the <locale.h> header file. */
#define _GLIBCXX_HAVE_LOCALE_H 1
/* Define to 1 if you have the `log10f' function. */
#define _GLIBCXX_HAVE_LOG10F 1
/* Define to 1 if you have the `log10l' function. */
#define _GLIBCXX_HAVE_LOG10L 1
/* Define to 1 if you have the `logf' function. */
#define _GLIBCXX_HAVE_LOGF 1
/* Define to 1 if you have the `logl' function. */
#define _GLIBCXX_HAVE_LOGL 1
/* Define to 1 if you have the <machine/endian.h> header file. */
/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
/* Define to 1 if you have the <machine/param.h> header file. */
/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
/* Define if mbstate_t exists in wchar.h. */
#define _GLIBCXX_HAVE_MBSTATE_T 1
/* Define to 1 if you have the `memalign' function. */
#define _GLIBCXX_HAVE_MEMALIGN 1
/* Define to 1 if you have the <memory.h> header file. */
#define _GLIBCXX_HAVE_MEMORY_H 1
/* Define to 1 if you have the `modf' function. */
#define _GLIBCXX_HAVE_MODF 1
/* Define to 1 if you have the `modff' function. */
#define _GLIBCXX_HAVE_MODFF 1
/* Define to 1 if you have the `modfl' function. */
#define _GLIBCXX_HAVE_MODFL 1
/* Define to 1 if you have the <nan.h> header file. */
/* #undef _GLIBCXX_HAVE_NAN_H */
/* Define if <math.h> defines obsolete isinf function. */
/* #undef _GLIBCXX_HAVE_OBSOLETE_ISINF */
/* Define if <math.h> defines obsolete isnan function. */
/* #undef _GLIBCXX_HAVE_OBSOLETE_ISNAN */
/* Define if poll is available in <poll.h>. */
#define _GLIBCXX_HAVE_POLL 1
/* Define to 1 if you have the `posix_memalign' function. */
#define _GLIBCXX_HAVE_POSIX_MEMALIGN 1
/* Define to 1 if you have the `powf' function. */
#define _GLIBCXX_HAVE_POWF 1
/* Define to 1 if you have the `powl' function. */
#define _GLIBCXX_HAVE_POWL 1
/* Define to 1 if you have the `qfpclass' function. */
/* #undef _GLIBCXX_HAVE_QFPCLASS */
/* Define to 1 if you have the `quick_exit' function. */
#define _GLIBCXX_HAVE_QUICK_EXIT 1
/* Define to 1 if you have the `setenv' function. */
#define _GLIBCXX_HAVE_SETENV 1
/* Define to 1 if you have the `sincos' function. */
#define _GLIBCXX_HAVE_SINCOS 1
/* Define to 1 if you have the `sincosf' function. */
#define _GLIBCXX_HAVE_SINCOSF 1
/* Define to 1 if you have the `sincosl' function. */
#define _GLIBCXX_HAVE_SINCOSL 1
/* Define to 1 if you have the `sinf' function. */
#define _GLIBCXX_HAVE_SINF 1
/* Define to 1 if you have the `sinhf' function. */
#define _GLIBCXX_HAVE_SINHF 1
/* Define to 1 if you have the `sinhl' function. */
#define _GLIBCXX_HAVE_SINHL 1
/* Define to 1 if you have the `sinl' function. */
#define _GLIBCXX_HAVE_SINL 1
/* Defined if sleep exists. */
/* #undef _GLIBCXX_HAVE_SLEEP */
/* Define to 1 if you have the `sqrtf' function. */
#define _GLIBCXX_HAVE_SQRTF 1
/* Define to 1 if you have the `sqrtl' function. */
#define _GLIBCXX_HAVE_SQRTL 1
/* Define to 1 if you have the <stdalign.h> header file. */
#define _GLIBCXX_HAVE_STDALIGN_H 1
/* Define to 1 if you have the <stdbool.h> header file. */
#define _GLIBCXX_HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define _GLIBCXX_HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define _GLIBCXX_HAVE_STDLIB_H 1
/* Define if strerror_l is available in <string.h>. */
#define _GLIBCXX_HAVE_STRERROR_L 1
/* Define if strerror_r is available in <string.h>. */
#define _GLIBCXX_HAVE_STRERROR_R 1
/* Define to 1 if you have the <strings.h> header file. */
#define _GLIBCXX_HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define _GLIBCXX_HAVE_STRING_H 1
/* Define to 1 if you have the `strtof' function. */
#define _GLIBCXX_HAVE_STRTOF 1
/* Define to 1 if you have the `strtold' function. */
#define _GLIBCXX_HAVE_STRTOLD 1
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1
/* Define if strxfrm_l is available in <string.h>. */
#define _GLIBCXX_HAVE_STRXFRM_L 1
/* Define to 1 if the target runtime linker supports binding the same symbol
to different versions. */
#define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1
/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/ipc.h> header file. */
#define _GLIBCXX_HAVE_SYS_IPC_H 1
/* Define to 1 if you have the <sys/isa_defs.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
/* Define to 1 if you have the <sys/machine.h> header file. */
/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define _GLIBCXX_HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have a suitable <sys/sdt.h> header file */
#define _GLIBCXX_HAVE_SYS_SDT_H 1
/* Define to 1 if you have the <sys/sem.h> header file. */
#define _GLIBCXX_HAVE_SYS_SEM_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define _GLIBCXX_HAVE_SYS_STATVFS_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define _GLIBCXX_HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysinfo.h> header file. */
#define _GLIBCXX_HAVE_SYS_SYSINFO_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define _GLIBCXX_HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define _GLIBCXX_HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define _GLIBCXX_HAVE_SYS_UIO_H 1
/* Define if S_IFREG is available in <sys/stat.h>. */
/* #undef _GLIBCXX_HAVE_S_IFREG */
/* Define if S_ISREG is available in <sys/stat.h>. */
#define _GLIBCXX_HAVE_S_ISREG 1
/* Define to 1 if you have the `tanf' function. */
#define _GLIBCXX_HAVE_TANF 1
/* Define to 1 if you have the `tanhf' function. */
#define _GLIBCXX_HAVE_TANHF 1
/* Define to 1 if you have the `tanhl' function. */
#define _GLIBCXX_HAVE_TANHL 1
/* Define to 1 if you have the `tanl' function. */
#define _GLIBCXX_HAVE_TANL 1
/* Define to 1 if you have the <tgmath.h> header file. */
#define _GLIBCXX_HAVE_TGMATH_H 1
/* Define to 1 if the target supports thread-local storage. */
#define _GLIBCXX_HAVE_TLS 1
/* Define to 1 if you have the <uchar.h> header file. */
#define _GLIBCXX_HAVE_UCHAR_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define _GLIBCXX_HAVE_UNISTD_H 1
/* Defined if usleep exists. */
/* #undef _GLIBCXX_HAVE_USLEEP */
/* Define to 1 if you have the <utime.h> header file. */
#define _GLIBCXX_HAVE_UTIME_H 1
/* Defined if vfwscanf exists. */
#define _GLIBCXX_HAVE_VFWSCANF 1
/* Defined if vswscanf exists. */
#define _GLIBCXX_HAVE_VSWSCANF 1
/* Defined if vwscanf exists. */
#define _GLIBCXX_HAVE_VWSCANF 1
/* Define to 1 if you have the <wchar.h> header file. */
#define _GLIBCXX_HAVE_WCHAR_H 1
/* Defined if wcstof exists. */
#define _GLIBCXX_HAVE_WCSTOF 1
/* Define to 1 if you have the <wctype.h> header file. */
#define _GLIBCXX_HAVE_WCTYPE_H 1
/* Defined if Sleep exists. */
/* #undef _GLIBCXX_HAVE_WIN32_SLEEP */
/* Define if writev is available in <sys/uio.h>. */
#define _GLIBCXX_HAVE_WRITEV 1
/* Define to 1 if you have the `_acosf' function. */
/* #undef _GLIBCXX_HAVE__ACOSF */
/* Define to 1 if you have the `_acosl' function. */
/* #undef _GLIBCXX_HAVE__ACOSL */
/* Define to 1 if you have the `_aligned_malloc' function. */
/* #undef _GLIBCXX_HAVE__ALIGNED_MALLOC */
/* Define to 1 if you have the `_asinf' function. */
/* #undef _GLIBCXX_HAVE__ASINF */
/* Define to 1 if you have the `_asinl' function. */
/* #undef _GLIBCXX_HAVE__ASINL */
/* Define to 1 if you have the `_atan2f' function. */
/* #undef _GLIBCXX_HAVE__ATAN2F */
/* Define to 1 if you have the `_atan2l' function. */
/* #undef _GLIBCXX_HAVE__ATAN2L */
/* Define to 1 if you have the `_atanf' function. */
/* #undef _GLIBCXX_HAVE__ATANF */
/* Define to 1 if you have the `_atanl' function. */
/* #undef _GLIBCXX_HAVE__ATANL */
/* Define to 1 if you have the `_ceilf' function. */
/* #undef _GLIBCXX_HAVE__CEILF */
/* Define to 1 if you have the `_ceill' function. */
/* #undef _GLIBCXX_HAVE__CEILL */
/* Define to 1 if you have the `_cosf' function. */
/* #undef _GLIBCXX_HAVE__COSF */
/* Define to 1 if you have the `_coshf' function. */
/* #undef _GLIBCXX_HAVE__COSHF */
/* Define to 1 if you have the `_coshl' function. */
/* #undef _GLIBCXX_HAVE__COSHL */
/* Define to 1 if you have the `_cosl' function. */
/* #undef _GLIBCXX_HAVE__COSL */
/* Define to 1 if you have the `_expf' function. */
/* #undef _GLIBCXX_HAVE__EXPF */
/* Define to 1 if you have the `_expl' function. */
/* #undef _GLIBCXX_HAVE__EXPL */
/* Define to 1 if you have the `_fabsf' function. */
/* #undef _GLIBCXX_HAVE__FABSF */
/* Define to 1 if you have the `_fabsl' function. */
/* #undef _GLIBCXX_HAVE__FABSL */
/* Define to 1 if you have the `_finite' function. */
/* #undef _GLIBCXX_HAVE__FINITE */
/* Define to 1 if you have the `_finitef' function. */
/* #undef _GLIBCXX_HAVE__FINITEF */
/* Define to 1 if you have the `_finitel' function. */
/* #undef _GLIBCXX_HAVE__FINITEL */
/* Define to 1 if you have the `_floorf' function. */
/* #undef _GLIBCXX_HAVE__FLOORF */
/* Define to 1 if you have the `_floorl' function. */
/* #undef _GLIBCXX_HAVE__FLOORL */
/* Define to 1 if you have the `_fmodf' function. */
/* #undef _GLIBCXX_HAVE__FMODF */
/* Define to 1 if you have the `_fmodl' function. */
/* #undef _GLIBCXX_HAVE__FMODL */
/* Define to 1 if you have the `_fpclass' function. */
/* #undef _GLIBCXX_HAVE__FPCLASS */
/* Define to 1 if you have the `_frexpf' function. */
/* #undef _GLIBCXX_HAVE__FREXPF */
/* Define to 1 if you have the `_frexpl' function. */
/* #undef _GLIBCXX_HAVE__FREXPL */
/* Define to 1 if you have the `_hypot' function. */
/* #undef _GLIBCXX_HAVE__HYPOT */
/* Define to 1 if you have the `_hypotf' function. */
/* #undef _GLIBCXX_HAVE__HYPOTF */
/* Define to 1 if you have the `_hypotl' function. */
/* #undef _GLIBCXX_HAVE__HYPOTL */
/* Define to 1 if you have the `_isinf' function. */
/* #undef _GLIBCXX_HAVE__ISINF */
/* Define to 1 if you have the `_isinff' function. */
/* #undef _GLIBCXX_HAVE__ISINFF */
/* Define to 1 if you have the `_isinfl' function. */
/* #undef _GLIBCXX_HAVE__ISINFL */
/* Define to 1 if you have the `_isnan' function. */
/* #undef _GLIBCXX_HAVE__ISNAN */
/* Define to 1 if you have the `_isnanf' function. */
/* #undef _GLIBCXX_HAVE__ISNANF */
/* Define to 1 if you have the `_isnanl' function. */
/* #undef _GLIBCXX_HAVE__ISNANL */
/* Define to 1 if you have the `_ldexpf' function. */
/* #undef _GLIBCXX_HAVE__LDEXPF */
/* Define to 1 if you have the `_ldexpl' function. */
/* #undef _GLIBCXX_HAVE__LDEXPL */
/* Define to 1 if you have the `_log10f' function. */
/* #undef _GLIBCXX_HAVE__LOG10F */
/* Define to 1 if you have the `_log10l' function. */
/* #undef _GLIBCXX_HAVE__LOG10L */
/* Define to 1 if you have the `_logf' function. */
/* #undef _GLIBCXX_HAVE__LOGF */
/* Define to 1 if you have the `_logl' function. */
/* #undef _GLIBCXX_HAVE__LOGL */
/* Define to 1 if you have the `_modf' function. */
/* #undef _GLIBCXX_HAVE__MODF */
/* Define to 1 if you have the `_modff' function. */
/* #undef _GLIBCXX_HAVE__MODFF */
/* Define to 1 if you have the `_modfl' function. */
/* #undef _GLIBCXX_HAVE__MODFL */
/* Define to 1 if you have the `_powf' function. */
/* #undef _GLIBCXX_HAVE__POWF */
/* Define to 1 if you have the `_powl' function. */
/* #undef _GLIBCXX_HAVE__POWL */
/* Define to 1 if you have the `_qfpclass' function. */
/* #undef _GLIBCXX_HAVE__QFPCLASS */
/* Define to 1 if you have the `_sincos' function. */
/* #undef _GLIBCXX_HAVE__SINCOS */
/* Define to 1 if you have the `_sincosf' function. */
/* #undef _GLIBCXX_HAVE__SINCOSF */
/* Define to 1 if you have the `_sincosl' function. */
/* #undef _GLIBCXX_HAVE__SINCOSL */
/* Define to 1 if you have the `_sinf' function. */
/* #undef _GLIBCXX_HAVE__SINF */
/* Define to 1 if you have the `_sinhf' function. */
/* #undef _GLIBCXX_HAVE__SINHF */
/* Define to 1 if you have the `_sinhl' function. */
/* #undef _GLIBCXX_HAVE__SINHL */
/* Define to 1 if you have the `_sinl' function. */
/* #undef _GLIBCXX_HAVE__SINL */
/* Define to 1 if you have the `_sqrtf' function. */
/* #undef _GLIBCXX_HAVE__SQRTF */
/* Define to 1 if you have the `_sqrtl' function. */
/* #undef _GLIBCXX_HAVE__SQRTL */
/* Define to 1 if you have the `_tanf' function. */
/* #undef _GLIBCXX_HAVE__TANF */
/* Define to 1 if you have the `_tanhf' function. */
/* #undef _GLIBCXX_HAVE__TANHF */
/* Define to 1 if you have the `_tanhl' function. */
/* #undef _GLIBCXX_HAVE__TANHL */
/* Define to 1 if you have the `_tanl' function. */
/* #undef _GLIBCXX_HAVE__TANL */
/* Define to 1 if you have the `__cxa_thread_atexit' function. */
/* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT */
/* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */
#define _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL 1
/* Define as const if the declaration of iconv() needs const. */
#define _GLIBCXX_ICONV_CONST
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
/* #undef _GLIBCXX_PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define _GLIBCXX_PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define _GLIBCXX_PACKAGE_NAME "package-unused"
/* Define to the full name and version of this package. */
#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
/* Define to the one symbol short name of this package. */
#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
/* Define to the home page for this package. */
#define _GLIBCXX_PACKAGE_URL ""
/* Define to the version of this package. */
#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
/* The size of `char', as computed by sizeof. */
/* #undef SIZEOF_CHAR */
/* The size of `int', as computed by sizeof. */
/* #undef SIZEOF_INT */
/* The size of `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* The size of `short', as computed by sizeof. */
/* #undef SIZEOF_SHORT */
/* The size of `void *', as computed by sizeof. */
/* #undef SIZEOF_VOID_P */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
/* #undef _GLIBCXX_VERSION */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _GLIBCXX_FILE_OFFSET_BITS */
/* Define if C99 functions in <complex.h> should be used in <complex> for
C++11. Using compiler builtins for these functions requires corresponding
C99 library functions to be present. */
#define _GLIBCXX11_USE_C99_COMPLEX 1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_MATH 1
/* Define if C99 functions or macros in <stdio.h> should be imported in
<cstdio> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_STDIO 1
/* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++11. */
#define _GLIBCXX11_USE_C99_WCHAR 1
/* Define if C99 functions in <complex.h> should be used in <complex> for
C++98. Using compiler builtins for these functions requires corresponding
C99 library functions to be present. */
#define _GLIBCXX98_USE_C99_COMPLEX 1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_MATH 1
/* Define if C99 functions or macros in <stdio.h> should be imported in
<cstdio> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_STDIO 1
/* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++98. */
#define _GLIBCXX98_USE_C99_WCHAR 1
/* Define if the compiler supports C++11 atomics. */
#define _GLIBCXX_ATOMIC_BUILTINS 1
/* Define to use concept checking code from the boost libraries. */
/* #undef _GLIBCXX_CONCEPT_CHECKS */
/* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable,
undefined for platform defaults */
#define _GLIBCXX_FULLY_DYNAMIC_STRING 0
/* Define if gthreads library is available. */
#define _GLIBCXX_HAS_GTHREADS 1
/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
#define _GLIBCXX_HOSTED 1
/* Define if compatibility should be provided for -mlong-double-64. */
/* Define to the letter to which size_t is mangled. */
#define _GLIBCXX_MANGLE_SIZE_T m
/* Define if C99 llrint and llround functions are missing from <math.h>. */
/* #undef _GLIBCXX_NO_C99_ROUNDING_FUNCS */
/* Define if ptrdiff_t is int. */
/* #undef _GLIBCXX_PTRDIFF_T_IS_INT */
/* Define if using setrlimit to set resource limits during "make check" */
#define _GLIBCXX_RES_LIMITS 1
/* Define if size_t is unsigned int. */
/* #undef _GLIBCXX_SIZE_T_IS_UINT */
/* Define to the value of the EOF integer constant. */
#define _GLIBCXX_STDIO_EOF -1
/* Define to the value of the SEEK_CUR integer constant. */
#define _GLIBCXX_STDIO_SEEK_CUR 1
/* Define to the value of the SEEK_END integer constant. */
#define _GLIBCXX_STDIO_SEEK_END 2
/* Define to use symbol versioning in the shared library. */
#define _GLIBCXX_SYMVER 1
/* Define to use darwin versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_DARWIN */
/* Define to use GNU versioning in the shared library. */
#define _GLIBCXX_SYMVER_GNU 1
/* Define to use GNU namespace versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
/* Define to use Sun versioning in the shared library. */
/* #undef _GLIBCXX_SYMVER_SUN */
/* Define if C11 functions in <uchar.h> should be imported into namespace std
in <cuchar>. */
#define _GLIBCXX_USE_C11_UCHAR_CXX11 1
/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
<stdio.h>, and <stdlib.h> can be used or exposed. */
#define _GLIBCXX_USE_C99 1
/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
Using compiler builtins for these functions requires corresponding C99
library functions to be present. */
#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_CTYPE_TR1 1
/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_FENV_TR1 1
/* Define if C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1
/* Define if C99 functions or macros in <math.h> should be imported in
<tr1/cmath> in namespace std::tr1. */
#define _GLIBCXX_USE_C99_MATH_TR1 1
/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
namespace std::tr1. */
#define _GLIBCXX_USE_C99_STDINT_TR1 1
/* Defined if clock_gettime syscall has monotonic and realtime clock support.
*/
/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */
/* Defined if clock_gettime has monotonic clock support. */
#define _GLIBCXX_USE_CLOCK_MONOTONIC 1
/* Defined if clock_gettime has realtime clock support. */
#define _GLIBCXX_USE_CLOCK_REALTIME 1
/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
this host. */
#define _GLIBCXX_USE_DECIMAL_FLOAT 1
/* Define if fchmod is available in <sys/stat.h>. */
#define _GLIBCXX_USE_FCHMOD 1
/* Define if fchmodat is available in <sys/stat.h>. */
#define _GLIBCXX_USE_FCHMODAT 1
/* Defined if gettimeofday is available. */
#define _GLIBCXX_USE_GETTIMEOFDAY 1
/* Define if get_nprocs is available in <sys/sysinfo.h>. */
#define _GLIBCXX_USE_GET_NPROCS 1
/* Define if __int128 is supported on this host. */
#define _GLIBCXX_USE_INT128 1
/* Define if LFS support is available. */
#define _GLIBCXX_USE_LFS 1
/* Define if code specialized for long long should be used. */
#define _GLIBCXX_USE_LONG_LONG 1
/* Defined if nanosleep is available. */
#define _GLIBCXX_USE_NANOSLEEP 1
/* Define if NLS translations are to be used. */
#define _GLIBCXX_USE_NLS 1
/* Define if pthreads_num_processors_np is available in <pthread.h>. */
/* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */
/* Define if POSIX read/write locks are available in <gthr.h>. */
#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1
/* Define if /dev/random and /dev/urandom are available for the random_device
of TR1 (Chapter 5.1). */
#define _GLIBCXX_USE_RANDOM_TR1 1
/* Define if usable realpath is available in <stdlib.h>. */
#define _GLIBCXX_USE_REALPATH 1
/* Defined if sched_yield is available. */
#define _GLIBCXX_USE_SCHED_YIELD 1
/* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */
#define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1
/* Define if _SC_NPROC_ONLN is available in <unistd.h>. */
/* #undef _GLIBCXX_USE_SC_NPROC_ONLN */
/* Define if sendfile is available in <sys/sendfile.h>. */
#define _GLIBCXX_USE_SENDFILE 1
/* Define if struct stat has timespec members. */
#define _GLIBCXX_USE_ST_MTIM 1
/* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */
/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */
/* Define if obsolescent tmpnam is available in <stdio.h>. */
#define _GLIBCXX_USE_TMPNAM 1
/* Define if utimensat and UTIME_OMIT are available in <sys/stat.h> and
AT_FDCWD in <fcntl.h>. */
#define _GLIBCXX_USE_UTIMENSAT 1
/* Define if code specialized for wchar_t should be used. */
#define _GLIBCXX_USE_WCHAR_T 1
/* Define to 1 if a verbose library is built, or 0 otherwise. */
#define _GLIBCXX_VERBOSE 1
/* Defined if as can handle rdrand. */
#define _GLIBCXX_X86_RDRAND 1
/* Define to 1 if mutex_timedlock is available. */
#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
/* Define for large files, on AIX-style hosts. */
/* #undef _GLIBCXX_LARGE_FILES */
/* Define if all C++11 floating point overloads are available in <math.h>. */
#if __cplusplus >= 201103L
/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP */
#endif
/* Define if all C++11 integral type overloads are available in <math.h>. */
#if __cplusplus >= 201103L
/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT */
#endif
#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
# define _GLIBCXX_HAVE_ACOSF 1
# define acosf _acosf
#endif
#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
# define _GLIBCXX_HAVE_ACOSL 1
# define acosl _acosl
#endif
#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
# define _GLIBCXX_HAVE_ASINF 1
# define asinf _asinf
#endif
#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
# define _GLIBCXX_HAVE_ASINL 1
# define asinl _asinl
#endif
#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
# define _GLIBCXX_HAVE_ATAN2F 1
# define atan2f _atan2f
#endif
#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
# define _GLIBCXX_HAVE_ATAN2L 1
# define atan2l _atan2l
#endif
#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
# define _GLIBCXX_HAVE_ATANF 1
# define atanf _atanf
#endif
#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
# define _GLIBCXX_HAVE_ATANL 1
# define atanl _atanl
#endif
#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
# define _GLIBCXX_HAVE_CEILF 1
# define ceilf _ceilf
#endif
#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
# define _GLIBCXX_HAVE_CEILL 1
# define ceill _ceill
#endif
#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
# define _GLIBCXX_HAVE_COSF 1
# define cosf _cosf
#endif
#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
# define _GLIBCXX_HAVE_COSHF 1
# define coshf _coshf
#endif
#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
# define _GLIBCXX_HAVE_COSHL 1
# define coshl _coshl
#endif
#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
# define _GLIBCXX_HAVE_COSL 1
# define cosl _cosl
#endif
#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
# define _GLIBCXX_HAVE_EXPF 1
# define expf _expf
#endif
#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
# define _GLIBCXX_HAVE_EXPL 1
# define expl _expl
#endif
#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
# define _GLIBCXX_HAVE_FABSF 1
# define fabsf _fabsf
#endif
#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
# define _GLIBCXX_HAVE_FABSL 1
# define fabsl _fabsl
#endif
#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
# define _GLIBCXX_HAVE_FINITE 1
# define finite _finite
#endif
#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
# define _GLIBCXX_HAVE_FINITEF 1
# define finitef _finitef
#endif
#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
# define _GLIBCXX_HAVE_FINITEL 1
# define finitel _finitel
#endif
#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
# define _GLIBCXX_HAVE_FLOORF 1
# define floorf _floorf
#endif
#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
# define _GLIBCXX_HAVE_FLOORL 1
# define floorl _floorl
#endif
#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
# define _GLIBCXX_HAVE_FMODF 1
# define fmodf _fmodf
#endif
#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
# define _GLIBCXX_HAVE_FMODL 1
# define fmodl _fmodl
#endif
#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
# define _GLIBCXX_HAVE_FPCLASS 1
# define fpclass _fpclass
#endif
#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
# define _GLIBCXX_HAVE_FREXPF 1
# define frexpf _frexpf
#endif
#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
# define _GLIBCXX_HAVE_FREXPL 1
# define frexpl _frexpl
#endif
#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
# define _GLIBCXX_HAVE_HYPOT 1
# define hypot _hypot
#endif
#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
# define _GLIBCXX_HAVE_HYPOTF 1
# define hypotf _hypotf
#endif
#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
# define _GLIBCXX_HAVE_HYPOTL 1
# define hypotl _hypotl
#endif
#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
# define _GLIBCXX_HAVE_ISINF 1
# define isinf _isinf
#endif
#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
# define _GLIBCXX_HAVE_ISINFF 1
# define isinff _isinff
#endif
#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
# define _GLIBCXX_HAVE_ISINFL 1
# define isinfl _isinfl
#endif
#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
# define _GLIBCXX_HAVE_ISNAN 1
# define isnan _isnan
#endif
#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
# define _GLIBCXX_HAVE_ISNANF 1
# define isnanf _isnanf
#endif
#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
# define _GLIBCXX_HAVE_ISNANL 1
# define isnanl _isnanl
#endif
#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
# define _GLIBCXX_HAVE_LDEXPF 1
# define ldexpf _ldexpf
#endif
#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
# define _GLIBCXX_HAVE_LDEXPL 1
# define ldexpl _ldexpl
#endif
#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
# define _GLIBCXX_HAVE_LOG10F 1
# define log10f _log10f
#endif
#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
# define _GLIBCXX_HAVE_LOG10L 1
# define log10l _log10l
#endif
#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
# define _GLIBCXX_HAVE_LOGF 1
# define logf _logf
#endif
#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
# define _GLIBCXX_HAVE_LOGL 1
# define logl _logl
#endif
#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
# define _GLIBCXX_HAVE_MODF 1
# define modf _modf
#endif
#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
# define _GLIBCXX_HAVE_MODFF 1
# define modff _modff
#endif
#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
# define _GLIBCXX_HAVE_MODFL 1
# define modfl _modfl
#endif
#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
# define _GLIBCXX_HAVE_POWF 1
# define powf _powf
#endif
#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
# define _GLIBCXX_HAVE_POWL 1
# define powl _powl
#endif
#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
# define _GLIBCXX_HAVE_QFPCLASS 1
# define qfpclass _qfpclass
#endif
#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
# define _GLIBCXX_HAVE_SINCOS 1
# define sincos _sincos
#endif
#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
# define _GLIBCXX_HAVE_SINCOSF 1
# define sincosf _sincosf
#endif
#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
# define _GLIBCXX_HAVE_SINCOSL 1
# define sincosl _sincosl
#endif
#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
# define _GLIBCXX_HAVE_SINF 1
# define sinf _sinf
#endif
#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
# define _GLIBCXX_HAVE_SINHF 1
# define sinhf _sinhf
#endif
#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
# define _GLIBCXX_HAVE_SINHL 1
# define sinhl _sinhl
#endif
#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
# define _GLIBCXX_HAVE_SINL 1
# define sinl _sinl
#endif
#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
# define _GLIBCXX_HAVE_SQRTF 1
# define sqrtf _sqrtf
#endif
#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
# define _GLIBCXX_HAVE_SQRTL 1
# define sqrtl _sqrtl
#endif
#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
# define _GLIBCXX_HAVE_STRTOF 1
# define strtof _strtof
#endif
#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
# define _GLIBCXX_HAVE_STRTOLD 1
# define strtold _strtold
#endif
#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
# define _GLIBCXX_HAVE_TANF 1
# define tanf _tanf
#endif
#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
# define _GLIBCXX_HAVE_TANHF 1
# define tanhf _tanhf
#endif
#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
# define _GLIBCXX_HAVE_TANHL 1
# define tanhl _tanhl
#endif
#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
# define _GLIBCXX_HAVE_TANL 1
# define tanl _tanl
#endif
#endif // _GLIBCXX_CXX_CONFIG_H
#endif
#endif
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
#define _GLIBCXX_GCC_GTHR_POSIX_H
/* POSIX threads specific definitions.
Easy, since the interface is just one-to-one mapping. */
#define __GTHREADS 1
#define __GTHREADS_CXX0X 1
#include <pthread.h>
#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
|| !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
# include <unistd.h>
# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
# else
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
# endif
#endif
typedef pthread_t __gthread_t;
typedef pthread_key_t __gthread_key_t;
typedef pthread_once_t __gthread_once_t;
typedef pthread_mutex_t __gthread_mutex_t;
typedef pthread_mutex_t __gthread_recursive_mutex_t;
typedef pthread_cond_t __gthread_cond_t;
typedef struct timespec __gthread_time_t;
/* POSIX like conditional variables are supported. Please look at comments
in gthr.h for details. */
#define __GTHREAD_HAS_COND 1
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
#else
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
#define __GTHREAD_TIME_INIT {0,0}
#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
# undef __GTHREAD_MUTEX_INIT
#endif
#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
# undef __GTHREAD_RECURSIVE_MUTEX_INIT
# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#endif
#ifdef _GTHREAD_USE_COND_INIT_FUNC
# undef __GTHREAD_COND_INIT
# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
#endif
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
# ifndef __gthrw_pragma
# define __gthrw_pragma(pragma)
# endif
# define __gthrw2(name,name2,type) \
static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
__gthrw_pragma(weak type)
# define __gthrw_(name) __gthrw_ ## name
#else
# define __gthrw2(name,name2,type)
# define __gthrw_(name) name
#endif
/* Typically, __gthrw_foo is a weak reference to symbol foo. */
#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
__gthrw(pthread_once)
__gthrw(pthread_getspecific)
__gthrw(pthread_setspecific)
__gthrw(pthread_create)
__gthrw(pthread_join)
__gthrw(pthread_equal)
__gthrw(pthread_self)
__gthrw(pthread_detach)
#ifndef __BIONIC__
__gthrw(pthread_cancel)
#endif
__gthrw(sched_yield)
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
__gthrw(pthread_mutex_timedlock)
#endif
__gthrw(pthread_mutex_unlock)
__gthrw(pthread_mutex_init)
__gthrw(pthread_mutex_destroy)
__gthrw(pthread_cond_init)
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_signal)
__gthrw(pthread_cond_wait)
__gthrw(pthread_cond_timedwait)
__gthrw(pthread_cond_destroy)
__gthrw(pthread_key_create)
__gthrw(pthread_key_delete)
__gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_settype)
__gthrw(pthread_mutexattr_destroy)
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
/* Objective-C. */
__gthrw(pthread_exit)
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(sched_get_priority_max)
__gthrw(sched_get_priority_min)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
__gthrw(pthread_attr_destroy)
__gthrw(pthread_attr_init)
__gthrw(pthread_attr_setdetachstate)
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(pthread_getschedparam)
__gthrw(pthread_setschedparam)
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _LIBOBJC || _LIBOBJC_WEAK */
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
-pthreads is not specified. The functions are dummies and most return an
error value. However pthread_once returns 0 without invoking the routine
it is passed so we cannot pretend that the interface is active if -pthreads
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
we need to play the usual game with weak symbols. On Solaris 10 and up, a
working interface is always exposed. On FreeBSD 6 and later, libc also
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
which means the alternate __gthread_active_p below cannot be used there. */
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
static volatile int __gthread_active = -1;
static void
__gthread_trigger (void)
{
__gthread_active = 1;
}
static inline int
__gthread_active_p (void)
{
static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
/* This test is not protected to avoid taking a lock on the main code
path so every update of __gthread_active in a threaded program must
be atomic with regard to the result of the test. */
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
if (__gthrw_(pthread_once))
{
/* If this really is a threaded program, then we must ensure that
__gthread_active has been set to 1 before exiting this block. */
__gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
__gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
__gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
}
/* Make sure we'll never enter this block again. */
if (__gthread_active < 0)
__gthread_active = 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* neither FreeBSD nor Solaris */
/* For a program to be multi-threaded the only thing that it certainly must
be using is pthread_create. However, there may be other libraries that
intercept pthread_create with their own definitions to wrap pthreads
functionality for some purpose. In those cases, pthread_create being
defined might not necessarily mean that libpthread is actually linked
in.
For the GNU C library, we can use a known internal name. This is always
available in the ABI, but no other library would define it. That is
ideal, since any public pthread function might be intercepted just as
pthread_create might be. __pthread_key_create is an "internal"
implementation symbol, but it is part of the public exported ABI. Also,
it's among the symbols that the static libpthread.a always links in
whenever pthread_create is used, so there is no danger of a false
negative result in any statically-linked, multi-threaded program.
For others, we choose pthread_cancel as a function that seems unlikely
to be redefined by an interceptor library. The bionic (Android) C
library does not provide pthread_cancel, so we do use pthread_create
there (and interceptor libraries lose). */
#ifdef __GLIBC__
__gthrw2(__gthrw_(__pthread_key_create),
__pthread_key_create,
pthread_key_create)
# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
#elif defined (__BIONIC__)
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
#else
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
#endif
static inline int
__gthread_active_p (void)
{
static void *const __gthread_active_ptr
= __extension__ (void *) >HR_ACTIVE_PROXY;
return __gthread_active_ptr != 0;
}
#endif /* FreeBSD or Solaris */
#else /* not __GXX_WEAK__ */
/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
calls in shared flavors of the HP-UX C library. Most of the stubs
have no functionality. The details are described in the "libc cumulative
patch" for each subversion of HP-UX 11. There are two special interfaces
provided for checking whether an application is linked to a shared pthread
library or not. However, these interfaces aren't available in early
libpthread libraries. We also need a test that works for archive
libraries. We can't use pthread_once as some libc versions call the
init function. We also can't use pthread_create or pthread_attr_init
as these create a thread and thereby prevent changing the default stack
size. The function pthread_default_stacksize_np is available in both
the archive and shared versions of libpthread. It can be used to
determine the default pthread stack size. There is a stub in some
shared libc versions which returns a zero size if pthreads are not
active. We provide an equivalent stub to handle cases where libc
doesn't provide one. */
#if defined(__hppa__) && defined(__hpux__)
static volatile int __gthread_active = -1;
static inline int
__gthread_active_p (void)
{
/* Avoid reading __gthread_active twice on the main code path. */
int __gthread_active_latest_value = __gthread_active;
size_t __s;
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
{
pthread_default_stacksize_np (0, &__s);
__gthread_active = __s ? 1 : 0;
__gthread_active_latest_value = __gthread_active;
}
return __gthread_active_latest_value != 0;
}
#else /* not hppa-hpux */
static inline int
__gthread_active_p (void)
{
return 1;
}
#endif /* hppa-hpux */
#endif /* __GXX_WEAK__ */
#ifdef _LIBOBJC
/* This is the config.h file in libobjc/ */
#include <config.h>
#ifdef HAVE_SCHED_H
# include <sched.h>
#endif
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;
static pthread_attr_t _objc_thread_attribs;
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
static inline int
__gthread_objc_init_thread_system (void)
{
if (__gthread_active_p ())
{
/* Initialize the thread storage key. */
if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
{
/* The normal default detach state for threads is
* PTHREAD_CREATE_JOINABLE which causes threads to not die
* when you think they should. */
if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
&& __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
PTHREAD_CREATE_DETACHED) == 0)
return 0;
}
}
return -1;
}
/* Close the threads subsystem. */
static inline int
__gthread_objc_close_thread_system (void)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
&& __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
return 0;
return -1;
}
/* Backend thread functions */
/* Create a new thread of execution. */
static inline objc_thread_t
__gthread_objc_thread_detach (void (*func)(void *), void *arg)
{
objc_thread_t thread_id;
pthread_t new_thread_handle;
if (!__gthread_active_p ())
return NULL;
if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
(void *) func, arg)))
thread_id = (objc_thread_t) new_thread_handle;
else
thread_id = NULL;
return thread_id;
}
/* Set the current thread's priority. */
static inline int
__gthread_objc_thread_set_priority (int priority)
{
if (!__gthread_active_p ())
return -1;
else
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_t thread_id = __gthrw_(pthread_self) ();
int policy;
struct sched_param params;
int priority_min, priority_max;
if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0)
{
if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
return -1;
if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
return -1;
if (priority > priority_max)
priority = priority_max;
else if (priority < priority_min)
priority = priority_min;
params.sched_priority = priority;
/*
* The solaris 7 and several other man pages incorrectly state that
* this should be a pointer to policy but pthread.h is universally
* at odds with this.
*/
if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0)
return 0;
}
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return -1;
}
}
/* Return the current thread's priority. */
static inline int
__gthread_objc_thread_get_priority (void)
{
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
if (__gthread_active_p ())
{
int policy;
struct sched_param params;
if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0)
return params.sched_priority;
else
return -1;
}
else
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
#endif /* _POSIX_PRIORITY_SCHEDULING */
return OBJC_THREAD_INTERACTIVE_PRIORITY;
}
/* Yield our process time to another thread. */
static inline void
__gthread_objc_thread_yield (void)
{
if (__gthread_active_p ())
__gthrw_(sched_yield) ();
}
/* Terminate the current thread. */
static inline int
__gthread_objc_thread_exit (void)
{
if (__gthread_active_p ())
/* exit the thread */
__gthrw_(pthread_exit) (&__objc_thread_exit_status);
/* Failed if we reached here */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
static inline objc_thread_t
__gthread_objc_thread_id (void)
{
if (__gthread_active_p ())
return (objc_thread_t) __gthrw_(pthread_self) ();
else
return (objc_thread_t) 1;
}
/* Sets the thread's local storage pointer. */
static inline int
__gthread_objc_thread_set_data (void *value)
{
if (__gthread_active_p ())
return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
else
{
thread_local_storage = value;
return 0;
}
}
/* Returns the thread's local storage pointer. */
static inline void *
__gthread_objc_thread_get_data (void)
{
if (__gthread_active_p ())
return __gthrw_(pthread_getspecific) (_objc_thread_storage);
else
return thread_local_storage;
}
/* Backend mutex functions */
/* Allocate a mutex. */
static inline int
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
{
objc_free (mutex->backend);
mutex->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a mutex. */
static inline int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
{
if (__gthread_active_p ())
{
int count;
/*
* Posix Threads specifically require that the thread be unlocked
* for __gthrw_(pthread_mutex_destroy) to work.
*/
do
{
count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
if (count < 0)
return -1;
}
while (count);
if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
return -1;
objc_free (mutex->backend);
mutex->backend = NULL;
}
return 0;
}
/* Grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_lock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Try to grab a lock on a mutex. */
static inline int
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Unlock the mutex */
static inline int
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
&& __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
{
return -1;
}
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
static inline int
__gthread_objc_condition_allocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
condition->backend = objc_malloc (sizeof (pthread_cond_t));
if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
{
objc_free (condition->backend);
condition->backend = NULL;
return -1;
}
}
return 0;
}
/* Deallocate a condition. */
static inline int
__gthread_objc_condition_deallocate (objc_condition_t condition)
{
if (__gthread_active_p ())
{
if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
return -1;
objc_free (condition->backend);
condition->backend = NULL;
}
return 0;
}
/* Wait on the condition */
static inline int
__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
(pthread_mutex_t *) mutex->backend);
else
return 0;
}
/* Wake up all threads waiting on this condition. */
static inline int
__gthread_objc_condition_broadcast (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
else
return 0;
}
/* Wake up one thread waiting on this condition. */
static inline int
__gthread_objc_condition_signal (objc_condition_t condition)
{
if (__gthread_active_p ())
return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
else
return 0;
}
#else /* _LIBOBJC */
static inline int
__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
void *__args)
{
return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
}
static inline int
__gthread_join (__gthread_t __threadid, void **__value_ptr)
{
return __gthrw_(pthread_join) (__threadid, __value_ptr);
}
static inline int
__gthread_detach (__gthread_t __threadid)
{
return __gthrw_(pthread_detach) (__threadid);
}
static inline int
__gthread_equal (__gthread_t __t1, __gthread_t __t2)
{
return __gthrw_(pthread_equal) (__t1, __t2);
}
static inline __gthread_t
__gthread_self (void)
{
return __gthrw_(pthread_self) ();
}
static inline int
__gthread_yield (void)
{
return __gthrw_(sched_yield) ();
}
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(pthread_key_create) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return __gthrw_(pthread_key_delete) (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return __gthrw_(pthread_getspecific) (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(pthread_setspecific) (__key, __ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
__gthrw_(pthread_mutex_init) (__mutex, NULL);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
else
return 0;
}
#endif
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
|| defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_mutexattr_t __attr;
int __r;
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
PTHREAD_MUTEX_RECURSIVE);
if (!__r)
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
return __r;
}
return 0;
}
#endif
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (__mutex);
}
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
static inline int
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
}
#endif
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (__mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
#ifdef _GTHREAD_USE_COND_INIT_FUNC
static inline void
__gthread_cond_init_function (__gthread_cond_t *__cond)
{
if (__gthread_active_p ())
__gthrw_(pthread_cond_init) (__cond, NULL);
}
#endif
static inline int
__gthread_cond_broadcast (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_broadcast) (__cond);
}
static inline int
__gthread_cond_signal (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_signal) (__cond);
}
static inline int
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
{
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
}
static inline int
__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
const __gthread_time_t *__abs_timeout)
{
return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
}
static inline int
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
__gthread_recursive_mutex_t *__mutex)
{
return __gthread_cond_wait (__cond, __mutex);
}
static inline int
__gthread_cond_destroy (__gthread_cond_t* __cond)
{
return __gthrw_(pthread_cond_destroy) (__cond);
}
#endif /* _LIBOBJC */
#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
// Locale support -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/ctype_inline.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.1 Locales
//
// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
// functions go in ctype.cc
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
ctype<char>::
is(mask __m, char __c) const
{ return _M_table[static_cast<unsigned char>(__c)] & __m; }
const char*
ctype<char>::
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
return __high;
}
const char*
ctype<char>::
scan_is(mask __m, const char* __low, const char* __high) const
{
while (__low < __high
&& !(_M_table[static_cast<unsigned char>(*__low)] & __m))
++__low;
return __low;
}
const char*
ctype<char>::
scan_not(mask __m, const char* __low, const char* __high) const
{
while (__low < __high
&& (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
++__low;
return __low;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// Locale support -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/ctype_base.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.1 Locales
//
// Information as gleaned from /usr/include/ctype.h
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @brief Base class for ctype.
struct ctype_base
{
// Non-standard typedefs.
typedef const int* __to_type;
// NB: Offsets into ctype<char>::_M_table force a particular size
// on the mask type. Because of this, we don't use an enum.
typedef unsigned short mask;
static const mask upper = _ISupper;
static const mask lower = _ISlower;
static const mask alpha = _ISalpha;
static const mask digit = _ISdigit;
static const mask xdigit = _ISxdigit;
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask graph = _ISalpha | _ISdigit | _ISpunct;
static const mask cntrl = _IScntrl;
static const mask punct = _ISpunct;
static const mask alnum = _ISalpha | _ISdigit;
#if __cplusplus >= 201103L
static const mask blank = _ISblank;
#endif
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// Specific definitions for GNU/Linux -*- C++ -*-
// Copyright (C) 2000-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/os_defines.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _GLIBCXX_OS_DEFINES
#define _GLIBCXX_OS_DEFINES 1
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
// This keeps isanum, et al from being propagated as macros.
#define __NO_CTYPE 1
#include <features.h>
// Provide a declaration for the possibly deprecated gets function, as
// glibc 2.15 and later does not declare gets for ISO C11 when
// __GNU_SOURCE is defined.
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
# undef _GLIBCXX_HAVE_GETS
#endif
// Glibc 2.23 removed the obsolete isinf and isnan declarations. Check the
// version dynamically in case it has changed since libstdc++ was configured.
#define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23)
#endif
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/time_members.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
//
// ISO C++ 14882: 22.2.5.1.2 - time_get functions
// ISO C++ 14882: 22.2.5.3.2 - time_put functions
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
_M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0),
_M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
: facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
_M_name_timepunct(0)
{
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
{
const size_t __len = __builtin_strlen(__s) + 1;
char* __tmp = new char[__len];
__builtin_memcpy(__tmp, __s, __len);
_M_name_timepunct = __tmp;
}
else
_M_name_timepunct = _S_get_c_name();
__try
{ _M_initialize_timepunct(__cloc); }
__catch(...)
{
if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct;
__throw_exception_again;
}
}
template<typename _CharT>
__timepunct<_CharT>::~__timepunct()
{
if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct;
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// The template and inlines for the -*- C++ -*- valarray class.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/valarray
* This is a Standard C++ Library header.
*/
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _GLIBCXX_VALARRAY
#define _GLIBCXX_VALARRAY 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <cmath>
#include <algorithm>
#include <debug/debug.h>
#if __cplusplus >= 201103L
#include <initializer_list>
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _Clos, typename _Tp>
class _Expr;
template<typename _Tp1, typename _Tp2>
class _ValArray;
template<class _Oper, template<class, class> class _Meta, class _Dom>
struct _UnClos;
template<class _Oper,
template<class, class> class _Meta1,
template<class, class> class _Meta2,
class _Dom1, class _Dom2>
class _BinClos;
template<template<class, class> class _Meta, class _Dom>
class _SClos;
template<template<class, class> class _Meta, class _Dom>
class _GClos;
template<template<class, class> class _Meta, class _Dom>
class _IClos;
template<template<class, class> class _Meta, class _Dom>
class _ValFunClos;
template<template<class, class> class _Meta, class _Dom>
class _RefFunClos;
template<class _Tp> class valarray; // An array of type _Tp
class slice; // BLAS-like slice out of an array
template<class _Tp> class slice_array;
class gslice; // generalized slice out of an array
template<class _Tp> class gslice_array;
template<class _Tp> class mask_array; // masked array
template<class _Tp> class indirect_array; // indirected array
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#include <bits/valarray_array.h>
#include <bits/valarray_before.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup numeric_arrays Numeric Arrays
* @ingroup numerics
*
* Classes and functions for representing and manipulating arrays of elements.
* @{
*/
/**
* @brief Smart array designed to support numeric processing.
*
* A valarray is an array that provides constraints intended to allow for
* effective optimization of numeric array processing by reducing the
* aliasing that can result from pointer representations. It represents a
* one-dimensional array from which different multidimensional subsets can
* be accessed and modified.
*
* @tparam _Tp Type of object in the array.
*/
template<class _Tp>
class valarray
{
template<class _Op>
struct _UnaryOp
{
typedef typename __fun<_Op, _Tp>::result_type __rt;
typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt;
};
public:
typedef _Tp value_type;
// _lib.valarray.cons_ construct/destroy:
/// Construct an empty array.
valarray();
/// Construct an array with @a n elements.
explicit valarray(size_t);
/// Construct an array with @a n elements initialized to @a t.
valarray(const _Tp&, size_t);
/// Construct an array initialized to the first @a n elements of @a t.
valarray(const _Tp* __restrict__, size_t);
/// Copy constructor.
valarray(const valarray&);
#if __cplusplus >= 201103L
/// Move constructor.
valarray(valarray&&) noexcept;
#endif
/// Construct an array with the same size and values in @a sa.
valarray(const slice_array<_Tp>&);
/// Construct an array with the same size and values in @a ga.
valarray(const gslice_array<_Tp>&);
/// Construct an array with the same size and values in @a ma.
valarray(const mask_array<_Tp>&);
/// Construct an array with the same size and values in @a ia.
valarray(const indirect_array<_Tp>&);
#if __cplusplus >= 201103L
/// Construct an array with an initializer_list of values.
valarray(initializer_list<_Tp>);
#endif
template<class _Dom>
valarray(const _Expr<_Dom, _Tp>& __e);
~valarray() _GLIBCXX_NOEXCEPT;
// _lib.valarray.assign_ assignment:
/**
* @brief Assign elements to an array.
*
* Assign elements of array to values in @a v.
*
* @param __v Valarray to get values from.
*/
valarray<_Tp>& operator=(const valarray<_Tp>& __v);
#if __cplusplus >= 201103L
/**
* @brief Move assign elements to an array.
*
* Move assign elements of array to values in @a v.
*
* @param __v Valarray to get values from.
*/
valarray<_Tp>& operator=(valarray<_Tp>&& __v) noexcept;
#endif
/**
* @brief Assign elements to a value.
*
* Assign all elements of array to @a t.
*
* @param __t Value for elements.
*/
valarray<_Tp>& operator=(const _Tp& __t);
/**
* @brief Assign elements to an array subset.
*
* Assign elements of array to values in @a sa. Results are undefined
* if @a sa does not have the same size as this array.
*
* @param __sa Array slice to get values from.
*/
valarray<_Tp>& operator=(const slice_array<_Tp>& __sa);
/**
* @brief Assign elements to an array subset.
*
* Assign elements of array to values in @a ga. Results are undefined
* if @a ga does not have the same size as this array.
*
* @param __ga Array slice to get values from.
*/
valarray<_Tp>& operator=(const gslice_array<_Tp>& __ga);
/**
* @brief Assign elements to an array subset.
*
* Assign elements of array to values in @a ma. Results are undefined
* if @a ma does not have the same size as this array.
*
* @param __ma Array slice to get values from.
*/
valarray<_Tp>& operator=(const mask_array<_Tp>& __ma);
/**
* @brief Assign elements to an array subset.
*
* Assign elements of array to values in @a ia. Results are undefined
* if @a ia does not have the same size as this array.
*
* @param __ia Array slice to get values from.
*/
valarray<_Tp>& operator=(const indirect_array<_Tp>& __ia);
#if __cplusplus >= 201103L
/**
* @brief Assign elements to an initializer_list.
*
* Assign elements of array to values in @a __l. Results are undefined
* if @a __l does not have the same size as this array.
*
* @param __l initializer_list to get values from.
*/
valarray& operator=(initializer_list<_Tp> __l);
#endif
template<class _Dom> valarray<_Tp>&
operator= (const _Expr<_Dom, _Tp>&);
// _lib.valarray.access_ element access:
/**
* Return a reference to the i'th array element.
*
* @param __i Index of element to return.
* @return Reference to the i'th element.
*/
_Tp& operator[](size_t __i);
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 389. Const overload of valarray::operator[] returns by value.
const _Tp& operator[](size_t) const;
// _lib.valarray.sub_ subset operations:
/**
* @brief Return an array subset.
*
* Returns a new valarray containing the elements of the array
* indicated by the slice argument. The new valarray has the same size
* as the input slice. @see slice.
*
* @param __s The source slice.
* @return New valarray containing elements in @a __s.
*/
_Expr<_SClos<_ValArray, _Tp>, _Tp> operator[](slice __s) const;
/**
* @brief Return a reference to an array subset.
*
* Returns a new valarray containing the elements of the array
* indicated by the slice argument. The new valarray has the same size
* as the input slice. @see slice.
*
* @param __s The source slice.
* @return New valarray containing elements in @a __s.
*/
slice_array<_Tp> operator[](slice __s);
/**
* @brief Return an array subset.
*
* Returns a slice_array referencing the elements of the array
* indicated by the slice argument. @see gslice.
*
* @param __s The source slice.
* @return Slice_array referencing elements indicated by @a __s.
*/
_Expr<_GClos<_ValArray, _Tp>, _Tp> operator[](const gslice& __s) const;
/**
* @brief Return a reference to an array subset.
*
* Returns a new valarray containing the elements of the array
* indicated by the gslice argument. The new valarray has
* the same size as the input gslice. @see gslice.
*
* @param __s The source gslice.
* @return New valarray containing elements in @a __s.
*/
gslice_array<_Tp> operator[](const gslice& __s);
/**
* @brief Return an array subset.
*
* Returns a new valarray containing the elements of the array
* indicated by the argument. The input is a valarray of bool which
* represents a bitmask indicating which elements should be copied into
* the new valarray. Each element of the array is added to the return
* valarray if the corresponding element of the argument is true.
*
* @param __m The valarray bitmask.
* @return New valarray containing elements indicated by @a __m.
*/
valarray<_Tp> operator[](const valarray<bool>& __m) const;
/**
* @brief Return a reference to an array subset.
*
* Returns a new mask_array referencing the elements of the array
* indicated by the argument. The input is a valarray of bool which
* represents a bitmask indicating which elements are part of the
* subset. Elements of the array are part of the subset if the
* corresponding element of the argument is true.
*
* @param __m The valarray bitmask.
* @return New valarray containing elements indicated by @a __m.
*/
mask_array<_Tp> operator[](const valarray<bool>& __m);
/**
* @brief Return an array subset.
*
* Returns a new valarray containing the elements of the array
* indicated by the argument. The elements in the argument are
* interpreted as the indices of elements of this valarray to copy to
* the return valarray.
*
* @param __i The valarray element index list.
* @return New valarray containing elements in @a __s.
*/
_Expr<_IClos<_ValArray, _Tp>, _Tp>
operator[](const valarray<size_t>& __i) const;
/**
* @brief Return a reference to an array subset.
*
* Returns an indirect_array referencing the elements of the array
* indicated by the argument. The elements in the argument are
* interpreted as the indices of elements of this valarray to include
* in the subset. The returned indirect_array refers to these
* elements.
*
* @param __i The valarray element index list.
* @return Indirect_array referencing elements in @a __i.
*/
indirect_array<_Tp> operator[](const valarray<size_t>& __i);
// _lib.valarray.unary_ unary operators:
/// Return a new valarray by applying unary + to each element.
typename _UnaryOp<__unary_plus>::_Rt operator+() const;
/// Return a new valarray by applying unary - to each element.
typename _UnaryOp<__negate>::_Rt operator-() const;
/// Return a new valarray by applying unary ~ to each element.
typename _UnaryOp<__bitwise_not>::_Rt operator~() const;
/// Return a new valarray by applying unary ! to each element.
typename _UnaryOp<__logical_not>::_Rt operator!() const;
// _lib.valarray.cassign_ computed assignment:
/// Multiply each element of array by @a t.
valarray<_Tp>& operator*=(const _Tp&);
/// Divide each element of array by @a t.
valarray<_Tp>& operator/=(const _Tp&);
/// Set each element e of array to e % @a t.
valarray<_Tp>& operator%=(const _Tp&);
/// Add @a t to each element of array.
valarray<_Tp>& operator+=(const _Tp&);
/// Subtract @a t to each element of array.
valarray<_Tp>& operator-=(const _Tp&);
/// Set each element e of array to e ^ @a t.
valarray<_Tp>& operator^=(const _Tp&);
/// Set each element e of array to e & @a t.
valarray<_Tp>& operator&=(const _Tp&);
/// Set each element e of array to e | @a t.
valarray<_Tp>& operator|=(const _Tp&);
/// Left shift each element e of array by @a t bits.
valarray<_Tp>& operator<<=(const _Tp&);
/// Right shift each element e of array by @a t bits.
valarray<_Tp>& operator>>=(const _Tp&);
/// Multiply elements of array by corresponding elements of @a v.
valarray<_Tp>& operator*=(const valarray<_Tp>&);
/// Divide elements of array by corresponding elements of @a v.
valarray<_Tp>& operator/=(const valarray<_Tp>&);
/// Modulo elements of array by corresponding elements of @a v.
valarray<_Tp>& operator%=(const valarray<_Tp>&);
/// Add corresponding elements of @a v to elements of array.
valarray<_Tp>& operator+=(const valarray<_Tp>&);
/// Subtract corresponding elements of @a v from elements of array.
valarray<_Tp>& operator-=(const valarray<_Tp>&);
/// Logical xor corresponding elements of @a v with elements of array.
valarray<_Tp>& operator^=(const valarray<_Tp>&);
/// Logical or corresponding elements of @a v with elements of array.
valarray<_Tp>& operator|=(const valarray<_Tp>&);
/// Logical and corresponding elements of @a v with elements of array.
valarray<_Tp>& operator&=(const valarray<_Tp>&);
/// Left shift elements of array by corresponding elements of @a v.
valarray<_Tp>& operator<<=(const valarray<_Tp>&);
/// Right shift elements of array by corresponding elements of @a v.
valarray<_Tp>& operator>>=(const valarray<_Tp>&);
template<class _Dom>
valarray<_Tp>& operator*=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator/=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator%=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator+=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator-=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator^=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator|=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator&=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&);
template<class _Dom>
valarray<_Tp>& operator>>=(const _Expr<_Dom, _Tp>&);
// _lib.valarray.members_ member functions:
#if __cplusplus >= 201103L
/// Swap.
void swap(valarray<_Tp>& __v) noexcept;
#endif
/// Return the number of elements in array.
size_t size() const;
/**
* @brief Return the sum of all elements in the array.
*
* Accumulates the sum of all elements into a Tp using +=. The order
* of adding the elements is unspecified.
*/
_Tp sum() const;
/// Return the minimum element using operator<().
_Tp min() const;
/// Return the maximum element using operator<().
_Tp max() const;
/**
* @brief Return a shifted array.
*
* A new valarray is constructed as a copy of this array with elements
* in shifted positions. For an element with index i, the new position
* is i - n. The new valarray has the same size as the current one.
* New elements without a value are set to 0. Elements whose new
* position is outside the bounds of the array are discarded.
*
* Positive arguments shift toward index 0, discarding elements [0, n).
* Negative arguments discard elements from the top of the array.
*
* @param __n Number of element positions to shift.
* @return New valarray with elements in shifted positions.
*/
valarray<_Tp> shift (int __n) const;
/**
* @brief Return a rotated array.
*
* A new valarray is constructed as a copy of this array with elements
* in shifted positions. For an element with index i, the new position
* is (i - n) % size(). The new valarray has the same size as the
* current one. Elements that are shifted beyond the array bounds are
* shifted into the other end of the array. No elements are lost.
*
* Positive arguments shift toward index 0, wrapping around the top.
* Negative arguments shift towards the top, wrapping around to 0.
*
* @param __n Number of element positions to rotate.
* @return New valarray with elements in shifted positions.
*/
valarray<_Tp> cshift(int __n) const;
/**
* @brief Apply a function to the array.
*
* Returns a new valarray with elements assigned to the result of
* applying func to the corresponding element of this array. The new
* array has the same size as this one.
*
* @param func Function of Tp returning Tp to apply.
* @return New valarray with transformed elements.
*/
_Expr<_ValFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(_Tp)) const;
/**
* @brief Apply a function to the array.
*
* Returns a new valarray with elements assigned to the result of
* applying func to the corresponding element of this array. The new
* array has the same size as this one.
*
* @param func Function of const Tp& returning Tp to apply.
* @return New valarray with transformed elements.
*/
_Expr<_RefFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(const _Tp&)) const;
/**
* @brief Resize array.
*
* Resize this array to @a size and set all elements to @a c. All
* references and iterators are invalidated.
*
* @param __size New array size.
* @param __c New value for all elements.
*/
void resize(size_t __size, _Tp __c = _Tp());
private:
size_t _M_size;
_Tp* __restrict__ _M_data;
friend class _Array<_Tp>;
};
#if __cpp_deduction_guides >= 201606
template<typename _Tp, size_t _Nm>
valarray(const _Tp(&)[_Nm], size_t) -> valarray<_Tp>;
#endif
template<typename _Tp>
inline const _Tp&
valarray<_Tp>::operator[](size_t __i) const
{
__glibcxx_requires_subscript(__i);
return _M_data[__i];
}
template<typename _Tp>
inline _Tp&
valarray<_Tp>::operator[](size_t __i)
{
__glibcxx_requires_subscript(__i);
return _M_data[__i];
}
// @} group numeric_arrays
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#include <bits/valarray_after.h>
#include <bits/slice_array.h>
#include <bits/gslice.h>
#include <bits/gslice_array.h>
#include <bits/mask_array.h>
#include <bits/indirect_array.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @addtogroup numeric_arrays
* @{
*/
template<typename _Tp>
inline
valarray<_Tp>::valarray() : _M_size(0), _M_data(0) {}
template<typename _Tp>
inline
valarray<_Tp>::valarray(size_t __n)
: _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
{ std::__valarray_default_construct(_M_data, _M_data + __n); }
template<typename _Tp>
inline
valarray<_Tp>::valarray(const _Tp& __t, size_t __n)
: _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
{ std::__valarray_fill_construct(_M_data, _M_data + __n, __t); }
template<typename _Tp>
inline
valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n)
: _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
{
__glibcxx_assert(__p != 0 || __n == 0);
std::__valarray_copy_construct(__p, __p + __n, _M_data);
}
template<typename _Tp>
inline
valarray<_Tp>::valarray(const valarray<_Tp>& __v)
: _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size))
{ std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
_M_data); }
#if __cplusplus >= 201103L
template<typename _Tp>
inline
valarray<_Tp>::valarray(valarray<_Tp>&& __v) noexcept
: _M_size(__v._M_size), _M_data(__v._M_data)
{
__v._M_size = 0;
__v._M_data = 0;
}
#endif
template<typename _Tp>
inline
valarray<_Tp>::valarray(const slice_array<_Tp>& __sa)
: _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz))
{
std::__valarray_copy_construct
(__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data));
}
template<typename _Tp>
inline
valarray<_Tp>::valarray(const gslice_array<_Tp>& __ga)
: _M_size(__ga._M_index.size()),
_M_data(__valarray_get_storage<_Tp>(_M_size))
{
std::__valarray_copy_construct
(__ga._M_array, _Array<size_t>(__ga._M_index),
_Array<_Tp>(_M_data), _M_size);
}
template<typename _Tp>
inline
valarray<_Tp>::valarray(const mask_array<_Tp>& __ma)
: _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz))
{
std::__valarray_copy_construct
(__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size);
}
template<typename _Tp>
inline
valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia)
: _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz))
{
std::__valarray_copy_construct
(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);
}
#if __cplusplus >= 201103L
template<typename _Tp>
inline
valarray<_Tp>::valarray(initializer_list<_Tp> __l)
: _M_size(__l.size()), _M_data(__valarray_get_storage<_Tp>(__l.size()))
{ std::__valarray_copy_construct(__l.begin(), __l.end(), _M_data); }
#endif
template<typename _Tp> template<class _Dom>
inline
valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e)
: _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size))
{ std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); }
template<typename _Tp>
inline
valarray<_Tp>::~valarray() _GLIBCXX_NOEXCEPT
{
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
std::__valarray_release_memory(_M_data);
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const valarray<_Tp>& __v)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 630. arrays of valarray.
if (_M_size == __v._M_size)
std::__valarray_copy(__v._M_data, _M_size, _M_data);
else
{
if (_M_data)
{
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
std::__valarray_release_memory(_M_data);
}
_M_size = __v._M_size;
_M_data = __valarray_get_storage<_Tp>(_M_size);
std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
_M_data);
}
return *this;
}
#if __cplusplus >= 201103L
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(valarray<_Tp>&& __v) noexcept
{
if (_M_data)
{
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
std::__valarray_release_memory(_M_data);
}
_M_size = __v._M_size;
_M_data = __v._M_data;
__v._M_size = 0;
__v._M_data = 0;
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(initializer_list<_Tp> __l)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 630. arrays of valarray.
if (_M_size == __l.size())
std::__valarray_copy(__l.begin(), __l.size(), _M_data);
else
{
if (_M_data)
{
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
std::__valarray_release_memory(_M_data);
}
_M_size = __l.size();
_M_data = __valarray_get_storage<_Tp>(_M_size);
std::__valarray_copy_construct(__l.begin(), __l.begin() + _M_size,
_M_data);
}
return *this;
}
#endif
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const _Tp& __t)
{
std::__valarray_fill(_M_data, _M_size, __t);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const slice_array<_Tp>& __sa)
{
__glibcxx_assert(_M_size == __sa._M_sz);
std::__valarray_copy(__sa._M_array, __sa._M_sz,
__sa._M_stride, _Array<_Tp>(_M_data));
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga)
{
__glibcxx_assert(_M_size == __ga._M_index.size());
std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index),
_Array<_Tp>(_M_data), _M_size);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const mask_array<_Tp>& __ma)
{
__glibcxx_assert(_M_size == __ma._M_sz);
std::__valarray_copy(__ma._M_array, __ma._M_mask,
_Array<_Tp>(_M_data), _M_size);
return *this;
}
template<typename _Tp>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia)
{
__glibcxx_assert(_M_size == __ia._M_sz);
std::__valarray_copy(__ia._M_array, __ia._M_index,
_Array<_Tp>(_M_data), _M_size);
return *this;
}
template<typename _Tp> template<class _Dom>
inline valarray<_Tp>&
valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 630. arrays of valarray.
if (_M_size == __e.size())
std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data));
else
{
if (_M_data)
{
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
std::__valarray_release_memory(_M_data);
}
_M_size = __e.size();
_M_data = __valarray_get_storage<_Tp>(_M_size);
std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data));
}
return *this;
}
template<typename _Tp>
inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
valarray<_Tp>::operator[](slice __s) const
{
typedef _SClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s));
}
template<typename _Tp>
inline slice_array<_Tp>
valarray<_Tp>::operator[](slice __s)
{ return slice_array<_Tp>(_Array<_Tp>(_M_data), __s); }
template<typename _Tp>
inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
valarray<_Tp>::operator[](const gslice& __gs) const
{
typedef _GClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure, _Tp>
(_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index));
}
template<typename _Tp>
inline gslice_array<_Tp>
valarray<_Tp>::operator[](const gslice& __gs)
{
return gslice_array<_Tp>
(_Array<_Tp>(_M_data), __gs._M_index->_M_index);
}
template<typename _Tp>
inline valarray<_Tp>
valarray<_Tp>::operator[](const valarray<bool>& __m) const
{
size_t __s = 0;
size_t __e = __m.size();
for (size_t __i=0; __i<__e; ++__i)
if (__m[__i]) ++__s;
return valarray<_Tp>(mask_array<_Tp>(_Array<_Tp>(_M_data), __s,
_Array<bool> (__m)));
}
template<typename _Tp>
inline mask_array<_Tp>
valarray<_Tp>::operator[](const valarray<bool>& __m)
{
size_t __s = 0;
size_t __e = __m.size();
for (size_t __i=0; __i<__e; ++__i)
if (__m[__i]) ++__s;
return mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array<bool>(__m));
}
template<typename _Tp>
inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
valarray<_Tp>::operator[](const valarray<size_t>& __i) const
{
typedef _IClos<_ValArray,_Tp> _Closure;
return _Expr<_Closure, _Tp>(_Closure(*this, __i));
}
template<typename _Tp>
inline indirect_array<_Tp>
valarray<_Tp>::operator[](const valarray<size_t>& __i)
{
return indirect_array<_Tp>(_Array<_Tp>(_M_data), __i.size(),
_Array<size_t>(__i));
}
#if __cplusplus >= 201103L
template<class _Tp>
inline void
valarray<_Tp>::swap(valarray<_Tp>& __v) noexcept
{
std::swap(_M_size, __v._M_size);
std::swap(_M_data, __v._M_data);
}
#endif
template<class _Tp>
inline size_t
valarray<_Tp>::size() const
{ return _M_size; }
template<class _Tp>
inline _Tp
valarray<_Tp>::sum() const
{
__glibcxx_assert(_M_size > 0);
return std::__valarray_sum(_M_data, _M_data + _M_size);
}
template<class _Tp>
inline valarray<_Tp>
valarray<_Tp>::shift(int __n) const
{
valarray<_Tp> __ret;
if (_M_size == 0)
return __ret;
_Tp* __restrict__ __tmp_M_data =
std::__valarray_get_storage<_Tp>(_M_size);
if (__n == 0)
std::__valarray_copy_construct(_M_data,
_M_data + _M_size, __tmp_M_data);
else if (__n > 0) // shift left
{
if (size_t(__n) > _M_size)
__n = int(_M_size);
std::__valarray_copy_construct(_M_data + __n,
_M_data + _M_size, __tmp_M_data);
std::__valarray_default_construct(__tmp_M_data + _M_size - __n,
__tmp_M_data + _M_size);
}
else // shift right
{
if (-size_t(__n) > _M_size)
__n = -int(_M_size);
std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
__tmp_M_data - __n);
std::__valarray_default_construct(__tmp_M_data,
__tmp_M_data - __n);
}
__ret._M_size = _M_size;
__ret._M_data = __tmp_M_data;
return __ret;
}
template<class _Tp>
inline valarray<_Tp>
valarray<_Tp>::cshift(int __n) const
{
valarray<_Tp> __ret;
if (_M_size == 0)
return __ret;
_Tp* __restrict__ __tmp_M_data =
std::__valarray_get_storage<_Tp>(_M_size);
if (__n == 0)
std::__valarray_copy_construct(_M_data,
_M_data + _M_size, __tmp_M_data);
else if (__n > 0) // cshift left
{
if (size_t(__n) > _M_size)
__n = int(__n % _M_size);
std::__valarray_copy_construct(_M_data, _M_data + __n,
__tmp_M_data + _M_size - __n);
std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size,
__tmp_M_data);
}
else // cshift right
{
if (-size_t(__n) > _M_size)
__n = -int(-size_t(__n) % _M_size);
std::__valarray_copy_construct(_M_data + _M_size + __n,
_M_data + _M_size, __tmp_M_data);
std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
__tmp_M_data - __n);
}
__ret._M_size = _M_size;
__ret._M_data = __tmp_M_data;
return __ret;
}
template<class _Tp>
inline void
valarray<_Tp>::resize(size_t __n, _Tp __c)
{
// This complication is so to make valarray<valarray<T> > work
// even though it is not required by the standard. Nobody should
// be saying valarray<valarray<T> > anyway. See the specs.
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
if (_M_size != __n)
{
std::__valarray_release_memory(_M_data);
_M_size = __n;
_M_data = __valarray_get_storage<_Tp>(__n);
}
std::__valarray_fill_construct(_M_data, _M_data + __n, __c);
}
template<typename _Tp>
inline _Tp
valarray<_Tp>::min() const
{
__glibcxx_assert(_M_size > 0);
return *std::min_element(_M_data, _M_data + _M_size);
}
template<typename _Tp>
inline _Tp
valarray<_Tp>::max() const
{
__glibcxx_assert(_M_size > 0);
return *std::max_element(_M_data, _M_data + _M_size);
}
template<class _Tp>
inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>
valarray<_Tp>::apply(_Tp func(_Tp)) const
{
typedef _ValFunClos<_ValArray, _Tp> _Closure;
return _Expr<_Closure, _Tp>(_Closure(*this, func));
}
template<class _Tp>
inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>
valarray<_Tp>::apply(_Tp func(const _Tp &)) const
{
typedef _RefFunClos<_ValArray, _Tp> _Closure;
return _Expr<_Closure, _Tp>(_Closure(*this, func));
}
#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
template<typename _Tp> \
inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \
valarray<_Tp>::operator _Op() const \
{ \
typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \
typedef typename __fun<_Name, _Tp>::result_type _Rt; \
return _Expr<_Closure, _Rt>(_Closure(*this)); \
}
_DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus)
_DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate)
_DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not)
_DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not)
#undef _DEFINE_VALARRAY_UNARY_OPERATOR
#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
template<class _Tp> \
inline valarray<_Tp>& \
valarray<_Tp>::operator _Op##=(const _Tp &__t) \
{ \
_Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \
return *this; \
} \
\
template<class _Tp> \
inline valarray<_Tp>& \
valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \
{ \
__glibcxx_assert(_M_size == __v._M_size); \
_Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \
_Array<_Tp>(__v._M_data)); \
return *this; \
}
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left)
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right)
#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
template<class _Tp> template<class _Dom> \
inline valarray<_Tp>& \
valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \
{ \
_Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \
return *this; \
}
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left)
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right)
#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
template<typename _Tp> \
inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \
typename __fun<_Name, _Tp>::result_type> \
operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
{ \
__glibcxx_assert(__v.size() == __w.size()); \
typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \
typedef typename __fun<_Name, _Tp>::result_type _Rt; \
return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \
} \
\
template<typename _Tp> \
inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \
typename __fun<_Name, _Tp>::result_type> \
operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \
{ \
typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \
typedef typename __fun<_Name, _Tp>::result_type _Rt; \
return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \
} \
\
template<typename _Tp> \
inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \
typename __fun<_Name, _Tp>::result_type> \
operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \
{ \
typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \
typedef typename __fun<_Name, _Tp>::result_type _Rt; \
return _Expr<_Closure, _Rt>(_Closure(__t, __v)); \
}
_DEFINE_BINARY_OPERATOR(+, __plus)
_DEFINE_BINARY_OPERATOR(-, __minus)
_DEFINE_BINARY_OPERATOR(*, __multiplies)
_DEFINE_BINARY_OPERATOR(/, __divides)
_DEFINE_BINARY_OPERATOR(%, __modulus)
_DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
_DEFINE_BINARY_OPERATOR(&, __bitwise_and)
_DEFINE_BINARY_OPERATOR(|, __bitwise_or)
_DEFINE_BINARY_OPERATOR(<<, __shift_left)
_DEFINE_BINARY_OPERATOR(>>, __shift_right)
_DEFINE_BINARY_OPERATOR(&&, __logical_and)
_DEFINE_BINARY_OPERATOR(||, __logical_or)
_DEFINE_BINARY_OPERATOR(==, __equal_to)
_DEFINE_BINARY_OPERATOR(!=, __not_equal_to)
_DEFINE_BINARY_OPERATOR(<, __less)
_DEFINE_BINARY_OPERATOR(>, __greater)
_DEFINE_BINARY_OPERATOR(<=, __less_equal)
_DEFINE_BINARY_OPERATOR(>=, __greater_equal)
#undef _DEFINE_BINARY_OPERATOR
#if __cplusplus >= 201103L
/**
* @brief Return an iterator pointing to the first element of
* the valarray.
* @param __va valarray.
*/
template<class _Tp>
inline _Tp*
begin(valarray<_Tp>& __va)
{ return std::__addressof(__va[0]); }
/**
* @brief Return an iterator pointing to the first element of
* the const valarray.
* @param __va valarray.
*/
template<class _Tp>
inline const _Tp*
begin(const valarray<_Tp>& __va)
{ return std::__addressof(__va[0]); }
/**
* @brief Return an iterator pointing to one past the last element of
* the valarray.
* @param __va valarray.
*/
template<class _Tp>
inline _Tp*
end(valarray<_Tp>& __va)
{ return std::__addressof(__va[0]) + __va.size(); }
/**
* @brief Return an iterator pointing to one past the last element of
* the const valarray.
* @param __va valarray.
*/
template<class _Tp>
inline const _Tp*
end(const valarray<_Tp>& __va)
{ return std::__addressof(__va[0]) + __va.size(); }
#endif // C++11
// @} group numeric_arrays
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _GLIBCXX_VALARRAY */
// <mutex> -*- C++ -*-
// Copyright (C) 2003-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/mutex
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_MUTEX
#define _GLIBCXX_MUTEX 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <tuple>
#include <chrono>
#include <exception>
#include <type_traits>
#include <system_error>
#include <bits/std_mutex.h>
#if ! _GTHREAD_USE_MUTEX_TIMEDLOCK
# include <condition_variable>
# include <thread>
#endif
#ifndef _GLIBCXX_HAVE_TLS
# include <bits/std_function.h>
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @ingroup mutexes
* @{
*/
#ifdef _GLIBCXX_HAS_GTHREADS
// Common base class for std::recursive_mutex and std::recursive_timed_mutex
class __recursive_mutex_base
{
protected:
typedef __gthread_recursive_mutex_t __native_type;
__recursive_mutex_base(const __recursive_mutex_base&) = delete;
__recursive_mutex_base& operator=(const __recursive_mutex_base&) = delete;
#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
__native_type _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
__recursive_mutex_base() = default;
#else
__native_type _M_mutex;
__recursive_mutex_base()
{
// XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
}
~__recursive_mutex_base()
{ __gthread_recursive_mutex_destroy(&_M_mutex); }
#endif
};
/// The standard recursive mutex type.
class recursive_mutex : private __recursive_mutex_base
{
public:
typedef __native_type* native_handle_type;
recursive_mutex() = default;
~recursive_mutex() = default;
recursive_mutex(const recursive_mutex&) = delete;
recursive_mutex& operator=(const recursive_mutex&) = delete;
void
lock()
{
int __e = __gthread_recursive_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
if (__e)
__throw_system_error(__e);
}
bool
try_lock() noexcept
{
// XXX EINVAL, EAGAIN, EBUSY
return !__gthread_recursive_mutex_trylock(&_M_mutex);
}
void
unlock()
{
// XXX EINVAL, EAGAIN, EBUSY
__gthread_recursive_mutex_unlock(&_M_mutex);
}
native_handle_type
native_handle() noexcept
{ return &_M_mutex; }
};
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
template<typename _Derived>
class __timed_mutex_impl
{
protected:
typedef chrono::high_resolution_clock __clock_t;
template<typename _Rep, typename _Period>
bool
_M_try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
{
using chrono::steady_clock;
auto __rt = chrono::duration_cast<steady_clock::duration>(__rtime);
if (ratio_greater<steady_clock::period, _Period>())
++__rt;
return _M_try_lock_until(steady_clock::now() + __rt);
}
template<typename _Duration>
bool
_M_try_lock_until(const chrono::time_point<__clock_t,
_Duration>& __atime)
{
auto __s = chrono::time_point_cast<chrono::seconds>(__atime);
auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
__gthread_time_t __ts = {
static_cast<std::time_t>(__s.time_since_epoch().count()),
static_cast<long>(__ns.count())
};
return static_cast<_Derived*>(this)->_M_timedlock(__ts);
}
template<typename _Clock, typename _Duration>
bool
_M_try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
{
auto __rtime = __atime - _Clock::now();
return _M_try_lock_until(__clock_t::now() + __rtime);
}
};
/// The standard timed mutex type.
class timed_mutex
: private __mutex_base, public __timed_mutex_impl<timed_mutex>
{
public:
typedef __native_type* native_handle_type;
timed_mutex() = default;
~timed_mutex() = default;
timed_mutex(const timed_mutex&) = delete;
timed_mutex& operator=(const timed_mutex&) = delete;
void
lock()
{
int __e = __gthread_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
if (__e)
__throw_system_error(__e);
}
bool
try_lock() noexcept
{
// XXX EINVAL, EAGAIN, EBUSY
return !__gthread_mutex_trylock(&_M_mutex);
}
template <class _Rep, class _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
{ return _M_try_lock_for(__rtime); }
template <class _Clock, class _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
{ return _M_try_lock_until(__atime); }
void
unlock()
{
// XXX EINVAL, EAGAIN, EBUSY
__gthread_mutex_unlock(&_M_mutex);
}
native_handle_type
native_handle() noexcept
{ return &_M_mutex; }
private:
friend class __timed_mutex_impl<timed_mutex>;
bool
_M_timedlock(const __gthread_time_t& __ts)
{ return !__gthread_mutex_timedlock(&_M_mutex, &__ts); }
};
/// recursive_timed_mutex
class recursive_timed_mutex
: private __recursive_mutex_base,
public __timed_mutex_impl<recursive_timed_mutex>
{
public:
typedef __native_type* native_handle_type;
recursive_timed_mutex() = default;
~recursive_timed_mutex() = default;
recursive_timed_mutex(const recursive_timed_mutex&) = delete;
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void
lock()
{
int __e = __gthread_recursive_mutex_lock(&_M_mutex);
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
if (__e)
__throw_system_error(__e);
}
bool
try_lock() noexcept
{
// XXX EINVAL, EAGAIN, EBUSY
return !__gthread_recursive_mutex_trylock(&_M_mutex);
}
template <class _Rep, class _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
{ return _M_try_lock_for(__rtime); }
template <class _Clock, class _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
{ return _M_try_lock_until(__atime); }
void
unlock()
{
// XXX EINVAL, EAGAIN, EBUSY
__gthread_recursive_mutex_unlock(&_M_mutex);
}
native_handle_type
native_handle() noexcept
{ return &_M_mutex; }
private:
friend class __timed_mutex_impl<recursive_timed_mutex>;
bool
_M_timedlock(const __gthread_time_t& __ts)
{ return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts); }
};
#else // !_GTHREAD_USE_MUTEX_TIMEDLOCK
/// timed_mutex
class timed_mutex
{
mutex _M_mut;
condition_variable _M_cv;
bool _M_locked = false;
public:
timed_mutex() = default;
~timed_mutex() { __glibcxx_assert( !_M_locked ); }
timed_mutex(const timed_mutex&) = delete;
timed_mutex& operator=(const timed_mutex&) = delete;
void
lock()
{
unique_lock<mutex> __lk(_M_mut);
_M_cv.wait(__lk, [&]{ return !_M_locked; });
_M_locked = true;
}
bool
try_lock()
{
lock_guard<mutex> __lk(_M_mut);
if (_M_locked)
return false;
_M_locked = true;
return true;
}
template<typename _Rep, typename _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
{
unique_lock<mutex> __lk(_M_mut);
if (!_M_cv.wait_for(__lk, __rtime, [&]{ return !_M_locked; }))
return false;
_M_locked = true;
return true;
}
template<typename _Clock, typename _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
{
unique_lock<mutex> __lk(_M_mut);
if (!_M_cv.wait_until(__lk, __atime, [&]{ return !_M_locked; }))
return false;
_M_locked = true;
return true;
}
void
unlock()
{
lock_guard<mutex> __lk(_M_mut);
__glibcxx_assert( _M_locked );
_M_locked = false;
_M_cv.notify_one();
}
};
/// recursive_timed_mutex
class recursive_timed_mutex
{
mutex _M_mut;
condition_variable _M_cv;
thread::id _M_owner;
unsigned _M_count = 0;
// Predicate type that tests whether the current thread can lock a mutex.
struct _Can_lock
{
// Returns true if the mutex is unlocked or is locked by _M_caller.
bool
operator()() const noexcept
{ return _M_mx->_M_count == 0 || _M_mx->_M_owner == _M_caller; }
const recursive_timed_mutex* _M_mx;
thread::id _M_caller;
};
public:
recursive_timed_mutex() = default;
~recursive_timed_mutex() { __glibcxx_assert( _M_count == 0 ); }
recursive_timed_mutex(const recursive_timed_mutex&) = delete;
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void
lock()
{
auto __id = this_thread::get_id();
_Can_lock __can_lock{this, __id};
unique_lock<mutex> __lk(_M_mut);
_M_cv.wait(__lk, __can_lock);
if (_M_count == -1u)
__throw_system_error(EAGAIN); // [thread.timedmutex.recursive]/3
_M_owner = __id;
++_M_count;
}
bool
try_lock()
{
auto __id = this_thread::get_id();
_Can_lock __can_lock{this, __id};
lock_guard<mutex> __lk(_M_mut);
if (!__can_lock())
return false;
if (_M_count == -1u)
return false;
_M_owner = __id;
++_M_count;
return true;
}
template<typename _Rep, typename _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
{
auto __id = this_thread::get_id();
_Can_lock __can_lock{this, __id};
unique_lock<mutex> __lk(_M_mut);
if (!_M_cv.wait_for(__lk, __rtime, __can_lock))
return false;
if (_M_count == -1u)
return false;
_M_owner = __id;
++_M_count;
return true;
}
template<typename _Clock, typename _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
{
auto __id = this_thread::get_id();
_Can_lock __can_lock{this, __id};
unique_lock<mutex> __lk(_M_mut);
if (!_M_cv.wait_until(__lk, __atime, __can_lock))
return false;
if (_M_count == -1u)
return false;
_M_owner = __id;
++_M_count;
return true;
}
void
unlock()
{
lock_guard<mutex> __lk(_M_mut);
__glibcxx_assert( _M_owner == this_thread::get_id() );
__glibcxx_assert( _M_count > 0 );
if (--_M_count == 0)
{
_M_owner = {};
_M_cv.notify_one();
}
}
};
#endif
#endif // _GLIBCXX_HAS_GTHREADS
template<typename _Lock>
inline unique_lock<_Lock>
__try_to_lock(_Lock& __l)
{ return unique_lock<_Lock>{__l, try_to_lock}; }
template<int _Idx, bool _Continue = true>
struct __try_lock_impl
{
template<typename... _Lock>
static void
__do_try_lock(tuple<_Lock&...>& __locks, int& __idx)
{
__idx = _Idx;
auto __lock = std::__try_to_lock(std::get<_Idx>(__locks));
if (__lock.owns_lock())
{
constexpr bool __cont = _Idx + 2 < sizeof...(_Lock);
using __try_locker = __try_lock_impl<_Idx + 1, __cont>;
__try_locker::__do_try_lock(__locks, __idx);
if (__idx == -1)
__lock.release();
}
}
};
template<int _Idx>
struct __try_lock_impl<_Idx, false>
{
template<typename... _Lock>
static void
__do_try_lock(tuple<_Lock&...>& __locks, int& __idx)
{
__idx = _Idx;
auto __lock = std::__try_to_lock(std::get<_Idx>(__locks));
if (__lock.owns_lock())
{
__idx = -1;
__lock.release();
}
}
};
/** @brief Generic try_lock.
* @param __l1 Meets Lockable requirements (try_lock() may throw).
* @param __l2 Meets Lockable requirements (try_lock() may throw).
* @param __l3 Meets Lockable requirements (try_lock() may throw).
* @return Returns -1 if all try_lock() calls return true. Otherwise returns
* a 0-based index corresponding to the argument that returned false.
* @post Either all arguments are locked, or none will be.
*
* Sequentially calls try_lock() on each argument.
*/
template<typename _Lock1, typename _Lock2, typename... _Lock3>
int
try_lock(_Lock1& __l1, _Lock2& __l2, _Lock3&... __l3)
{
int __idx;
auto __locks = std::tie(__l1, __l2, __l3...);
__try_lock_impl<0>::__do_try_lock(__locks, __idx);
return __idx;
}
/** @brief Generic lock.
* @param __l1 Meets Lockable requirements (try_lock() may throw).
* @param __l2 Meets Lockable requirements (try_lock() may throw).
* @param __l3 Meets Lockable requirements (try_lock() may throw).
* @throw An exception thrown by an argument's lock() or try_lock() member.
* @post All arguments are locked.
*
* All arguments are locked via a sequence of calls to lock(), try_lock()
* and unlock(). If the call exits via an exception any locks that were
* obtained will be released.
*/
template<typename _L1, typename _L2, typename... _L3>
void
lock(_L1& __l1, _L2& __l2, _L3&... __l3)
{
while (true)
{
using __try_locker = __try_lock_impl<0, sizeof...(_L3) != 0>;
unique_lock<_L1> __first(__l1);
int __idx;
auto __locks = std::tie(__l2, __l3...);
__try_locker::__do_try_lock(__locks, __idx);
if (__idx == -1)
{
__first.release();
return;
}
}
}
#if __cplusplus >= 201703L
#define __cpp_lib_scoped_lock 201703
/** @brief A scoped lock type for multiple lockable objects.
*
* A scoped_lock controls mutex ownership within a scope, releasing
* ownership in the destructor.
*/
template<typename... _MutexTypes>
class scoped_lock
{
public:
explicit scoped_lock(_MutexTypes&... __m) : _M_devices(std::tie(__m...))
{ std::lock(__m...); }
explicit scoped_lock(adopt_lock_t, _MutexTypes&... __m) noexcept
: _M_devices(std::tie(__m...))
{ } // calling thread owns mutex
~scoped_lock()
{
std::apply([](_MutexTypes&... __m) {
char __i[] __attribute__((__unused__)) = { (__m.unlock(), 0)... };
}, _M_devices);
}
scoped_lock(const scoped_lock&) = delete;
scoped_lock& operator=(const scoped_lock&) = delete;
private:
tuple<_MutexTypes&...> _M_devices;
};
template<>
class scoped_lock<>
{
public:
explicit scoped_lock() = default;
explicit scoped_lock(adopt_lock_t) noexcept { }
~scoped_lock() = default;
scoped_lock(const scoped_lock&) = delete;
scoped_lock& operator=(const scoped_lock&) = delete;
};
template<typename _Mutex>
class scoped_lock<_Mutex>
{
public:
using mutex_type = _Mutex;
explicit scoped_lock(mutex_type& __m) : _M_device(__m)
{ _M_device.lock(); }
explicit scoped_lock(adopt_lock_t, mutex_type& __m) noexcept
: _M_device(__m)
{ } // calling thread owns mutex
~scoped_lock()
{ _M_device.unlock(); }
scoped_lock(const scoped_lock&) = delete;
scoped_lock& operator=(const scoped_lock&) = delete;
private:
mutex_type& _M_device;
};
#endif // C++17
#ifdef _GLIBCXX_HAS_GTHREADS
/// once_flag
struct once_flag
{
private:
typedef __gthread_once_t __native_type;
__native_type _M_once = __GTHREAD_ONCE_INIT;
public:
/// Constructor
constexpr once_flag() noexcept = default;
/// Deleted copy constructor
once_flag(const once_flag&) = delete;
/// Deleted assignment operator
once_flag& operator=(const once_flag&) = delete;
template<typename _Callable, typename... _Args>
friend void
call_once(once_flag& __once, _Callable&& __f, _Args&&... __args);
};
#ifdef _GLIBCXX_HAVE_TLS
extern __thread void* __once_callable;
extern __thread void (*__once_call)();
#else
extern function<void()> __once_functor;
extern void
__set_once_functor_lock_ptr(unique_lock<mutex>*);
extern mutex&
__get_once_mutex();
#endif
extern "C" void __once_proxy(void);
/// call_once
template<typename _Callable, typename... _Args>
void
call_once(once_flag& __once, _Callable&& __f, _Args&&... __args)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2442. call_once() shouldn't DECAY_COPY()
auto __callable = [&] {
std::__invoke(std::forward<_Callable>(__f),
std::forward<_Args>(__args)...);
};
#ifdef _GLIBCXX_HAVE_TLS
__once_callable = std::__addressof(__callable); // NOLINT: PR 82481
__once_call = []{ (*(decltype(__callable)*)__once_callable)(); };
#else
unique_lock<mutex> __functor_lock(__get_once_mutex());
__once_functor = __callable;
__set_once_functor_lock_ptr(&__functor_lock);
#endif
int __e = __gthread_once(&__once._M_once, &__once_proxy);
#ifndef _GLIBCXX_HAVE_TLS
if (__functor_lock)
__set_once_functor_lock_ptr(0);
#endif
if (__e)
__throw_system_error(__e);
}
#endif // _GLIBCXX_HAS_GTHREADS
// @} group mutexes
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // C++11
#endif // _GLIBCXX_MUTEX
// Standard stream manipulators -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/iomanip
* This is a Standard C++ Library header.
*/
//
// ISO C++ 14882: 27.6.3 Standard manipulators
//
#ifndef _GLIBCXX_IOMANIP
#define _GLIBCXX_IOMANIP 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <iosfwd>
#include <bits/ios_base.h>
#if __cplusplus >= 201103L
#include <locale>
#if __cplusplus > 201103L
#include <bits/quoted_string.h>
#endif
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// [27.6.3] standard manipulators
// Also see DR 183.
struct _Resetiosflags { ios_base::fmtflags _M_mask; };
/**
* @brief Manipulator for @c setf.
* @param __mask A format flags mask.
*
* Sent to a stream object, this manipulator resets the specified flags,
* via @e stream.setf(0,__mask).
*/
inline _Resetiosflags
resetiosflags(ios_base::fmtflags __mask)
{ return { __mask }; }
template<typename _CharT, typename _Traits>
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
{
__is.setf(ios_base::fmtflags(0), __f._M_mask);
return __is;
}
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
{
__os.setf(ios_base::fmtflags(0), __f._M_mask);
return __os;
}
struct _Setiosflags { ios_base::fmtflags _M_mask; };
/**
* @brief Manipulator for @c setf.
* @param __mask A format flags mask.
*
* Sent to a stream object, this manipulator sets the format flags
* to @a __mask.
*/
inline _Setiosflags
setiosflags(ios_base::fmtflags __mask)
{ return { __mask }; }
template<typename _CharT, typename _Traits>
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
{
__is.setf(__f._M_mask);
return __is;
}
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
{
__os.setf(__f._M_mask);
return __os;
}
struct _Setbase { int _M_base; };
/**
* @brief Manipulator for @c setf.
* @param __base A numeric base.
*
* Sent to a stream object, this manipulator changes the
* @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base
* is 8, 10, or 16, accordingly, and to 0 if @a __base is any other value.
*/
inline _Setbase
setbase(int __base)
{ return { __base }; }
template<typename _CharT, typename _Traits>
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
{
__is.setf(__f._M_base == 8 ? ios_base::oct :
__f._M_base == 10 ? ios_base::dec :
__f._M_base == 16 ? ios_base::hex :
ios_base::fmtflags(0), ios_base::basefield);
return __is;
}
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
{
__os.setf(__f._M_base == 8 ? ios_base::oct :
__f._M_base == 10 ? ios_base::dec :
__f._M_base == 16 ? ios_base::hex :
ios_base::fmtflags(0), ios_base::basefield);
return __os;
}
template<typename _CharT>
struct _Setfill { _CharT _M_c; };
/**
* @brief Manipulator for @c fill.
* @param __c The new fill character.
*
* Sent to a stream object, this manipulator calls @c fill(__c) for that
* object.
*/
template<typename _CharT>
inline _Setfill<_CharT>
setfill(_CharT __c)
{ return { __c }; }
template<typename _CharT, typename _Traits>
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
{
__is.fill(__f._M_c);
return __is;
}
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
{
__os.fill(__f._M_c);
return __os;
}
struct _Setprecision { int _M_n; };
/**
* @brief Manipulator for @c precision.
* @param __n The new precision.
*
* Sent to a stream object, this manipulator calls @c precision(__n) for
* that object.
*/
inline _Setprecision
setprecision(int __n)
{ return { __n }; }
template<typename _CharT, typename _Traits>
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
{
__is.precision(__f._M_n);
return __is;
}
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
{
__os.precision(__f._M_n);
return __os;
}
struct _Setw { int _M_n; };
/**
* @brief Manipulator for @c width.
* @param __n The new width.
*
* Sent to a stream object, this manipulator calls @c width(__n) for
* that object.
*/
inline _Setw
setw(int __n)
{ return { __n }; }
template<typename _CharT, typename _Traits>
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
{
__is.width(__f._M_n);
return __is;
}
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
{
__os.width(__f._M_n);
return __os;
}
#if __cplusplus >= 201103L
template<typename _MoneyT>
struct _Get_money { _MoneyT& _M_mon; bool _M_intl; };
/**
* @brief Extended manipulator for extracting money.
* @param __mon Either long double or a specialization of @c basic_string.
* @param __intl A bool indicating whether international format
* is to be used.
*
* Sent to a stream object, this manipulator extracts @a __mon.
*/
template<typename _MoneyT>
inline _Get_money<_MoneyT>
get_money(_MoneyT& __mon, bool __intl = false)
{ return { __mon, __intl }; }
template<typename _CharT, typename _Traits, typename _MoneyT>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
{
typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false);
if (__cerb)
{
ios_base::iostate __err = ios_base::goodbit;
__try
{
typedef istreambuf_iterator<_CharT, _Traits> _Iter;
typedef money_get<_CharT, _Iter> _MoneyGet;
const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
__mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
__is, __err, __f._M_mon);
}
__catch(__cxxabiv1::__forced_unwind&)
{
__is._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{ __is._M_setstate(ios_base::badbit); }
if (__err)
__is.setstate(__err);
}
return __is;
}
template<typename _MoneyT>
struct _Put_money { const _MoneyT& _M_mon; bool _M_intl; };
/**
* @brief Extended manipulator for inserting money.
* @param __mon Either long double or a specialization of @c basic_string.
* @param __intl A bool indicating whether international format
* is to be used.
*
* Sent to a stream object, this manipulator inserts @a __mon.
*/
template<typename _MoneyT>
inline _Put_money<_MoneyT>
put_money(const _MoneyT& __mon, bool __intl = false)
{ return { __mon, __intl }; }
template<typename _CharT, typename _Traits, typename _MoneyT>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
{
typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
if (__cerb)
{
ios_base::iostate __err = ios_base::goodbit;
__try
{
typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
typedef money_put<_CharT, _Iter> _MoneyPut;
const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
if (__mp.put(_Iter(__os.rdbuf()), __f._M_intl, __os,
__os.fill(), __f._M_mon).failed())
__err |= ios_base::badbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__os._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{ __os._M_setstate(ios_base::badbit); }
if (__err)
__os.setstate(__err);
}
return __os;
}
template<typename _CharT>
struct _Put_time
{
const std::tm* _M_tmb;
const _CharT* _M_fmt;
};
/**
* @brief Extended manipulator for formatting time.
*
* This manipulator uses time_put::put to format time.
* [ext.manip]
*
* @param __tmb struct tm time data to format.
* @param __fmt format string.
*/
template<typename _CharT>
inline _Put_time<_CharT>
put_time(const std::tm* __tmb, const _CharT* __fmt)
{ return { __tmb, __fmt }; }
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_time<_CharT> __f)
{
typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
if (__cerb)
{
ios_base::iostate __err = ios_base::goodbit;
__try
{
typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
typedef time_put<_CharT, _Iter> _TimePut;
const _CharT* const __fmt_end = __f._M_fmt +
_Traits::length(__f._M_fmt);
const _TimePut& __mp = use_facet<_TimePut>(__os.getloc());
if (__mp.put(_Iter(__os.rdbuf()), __os, __os.fill(),
__f._M_tmb, __f._M_fmt, __fmt_end).failed())
__err |= ios_base::badbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__os._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{ __os._M_setstate(ios_base::badbit); }
if (__err)
__os.setstate(__err);
}
return __os;
}
template<typename _CharT>
struct _Get_time
{
std::tm* _M_tmb;
const _CharT* _M_fmt;
};
/**
* @brief Extended manipulator for extracting time.
*
* This manipulator uses time_get::get to extract time.
* [ext.manip]
*
* @param __tmb struct to extract the time data to.
* @param __fmt format string.
*/
template<typename _CharT>
inline _Get_time<_CharT>
get_time(std::tm* __tmb, const _CharT* __fmt)
{ return { __tmb, __fmt }; }
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Get_time<_CharT> __f)
{
typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false);
if (__cerb)
{
ios_base::iostate __err = ios_base::goodbit;
__try
{
typedef istreambuf_iterator<_CharT, _Traits> _Iter;
typedef time_get<_CharT, _Iter> _TimeGet;
const _CharT* const __fmt_end = __f._M_fmt +
_Traits::length(__f._M_fmt);
const _TimeGet& __mg = use_facet<_TimeGet>(__is.getloc());
__mg.get(_Iter(__is.rdbuf()), _Iter(), __is,
__err, __f._M_tmb, __f._M_fmt, __fmt_end);
}
__catch(__cxxabiv1::__forced_unwind&)
{
__is._M_setstate(ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{ __is._M_setstate(ios_base::badbit); }
if (__err)
__is.setstate(__err);
}
return __is;
}
#if __cplusplus >= 201402L
#define __cpp_lib_quoted_string_io 201304
/**
* @brief Manipulator for quoted strings.
* @param __string String to quote.
* @param __delim Character to quote string with.
* @param __escape Escape character to escape itself or quote character.
*/
template<typename _CharT>
inline auto
quoted(const _CharT* __string,
_CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
{
return __detail::_Quoted_string<const _CharT*, _CharT>(__string, __delim,
__escape);
}
template<typename _CharT, typename _Traits, typename _Alloc>
inline auto
quoted(const basic_string<_CharT, _Traits, _Alloc>& __string,
_CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
{
return __detail::_Quoted_string<
const basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
__string, __delim, __escape);
}
template<typename _CharT, typename _Traits, typename _Alloc>
inline auto
quoted(basic_string<_CharT, _Traits, _Alloc>& __string,
_CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
{
return __detail::_Quoted_string<
basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
__string, __delim, __escape);
}
#if __cplusplus >= 201703L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2785. quoted should work with basic_string_view
template<typename _CharT, typename _Traits>
inline auto
quoted(basic_string_view<_CharT, _Traits> __sv,
_CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
{
return __detail::_Quoted_string<
basic_string_view<_CharT, _Traits>, _CharT>(__sv, __delim, __escape);
}
#endif // C++17
#endif // C++14
#endif // __cplusplus >= 201103L
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template ostream& operator<<(ostream&, _Setfill<char>);
extern template ostream& operator<<(ostream&, _Setiosflags);
extern template ostream& operator<<(ostream&, _Resetiosflags);
extern template ostream& operator<<(ostream&, _Setbase);
extern template ostream& operator<<(ostream&, _Setprecision);
extern template ostream& operator<<(ostream&, _Setw);
extern template istream& operator>>(istream&, _Setfill<char>);
extern template istream& operator>>(istream&, _Setiosflags);
extern template istream& operator>>(istream&, _Resetiosflags);
extern template istream& operator>>(istream&, _Setbase);
extern template istream& operator>>(istream&, _Setprecision);
extern template istream& operator>>(istream&, _Setw);
#ifdef _GLIBCXX_USE_WCHAR_T
extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
extern template wostream& operator<<(wostream&, _Setiosflags);
extern template wostream& operator<<(wostream&, _Resetiosflags);
extern template wostream& operator<<(wostream&, _Setbase);
extern template wostream& operator<<(wostream&, _Setprecision);
extern template wostream& operator<<(wostream&, _Setw);
extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
extern template wistream& operator>>(wistream&, _Setiosflags);
extern template wistream& operator>>(wistream&, _Resetiosflags);
extern template wistream& operator>>(wistream&, _Setbase);
extern template wistream& operator>>(wistream&, _Setprecision);
extern template wistream& operator>>(wistream&, _Setw);
#endif
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _GLIBCXX_IOMANIP */
// <codecvt> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// ISO C++ 14882: 22.5 Standard code conversion facets
/** @file include/codecvt
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_CODECVT
#define _GLIBCXX_CODECVT 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <bits/locale_classes.h>
#include <bits/codecvt.h>
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
enum codecvt_mode
{
consume_header = 4,
generate_header = 2,
little_endian = 1
};
template<typename _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class codecvt_utf8 : public codecvt<_Elem, char, mbstate_t>
{
public:
explicit
codecvt_utf8(size_t __refs = 0);
~codecvt_utf8();
};
template<typename _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class codecvt_utf16 : public codecvt<_Elem, char, mbstate_t>
{
public:
explicit
codecvt_utf16(size_t __refs = 0);
~codecvt_utf16();
};
template<typename _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class codecvt_utf8_utf16 : public codecvt<_Elem, char, mbstate_t>
{
public:
explicit
codecvt_utf8_utf16(size_t __refs = 0);
~codecvt_utf8_utf16();
};
#define _GLIBCXX_CODECVT_SPECIALIZATION2(_NAME, _ELEM) \
template<> \
class _NAME<_ELEM> \
: public codecvt<_ELEM, char, mbstate_t> \
{ \
public: \
typedef _ELEM intern_type; \
typedef char extern_type; \
typedef mbstate_t state_type; \
\
protected: \
_NAME(unsigned long __maxcode, codecvt_mode __mode, size_t __refs) \
: codecvt(__refs), _M_maxcode(__maxcode), _M_mode(__mode) { } \
\
virtual \
~_NAME(); \
\
virtual result \
do_out(state_type& __state, const intern_type* __from, \
const intern_type* __from_end, const intern_type*& __from_next, \
extern_type* __to, extern_type* __to_end, \
extern_type*& __to_next) const; \
\
virtual result \
do_unshift(state_type& __state, \
extern_type* __to, extern_type* __to_end, \
extern_type*& __to_next) const; \
\
virtual result \
do_in(state_type& __state, \
const extern_type* __from, const extern_type* __from_end, \
const extern_type*& __from_next, \
intern_type* __to, intern_type* __to_end, \
intern_type*& __to_next) const; \
\
virtual \
int do_encoding() const throw(); \
\
virtual \
bool do_always_noconv() const throw(); \
\
virtual \
int do_length(state_type&, const extern_type* __from, \
const extern_type* __end, size_t __max) const; \
\
virtual int \
do_max_length() const throw(); \
\
private: \
unsigned long _M_maxcode; \
codecvt_mode _M_mode; \
}
#define _GLIBCXX_CODECVT_SPECIALIZATION(_NAME, _ELEM) \
_GLIBCXX_CODECVT_SPECIALIZATION2(__ ## _NAME ## _base, _ELEM); \
template<unsigned long _Maxcode, codecvt_mode _Mode> \
class _NAME<_ELEM, _Maxcode, _Mode> \
: public __ ## _NAME ## _base<_ELEM> \
{ \
public: \
explicit \
_NAME(size_t __refs = 0) \
: __ ## _NAME ## _base<_ELEM>(std::min(_Maxcode, 0x10fffful), \
_Mode, __refs) \
{ } \
}
template<typename _Elem> class __codecvt_utf8_base;
template<typename _Elem> class __codecvt_utf16_base;
template<typename _Elem> class __codecvt_utf8_utf16_base;
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, char16_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, char16_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, char16_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, char32_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, char32_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, char32_t);
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, wchar_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, wchar_t);
_GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, wchar_t);
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif
#endif /* _GLIBCXX_CODECVT */
// C++11 <typeindex> -*- C++ -*-
// Copyright (C) 2010-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/typeindex
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_TYPEINDEX
#define _GLIBCXX_TYPEINDEX 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <typeinfo>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Class type_index
* @ingroup utilities
*
* The class type_index provides a simple wrapper for type_info
* which can be used as an index type in associative containers
* (23.6) and in unordered associative containers (23.7).
*/
struct type_index
{
type_index(const type_info& __rhs) noexcept
: _M_target(&__rhs) { }
bool
operator==(const type_index& __rhs) const noexcept
{ return *_M_target == *__rhs._M_target; }
bool
operator!=(const type_index& __rhs) const noexcept
{ return *_M_target != *__rhs._M_target; }
bool
operator<(const type_index& __rhs) const noexcept
{ return _M_target->before(*__rhs._M_target); }
bool
operator<=(const type_index& __rhs) const noexcept
{ return !__rhs._M_target->before(*_M_target); }
bool
operator>(const type_index& __rhs) const noexcept
{ return __rhs._M_target->before(*_M_target); }
bool
operator>=(const type_index& __rhs) const noexcept
{ return !_M_target->before(*__rhs._M_target); }
size_t
hash_code() const noexcept
{ return _M_target->hash_code(); }
const char*
name() const noexcept
{ return _M_target->name(); }
private:
const type_info* _M_target;
};
template<typename _Tp> struct hash;
/// std::hash specialization for type_index.
template<>
struct hash<type_index>
{
typedef size_t result_type;
typedef type_index argument_type;
size_t
operator()(const type_index& __ti) const noexcept
{ return __ti.hash_code(); }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_TYPEINDEX
// The template and inlines for the -*- C++ -*- complex number classes.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/complex
* This is a Standard C++ Library header.
*/
//
// ISO C++ 14882: 26.2 Complex Numbers
// Note: this is not a conforming implementation.
// Initially implemented by Ulrich Drepper <drepper@cygnus.com>
// Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
//
#ifndef _GLIBCXX_COMPLEX
#define _GLIBCXX_COMPLEX 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
#include <cmath>
#include <sstream>
// Get rid of a macro possibly defined in <complex.h>
#undef complex
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup complex_numbers Complex Numbers
* @ingroup numerics
*
* Classes and functions for complex numbers.
* @{
*/
// Forward declarations.
template<typename _Tp> class complex;
template<> class complex<float>;
template<> class complex<double>;
template<> class complex<long double>;
/// Return magnitude of @a z.
template<typename _Tp> _Tp abs(const complex<_Tp>&);
/// Return phase angle of @a z.
template<typename _Tp> _Tp arg(const complex<_Tp>&);
/// Return @a z magnitude squared.
template<typename _Tp> _Tp norm(const complex<_Tp>&);
/// Return complex conjugate of @a z.
template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
/// Return complex with magnitude @a rho and angle @a theta.
template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp& = 0);
// Transcendentals:
/// Return complex cosine of @a z.
template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);
/// Return complex hyperbolic cosine of @a z.
template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);
/// Return complex base e exponential of @a z.
template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);
/// Return complex natural logarithm of @a z.
template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
/// Return complex base 10 logarithm of @a z.
template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
/// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
/// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
/// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&,
const complex<_Tp>&);
/// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);
/// Return complex sine of @a z.
template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);
/// Return complex hyperbolic sine of @a z.
template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);
/// Return complex square root of @a z.
template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);
/// Return complex tangent of @a z.
template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);
/// Return complex hyperbolic tangent of @a z.
template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);
// 26.2.2 Primary template class complex
/**
* Template to represent complex numbers.
*
* Specializations for float, double, and long double are part of the
* library. Results with any other type are not guaranteed.
*
* @param Tp Type of real and imaginary values.
*/
template<typename _Tp>
struct complex
{
/// Value typedef.
typedef _Tp value_type;
/// Default constructor. First parameter is x, second parameter is y.
/// Unspecified parameters default to 0.
_GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
: _M_real(__r), _M_imag(__i) { }
// Let the compiler synthesize the copy constructor
#if __cplusplus >= 201103L
constexpr complex(const complex&) = default;
#endif
/// Converting constructor.
template<typename _Up>
_GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) { }
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
_GLIBCXX_ABI_TAG_CXX11
constexpr _Tp
real() const { return _M_real; }
_GLIBCXX_ABI_TAG_CXX11
constexpr _Tp
imag() const { return _M_imag; }
#else
/// Return real part of complex number.
_Tp&
real() { return _M_real; }
/// Return real part of complex number.
const _Tp&
real() const { return _M_real; }
/// Return imaginary part of complex number.
_Tp&
imag() { return _M_imag; }
/// Return imaginary part of complex number.
const _Tp&
imag() const { return _M_imag; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void
real(_Tp __val) { _M_real = __val; }
void
imag(_Tp __val) { _M_imag = __val; }
/// Assign a scalar to this complex number.
complex<_Tp>& operator=(const _Tp&);
/// Add a scalar to this complex number.
// 26.2.5/1
complex<_Tp>&
operator+=(const _Tp& __t)
{
_M_real += __t;
return *this;
}
/// Subtract a scalar from this complex number.
// 26.2.5/3
complex<_Tp>&
operator-=(const _Tp& __t)
{
_M_real -= __t;
return *this;
}
/// Multiply this complex number by a scalar.
complex<_Tp>& operator*=(const _Tp&);
/// Divide this complex number by a scalar.
complex<_Tp>& operator/=(const _Tp&);
// Let the compiler synthesize the copy assignment operator
#if __cplusplus >= 201103L
complex& operator=(const complex&) = default;
#endif
/// Assign another complex number to this one.
template<typename _Up>
complex<_Tp>& operator=(const complex<_Up>&);
/// Add another complex number to this one.
template<typename _Up>
complex<_Tp>& operator+=(const complex<_Up>&);
/// Subtract another complex number from this one.
template<typename _Up>
complex<_Tp>& operator-=(const complex<_Up>&);
/// Multiply this complex number by another.
template<typename _Up>
complex<_Tp>& operator*=(const complex<_Up>&);
/// Divide this complex number by another.
template<typename _Up>
complex<_Tp>& operator/=(const complex<_Up>&);
_GLIBCXX_CONSTEXPR complex __rep() const
{ return *this; }
private:
_Tp _M_real;
_Tp _M_imag;
};
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator=(const _Tp& __t)
{
_M_real = __t;
_M_imag = _Tp();
return *this;
}
// 26.2.5/5
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator*=(const _Tp& __t)
{
_M_real *= __t;
_M_imag *= __t;
return *this;
}
// 26.2.5/7
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator/=(const _Tp& __t)
{
_M_real /= __t;
_M_imag /= __t;
return *this;
}
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator=(const complex<_Up>& __z)
{
_M_real = __z.real();
_M_imag = __z.imag();
return *this;
}
// 26.2.5/9
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator+=(const complex<_Up>& __z)
{
_M_real += __z.real();
_M_imag += __z.imag();
return *this;
}
// 26.2.5/11
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator-=(const complex<_Up>& __z)
{
_M_real -= __z.real();
_M_imag -= __z.imag();
return *this;
}
// 26.2.5/13
// XXX: This is a grammar school implementation.
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator*=(const complex<_Up>& __z)
{
const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
_M_real = __r;
return *this;
}
// 26.2.5/15
// XXX: This is a grammar school implementation.
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator/=(const complex<_Up>& __z)
{
const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
const _Tp __n = std::norm(__z);
_M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;
_M_real = __r / __n;
return *this;
}
// Operators:
//@{
/// Return new complex value @a x plus @a y.
template<typename _Tp>
inline complex<_Tp>
operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __x;
__r += __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator+(const complex<_Tp>& __x, const _Tp& __y)
{
complex<_Tp> __r = __x;
__r += __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator+(const _Tp& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __y;
__r += __x;
return __r;
}
//@}
//@{
/// Return new complex value @a x minus @a y.
template<typename _Tp>
inline complex<_Tp>
operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __x;
__r -= __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator-(const complex<_Tp>& __x, const _Tp& __y)
{
complex<_Tp> __r = __x;
__r -= __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator-(const _Tp& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r(__x, -__y.imag());
__r -= __y.real();
return __r;
}
//@}
//@{
/// Return new complex value @a x times @a y.
template<typename _Tp>
inline complex<_Tp>
operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __x;
__r *= __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator*(const complex<_Tp>& __x, const _Tp& __y)
{
complex<_Tp> __r = __x;
__r *= __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator*(const _Tp& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __y;
__r *= __x;
return __r;
}
//@}
//@{
/// Return new complex value @a x divided by @a y.
template<typename _Tp>
inline complex<_Tp>
operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __x;
__r /= __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator/(const complex<_Tp>& __x, const _Tp& __y)
{
complex<_Tp> __r = __x;
__r /= __y;
return __r;
}
template<typename _Tp>
inline complex<_Tp>
operator/(const _Tp& __x, const complex<_Tp>& __y)
{
complex<_Tp> __r = __x;
__r /= __y;
return __r;
}
//@}
/// Return @a x.
template<typename _Tp>
inline complex<_Tp>
operator+(const complex<_Tp>& __x)
{ return __x; }
/// Return complex negation of @a x.
template<typename _Tp>
inline complex<_Tp>
operator-(const complex<_Tp>& __x)
{ return complex<_Tp>(-__x.real(), -__x.imag()); }
//@{
/// Return true if @a x is equal to @a y.
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR bool
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __x.real() == __y.real() && __x.imag() == __y.imag(); }
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR bool
operator==(const complex<_Tp>& __x, const _Tp& __y)
{ return __x.real() == __y && __x.imag() == _Tp(); }
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR bool
operator==(const _Tp& __x, const complex<_Tp>& __y)
{ return __x == __y.real() && _Tp() == __y.imag(); }
//@}
//@{
/// Return false if @a x is equal to @a y.
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR bool
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __x.real() != __y.real() || __x.imag() != __y.imag(); }
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR bool
operator!=(const complex<_Tp>& __x, const _Tp& __y)
{ return __x.real() != __y || __x.imag() != _Tp(); }
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR bool
operator!=(const _Tp& __x, const complex<_Tp>& __y)
{ return __x != __y.real() || _Tp() != __y.imag(); }
//@}
/// Extraction operator for complex values.
template<typename _Tp, typename _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
{
bool __fail = true;
_CharT __ch;
if (__is >> __ch)
{
if (_Traits::eq(__ch, __is.widen('(')))
{
_Tp __u;
if (__is >> __u >> __ch)
{
const _CharT __rparen = __is.widen(')');
if (_Traits::eq(__ch, __rparen))
{
__x = __u;
__fail = false;
}
else if (_Traits::eq(__ch, __is.widen(',')))
{
_Tp __v;
if (__is >> __v >> __ch)
{
if (_Traits::eq(__ch, __rparen))
{
__x = complex<_Tp>(__u, __v);
__fail = false;
}
else
__is.putback(__ch);
}
}
else
__is.putback(__ch);
}
}
else
{
__is.putback(__ch);
_Tp __u;
if (__is >> __u)
{
__x = __u;
__fail = false;
}
}
}
if (__fail)
__is.setstate(ios_base::failbit);
return __is;
}
/// Insertion operator for complex values.
template<typename _Tp, typename _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
{
basic_ostringstream<_CharT, _Traits> __s;
__s.flags(__os.flags());
__s.imbue(__os.getloc());
__s.precision(__os.precision());
__s << '(' << __x.real() << ',' << __x.imag() << ')';
return __os << __s.str();
}
// Values
#if __cplusplus >= 201103L
template<typename _Tp>
constexpr _Tp
real(const complex<_Tp>& __z)
{ return __z.real(); }
template<typename _Tp>
constexpr _Tp
imag(const complex<_Tp>& __z)
{ return __z.imag(); }
#else
template<typename _Tp>
inline _Tp&
real(complex<_Tp>& __z)
{ return __z.real(); }
template<typename _Tp>
inline const _Tp&
real(const complex<_Tp>& __z)
{ return __z.real(); }
template<typename _Tp>
inline _Tp&
imag(complex<_Tp>& __z)
{ return __z.imag(); }
template<typename _Tp>
inline const _Tp&
imag(const complex<_Tp>& __z)
{ return __z.imag(); }
#endif
// 26.2.7/3 abs(__z): Returns the magnitude of __z.
template<typename _Tp>
inline _Tp
__complex_abs(const complex<_Tp>& __z)
{
_Tp __x = __z.real();
_Tp __y = __z.imag();
const _Tp __s = std::max(abs(__x), abs(__y));
if (__s == _Tp()) // well ...
return __s;
__x /= __s;
__y /= __s;
return __s * sqrt(__x * __x + __y * __y);
}
#if _GLIBCXX_USE_C99_COMPLEX
inline float
__complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); }
inline double
__complex_abs(__complex__ double __z) { return __builtin_cabs(__z); }
inline long double
__complex_abs(const __complex__ long double& __z)
{ return __builtin_cabsl(__z); }
template<typename _Tp>
inline _Tp
abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
#else
template<typename _Tp>
inline _Tp
abs(const complex<_Tp>& __z) { return __complex_abs(__z); }
#endif
// 26.2.7/4: arg(__z): Returns the phase angle of __z.
template<typename _Tp>
inline _Tp
__complex_arg(const complex<_Tp>& __z)
{ return atan2(__z.imag(), __z.real()); }
#if _GLIBCXX_USE_C99_COMPLEX
inline float
__complex_arg(__complex__ float __z) { return __builtin_cargf(__z); }
inline double
__complex_arg(__complex__ double __z) { return __builtin_carg(__z); }
inline long double
__complex_arg(const __complex__ long double& __z)
{ return __builtin_cargl(__z); }
template<typename _Tp>
inline _Tp
arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); }
#else
template<typename _Tp>
inline _Tp
arg(const complex<_Tp>& __z) { return __complex_arg(__z); }
#endif
// 26.2.7/5: norm(__z) returns the squared magnitude of __z.
// As defined, norm() is -not- a norm is the common mathematical
// sense used in numerics. The helper class _Norm_helper<> tries to
// distinguish between builtin floating point and the rest, so as
// to deliver an answer as close as possible to the real value.
template<bool>
struct _Norm_helper
{
template<typename _Tp>
static inline _Tp _S_do_it(const complex<_Tp>& __z)
{
const _Tp __x = __z.real();
const _Tp __y = __z.imag();
return __x * __x + __y * __y;
}
};
template<>
struct _Norm_helper<true>
{
template<typename _Tp>
static inline _Tp _S_do_it(const complex<_Tp>& __z)
{
_Tp __res = std::abs(__z);
return __res * __res;
}
};
template<typename _Tp>
inline _Tp
norm(const complex<_Tp>& __z)
{
return _Norm_helper<__is_floating<_Tp>::__value
&& !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
}
template<typename _Tp>
inline complex<_Tp>
polar(const _Tp& __rho, const _Tp& __theta)
{
__glibcxx_assert( __rho >= 0 );
return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta));
}
template<typename _Tp>
inline complex<_Tp>
conj(const complex<_Tp>& __z)
{ return complex<_Tp>(__z.real(), -__z.imag()); }
// Transcendentals
// 26.2.8/1 cos(__z): Returns the cosine of __z.
template<typename _Tp>
inline complex<_Tp>
__complex_cos(const complex<_Tp>& __z)
{
const _Tp __x = __z.real();
const _Tp __y = __z.imag();
return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y));
}
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); }
inline __complex__ double
__complex_cos(__complex__ double __z) { return __builtin_ccos(__z); }
inline __complex__ long double
__complex_cos(const __complex__ long double& __z)
{ return __builtin_ccosl(__z); }
template<typename _Tp>
inline complex<_Tp>
cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
cos(const complex<_Tp>& __z) { return __complex_cos(__z); }
#endif
// 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z.
template<typename _Tp>
inline complex<_Tp>
__complex_cosh(const complex<_Tp>& __z)
{
const _Tp __x = __z.real();
const _Tp __y = __z.imag();
return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y));
}
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); }
inline __complex__ double
__complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); }
inline __complex__ long double
__complex_cosh(const __complex__ long double& __z)
{ return __builtin_ccoshl(__z); }
template<typename _Tp>
inline complex<_Tp>
cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); }
#endif
// 26.2.8/3 exp(__z): Returns the complex base e exponential of x
template<typename _Tp>
inline complex<_Tp>
__complex_exp(const complex<_Tp>& __z)
{ return std::polar<_Tp>(exp(__z.real()), __z.imag()); }
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); }
inline __complex__ double
__complex_exp(__complex__ double __z) { return __builtin_cexp(__z); }
inline __complex__ long double
__complex_exp(const __complex__ long double& __z)
{ return __builtin_cexpl(__z); }
template<typename _Tp>
inline complex<_Tp>
exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
exp(const complex<_Tp>& __z) { return __complex_exp(__z); }
#endif
// 26.2.8/5 log(__z): Returns the natural complex logarithm of __z.
// The branch cut is along the negative axis.
template<typename _Tp>
inline complex<_Tp>
__complex_log(const complex<_Tp>& __z)
{ return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); }
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_log(__complex__ float __z) { return __builtin_clogf(__z); }
inline __complex__ double
__complex_log(__complex__ double __z) { return __builtin_clog(__z); }
inline __complex__ long double
__complex_log(const __complex__ long double& __z)
{ return __builtin_clogl(__z); }
template<typename _Tp>
inline complex<_Tp>
log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
log(const complex<_Tp>& __z) { return __complex_log(__z); }
#endif
template<typename _Tp>
inline complex<_Tp>
log10(const complex<_Tp>& __z)
{ return std::log(__z) / log(_Tp(10.0)); }
// 26.2.8/10 sin(__z): Returns the sine of __z.
template<typename _Tp>
inline complex<_Tp>
__complex_sin(const complex<_Tp>& __z)
{
const _Tp __x = __z.real();
const _Tp __y = __z.imag();
return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y));
}
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_sin(__complex__ float __z) { return __builtin_csinf(__z); }
inline __complex__ double
__complex_sin(__complex__ double __z) { return __builtin_csin(__z); }
inline __complex__ long double
__complex_sin(const __complex__ long double& __z)
{ return __builtin_csinl(__z); }
template<typename _Tp>
inline complex<_Tp>
sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
sin(const complex<_Tp>& __z) { return __complex_sin(__z); }
#endif
// 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z.
template<typename _Tp>
inline complex<_Tp>
__complex_sinh(const complex<_Tp>& __z)
{
const _Tp __x = __z.real();
const _Tp __y = __z.imag();
return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y));
}
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); }
inline __complex__ double
__complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); }
inline __complex__ long double
__complex_sinh(const __complex__ long double& __z)
{ return __builtin_csinhl(__z); }
template<typename _Tp>
inline complex<_Tp>
sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); }
#endif
// 26.2.8/13 sqrt(__z): Returns the complex square root of __z.
// The branch cut is on the negative axis.
template<typename _Tp>
complex<_Tp>
__complex_sqrt(const complex<_Tp>& __z)
{
_Tp __x = __z.real();
_Tp __y = __z.imag();
if (__x == _Tp())
{
_Tp __t = sqrt(abs(__y) / 2);
return complex<_Tp>(__t, __y < _Tp() ? -__t : __t);
}
else
{
_Tp __t = sqrt(2 * (std::abs(__z) + abs(__x)));
_Tp __u = __t / 2;
return __x > _Tp()
? complex<_Tp>(__u, __y / __t)
: complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u);
}
}
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); }
inline __complex__ double
__complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); }
inline __complex__ long double
__complex_sqrt(const __complex__ long double& __z)
{ return __builtin_csqrtl(__z); }
template<typename _Tp>
inline complex<_Tp>
sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); }
#endif
// 26.2.8/14 tan(__z): Return the complex tangent of __z.
template<typename _Tp>
inline complex<_Tp>
__complex_tan(const complex<_Tp>& __z)
{ return std::sin(__z) / std::cos(__z); }
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); }
inline __complex__ double
__complex_tan(__complex__ double __z) { return __builtin_ctan(__z); }
inline __complex__ long double
__complex_tan(const __complex__ long double& __z)
{ return __builtin_ctanl(__z); }
template<typename _Tp>
inline complex<_Tp>
tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
tan(const complex<_Tp>& __z) { return __complex_tan(__z); }
#endif
// 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z.
template<typename _Tp>
inline complex<_Tp>
__complex_tanh(const complex<_Tp>& __z)
{ return std::sinh(__z) / std::cosh(__z); }
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); }
inline __complex__ double
__complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); }
inline __complex__ long double
__complex_tanh(const __complex__ long double& __z)
{ return __builtin_ctanhl(__z); }
template<typename _Tp>
inline complex<_Tp>
tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); }
#endif
// 26.2.8/9 pow(__x, __y): Returns the complex power base of __x
// raised to the __y-th power. The branch
// cut is on the negative axis.
template<typename _Tp>
complex<_Tp>
__complex_pow_unsigned(complex<_Tp> __x, unsigned __n)
{
complex<_Tp> __y = __n % 2 ? __x : complex<_Tp>(1);
while (__n >>= 1)
{
__x *= __x;
if (__n % 2)
__y *= __x;
}
return __y;
}
// In C++11 mode we used to implement the resolution of
// DR 844. complex pow return type is ambiguous.
// thus the following overload was disabled in that mode. However, doing
// that causes all sorts of issues, see, for example:
// http://gcc.gnu.org/ml/libstdc++/2013-01/msg00058.html
// and also PR57974.
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __z, int __n)
{
return __n < 0
? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n)
: std::__complex_pow_unsigned(__z, __n);
}
template<typename _Tp>
complex<_Tp>
pow(const complex<_Tp>& __x, const _Tp& __y)
{
#if ! _GLIBCXX_USE_C99_COMPLEX
if (__x == _Tp())
return _Tp();
#endif
if (__x.imag() == _Tp() && __x.real() > _Tp())
return pow(__x.real(), __y);
complex<_Tp> __t = std::log(__x);
return std::polar<_Tp>(exp(__y * __t.real()), __y * __t.imag());
}
template<typename _Tp>
inline complex<_Tp>
__complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); }
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_pow(__complex__ float __x, __complex__ float __y)
{ return __builtin_cpowf(__x, __y); }
inline __complex__ double
__complex_pow(__complex__ double __x, __complex__ double __y)
{ return __builtin_cpow(__x, __y); }
inline __complex__ long double
__complex_pow(const __complex__ long double& __x,
const __complex__ long double& __y)
{ return __builtin_cpowl(__x, __y); }
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __complex_pow(__x.__rep(), __y.__rep()); }
#else
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __complex_pow(__x, __y); }
#endif
template<typename _Tp>
inline complex<_Tp>
pow(const _Tp& __x, const complex<_Tp>& __y)
{
return __x > _Tp() ? std::polar<_Tp>(pow(__x, __y.real()),
__y.imag() * log(__x))
: std::pow(complex<_Tp>(__x), __y);
}
/// 26.2.3 complex specializations
/// complex<float> specialization
template<>
struct complex<float>
{
typedef float value_type;
typedef __complex__ float _ComplexT;
_GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
_GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f)
#if __cplusplus >= 201103L
: _M_value{ __r, __i } { }
#else
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
#endif
explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&);
explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
__attribute ((__abi_tag__ ("cxx11")))
constexpr float
real() const { return __real__ _M_value; }
__attribute ((__abi_tag__ ("cxx11")))
constexpr float
imag() const { return __imag__ _M_value; }
#else
float&
real() { return __real__ _M_value; }
const float&
real() const { return __real__ _M_value; }
float&
imag() { return __imag__ _M_value; }
const float&
imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void
real(float __val) { __real__ _M_value = __val; }
void
imag(float __val) { __imag__ _M_value = __val; }
complex&
operator=(float __f)
{
_M_value = __f;
return *this;
}
complex&
operator+=(float __f)
{
_M_value += __f;
return *this;
}
complex&
operator-=(float __f)
{
_M_value -= __f;
return *this;
}
complex&
operator*=(float __f)
{
_M_value *= __f;
return *this;
}
complex&
operator/=(float __f)
{
_M_value /= __f;
return *this;
}
// Let the compiler synthesize the copy and assignment
// operator. It always does a pretty good job.
// complex& operator=(const complex&);
template<typename _Tp>
complex&
operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator+=(const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
return *this;
}
template<class _Tp>
complex&
operator-=(const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
return *this;
}
template<class _Tp>
complex&
operator*=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value *= __t;
return *this;
}
template<class _Tp>
complex&
operator/=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value /= __t;
return *this;
}
_GLIBCXX_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
};
/// 26.2.3 complex specializations
/// complex<double> specialization
template<>
struct complex<double>
{
typedef double value_type;
typedef __complex__ double _ComplexT;
_GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
_GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
#if __cplusplus >= 201103L
: _M_value{ __r, __i } { }
#else
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
#endif
_GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
__attribute ((__abi_tag__ ("cxx11")))
constexpr double
real() const { return __real__ _M_value; }
__attribute ((__abi_tag__ ("cxx11")))
constexpr double
imag() const { return __imag__ _M_value; }
#else
double&
real() { return __real__ _M_value; }
const double&
real() const { return __real__ _M_value; }
double&
imag() { return __imag__ _M_value; }
const double&
imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void
real(double __val) { __real__ _M_value = __val; }
void
imag(double __val) { __imag__ _M_value = __val; }
complex&
operator=(double __d)
{
_M_value = __d;
return *this;
}
complex&
operator+=(double __d)
{
_M_value += __d;
return *this;
}
complex&
operator-=(double __d)
{
_M_value -= __d;
return *this;
}
complex&
operator*=(double __d)
{
_M_value *= __d;
return *this;
}
complex&
operator/=(double __d)
{
_M_value /= __d;
return *this;
}
// The compiler will synthesize this, efficiently.
// complex& operator=(const complex&);
template<typename _Tp>
complex&
operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator+=(const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator-=(const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator*=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value *= __t;
return *this;
}
template<typename _Tp>
complex&
operator/=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value /= __t;
return *this;
}
_GLIBCXX_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
};
/// 26.2.3 complex specializations
/// complex<long double> specialization
template<>
struct complex<long double>
{
typedef long double value_type;
typedef __complex__ long double _ComplexT;
_GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
_GLIBCXX_CONSTEXPR complex(long double __r = 0.0L,
long double __i = 0.0L)
#if __cplusplus >= 201103L
: _M_value{ __r, __i } { }
#else
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
#endif
_GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
_GLIBCXX_CONSTEXPR complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
__attribute ((__abi_tag__ ("cxx11")))
constexpr long double
real() const { return __real__ _M_value; }
__attribute ((__abi_tag__ ("cxx11")))
constexpr long double
imag() const { return __imag__ _M_value; }
#else
long double&
real() { return __real__ _M_value; }
const long double&
real() const { return __real__ _M_value; }
long double&
imag() { return __imag__ _M_value; }
const long double&
imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void
real(long double __val) { __real__ _M_value = __val; }
void
imag(long double __val) { __imag__ _M_value = __val; }
complex&
operator=(long double __r)
{
_M_value = __r;
return *this;
}
complex&
operator+=(long double __r)
{
_M_value += __r;
return *this;
}
complex&
operator-=(long double __r)
{
_M_value -= __r;
return *this;
}
complex&
operator*=(long double __r)
{
_M_value *= __r;
return *this;
}
complex&
operator/=(long double __r)
{
_M_value /= __r;
return *this;
}
// The compiler knows how to do this efficiently
// complex& operator=(const complex&);
template<typename _Tp>
complex&
operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator+=(const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator-=(const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
return *this;
}
template<typename _Tp>
complex&
operator*=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value *= __t;
return *this;
}
template<typename _Tp>
complex&
operator/=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value /= __t;
return *this;
}
_GLIBCXX_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
};
// These bits have to be at the end of this file, so that the
// specializations have all been defined.
inline _GLIBCXX_CONSTEXPR
complex<float>::complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
inline _GLIBCXX_CONSTEXPR
complex<float>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
inline _GLIBCXX_CONSTEXPR
complex<double>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE
extern template istream& operator>>(istream&, complex<float>&);
extern template ostream& operator<<(ostream&, const complex<float>&);
extern template istream& operator>>(istream&, complex<double>&);
extern template ostream& operator<<(ostream&, const complex<double>&);
extern template istream& operator>>(istream&, complex<long double>&);
extern template ostream& operator<<(ostream&, const complex<long double>&);
#ifdef _GLIBCXX_USE_WCHAR_T
extern template wistream& operator>>(wistream&, complex<float>&);
extern template wostream& operator<<(wostream&, const complex<float>&);
extern template wistream& operator>>(wistream&, complex<double>&);
extern template wostream& operator<<(wostream&, const complex<double>&);
extern template wistream& operator>>(wistream&, complex<long double>&);
extern template wostream& operator<<(wostream&, const complex<long double>&);
#endif
#endif
// @} group complex_numbers
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// See ext/type_traits.h for the primary template.
template<typename _Tp, typename _Up>
struct __promote_2<std::complex<_Tp>, _Up>
{
public:
typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
};
template<typename _Tp, typename _Up>
struct __promote_2<_Tp, std::complex<_Up> >
{
public:
typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
};
template<typename _Tp, typename _Up>
struct __promote_2<std::complex<_Tp>, std::complex<_Up> >
{
public:
typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#if __cplusplus >= 201103L
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Forward declarations.
template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);
// DR 595.
template<typename _Tp> _Tp fabs(const std::complex<_Tp>&);
template<typename _Tp>
inline std::complex<_Tp>
__complex_acos(const std::complex<_Tp>& __z)
{
const std::complex<_Tp> __t = std::asin(__z);
const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acos(__complex__ float __z)
{ return __builtin_cacosf(__z); }
inline __complex__ double
__complex_acos(__complex__ double __z)
{ return __builtin_cacos(__z); }
inline __complex__ long double
__complex_acos(const __complex__ long double& __z)
{ return __builtin_cacosl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
acos(const std::complex<_Tp>& __z)
{ return __complex_acos(__z.__rep()); }
#else
/// acos(__z) [8.1.2].
// Effects: Behaves the same as C99 function cacos, defined
// in subclause 7.3.5.1.
template<typename _Tp>
inline std::complex<_Tp>
acos(const std::complex<_Tp>& __z)
{ return __complex_acos(__z); }
#endif
template<typename _Tp>
inline std::complex<_Tp>
__complex_asin(const std::complex<_Tp>& __z)
{
std::complex<_Tp> __t(-__z.imag(), __z.real());
__t = std::asinh(__t);
return std::complex<_Tp>(__t.imag(), -__t.real());
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_asin(__complex__ float __z)
{ return __builtin_casinf(__z); }
inline __complex__ double
__complex_asin(__complex__ double __z)
{ return __builtin_casin(__z); }
inline __complex__ long double
__complex_asin(const __complex__ long double& __z)
{ return __builtin_casinl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
asin(const std::complex<_Tp>& __z)
{ return __complex_asin(__z.__rep()); }
#else
/// asin(__z) [8.1.3].
// Effects: Behaves the same as C99 function casin, defined
// in subclause 7.3.5.2.
template<typename _Tp>
inline std::complex<_Tp>
asin(const std::complex<_Tp>& __z)
{ return __complex_asin(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_atan(const std::complex<_Tp>& __z)
{
const _Tp __r2 = __z.real() * __z.real();
const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
_Tp __num = __z.imag() + _Tp(1.0);
_Tp __den = __z.imag() - _Tp(1.0);
__num = __r2 + __num * __num;
__den = __r2 + __den * __den;
return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),
_Tp(0.25) * log(__num / __den));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_atan(__complex__ float __z)
{ return __builtin_catanf(__z); }
inline __complex__ double
__complex_atan(__complex__ double __z)
{ return __builtin_catan(__z); }
inline __complex__ long double
__complex_atan(const __complex__ long double& __z)
{ return __builtin_catanl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
atan(const std::complex<_Tp>& __z)
{ return __complex_atan(__z.__rep()); }
#else
/// atan(__z) [8.1.4].
// Effects: Behaves the same as C99 function catan, defined
// in subclause 7.3.5.3.
template<typename _Tp>
inline std::complex<_Tp>
atan(const std::complex<_Tp>& __z)
{ return __complex_atan(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_acosh(const std::complex<_Tp>& __z)
{
// Kahan's formula.
return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0)))
+ std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acosh(__complex__ float __z)
{ return __builtin_cacoshf(__z); }
inline __complex__ double
__complex_acosh(__complex__ double __z)
{ return __builtin_cacosh(__z); }
inline __complex__ long double
__complex_acosh(const __complex__ long double& __z)
{ return __builtin_cacoshl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
acosh(const std::complex<_Tp>& __z)
{ return __complex_acosh(__z.__rep()); }
#else
/// acosh(__z) [8.1.5].
// Effects: Behaves the same as C99 function cacosh, defined
// in subclause 7.3.6.1.
template<typename _Tp>
inline std::complex<_Tp>
acosh(const std::complex<_Tp>& __z)
{ return __complex_acosh(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_asinh(const std::complex<_Tp>& __z)
{
std::complex<_Tp> __t((__z.real() - __z.imag())
* (__z.real() + __z.imag()) + _Tp(1.0),
_Tp(2.0) * __z.real() * __z.imag());
__t = std::sqrt(__t);
return std::log(__t + __z);
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_asinh(__complex__ float __z)
{ return __builtin_casinhf(__z); }
inline __complex__ double
__complex_asinh(__complex__ double __z)
{ return __builtin_casinh(__z); }
inline __complex__ long double
__complex_asinh(const __complex__ long double& __z)
{ return __builtin_casinhl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
asinh(const std::complex<_Tp>& __z)
{ return __complex_asinh(__z.__rep()); }
#else
/// asinh(__z) [8.1.6].
// Effects: Behaves the same as C99 function casin, defined
// in subclause 7.3.6.2.
template<typename _Tp>
inline std::complex<_Tp>
asinh(const std::complex<_Tp>& __z)
{ return __complex_asinh(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_atanh(const std::complex<_Tp>& __z)
{
const _Tp __i2 = __z.imag() * __z.imag();
const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
_Tp __num = _Tp(1.0) + __z.real();
_Tp __den = _Tp(1.0) - __z.real();
__num = __i2 + __num * __num;
__den = __i2 + __den * __den;
return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),
_Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_atanh(__complex__ float __z)
{ return __builtin_catanhf(__z); }
inline __complex__ double
__complex_atanh(__complex__ double __z)
{ return __builtin_catanh(__z); }
inline __complex__ long double
__complex_atanh(const __complex__ long double& __z)
{ return __builtin_catanhl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
atanh(const std::complex<_Tp>& __z)
{ return __complex_atanh(__z.__rep()); }
#else
/// atanh(__z) [8.1.7].
// Effects: Behaves the same as C99 function catanh, defined
// in subclause 7.3.6.3.
template<typename _Tp>
inline std::complex<_Tp>
atanh(const std::complex<_Tp>& __z)
{ return __complex_atanh(__z); }
#endif
template<typename _Tp>
inline _Tp
/// fabs(__z) [8.1.8].
// Effects: Behaves the same as C99 function cabs, defined
// in subclause 7.3.8.1.
fabs(const std::complex<_Tp>& __z)
{ return std::abs(__z); }
/// Additional overloads [8.1.9].
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
arg(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
#if (_GLIBCXX11_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
: __type();
#else
return std::arg(std::complex<__type>(__x));
#endif
}
template<typename _Tp>
_GLIBCXX_CONSTEXPR inline typename __gnu_cxx::__promote<_Tp>::__type
imag(_Tp)
{ return _Tp(); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
norm(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __type(__x) * __type(__x);
}
template<typename _Tp>
_GLIBCXX_CONSTEXPR inline typename __gnu_cxx::__promote<_Tp>::__type
real(_Tp __x)
{ return __x; }
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
pow(const std::complex<_Tp>& __x, const _Up& __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(std::complex<__type>(__x), __type(__y));
}
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
pow(const _Tp& __x, const std::complex<_Up>& __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(__type(__x), std::complex<__type>(__y));
}
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(std::complex<__type>(__x),
std::complex<__type>(__y));
}
// Forward declarations.
// DR 781.
template<typename _Tp> std::complex<_Tp> proj(const std::complex<_Tp>&);
template<typename _Tp>
std::complex<_Tp>
__complex_proj(const std::complex<_Tp>& __z)
{
const _Tp __den = (__z.real() * __z.real()
+ __z.imag() * __z.imag() + _Tp(1.0));
return std::complex<_Tp>((_Tp(2.0) * __z.real()) / __den,
(_Tp(2.0) * __z.imag()) / __den);
}
#if _GLIBCXX_USE_C99_COMPLEX
inline __complex__ float
__complex_proj(__complex__ float __z)
{ return __builtin_cprojf(__z); }
inline __complex__ double
__complex_proj(__complex__ double __z)
{ return __builtin_cproj(__z); }
inline __complex__ long double
__complex_proj(const __complex__ long double& __z)
{ return __builtin_cprojl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
proj(const std::complex<_Tp>& __z)
{ return __complex_proj(__z.__rep()); }
#else
template<typename _Tp>
inline std::complex<_Tp>
proj(const std::complex<_Tp>& __z)
{ return __complex_proj(__z); }
#endif
template<typename _Tp>
inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
proj(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return std::proj(std::complex<__type>(__x));
}
template<typename _Tp>
inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
conj(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return std::complex<__type>(__x, -__type());
}
#if __cplusplus > 201103L
inline namespace literals {
inline namespace complex_literals {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
#define __cpp_lib_complex_udls 201309
constexpr std::complex<float>
operator""if(long double __num)
{ return std::complex<float>{0.0F, static_cast<float>(__num)}; }
constexpr std::complex<float>
operator""if(unsigned long long __num)
{ return std::complex<float>{0.0F, static_cast<float>(__num)}; }
constexpr std::complex<double>
operator""i(long double __num)
{ return std::complex<double>{0.0, static_cast<double>(__num)}; }
constexpr std::complex<double>
operator""i(unsigned long long __num)
{ return std::complex<double>{0.0, static_cast<double>(__num)}; }
constexpr std::complex<long double>
operator""il(long double __num)
{ return std::complex<long double>{0.0L, __num}; }
constexpr std::complex<long double>
operator""il(unsigned long long __num)
{ return std::complex<long double>{0.0L, static_cast<long double>(__num)}; }
#pragma GCC diagnostic pop
} // inline namespace complex_literals
} // inline namespace literals
#endif // C++14
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // C++11
#endif /* _GLIBCXX_COMPLEX */
// String based streams -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/sstream
* This is a Standard C++ Library header.
*/
//
// ISO C++ 14882: 27.7 String-based streams
//
#ifndef _GLIBCXX_SSTREAM
#define _GLIBCXX_SSTREAM 1
#pragma GCC system_header
#include <istream>
#include <ostream>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CXX11
// [27.7.1] template class basic_stringbuf
/**
* @brief The actual work of input and output (for std::string).
* @ingroup io
*
* @tparam _CharT Type of character stream.
* @tparam _Traits Traits for character type, defaults to
* char_traits<_CharT>.
* @tparam _Alloc Allocator type, defaults to allocator<_CharT>.
*
* This class associates either or both of its input and output sequences
* with a sequence of characters, which can be initialized from, or made
* available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.)
*
* For this class, open modes (of type @c ios_base::openmode) have
* @c in set if the input sequence can be read, and @c out set if the
* output sequence can be written.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
{
struct __xfer_bufptrs;
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 251. basic_stringbuf missing allocator_type
typedef _Alloc allocator_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
typedef basic_streambuf<char_type, traits_type> __streambuf_type;
typedef basic_string<char_type, _Traits, _Alloc> __string_type;
typedef typename __string_type::size_type __size_type;
protected:
/// Place to stash in || out || in | out settings for current stringbuf.
ios_base::openmode _M_mode;
// Data Members:
__string_type _M_string;
public:
// Constructors:
/**
* @brief Starts with an empty string buffer.
* @param __mode Whether the buffer can read, or write, or both.
*
* The default constructor initializes the parent class using its
* own default ctor.
*/
explicit
basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
: __streambuf_type(), _M_mode(__mode), _M_string()
{ }
/**
* @brief Starts with an existing string buffer.
* @param __str A string to copy as a starting buffer.
* @param __mode Whether the buffer can read, or write, or both.
*
* This constructor initializes the parent class using its
* own default ctor.
*/
explicit
basic_stringbuf(const __string_type& __str,
ios_base::openmode __mode = ios_base::in | ios_base::out)
: __streambuf_type(), _M_mode(),
_M_string(__str.data(), __str.size(), __str.get_allocator())
{ _M_stringbuf_init(__mode); }
#if __cplusplus >= 201103L
basic_stringbuf(const basic_stringbuf&) = delete;
basic_stringbuf(basic_stringbuf&& __rhs)
: basic_stringbuf(std::move(__rhs), __xfer_bufptrs(__rhs, this))
{ __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); }
// 27.8.2.2 Assign and swap:
basic_stringbuf&
operator=(const basic_stringbuf&) = delete;
basic_stringbuf&
operator=(basic_stringbuf&& __rhs)
{
__xfer_bufptrs __st{__rhs, this};
const __streambuf_type& __base = __rhs;
__streambuf_type::operator=(__base);
this->pubimbue(__rhs.getloc());
_M_mode = __rhs._M_mode;
_M_string = std::move(__rhs._M_string);
__rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0);
return *this;
}
void
swap(basic_stringbuf& __rhs)
{
__xfer_bufptrs __l_st{*this, std::__addressof(__rhs)};
__xfer_bufptrs __r_st{__rhs, this};
__streambuf_type& __base = __rhs;
__streambuf_type::swap(__base);
__rhs.pubimbue(this->pubimbue(__rhs.getloc()));
std::swap(_M_mode, __rhs._M_mode);
std::swap(_M_string, __rhs._M_string);
}
#endif
// Get and set:
/**
* @brief Copying out the string buffer.
* @return A copy of one of the underlying sequences.
*
* <em>If the buffer is only created in input mode, the underlying
* character sequence is equal to the input sequence; otherwise, it
* is equal to the output sequence.</em> [27.7.1.2]/1
*/
__string_type
str() const
{
__string_type __ret(_M_string.get_allocator());
if (this->pptr())
{
// The current egptr() may not be the actual string end.
if (this->pptr() > this->egptr())
__ret.assign(this->pbase(), this->pptr());
else
__ret.assign(this->pbase(), this->egptr());
}
else
__ret = _M_string;
return __ret;
}
/**
* @brief Setting a new buffer.
* @param __s The string to use as a new sequence.
*
* Deallocates any previous stored sequence, then copies @a s to
* use as a new one.
*/
void
str(const __string_type& __s)
{
// Cannot use _M_string = __s, since v3 strings are COW
// (not always true now but assign() always works).
_M_string.assign(__s.data(), __s.size());
_M_stringbuf_init(_M_mode);
}
protected:
// Common initialization code goes here.
void
_M_stringbuf_init(ios_base::openmode __mode)
{
_M_mode = __mode;
__size_type __len = 0;
if (_M_mode & (ios_base::ate | ios_base::app))
__len = _M_string.size();
_M_sync(const_cast<char_type*>(_M_string.data()), 0, __len);
}
virtual streamsize
showmanyc()
{
streamsize __ret = -1;
if (_M_mode & ios_base::in)
{
_M_update_egptr();
__ret = this->egptr() - this->gptr();
}
return __ret;
}
virtual int_type
underflow();
virtual int_type
pbackfail(int_type __c = traits_type::eof());
virtual int_type
overflow(int_type __c = traits_type::eof());
/**
* @brief Manipulates the buffer.
* @param __s Pointer to a buffer area.
* @param __n Size of @a __s.
* @return @c this
*
* If no buffer has already been created, and both @a __s and @a __n are
* non-zero, then @c __s is used as a buffer; see
* https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering
* for more.
*/
virtual __streambuf_type*
setbuf(char_type* __s, streamsize __n)
{
if (__s && __n >= 0)
{
// This is implementation-defined behavior, and assumes
// that an external char_type array of length __n exists
// and has been pre-allocated. If this is not the case,
// things will quickly blow up.
// Step 1: Destroy the current internal array.
_M_string.clear();
// Step 2: Use the external array.
_M_sync(__s, __n, 0);
}
return this;
}
virtual pos_type
seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual pos_type
seekpos(pos_type __sp,
ios_base::openmode __mode = ios_base::in | ios_base::out);
// Internal function for correctly updating the internal buffer
// for a particular _M_string, due to initialization or re-sizing
// of an existing _M_string.
void
_M_sync(char_type* __base, __size_type __i, __size_type __o);
// Internal function for correctly updating egptr() to the actual
// string end.
void
_M_update_egptr()
{
const bool __testin = _M_mode & ios_base::in;
if (this->pptr() && this->pptr() > this->egptr())
{
if (__testin)
this->setg(this->eback(), this->gptr(), this->pptr());
else
this->setg(this->pptr(), this->pptr(), this->pptr());
}
}
// Works around the issue with pbump, part of the protected
// interface of basic_streambuf, taking just an int.
void
_M_pbump(char_type* __pbeg, char_type* __pend, off_type __off);
private:
#if __cplusplus >= 201103L
#if _GLIBCXX_USE_CXX11_ABI
// This type captures the state of the gptr / pptr pointers as offsets
// so they can be restored in another object after moving the string.
struct __xfer_bufptrs
{
__xfer_bufptrs(const basic_stringbuf& __from, basic_stringbuf* __to)
: _M_to{__to}, _M_goff{-1, -1, -1}, _M_poff{-1, -1, -1}
{
const _CharT* const __str = __from._M_string.data();
const _CharT* __end = nullptr;
if (__from.eback())
{
_M_goff[0] = __from.eback() - __str;
_M_goff[1] = __from.gptr() - __str;
_M_goff[2] = __from.egptr() - __str;
__end = __from.egptr();
}
if (__from.pbase())
{
_M_poff[0] = __from.pbase() - __str;
_M_poff[1] = __from.pptr() - __from.pbase();
_M_poff[2] = __from.epptr() - __str;
if (__from.pptr() > __end)
__end = __from.pptr();
}
// Set _M_string length to the greater of the get and put areas.
if (__end)
{
// The const_cast avoids changing this constructor's signature,
// because it is exported from the dynamic library.
auto& __mut_from = const_cast<basic_stringbuf&>(__from);
__mut_from._M_string._M_length(__end - __str);
}
}
~__xfer_bufptrs()
{
char_type* __str = const_cast<char_type*>(_M_to->_M_string.data());
if (_M_goff[0] != -1)
_M_to->setg(__str+_M_goff[0], __str+_M_goff[1], __str+_M_goff[2]);
if (_M_poff[0] != -1)
_M_to->_M_pbump(__str+_M_poff[0], __str+_M_poff[2], _M_poff[1]);
}
basic_stringbuf* _M_to;
off_type _M_goff[3];
off_type _M_poff[3];
};
#else
// This type does nothing when using Copy-On-Write strings.
struct __xfer_bufptrs
{
__xfer_bufptrs(const basic_stringbuf&, basic_stringbuf*) { }
};
#endif
// The move constructor initializes an __xfer_bufptrs temporary then
// delegates to this constructor to performs moves during its lifetime.
basic_stringbuf(basic_stringbuf&& __rhs, __xfer_bufptrs&&)
: __streambuf_type(static_cast<const __streambuf_type&>(__rhs)),
_M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string))
{ }
#endif
};
// [27.7.2] Template class basic_istringstream
/**
* @brief Controlling input for std::string.
* @ingroup io
*
* @tparam _CharT Type of character stream.
* @tparam _Traits Traits for character type, defaults to
* char_traits<_CharT>.
* @tparam _Alloc Allocator type, defaults to allocator<_CharT>.
*
* This class supports reading from objects of type std::basic_string,
* using the inherited functions from std::basic_istream. To control
* the associated sequence, an instance of std::basic_stringbuf is used,
* which this page refers to as @c sb.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
class basic_istringstream : public basic_istream<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 251. basic_stringbuf missing allocator_type
typedef _Alloc allocator_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
// Non-standard types:
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
typedef basic_istream<char_type, traits_type> __istream_type;
private:
__stringbuf_type _M_stringbuf;
public:
// Constructors:
/**
* @brief Default constructor starts with an empty string buffer.
* @param __mode Whether the buffer can read, or write, or both.
*
* @c ios_base::in is automatically included in @a __mode.
*
* Initializes @c sb using @c __mode|in, and passes @c &sb to the base
* class initializer. Does not allocate any buffer.
*
* That's a lie. We initialize the base class with NULL, because the
* string class does its own memory management.
*/
explicit
basic_istringstream(ios_base::openmode __mode = ios_base::in)
: __istream_type(), _M_stringbuf(__mode | ios_base::in)
{ this->init(&_M_stringbuf); }
/**
* @brief Starts with an existing string buffer.
* @param __str A string to copy as a starting buffer.
* @param __mode Whether the buffer can read, or write, or both.
*
* @c ios_base::in is automatically included in @a mode.
*
* Initializes @c sb using @a str and @c mode|in, and passes @c &sb
* to the base class initializer.
*
* That's a lie. We initialize the base class with NULL, because the
* string class does its own memory management.
*/
explicit
basic_istringstream(const __string_type& __str,
ios_base::openmode __mode = ios_base::in)
: __istream_type(), _M_stringbuf(__str, __mode | ios_base::in)
{ this->init(&_M_stringbuf); }
/**
* @brief The destructor does nothing.
*
* The buffer is deallocated by the stringbuf object, not the
* formatting stream.
*/
~basic_istringstream()
{ }
#if __cplusplus >= 201103L
basic_istringstream(const basic_istringstream&) = delete;
basic_istringstream(basic_istringstream&& __rhs)
: __istream_type(std::move(__rhs)),
_M_stringbuf(std::move(__rhs._M_stringbuf))
{ __istream_type::set_rdbuf(&_M_stringbuf); }
// 27.8.3.2 Assign and swap:
basic_istringstream&
operator=(const basic_istringstream&) = delete;
basic_istringstream&
operator=(basic_istringstream&& __rhs)
{
__istream_type::operator=(std::move(__rhs));
_M_stringbuf = std::move(__rhs._M_stringbuf);
return *this;
}
void
swap(basic_istringstream& __rhs)
{
__istream_type::swap(__rhs);
_M_stringbuf.swap(__rhs._M_stringbuf);
}
#endif
// Members:
/**
* @brief Accessing the underlying buffer.
* @return The current basic_stringbuf buffer.
*
* This hides both signatures of std::basic_ios::rdbuf().
*/
__stringbuf_type*
rdbuf() const
{ return const_cast<__stringbuf_type*>(&_M_stringbuf); }
/**
* @brief Copying out the string buffer.
* @return @c rdbuf()->str()
*/
__string_type
str() const
{ return _M_stringbuf.str(); }
/**
* @brief Setting a new buffer.
* @param __s The string to use as a new sequence.
*
* Calls @c rdbuf()->str(s).
*/
void
str(const __string_type& __s)
{ _M_stringbuf.str(__s); }
};
// [27.7.3] Template class basic_ostringstream
/**
* @brief Controlling output for std::string.
* @ingroup io
*
* @tparam _CharT Type of character stream.
* @tparam _Traits Traits for character type, defaults to
* char_traits<_CharT>.
* @tparam _Alloc Allocator type, defaults to allocator<_CharT>.
*
* This class supports writing to objects of type std::basic_string,
* using the inherited functions from std::basic_ostream. To control
* the associated sequence, an instance of std::basic_stringbuf is used,
* which this page refers to as @c sb.
*/
template <typename _CharT, typename _Traits, typename _Alloc>
class basic_ostringstream : public basic_ostream<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 251. basic_stringbuf missing allocator_type
typedef _Alloc allocator_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
// Non-standard types:
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
typedef basic_ostream<char_type, traits_type> __ostream_type;
private:
__stringbuf_type _M_stringbuf;
public:
// Constructors/destructor:
/**
* @brief Default constructor starts with an empty string buffer.
* @param __mode Whether the buffer can read, or write, or both.
*
* @c ios_base::out is automatically included in @a mode.
*
* Initializes @c sb using @c mode|out, and passes @c &sb to the base
* class initializer. Does not allocate any buffer.
*
* That's a lie. We initialize the base class with NULL, because the
* string class does its own memory management.
*/
explicit
basic_ostringstream(ios_base::openmode __mode = ios_base::out)
: __ostream_type(), _M_stringbuf(__mode | ios_base::out)
{ this->init(&_M_stringbuf); }
/**
* @brief Starts with an existing string buffer.
* @param __str A string to copy as a starting buffer.
* @param __mode Whether the buffer can read, or write, or both.
*
* @c ios_base::out is automatically included in @a mode.
*
* Initializes @c sb using @a str and @c mode|out, and passes @c &sb
* to the base class initializer.
*
* That's a lie. We initialize the base class with NULL, because the
* string class does its own memory management.
*/
explicit
basic_ostringstream(const __string_type& __str,
ios_base::openmode __mode = ios_base::out)
: __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out)
{ this->init(&_M_stringbuf); }
/**
* @brief The destructor does nothing.
*
* The buffer is deallocated by the stringbuf object, not the
* formatting stream.
*/
~basic_ostringstream()
{ }
#if __cplusplus >= 201103L
basic_ostringstream(const basic_ostringstream&) = delete;
basic_ostringstream(basic_ostringstream&& __rhs)
: __ostream_type(std::move(__rhs)),
_M_stringbuf(std::move(__rhs._M_stringbuf))
{ __ostream_type::set_rdbuf(&_M_stringbuf); }
// 27.8.3.2 Assign and swap:
basic_ostringstream&
operator=(const basic_ostringstream&) = delete;
basic_ostringstream&
operator=(basic_ostringstream&& __rhs)
{
__ostream_type::operator=(std::move(__rhs));
_M_stringbuf = std::move(__rhs._M_stringbuf);
return *this;
}
void
swap(basic_ostringstream& __rhs)
{
__ostream_type::swap(__rhs);
_M_stringbuf.swap(__rhs._M_stringbuf);
}
#endif
// Members:
/**
* @brief Accessing the underlying buffer.
* @return The current basic_stringbuf buffer.
*
* This hides both signatures of std::basic_ios::rdbuf().
*/
__stringbuf_type*
rdbuf() const
{ return const_cast<__stringbuf_type*>(&_M_stringbuf); }
/**
* @brief Copying out the string buffer.
* @return @c rdbuf()->str()
*/
__string_type
str() const
{ return _M_stringbuf.str(); }
/**
* @brief Setting a new buffer.
* @param __s The string to use as a new sequence.
*
* Calls @c rdbuf()->str(s).
*/
void
str(const __string_type& __s)
{ _M_stringbuf.str(__s); }
};
// [27.7.4] Template class basic_stringstream
/**
* @brief Controlling input and output for std::string.
* @ingroup io
*
* @tparam _CharT Type of character stream.
* @tparam _Traits Traits for character type, defaults to
* char_traits<_CharT>.
* @tparam _Alloc Allocator type, defaults to allocator<_CharT>.
*
* This class supports reading from and writing to objects of type
* std::basic_string, using the inherited functions from
* std::basic_iostream. To control the associated sequence, an instance
* of std::basic_stringbuf is used, which this page refers to as @c sb.
*/
template <typename _CharT, typename _Traits, typename _Alloc>
class basic_stringstream : public basic_iostream<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 251. basic_stringbuf missing allocator_type
typedef _Alloc allocator_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
// Non-standard Types:
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
typedef basic_iostream<char_type, traits_type> __iostream_type;
private:
__stringbuf_type _M_stringbuf;
public:
// Constructors/destructors
/**
* @brief Default constructor starts with an empty string buffer.
* @param __m Whether the buffer can read, or write, or both.
*
* Initializes @c sb using the mode from @c __m, and passes @c
* &sb to the base class initializer. Does not allocate any
* buffer.
*
* That's a lie. We initialize the base class with NULL, because the
* string class does its own memory management.
*/
explicit
basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in)
: __iostream_type(), _M_stringbuf(__m)
{ this->init(&_M_stringbuf); }
/**
* @brief Starts with an existing string buffer.
* @param __str A string to copy as a starting buffer.
* @param __m Whether the buffer can read, or write, or both.
*
* Initializes @c sb using @a __str and @c __m, and passes @c &sb
* to the base class initializer.
*
* That's a lie. We initialize the base class with NULL, because the
* string class does its own memory management.
*/
explicit
basic_stringstream(const __string_type& __str,
ios_base::openmode __m = ios_base::out | ios_base::in)
: __iostream_type(), _M_stringbuf(__str, __m)
{ this->init(&_M_stringbuf); }
/**
* @brief The destructor does nothing.
*
* The buffer is deallocated by the stringbuf object, not the
* formatting stream.
*/
~basic_stringstream()
{ }
#if __cplusplus >= 201103L
basic_stringstream(const basic_stringstream&) = delete;
basic_stringstream(basic_stringstream&& __rhs)
: __iostream_type(std::move(__rhs)),
_M_stringbuf(std::move(__rhs._M_stringbuf))
{ __iostream_type::set_rdbuf(&_M_stringbuf); }
// 27.8.3.2 Assign and swap:
basic_stringstream&
operator=(const basic_stringstream&) = delete;
basic_stringstream&
operator=(basic_stringstream&& __rhs)
{
__iostream_type::operator=(std::move(__rhs));
_M_stringbuf = std::move(__rhs._M_stringbuf);
return *this;
}
void
swap(basic_stringstream& __rhs)
{
__iostream_type::swap(__rhs);
_M_stringbuf.swap(__rhs._M_stringbuf);
}
#endif
// Members:
/**
* @brief Accessing the underlying buffer.
* @return The current basic_stringbuf buffer.
*
* This hides both signatures of std::basic_ios::rdbuf().
*/
__stringbuf_type*
rdbuf() const
{ return const_cast<__stringbuf_type*>(&_M_stringbuf); }
/**
* @brief Copying out the string buffer.
* @return @c rdbuf()->str()
*/
__string_type
str() const
{ return _M_stringbuf.str(); }
/**
* @brief Setting a new buffer.
* @param __s The string to use as a new sequence.
*
* Calls @c rdbuf()->str(s).
*/
void
str(const __string_type& __s)
{ _M_stringbuf.str(__s); }
};
#if __cplusplus >= 201103L
/// Swap specialization for stringbufs.
template <class _CharT, class _Traits, class _Allocator>
inline void
swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
{ __x.swap(__y); }
/// Swap specialization for istringstreams.
template <class _CharT, class _Traits, class _Allocator>
inline void
swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
basic_istringstream<_CharT, _Traits, _Allocator>& __y)
{ __x.swap(__y); }
/// Swap specialization for ostringstreams.
template <class _CharT, class _Traits, class _Allocator>
inline void
swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
{ __x.swap(__y); }
/// Swap specialization for stringstreams.
template <class _CharT, class _Traits, class _Allocator>
inline void
swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
basic_stringstream<_CharT, _Traits, _Allocator>& __y)
{ __x.swap(__y); }
#endif
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#include <bits/sstream.tcc>
#endif /* _GLIBCXX_SSTREAM */
// The -*- C++ -*- forwarding header.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file cerrno
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c errno.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
//
// ISO C++ 14882: 19.3 Error numbers
//
#pragma GCC system_header
#include <bits/c++config.h>
#include <errno.h>
#ifndef _GLIBCXX_CERRNO
#define _GLIBCXX_CERRNO 1
// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
#ifndef errno
#define errno errno
#endif
#endif
// ratio -*- C++ -*-
// Copyright (C) 2008-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/ratio
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_RATIO
#define _GLIBCXX_RATIO 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <type_traits>
#include <cstdint>
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup ratio Rational Arithmetic
* @ingroup utilities
*
* Compile time representation of finite rational numbers.
* @{
*/
template<intmax_t _Pn>
struct __static_sign
: integral_constant<intmax_t, (_Pn < 0) ? -1 : 1>
{ };
template<intmax_t _Pn>
struct __static_abs
: integral_constant<intmax_t, _Pn * __static_sign<_Pn>::value>
{ };
template<intmax_t _Pn, intmax_t _Qn>
struct __static_gcd
: __static_gcd<_Qn, (_Pn % _Qn)>
{ };
template<intmax_t _Pn>
struct __static_gcd<_Pn, 0>
: integral_constant<intmax_t, __static_abs<_Pn>::value>
{ };
template<intmax_t _Qn>
struct __static_gcd<0, _Qn>
: integral_constant<intmax_t, __static_abs<_Qn>::value>
{ };
// Let c = 2^(half # of bits in an intmax_t)
// then we find a1, a0, b1, b0 s.t. N = a1*c + a0, M = b1*c + b0
// The multiplication of N and M becomes,
// N * M = (a1 * b1)c^2 + (a0 * b1 + b0 * a1)c + a0 * b0
// Multiplication is safe if each term and the sum of the terms
// is representable by intmax_t.
template<intmax_t _Pn, intmax_t _Qn>
struct __safe_multiply
{
private:
static const uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4);
static const uintmax_t __a0 = __static_abs<_Pn>::value % __c;
static const uintmax_t __a1 = __static_abs<_Pn>::value / __c;
static const uintmax_t __b0 = __static_abs<_Qn>::value % __c;
static const uintmax_t __b1 = __static_abs<_Qn>::value / __c;
static_assert(__a1 == 0 || __b1 == 0,
"overflow in multiplication");
static_assert(__a0 * __b1 + __b0 * __a1 < (__c >> 1),
"overflow in multiplication");
static_assert(__b0 * __a0 <= __INTMAX_MAX__,
"overflow in multiplication");
static_assert((__a0 * __b1 + __b0 * __a1) * __c
<= __INTMAX_MAX__ - __b0 * __a0,
"overflow in multiplication");
public:
static const intmax_t value = _Pn * _Qn;
};
// Some double-precision utilities, where numbers are represented as
// __hi*2^(8*sizeof(uintmax_t)) + __lo.
template<uintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2>
struct __big_less
: integral_constant<bool, (__hi1 < __hi2
|| (__hi1 == __hi2 && __lo1 < __lo2))>
{ };
template<uintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2>
struct __big_add
{
static constexpr uintmax_t __lo = __lo1 + __lo2;
static constexpr uintmax_t __hi = (__hi1 + __hi2 +
(__lo1 + __lo2 < __lo1)); // carry
};
// Subtract a number from a bigger one.
template<uintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2>
struct __big_sub
{
static_assert(!__big_less<__hi1, __lo1, __hi2, __lo2>::value,
"Internal library error");
static constexpr uintmax_t __lo = __lo1 - __lo2;
static constexpr uintmax_t __hi = (__hi1 - __hi2 -
(__lo1 < __lo2)); // carry
};
// Same principle as __safe_multiply.
template<uintmax_t __x, uintmax_t __y>
struct __big_mul
{
private:
static constexpr uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4);
static constexpr uintmax_t __x0 = __x % __c;
static constexpr uintmax_t __x1 = __x / __c;
static constexpr uintmax_t __y0 = __y % __c;
static constexpr uintmax_t __y1 = __y / __c;
static constexpr uintmax_t __x0y0 = __x0 * __y0;
static constexpr uintmax_t __x0y1 = __x0 * __y1;
static constexpr uintmax_t __x1y0 = __x1 * __y0;
static constexpr uintmax_t __x1y1 = __x1 * __y1;
static constexpr uintmax_t __mix = __x0y1 + __x1y0; // possible carry...
static constexpr uintmax_t __mix_lo = __mix * __c;
static constexpr uintmax_t __mix_hi
= __mix / __c + ((__mix < __x0y1) ? __c : 0); // ... added here
typedef __big_add<__mix_hi, __mix_lo, __x1y1, __x0y0> _Res;
public:
static constexpr uintmax_t __hi = _Res::__hi;
static constexpr uintmax_t __lo = _Res::__lo;
};
// Adapted from __udiv_qrnnd_c in longlong.h
// This version assumes that the high bit of __d is 1.
template<uintmax_t __n1, uintmax_t __n0, uintmax_t __d>
struct __big_div_impl
{
private:
static_assert(__d >= (uintmax_t(1) << (sizeof(intmax_t) * 8 - 1)),
"Internal library error");
static_assert(__n1 < __d, "Internal library error");
static constexpr uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4);
static constexpr uintmax_t __d1 = __d / __c;
static constexpr uintmax_t __d0 = __d % __c;
static constexpr uintmax_t __q1x = __n1 / __d1;
static constexpr uintmax_t __r1x = __n1 % __d1;
static constexpr uintmax_t __m = __q1x * __d0;
static constexpr uintmax_t __r1y = __r1x * __c + __n0 / __c;
static constexpr uintmax_t __r1z = __r1y + __d;
static constexpr uintmax_t __r1
= ((__r1y < __m) ? ((__r1z >= __d) && (__r1z < __m))
? (__r1z + __d) : __r1z : __r1y) - __m;
static constexpr uintmax_t __q1
= __q1x - ((__r1y < __m)
? ((__r1z >= __d) && (__r1z < __m)) ? 2 : 1 : 0);
static constexpr uintmax_t __q0x = __r1 / __d1;
static constexpr uintmax_t __r0x = __r1 % __d1;
static constexpr uintmax_t __n = __q0x * __d0;
static constexpr uintmax_t __r0y = __r0x * __c + __n0 % __c;
static constexpr uintmax_t __r0z = __r0y + __d;
static constexpr uintmax_t __r0
= ((__r0y < __n) ? ((__r0z >= __d) && (__r0z < __n))
? (__r0z + __d) : __r0z : __r0y) - __n;
static constexpr uintmax_t __q0
= __q0x - ((__r0y < __n) ? ((__r0z >= __d)
&& (__r0z < __n)) ? 2 : 1 : 0);
public:
static constexpr uintmax_t __quot = __q1 * __c + __q0;
static constexpr uintmax_t __rem = __r0;
private:
typedef __big_mul<__quot, __d> _Prod;
typedef __big_add<_Prod::__hi, _Prod::__lo, 0, __rem> _Sum;
static_assert(_Sum::__hi == __n1 && _Sum::__lo == __n0,
"Internal library error");
};
template<uintmax_t __n1, uintmax_t __n0, uintmax_t __d>
struct __big_div
{
private:
static_assert(__d != 0, "Internal library error");
static_assert(sizeof (uintmax_t) == sizeof (unsigned long long),
"This library calls __builtin_clzll on uintmax_t, which "
"is unsafe on your platform. Please complain to "
"http://gcc.gnu.org/bugzilla/");
static constexpr int __shift = __builtin_clzll(__d);
static constexpr int __coshift_ = sizeof(uintmax_t) * 8 - __shift;
static constexpr int __coshift = (__shift != 0) ? __coshift_ : 0;
static constexpr uintmax_t __c1 = uintmax_t(1) << __shift;
static constexpr uintmax_t __c2 = uintmax_t(1) << __coshift;
static constexpr uintmax_t __new_d = __d * __c1;
static constexpr uintmax_t __new_n0 = __n0 * __c1;
static constexpr uintmax_t __n1_shifted = (__n1 % __d) * __c1;
static constexpr uintmax_t __n0_top = (__shift != 0) ? (__n0 / __c2) : 0;
static constexpr uintmax_t __new_n1 = __n1_shifted + __n0_top;
typedef __big_div_impl<__new_n1, __new_n0, __new_d> _Res;
public:
static constexpr uintmax_t __quot_hi = __n1 / __d;
static constexpr uintmax_t __quot_lo = _Res::__quot;
static constexpr uintmax_t __rem = _Res::__rem / __c1;
private:
typedef __big_mul<__quot_lo, __d> _P0;
typedef __big_mul<__quot_hi, __d> _P1;
typedef __big_add<_P0::__hi, _P0::__lo, _P1::__lo, __rem> _Sum;
// No overflow.
static_assert(_P1::__hi == 0, "Internal library error");
static_assert(_Sum::__hi >= _P0::__hi, "Internal library error");
// Matches the input data.
static_assert(_Sum::__hi == __n1 && _Sum::__lo == __n0,
"Internal library error");
static_assert(__rem < __d, "Internal library error");
};
/**
* @brief Provides compile-time rational arithmetic.
*
* This class template represents any finite rational number with a
* numerator and denominator representable by compile-time constants of
* type intmax_t. The ratio is simplified when instantiated.
*
* For example:
* @code
* std::ratio<7,-21>::num == -1;
* std::ratio<7,-21>::den == 3;
* @endcode
*
*/
template<intmax_t _Num, intmax_t _Den = 1>
struct ratio
{
static_assert(_Den != 0, "denominator cannot be zero");
static_assert(_Num >= -__INTMAX_MAX__ && _Den >= -__INTMAX_MAX__,
"out of range");
// Note: sign(N) * abs(N) == N
static constexpr intmax_t num =
_Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value;
static constexpr intmax_t den =
__static_abs<_Den>::value / __static_gcd<_Num, _Den>::value;
typedef ratio<num, den> type;
};
template<intmax_t _Num, intmax_t _Den>
constexpr intmax_t ratio<_Num, _Den>::num;
template<intmax_t _Num, intmax_t _Den>
constexpr intmax_t ratio<_Num, _Den>::den;
template<typename _R1, typename _R2>
struct __ratio_multiply
{
private:
static const intmax_t __gcd1 =
__static_gcd<_R1::num, _R2::den>::value;
static const intmax_t __gcd2 =
__static_gcd<_R2::num, _R1::den>::value;
public:
typedef ratio<
__safe_multiply<(_R1::num / __gcd1),
(_R2::num / __gcd2)>::value,
__safe_multiply<(_R1::den / __gcd2),
(_R2::den / __gcd1)>::value> type;
static constexpr intmax_t num = type::num;
static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_multiply<_R1, _R2>::num;
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_multiply<_R1, _R2>::den;
/// ratio_multiply
template<typename _R1, typename _R2>
using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type;
template<typename _R1, typename _R2>
struct __ratio_divide
{
static_assert(_R2::num != 0, "division by 0");
typedef typename __ratio_multiply<
_R1,
ratio<_R2::den, _R2::num>>::type type;
static constexpr intmax_t num = type::num;
static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_divide<_R1, _R2>::num;
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_divide<_R1, _R2>::den;
/// ratio_divide
template<typename _R1, typename _R2>
using ratio_divide = typename __ratio_divide<_R1, _R2>::type;
/// ratio_equal
template<typename _R1, typename _R2>
struct ratio_equal
: integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den>
{ };
/// ratio_not_equal
template<typename _R1, typename _R2>
struct ratio_not_equal
: integral_constant<bool, !ratio_equal<_R1, _R2>::value>
{ };
// Both numbers are positive.
template<typename _R1, typename _R2,
typename _Left = __big_mul<_R1::num,_R2::den>,
typename _Right = __big_mul<_R2::num,_R1::den> >
struct __ratio_less_impl_1
: integral_constant<bool, __big_less<_Left::__hi, _Left::__lo,
_Right::__hi, _Right::__lo>::value>
{ };
template<typename _R1, typename _R2,
bool = (_R1::num == 0 || _R2::num == 0
|| (__static_sign<_R1::num>::value
!= __static_sign<_R2::num>::value)),
bool = (__static_sign<_R1::num>::value == -1
&& __static_sign<_R2::num>::value == -1)>
struct __ratio_less_impl
: __ratio_less_impl_1<_R1, _R2>::type
{ };
template<typename _R1, typename _R2>
struct __ratio_less_impl<_R1, _R2, true, false>
: integral_constant<bool, _R1::num < _R2::num>
{ };
template<typename _R1, typename _R2>
struct __ratio_less_impl<_R1, _R2, false, true>
: __ratio_less_impl_1<ratio<-_R2::num, _R2::den>,
ratio<-_R1::num, _R1::den> >::type
{ };
/// ratio_less
template<typename _R1, typename _R2>
struct ratio_less
: __ratio_less_impl<_R1, _R2>::type
{ };
/// ratio_less_equal
template<typename _R1, typename _R2>
struct ratio_less_equal
: integral_constant<bool, !ratio_less<_R2, _R1>::value>
{ };
/// ratio_greater
template<typename _R1, typename _R2>
struct ratio_greater
: integral_constant<bool, ratio_less<_R2, _R1>::value>
{ };
/// ratio_greater_equal
template<typename _R1, typename _R2>
struct ratio_greater_equal
: integral_constant<bool, !ratio_less<_R1, _R2>::value>
{ };
#if __cplusplus > 201402L
template <typename _R1, typename _R2>
inline constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value;
template <typename _R1, typename _R2>
inline constexpr bool ratio_not_equal_v = ratio_not_equal<_R1, _R2>::value;
template <typename _R1, typename _R2>
inline constexpr bool ratio_less_v = ratio_less<_R1, _R2>::value;
template <typename _R1, typename _R2>
inline constexpr bool ratio_less_equal_v =
ratio_less_equal<_R1, _R2>::value;
template <typename _R1, typename _R2>
inline constexpr bool ratio_greater_v = ratio_greater<_R1, _R2>::value;
template <typename _R1, typename _R2>
inline constexpr bool ratio_greater_equal_v
= ratio_greater_equal<_R1, _R2>::value;
#endif // C++17
template<typename _R1, typename _R2,
bool = (_R1::num >= 0),
bool = (_R2::num >= 0),
bool = ratio_less<ratio<__static_abs<_R1::num>::value, _R1::den>,
ratio<__static_abs<_R2::num>::value, _R2::den> >::value>
struct __ratio_add_impl
{
private:
typedef typename __ratio_add_impl<
ratio<-_R1::num, _R1::den>,
ratio<-_R2::num, _R2::den> >::type __t;
public:
typedef ratio<-__t::num, __t::den> type;
};
// True addition of nonnegative numbers.
template<typename _R1, typename _R2, bool __b>
struct __ratio_add_impl<_R1, _R2, true, true, __b>
{
private:
static constexpr uintmax_t __g = __static_gcd<_R1::den, _R2::den>::value;
static constexpr uintmax_t __d2 = _R2::den / __g;
typedef __big_mul<_R1::den, __d2> __d;
typedef __big_mul<_R1::num, _R2::den / __g> __x;
typedef __big_mul<_R2::num, _R1::den / __g> __y;
typedef __big_add<__x::__hi, __x::__lo, __y::__hi, __y::__lo> __n;
static_assert(__n::__hi >= __x::__hi, "Internal library error");
typedef __big_div<__n::__hi, __n::__lo, __g> __ng;
static constexpr uintmax_t __g2 = __static_gcd<__ng::__rem, __g>::value;
typedef __big_div<__n::__hi, __n::__lo, __g2> __n_final;
static_assert(__n_final::__rem == 0, "Internal library error");
static_assert(__n_final::__quot_hi == 0 &&
__n_final::__quot_lo <= __INTMAX_MAX__, "overflow in addition");
typedef __big_mul<_R1::den / __g2, __d2> __d_final;
static_assert(__d_final::__hi == 0 &&
__d_final::__lo <= __INTMAX_MAX__, "overflow in addition");
public:
typedef ratio<__n_final::__quot_lo, __d_final::__lo> type;
};
template<typename _R1, typename _R2>
struct __ratio_add_impl<_R1, _R2, false, true, true>
: __ratio_add_impl<_R2, _R1>
{ };
// True subtraction of nonnegative numbers yielding a nonnegative result.
template<typename _R1, typename _R2>
struct __ratio_add_impl<_R1, _R2, true, false, false>
{
private:
static constexpr uintmax_t __g = __static_gcd<_R1::den, _R2::den>::value;
static constexpr uintmax_t __d2 = _R2::den / __g;
typedef __big_mul<_R1::den, __d2> __d;
typedef __big_mul<_R1::num, _R2::den / __g> __x;
typedef __big_mul<-_R2::num, _R1::den / __g> __y;
typedef __big_sub<__x::__hi, __x::__lo, __y::__hi, __y::__lo> __n;
typedef __big_div<__n::__hi, __n::__lo, __g> __ng;
static constexpr uintmax_t __g2 = __static_gcd<__ng::__rem, __g>::value;
typedef __big_div<__n::__hi, __n::__lo, __g2> __n_final;
static_assert(__n_final::__rem == 0, "Internal library error");
static_assert(__n_final::__quot_hi == 0 &&
__n_final::__quot_lo <= __INTMAX_MAX__, "overflow in addition");
typedef __big_mul<_R1::den / __g2, __d2> __d_final;
static_assert(__d_final::__hi == 0 &&
__d_final::__lo <= __INTMAX_MAX__, "overflow in addition");
public:
typedef ratio<__n_final::__quot_lo, __d_final::__lo> type;
};
template<typename _R1, typename _R2>
struct __ratio_add
{
typedef typename __ratio_add_impl<_R1, _R2>::type type;
static constexpr intmax_t num = type::num;
static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_add<_R1, _R2>::num;
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_add<_R1, _R2>::den;
/// ratio_add
template<typename _R1, typename _R2>
using ratio_add = typename __ratio_add<_R1, _R2>::type;
template<typename _R1, typename _R2>
struct __ratio_subtract
{
typedef typename __ratio_add<
_R1,
ratio<-_R2::num, _R2::den>>::type type;
static constexpr intmax_t num = type::num;
static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_subtract<_R1, _R2>::num;
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_subtract<_R1, _R2>::den;
/// ratio_subtract
template<typename _R1, typename _R2>
using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type;
typedef ratio<1, 1000000000000000000> atto;
typedef ratio<1, 1000000000000000> femto;
typedef ratio<1, 1000000000000> pico;
typedef ratio<1, 1000000000> nano;
typedef ratio<1, 1000000> micro;
typedef ratio<1, 1000> milli;
typedef ratio<1, 100> centi;
typedef ratio<1, 10> deci;
typedef ratio< 10, 1> deca;
typedef ratio< 100, 1> hecto;
typedef ratio< 1000, 1> kilo;
typedef ratio< 1000000, 1> mega;
typedef ratio< 1000000000, 1> giga;
typedef ratio< 1000000000000, 1> tera;
typedef ratio< 1000000000000000, 1> peta;
typedef ratio< 1000000000000000000, 1> exa;
// @} group ratio
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif //_GLIBCXX_USE_C99_STDINT_TR1
#endif // C++11
#endif //_GLIBCXX_RATIO
// -*- C++ -*- forwarding header.
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/cuchar
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c uchar.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
//
// ISO C++ 14882:2011 21.8
//
#ifndef _GLIBCXX_CUCHAR
#define _GLIBCXX_CUCHAR 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <bits/c++config.h>
#include <cwchar>
#if _GLIBCXX_USE_C11_UCHAR_CXX11
#include <uchar.h>
// Get rid of those macros defined in <uchar.h> in lieu of real functions.
#undef mbrtoc16
#undef c16rtomb
#undef mbrtoc32
#undef c32rtomb
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using ::mbrtoc16;
using ::c16rtomb;
using ::mbrtoc32;
using ::c32rtomb;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
#endif // C++11
#endif // _GLIBCXX_CUCHAR
// <utility> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file include/utility
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_UTILITY
#define _GLIBCXX_UTILITY 1
#pragma GCC system_header
/**
* @defgroup utilities Utilities
*
* Components deemed generally useful. Includes pair, tuple,
* forward/move helpers, ratio, function object, metaprogramming and
* type traits, time, date, and memory functions.
*/
#include <bits/c++config.h>
#include <bits/stl_relops.h>
#include <bits/stl_pair.h>
#if __cplusplus >= 201103L
#include <type_traits>
#include <bits/move.h>
#include <initializer_list>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Finds the size of a given tuple type.
template<typename _Tp>
struct tuple_size;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2313. tuple_size should always derive from integral_constant<size_t, N>
// 2770. tuple_size<const T> specialization is not SFINAE compatible
template<typename _Tp,
typename _Up = typename remove_cv<_Tp>::type,
typename = typename enable_if<is_same<_Tp, _Up>::value>::type,
size_t = tuple_size<_Tp>::value>
using __enable_if_has_tuple_size = _Tp;
template<typename _Tp>
struct tuple_size<const __enable_if_has_tuple_size<_Tp>>
: public tuple_size<_Tp> { };
template<typename _Tp>
struct tuple_size<volatile __enable_if_has_tuple_size<_Tp>>
: public tuple_size<_Tp> { };
template<typename _Tp>
struct tuple_size<const volatile __enable_if_has_tuple_size<_Tp>>
: public tuple_size<_Tp> { };
/// Gives the type of the ith element of a given tuple type.
template<std::size_t __i, typename _Tp>
struct tuple_element;
// Duplicate of C++14's tuple_element_t for internal use in C++11 mode
template<std::size_t __i, typename _Tp>
using __tuple_element_t = typename tuple_element<__i, _Tp>::type;
template<std::size_t __i, typename _Tp>
struct tuple_element<__i, const _Tp>
{
typedef typename add_const<__tuple_element_t<__i, _Tp>>::type type;
};
template<std::size_t __i, typename _Tp>
struct tuple_element<__i, volatile _Tp>
{
typedef typename add_volatile<__tuple_element_t<__i, _Tp>>::type type;
};
template<std::size_t __i, typename _Tp>
struct tuple_element<__i, const volatile _Tp>
{
typedef typename add_cv<__tuple_element_t<__i, _Tp>>::type type;
};
#if __cplusplus > 201103L
#define __cpp_lib_tuple_element_t 201402
template<std::size_t __i, typename _Tp>
using tuple_element_t = typename tuple_element<__i, _Tp>::type;
#endif
// Various functions which give std::pair a tuple-like interface.
/// Partial specialization for std::pair
template<typename _T1, typename _T2>
struct __is_tuple_like_impl<std::pair<_T1, _T2>> : true_type
{ };
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2>>
: public integral_constant<std::size_t, 2> { };
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2>>
{ typedef _Tp1 type; };
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2>>
{ typedef _Tp2 type; };
template<std::size_t _Int>
struct __pair_get;
template<>
struct __pair_get<0>
{
template<typename _Tp1, typename _Tp2>
static constexpr _Tp1&
__get(std::pair<_Tp1, _Tp2>& __pair) noexcept
{ return __pair.first; }
template<typename _Tp1, typename _Tp2>
static constexpr _Tp1&&
__move_get(std::pair<_Tp1, _Tp2>&& __pair) noexcept
{ return std::forward<_Tp1>(__pair.first); }
template<typename _Tp1, typename _Tp2>
static constexpr const _Tp1&
__const_get(const std::pair<_Tp1, _Tp2>& __pair) noexcept
{ return __pair.first; }
template<typename _Tp1, typename _Tp2>
static constexpr const _Tp1&&
__const_move_get(const std::pair<_Tp1, _Tp2>&& __pair) noexcept
{ return std::forward<const _Tp1>(__pair.first); }
};
template<>
struct __pair_get<1>
{
template<typename _Tp1, typename _Tp2>
static constexpr _Tp2&
__get(std::pair<_Tp1, _Tp2>& __pair) noexcept
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static constexpr _Tp2&&
__move_get(std::pair<_Tp1, _Tp2>&& __pair) noexcept
{ return std::forward<_Tp2>(__pair.second); }
template<typename _Tp1, typename _Tp2>
static constexpr const _Tp2&
__const_get(const std::pair<_Tp1, _Tp2>& __pair) noexcept
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static constexpr const _Tp2&&
__const_move_get(const std::pair<_Tp1, _Tp2>&& __pair) noexcept
{ return std::forward<const _Tp2>(__pair.second); }
};
template<std::size_t _Int, class _Tp1, class _Tp2>
constexpr typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type&
get(std::pair<_Tp1, _Tp2>& __in) noexcept
{ return __pair_get<_Int>::__get(__in); }
template<std::size_t _Int, class _Tp1, class _Tp2>
constexpr typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type&&
get(std::pair<_Tp1, _Tp2>&& __in) noexcept
{ return __pair_get<_Int>::__move_get(std::move(__in)); }
template<std::size_t _Int, class _Tp1, class _Tp2>
constexpr const typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type&
get(const std::pair<_Tp1, _Tp2>& __in) noexcept
{ return __pair_get<_Int>::__const_get(__in); }
template<std::size_t _Int, class _Tp1, class _Tp2>
constexpr const typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type&&
get(const std::pair<_Tp1, _Tp2>&& __in) noexcept
{ return __pair_get<_Int>::__const_move_get(std::move(__in)); }
#if __cplusplus > 201103L
#define __cpp_lib_tuples_by_type 201304
template <typename _Tp, typename _Up>
constexpr _Tp&
get(pair<_Tp, _Up>& __p) noexcept
{ return __p.first; }
template <typename _Tp, typename _Up>
constexpr const _Tp&
get(const pair<_Tp, _Up>& __p) noexcept
{ return __p.first; }
template <typename _Tp, typename _Up>
constexpr _Tp&&
get(pair<_Tp, _Up>&& __p) noexcept
{ return std::move(__p.first); }
template <typename _Tp, typename _Up>
constexpr const _Tp&&
get(const pair<_Tp, _Up>&& __p) noexcept
{ return std::move(__p.first); }
template <typename _Tp, typename _Up>
constexpr _Tp&
get(pair<_Up, _Tp>& __p) noexcept
{ return __p.second; }
template <typename _Tp, typename _Up>
constexpr const _Tp&
get(const pair<_Up, _Tp>& __p) noexcept
{ return __p.second; }
template <typename _Tp, typename _Up>
constexpr _Tp&&
get(pair<_Up, _Tp>&& __p) noexcept
{ return std::move(__p.second); }
template <typename _Tp, typename _Up>
constexpr const _Tp&&
get(const pair<_Up, _Tp>&& __p) noexcept
{ return std::move(__p.second); }
#define __cpp_lib_exchange_function 201304
/// Assign @p __new_val to @p __obj and return its previous value.
template <typename _Tp, typename _Up = _Tp>
inline _Tp
exchange(_Tp& __obj, _Up&& __new_val)
{ return std::__exchange(__obj, std::forward<_Up>(__new_val)); }
#endif
// Stores a tuple of indices. Used by tuple and pair, and by bind() to
// extract the elements in a tuple.
template<size_t... _Indexes> struct _Index_tuple { };
#ifdef __has_builtin
# if __has_builtin(__make_integer_seq)
# define _GLIBCXX_USE_MAKE_INTEGER_SEQ 1
# endif
#endif
// Builds an _Index_tuple<0, 1, 2, ..., _Num-1>.
template<size_t _Num>
struct _Build_index_tuple
{
#if _GLIBCXX_USE_MAKE_INTEGER_SEQ
template<typename, size_t... _Indices>
using _IdxTuple = _Index_tuple<_Indices...>;
using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
#else
using __type = _Index_tuple<__integer_pack(_Num)...>;
#endif
};
#if __cplusplus > 201103L
#define __cpp_lib_integer_sequence 201304
/// Class template integer_sequence
template<typename _Tp, _Tp... _Idx>
struct integer_sequence
{
typedef _Tp value_type;
static constexpr size_t size() noexcept { return sizeof...(_Idx); }
};
/// Alias template make_integer_sequence
template<typename _Tp, _Tp _Num>
using make_integer_sequence
#if _GLIBCXX_USE_MAKE_INTEGER_SEQ
= __make_integer_seq<integer_sequence, _Tp, _Num>;
#else
= integer_sequence<_Tp, __integer_pack(_Num)...>;
#endif
#undef _GLIBCXX_USE_MAKE_INTEGER_SEQ
/// Alias template index_sequence
template<size_t... _Idx>
using index_sequence = integer_sequence<size_t, _Idx...>;
/// Alias template make_index_sequence
template<size_t _Num>
using make_index_sequence = make_integer_sequence<size_t, _Num>;
/// Alias template index_sequence_for
template<typename... _Types>
using index_sequence_for = make_index_sequence<sizeof...(_Types)>;
#endif
#if __cplusplus > 201402L
struct in_place_t {
explicit in_place_t() = default;
};
inline constexpr in_place_t in_place{};
template<typename _Tp> struct in_place_type_t
{
explicit in_place_type_t() = default;
};
template<typename _Tp>
inline constexpr in_place_type_t<_Tp> in_place_type{};
template<size_t _Idx> struct in_place_index_t
{
explicit in_place_index_t() = default;
};
template<size_t _Idx>
inline constexpr in_place_index_t<_Idx> in_place_index{};
template<typename>
struct __is_in_place_type_impl : false_type
{ };
template<typename _Tp>
struct __is_in_place_type_impl<in_place_type_t<_Tp>> : true_type
{ };
template<typename _Tp>
struct __is_in_place_type
: public __is_in_place_type_impl<_Tp>
{ };
#define __cpp_lib_as_const 201510
template<typename _Tp>
constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
template<typename _Tp>
void as_const(const _Tp&&) = delete;
#endif // C++17
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
#endif /* _GLIBCXX_UTILITY */
// -*- C++ -*- forwarding header.
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ciso646
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c iso646.h,
* which is empty in C++.
*/
#ifndef _GLIBCXX_CISO646
#define _GLIBCXX_CISO646
#pragma GCC system_header
#include <bits/c++config.h>
#endif
// <array> -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/array
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_ARRAY
#define _GLIBCXX_ARRAY 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <utility>
#include <stdexcept>
#include <bits/stl_algobase.h>
#include <bits/range_access.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, std::size_t _Nm>
struct __array_traits
{
typedef _Tp _Type[_Nm];
typedef __is_swappable<_Tp> _Is_swappable;
typedef __is_nothrow_swappable<_Tp> _Is_nothrow_swappable;
static constexpr _Tp&
_S_ref(const _Type& __t, std::size_t __n) noexcept
{ return const_cast<_Tp&>(__t[__n]); }
static constexpr _Tp*
_S_ptr(const _Type& __t) noexcept
{ return const_cast<_Tp*>(__t); }
};
template<typename _Tp>
struct __array_traits<_Tp, 0>
{
struct _Type { };
typedef true_type _Is_swappable;
typedef true_type _Is_nothrow_swappable;
static constexpr _Tp&
_S_ref(const _Type&, std::size_t) noexcept
{ return *static_cast<_Tp*>(nullptr); }
static constexpr _Tp*
_S_ptr(const _Type&) noexcept
{ return nullptr; }
};
/**
* @brief A standard container for storing a fixed size sequence of elements.
*
* @ingroup sequences
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
* <a href="tables.html#66">reversible container</a>, and a
* <a href="tables.html#67">sequence</a>.
*
* Sets support random access iterators.
*
* @tparam Tp Type of element. Required to be a complete type.
* @tparam N Number of elements.
*/
template<typename _Tp, std::size_t _Nm>
struct array
{
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Support for zero-sized arrays mandatory.
typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type;
typename _AT_Type::_Type _M_elems;
// No explicit construct/copy/destroy for aggregate type.
// DR 776.
void
fill(const value_type& __u)
{ std::fill_n(begin(), size(), __u); }
void
swap(array& __other)
noexcept(_AT_Type::_Is_nothrow_swappable::value)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
_GLIBCXX17_CONSTEXPR iterator
begin() noexcept
{ return iterator(data()); }
_GLIBCXX17_CONSTEXPR const_iterator
begin() const noexcept
{ return const_iterator(data()); }
_GLIBCXX17_CONSTEXPR iterator
end() noexcept
{ return iterator(data() + _Nm); }
_GLIBCXX17_CONSTEXPR const_iterator
end() const noexcept
{ return const_iterator(data() + _Nm); }
_GLIBCXX17_CONSTEXPR reverse_iterator
rbegin() noexcept
{ return reverse_iterator(end()); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
rbegin() const noexcept
{ return const_reverse_iterator(end()); }
_GLIBCXX17_CONSTEXPR reverse_iterator
rend() noexcept
{ return reverse_iterator(begin()); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
rend() const noexcept
{ return const_reverse_iterator(begin()); }
_GLIBCXX17_CONSTEXPR const_iterator
cbegin() const noexcept
{ return const_iterator(data()); }
_GLIBCXX17_CONSTEXPR const_iterator
cend() const noexcept
{ return const_iterator(data() + _Nm); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(end()); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(begin()); }
// Capacity.
constexpr size_type
size() const noexcept { return _Nm; }
constexpr size_type
max_size() const noexcept { return _Nm; }
constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.
_GLIBCXX17_CONSTEXPR reference
operator[](size_type __n) noexcept
{ return _AT_Type::_S_ref(_M_elems, __n); }
constexpr const_reference
operator[](size_type __n) const noexcept
{ return _AT_Type::_S_ref(_M_elems, __n); }
_GLIBCXX17_CONSTEXPR reference
at(size_type __n)
{
if (__n >= _Nm)
std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
">= _Nm (which is %zu)"),
__n, _Nm);
return _AT_Type::_S_ref(_M_elems, __n);
}
constexpr const_reference
at(size_type __n) const
{
// Result of conditional expression must be an lvalue so use
// boolean ? lvalue : (throw-expr, lvalue)
return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
: (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
">= _Nm (which is %zu)"),
__n, _Nm),
_AT_Type::_S_ref(_M_elems, 0));
}
_GLIBCXX17_CONSTEXPR reference
front() noexcept
{ return *begin(); }
constexpr const_reference
front() const noexcept
{ return _AT_Type::_S_ref(_M_elems, 0); }
_GLIBCXX17_CONSTEXPR reference
back() noexcept
{ return _Nm ? *(end() - 1) : *end(); }
constexpr const_reference
back() const noexcept
{
return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
: _AT_Type::_S_ref(_M_elems, 0);
}
_GLIBCXX17_CONSTEXPR pointer
data() noexcept
{ return _AT_Type::_S_ptr(_M_elems); }
_GLIBCXX17_CONSTEXPR const_pointer
data() const noexcept
{ return _AT_Type::_S_ptr(_M_elems); }
};
#if __cpp_deduction_guides >= 201606
template<typename _Tp, typename... _Up>
array(_Tp, _Up...)
-> array<enable_if_t<(is_same_v<_Tp, _Up> && ...), _Tp>,
1 + sizeof...(_Up)>;
#endif
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
__b.begin(), __b.end());
}
template<typename _Tp, std::size_t _Nm>
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms.
template<typename _Tp, std::size_t _Nm>
inline
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
// Constrained free swap overload, see p0185r1
typename enable_if<
_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value
>::type
#else
void
#endif
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
noexcept(noexcept(__one.swap(__two)))
{ __one.swap(__two); }
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
template<typename _Tp, std::size_t _Nm>
typename enable_if<
!_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type
swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
#endif
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr _Tp&
get(array<_Tp, _Nm>& __arr) noexcept
{
static_assert(_Int < _Nm, "array index is within bounds");
return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::
_S_ref(__arr._M_elems, _Int);
}
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr _Tp&&
get(array<_Tp, _Nm>&& __arr) noexcept
{
static_assert(_Int < _Nm, "array index is within bounds");
return std::move(_GLIBCXX_STD_C::get<_Int>(__arr));
}
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr const _Tp&
get(const array<_Tp, _Nm>& __arr) noexcept
{
static_assert(_Int < _Nm, "array index is within bounds");
return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::
_S_ref(__arr._M_elems, _Int);
}
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr const _Tp&&
get(const array<_Tp, _Nm>&& __arr) noexcept
{
static_assert(_Int < _Nm, "array index is within bounds");
return std::move(_GLIBCXX_STD_C::get<_Int>(__arr));
}
_GLIBCXX_END_NAMESPACE_CONTAINER
} // namespace std
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Tuple interface to class template array.
/// tuple_size
template<typename _Tp>
struct tuple_size;
/// Partial specialization for std::array
template<typename _Tp, std::size_t _Nm>
struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>>
: public integral_constant<std::size_t, _Nm> { };
/// tuple_element
template<std::size_t _Int, typename _Tp>
struct tuple_element;
/// Partial specialization for std::array
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>>
{
static_assert(_Int < _Nm, "index is out of bounds");
typedef _Tp type;
};
template<typename _Tp, std::size_t _Nm>
struct __is_tuple_like_impl<_GLIBCXX_STD_C::array<_Tp, _Nm>> : true_type
{ };
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#ifdef _GLIBCXX_DEBUG
# include <debug/array>
#endif
#ifdef _GLIBCXX_PROFILE
# include <profile/array>
#endif
#endif // C++11
#endif // _GLIBCXX_ARRAY
// <map> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file include/map
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_MAP
#define _GLIBCXX_MAP 1
#pragma GCC system_header
#include <bits/stl_tree.h>
#include <bits/stl_map.h>
#include <bits/stl_multimap.h>
#include <bits/range_access.h>
#ifdef _GLIBCXX_DEBUG
# include <debug/map>
#endif
#ifdef _GLIBCXX_PROFILE
# include <profile/map>
#endif
#endif /* _GLIBCXX_MAP */
// Profiling deque implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/deque
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_DEQUE
#define _GLIBCXX_PROFILE_DEQUE 1
#include <deque>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::deque wrapper with performance instrumentation.
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
class deque
: public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
{
typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::value_type value_type;
// 23.2.1.1 construct/copy/destroy:
#if __cplusplus < 201103L
deque()
: _Base() { }
deque(const deque& __x)
: _Base(__x) { }
~deque() { }
#else
deque() = default;
deque(const deque&) = default;
deque(deque&&) = default;
deque(const deque& __d, const _Allocator& __a)
: _Base(__d, __a) { }
deque(deque&& __d, const _Allocator& __a)
: _Base(std::move(__d), __a) { }
~deque() = default;
deque(initializer_list<value_type> __l,
const _Allocator& __a = _Allocator())
: _Base(__l, __a) { }
#endif
explicit
deque(const _Allocator& __a)
: _Base(__a) { }
#if __cplusplus >= 201103L
explicit
deque(size_type __n, const _Allocator& __a = _Allocator())
: _Base(__n, __a) { }
deque(size_type __n, const _Tp& __value,
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#else
explicit
deque(size_type __n, const _Tp& __value = _Tp(),
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#endif
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
deque(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __a)
{ }
deque(const _Base& __x)
: _Base(__x) { }
#if __cplusplus < 201103L
deque&
operator=(const deque& __x)
{
_M_base() = __x;
return *this;
}
#else
deque&
operator=(const deque&) = default;
deque&
operator=(deque&&) = default;
deque&
operator=(initializer_list<value_type> __l)
{
_M_base() = __l;
return *this;
}
#endif
void
swap(deque& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{ _Base::swap(__x); }
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
template<typename _Tp, typename _Alloc>
inline bool
operator==(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator!=(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<=(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>=(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
} // namespace __profile
} // namespace std
#endif
// Profiling multimap implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/multimap.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_MULTIMAP_H
#define _GLIBCXX_PROFILE_MULTIMAP_H 1
#include <profile/base.h>
#include <profile/ordered_base.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::multimap wrapper with performance instrumentation.
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
class multimap
: public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>,
public _Ordered_profile<map<_Key, _Tp, _Compare, _Allocator> >
{
typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_iterator _Base_const_iterator;
public:
// types:
typedef _Key key_type;
typedef _Tp mapped_type;
typedef std::pair<const _Key, _Tp> value_type;
typedef _Compare key_compare;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __iterator_tracker<_Base_iterator,
multimap> iterator;
typedef __iterator_tracker<_Base_const_iterator,
multimap> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
// 23.3.1.1 construct/copy/destroy:
#if __cplusplus < 201103L
multimap()
: _Base() { }
multimap(const multimap& __x)
: _Base(__x) { }
~multimap() { }
#else
multimap() = default;
multimap(const multimap&) = default;
multimap(multimap&&) = default;
~multimap() = default;
#endif
explicit multimap(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __comp, __a) { }
#if __cplusplus >= 201103L
multimap(initializer_list<value_type> __l,
const _Compare& __c = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__l, __c, __a) { }
explicit
multimap(const _Allocator& __a)
: _Base(__a) { }
multimap(const multimap& __x, const _Allocator& __a)
: _Base(__x, __a) { }
multimap(multimap&& __x, const _Allocator& __a)
noexcept( noexcept(_Base(std::move(__x), __a)) )
: _Base(std::move(__x), __a) { }
multimap(initializer_list<value_type> __l, const _Allocator& __a)
: _Base(__l, __a) { }
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Allocator& __a)
: _Base(__first, __last, __a) { }
#endif
multimap(const _Base& __x)
: _Base(__x) { }
#if __cplusplus < 201103L
multimap&
operator=(const multimap& __x)
{
this->_M_profile_destruct();
_M_base() = __x;
this->_M_profile_construct();
return *this;
}
#else
multimap&
operator=(const multimap&) = default;
multimap&
operator=(multimap&&) = default;
multimap&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
#endif
// iterators
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
#if __cplusplus >= 201103L
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::cbegin(), this); }
const_iterator
cend() const noexcept
{ return const_iterator(_Base::cend(), this); }
#endif
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(end());
}
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(end());
}
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(begin());
}
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(begin());
}
#if __cplusplus >= 201103L
const_reverse_iterator
crbegin() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cend());
}
const_reverse_iterator
crend() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cbegin());
}
#endif
// modifiers:
#if __cplusplus >= 201103L
template<typename... _Args>
iterator
emplace(_Args&&... __args)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::emplace(std::forward<_Args>(__args)...), this);
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __pos, _Args&&... __args)
{
auto size_before = this->size();
auto __res
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
iterator
insert(const value_type& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::insert(__x), this);
}
#if __cplusplus >= 201103L
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
iterator
insert(_Pair&& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::insert(std::forward<_Pair>(__x)), this);
}
#endif
#if __cplusplus >= 201103L
void
insert(std::initializer_list<value_type> __list)
{ insert(__list.begin(), __list.end()); }
#endif
iterator
#if __cplusplus >= 201103L
insert(const_iterator __pos, const value_type& __x)
#else
insert(iterator __pos, const value_type& __x)
#endif
{
size_type size_before = this->size();
_Base_iterator __res = _Base::insert(__pos.base(), __x);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#if __cplusplus >= 201103L
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
iterator
insert(const_iterator __pos, _Pair&& __x)
{
size_type size_before = this->size();
auto __res = _Base::insert(__pos.base(), std::forward<_Pair>(__x));
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
for (; __first != __last; ++__first)
insert(*__first);
}
#if __cplusplus >= 201103L
iterator
erase(const_iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::erase(__pos.base()), this);
}
iterator
erase(iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::erase(__pos.base()), this);
}
#else
void
erase(iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
_Base::erase(__pos.base());
}
#endif
size_type
erase(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return _Base::erase(__x);
}
#if __cplusplus >= 201103L
iterator
erase(const_iterator __first, const_iterator __last)
{
if (__first != __last)
{
iterator __ret;
for (; __first != __last;)
__ret = erase(__first++);
return __ret;
}
else
return iterator(_Base::erase(__first.base(), __last.base()), this);
}
#else
void
erase(iterator __first, iterator __last)
{
for (; __first != __last;)
erase(__first++);
}
#endif
void
swap(multimap& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{
std::swap(this->_M_map2umap_info, __x._M_map2umap_info);
_Base::swap(__x);
}
void
clear() _GLIBCXX_NOEXCEPT
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
// 23.3.1.3 multimap operations:
iterator
find(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return iterator(_Base::find(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
find(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
#endif
const_iterator
find(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return const_iterator(_Base::find(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
find(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
#endif
size_type
count(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
size_type
count(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#endif
iterator
lower_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::lower_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
lower_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
#endif
const_iterator
lower_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::lower_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
lower_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
#endif
iterator
upper_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::upper_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
upper_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
#endif
const_iterator
upper_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::upper_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
upper_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
#endif
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_iterator, _Base_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(iterator(__base_ret.first, this),
iterator(__base_ret.second, this));
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<iterator, iterator>
equal_range(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
#endif
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(const_iterator(__base_ret.first, this),
const_iterator(__base_ret.second, this));
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<const_iterator, const_iterator>
equal_range(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
#endif
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
private:
/** If hint is used we consider that the map and unordered_map
* operations have equivalent insertion cost so we do not update metrics
* about it.
* Note that to find out if hint has been used is libstdc++
* implementation dependent.
*/
bool
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
{
return (__hint == __res
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|| (__hint != _M_base().end() && (++__hint == __res
|| ++__res == --__hint)));
}
template<typename _K1, typename _T1, typename _C1, typename _A1>
friend bool
operator==(const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
template<typename _K1, typename _T1, typename _C1, typename _A1>
friend bool
operator<(const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
};
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() == __rhs._M_base();
}
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() < __rhs._M_base();
}
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return !(__lhs < __rhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __rhs < __lhs; }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
} // namespace __profile
} // namespace std
#endif
// <forward_list> -*- C++ -*-
// Copyright (C) 2010-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/forward_list
* This file is a GNU debug extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_FORWARD_LIST
#define _GLIBCXX_PROFILE_FORWARD_LIST 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <forward_list>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::forward_list wrapper with performance instrumentation.
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class forward_list
: public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc>
{
typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base;
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::const_iterator const_iterator;
// 23.2.3.1 construct/copy/destroy:
forward_list() = default;
explicit
forward_list(const _Alloc& __al) noexcept
: _Base(__al) { }
forward_list(const forward_list& __list, const _Alloc& __al)
: _Base(__list, __al)
{ }
forward_list(forward_list&& __list, const _Alloc& __al)
: _Base(std::move(__list), __al)
{ }
explicit
forward_list(size_type __n, const _Alloc& __al = _Alloc())
: _Base(__n, __al)
{ }
forward_list(size_type __n, const _Tp& __value,
const _Alloc& __al = _Alloc())
: _Base(__n, __value, __al)
{ }
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
forward_list(_InputIterator __first, _InputIterator __last,
const _Alloc& __al = _Alloc())
: _Base(__first, __last, __al)
{ }
forward_list(const forward_list&) = default;
forward_list(forward_list&&) = default;
forward_list(std::initializer_list<_Tp> __il,
const _Alloc& __al = _Alloc())
: _Base(__il, __al)
{ }
~forward_list() = default;
forward_list&
operator=(const forward_list&) = default;
forward_list&
operator=(forward_list&&) = default;
forward_list&
operator=(std::initializer_list<_Tp> __il)
{
_M_base() = __il;
return *this;
}
void
swap(forward_list& __fl)
noexcept( noexcept(declval<_Base&>().swap(__fl)) )
{ _Base::swap(__fl); }
void
splice_after(const_iterator __pos, forward_list&& __fl)
{ _Base::splice_after(__pos, std::move(__fl)); }
void
splice_after(const_iterator __pos, forward_list& __list)
{ _Base::splice_after(__pos, __list); }
void
splice_after(const_iterator __pos, forward_list&& __list,
const_iterator __i)
{ _Base::splice_after(__pos, std::move(__list), __i); }
void
splice_after(const_iterator __pos, forward_list& __list,
const_iterator __i)
{ _Base::splice_after(__pos, __list, __i); }
void
splice_after(const_iterator __pos, forward_list&& __list,
const_iterator __before, const_iterator __last)
{ _Base::splice_after(__pos, std::move(__list), __before, __last); }
void
splice_after(const_iterator __pos, forward_list& __list,
const_iterator __before, const_iterator __last)
{ _Base::splice_after(__pos, __list, __before, __last); }
void
merge(forward_list&& __list)
{ _Base::merge(std::move(__list)); }
void
merge(forward_list& __list)
{ _Base::merge(__list); }
template<typename _Comp>
void
merge(forward_list&& __list, _Comp __comp)
{ _Base::merge(std::move(__list), __comp); }
template<typename _Comp>
void
merge(forward_list& __list, _Comp __comp)
{ _Base::merge(__list, __comp); }
_Base&
_M_base() noexcept { return *this; }
const _Base&
_M_base() const noexcept { return *this; }
};
template<typename _Tp, typename _Alloc>
inline bool
operator==(const forward_list<_Tp, _Alloc>& __lx,
const forward_list<_Tp, _Alloc>& __ly)
{ return __lx._M_base() == __ly._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<(const forward_list<_Tp, _Alloc>& __lx,
const forward_list<_Tp, _Alloc>& __ly)
{ return __lx._M_base() < __ly._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator!=(const forward_list<_Tp, _Alloc>& __lx,
const forward_list<_Tp, _Alloc>& __ly)
{ return !(__lx == __ly); }
/// Based on operator<
template<typename _Tp, typename _Alloc>
inline bool
operator>(const forward_list<_Tp, _Alloc>& __lx,
const forward_list<_Tp, _Alloc>& __ly)
{ return (__ly < __lx); }
/// Based on operator<
template<typename _Tp, typename _Alloc>
inline bool
operator>=(const forward_list<_Tp, _Alloc>& __lx,
const forward_list<_Tp, _Alloc>& __ly)
{ return !(__lx < __ly); }
/// Based on operator<
template<typename _Tp, typename _Alloc>
inline bool
operator<=(const forward_list<_Tp, _Alloc>& __lx,
const forward_list<_Tp, _Alloc>& __ly)
{ return !(__ly < __lx); }
/// See std::forward_list::swap().
template<typename _Tp, typename _Alloc>
inline void
swap(forward_list<_Tp, _Alloc>& __lx,
forward_list<_Tp, _Alloc>& __ly)
noexcept(noexcept(__lx.swap(__ly)))
{ __lx.swap(__ly); }
} // namespace __profile
} // namespace std
#endif // C++11
#endif
// Profiling set implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/set.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_SET_H
#define _GLIBCXX_PROFILE_SET_H 1
#include <profile/base.h>
#include <profile/ordered_base.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::set wrapper with performance instrumentation.
template<typename _Key, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<_Key> >
class set
: public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator>,
public _Ordered_profile<set<_Key, _Compare, _Allocator> >
{
typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_iterator _Base_const_iterator;
public:
// types:
typedef _Key key_type;
typedef _Key value_type;
typedef _Compare key_compare;
typedef _Compare value_compare;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __iterator_tracker<_Base_iterator, set> iterator;
typedef __iterator_tracker<_Base_const_iterator,
set> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
// 23.3.3.1 construct/copy/destroy:
#if __cplusplus < 201103L
set()
: _Base() { }
set(const set& __x)
: _Base(__x) { }
~set() { }
#else
set() = default;
set(const set&) = default;
set(set&&) = default;
~set() = default;
#endif
explicit set(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
set(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __comp, __a) { }
#if __cplusplus >= 201103L
set(initializer_list<value_type> __l,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__l, __comp, __a) { }
explicit
set(const _Allocator& __a)
: _Base(__a) { }
set(const set& __x, const _Allocator& __a)
: _Base(__x, __a) { }
set(set&& __x, const _Allocator& __a)
noexcept( noexcept(_Base(std::move(__x), __a)) )
: _Base(std::move(__x), __a) { }
set(initializer_list<value_type> __l, const _Allocator& __a)
: _Base(__l, __a) { }
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last,
const _Allocator& __a)
: _Base(__first, __last, __a) { }
#endif
set(const _Base& __x)
: _Base(__x) { }
#if __cplusplus < 201103L
set&
operator=(const set& __x)
{
this->_M_profile_destruct();
_M_base() = __x;
this->_M_profile_construct();
return *this;
}
#else
set&
operator=(const set&) = default;
set&
operator=(set&&) = default;
set&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
#endif
// iterators
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
#if __cplusplus >= 201103L
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::cbegin(), this); }
const_iterator
cend() const noexcept
{ return const_iterator(_Base::cend(), this); }
#endif
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(end());
}
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(end());
}
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(begin());
}
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(begin());
}
#if __cplusplus >= 201103L
const_reverse_iterator
crbegin() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cend());
}
const_reverse_iterator
crend() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cbegin());
}
#endif
void
swap(set& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{
_Base::swap(__x);
this->_M_swap(__x);
}
// modifiers:
#if __cplusplus >= 201103L
template<typename... _Args>
std::pair<iterator, bool>
emplace(_Args&&... __args)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
auto __base_ret = _Base::emplace(std::forward<_Args>(__args)...);
return std::make_pair(iterator(__base_ret.first, this),
__base_ret.second);
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __pos, _Args&&... __args)
{
auto size_before = this->size();
auto __res
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
std::pair<iterator, bool>
insert(const value_type& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
std::pair<_Base_iterator, bool> __base_ret = _Base::insert(__x);
return std::make_pair(iterator(__base_ret.first, this),
__base_ret.second);
}
#if __cplusplus >= 201103L
std::pair<iterator, bool>
insert(value_type&& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
std::pair<_Base_iterator, bool> __base_ret
= _Base::insert(std::move(__x));
return std::make_pair(iterator(__base_ret.first, this),
__base_ret.second);
}
#endif
iterator
insert(const_iterator __pos, const value_type& __x)
{
size_type size_before = this->size();
_Base_iterator __res = _Base::insert(__pos.base(), __x);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#if __cplusplus >= 201103L
iterator
insert(const_iterator __pos, value_type&& __x)
{ return iterator(_Base::insert(__pos.base(), std::move(__x)), this); }
#endif
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
for (; __first != __last; ++__first)
insert(*__first);
}
#if __cplusplus >= 201103L
void
insert(initializer_list<value_type> __l)
{ insert(__l.begin(), __l.end()); }
#endif
#if __cplusplus >= 201103L
iterator
erase(const_iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::erase(__pos.base()), this);
}
#else
void
erase(iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
_Base::erase(__pos.base());
}
#endif
size_type
erase(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return _Base::erase(__x);
}
#if __cplusplus >= 201103L
iterator
erase(const_iterator __first, const_iterator __last)
{
if (__first != __last)
{
iterator __ret;
for (; __first != __last;)
__ret = erase(__first++);
return __ret;
}
return iterator(_Base::erase(__first.base(), __last.base()), this);
}
#else
void
erase(iterator __first, iterator __last)
{
for (; __first != __last;)
erase(__first++);
}
#endif
void
clear() _GLIBCXX_NOEXCEPT
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
size_type
count(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
size_type
count(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#endif
// set operations:
iterator
find(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return iterator(_Base::find(__x), this);
}
const_iterator
find(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return const_iterator(_Base::find(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
find(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
find(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
#endif
iterator
lower_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::lower_bound(__x), this);
}
const_iterator
lower_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::lower_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
lower_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
lower_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
#endif
iterator
upper_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::upper_bound(__x), this);
}
const_iterator
upper_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::upper_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
upper_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
upper_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
#endif
std::pair<iterator, iterator>
equal_range(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_iterator, _Base_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(iterator(__base_ret.first, this),
iterator(__base_ret.second, this));
}
std::pair<const_iterator, const_iterator>
equal_range(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(const_iterator(__base_ret.first, this),
const_iterator(__base_ret.second, this));
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<iterator, iterator>
equal_range(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<const_iterator, const_iterator>
equal_range(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
#endif
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
private:
/** If hint is used we consider that the map and unordered_map
* operations have equivalent insertion cost so we do not update metrics
* about it.
* Note that to find out if hint has been used is libstdc++
* implementation dependent.
*/
bool
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
{
return (__hint == __res
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|| (__hint != _M_base().end() && (++__hint == __res
|| ++__res == --__hint)));
}
template<typename _K1, typename _C1, typename _A1>
friend bool
operator==(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
template<typename _K1, typename _C1, typename _A1>
friend bool
operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
};
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() == __rhs._M_base();
}
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator<(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() < __rhs._M_base();
}
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator!=(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key, _Compare, _Allocator>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key, _Compare, _Allocator>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator>=(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key, _Compare, _Allocator>& __rhs)
{ return !(__lhs < __rhs); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator>(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key, _Compare, _Allocator>& __rhs)
{ return __rhs < __lhs; }
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ return __x.swap(__y); }
} // namespace __profile
} // namespace std
#endif
// Profiling unordered containers implementation details -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/unordered_base.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_UNORDERED
#define _GLIBCXX_PROFILE_UNORDERED 1
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
template<typename _UnorderedCont,
typename _Value, bool _Cache_hash_code>
struct _Bucket_index_helper;
template<typename _UnorderedCont, typename _Value>
struct _Bucket_index_helper<_UnorderedCont, _Value, true>
{
static std::size_t
bucket(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, true>* __node)
{ return __node->_M_hash_code % __uc.bucket_count(); }
};
template<typename _UnorderedCont, typename _Value>
struct _Bucket_index_helper<_UnorderedCont, _Value, false>
{
static std::size_t
bucket(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, false>* __node)
{ return __uc.bucket(__node->_M_v()); }
};
template<typename _UnorderedCont, typename _Key, typename _Mapped>
struct _Bucket_index_helper<_UnorderedCont,
std::pair<const _Key, _Mapped>, false>
{
typedef std::pair<const _Key, _Mapped> _Value;
static std::size_t
bucket(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, false>* __node)
{ return __uc.bucket(__node->_M_v().first); }
};
template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code>
std::size_t
__get_bucket_index(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, _Cache_hash_code>* __node)
{
using __bucket_index_helper
= _Bucket_index_helper<_UnorderedCont, _Value, _Cache_hash_code>;
return __bucket_index_helper::bucket(__uc, __node);
}
template<typename _UnorderedCont,
typename _Value, bool _Cache_hash_code>
struct _Equal_helper;
template<typename _UnorderedCont, typename _Value>
struct _Equal_helper<_UnorderedCont, _Value, true>
{
static std::size_t
are_equal(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, true>* __lhs,
const __detail::_Hash_node<_Value, true>* __rhs)
{
return __lhs->_M_hash_code == __rhs->_M_hash_code
&& __uc.key_eq()(__lhs->_M_v(), __rhs->_M_v());
}
};
template<typename _UnorderedCont,
typename _Value>
struct _Equal_helper<_UnorderedCont, _Value, false>
{
static std::size_t
are_equal(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, false>* __lhs,
const __detail::_Hash_node<_Value, false>* __rhs)
{ return __uc.key_eq()(__lhs->_M_v(), __rhs->_M_v()); }
};
template<typename _UnorderedCont,
typename _Key, typename _Mapped>
struct _Equal_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, true>
{
typedef std::pair<const _Key, _Mapped> _Value;
static std::size_t
are_equal(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, true>* __lhs,
const __detail::_Hash_node<_Value, true>* __rhs)
{
return __lhs->_M_hash_code == __rhs->_M_hash_code
&& __uc.key_eq()(__lhs->_M_v().first, __rhs->_M_v().first);
}
};
template<typename _UnorderedCont,
typename _Key, typename _Mapped>
struct _Equal_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, false>
{
typedef std::pair<const _Key, _Mapped> _Value;
static std::size_t
are_equal(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, false>* __lhs,
const __detail::_Hash_node<_Value, false>* __rhs)
{ return __uc.key_eq()(__lhs->_M_v().first, __rhs->_M_v().first); }
};
template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code>
bool
__are_equal(const _UnorderedCont& __uc,
const __detail::_Hash_node<_Value, _Cache_hash_code>* __lhs,
const __detail::_Hash_node<_Value, _Cache_hash_code>* __rhs)
{
using __equal_helper
= _Equal_helper<_UnorderedCont, _Value, _Cache_hash_code>;
return __equal_helper::are_equal(__uc, __lhs, __rhs);
}
template<typename _UnorderedCont, bool _Unique_keys>
class _Unordered_profile
{
_UnorderedCont&
_M_conjure()
{ return *(static_cast<_UnorderedCont*>(this)); }
using __unique_keys = std::integral_constant<bool, _Unique_keys>;
protected:
_Unordered_profile() noexcept
{ _M_profile_construct(); }
_Unordered_profile(const _Unordered_profile&) noexcept
: _Unordered_profile() { }
_Unordered_profile(_Unordered_profile&& __other) noexcept
: _Unordered_profile()
{ _M_swap(__other); }
~_Unordered_profile()
{ _M_profile_destruct(); }
_Unordered_profile&
operator=(const _Unordered_profile&) noexcept
{
// Assignment just reset profiling.
_M_profile_destruct();
_M_profile_construct();
}
_Unordered_profile&
operator=(_Unordered_profile&& __other) noexcept
{
// Take profiling of the moved instance...
_M_swap(__other);
// ...and then reset other instance profiling.
__other._M_profile_destruct();
__other._M_profile_construct();
}
void
_M_profile_construct() noexcept
{
auto& __uc = _M_conjure();
_M_size_info = __profcxx_hashtable_size_construct(__uc.bucket_count());
_M_hashfunc_info = __profcxx_hash_func_construct();
}
void
_M_profile_destruct() noexcept
{
auto& __uc = _M_conjure();
__profcxx_hashtable_size_destruct(_M_size_info,
__uc.bucket_count(), __uc.size());
_M_size_info = 0;
if (!_M_hashfunc_info)
return;
_M_profile_destruct(__unique_keys());
_M_hashfunc_info = 0;
}
void
_M_swap(_Unordered_profile& __other) noexcept
{
std::swap(_M_size_info, __other._M_size_info);
std::swap(_M_hashfunc_info, __other._M_hashfunc_info);
}
void
_M_profile_resize(std::size_t __old_size)
{
auto __new_size = _M_conjure().bucket_count();
if (__old_size != __new_size)
__profcxx_hashtable_size_resize(_M_size_info, __old_size, __new_size);
}
__gnu_profile::__container_size_info* _M_size_info;
__gnu_profile::__hashfunc_info* _M_hashfunc_info;
private:
void
_M_profile_destruct(std::true_type);
void
_M_profile_destruct(std::false_type);
};
template<typename _UnorderedCont, bool _Unique_keys>
void
_Unordered_profile<_UnorderedCont, _Unique_keys>::
_M_profile_destruct(std::true_type)
{
auto& __uc = _M_conjure();
std::size_t __hops = 0, __lc = 0, __chain = 0;
auto __it = __uc.begin();
while (__it != __uc.end())
{
auto __bkt = __get_bucket_index(__uc, __it._M_cur);
auto __lit = __uc.begin(__bkt);
auto __lend = __uc.end(__bkt);
for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit)
++__chain;
if (__chain)
{
++__chain;
__lc = __lc > __chain ? __lc : __chain;
__hops += __chain * (__chain - 1) / 2;
__chain = 0;
}
}
__profcxx_hash_func_destruct(_M_hashfunc_info,
__lc, __uc.size(), __hops);
}
template<typename _UnorderedCont, bool _Unique_keys>
void
_Unordered_profile<_UnorderedCont, _Unique_keys>::
_M_profile_destruct(std::false_type)
{
auto& __uc = _M_conjure();
std::size_t __hops = 0, __lc = 0, __chain = 0, __unique_size = 0;
auto __it = __uc.begin();
while (__it != __uc.end())
{
auto __bkt = __get_bucket_index(__uc, __it._M_cur);
auto __lit = __uc.begin(__bkt);
auto __lend = __uc.end(__bkt);
auto __pit = __it;
++__unique_size;
for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit)
{
if (!__are_equal(__uc, __pit._M_cur, __it._M_cur))
{
++__chain;
++__unique_size;
__pit = __it;
}
}
if (__chain)
{
++__chain;
__lc = __lc > __chain ? __lc : __chain;
__hops += __chain * (__chain - 1) / 2;
__chain = 0;
}
}
__profcxx_hash_func_destruct(_M_hashfunc_info,
__lc, __unique_size, __hops);
}
} // namespace __profile
} // namespace std
#endif
// -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/base.h
* @brief Sequential helper functions.
* This file is a GNU profile extension to the Standard C++ Library.
*/
// Written by Lixia Liu
#ifndef _GLIBCXX_PROFILE_BASE_H
#define _GLIBCXX_PROFILE_BASE_H 1
#include <profile/impl/profiler.h>
// Profiling mode namespaces.
/**
* @namespace std::__profile
* @brief GNU profile code, replaces standard behavior with profile behavior.
*/
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile { }
}
/**
* @namespace __gnu_profile
* @brief GNU profile code for public use.
*/
namespace __gnu_profile
{
// Import all the profile versions of components in namespace std.
using namespace std::__profile;
}
#endif /* _GLIBCXX_PROFILE_BASE_H */
// Profile array implementation -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/array
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_PROFILE_ARRAY
#define _GLIBCXX_PROFILE_ARRAY 1
#pragma GCC system_header
#include <array>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
template<typename _Tp, std::size_t _Nm>
struct array
{
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Support for zero-sized arrays mandatory.
typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type;
typename _AT_Type::_Type _M_elems;
// No explicit construct/copy/destroy for aggregate type.
// DR 776.
void
fill(const value_type& __u)
{ std::fill_n(begin(), size(), __u); }
void
swap(array& __other)
noexcept(_AT_Type::_Is_nothrow_swappable::value)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
_GLIBCXX17_CONSTEXPR iterator
begin() noexcept
{ return iterator(data()); }
_GLIBCXX17_CONSTEXPR const_iterator
begin() const noexcept
{ return const_iterator(data()); }
_GLIBCXX17_CONSTEXPR iterator
end() noexcept
{ return iterator(data() + _Nm); }
_GLIBCXX17_CONSTEXPR const_iterator
end() const noexcept
{ return const_iterator(data() + _Nm); }
_GLIBCXX17_CONSTEXPR reverse_iterator
rbegin() noexcept
{ return reverse_iterator(end()); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
rbegin() const noexcept
{ return const_reverse_iterator(end()); }
_GLIBCXX17_CONSTEXPR reverse_iterator
rend() noexcept
{ return reverse_iterator(begin()); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
rend() const noexcept
{ return const_reverse_iterator(begin()); }
_GLIBCXX17_CONSTEXPR const_iterator
cbegin() const noexcept
{ return const_iterator(data()); }
_GLIBCXX17_CONSTEXPR const_iterator
cend() const noexcept
{ return const_iterator(data() + _Nm); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(end()); }
_GLIBCXX17_CONSTEXPR const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(begin()); }
// Capacity.
constexpr size_type
size() const noexcept { return _Nm; }
constexpr size_type
max_size() const noexcept { return _Nm; }
constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.
reference
operator[](size_type __n) noexcept
{ return _AT_Type::_S_ref(_M_elems, __n); }
constexpr const_reference
operator[](size_type __n) const noexcept
{ return _AT_Type::_S_ref(_M_elems, __n); }
_GLIBCXX17_CONSTEXPR reference
at(size_type __n)
{
if (__n >= _Nm)
std::__throw_out_of_range_fmt(__N("array::at: __n "
"(which is %zu) >= _Nm "
"(which is %zu)"),
__n, _Nm);
return _AT_Type::_S_ref(_M_elems, __n);
}
constexpr const_reference
at(size_type __n) const
{
// Result of conditional expression must be an lvalue so use
// boolean ? lvalue : (throw-expr, lvalue)
return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
: (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
">= _Nm (which is %zu)"),
__n, _Nm),
_AT_Type::_S_ref(_M_elems, 0));
}
_GLIBCXX17_CONSTEXPR reference
front() noexcept
{ return *begin(); }
constexpr const_reference
front() const noexcept
{ return _AT_Type::_S_ref(_M_elems, 0); }
_GLIBCXX17_CONSTEXPR reference
back() noexcept
{ return _Nm ? *(end() - 1) : *end(); }
constexpr const_reference
back() const noexcept
{
return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
: _AT_Type::_S_ref(_M_elems, 0);
}
_GLIBCXX17_CONSTEXPR pointer
data() noexcept
{ return _AT_Type::_S_ptr(_M_elems); }
_GLIBCXX17_CONSTEXPR const_pointer
data() const noexcept
{ return _AT_Type::_S_ptr(_M_elems); }
};
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
__b.begin(), __b.end());
}
template<typename _Tp, std::size_t _Nm>
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms.
template<typename _Tp, std::size_t _Nm>
inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
noexcept(noexcept(__one.swap(__two)))
{ __one.swap(__two); }
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr _Tp&
get(array<_Tp, _Nm>& __arr) noexcept
{
static_assert(_Int < _Nm, "index is out of bounds");
return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::
_S_ref(__arr._M_elems, _Int);
}
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr _Tp&&
get(array<_Tp, _Nm>&& __arr) noexcept
{
static_assert(_Int < _Nm, "index is out of bounds");
return std::move(__profile::get<_Int>(__arr));
}
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
constexpr const _Tp&
get(const array<_Tp, _Nm>& __arr) noexcept
{
static_assert(_Int < _Nm, "index is out of bounds");
return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::
_S_ref(__arr._M_elems, _Int);
}
} // namespace __profile
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Tuple interface to class template array.
/// tuple_size
template<typename _Tp, std::size_t _Nm>
struct tuple_size<std::__profile::array<_Tp, _Nm>>
: public integral_constant<std::size_t, _Nm> { };
/// tuple_element
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
struct tuple_element<_Int, std::__profile::array<_Tp, _Nm>>
{
static_assert(_Int < _Nm, "index is out of bounds");
typedef _Tp type;
};
template<typename _Tp, std::size_t _Nm>
struct __is_tuple_like_impl<std::__profile::array<_Tp, _Nm>> : true_type
{ };
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_PROFILE_ARRAY
// Profiling map/multimap implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/map
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_MAP
#define _GLIBCXX_PROFILE_MAP 1
#include <map>
#include <profile/map.h>
#include <profile/multimap.h>
#endif
// Profiling map implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/map.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_MAP_H
#define _GLIBCXX_PROFILE_MAP_H 1
#include <profile/base.h>
#include <profile/ordered_base.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::map wrapper with performance instrumentation.
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
class map
: public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>,
public _Ordered_profile<map<_Key, _Tp, _Compare, _Allocator> >
{
typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_iterator _Base_const_iterator;
public:
// types:
typedef _Key key_type;
typedef _Tp mapped_type;
typedef typename _Base::value_type value_type;
typedef _Compare key_compare;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __iterator_tracker<_Base_iterator, map> iterator;
typedef __iterator_tracker<_Base_const_iterator,
map> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
// 23.3.1.1 construct/copy/destroy:
#if __cplusplus < 201103L
map()
: _Base() { }
map(const map& __x)
: _Base(__x) { }
~map()
{ }
#else
map() = default;
map(const map&) = default;
map(map&&) = default;
~map() = default;
#endif
explicit
map(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __comp, __a) { }
map(const _Base& __x)
: _Base(__x) { }
#if __cplusplus >= 201103L
map(initializer_list<value_type> __l,
const _Compare& __c = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__l, __c, __a) { }
explicit
map(const _Allocator& __a)
: _Base(__a) { }
map(const map& __x, const _Allocator& __a)
: _Base(__x, __a) { }
map(map&& __x, const _Allocator& __a)
noexcept( noexcept(_Base(std::move(__x), __a)) )
: _Base(std::move(__x), __a) { }
map(initializer_list<value_type> __l, const _Allocator& __a)
: _Base(__l, __a) { }
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Allocator& __a)
: _Base(__first, __last, __a) { }
#endif
#if __cplusplus < 201103L
map&
operator=(const map& __x)
{
this->_M_profile_destruct();
_M_base() = __x;
this->_M_profile_construct();
return *this;
}
#else
map&
operator=(const map&) = default;
map&
operator=(map&&) = default;
map&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
#endif
// iterators
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
#if __cplusplus >= 201103L
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::cbegin(), this); }
const_iterator
cend() const noexcept
{ return const_iterator(_Base::cend(), this); }
#endif
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(end());
}
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(end());
}
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(begin());
}
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(begin());
}
#if __cplusplus >= 201103L
const_reverse_iterator
crbegin() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cend());
}
const_reverse_iterator
crend() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cbegin());
}
#endif
// 23.3.1.2 element access:
mapped_type&
operator[](const key_type& __k)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::operator[](__k);
}
#if __cplusplus >= 201103L
mapped_type&
operator[](key_type&& __k)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::operator[](std::move(__k));
}
#endif
mapped_type&
at(const key_type& __k)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::at(__k);
}
const mapped_type&
at(const key_type& __k) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::at(__k);
}
// modifiers:
#if __cplusplus >= 201103L
template<typename... _Args>
std::pair<iterator, bool>
emplace(_Args&&... __args)
{
// The cost is the same whether or not the element is inserted so we
// always report insertion of 1 element.
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
auto __base_ret = _Base::emplace(std::forward<_Args>(__args)...);
return std::make_pair(iterator(__base_ret.first, this),
__base_ret.second);
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __pos, _Args&&... __args)
{
auto size_before = this->size();
auto __res
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
std::pair<iterator, bool>
insert(const value_type& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
std::pair<_Base_iterator, bool> __base_ret = _Base::insert(__x);
return std::make_pair(iterator(__base_ret.first, this),
__base_ret.second);
}
#if __cplusplus >= 201103L
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
std::pair<iterator, bool>
insert(_Pair&& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
auto __base_ret= _Base::insert(std::forward<_Pair>(__x));
return std::make_pair(iterator(__base_ret.first, this),
__base_ret.second);
}
#endif
#if __cplusplus >= 201103L
void
insert(std::initializer_list<value_type> __list)
{ insert(__list.begin(), __list.end()); }
#endif
iterator
#if __cplusplus >= 201103L
insert(const_iterator __pos, const value_type& __x)
#else
insert(iterator __pos, const value_type& __x)
#endif
{
size_type size_before = this->size();
_Base_iterator __res = _Base::insert(__pos.base(), __x);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#if __cplusplus >= 201103L
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
iterator
insert(const_iterator __pos, _Pair&& __x)
{
size_type size_before = this->size();
auto __res = _Base::insert(__pos.base(), std::forward<_Pair>(__x));
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
for (; __first != __last; ++__first)
insert(*__first);
}
#if __cplusplus >= 201103L
iterator
erase(const_iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::erase(__pos.base()), this);
}
iterator
erase(iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::erase(__pos.base()), this);
}
#else
void
erase(iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
_Base::erase(__pos.base());
}
#endif
size_type
erase(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return _Base::erase(__x);
}
#if __cplusplus >= 201103L
iterator
erase(const_iterator __first, const_iterator __last)
{
if (__first != __last)
{
iterator __ret;
for (; __first != __last;)
__ret = erase(__first++);
return __ret;
}
else
return iterator(_Base::erase(__first.base(), __last.base()), this);
}
#else
void
erase(iterator __first, iterator __last)
{
for (; __first != __last;)
erase(__first++);
}
#endif
void
swap(map& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{
_Base::swap(__x);
this->_M_swap(__x);
}
void
clear() _GLIBCXX_NOEXCEPT
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
// 23.3.1.3 map operations:
iterator
find(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return iterator(_Base::find(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
find(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
#endif
const_iterator
find(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return const_iterator(_Base::find(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
find(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
#endif
size_type
count(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
size_type
count(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#endif
iterator
lower_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::lower_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
lower_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
#endif
const_iterator
lower_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::lower_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
lower_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
#endif
iterator
upper_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::upper_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
upper_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
#endif
const_iterator
upper_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::upper_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
upper_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
#endif
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_iterator, _Base_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(iterator(__base_ret.first, this),
iterator(__base_ret.second, this));
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<iterator, iterator>
equal_range(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
#endif
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(const_iterator(__base_ret.first, this),
const_iterator(__base_ret.second, this));
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<const_iterator, const_iterator>
equal_range(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
#endif
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
private:
/** If hint is used we consider that the map and unordered_map
* operations have equivalent insertion cost so we do not update metrics
* about it.
* Note that to find out if hint has been used is libstdc++
* implementation dependent.
*/
bool
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
{
return (__hint == __res
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|| (__hint != _M_base().end() && (++__hint == __res
|| ++__res == --__hint)));
}
template<typename _K1, typename _T1, typename _C1, typename _A1>
friend bool
operator==(const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
template<typename _K1, typename _T1, typename _C1, typename _A1>
friend bool
operator<(const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
};
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() == __rhs._M_base();
}
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() < __rhs._M_base();
}
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return !(__lhs < __rhs); }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __rhs < __lhs; }
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline void
swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
map<_Key, _Tp, _Compare, _Allocator>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
} // namespace __profile
} // namespace std
#endif
// Profiling unordered containers implementation details -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/ordered_base.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_ORDERED
#define _GLIBCXX_PROFILE_ORDERED 1
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
template<typename _Cont>
class _Ordered_profile
{
public:
void
_M_profile_iterate(int __rewind = 0) const
{ __profcxx_map2umap_iterate(this->_M_map2umap_info, __rewind); }
protected:
_Ordered_profile() _GLIBCXX_NOEXCEPT
{ _M_profile_construct(); }
#if __cplusplus >= 201103L
_Ordered_profile(const _Ordered_profile&) noexcept
: _Ordered_profile() { }
_Ordered_profile(_Ordered_profile&& __other) noexcept
: _Ordered_profile()
{ _M_swap(__other); }
_Ordered_profile&
operator=(const _Ordered_profile&) noexcept
{
_M_profile_destruct();
_M_profile_construct();
}
_Ordered_profile&
operator=(_Ordered_profile&& __other) noexcept
{
_M_swap(__other);
__other._M_profile_destruct();
__other._M_profile_construct();
}
#endif
~_Ordered_profile()
{ _M_profile_destruct(); }
void
_M_profile_construct() _GLIBCXX_NOEXCEPT
{ _M_map2umap_info = __profcxx_map2umap_construct(); }
void
_M_profile_destruct() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_destruct(_M_map2umap_info);
_M_map2umap_info = 0;
}
void
_M_swap(_Ordered_profile& __other)
{ std::swap(_M_map2umap_info, __other._M_map2umap_info); }
__gnu_profile::__map2umap_info* _M_map2umap_info;
private:
_Cont&
_M_conjure()
{ return *static_cast<_Cont*>(this); }
};
} // namespace __profile
} // namespace std
#endif
// Profiling set/multiset implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/set
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_SET
#define _GLIBCXX_PROFILE_SET 1
#include <set>
#include <profile/set.h>
#include <profile/multiset.h>
#endif
// Profiling iterator implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/iterator_tracker.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_ITERATOR_TRACKER
#define _GLIBCXX_PROFILE_ITERATOR_TRACKER 1
#include <ext/type_traits.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
template<typename _Iterator, typename _Sequence>
class __iterator_tracker
{
typedef __iterator_tracker _Self;
// The underlying iterator
_Iterator _M_current;
// The underlying data structure
const _Sequence* _M_ds;
typedef std::iterator_traits<_Iterator> _Traits;
public:
typedef _Iterator _Base_iterator;
typedef typename _Traits::iterator_category iterator_category;
typedef typename _Traits::value_type value_type;
typedef typename _Traits::difference_type difference_type;
typedef typename _Traits::reference reference;
typedef typename _Traits::pointer pointer;
__iterator_tracker() _GLIBCXX_NOEXCEPT
: _M_current(), _M_ds(0) { }
__iterator_tracker(const _Iterator& __i, const _Sequence* __seq)
_GLIBCXX_NOEXCEPT
: _M_current(__i), _M_ds(__seq) { }
__iterator_tracker(const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
: _M_current(__x._M_current), _M_ds(__x._M_ds) { }
template<typename _MutableIterator>
__iterator_tracker(const __iterator_tracker<_MutableIterator,
typename __gnu_cxx::__enable_if
<(std::__are_same<_MutableIterator, typename
_Sequence::iterator::_Base_iterator>::__value),
_Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT
: _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
_Iterator
base() const _GLIBCXX_NOEXCEPT { return _M_current; }
/**
* @brief Conversion to underlying non-debug iterator to allow
* better interaction with non-profile containers.
*/
operator _Iterator() const _GLIBCXX_NOEXCEPT { return _M_current; }
pointer
operator->() const _GLIBCXX_NOEXCEPT { return &*_M_current; }
__iterator_tracker&
operator++() _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate();
++_M_current;
return *this;
}
__iterator_tracker
operator++(int) _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate();
__iterator_tracker __tmp(*this);
++_M_current;
return __tmp;
}
__iterator_tracker&
operator--() _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate(1);
--_M_current;
return *this;
}
__iterator_tracker
operator--(int) _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate(1);
__iterator_tracker __tmp(*this);
--_M_current;
return __tmp;
}
__iterator_tracker&
operator=(const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
{
_M_current = __x._M_current;
_M_ds = __x._M_ds;
return *this;
}
reference
operator*() const _GLIBCXX_NOEXCEPT
{ return *_M_current; }
// ------ Random access iterator requirements ------
reference
operator[](const difference_type& __n) const _GLIBCXX_NOEXCEPT
{ return _M_current[__n]; }
__iterator_tracker&
operator+=(const difference_type& __n) _GLIBCXX_NOEXCEPT
{
_M_current += __n;
return *this;
}
__iterator_tracker
operator+(const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
__iterator_tracker __tmp(*this);
__tmp += __n;
return __tmp;
}
__iterator_tracker&
operator-=(const difference_type& __n) _GLIBCXX_NOEXCEPT
{
_M_current += -__n;
return *this;
}
__iterator_tracker
operator-(const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
__iterator_tracker __tmp(*this);
__tmp -= __n;
return __tmp;
}
const _Sequence*
_M_get_sequence() const
{ return static_cast<const _Sequence*>(_M_ds); }
};
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() == __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() == __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() != __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() != __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() < __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() < __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() <= __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() <= __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() > __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() > __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() >= __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() >= __rhs.base(); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// According to the resolution of DR179 not only the various comparison
// operators but also operator- must accept mixed iterator/const_iterator
// parameters.
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type
operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() - __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
_GLIBCXX_NOEXCEPT
{ return __lhs.base() - __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline __iterator_tracker<_Iterator, _Sequence>
operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type
__n,
const __iterator_tracker<_Iterator, _Sequence>& __i)
_GLIBCXX_NOEXCEPT
{ return __i + __n; }
} // namespace __profile
} // namespace std
#endif
// Profiling bitset implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/bitset
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_BITSET
#define _GLIBCXX_PROFILE_BITSET
#include <bitset>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::bitset wrapper with performance instrumentation, none at the
/// moment.
template<size_t _Nb>
class bitset
: public _GLIBCXX_STD_C::bitset<_Nb>
{
typedef _GLIBCXX_STD_C::bitset<_Nb> _Base;
public:
// 23.3.5.1 constructors:
#if __cplusplus < 201103L
bitset()
: _Base() { }
#else
constexpr bitset() = default;
#endif
#if __cplusplus >= 201103L
constexpr bitset(unsigned long long __val) noexcept
#else
bitset(unsigned long __val)
#endif
: _Base(__val) { }
template<typename _CharT, typename _Traits, typename _Alloc>
explicit
bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
__pos = 0,
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
__n = (std::basic_string<_CharT, _Traits, _Alloc>::npos))
: _Base(__str, __pos, __n) { }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 396. what are characters zero and one.
template<class _CharT, class _Traits, class _Alloc>
bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
__pos,
typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
__n,
_CharT __zero, _CharT __one = _CharT('1'))
: _Base(__str, __pos, __n, __zero, __one) { }
bitset(const _Base& __x) : _Base(__x) { }
#if __cplusplus >= 201103L
template<typename _CharT>
explicit
bitset(const _CharT* __str,
typename std::basic_string<_CharT>::size_type __n
= std::basic_string<_CharT>::npos,
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
: _Base(__str, __n, __zero, __one) { }
#endif
// 23.3.5.2 bitset operations:
bitset<_Nb>&
operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() &= __rhs;
return *this;
}
bitset<_Nb>&
operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() |= __rhs;
return *this;
}
bitset<_Nb>&
operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() ^= __rhs;
return *this;
}
bitset<_Nb>&
operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_base() <<= __pos;
return *this;
}
bitset<_Nb>&
operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_base() >>= __pos;
return *this;
}
bitset<_Nb>&
set() _GLIBCXX_NOEXCEPT
{
_Base::set();
return *this;
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 186. bitset::set() second parameter should be bool
bitset<_Nb>&
set(size_t __pos, bool __val = true)
{
_Base::set(__pos, __val);
return *this;
}
bitset<_Nb>&
reset() _GLIBCXX_NOEXCEPT
{
_Base::reset();
return *this;
}
bitset<_Nb>&
reset(size_t __pos)
{
_Base::reset(__pos);
return *this;
}
bitset<_Nb>
operator~() const _GLIBCXX_NOEXCEPT
{ return bitset(~_M_base()); }
bitset<_Nb>&
flip() _GLIBCXX_NOEXCEPT
{
_Base::flip();
return *this;
}
bitset<_Nb>&
flip(size_t __pos)
{
_Base::flip(__pos);
return *this;
}
bool
operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() == __rhs; }
bool
operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() != __rhs; }
bitset<_Nb>
operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() << __pos); }
bitset<_Nb>
operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() >> __pos); }
_Base&
_M_base() _GLIBCXX_NOEXCEPT
{ return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT
{ return *this; }
};
template<size_t _Nb>
bitset<_Nb>
operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) &= __y; }
template<size_t _Nb>
bitset<_Nb>
operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) |= __y; }
template<size_t _Nb>
bitset<_Nb>
operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) ^= __y; }
template<typename _CharT, typename _Traits, size_t _Nb>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
{ return __is >> __x._M_base(); }
template<typename _CharT, typename _Traits, size_t _Nb>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const bitset<_Nb>& __x)
{ return __os << __x._M_base(); }
} // namespace __profile
#if __cplusplus >= 201103L
// DR 1182.
/// std::hash specialization for bitset.
template<size_t _Nb>
struct hash<__profile::bitset<_Nb>>
: public __hash_base<size_t, __profile::bitset<_Nb>>
{
size_t
operator()(const __profile::bitset<_Nb>& __b) const noexcept
{ return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); }
};
#endif
} // namespace std
#endif
// Profiling list implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/list
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_LIST
#define _GLIBCXX_PROFILE_LIST 1
#include <list>
#include <profile/base.h>
#include <profile/iterator_tracker.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
template<typename _List>
class _List_profile
{
_List&
_M_conjure()
{ return *static_cast<_List*>(this); }
public:
__gnu_profile::__list2slist_info* _M_list2slist_info;
__gnu_profile::__list2vector_info* _M_list2vector_info;
_List_profile() _GLIBCXX_NOEXCEPT
{ _M_profile_construct(); }
void
_M_profile_construct() _GLIBCXX_NOEXCEPT
{
_M_list2slist_info = __profcxx_list2slist_construct();
_M_list2vector_info = __profcxx_list2vector_construct();
}
void
_M_profile_destruct() _GLIBCXX_NOEXCEPT
{
__profcxx_list2vector_destruct(_M_list2vector_info);
_M_list2vector_info = 0;
__profcxx_list2slist_destruct(_M_list2slist_info);
_M_list2slist_info = 0;
}
void
_M_swap(_List_profile& __other)
{
std::swap(_M_list2slist_info, __other._M_list2slist_info);
std::swap(_M_list2vector_info, __other._M_list2vector_info);
}
#if __cplusplus >= 201103L
_List_profile(const _List_profile&) noexcept
: _List_profile() { }
_List_profile(_List_profile&& __other) noexcept
: _List_profile()
{ _M_swap(__other); }
_List_profile&
operator=(const _List_profile&) noexcept
{
_M_profile_destruct();
_M_profile_construct();
}
_List_profile&
operator=(_List_profile&& __other) noexcept
{
_M_swap(__other);
__other._M_profile_destruct();
__other._M_profile_construct();
}
#endif
~_List_profile()
{ _M_profile_destruct(); }
};
/** @brief List wrapper with performance instrumentation. */
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
class list
: public _GLIBCXX_STD_C::list<_Tp, _Allocator>,
public _List_profile<list<_Tp, _Allocator> >
{
typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
public:
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __iterator_tracker<typename _Base::iterator, list>
iterator;
typedef __iterator_tracker<typename _Base::const_iterator, list>
const_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
typedef _Tp value_type;
typedef _Allocator allocator_type;
typedef typename _Base::pointer pointer;
typedef typename _Base::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.2.1 construct/copy/destroy:
#if __cplusplus < 201103L
list() { }
list(const list& __x)
: _Base(__x) { }
~list() { }
#else
list() = default;
list(const list&) = default;
list(list&&) = default;
~list() = default;
list(initializer_list<value_type> __l,
const allocator_type& __a = allocator_type())
: _Base(__l, __a) { }
list(const list& __x, const allocator_type& __a)
: _Base(__x, __a) { }
list(list&& __x, const allocator_type& __a)
: _Base(std::move(__x), __a) { }
#endif
explicit
list(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
explicit
list(size_type __n, const allocator_type& __a = allocator_type())
: _Base(__n, __a) { }
list(size_type __n, const _Tp& __value,
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#else
explicit
list(size_type __n, const _Tp& __value = _Tp(),
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#endif
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator>
#endif
list(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __a) { }
list(const _Base& __x)
: _Base(__x) { }
#if __cplusplus < 201103L
list&
operator=(const list& __x)
{
this->_M_profile_destruct();
_M_base() = __x;
this->_M_profile_construct();
return *this;
}
#else
list&
operator=(const list&) = default;
list&
operator=(list&&) = default;
list&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
#endif
// iterators:
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
end() _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_rewind(this->_M_list2slist_info);
return iterator(_Base::end(), this);
}
const_iterator
end() const _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_rewind(this->_M_list2slist_info);
return const_iterator(_Base::end(), this);
}
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_rewind(this->_M_list2slist_info);
return reverse_iterator(end());
}
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_rewind(this->_M_list2slist_info);
return const_reverse_iterator(end());
}
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(begin()); }
#if __cplusplus >= 201103L
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::cbegin(), this); }
const_iterator
cend() const noexcept
{ return const_iterator(_Base::cend(), this); }
const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(end()); }
const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(begin()); }
#endif
// 23.2.2.2 capacity:
reference
back() _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_rewind(this->_M_list2slist_info);
return _Base::back();
}
const_reference
back() const _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_rewind(this->_M_list2slist_info);
return _Base::back();
}
// 23.2.2.3 modifiers:
void
push_front(const value_type& __x)
{
__profcxx_list2vector_invalid_operator(this->_M_list2vector_info);
__profcxx_list2slist_operation(this->_M_list2slist_info);
_Base::push_front(__x);
}
void
pop_front() _GLIBCXX_NOEXCEPT
{
__profcxx_list2slist_operation(this->_M_list2slist_info);
_Base::pop_front();
}
void
pop_back() _GLIBCXX_NOEXCEPT
{
_Base::pop_back();
__profcxx_list2slist_rewind(this->_M_list2slist_info);
}
#if __cplusplus >= 201103L
template<typename... _Args>
iterator
emplace(const_iterator __position, _Args&&... __args)
{
return iterator(_Base::emplace(__position.base(),
std::forward<_Args>(__args)...),
this);
}
#endif
iterator
#if __cplusplus >= 201103L
insert(const_iterator __pos, const _Tp& __x)
#else
insert(iterator __pos, const _Tp& __x)
#endif
{
_M_profile_insert(__pos, this->size());
return iterator(_Base::insert(__pos.base(), __x), this);
}
#if __cplusplus >= 201103L
iterator
insert(const_iterator __pos, _Tp&& __x)
{
_M_profile_insert(__pos, this->size());
return iterator(_Base::emplace(__pos.base(), std::move(__x)),
this);
}
iterator
insert(const_iterator __pos, initializer_list<value_type> __l)
{
_M_profile_insert(__pos, this->size());
return iterator(_Base::insert(__pos.base(), __l), this);
}
#endif
#if __cplusplus >= 201103L
iterator
insert(const_iterator __pos, size_type __n, const _Tp& __x)
{
_M_profile_insert(__pos, this->size());
return iterator(_Base::insert(__pos.base(), __n, __x), this);
}
#else
void
insert(iterator __pos, size_type __n, const _Tp& __x)
{
_M_profile_insert(__pos, this->size());
_Base::insert(__pos.base(), __n, __x);
}
#endif
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
iterator
insert(const_iterator __pos, _InputIterator __first,
_InputIterator __last)
{
_M_profile_insert(__pos, this->size());
return iterator(_Base::insert(__pos.base(), __first, __last),
this);
}
#else
template<class _InputIterator>
void
insert(iterator __pos, _InputIterator __first,
_InputIterator __last)
{
_M_profile_insert(__pos, this->size());
_Base::insert(__pos.base(), __first, __last);
}
#endif
iterator
#if __cplusplus >= 201103L
erase(const_iterator __pos) noexcept
#else
erase(iterator __pos)
#endif
{ return iterator(_Base::erase(__pos.base()), this); }
iterator
#if __cplusplus >= 201103L
erase(const_iterator __pos, const_iterator __last) noexcept
#else
erase(iterator __pos, iterator __last)
#endif
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
return iterator(_Base::erase(__pos.base(), __last.base()), this);
}
void
swap(list& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{
_Base::swap(__x);
this->_M_swap(__x);
}
void
clear() _GLIBCXX_NOEXCEPT
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
// 23.2.2.4 list operations:
void
#if __cplusplus >= 201103L
splice(const_iterator __pos, list&& __x) noexcept
#else
splice(iterator __pos, list& __x)
#endif
{ this->splice(__pos, _GLIBCXX_MOVE(__x), __x.begin(), __x.end()); }
#if __cplusplus >= 201103L
void
splice(const_iterator __pos, list& __x) noexcept
{ this->splice(__pos, std::move(__x)); }
void
splice(const_iterator __pos, list& __x, const_iterator __i)
{ this->splice(__pos, std::move(__x), __i); }
#endif
void
#if __cplusplus >= 201103L
splice(const_iterator __pos, list&& __x, const_iterator __i) noexcept
#else
splice(iterator __pos, list& __x, iterator __i)
#endif
{
// We used to perform the splice_alloc check: not anymore, redundant
// after implementing the relevant bits of N1599.
// _GLIBCXX_RESOLVE_LIB_DEFECTS
_Base::splice(__pos.base(), _GLIBCXX_MOVE(__x._M_base()),
__i.base());
}
void
#if __cplusplus >= 201103L
splice(const_iterator __pos, list&& __x, const_iterator __first,
const_iterator __last) noexcept
#else
splice(iterator __pos, list& __x, iterator __first,
iterator __last)
#endif
{
_Base::splice(__pos.base(), _GLIBCXX_MOVE(__x._M_base()),
__first.base(), __last.base());
}
#if __cplusplus >= 201103L
void
splice(const_iterator __pos, list& __x,
const_iterator __first, const_iterator __last) noexcept
{ this->splice(__pos, std::move(__x), __first, __last); }
#endif
void
remove(const _Tp& __value)
{
for (iterator __x = begin(); __x != end(); )
{
if (*__x == __value)
__x = erase(__x);
else
++__x;
}
}
template<class _Predicate>
void
remove_if(_Predicate __pred)
{
for (iterator __x = begin(); __x != end(); )
{
__profcxx_list2slist_operation(this->_M_list2slist_info);
if (__pred(*__x))
__x = erase(__x);
else
++__x;
}
}
void
unique()
{
iterator __first = begin();
iterator __last = end();
if (__first == __last)
return;
iterator __next = __first;
while (++__next != __last)
{
__profcxx_list2slist_operation(this->_M_list2slist_info);
if (*__first == *__next)
erase(__next);
else
__first = __next;
__next = __first;
}
}
template<class _BinaryPredicate>
void
unique(_BinaryPredicate __binary_pred)
{
iterator __first = begin();
iterator __last = end();
if (__first == __last)
return;
iterator __next = __first;
while (++__next != __last)
{
__profcxx_list2slist_operation(this->_M_list2slist_info);
if (__binary_pred(*__first, *__next))
erase(__next);
else
__first = __next;
__next = __first;
}
}
void
#if __cplusplus >= 201103L
merge(list&& __x)
#else
merge(list& __x)
#endif
{ _Base::merge(_GLIBCXX_MOVE(__x._M_base())); }
#if __cplusplus >= 201103L
void
merge(list& __x)
{ this->merge(std::move(__x)); }
#endif
template<class _Compare>
void
#if __cplusplus >= 201103L
merge(list&& __x, _Compare __comp)
#else
merge(list& __x, _Compare __comp)
#endif
{ _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); }
#if __cplusplus >= 201103L
template<typename _Compare>
void
merge(list& __x, _Compare __comp)
{ this->merge(std::move(__x), __comp); }
#endif
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
void _M_profile_iterate(int __rewind = 0) const
{
__profcxx_list2slist_operation(this->_M_list2slist_info);
__profcxx_list2vector_iterate(this->_M_list2vector_info, __rewind);
if (__rewind)
__profcxx_list2slist_rewind(this->_M_list2slist_info);
}
private:
size_type
_M_profile_insert(const_iterator __pos, size_type __size)
{
size_type __shift = 0;
typename _Base::const_iterator __it = __pos.base();
for (; __it != _Base::end(); ++__it)
__shift++;
__profcxx_list2slist_rewind(this->_M_list2slist_info);
__profcxx_list2slist_operation(this->_M_list2slist_info);
__profcxx_list2vector_insert(this->_M_list2vector_info, __shift, __size);
}
};
template<typename _Tp, typename _Alloc>
inline bool
operator==(const list<_Tp, _Alloc>& __lhs,
const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator!=(const list<_Tp, _Alloc>& __lhs,
const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<(const list<_Tp, _Alloc>& __lhs,
const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<=(const list<_Tp, _Alloc>& __lhs,
const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>=(const list<_Tp, _Alloc>& __lhs,
const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>(const list<_Tp, _Alloc>& __lhs,
const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
} // namespace __profile
} // namespace std
#endif
// Profiling unordered_set/unordered_multiset implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/unordered_set
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_UNORDERED_SET
#define _GLIBCXX_PROFILE_UNORDERED_SET 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
# include <unordered_set>
#include <profile/base.h>
#include <profile/unordered_base.h>
#define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc>
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/** @brief Unordered_set wrapper with performance instrumentation. */
template<typename _Key,
typename _Hash = std::hash<_Key>,
typename _Pred = std::equal_to<_Key>,
typename _Alloc = std::allocator<_Key> >
class unordered_set
: public _GLIBCXX_STD_BASE,
public _Unordered_profile<unordered_set<_Key, _Hash, _Pred, _Alloc>,
true>
{
typedef _GLIBCXX_STD_BASE _Base;
_Base&
_M_base() noexcept { return *this; }
const _Base&
_M_base() const noexcept { return *this; }
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
typedef typename _Base::key_type key_type;
typedef typename _Base::value_type value_type;
typedef typename _Base::difference_type difference_type;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef typename _Base::iterator iterator;
typedef typename _Base::const_iterator const_iterator;
unordered_set() = default;
explicit
unordered_set(size_type __n,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a)
{ }
template<typename _InputIterator>
unordered_set(_InputIterator __f, _InputIterator __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
unordered_set(const unordered_set&) = default;
unordered_set(const _Base& __x)
: _Base(__x)
{ }
unordered_set(unordered_set&&) = default;
explicit
unordered_set(const allocator_type& __a)
: _Base(__a)
{ }
unordered_set(const unordered_set& __uset,
const allocator_type& __a)
: _Base(__uset._M_base(), __a)
{ }
unordered_set(unordered_set&& __uset,
const allocator_type& __a)
: _Base(std::move(__uset._M_base()), __a)
{ }
unordered_set(initializer_list<value_type> __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__l, __n, __hf, __eql, __a)
{ }
unordered_set(size_type __n, const allocator_type& __a)
: unordered_set(__n, hasher(), key_equal(), __a)
{ }
unordered_set(size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_set(__n, __hf, key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_set(_InputIterator __first, _InputIterator __last,
size_type __n,
const allocator_type& __a)
: unordered_set(__first, __last, __n, hasher(), key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_set(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_set(__first, __last, __n, __hf, key_equal(), __a)
{ }
unordered_set(initializer_list<value_type> __l,
size_type __n,
const allocator_type& __a)
: unordered_set(__l, __n, hasher(), key_equal(), __a)
{ }
unordered_set(initializer_list<value_type> __l,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_set(__l, __n, __hf, key_equal(), __a)
{ }
unordered_set&
operator=(const unordered_set&) = default;
unordered_set&
operator=(unordered_set&&) = default;
unordered_set&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
void
swap(unordered_set& __x)
noexcept( noexcept(__x._M_base().swap(__x)) )
{
_Base::swap(__x);
this->_M_swap(__x);
}
void
clear() noexcept
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
template<typename... _Args>
std::pair<iterator, bool>
emplace(_Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res
= _Base::emplace(std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __it, _Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
iterator __res
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
void
insert(std::initializer_list<value_type> __l)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__l);
this->_M_profile_resize(__old_size);
}
std::pair<iterator, bool>
insert(const value_type& __obj)
{
size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res = _Base::insert(__obj);
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(const_iterator __iter, const value_type& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, __v);
this->_M_profile_resize(__old_size);
return __res;
}
std::pair<iterator, bool>
insert(value_type&& __obj)
{
size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res = _Base::insert(std::move(__obj));
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(const_iterator __iter, value_type&& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, std::move(__v));
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__first, __last);
this->_M_profile_resize(__old_size);
}
void
rehash(size_type __n)
{
size_type __old_size = _Base::bucket_count();
_Base::rehash(__n);
this->_M_profile_resize(__old_size);
}
};
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
inline bool
operator==(const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
template<typename _Key, typename _Hash, typename _Pred, typename _Alloc>
inline bool
operator!=(const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
{ return !(__x == __y); }
#undef _GLIBCXX_BASE
#undef _GLIBCXX_STD_BASE
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
#define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc>
/** @brief Unordered_multiset wrapper with performance instrumentation. */
template<typename _Value,
typename _Hash = std::hash<_Value>,
typename _Pred = std::equal_to<_Value>,
typename _Alloc = std::allocator<_Value> >
class unordered_multiset
: public _GLIBCXX_STD_BASE,
public _Unordered_profile<unordered_multiset<_Value,
_Hash, _Pred, _Alloc>,
false>
{
typedef _GLIBCXX_STD_BASE _Base;
_Base&
_M_base() noexcept { return *this; }
const _Base&
_M_base() const noexcept { return *this; }
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
typedef typename _Base::key_type key_type;
typedef typename _Base::value_type value_type;
typedef typename _Base::difference_type difference_type;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef typename _Base::iterator iterator;
typedef typename _Base::const_iterator const_iterator;
unordered_multiset() = default;
explicit
unordered_multiset(size_type __n,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a)
{ }
template<typename _InputIterator>
unordered_multiset(_InputIterator __f, _InputIterator __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
unordered_multiset(const unordered_multiset&) = default;
unordered_multiset(const _Base& __x)
: _Base(__x)
{ }
unordered_multiset(unordered_multiset&&) = default;
explicit
unordered_multiset(const allocator_type& __a)
: _Base(__a)
{ }
unordered_multiset(const unordered_multiset& __umset,
const allocator_type& __a)
: _Base(__umset._M_base(), __a)
{ }
unordered_multiset(unordered_multiset&& __umset,
const allocator_type& __a)
: _Base(std::move(__umset._M_base()), __a)
{ }
unordered_multiset(initializer_list<value_type> __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__l, __n, __hf, __eql, __a)
{ }
unordered_multiset(size_type __n, const allocator_type& __a)
: unordered_multiset(__n, hasher(), key_equal(), __a)
{ }
unordered_multiset(size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_multiset(__n, __hf, key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_multiset(_InputIterator __first, _InputIterator __last,
size_type __n,
const allocator_type& __a)
: unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_multiset(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_multiset(__first, __last, __n, __hf, key_equal(), __a)
{ }
unordered_multiset(initializer_list<value_type> __l,
size_type __n,
const allocator_type& __a)
: unordered_multiset(__l, __n, hasher(), key_equal(), __a)
{ }
unordered_multiset(initializer_list<value_type> __l,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_multiset(__l, __n, __hf, key_equal(), __a)
{ }
unordered_multiset&
operator=(const unordered_multiset&) = default;
unordered_multiset&
operator=(unordered_multiset&&) = default;
unordered_multiset&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
void
swap(unordered_multiset& __x)
noexcept( noexcept(__x._M_base().swap(__x)) )
{
_Base::swap(__x);
this->_M_swap(__x);
}
void
clear() noexcept
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
template<typename... _Args>
iterator
emplace(_Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::emplace(std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __it, _Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
iterator __res
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
void
insert(std::initializer_list<value_type> __l)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__l);
this->_M_profile_resize(__old_size);
}
iterator
insert(const value_type& __obj)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__obj);
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(const_iterator __iter, const value_type& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, __v);
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(value_type&& __obj)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(std::move(__obj));
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(const_iterator __iter, value_type&& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, std::move(__v));
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__first, __last);
this->_M_profile_resize(__old_size);
}
void
rehash(size_type __n)
{
size_type __old_size = _Base::bucket_count();
_Base::rehash(__n);
this->_M_profile_resize(__old_size);
}
};
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline bool
operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline bool
operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ return !(__x == __y); }
} // namespace __profile
} // namespace std
#undef _GLIBCXX_BASE
#undef _GLIBCXX_STD_BASE
#endif // C++11
#endif
// Profiling multiset implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file profile/multiset.h
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_MULTISET_H
#define _GLIBCXX_PROFILE_MULTISET_H 1
#include <profile/base.h>
#include <profile/ordered_base.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::multiset wrapper with performance instrumentation.
template<typename _Key, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<_Key> >
class multiset
: public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>,
public _Ordered_profile<multiset<_Key, _Compare, _Allocator> >
{
typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_iterator _Base_const_iterator;
public:
// types:
typedef _Key key_type;
typedef _Key value_type;
typedef _Compare key_compare;
typedef _Compare value_compare;
typedef _Allocator allocator_type;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __iterator_tracker<_Base_iterator,
multiset> iterator;
typedef __iterator_tracker<_Base_const_iterator,
multiset> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
// 23.3.3.1 construct/copy/destroy:
#if __cplusplus < 201103L
multiset()
: _Base() { }
multiset(const multiset& __x)
: _Base(__x) { }
~multiset() { }
#else
multiset() = default;
multiset(const multiset&) = default;
multiset(multiset&&) = default;
~multiset() = default;
#endif
explicit multiset(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __comp, __a) { }
#if __cplusplus >= 201103L
multiset(initializer_list<value_type> __l,
const _Compare& __comp = _Compare(),
const allocator_type& __a = allocator_type())
: _Base(__l, __comp, __a) { }
explicit
multiset(const allocator_type& __a)
: _Base(__a) { }
multiset(const multiset& __x, const allocator_type& __a)
: _Base(__x, __a) { }
multiset(multiset&& __x, const allocator_type& __a)
noexcept( noexcept(_Base(std::move(__x), __a)) )
: _Base(std::move(__x), __a) { }
multiset(initializer_list<value_type> __l, const allocator_type& __a)
: _Base(__l, __a) { }
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
: _Base(__first, __last, __a) { }
#endif
multiset(const _Base& __x)
: _Base(__x) { }
#if __cplusplus < 201103L
multiset&
operator=(const multiset& __x)
{
this->_M_profile_destruct();
_M_base() = __x;
this->_M_profile_construct();
return *this;
}
#else
multiset&
operator=(const multiset&) = default;
multiset&
operator=(multiset&&) = default;
multiset&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
#endif
// iterators
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
#if __cplusplus >= 201103L
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::cbegin(), this); }
const_iterator
cend() const noexcept
{ return const_iterator(_Base::cend(), this); }
#endif
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(end());
}
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(end());
}
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return reverse_iterator(begin());
}
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(begin());
}
#if __cplusplus >= 201103L
const_reverse_iterator
crbegin() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cend());
}
const_reverse_iterator
crend() const noexcept
{
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_reverse_iterator(cbegin());
}
#endif
void
swap(multiset& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{
_Base::swap(__x);
this->_M_swap(__x);
}
// modifiers:
#if __cplusplus >= 201103L
template<typename... _Args>
iterator
emplace(_Args&&... __args)
{
// The cost is the same whether or not the element is inserted so we
// always report insertion of 1 element.
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::emplace(std::forward<_Args>(__args)...), this);
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __pos, _Args&&... __args)
{
auto size_before = this->size();
auto __res
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
iterator
insert(const value_type& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::insert(__x), this);
}
#if __cplusplus >= 201103L
iterator
insert(value_type&& __x)
{
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::insert(std::move(__x)), this);
}
#endif
iterator
insert(const_iterator __pos, const value_type& __x)
{
size_type size_before = this->size();
_Base_iterator __res = _Base::insert(__pos.base(), __x);
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#if __cplusplus >= 201103L
iterator
insert(const_iterator __pos, value_type&& __x)
{
auto size_before = this->size();
auto __res = _Base::insert(__pos.base(), std::move(__x));
__profcxx_map2umap_insert(this->_M_map2umap_info,
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
return iterator(__res, this);
}
#endif
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
void
insert(_InputIterator __first, _InputIterator __last)
{
for (; __first != __last; ++__first)
insert(*__first);
}
#if __cplusplus >= 201103L
void
insert(initializer_list<value_type> __l)
{ insert(__l.begin(), __l.end()); }
#endif
#if __cplusplus >= 201103L
iterator
erase(const_iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return iterator(_Base::erase(__pos.base()), this);
}
#else
void
erase(iterator __pos)
{
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
_Base::erase(__pos.base());
}
#endif
size_type
erase(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
return _Base::erase(__x);
}
#if __cplusplus >= 201103L
iterator
erase(const_iterator __first, const_iterator __last)
{
if (__first != __last)
{
iterator __ret;
for (; __first != __last;)
__ret = erase(__first++);
return __ret;
}
else
return iterator(_Base::erase(__first.base(), __last.base()), this);
}
#else
void
erase(iterator __first, iterator __last)
{
for (; __first != __last;)
erase(__first++);
}
#endif
void
clear() _GLIBCXX_NOEXCEPT
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
size_type
count(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
size_type
count(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return _Base::count(__x);
}
#endif
// multiset operations:
iterator
find(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return iterator(_Base::find(__x), this);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
const_iterator
find(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return const_iterator(_Base::find(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
find(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
find(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return { _Base::find(__x), this };
}
#endif
iterator
lower_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
return iterator(_Base::lower_bound(__x), this);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
const_iterator
lower_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::lower_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
lower_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
lower_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::lower_bound(__x), this };
}
#endif
iterator
upper_bound(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return iterator(_Base::upper_bound(__x), this);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
const_iterator
upper_bound(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return const_iterator(_Base::upper_bound(__x), this);
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
iterator
upper_bound(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
const_iterator
upper_bound(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
return { _Base::upper_bound(__x), this };
}
#endif
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_iterator, _Base_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(iterator(__base_ret.first, this),
iterator(__base_ret.second, this));
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
= _Base::equal_range(__x);
return std::make_pair(const_iterator(__base_ret.first, this),
const_iterator(__base_ret.second, this));
}
#if __cplusplus > 201103L
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<iterator, iterator>
equal_range(const _Kt& __x)
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
template<typename _Kt,
typename _Req =
typename __has_is_transparent<_Compare, _Kt>::type>
std::pair<const_iterator, const_iterator>
equal_range(const _Kt& __x) const
{
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
auto __res = _Base::equal_range(__x);
return { { __res.first, this }, { __res.second, this } };
}
#endif
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
private:
/** If hint is used we consider that the map and unordered_map
* operations have equivalent insertion cost so we do not update metrics
* about it.
* Note that to find out if hint has been used is libstdc++
* implementation dependent.
*/
bool
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
{
return (__hint == __res
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|| (__hint != _M_base().end() && (++__hint == __res
|| ++__res == --__hint)));
}
template<typename _K1, typename _C1, typename _A1>
friend bool
operator==(const multiset<_K1, _C1, _A1>&,
const multiset<_K1, _C1, _A1>&);
template<typename _K1, typename _C1, typename _A1>
friend bool
operator< (const multiset<_K1, _C1, _A1>&,
const multiset<_K1, _C1, _A1>&);
};
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() == __rhs._M_base();
}
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
return __lhs._M_base() < __rhs._M_base();
}
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return !(__lhs < __rhs); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __rhs < __lhs; }
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ return __x.swap(__y); }
} // namespace __profile
} // namespace std
#endif
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_state.h
* @brief Global profiler state.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_STATE_H
#define _GLIBCXX_PROFILE_PROFILER_STATE_H 1
namespace __gnu_profile
{
enum __state_type { __ON, __OFF, __INVALID };
_GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
inline bool
__turn(__state_type __s)
{
__state_type inv(__INVALID);
return __atomic_compare_exchange_n(&_GLIBCXX_PROFILE_DATA(__state),
&inv, __s, false, __ATOMIC_ACQ_REL,
__ATOMIC_RELAXED);
}
inline bool
__turn_on()
{ return __turn(__ON); }
inline bool
__turn_off()
{ return __turn(__OFF); }
inline bool
__is_on()
{ return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
inline bool
__is_off()
{ return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
inline bool
__is_invalid()
{ return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
} // end namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_trace.h
* @brief Data structures to represent profiling traces.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_TRACE_H
#define _GLIBCXX_PROFILE_PROFILER_TRACE_H 1
#include <cstdio> // fopen, fclose, fprintf, FILE
#include <cerrno>
#include <cstdlib> // atof, atoi, strtol, getenv, atexit, abort
#if __cplusplus >= 201103L
#include <unordered_map>
#define _GLIBCXX_IMPL_UNORDERED_MAP std::_GLIBCXX_STD_C::unordered_map
#else
#include <tr1/unordered_map>
#define _GLIBCXX_IMPL_UNORDERED_MAP std::tr1::unordered_map
#endif
#include <ext/concurrence.h>
#include <fstream>
#include <string>
#include <utility>
#include <vector>
#include "profile/impl/profiler_algos.h"
#include "profile/impl/profiler_state.h"
#include "profile/impl/profiler_node.h"
namespace __gnu_profile
{
/** @brief Internal environment. Values can be set one of two ways:
1. In config file "var = value". The default config file path is
libstdcxx-profile.conf.
2. By setting process environment variables. For instance, in a Bash
shell you can set the unit cost of iterating through a map like this:
export __map_iterate_cost_factor=5.0.
If a value is set both in the input file and through an environment
variable, the environment value takes precedence. */
typedef _GLIBCXX_IMPL_UNORDERED_MAP<std::string, std::string> __env_t;
_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__env_t, __env);
/** @brief Master lock. */
_GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__gnu_cxx::__mutex, __global_mutex);
/** @brief Representation of a warning. */
struct __warning_data
{
float __magnitude;
__stack_t __context;
const char* __warning_id;
std::string __warning_message;
__warning_data()
: __magnitude(0.0), __context(0), __warning_id(0) { }
__warning_data(float __m, __stack_t __c, const char* __id,
const std::string& __msg)
: __magnitude(__m), __context(__c), __warning_id(__id),
__warning_message(__msg) { }
bool
operator<(const __warning_data& __other) const
{ return __magnitude < __other.__magnitude; }
};
typedef std::_GLIBCXX_STD_C::vector<__warning_data> __warning_vector_t;
// Defined in profiler_<diagnostic name>.h.
class __trace_hash_func;
class __trace_hashtable_size;
class __trace_map2umap;
class __trace_vector_size;
class __trace_vector_to_list;
class __trace_list_to_slist;
class __trace_list_to_vector;
void __trace_vector_size_init();
void __trace_hashtable_size_init();
void __trace_hash_func_init();
void __trace_vector_to_list_init();
void __trace_list_to_slist_init();
void __trace_list_to_vector_init();
void __trace_map_to_unordered_map_init();
void __trace_vector_size_report(FILE*, __warning_vector_t&);
void __trace_hashtable_size_report(FILE*, __warning_vector_t&);
void __trace_hash_func_report(FILE*, __warning_vector_t&);
void __trace_vector_to_list_report(FILE*, __warning_vector_t&);
void __trace_list_to_slist_report(FILE*, __warning_vector_t&);
void __trace_list_to_vector_report(FILE*, __warning_vector_t&);
void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&);
void __trace_vector_size_free();
void __trace_hashtable_size_free();
void __trace_hash_func_free();
void __trace_vector_to_list_free();
void __trace_list_to_slist_free();
void __trace_list_to_vector_free();
void __trace_map_to_unordered_map_free();
struct __cost_factor
{
const char* __env_var;
float __value;
};
typedef std::_GLIBCXX_STD_C::vector<__cost_factor*> __cost_factor_vector;
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_hash_func*, _S_hash_func, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_hashtable_size*, _S_hashtable_size, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_map2umap*, _S_map2umap, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_size*, _S_vector_size, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_to_list*, _S_vector_to_list, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_slist*, _S_list_to_slist, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_vector*, _S_list_to_vector, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_shift_cost_factor,
{"__vector_shift_cost_factor", 1.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_iterate_cost_factor,
{"__vector_iterate_cost_factor", 1.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_resize_cost_factor,
{"__vector_resize_cost_factor", 1.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_shift_cost_factor,
{"__list_shift_cost_factor", 0.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_iterate_cost_factor,
{"__list_iterate_cost_factor", 10.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_resize_cost_factor,
{"__list_resize_cost_factor", 0.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_insert_cost_factor,
{"__map_insert_cost_factor", 1.5});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_erase_cost_factor,
{"__map_erase_cost_factor", 1.5});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_find_cost_factor,
{"__map_find_cost_factor", 1});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_iterate_cost_factor,
{"__map_iterate_cost_factor", 2.3});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_insert_cost_factor,
{"__umap_insert_cost_factor", 12.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_erase_cost_factor,
{"__umap_erase_cost_factor", 12.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_find_cost_factor,
{"__umap_find_cost_factor", 10.0});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_iterate_cost_factor,
{"__umap_iterate_cost_factor", 1.7});
_GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor_vector*, __cost_factors, 0);
_GLIBCXX_PROFILE_DEFINE_DATA(const char*, _S_trace_file_name,
_GLIBCXX_PROFILE_TRACE_PATH_ROOT);
_GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_warn_count,
_GLIBCXX_PROFILE_MAX_WARN_COUNT);
_GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_stack_depth,
_GLIBCXX_PROFILE_MAX_STACK_DEPTH);
_GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_mem,
_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC);
inline std::size_t
__stack_max_depth()
{ return _GLIBCXX_PROFILE_DATA(_S_max_stack_depth); }
inline std::size_t
__max_mem()
{ return _GLIBCXX_PROFILE_DATA(_S_max_mem); }
/** @brief Base class for all trace producers. */
template<typename __object_info, typename __stack_info>
class __trace_base
{
public:
// Do not pick the initial size too large, as we don't know which
// diagnostics are more active.
__trace_base()
: __objects_byte_size(0), __stack_table(10000),
__stack_table_byte_size(0), __id(0) { }
~__trace_base()
{
for (typename __stack_table_t::iterator __it
= __stack_table.begin(); __it != __stack_table.end(); ++__it)
delete __it->first;
}
__object_info* __add_object(__stack_t __stack);
void __retire_object(__object_info* __info);
void __write(FILE* __f);
void __collect_warnings(__warning_vector_t& __warnings);
void __free();
private:
__gnu_cxx::__mutex __trace_mutex;
typedef _GLIBCXX_IMPL_UNORDERED_MAP<__stack_t, __stack_info,
__stack_hash,
__stack_hash> __stack_table_t;
std::size_t __objects_byte_size;
__stack_table_t __stack_table;
std::size_t __stack_table_byte_size;
protected:
const char* __id;
};
template<typename __object_info, typename __stack_info>
__object_info*
__trace_base<__object_info, __stack_info>::
__add_object(__stack_t __stack)
{
// If we have no backtrace information no need to collect data.
if (!__stack)
return 0;
__gnu_cxx::__scoped_lock __lock(this->__trace_mutex);
if (__max_mem() != 0 && __objects_byte_size >= __max_mem())
{
delete __stack;
return 0;
}
__object_info* __ret = new(std::nothrow) __object_info(__stack);
if (!__ret)
{
delete __stack;
return 0;
}
__objects_byte_size += sizeof(__object_info);
return __ret;
}
template<typename __object_info, typename __stack_info>
void
__trace_base<__object_info, __stack_info>::
__retire_object(__object_info* __obj_info)
{
if (!__obj_info)
return;
__gnu_cxx::__scoped_lock __lock(this->__trace_mutex);
const __object_info& __info = *__obj_info;
__stack_t __stack = __info.__stack();
typename __stack_table_t::iterator __stack_it
= __stack_table.find(__stack);
if (__stack_it == __stack_table.end())
{
// First occurrence of this call context.
if (__max_mem() == 0 || __stack_table_byte_size < __max_mem())
{
__stack_table_byte_size
+= (sizeof(__instruction_address_t) * __size(__stack)
+ sizeof(__stack) + sizeof(__stack_info));
__stack_table.insert(make_pair(__stack,
__stack_info(__info)));
}
else
delete __stack;
}
else
{
// Merge object info into info summary for this call context.
__stack_it->second.__merge(__info);
delete __stack;
}
delete __obj_info;
__objects_byte_size -= sizeof(__object_info);
}
template<typename __object_info, typename __stack_info>
void
__trace_base<__object_info, __stack_info>::
__write(FILE* __f)
{
for (typename __stack_table_t::iterator __it
= __stack_table.begin(); __it != __stack_table.end(); ++__it)
if (__it->second.__is_valid())
{
std::fprintf(__f, __id);
std::fprintf(__f, "|");
__gnu_profile::__write(__f, __it->first);
std::fprintf(__f, "|");
__it->second.__write(__f);
}
}
template<typename __object_info, typename __stack_info>
void
__trace_base<__object_info, __stack_info>::
__collect_warnings(__warning_vector_t& __warnings)
{
for (typename __stack_table_t::iterator __it
= __stack_table.begin(); __it != __stack_table.end(); ++__it)
__warnings.push_back(__warning_data(__it->second.__magnitude(),
__it->first, __id,
__it->second.__advice()));
}
template<typename __object_info, typename __stack_info>
inline void
__trace_report(__trace_base<__object_info, __stack_info>* __cont,
FILE* __f, __warning_vector_t& __warnings)
{
if (__cont)
{
__cont->__collect_warnings(__warnings);
__cont->__write(__f);
}
}
inline std::size_t
__env_to_size_t(const char* __env_var, std::size_t __default_value)
{
char* __env_value = std::getenv(__env_var);
if (__env_value)
{
errno = 0;
long __converted_value = std::strtol(__env_value, 0, 10);
if (errno || __converted_value < 0)
{
std::fprintf(stderr,
"Bad value for environment variable '%s'.\n",
__env_var);
std::abort();
}
else
return static_cast<std::size_t>(__converted_value);
}
else
return __default_value;
}
inline void
__set_max_stack_trace_depth()
{
_GLIBCXX_PROFILE_DATA(_S_max_stack_depth)
= __env_to_size_t(_GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR,
_GLIBCXX_PROFILE_DATA(_S_max_stack_depth));
}
inline void
__set_max_mem()
{
_GLIBCXX_PROFILE_DATA(_S_max_mem)
= __env_to_size_t(_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR,
_GLIBCXX_PROFILE_DATA(_S_max_mem));
}
inline int
__log_magnitude(float __f)
{
const float __log_base = 10.0;
int __result = 0;
int __sign = 1;
if (__f < 0)
{
__f = -__f;
__sign = -1;
}
while (__f > __log_base)
{
++__result;
__f /= 10.0;
}
return __sign * __result;
}
inline FILE*
__open_output_file(const char* __extension)
{
// The path is made of _S_trace_file_name + "." + extension.
std::size_t __root_len
= __builtin_strlen(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
std::size_t __ext_len = __builtin_strlen(__extension);
char* __file_name = new char[__root_len + 1 + __ext_len + 1];
__builtin_memcpy(__file_name,
_GLIBCXX_PROFILE_DATA(_S_trace_file_name),
__root_len);
*(__file_name + __root_len) = '.';
__builtin_memcpy(__file_name + __root_len + 1,
__extension, __ext_len + 1);
FILE* __out_file = std::fopen(__file_name, "w");
if (!__out_file)
{
std::fprintf(stderr, "Could not open trace file '%s'.\n",
__file_name);
std::abort();
}
delete[] __file_name;
return __out_file;
}
struct __warn
{
FILE* __file;
__warn(FILE* __f)
{ __file = __f; }
void
operator()(const __warning_data& __info)
{
std::fprintf(__file, __info.__warning_id);
std::fprintf(__file, ": improvement = %d",
__log_magnitude(__info.__magnitude));
std::fprintf(__file, ": call stack = ");
__gnu_profile::__write(__file, __info.__context);
std::fprintf(__file, ": advice = %s\n",
__info.__warning_message.c_str());
}
};
/** @brief Final report method, registered with @b atexit.
*
* This can also be called directly by user code, including signal handlers.
* It is protected against deadlocks by the reentrance guard in profiler.h.
* However, when called from a signal handler that triggers while within
* __gnu_profile (under the guarded zone), no output will be produced.
*/
inline void
__report()
{
__gnu_cxx::__scoped_lock __lock(_GLIBCXX_PROFILE_DATA(__global_mutex));
__warning_vector_t __warnings, __top_warnings;
FILE* __raw_file = __open_output_file("raw");
__trace_vector_size_report(__raw_file, __warnings);
__trace_hashtable_size_report(__raw_file, __warnings);
__trace_hash_func_report(__raw_file, __warnings);
__trace_vector_to_list_report(__raw_file, __warnings);
__trace_list_to_slist_report(__raw_file, __warnings);
__trace_list_to_vector_report(__raw_file, __warnings);
__trace_map_to_unordered_map_report(__raw_file, __warnings);
std::fclose(__raw_file);
// Sort data by magnitude, keeping just top N.
std::size_t __cutoff = std::min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count),
__warnings.size());
__top_n(__warnings, __top_warnings, __cutoff);
FILE* __warn_file = __open_output_file("txt");
__for_each(__top_warnings.begin(), __top_warnings.end(),
__warn(__warn_file));
std::fclose(__warn_file);
}
inline void
__report_and_free()
{
__report();
__trace_map_to_unordered_map_free();
__trace_list_to_vector_free();
__trace_list_to_slist_free();
__trace_vector_to_list_free();
__trace_hash_func_free();
__trace_hashtable_size_free();
__trace_vector_size_free();
delete _GLIBCXX_PROFILE_DATA(__cost_factors);
}
inline void
__set_trace_path()
{
char* __env_trace_file_name = std::getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR);
if (__env_trace_file_name)
_GLIBCXX_PROFILE_DATA(_S_trace_file_name) = __env_trace_file_name;
// Make sure early that we can create the trace file.
std::fclose(__open_output_file("txt"));
}
inline void
__set_max_warn_count()
{
char* __env_max_warn_count_str
= std::getenv(_GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR);
if (__env_max_warn_count_str)
_GLIBCXX_PROFILE_DATA(_S_max_warn_count)
= static_cast<std::size_t>(std::atoi(__env_max_warn_count_str));
}
inline void
__read_cost_factors()
{
std::string __conf_file_name(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
__conf_file_name += ".conf";
std::ifstream __conf_file(__conf_file_name.c_str());
if (__conf_file.is_open())
{
std::string __line;
while (std::getline(__conf_file, __line))
{
std::string::size_type __i = __line.find_first_not_of(" \t\n\v");
if (__line.length() <= 0 || __line[__i] == '#')
// Skip empty lines or comments.
continue;
}
// Trim.
__line.erase(__remove(__line.begin(), __line.end(), ' '),
__line.end());
std::string::size_type __pos = __line.find("=");
std::string __factor_name = __line.substr(0, __pos);
std::string::size_type __end = __line.find_first_of(";\n");
std::string __factor_value = __line.substr(__pos + 1, __end - __pos);
_GLIBCXX_PROFILE_DATA(__env)[__factor_name] = __factor_value;
}
}
struct __cost_factor_writer
{
FILE* __file;
__cost_factor_writer(FILE* __f)
: __file(__f) { }
void
operator() (const __cost_factor* __factor)
{ std::fprintf(__file, "%s = %f\n", __factor->__env_var,
__factor->__value); }
};
inline void
__write_cost_factors()
{
FILE* __file = __open_output_file("conf.out");
__for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
_GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
__cost_factor_writer(__file));
std::fclose(__file);
}
struct __cost_factor_setter
{
void
operator()(__cost_factor* __factor)
{
// Look it up in the process environment first.
const char* __env_value = std::getenv(__factor->__env_var);
if (!__env_value)
{
// Look it up in the config file.
__env_t::iterator __it
= _GLIBCXX_PROFILE_DATA(__env).find(__factor->__env_var);
if (__it != _GLIBCXX_PROFILE_DATA(__env).end())
__env_value = __it->second.c_str();
}
if (__env_value)
__factor->__value = std::atof(__env_value);
}
};
inline void
__set_cost_factors()
{
__cost_factor_vector* __factors = new __cost_factor_vector;
_GLIBCXX_PROFILE_DATA(__cost_factors) = __factors;
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__list_shift_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__list_resize_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_find_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_find_cost_factor));
__factors->push_back(&_GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor));
__for_each(__factors->begin(), __factors->end(), __cost_factor_setter());
}
inline void
__profcxx_init_unconditional()
{
__gnu_cxx::__scoped_lock __lock(_GLIBCXX_PROFILE_DATA(__global_mutex));
if (__is_invalid())
{
__set_max_warn_count();
if (_GLIBCXX_PROFILE_DATA(_S_max_warn_count) == 0)
__turn_off();
else
{
__set_max_stack_trace_depth();
__set_max_mem();
__set_trace_path();
__read_cost_factors();
__set_cost_factors();
__write_cost_factors();
__trace_vector_size_init();
__trace_hashtable_size_init();
__trace_hash_func_init();
__trace_vector_to_list_init();
__trace_list_to_slist_init();
__trace_list_to_vector_init();
__trace_map_to_unordered_map_init();
std::atexit(__report_and_free);
__turn_on();
}
}
}
/** @brief This function must be called by each instrumentation point.
*
* The common path is inlined fully.
*/
inline bool
__profcxx_init()
{
if (__is_invalid())
__profcxx_init_unconditional();
return __is_on();
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_TRACE_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_map_to_unordered_map.h
* @brief Diagnostics for map to unordered_map.
*/
// Written by Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H
#define _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H 1
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
inline int
__log2(std::size_t __size)
{
for (int __bit_count = sizeof(std::size_t) - 1; __bit_count >= 0;
-- __bit_count)
if ((2 << __bit_count) & __size)
return __bit_count;
return 0;
}
inline float
__map_insert_cost(std::size_t __size)
{ return (_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor).__value
* static_cast<float>(__log2(__size))); }
inline float
__map_erase_cost(std::size_t __size)
{ return (_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor).__value
* static_cast<float>(__log2(__size))); }
inline float
__map_find_cost(std::size_t __size)
{ return (_GLIBCXX_PROFILE_DATA(__map_find_cost_factor).__value
* static_cast<float>(__log2(__size))); }
/** @brief A map-to-unordered_map instrumentation line in the
object table. */
class __map2umap_info
: public __object_info_base
{
public:
__map2umap_info(__stack_t __stack)
: __object_info_base(__stack), _M_insert(0), _M_erase(0), _M_find(0),
_M_iterate(0), _M_umap_cost(0.0), _M_map_cost(0.0)
{ }
void
__merge(const __map2umap_info& __o)
{
__object_info_base::__merge(__o);
_M_insert += __o._M_insert;
_M_erase += __o._M_erase;
_M_find += __o._M_find;
_M_iterate += __o._M_iterate;
_M_umap_cost += __o._M_umap_cost;
_M_map_cost += __o._M_map_cost;
}
void
__write(FILE* __f) const
{
std::fprintf(__f, "%Zu %Zu %Zu %Zu %.0f %.0f\n",
_M_insert, _M_erase, _M_find, _M_iterate, _M_map_cost,
_M_umap_cost);
}
float
__magnitude() const
{ return _M_map_cost - _M_umap_cost; }
std::string
__advice() const
{ return "prefer an unordered container"; }
void
__record_insert(std::size_t __size, std::size_t __count)
{
++_M_insert;
if (__count)
{
_M_map_cost += __count * __map_insert_cost(__size);
_M_umap_cost
+= (__count
* _GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor).__value);
}
}
void
__record_erase(std::size_t __size, std::size_t __count)
{
++_M_erase;
if (__count)
{
_M_map_cost += __count * __map_erase_cost(__size);
_M_umap_cost
+= (__count
* _GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor).__value);
}
}
void
__record_find(std::size_t __size)
{
++_M_find;
_M_map_cost += __map_find_cost(__size);
_M_umap_cost += _GLIBCXX_PROFILE_DATA(__umap_find_cost_factor).__value;
}
void
__record_iterate(int __count)
{ __gnu_cxx::__atomic_add(&_M_iterate, __count); }
void
__set_iterate_costs()
{
_M_umap_cost
+= (_M_iterate
* _GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor).__value);
_M_map_cost
+= (_M_iterate
* _GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor).__value);
}
private:
std::size_t _M_insert;
std::size_t _M_erase;
std::size_t _M_find;
mutable _Atomic_word _M_iterate;
float _M_umap_cost;
float _M_map_cost;
};
/** @brief A map-to-unordered_map instrumentation line in the
stack table. */
class __map2umap_stack_info
: public __map2umap_info
{
public:
__map2umap_stack_info(const __map2umap_info& __o)
: __map2umap_info(__o) { }
};
/** @brief Map-to-unordered_map instrumentation producer. */
class __trace_map2umap
: public __trace_base<__map2umap_info, __map2umap_stack_info>
{
public:
__trace_map2umap()
: __trace_base<__map2umap_info, __map2umap_stack_info>()
{ __id = "ordered-to-unordered"; }
// Call at destruction/clean to set container final size.
void
__destruct(__map2umap_info* __obj_info)
{
__obj_info->__set_iterate_costs();
__retire_object(__obj_info);
}
};
inline void
__trace_map_to_unordered_map_init()
{ _GLIBCXX_PROFILE_DATA(_S_map2umap) = new __trace_map2umap(); }
inline void
__trace_map_to_unordered_map_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_map2umap); }
inline void
__trace_map_to_unordered_map_report(FILE* __f,
__warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_map2umap), __f, __warnings); }
inline __map2umap_info*
__trace_map_to_unordered_map_construct()
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_map2umap)->__add_object(__get_stack());
}
inline void
__trace_map_to_unordered_map_insert(__map2umap_info* __info,
std::size_t __size, std::size_t __count)
{
if (!__info)
return;
__info->__record_insert(__size, __count);
}
inline void
__trace_map_to_unordered_map_erase(__map2umap_info* __info,
std::size_t __size, std::size_t __count)
{
if (!__info)
return;
__info->__record_erase(__size, __count);
}
inline void
__trace_map_to_unordered_map_find(__map2umap_info* __info,
std::size_t __size)
{
if (!__info)
return;
__info->__record_find(__size);
}
inline void
__trace_map_to_unordered_map_iterate(__map2umap_info* __info,
int)
{
if (!__info)
return;
// We only collect if an iteration took place no matter in what side.
__info->__record_iterate(1);
}
inline void
__trace_map_to_unordered_map_invalidate(__map2umap_info* __info)
{
if (!__info)
return;
__info->__set_invalid();
}
inline void
__trace_map_to_unordered_map_destruct(__map2umap_info* __info)
{
if (!__info)
return;
_GLIBCXX_PROFILE_DATA(_S_map2umap)->__destruct(__info);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_hash_func.h
* @brief Data structures to represent profiling traces.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H
#define _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H 1
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
/** @brief A hash performance instrumentation line in the object table. */
class __hashfunc_info
: public __object_info_base
{
public:
__hashfunc_info(__stack_t __stack)
: __object_info_base(__stack), _M_longest_chain(0),
_M_accesses(0), _M_hops(0) { }
void
__merge(const __hashfunc_info& __o)
{
__object_info_base::__merge(__o);
_M_longest_chain = std::max(_M_longest_chain, __o._M_longest_chain);
_M_accesses += __o._M_accesses;
_M_hops += __o._M_hops;
}
void
__destruct(std::size_t __chain, std::size_t __accesses,
std::size_t __hops)
{
_M_longest_chain = std::max(_M_longest_chain, __chain);
_M_accesses += __accesses;
_M_hops += __hops;
}
void
__write(FILE* __f) const
{ std::fprintf(__f, "%Zu %Zu %Zu\n", _M_hops,
_M_accesses, _M_longest_chain); }
float
__magnitude() const
{ return static_cast<float>(_M_hops); }
std::string
__advice() const
{ return "change hash function"; }
private:
std::size_t _M_longest_chain;
std::size_t _M_accesses;
std::size_t _M_hops;
};
/** @brief A hash performance instrumentation line in the stack table. */
class __hashfunc_stack_info
: public __hashfunc_info
{
public:
__hashfunc_stack_info(const __hashfunc_info& __o)
: __hashfunc_info(__o) { }
};
/** @brief Hash performance instrumentation producer. */
class __trace_hash_func
: public __trace_base<__hashfunc_info, __hashfunc_stack_info>
{
public:
__trace_hash_func()
: __trace_base<__hashfunc_info, __hashfunc_stack_info>()
{ __id = "hash-distr"; }
~__trace_hash_func() {}
// Call at destruction/clean to set container final size.
void
__destruct(__hashfunc_info* __obj_info,
std::size_t __chain, std::size_t __accesses, std::size_t __hops)
{
if (!__obj_info)
return;
__obj_info->__destruct(__chain, __accesses, __hops);
__retire_object(__obj_info);
}
};
inline void
__trace_hash_func_init()
{ _GLIBCXX_PROFILE_DATA(_S_hash_func) = new __trace_hash_func(); }
inline void
__trace_hash_func_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_hash_func); }
inline void
__trace_hash_func_report(FILE* __f, __warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_hash_func), __f, __warnings); }
inline __hashfunc_info*
__trace_hash_func_construct()
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_hash_func)->__add_object(__get_stack());
}
inline void
__trace_hash_func_destruct(__hashfunc_info* __obj_info,
std::size_t __chain, std::size_t __accesses,
std::size_t __hops)
{
_GLIBCXX_PROFILE_DATA(_S_hash_func)->__destruct(__obj_info, __chain,
__accesses, __hops);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_vector_to_list.h
* @brief diagnostics for vector to list.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H
#define _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 1
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
/** @brief A vector-to-list instrumentation line in the object table. */
class __vector2list_info
: public __object_info_base
{
public:
__vector2list_info(__stack_t __stack)
: __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
_M_resize(0), _M_list_cost(0), _M_vector_cost(0)
{ }
void
__merge(const __vector2list_info& __o)
{
__object_info_base::__merge(__o);
_M_shift_count += __o._M_shift_count;
_M_iterate += __o._M_iterate;
_M_vector_cost += __o._M_vector_cost;
_M_list_cost += __o._M_list_cost;
_M_resize += __o._M_resize;
}
void
__write(FILE* __f) const
{
std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
_M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
}
float
__magnitude() const
{ return _M_vector_cost - _M_list_cost; }
std::string
__advice() const
{ return "change std::vector to std::list"; }
std::size_t
__shift_count()
{ return _M_shift_count; }
std::size_t
__iterate()
{ return _M_iterate; }
float
__list_cost()
{ return _M_list_cost; }
std::size_t
__resize()
{ return _M_resize; }
void
__set_list_cost(float __lc)
{ _M_list_cost = __lc; }
void
__set_vector_cost(float __vc)
{ _M_vector_cost = __vc; }
void
__opr_insert(std::size_t __pos, std::size_t __num)
{ _M_shift_count += __num - __pos; }
void
__opr_iterate(int __num)
{ __gnu_cxx::__atomic_add(&_M_iterate, __num); }
void
__resize(std::size_t __from, std::size_t)
{ _M_resize += __from; }
private:
std::size_t _M_shift_count;
mutable _Atomic_word _M_iterate;
std::size_t _M_resize;
float _M_list_cost;
float _M_vector_cost;
};
/** @brief A vector-to-list instrumentation line in the stack table. */
class __vector2list_stack_info
: public __vector2list_info
{
public:
__vector2list_stack_info(const __vector2list_info& __o)
: __vector2list_info(__o) { }
};
/** @brief Vector-to-list instrumentation producer. */
class __trace_vector_to_list
: public __trace_base<__vector2list_info, __vector2list_stack_info>
{
public:
__trace_vector_to_list()
: __trace_base<__vector2list_info, __vector2list_stack_info>()
{ __id = "vector-to-list"; }
~__trace_vector_to_list() { }
// Call at destruction/clean to set container final size.
void
__destruct(__vector2list_info* __obj_info)
{
float __vc = __vector_cost(__obj_info->__shift_count(),
__obj_info->__iterate(),
__obj_info->__resize());
float __lc = __list_cost(__obj_info->__shift_count(),
__obj_info->__iterate(),
__obj_info->__resize());
__obj_info->__set_vector_cost(__vc);
__obj_info->__set_list_cost(__lc);
__retire_object(__obj_info);
}
// Collect cost of operations.
float
__vector_cost(std::size_t __shift, std::size_t __iterate,
std::size_t __resize)
{
return (__shift
* _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
+ __iterate
* _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value
+ __resize
* _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value);
}
float
__list_cost(std::size_t __shift, std::size_t __iterate,
std::size_t __resize)
{
return (__shift
* _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
+ __iterate
* _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value
+ __resize
* _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value);
}
};
inline void
__trace_vector_to_list_init()
{ _GLIBCXX_PROFILE_DATA(_S_vector_to_list) = new __trace_vector_to_list(); }
inline void
__trace_vector_to_list_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_vector_to_list); }
inline void
__trace_vector_to_list_report(FILE* __f, __warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_vector_to_list), __f, __warnings); }
inline __vector2list_info*
__trace_vector_to_list_construct()
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_vector_to_list)
->__add_object(__get_stack());
}
inline void
__trace_vector_to_list_insert(__vector2list_info* __obj_info,
std::size_t __pos,
std::size_t __num)
{
if (!__obj_info)
return;
__obj_info->__opr_insert(__pos, __num);
}
inline void
__trace_vector_to_list_iterate(__vector2list_info* __obj_info, int)
{
if (!__obj_info)
return;
// We only collect if an iteration took place no matter in what side.
__obj_info->__opr_iterate(1);
}
inline void
__trace_vector_to_list_invalid_operator(__vector2list_info* __obj_info)
{
if (!__obj_info)
return;
__obj_info->__set_invalid();
}
inline void
__trace_vector_to_list_resize(__vector2list_info* __obj_info,
std::size_t __from,
std::size_t __to)
{
if (!__obj_info)
return;
__obj_info->__resize(__from, __to);
}
inline void
__trace_vector_to_list_destruct(__vector2list_info* __obj_info)
{
if (!__obj_info)
return;
_GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj_info);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H */
// -*- C++ -*-
//
// Copyright (C) 2010-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_algos.h
* @brief Algorithms used by the profile extension.
*
* This file is needed to avoid including \<algorithm\> or \<bits/stl_algo.h\>.
* Including those files would result in recursive includes.
* These implementations are oversimplified. In general, efficiency may be
* sacrificed to minimize maintenance overhead.
*/
#ifndef _GLIBCXX_PROFILE_PROFILER_ALGOS_H
#define _GLIBCXX_PROFILE_PROFILER_ALGOS_H 1
namespace __gnu_profile
{
/* Helper for __top_n. Insert in sorted vector, but not beyond Nth elem. */
template<typename _Container>
void
__insert_top_n(_Container& __output,
const typename _Container::value_type& __value,
typename _Container::size_type __n)
{
typename _Container::iterator __it = __output.begin();
typename _Container::size_type __count = 0;
// Skip up to N - 1 elements larger than VALUE.
// XXX: Could do binary search for random iterators.
while (true)
{
if (__count >= __n)
// VALUE is not in top N.
return;
if (__it == __output.end())
break;
if (*__it < __value)
break;
++__it;
++__count;
}
__output.insert(__it, __value);
}
/* Copy the top N elements in INPUT, sorted in reverse order, to OUTPUT. */
template<typename _Container>
void
__top_n(const _Container& __input, _Container& __output,
typename _Container::size_type __n)
{
__output.clear();
typename _Container::const_iterator __it;
for (__it = __input.begin(); __it != __input.end(); ++__it)
__insert_top_n(__output, *__it, __n);
}
/* Simplified clone of std::for_each. */
template<typename _InputIterator, typename _Function>
_Function
__for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
for (; __first != __last; ++__first)
__f(*__first);
return __f;
}
/* Simplified clone of std::remove. */
template<typename _ForwardIterator, typename _Tp>
_ForwardIterator
__remove(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
{
if(__first == __last)
return __first;
_ForwardIterator __result = __first;
++__first;
for(; __first != __last; ++__first)
if(!(*__first == __value))
{
*__result = *__first;
++__result;
}
return __result;
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_ALGOS_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_vector_size.h
* @brief Collection of vector size traces.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
#define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
#include "profile/impl/profiler_state.h"
#include "profile/impl/profiler_container_size.h"
namespace __gnu_profile
{
/** @brief Hashtable size instrumentation trace producer. */
class __trace_vector_size
: public __trace_container_size
{
public:
__trace_vector_size()
: __trace_container_size()
{ __id = "vector-size"; }
};
inline void
__trace_vector_size_init()
{ _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); }
inline void
__trace_vector_size_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_vector_size); }
inline void
__trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_vector_size), __f, __warnings); }
inline __container_size_info*
__trace_vector_size_construct(std::size_t __num)
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_vector_size)->
__insert(__get_stack(), __num);
}
inline void
__trace_vector_size_resize(__container_size_info* __obj_info,
std::size_t __from, std::size_t __to)
{
if (!__obj_info)
return;
__obj_info->__resize(__from, __to);
}
inline void
__trace_vector_size_destruct(__container_size_info* __obj_info,
std::size_t __num, std::size_t __inum)
{
if (!__obj_info)
return;
_GLIBCXX_PROFILE_DATA(_S_vector_size)->
__destruct(__obj_info, __num, __inum);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler.h
* @brief Interface of the profiling runtime library.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_H
#define _GLIBCXX_PROFILE_PROFILER_H 1
#include <bits/c++config.h>
// Mechanism to define data with inline linkage.
#define _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__type, __name) \
inline __type& \
__get_##__name() \
{ \
static __type __name; \
return __name; \
}
#define _GLIBCXX_PROFILE_DEFINE_DATA(__type, __name, __initial_value...) \
inline __type& __get_##__name() { \
static __type __name(__initial_value); \
return __name; \
}
#define _GLIBCXX_PROFILE_DATA(__name) \
__get_##__name()
namespace __gnu_profile
{
/** @brief Reentrance guard.
*
* Mechanism to protect all __gnu_profile operations against recursion,
* multithreaded and exception reentrance.
*/
struct __reentrance_guard
{
static bool
__get_in()
{
if (__inside() == true)
return false;
else
{
__inside() = true;
return true;
}
}
static bool&
__inside()
{
static __thread bool _S_inside(false);
return _S_inside;
}
__reentrance_guard() { }
~__reentrance_guard() { __inside() = false; }
};
// Forward declarations of implementation functions.
// Don't use any __gnu_profile:: in user code.
// Instead, use the __profcxx... macros, which offer guarded access.
class __container_size_info;
class __hashfunc_info;
class __map2umap_info;
class __vector2list_info;
class __list2slist_info;
class __list2vector_info;
bool __turn_on();
bool __turn_off();
bool __is_invalid();
bool __is_on();
bool __is_off();
void __report();
__container_size_info*
__trace_hashtable_size_construct(std::size_t);
void __trace_hashtable_size_resize(__container_size_info*,
std::size_t, std::size_t);
void __trace_hashtable_size_destruct(__container_size_info*,
std::size_t, std::size_t);
__hashfunc_info*
__trace_hash_func_construct();
void __trace_hash_func_destruct(__hashfunc_info*,
std::size_t, std::size_t, std::size_t);
__container_size_info*
__trace_vector_size_construct(std::size_t);
void __trace_vector_size_resize(__container_size_info*,
std::size_t, std::size_t);
void __trace_vector_size_destruct(__container_size_info*,
std::size_t, std::size_t);
__vector2list_info*
__trace_vector_to_list_construct();
void __trace_vector_to_list_insert(__vector2list_info*,
std::size_t, std::size_t);
void __trace_vector_to_list_iterate(__vector2list_info*, int);
void __trace_vector_to_list_invalid_operator(__vector2list_info*);
void __trace_vector_to_list_resize(__vector2list_info*,
std::size_t, std::size_t);
void __trace_vector_to_list_destruct(__vector2list_info*);
__list2slist_info*
__trace_list_to_slist_construct();
void __trace_list_to_slist_rewind(__list2slist_info*);
void __trace_list_to_slist_operation(__list2slist_info*);
void __trace_list_to_slist_destruct(__list2slist_info*);
__list2vector_info*
__trace_list_to_vector_construct();
void __trace_list_to_vector_insert(__list2vector_info*,
std::size_t, std::size_t);
void __trace_list_to_vector_iterate(__list2vector_info*, int);
void __trace_list_to_vector_invalid_operator(__list2vector_info*);
void __trace_list_to_vector_resize(__list2vector_info*,
std::size_t, std::size_t);
void __trace_list_to_vector_destruct(__list2vector_info*);
__map2umap_info*
__trace_map_to_unordered_map_construct();
void __trace_map_to_unordered_map_invalidate(__map2umap_info*);
void __trace_map_to_unordered_map_insert(__map2umap_info*, std::size_t,
std::size_t);
void __trace_map_to_unordered_map_erase(__map2umap_info*, std::size_t,
std::size_t);
void __trace_map_to_unordered_map_iterate(__map2umap_info*, std::size_t);
void __trace_map_to_unordered_map_find(__map2umap_info*, std::size_t);
void __trace_map_to_unordered_map_destruct(__map2umap_info*);
} // namespace __gnu_profile
// Master switch turns on all diagnostics that are not explicitly turned off.
#ifdef _GLIBCXX_PROFILE
#ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_SMALL
#define _GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL
#endif
#ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_LARGE
#define _GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE
#endif
#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_SMALL
#define _GLIBCXX_PROFILE_VECTOR_TOO_SMALL
#endif
#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_LARGE
#define _GLIBCXX_PROFILE_VECTOR_TOO_LARGE
#endif
#ifndef _GLIBCXX_PROFILE_NO_INEFFICIENT_HASH
#define _GLIBCXX_PROFILE_INEFFICIENT_HASH
#endif
#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TO_LIST
#define _GLIBCXX_PROFILE_VECTOR_TO_LIST
#endif
#ifndef _GLIBCXX_PROFILE_NO_LIST_TO_SLIST
#define _GLIBCXX_PROFILE_LIST_TO_SLIST
#endif
#ifndef _GLIBCXX_PROFILE_NO_LIST_TO_VECTOR
#define _GLIBCXX_PROFILE_LIST_TO_VECTOR
#endif
#ifndef _GLIBCXX_PROFILE_NO_MAP_TO_UNORDERED_MAP
#define _GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP
#endif
#endif
// Expose global management routines to user code.
#ifdef _GLIBCXX_PROFILE
#define __profcxx_report() __gnu_profile::__report()
#define __profcxx_turn_on() __gnu_profile::__turn_on()
#define __profcxx_turn_off() __gnu_profile::__turn_off()
#define __profcxx_is_invalid() __gnu_profile::__is_invalid()
#define __profcxx_is_on() __gnu_profile::__is_on()
#define __profcxx_is_off() __gnu_profile::__is_off()
#else
#define __profcxx_report()
#define __profcxx_turn_on()
#define __profcxx_turn_off()
#define __profcxx_is_invalid()
#define __profcxx_is_on()
#define __profcxx_is_off()
#endif
// Turn on/off instrumentation for HASHTABLE_TOO_SMALL and HASHTABLE_TOO_LARGE.
#if (defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL) \
|| defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE))
#define __profcxx_hashtable_size_construct(__x...) \
__gnu_profile::__trace_hashtable_size_construct(__x)
#define __profcxx_hashtable_size_resize(__x...) \
__gnu_profile::__trace_hashtable_size_resize(__x)
#define __profcxx_hashtable_size_destruct(__x...) \
__gnu_profile::__trace_hashtable_size_destruct(__x)
#else
#define __profcxx_hashtable_size_construct(__x...) 0
#define __profcxx_hashtable_size_resize(__x...)
#define __profcxx_hashtable_size_destruct(__x...)
#endif
// Turn on/off instrumentation for VECTOR_TOO_SMALL and VECTOR_TOO_LARGE.
#if (defined(_GLIBCXX_PROFILE_VECTOR_TOO_SMALL) \
|| defined(_GLIBCXX_PROFILE_VECTOR_TOO_LARGE))
#define __profcxx_vector_size_construct(__x...) \
__gnu_profile::__trace_vector_size_construct(__x)
#define __profcxx_vector_size_resize(__x...) \
__gnu_profile::__trace_vector_size_resize(__x)
#define __profcxx_vector_size_destruct(__x...) \
__gnu_profile::__trace_vector_size_destruct(__x)
#else
#define __profcxx_vector_size_construct(__x...) 0
#define __profcxx_vector_size_resize(__x...)
#define __profcxx_vector_size_destruct(__x...)
#endif
// Turn on/off instrumentation for INEFFICIENT_HASH.
#if defined(_GLIBCXX_PROFILE_INEFFICIENT_HASH)
#define __profcxx_hash_func_construct(__x...) \
__gnu_profile::__trace_hash_func_construct(__x)
#define __profcxx_hash_func_destruct(__x...) \
__gnu_profile::__trace_hash_func_destruct(__x)
#else
#define __profcxx_hash_func_construct(__x...) 0
#define __profcxx_hash_func_destruct(__x...)
#endif
// Turn on/off instrumentation for VECTOR_TO_LIST.
#if defined(_GLIBCXX_PROFILE_VECTOR_TO_LIST)
#define __profcxx_vector2list_construct(__x...) \
__gnu_profile::__trace_vector_to_list_construct(__x)
#define __profcxx_vector2list_insert(__x...) \
__gnu_profile::__trace_vector_to_list_insert(__x)
#define __profcxx_vector2list_iterate(__x...) \
__gnu_profile::__trace_vector_to_list_iterate(__x)
#define __profcxx_vector2list_invalid_operator(__x...) \
__gnu_profile::__trace_vector_to_list_invalid_operator(__x)
#define __profcxx_vector2list_resize(__x...) \
__gnu_profile::__trace_vector_to_list_resize(__x)
#define __profcxx_vector2list_destruct(__x...) \
__gnu_profile::__trace_vector_to_list_destruct(__x)
#else
#define __profcxx_vector2list_construct(__x...) 0
#define __profcxx_vector2list_insert(__x...)
#define __profcxx_vector2list_iterate(__x...)
#define __profcxx_vector2list_invalid_operator(__x...)
#define __profcxx_vector2list_resize(__x...)
#define __profcxx_vector2list_destruct(__x...)
#endif
// Turn on/off instrumentation for LIST_TO_VECTOR.
#if defined(_GLIBCXX_PROFILE_LIST_TO_VECTOR)
#define __profcxx_list2vector_construct(__x...) \
__gnu_profile::__trace_list_to_vector_construct(__x)
#define __profcxx_list2vector_insert(__x...) \
__gnu_profile::__trace_list_to_vector_insert(__x)
#define __profcxx_list2vector_iterate(__x...) \
__gnu_profile::__trace_list_to_vector_iterate(__x)
#define __profcxx_list2vector_invalid_operator(__x...) \
__gnu_profile::__trace_list_to_vector_invalid_operator(__x)
#define __profcxx_list2vector_destruct(__x...) \
__gnu_profile::__trace_list_to_vector_destruct(__x)
#else
#define __profcxx_list2vector_construct(__x...) 0
#define __profcxx_list2vector_insert(__x...)
#define __profcxx_list2vector_iterate(__x...)
#define __profcxx_list2vector_invalid_operator(__x...)
#define __profcxx_list2vector_destruct(__x...)
#endif
// Turn on/off instrumentation for LIST_TO_SLIST.
#if defined(_GLIBCXX_PROFILE_LIST_TO_SLIST)
#define __profcxx_list2slist_construct(__x...) \
__gnu_profile::__trace_list_to_slist_construct(__x)
#define __profcxx_list2slist_rewind(__x...) \
__gnu_profile::__trace_list_to_slist_rewind(__x)
#define __profcxx_list2slist_operation(__x...) \
__gnu_profile::__trace_list_to_slist_operation(__x)
#define __profcxx_list2slist_destruct(__x...) \
__gnu_profile::__trace_list_to_slist_destruct(__x)
#else
#define __profcxx_list2slist_construct(__x...) 0
#define __profcxx_list2slist_rewind(__x...)
#define __profcxx_list2slist_operation(__x...)
#define __profcxx_list2slist_destruct(__x...)
#endif
// Turn on/off instrumentation for MAP_TO_UNORDERED_MAP.
#if defined(_GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP)
#define __profcxx_map2umap_construct(__x...) \
__gnu_profile::__trace_map_to_unordered_map_construct(__x)
#define __profcxx_map2umap_insert(__x...) \
__gnu_profile::__trace_map_to_unordered_map_insert(__x)
#define __profcxx_map2umap_erase(__x...) \
__gnu_profile::__trace_map_to_unordered_map_erase(__x)
#define __profcxx_map2umap_iterate(__x...) \
__gnu_profile::__trace_map_to_unordered_map_iterate(__x)
#define __profcxx_map2umap_invalidate(__x...) \
__gnu_profile::__trace_map_to_unordered_map_invalidate(__x)
#define __profcxx_map2umap_find(__x...) \
__gnu_profile::__trace_map_to_unordered_map_find(__x)
#define __profcxx_map2umap_destruct(__x...) \
__gnu_profile::__trace_map_to_unordered_map_destruct(__x)
#else
#define __profcxx_map2umap_construct(__x...) 0
#define __profcxx_map2umap_insert(__x...)
#define __profcxx_map2umap_erase(__x...)
#define __profcxx_map2umap_iterate(__x...)
#define __profcxx_map2umap_invalidate(__x...)
#define __profcxx_map2umap_find(__x...)
#define __profcxx_map2umap_destruct(__x...)
#endif
// Set default values for compile-time customizable variables.
#ifndef _GLIBCXX_PROFILE_TRACE_PATH_ROOT
#define _GLIBCXX_PROFILE_TRACE_PATH_ROOT "libstdcxx-profile"
#endif
#ifndef _GLIBCXX_PROFILE_TRACE_ENV_VAR
#define _GLIBCXX_PROFILE_TRACE_ENV_VAR "_GLIBCXX_PROFILE_TRACE_PATH_ROOT"
#endif
#ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR
#define _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR \
"_GLIBCXX_PROFILE_MAX_WARN_COUNT"
#endif
#ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT
#define _GLIBCXX_PROFILE_MAX_WARN_COUNT 10
#endif
#ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH
#define _GLIBCXX_PROFILE_MAX_STACK_DEPTH 32
#endif
#ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR
#define _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR \
"_GLIBCXX_PROFILE_MAX_STACK_DEPTH"
#endif
#ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC
#define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC (1 << 28)
#endif
#ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR
#define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR \
"_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC"
#endif
// Instrumentation hook implementations.
#include "profile/impl/profiler_hash_func.h"
#include "profile/impl/profiler_hashtable_size.h"
#include "profile/impl/profiler_map_to_unordered_map.h"
#include "profile/impl/profiler_vector_size.h"
#include "profile/impl/profiler_vector_to_list.h"
#include "profile/impl/profiler_list_to_slist.h"
#include "profile/impl/profiler_list_to_vector.h"
#endif // _GLIBCXX_PROFILE_PROFILER_H
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_hashtable_size.h
* @brief Collection of hashtable size traces.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H
#define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
#include "profile/impl/profiler_state.h"
#include "profile/impl/profiler_container_size.h"
namespace __gnu_profile
{
/** @brief Hashtable size instrumentation trace producer. */
class __trace_hashtable_size
: public __trace_container_size
{
public:
__trace_hashtable_size()
: __trace_container_size()
{ __id = "hashtable-size"; }
};
inline void
__trace_hashtable_size_init()
{ _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); }
inline void
__trace_hashtable_size_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_hashtable_size); }
inline void
__trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_hashtable_size), __f, __warnings); }
inline __container_size_info*
__trace_hashtable_size_construct(std::size_t __num)
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
__insert(__get_stack(), __num);
}
inline void
__trace_hashtable_size_resize(__container_size_info* __obj_info,
std::size_t __from, std::size_t __to)
{
if (!__obj_info)
return;
__obj_info->__resize(__from, __to);
}
inline void
__trace_hashtable_size_destruct(__container_size_info* __obj_info,
std::size_t __num, std::size_t __inum)
{
if (!__obj_info)
return;
_GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
__destruct(__obj_info, __num, __inum);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_container_size.h
* @brief Diagnostics for container sizes.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H
#define _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H 1
#include <sstream>
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
/** @brief A container size instrumentation line in the object table. */
class __container_size_info
: public __object_info_base
{
public:
__container_size_info(__stack_t __stack)
: __object_info_base(__stack), _M_init(0), _M_max(0),
_M_min(0), _M_total(0), _M_item_min(0), _M_item_max(0),
_M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0)
{ }
void
__write(FILE* __f) const
{
std::fprintf(__f, "%Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu\n",
_M_init, _M_count, _M_cost, _M_resize, _M_min, _M_max,
_M_total, _M_item_min, _M_item_max, _M_item_total);
}
float
__magnitude() const
{ return static_cast<float>(_M_cost); }
std::string
__advice() const
{
std::stringstream __message;
if (_M_init < _M_item_max)
__message << "change initial container size from " << _M_init
<< " to " << _M_item_max;
return __message.str();
}
void
__init(std::size_t __num)
{
_M_init = __num;
_M_max = __num;
}
void
__merge(const __container_size_info& __o)
{
__object_info_base::__merge(__o);
_M_init = std::max(_M_init, __o._M_init);
_M_max = std::max(_M_max, __o._M_max);
_M_item_max = std::max(_M_item_max, __o._M_item_max);
_M_min = std::min(_M_min, __o._M_min);
_M_item_min = std::min(_M_item_min, __o._M_item_min);
_M_total += __o._M_total;
_M_item_total += __o._M_item_total;
_M_count += __o._M_count;
_M_cost += __o._M_cost;
_M_resize += __o._M_resize;
}
// Call if a container is destructed or cleaned.
void
__destruct(std::size_t __num, std::size_t __inum)
{
_M_max = std::max(_M_max, __num);
_M_item_max = std::max(_M_item_max, __inum);
if (_M_min == 0)
{
_M_min = __num;
_M_item_min = __inum;
}
else
{
_M_min = std::min(_M_min, __num);
_M_item_min = std::min(_M_item_min, __inum);
}
_M_total += __num;
_M_item_total += __inum;
_M_count += 1;
}
// Estimate the cost of resize/rehash.
float
__resize_cost(std::size_t __from, std::size_t)
{ return __from; }
// Call if container is resized.
void
__resize(std::size_t __from, std::size_t __to)
{
_M_cost += this->__resize_cost(__from, __to);
_M_resize += 1;
_M_max = std::max(_M_max, __to);
}
private:
std::size_t _M_init;
std::size_t _M_max; // range of # buckets
std::size_t _M_min;
std::size_t _M_total;
std::size_t _M_item_min; // range of # items
std::size_t _M_item_max;
std::size_t _M_item_total;
std::size_t _M_count;
std::size_t _M_resize;
std::size_t _M_cost;
};
/** @brief A container size instrumentation line in the stack table. */
class __container_size_stack_info
: public __container_size_info
{
public:
__container_size_stack_info(const __container_size_info& __o)
: __container_size_info(__o) { }
};
/** @brief Container size instrumentation trace producer. */
class __trace_container_size
: public __trace_base<__container_size_info, __container_size_stack_info>
{
public:
~__trace_container_size() { }
__trace_container_size()
: __trace_base<__container_size_info, __container_size_stack_info>() { };
// Insert a new node at construct with object, callstack and initial size.
__container_size_info*
__insert(__stack_t __stack, std::size_t __num)
{
__container_size_info* __ret = __add_object(__stack);
if (__ret)
__ret->__init(__num);
return __ret;
}
// Call at destruction/clean to set container final size.
void
__destruct(__container_size_info* __obj_info,
std::size_t __num, std::size_t __inum)
{
__obj_info->__destruct(__num, __inum);
__retire_object(__obj_info);
}
};
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_list_to_vector.h
* @brief diagnostics for list to vector.
*/
// Written by Changhee Jung.
#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H
#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H 1
#include <sstream>
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
/** @brief A list-to-vector instrumentation line in the object table. */
class __list2vector_info
: public __object_info_base
{
public:
__list2vector_info(__stack_t __stack)
: __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
_M_resize(0), _M_list_cost(0), _M_vector_cost(0),
_M_max_size(0) { }
void
__merge(const __list2vector_info& __o)
{
__object_info_base::__merge(__o);
_M_shift_count += __o._M_shift_count;
_M_iterate += __o._M_iterate;
_M_vector_cost += __o._M_vector_cost;
_M_list_cost += __o._M_list_cost;
_M_resize += __o._M_resize;
_M_max_size = std::max( _M_max_size, __o._M_max_size);
}
void
__write(FILE* __f) const
{
std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
_M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
}
float
__magnitude() const
{ return _M_list_cost - _M_vector_cost; }
std::string
__advice() const
{
std::stringstream __sstream;
__sstream
<< "change std::list to std::vector and its initial size from 0 to "
<< _M_max_size;
return __sstream.str();
}
std::size_t
__shift_count()
{ return _M_shift_count; }
std::size_t
__iterate()
{ return _M_iterate; }
float
__list_cost()
{ return _M_list_cost; }
std::size_t
__resize()
{ return _M_resize; }
void
__set_list_cost(float __lc)
{ _M_list_cost = __lc; }
void
__set_vector_cost(float __vc)
{ _M_vector_cost = __vc; }
void
__opr_insert(std::size_t __shift, std::size_t __size)
{
_M_shift_count += __shift;
_M_max_size = std::max(_M_max_size, __size);
}
void
__opr_iterate(int __num)
{ __gnu_cxx::__atomic_add(&_M_iterate, __num); }
void
__resize(std::size_t __from, std::size_t)
{ _M_resize += __from; }
private:
std::size_t _M_shift_count;
mutable _Atomic_word _M_iterate;
std::size_t _M_resize;
float _M_list_cost;
float _M_vector_cost;
std::size_t _M_max_size;
};
class __list2vector_stack_info
: public __list2vector_info
{
public:
__list2vector_stack_info(const __list2vector_info& __o)
: __list2vector_info(__o) {}
};
class __trace_list_to_vector
: public __trace_base<__list2vector_info, __list2vector_stack_info>
{
public:
__trace_list_to_vector()
: __trace_base<__list2vector_info, __list2vector_stack_info>()
{ __id = "list-to-vector"; }
~__trace_list_to_vector() { }
// Call at destruction/clean to set container final size.
void
__destruct(__list2vector_info* __obj_info)
{
float __vc = __vector_cost(__obj_info->__shift_count(),
__obj_info->__iterate());
float __lc = __list_cost(__obj_info->__shift_count(),
__obj_info->__iterate());
__obj_info->__set_vector_cost(__vc);
__obj_info->__set_list_cost(__lc);
__retire_object(__obj_info);
}
// Collect cost of operations.
float
__vector_cost(std::size_t __shift, std::size_t __iterate)
{
// The resulting vector will use a 'reserve' method.
return (__shift
* _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
+ __iterate
* _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value);
}
float
__list_cost(std::size_t __shift, std::size_t __iterate)
{
return (__shift
* _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
+ __iterate
* _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value);
}
};
inline void
__trace_list_to_vector_init()
{ _GLIBCXX_PROFILE_DATA(_S_list_to_vector) = new __trace_list_to_vector(); }
inline void
__trace_list_to_vector_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_list_to_vector); }
inline void
__trace_list_to_vector_report(FILE* __f, __warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_list_to_vector), __f, __warnings); }
inline __list2vector_info*
__trace_list_to_vector_construct()
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_list_to_vector)
->__add_object(__get_stack());
}
inline void
__trace_list_to_vector_insert(__list2vector_info* __obj_info,
std::size_t __shift, std::size_t __size)
{
if (!__obj_info)
return;
__obj_info->__opr_insert(__shift, __size);
}
inline void
__trace_list_to_vector_iterate(__list2vector_info* __obj_info,
int)
{
if (!__obj_info)
return;
// We only collect if an iteration took place no matter in what side.
__obj_info->__opr_iterate(1);
}
inline void
__trace_list_to_vector_invalid_operator(__list2vector_info* __obj_info)
{
if (!__obj_info)
return;
__obj_info->__set_invalid();
}
inline void
__trace_list_to_vector_resize(__list2vector_info* __obj_info,
std::size_t __from, std::size_t __to)
{
if (!__obj_info)
return;
__obj_info->__resize(__from, __to);
}
inline void
__trace_list_to_vector_destruct(__list2vector_info* __obj_info)
{
if (!__obj_info)
return;
_GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__destruct(__obj_info);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H__ */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_node.h
* @brief Data structures to represent a single profiling event.
*/
// Written by Lixia Liu and Silvius Rus.
#ifndef _GLIBCXX_PROFILE_PROFILER_NODE_H
#define _GLIBCXX_PROFILE_PROFILER_NODE_H 1
#include <cstdio> // FILE, fprintf
#include <vector>
#if defined _GLIBCXX_HAVE_EXECINFO_H
#include <execinfo.h>
#endif
namespace __gnu_profile
{
typedef void* __instruction_address_t;
typedef std::_GLIBCXX_STD_C::vector<__instruction_address_t> __stack_npt;
typedef __stack_npt* __stack_t;
std::size_t __stack_max_depth();
inline __stack_t
__get_stack()
{
#if defined _GLIBCXX_HAVE_EXECINFO_H
__try
{
std::size_t __max_depth = __stack_max_depth();
if (__max_depth == 0)
return 0;
__stack_npt __buffer(__max_depth);
int __depth = backtrace(&__buffer[0], __max_depth);
return new(std::nothrow) __stack_npt(__buffer.begin(),
__buffer.begin() + __depth);
}
__catch(...)
{
return 0;
}
#else
return 0;
#endif
}
inline std::size_t
__size(__stack_t __stack)
{
if (!__stack)
return 0;
else
return __stack->size();
}
// XXX
inline void
__write(FILE* __f, __stack_t __stack)
{
if (!__stack)
return;
__stack_npt::const_iterator __it;
for (__it = __stack->begin(); __it != __stack->end(); ++__it)
std::fprintf(__f, "%p ", *__it);
}
/** @brief Hash function for summary trace using call stack as index. */
class __stack_hash
{
public:
std::size_t
operator()(__stack_t __s) const
{
if (!__s)
return 0;
std::size_t __index = 0;
__stack_npt::const_iterator __it;
for (__it = __s->begin(); __it != __s->end(); ++__it)
__index += reinterpret_cast<std::size_t>(*__it);
return __index;
}
bool operator() (__stack_t __stack1, __stack_t __stack2) const
{
if (!__stack1 && !__stack2)
return true;
if (!__stack1 || !__stack2)
return false;
if (__stack1->size() != __stack2->size())
return false;
std::size_t __byte_size
= __stack1->size() * sizeof(__stack_npt::value_type);
return __builtin_memcmp(&(*__stack1)[0], &(*__stack2)[0],
__byte_size) == 0;
}
};
/** @brief Base class for a line in the object table. */
class __object_info_base
{
public:
__object_info_base(__stack_t __stack)
: _M_stack(__stack), _M_valid(true) { }
bool
__is_valid() const
{ return _M_valid; }
void
__set_invalid()
{ _M_valid = false; }
void
__merge(const __object_info_base& __o)
{ _M_valid &= __o._M_valid; }
__stack_t
__stack() const
{ return _M_stack; }
protected:
__stack_t _M_stack;
bool _M_valid;
};
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_NODE_H */
// -*- C++ -*-
//
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/impl/profiler_list_to_slist.h
* @brief Diagnostics for list to slist.
*/
// Written by Changhee Jung.
#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H
#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H 1
#include "profile/impl/profiler.h"
#include "profile/impl/profiler_node.h"
#include "profile/impl/profiler_trace.h"
namespace __gnu_profile
{
class __list2slist_info
: public __object_info_base
{
public:
__list2slist_info(__stack_t __stack)
: __object_info_base(__stack), _M_rewind(false), _M_operations(0) { }
// XXX: the magnitude should be multiplied with a constant factor F,
// where F is 1 when the malloc size class of list nodes is different
// from the malloc size class of slist nodes. When they fall into the same
// class, the only slist benefit is from having to set fewer links, so
// the factor F should be much smaller, closer to 0 than to 1.
// This could be implemented by passing the size classes in the config
// file. For now, we always assume F to be 1.
float
__magnitude() const
{
if (!_M_rewind)
return _M_operations;
else
return 0;
}
void
__write(FILE* __f) const
{ std::fprintf(__f, "%s\n", _M_rewind ? "invalid" : "valid"); }
std::string
__advice() const
{ return "change std::list to std::forward_list"; }
void
__opr_rewind()
{
_M_rewind = true;
__set_invalid();
}
void
__record_operation()
{ ++_M_operations; }
bool
__has_rewind()
{ return _M_rewind; }
private:
bool _M_rewind;
std::size_t _M_operations;
};
class __list2slist_stack_info
: public __list2slist_info
{
public:
__list2slist_stack_info(const __list2slist_info& __o)
: __list2slist_info(__o) { }
};
class __trace_list_to_slist
: public __trace_base<__list2slist_info, __list2slist_stack_info>
{
public:
~__trace_list_to_slist() { }
__trace_list_to_slist()
: __trace_base<__list2slist_info, __list2slist_stack_info>()
{ __id = "list-to-slist"; }
void
__destruct(__list2slist_info* __obj_info)
{ __retire_object(__obj_info); }
};
inline void
__trace_list_to_slist_init()
{ _GLIBCXX_PROFILE_DATA(_S_list_to_slist) = new __trace_list_to_slist(); }
inline void
__trace_list_to_slist_free()
{ delete _GLIBCXX_PROFILE_DATA(_S_list_to_slist); }
inline void
__trace_list_to_slist_report(FILE* __f, __warning_vector_t& __warnings)
{ __trace_report(_GLIBCXX_PROFILE_DATA(_S_list_to_slist), __f, __warnings); }
inline __list2slist_info*
__trace_list_to_slist_construct()
{
if (!__profcxx_init())
return 0;
if (!__reentrance_guard::__get_in())
return 0;
__reentrance_guard __get_out;
return _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__add_object(__get_stack());
}
inline void
__trace_list_to_slist_rewind(__list2slist_info* __obj_info)
{
if (!__obj_info)
return;
__obj_info->__opr_rewind();
}
inline void
__trace_list_to_slist_operation(__list2slist_info* __obj_info)
{
if (!__obj_info)
return;
__obj_info->__record_operation();
}
inline void
__trace_list_to_slist_destruct(__list2slist_info* __obj_info)
{
if (!__obj_info)
return;
_GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__destruct(__obj_info);
}
} // namespace __gnu_profile
#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H */
// Profiling unordered_map/unordered_multimap implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/unordered_map
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_UNORDERED_MAP
#define _GLIBCXX_PROFILE_UNORDERED_MAP 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
# include <unordered_map>
#include <profile/base.h>
#include <profile/unordered_base.h>
#define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
/// Class std::unordered_map wrapper with performance instrumentation.
template<typename _Key, typename _Tp,
typename _Hash = std::hash<_Key>,
typename _Pred = std::equal_to<_Key>,
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
class unordered_map
: public _GLIBCXX_STD_BASE,
public _Unordered_profile<unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
true>
{
typedef typename _GLIBCXX_STD_BASE _Base;
_Base&
_M_base() noexcept { return *this; }
const _Base&
_M_base() const noexcept { return *this; }
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
typedef typename _Base::key_type key_type;
typedef typename _Base::value_type value_type;
typedef typename _Base::difference_type difference_type;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef typename _Base::mapped_type mapped_type;
typedef typename _Base::iterator iterator;
typedef typename _Base::const_iterator const_iterator;
unordered_map() = default;
explicit
unordered_map(size_type __n,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a) { }
template<typename _InputIterator>
unordered_map(_InputIterator __f, _InputIterator __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a) { }
unordered_map(const unordered_map&) = default;
unordered_map(const _Base& __x)
: _Base(__x) { }
unordered_map(unordered_map&&) = default;
explicit
unordered_map(const allocator_type& __a)
: _Base(__a) { }
unordered_map(const unordered_map& __umap,
const allocator_type& __a)
: _Base(__umap, __a) { }
unordered_map(unordered_map&& __umap,
const allocator_type& __a)
: _Base(std::move(__umap._M_base()), __a) { }
unordered_map(initializer_list<value_type> __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__l, __n, __hf, __eql, __a) { }
unordered_map(size_type __n, const allocator_type& __a)
: unordered_map(__n, hasher(), key_equal(), __a)
{ }
unordered_map(size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_map(__n, __hf, key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_map(_InputIterator __first, _InputIterator __last,
size_type __n,
const allocator_type& __a)
: unordered_map(__first, __last, __n, hasher(), key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_map(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_map(__first, __last, __n, __hf, key_equal(), __a)
{ }
unordered_map(initializer_list<value_type> __l,
size_type __n,
const allocator_type& __a)
: unordered_map(__l, __n, hasher(), key_equal(), __a)
{ }
unordered_map(initializer_list<value_type> __l,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_map(__l, __n, __hf, key_equal(), __a)
{ }
unordered_map&
operator=(const unordered_map&) = default;
unordered_map&
operator=(unordered_map&&) = default;
unordered_map&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
void
clear() noexcept
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
template<typename... _Args>
std::pair<iterator, bool>
emplace(_Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res
= _Base::emplace(std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __it, _Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
iterator __res
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
void
insert(std::initializer_list<value_type> __l)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__l);
this->_M_profile_resize(__old_size);
}
std::pair<iterator, bool>
insert(const value_type& __obj)
{
size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res = _Base::insert(__obj);
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(const_iterator __iter, const value_type& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, __v);
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
std::pair<iterator, bool>
insert(_Pair&& __obj)
{
size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res
= _Base::insert(std::forward<_Pair>(__obj));
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
iterator
insert(const_iterator __iter, _Pair&& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__first, __last);
this->_M_profile_resize(__old_size);
}
// operator[]
mapped_type&
operator[](const _Key& __k)
{
size_type __old_size = _Base::bucket_count();
mapped_type& __res = _M_base()[__k];
this->_M_profile_resize(__old_size);
return __res;
}
mapped_type&
operator[](_Key&& __k)
{
size_type __old_size = _Base::bucket_count();
mapped_type& __res = _M_base()[std::move(__k)];
this->_M_profile_resize(__old_size);
return __res;
}
void
swap(unordered_map& __x)
noexcept( noexcept(__x._M_base().swap(__x)) )
{
_Base::swap(__x._M_base());
this->_M_swap(__x);
}
void rehash(size_type __n)
{
size_type __old_size = _Base::bucket_count();
_Base::rehash(__n);
this->_M_profile_resize(__old_size);
}
};
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline bool
operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline bool
operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ return !(__x == __y); }
#undef _GLIBCXX_BASE
#undef _GLIBCXX_STD_BASE
#define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
/// Class std::unordered_multimap wrapper with performance instrumentation.
template<typename _Key, typename _Tp,
typename _Hash = std::hash<_Key>,
typename _Pred = std::equal_to<_Key>,
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
class unordered_multimap
: public _GLIBCXX_STD_BASE,
public _Unordered_profile<unordered_multimap<_Key, _Tp,
_Hash, _Pred, _Alloc>,
false>
{
typedef typename _GLIBCXX_STD_BASE _Base;
_Base&
_M_base() noexcept { return *this; }
const _Base&
_M_base() const noexcept { return *this; }
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
typedef typename _Base::key_type key_type;
typedef typename _Base::value_type value_type;
typedef typename _Base::difference_type difference_type;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef typename _Base::iterator iterator;
typedef typename _Base::const_iterator const_iterator;
unordered_multimap() = default;
explicit
unordered_multimap(size_type __n,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a) { }
template<typename _InputIterator>
unordered_multimap(_InputIterator __f, _InputIterator __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a) { }
unordered_multimap(const unordered_multimap&) = default;
unordered_multimap(const _Base& __x)
: _Base(__x) { }
unordered_multimap(unordered_multimap&&) = default;
explicit
unordered_multimap(const allocator_type& __a)
: _Base(__a) { }
unordered_multimap(const unordered_multimap& __ummap,
const allocator_type& __a)
: _Base(__ummap._M_base(), __a) { }
unordered_multimap(unordered_multimap&& __ummap,
const allocator_type& __a)
: _Base(std::move(__ummap._M_base()), __a) { }
unordered_multimap(initializer_list<value_type> __l,
size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__l, __n, __hf, __eql, __a) { }
unordered_multimap(size_type __n, const allocator_type& __a)
: unordered_multimap(__n, hasher(), key_equal(), __a)
{ }
unordered_multimap(size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_multimap(__n, __hf, key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_multimap(_InputIterator __first, _InputIterator __last,
size_type __n,
const allocator_type& __a)
: unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a)
{ }
template<typename _InputIterator>
unordered_multimap(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_multimap(__first, __last, __n, __hf, key_equal(), __a)
{ }
unordered_multimap(initializer_list<value_type> __l,
size_type __n,
const allocator_type& __a)
: unordered_multimap(__l, __n, hasher(), key_equal(), __a)
{ }
unordered_multimap(initializer_list<value_type> __l,
size_type __n, const hasher& __hf,
const allocator_type& __a)
: unordered_multimap(__l, __n, __hf, key_equal(), __a)
{ }
unordered_multimap&
operator=(const unordered_multimap&) = default;
unordered_multimap&
operator=(unordered_multimap&&) = default;
unordered_multimap&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
void
clear() noexcept
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
template<typename... _Args>
iterator
emplace(_Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
iterator __res
= _Base::emplace(std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
template<typename... _Args>
iterator
emplace_hint(const_iterator __it, _Args&&... __args)
{
size_type __old_size = _Base::bucket_count();
iterator __res
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
this->_M_profile_resize(__old_size);
return __res;
}
void
insert(std::initializer_list<value_type> __l)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__l);
this->_M_profile_resize(__old_size);
}
iterator
insert(const value_type& __obj)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__obj);
this->_M_profile_resize(__old_size);
return __res;
}
iterator
insert(const_iterator __iter, const value_type& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, __v);
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
iterator
insert(_Pair&& __obj)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(std::forward<_Pair>(__obj));
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
iterator
insert(const_iterator __iter, _Pair&& __v)
{
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
this->_M_profile_resize(__old_size);
return __res;
}
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
{
size_type __old_size = _Base::bucket_count();
_Base::insert(__first, __last);
this->_M_profile_resize(__old_size);
}
void
swap(unordered_multimap& __x)
noexcept( noexcept(__x._M_base().swap(__x)) )
{
_Base::swap(__x._M_base());
this->_M_swap(__x);
}
void
rehash(size_type __n)
{
size_type __old_size = _Base::bucket_count();
_Base::rehash(__n);
this->_M_profile_resize(__old_size);
}
};
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline bool
operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline bool
operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ return !(__x == __y); }
} // namespace __profile
} // namespace std
#undef _GLIBCXX_BASE
#undef _GLIBCXX_STD_BASE
#endif // C++11
#endif
// Profiling vector implementation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
/** @file profile/vector
* This file is a GNU profile extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_PROFILE_VECTOR
#define _GLIBCXX_PROFILE_VECTOR 1
#include <vector>
#include <utility>
#include <profile/base.h>
#include <profile/iterator_tracker.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
{
template<typename _Vector>
class _Vector_profile_pre
{
_Vector&
_M_conjure()
{ return *static_cast<_Vector*>(this); }
public:
#if __cplusplus >= 201103L
_Vector_profile_pre() = default;
_Vector_profile_pre(const _Vector_profile_pre&) = default;
_Vector_profile_pre(_Vector_profile_pre&&) = default;
_Vector_profile_pre&
operator=(const _Vector_profile_pre&)
{ _M_conjure()._M_profile_destruct(); }
_Vector_profile_pre&
operator=(_Vector_profile_pre&&) noexcept
{ _M_conjure()._M_profile_destruct(); }
#endif
};
template<typename _Vector>
class _Vector_profile_post
{
_Vector&
_M_conjure()
{ return *static_cast<_Vector*>(this); }
protected:
__gnu_profile::__container_size_info* _M_size_info;
__gnu_profile::__vector2list_info* _M_vect2list_info;
_Vector_profile_post() _GLIBCXX_NOEXCEPT
{ _M_profile_construct(); }
#if __cplusplus >= 201103L
_Vector_profile_post(const _Vector_profile_post&) noexcept
: _Vector_profile_post() { }
_Vector_profile_post(_Vector_profile_post&& __other) noexcept
: _Vector_profile_post()
{ _M_swap(__other); }
_Vector_profile_post&
operator=(const _Vector_profile_post&) noexcept
{ _M_profile_construct(); }
_Vector_profile_post&
operator=(_Vector_profile_post&& __other) noexcept
{
_M_swap(__other);
__other._M_profile_construct();
}
#endif
~_Vector_profile_post()
{ _M_conjure()._M_profile_destruct(); }
public:
void
_M_profile_construct() _GLIBCXX_NOEXCEPT
{
_M_size_info =
__profcxx_vector_size_construct(_M_conjure().capacity());
_M_vect2list_info = __profcxx_vector2list_construct();
}
void
_M_profile_destruct() _GLIBCXX_NOEXCEPT
{
__profcxx_vector2list_destruct(_M_vect2list_info);
_M_vect2list_info = 0;
__profcxx_vector_size_destruct(_M_size_info,
_M_conjure().capacity(),
_M_conjure().size());
_M_size_info = 0;
}
void
_M_swap(_Vector_profile_post& __other) _GLIBCXX_NOEXCEPT
{
std::swap(_M_size_info, __other._M_size_info);
std::swap(_M_vect2list_info, __other._M_vect2list_info);
}
};
template<typename _Tp,
typename _Allocator = std::allocator<_Tp> >
class vector
: public _Vector_profile_pre<vector<_Tp, _Allocator> >,
public _GLIBCXX_STD_C::vector<_Tp, _Allocator>,
public _Vector_profile_post<vector<_Tp, _Allocator> >
{
typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_iterator _Base_const_iterator;
public:
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __iterator_tracker<_Base_iterator, vector>
iterator;
typedef __iterator_tracker<_Base_const_iterator, vector>
const_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
typedef _Tp value_type;
typedef _Allocator allocator_type;
typedef typename _Base::pointer pointer;
typedef typename _Base::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
// 23.2.4.1 construct/copy/destroy:
#if __cplusplus < 201103L
vector()
{ }
vector(const vector& __x)
: _Base(__x) { }
#else
vector() = default;
vector(const vector&) = default;
vector(vector&&) = default;
#endif
explicit
vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
explicit
vector(size_type __n, const _Allocator& __a = _Allocator())
: _Base(__n, __a) { }
vector(size_type __n, const _Tp& __value,
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#else
explicit
vector(size_type __n, const _Tp& __value = _Tp(),
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#endif
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator>
#endif
vector(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
: _Base(__first, __last, __a) { }
/// Construction from a normal-mode vector
vector(const _Base& __x)
: _Base(__x) { }
#if __cplusplus >= 201103L
vector(const _Base& __x, const _Allocator& __a)
: _Base(__x, __a) { }
vector(vector&& __x, const _Allocator& __a)
: _Base(std::move(__x), __a) { }
vector(initializer_list<value_type> __l,
const allocator_type& __a = allocator_type())
: _Base(__l, __a) { }
#endif
#if __cplusplus < 201103L
vector&
operator=(const vector& __x)
{
this->_M_profile_destruct();
_M_base() = __x;
this->_M_profile_construct();
return *this;
}
#else
vector&
operator=(const vector&) = default;
vector&
operator=(vector&&) = default;
vector&
operator=(initializer_list<value_type> __l)
{
this->_M_profile_destruct();
_M_base() = __l;
this->_M_profile_construct();
return *this;
}
#endif
// iterators:
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(end()); }
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(end()); }
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(begin()); }
#if __cplusplus >= 201103L
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::begin(), this); }
const_iterator
cend() const noexcept
{ return const_iterator(_Base::end(), this); }
const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(end()); }
const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(begin()); }
#endif
// 23.2.4.2 capacity:
#if __cplusplus >= 201103L
void
resize(size_type __sz)
{
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
_M_profile_resize(this->capacity(), __sz);
_Base::resize(__sz);
}
void
resize(size_type __sz, const _Tp& __c)
{
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
_M_profile_resize(this->capacity(), __sz);
_Base::resize(__sz, __c);
}
#else
void
resize(size_type __sz, _Tp __c = _Tp())
{
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
_M_profile_resize(this->capacity(), __sz);
_Base::resize(__sz, __c);
}
#endif
// element access:
reference
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
return _M_base()[__n];
}
const_reference
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__profcxx_vector2list_invalid_operator(this->_M_vect2list_info);
return _M_base()[__n];
}
// 23.2.4.3 modifiers:
void
push_back(const _Tp& __x)
{
size_type __old_size = this->capacity();
_Base::push_back(__x);
_M_profile_resize(__old_size, this->capacity());
}
#if __cplusplus >= 201103L
void
push_back(_Tp&& __x)
{
size_type __old_size = this->capacity();
_Base::push_back(std::move(__x));
_M_profile_resize(__old_size, this->capacity());
}
#endif
iterator
#if __cplusplus >= 201103L
insert(const_iterator __pos, const _Tp& __x)
#else
insert(iterator __pos, const _Tp& __x)
#endif
{
__profcxx_vector2list_insert(this->_M_vect2list_info,
__pos.base() - _Base::begin(),
this->size());
size_type __old_size = this->capacity();
_Base_iterator __res = _Base::insert(__pos.base(), __x);
_M_profile_resize(__old_size, this->capacity());
return iterator(__res, this);
}
#if __cplusplus >= 201103L
iterator
insert(const_iterator __pos, _Tp&& __x)
{
__profcxx_vector2list_insert(this->_M_vect2list_info,
__pos.base() - _Base::cbegin(),
this->size());
size_type __old_size = this->capacity();
_Base_iterator __res = _Base::insert(__pos.base(), __x);
_M_profile_resize(__old_size, this->capacity());
return iterator(__res, this);
}
template<typename... _Args>
iterator
emplace(const_iterator __pos, _Args&&... __args)
{
_Base_iterator __res = _Base::emplace(__pos.base(),
std::forward<_Args>(__args)...);
return iterator(__res, this);
}
iterator
insert(const_iterator __pos, initializer_list<value_type> __l)
{ return this->insert(__pos, __l.begin(), __l.end()); }
#endif
void
swap(vector& __x)
#if __cplusplus >= 201103L
noexcept( noexcept(declval<_Base>().swap(__x)) )
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
}
#if __cplusplus >= 201103L
iterator
insert(const_iterator __pos, size_type __n, const _Tp& __x)
{
__profcxx_vector2list_insert(this->_M_vect2list_info,
__pos.base() - _Base::cbegin(),
this->size());
size_type __old_size = this->capacity();
_Base_iterator __res = _Base::insert(__pos, __n, __x);
_M_profile_resize(__old_size, this->capacity());
return iterator(__res, this);
}
#else
void
insert(iterator __pos, size_type __n, const _Tp& __x)
{
__profcxx_vector2list_insert(this->_M_vect2list_info,
__pos.base() - _Base::begin(),
this->size());
size_type __old_size = this->capacity();
_Base::insert(__pos, __n, __x);
_M_profile_resize(__old_size, this->capacity());
}
#endif
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
iterator
insert(const_iterator __pos,
_InputIterator __first, _InputIterator __last)
{
__profcxx_vector2list_insert(this->_M_vect2list_info,
__pos.base() - _Base::cbegin(),
this->size());
size_type __old_size = this->capacity();
_Base_iterator __res = _Base::insert(__pos, __first, __last);
_M_profile_resize(__old_size, this->capacity());
return iterator(__res, this);
}
#else
template<typename _InputIterator>
void
insert(iterator __pos,
_InputIterator __first, _InputIterator __last)
{
__profcxx_vector2list_insert(this->_M_vect2list_info,
__pos.base() - _Base::begin(),
this->size());
size_type __old_size = this->capacity();
_Base::insert(__pos, __first, __last);
_M_profile_resize(__old_size, this->capacity());
}
#endif
iterator
#if __cplusplus >= 201103L
erase(const_iterator __pos)
#else
erase(iterator __pos)
#endif
{ return iterator(_Base::erase(__pos.base()), this); }
iterator
#if __cplusplus >= 201103L
erase(const_iterator __first, const_iterator __last)
#else
erase(iterator __first, iterator __last)
#endif
{ return iterator(_Base::erase(__first.base(), __last.base()), this); }
void
clear() _GLIBCXX_NOEXCEPT
{
this->_M_profile_destruct();
_Base::clear();
this->_M_profile_construct();
}
inline void
_M_profile_iterate(int __rewind = 0) const
{ __profcxx_vector2list_iterate(this->_M_vect2list_info, __rewind); }
private:
void _M_profile_resize(size_type __old_size, size_type __new_size)
{
if (__old_size < __new_size)
{
__profcxx_vector_size_resize(this->_M_size_info,
this->size(), __new_size);
__profcxx_vector2list_resize(this->_M_vect2list_info,
this->size(), __new_size);
}
}
};
template<typename _Tp, typename _Alloc>
inline bool
operator==(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator!=(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<=(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>=(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
} // namespace __profile
#if __cplusplus >= 201103L
// DR 1182.
/// std::hash specialization for vector<bool>.
template<typename _Alloc>
struct hash<__profile::vector<bool, _Alloc>>
: public __hash_base<size_t, __profile::vector<bool, _Alloc>>
{
size_t
operator()(const __profile::vector<bool, _Alloc>& __b) const noexcept
{
return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()(__b._M_base());
}
};
#endif
} // namespace std
#endif
// <algorithm> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file include/algorithm
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_ALGORITHM
#define _GLIBCXX_ALGORITHM 1
#pragma GCC system_header
#include <utility> // UK-300.
#include <bits/stl_algobase.h>
#include <bits/stl_algo.h>
#ifdef _GLIBCXX_PARALLEL
# include <parallel/algorithm>
#endif
#endif /* _GLIBCXX_ALGORITHM */
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/climits
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c limits.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
#pragma GCC system_header
#include <bits/c++config.h>
#include <limits.h>
#ifndef _GLIBCXX_CLIMITS
#define _GLIBCXX_CLIMITS 1
#ifndef LLONG_MIN
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
#endif
#ifndef LLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__
#endif
#ifndef ULLONG_MAX
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif
#endif
// The -*- C++ -*- dynamic memory management header.
// Copyright (C) 1994-2018 Free Software Foundation, Inc.
// This file is part of GCC.
//
// GCC is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// GCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file new
* This is a Standard C++ Library header.
*
* The header @c new defines several functions to manage dynamic memory and
* handling memory allocation errors; see
* http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more.
*/
#ifndef _NEW
#define _NEW
#pragma GCC system_header
#include <bits/c++config.h>
#include <exception>
#pragma GCC visibility push(default)
extern "C++" {
namespace std
{
/**
* @brief Exception possibly thrown by @c new.
* @ingroup exceptions
*
* @c bad_alloc (or classes derived from it) is used to report allocation
* errors from the throwing forms of @c new. */
class bad_alloc : public exception
{
public:
bad_alloc() throw() { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_alloc() throw();
// See comment in eh_exception.cc.
virtual const char* what() const throw();
};
#if __cplusplus >= 201103L
class bad_array_new_length : public bad_alloc
{
public:
bad_array_new_length() throw() { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_array_new_length() throw();
// See comment in eh_exception.cc.
virtual const char* what() const throw();
};
#endif
#if __cpp_aligned_new
enum class align_val_t: size_t {};
#endif
struct nothrow_t
{
#if __cplusplus >= 201103L
explicit nothrow_t() = default;
#endif
};
extern const nothrow_t nothrow;
/** If you write your own error handler to be called by @c new, it must
* be of this type. */
typedef void (*new_handler)();
/// Takes a replacement handler as the argument, returns the
/// previous handler.
new_handler set_new_handler(new_handler) throw();
#if __cplusplus >= 201103L
/// Return the current new handler.
new_handler get_new_handler() noexcept;
#endif
} // namespace std
//@{
/** These are replaceable signatures:
* - normal single new and delete (no arguments, throw @c bad_alloc on error)
* - normal array new and delete (same)
* - @c nothrow single new and delete (take a @c nothrow argument, return
* @c NULL on error)
* - @c nothrow array new and delete (same)
*
* Placement new and delete signatures (take a memory address argument,
* does nothing) may not be replaced by a user's program.
*/
void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
__attribute__((__externally_visible__));
void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
__attribute__((__externally_visible__));
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
#if __cpp_sized_deallocation
void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
#endif
void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
#if __cpp_aligned_new
void* operator new(std::size_t, std::align_val_t)
__attribute__((__externally_visible__));
void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void operator delete(void*, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void operator delete(void*, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void* operator new[](std::size_t, std::align_val_t)
__attribute__((__externally_visible__));
void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void operator delete[](void*, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
#if __cpp_sized_deallocation
void operator delete(void*, std::size_t, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void operator delete[](void*, std::size_t, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
#endif // __cpp_sized_deallocation
#endif // __cpp_aligned_new
// Default placement versions of operator new.
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
{ return __p; }
inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
{ return __p; }
// Default placement versions of operator delete.
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
//@}
} // extern "C++"
#if __cplusplus >= 201703L
#if __GNUC__ >= 7
# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
#elif defined __has_builtin
// For non-GNU compilers:
# if __has_builtin(__builtin_launder)
# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
# endif
#endif
#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER
namespace std
{
#define __cpp_lib_launder 201606
/// Pointer optimization barrier [ptr.launder]
template<typename _Tp>
[[nodiscard]] constexpr _Tp*
launder(_Tp* __p) noexcept
{ return __builtin_launder(__p); }
// The program is ill-formed if T is a function type or
// (possibly cv-qualified) void.
template<typename _Ret, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
void launder(_Ret (*)(_Args...) _GLIBCXX_NOEXCEPT_QUAL) = delete;
template<typename _Ret, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
void launder(_Ret (*)(_Args......) _GLIBCXX_NOEXCEPT_QUAL) = delete;
void launder(void*) = delete;
void launder(const void*) = delete;
void launder(volatile void*) = delete;
void launder(const volatile void*) = delete;
}
#endif // _GLIBCXX_HAVE_BUILTIN_LAUNDER
#undef _GLIBCXX_HAVE_BUILTIN_LAUNDER
#endif // C++17
#pragma GCC visibility pop
#endif
// <functional> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file include/functional
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_FUNCTIONAL
#define _GLIBCXX_FUNCTIONAL 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/stl_function.h>
#if __cplusplus >= 201103L
#include <new>
#include <tuple>
#include <type_traits>
#include <bits/functional_hash.h>
#include <bits/invoke.h>
#include <bits/refwrap.h> // std::reference_wrapper and _Mem_fn_traits
#include <bits/std_function.h> // std::function
#if __cplusplus > 201402L
# include <unordered_map>
# include <vector>
# include <array>
# include <utility>
# include <bits/stl_algo.h>
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus > 201402L
# define __cpp_lib_invoke 201411
/// Invoke a callable object.
template<typename _Callable, typename... _Args>
inline invoke_result_t<_Callable, _Args...>
invoke(_Callable&& __fn, _Args&&... __args)
noexcept(is_nothrow_invocable_v<_Callable, _Args...>)
{
return std::__invoke(std::forward<_Callable>(__fn),
std::forward<_Args>(__args)...);
}
#endif
template<typename _MemFunPtr,
bool __is_mem_fn = is_member_function_pointer<_MemFunPtr>::value>
class _Mem_fn_base
: public _Mem_fn_traits<_MemFunPtr>::__maybe_type
{
using _Traits = _Mem_fn_traits<_MemFunPtr>;
using _Arity = typename _Traits::__arity;
using _Varargs = typename _Traits::__vararg;
template<typename _Func, typename... _BoundArgs>
friend struct _Bind_check_arity;
_MemFunPtr _M_pmf;
public:
using result_type = typename _Traits::__result_type;
explicit constexpr
_Mem_fn_base(_MemFunPtr __pmf) noexcept : _M_pmf(__pmf) { }
template<typename... _Args>
auto
operator()(_Args&&... __args) const
noexcept(noexcept(
std::__invoke(_M_pmf, std::forward<_Args>(__args)...)))
-> decltype(std::__invoke(_M_pmf, std::forward<_Args>(__args)...))
{ return std::__invoke(_M_pmf, std::forward<_Args>(__args)...); }
};
// Partial specialization for member object pointers.
template<typename _MemObjPtr>
class _Mem_fn_base<_MemObjPtr, false>
{
using _Arity = integral_constant<size_t, 0>;
using _Varargs = false_type;
template<typename _Func, typename... _BoundArgs>
friend struct _Bind_check_arity;
_MemObjPtr _M_pm;
public:
explicit constexpr
_Mem_fn_base(_MemObjPtr __pm) noexcept : _M_pm(__pm) { }
template<typename _Tp>
auto
operator()(_Tp&& __obj) const
noexcept(noexcept(std::__invoke(_M_pm, std::forward<_Tp>(__obj))))
-> decltype(std::__invoke(_M_pm, std::forward<_Tp>(__obj)))
{ return std::__invoke(_M_pm, std::forward<_Tp>(__obj)); }
};
template<typename _MemberPointer>
struct _Mem_fn; // undefined
template<typename _Res, typename _Class>
struct _Mem_fn<_Res _Class::*>
: _Mem_fn_base<_Res _Class::*>
{
using _Mem_fn_base<_Res _Class::*>::_Mem_fn_base;
};
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2048. Unnecessary mem_fn overloads
/**
* @brief Returns a function object that forwards to the member
* pointer @a pm.
* @ingroup functors
*/
template<typename _Tp, typename _Class>
inline _Mem_fn<_Tp _Class::*>
mem_fn(_Tp _Class::* __pm) noexcept
{
return _Mem_fn<_Tp _Class::*>(__pm);
}
/**
* @brief Determines if the given type _Tp is a function object that
* should be treated as a subexpression when evaluating calls to
* function objects returned by bind().
*
* C++11 [func.bind.isbind].
* @ingroup binders
*/
template<typename _Tp>
struct is_bind_expression
: public false_type { };
/**
* @brief Determines if the given type _Tp is a placeholder in a
* bind() expression and, if so, which placeholder it is.
*
* C++11 [func.bind.isplace].
* @ingroup binders
*/
template<typename _Tp>
struct is_placeholder
: public integral_constant<int, 0>
{ };
#if __cplusplus > 201402L
template <typename _Tp> inline constexpr bool is_bind_expression_v
= is_bind_expression<_Tp>::value;
template <typename _Tp> inline constexpr int is_placeholder_v
= is_placeholder<_Tp>::value;
#endif // C++17
/** @brief The type of placeholder objects defined by libstdc++.
* @ingroup binders
*/
template<int _Num> struct _Placeholder { };
/** @namespace std::placeholders
* @brief ISO C++11 entities sub-namespace for functional.
* @ingroup binders
*/
namespace placeholders
{
/* Define a large number of placeholders. There is no way to
* simplify this with variadic templates, because we're introducing
* unique names for each.
*/
extern const _Placeholder<1> _1;
extern const _Placeholder<2> _2;
extern const _Placeholder<3> _3;
extern const _Placeholder<4> _4;
extern const _Placeholder<5> _5;
extern const _Placeholder<6> _6;
extern const _Placeholder<7> _7;
extern const _Placeholder<8> _8;
extern const _Placeholder<9> _9;
extern const _Placeholder<10> _10;
extern const _Placeholder<11> _11;
extern const _Placeholder<12> _12;
extern const _Placeholder<13> _13;
extern const _Placeholder<14> _14;
extern const _Placeholder<15> _15;
extern const _Placeholder<16> _16;
extern const _Placeholder<17> _17;
extern const _Placeholder<18> _18;
extern const _Placeholder<19> _19;
extern const _Placeholder<20> _20;
extern const _Placeholder<21> _21;
extern const _Placeholder<22> _22;
extern const _Placeholder<23> _23;
extern const _Placeholder<24> _24;
extern const _Placeholder<25> _25;
extern const _Placeholder<26> _26;
extern const _Placeholder<27> _27;
extern const _Placeholder<28> _28;
extern const _Placeholder<29> _29;
}
/**
* Partial specialization of is_placeholder that provides the placeholder
* number for the placeholder objects defined by libstdc++.
* @ingroup binders
*/
template<int _Num>
struct is_placeholder<_Placeholder<_Num> >
: public integral_constant<int, _Num>
{ };
template<int _Num>
struct is_placeholder<const _Placeholder<_Num> >
: public integral_constant<int, _Num>
{ };
// Like tuple_element_t but SFINAE-friendly.
template<std::size_t __i, typename _Tuple>
using _Safe_tuple_element_t
= typename enable_if<(__i < tuple_size<_Tuple>::value),
tuple_element<__i, _Tuple>>::type::type;
/**
* Maps an argument to bind() into an actual argument to the bound
* function object [func.bind.bind]/10. Only the first parameter should
* be specified: the rest are used to determine among the various
* implementations. Note that, although this class is a function
* object, it isn't entirely normal because it takes only two
* parameters regardless of the number of parameters passed to the
* bind expression. The first parameter is the bound argument and
* the second parameter is a tuple containing references to the
* rest of the arguments.
*/
template<typename _Arg,
bool _IsBindExp = is_bind_expression<_Arg>::value,
bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)>
class _Mu;
/**
* If the argument is reference_wrapper<_Tp>, returns the
* underlying reference.
* C++11 [func.bind.bind] p10 bullet 1.
*/
template<typename _Tp>
class _Mu<reference_wrapper<_Tp>, false, false>
{
public:
/* Note: This won't actually work for const volatile
* reference_wrappers, because reference_wrapper::get() is const
* but not volatile-qualified. This might be a defect in the TR.
*/
template<typename _CVRef, typename _Tuple>
_Tp&
operator()(_CVRef& __arg, _Tuple&) const volatile
{ return __arg.get(); }
};
/**
* If the argument is a bind expression, we invoke the underlying
* function object with the same cv-qualifiers as we are given and
* pass along all of our arguments (unwrapped).
* C++11 [func.bind.bind] p10 bullet 2.
*/
template<typename _Arg>
class _Mu<_Arg, true, false>
{
public:
template<typename _CVArg, typename... _Args>
auto
operator()(_CVArg& __arg,
tuple<_Args...>& __tuple) const volatile
-> decltype(__arg(declval<_Args>()...))
{
// Construct an index tuple and forward to __call
typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
_Indexes;
return this->__call(__arg, __tuple, _Indexes());
}
private:
// Invokes the underlying function object __arg by unpacking all
// of the arguments in the tuple.
template<typename _CVArg, typename... _Args, std::size_t... _Indexes>
auto
__call(_CVArg& __arg, tuple<_Args...>& __tuple,
const _Index_tuple<_Indexes...>&) const volatile
-> decltype(__arg(declval<_Args>()...))
{
return __arg(std::get<_Indexes>(std::move(__tuple))...);
}
};
/**
* If the argument is a placeholder for the Nth argument, returns
* a reference to the Nth argument to the bind function object.
* C++11 [func.bind.bind] p10 bullet 3.
*/
template<typename _Arg>
class _Mu<_Arg, false, true>
{
public:
template<typename _Tuple>
_Safe_tuple_element_t<(is_placeholder<_Arg>::value - 1), _Tuple>&&
operator()(const volatile _Arg&, _Tuple& __tuple) const volatile
{
return
::std::get<(is_placeholder<_Arg>::value - 1)>(std::move(__tuple));
}
};
/**
* If the argument is just a value, returns a reference to that
* value. The cv-qualifiers on the reference are determined by the caller.
* C++11 [func.bind.bind] p10 bullet 4.
*/
template<typename _Arg>
class _Mu<_Arg, false, false>
{
public:
template<typename _CVArg, typename _Tuple>
_CVArg&&
operator()(_CVArg&& __arg, _Tuple&) const volatile
{ return std::forward<_CVArg>(__arg); }
};
// std::get<I> for volatile-qualified tuples
template<std::size_t _Ind, typename... _Tp>
inline auto
__volget(volatile tuple<_Tp...>& __tuple)
-> __tuple_element_t<_Ind, tuple<_Tp...>> volatile&
{ return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); }
// std::get<I> for const-volatile-qualified tuples
template<std::size_t _Ind, typename... _Tp>
inline auto
__volget(const volatile tuple<_Tp...>& __tuple)
-> __tuple_element_t<_Ind, tuple<_Tp...>> const volatile&
{ return std::get<_Ind>(const_cast<const tuple<_Tp...>&>(__tuple)); }
/// Type of the function object returned from bind().
template<typename _Signature>
struct _Bind;
template<typename _Functor, typename... _Bound_args>
class _Bind<_Functor(_Bound_args...)>
: public _Weak_result_type<_Functor>
{
typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
_Bound_indexes;
_Functor _M_f;
tuple<_Bound_args...> _M_bound_args;
// Call unqualified
template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
{
return std::__invoke(_M_f,
_Mu<_Bound_args>()(std::get<_Indexes>(_M_bound_args), __args)...
);
}
// Call as const
template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result
__call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
{
return std::__invoke(_M_f,
_Mu<_Bound_args>()(std::get<_Indexes>(_M_bound_args), __args)...
);
}
// Call as volatile
template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result
__call_v(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>) volatile
{
return std::__invoke(_M_f,
_Mu<_Bound_args>()(__volget<_Indexes>(_M_bound_args), __args)...
);
}
// Call as const volatile
template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result
__call_c_v(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>) const volatile
{
return std::__invoke(_M_f,
_Mu<_Bound_args>()(__volget<_Indexes>(_M_bound_args), __args)...
);
}
template<typename _BoundArg, typename _CallArgs>
using _Mu_type = decltype(
_Mu<typename remove_cv<_BoundArg>::type>()(
std::declval<_BoundArg&>(), std::declval<_CallArgs&>()) );
template<typename _Fn, typename _CallArgs, typename... _BArgs>
using _Res_type_impl
= typename result_of< _Fn&(_Mu_type<_BArgs, _CallArgs>&&...) >::type;
template<typename _CallArgs>
using _Res_type = _Res_type_impl<_Functor, _CallArgs, _Bound_args...>;
template<typename _CallArgs>
using __dependent = typename
enable_if<bool(tuple_size<_CallArgs>::value+1), _Functor>::type;
template<typename _CallArgs, template<class> class __cv_quals>
using _Res_type_cv = _Res_type_impl<
typename __cv_quals<__dependent<_CallArgs>>::type,
_CallArgs,
typename __cv_quals<_Bound_args>::type...>;
public:
template<typename... _Args>
explicit _Bind(const _Functor& __f, _Args&&... __args)
: _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...)
{ }
template<typename... _Args>
explicit _Bind(_Functor&& __f, _Args&&... __args)
: _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...)
{ }
_Bind(const _Bind&) = default;
_Bind(_Bind&& __b)
: _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args))
{ }
// Call unqualified
template<typename... _Args,
typename _Result = _Res_type<tuple<_Args...>>>
_Result
operator()(_Args&&... __args)
{
return this->__call<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
// Call as const
template<typename... _Args,
typename _Result = _Res_type_cv<tuple<_Args...>, add_const>>
_Result
operator()(_Args&&... __args) const
{
return this->__call_c<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
#if __cplusplus > 201402L
# define _GLIBCXX_DEPR_BIND \
[[deprecated("std::bind does not support volatile in C++17")]]
#else
# define _GLIBCXX_DEPR_BIND
#endif
// Call as volatile
template<typename... _Args,
typename _Result = _Res_type_cv<tuple<_Args...>, add_volatile>>
_GLIBCXX_DEPR_BIND
_Result
operator()(_Args&&... __args) volatile
{
return this->__call_v<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
// Call as const volatile
template<typename... _Args,
typename _Result = _Res_type_cv<tuple<_Args...>, add_cv>>
_GLIBCXX_DEPR_BIND
_Result
operator()(_Args&&... __args) const volatile
{
return this->__call_c_v<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
};
/// Type of the function object returned from bind<R>().
template<typename _Result, typename _Signature>
struct _Bind_result;
template<typename _Result, typename _Functor, typename... _Bound_args>
class _Bind_result<_Result, _Functor(_Bound_args...)>
{
typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
_Bound_indexes;
_Functor _M_f;
tuple<_Bound_args...> _M_bound_args;
// sfinae types
template<typename _Res>
using __enable_if_void
= typename enable_if<is_void<_Res>{}>::type;
template<typename _Res>
using __disable_if_void
= typename enable_if<!is_void<_Res>{}, _Result>::type;
// Call unqualified
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__disable_if_void<_Res>
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
{
return std::__invoke(_M_f, _Mu<_Bound_args>()
(std::get<_Indexes>(_M_bound_args), __args)...);
}
// Call unqualified, return void
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__enable_if_void<_Res>
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
{
std::__invoke(_M_f, _Mu<_Bound_args>()
(std::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as const
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__disable_if_void<_Res>
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
{
return std::__invoke(_M_f, _Mu<_Bound_args>()
(std::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as const, return void
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__enable_if_void<_Res>
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
{
std::__invoke(_M_f, _Mu<_Bound_args>()
(std::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as volatile
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__disable_if_void<_Res>
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile
{
return std::__invoke(_M_f, _Mu<_Bound_args>()
(__volget<_Indexes>(_M_bound_args), __args)...);
}
// Call as volatile, return void
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__enable_if_void<_Res>
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile
{
std::__invoke(_M_f, _Mu<_Bound_args>()
(__volget<_Indexes>(_M_bound_args), __args)...);
}
// Call as const volatile
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__disable_if_void<_Res>
__call(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>) const volatile
{
return std::__invoke(_M_f, _Mu<_Bound_args>()
(__volget<_Indexes>(_M_bound_args), __args)...);
}
// Call as const volatile, return void
template<typename _Res, typename... _Args, std::size_t... _Indexes>
__enable_if_void<_Res>
__call(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>) const volatile
{
std::__invoke(_M_f, _Mu<_Bound_args>()
(__volget<_Indexes>(_M_bound_args), __args)...);
}
public:
typedef _Result result_type;
template<typename... _Args>
explicit _Bind_result(const _Functor& __f, _Args&&... __args)
: _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...)
{ }
template<typename... _Args>
explicit _Bind_result(_Functor&& __f, _Args&&... __args)
: _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...)
{ }
_Bind_result(const _Bind_result&) = default;
_Bind_result(_Bind_result&& __b)
: _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args))
{ }
// Call unqualified
template<typename... _Args>
result_type
operator()(_Args&&... __args)
{
return this->__call<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
// Call as const
template<typename... _Args>
result_type
operator()(_Args&&... __args) const
{
return this->__call<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
// Call as volatile
template<typename... _Args>
_GLIBCXX_DEPR_BIND
result_type
operator()(_Args&&... __args) volatile
{
return this->__call<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
// Call as const volatile
template<typename... _Args>
_GLIBCXX_DEPR_BIND
result_type
operator()(_Args&&... __args) const volatile
{
return this->__call<_Result>(
std::forward_as_tuple(std::forward<_Args>(__args)...),
_Bound_indexes());
}
};
#undef _GLIBCXX_DEPR_BIND
/**
* @brief Class template _Bind is always a bind expression.
* @ingroup binders
*/
template<typename _Signature>
struct is_bind_expression<_Bind<_Signature> >
: public true_type { };
/**
* @brief Class template _Bind is always a bind expression.
* @ingroup binders
*/
template<typename _Signature>
struct is_bind_expression<const _Bind<_Signature> >
: public true_type { };
/**
* @brief Class template _Bind is always a bind expression.
* @ingroup binders
*/
template<typename _Signature>
struct is_bind_expression<volatile _Bind<_Signature> >
: public true_type { };
/**
* @brief Class template _Bind is always a bind expression.
* @ingroup binders
*/
template<typename _Signature>
struct is_bind_expression<const volatile _Bind<_Signature>>
: public true_type { };
/**
* @brief Class template _Bind_result is always a bind expression.
* @ingroup binders
*/
template<typename _Result, typename _Signature>
struct is_bind_expression<_Bind_result<_Result, _Signature>>
: public true_type { };
/**
* @brief Class template _Bind_result is always a bind expression.
* @ingroup binders
*/
template<typename _Result, typename _Signature>
struct is_bind_expression<const _Bind_result<_Result, _Signature>>
: public true_type { };
/**
* @brief Class template _Bind_result is always a bind expression.
* @ingroup binders
*/
template<typename _Result, typename _Signature>
struct is_bind_expression<volatile _Bind_result<_Result, _Signature>>
: public true_type { };
/**
* @brief Class template _Bind_result is always a bind expression.
* @ingroup binders
*/
template<typename _Result, typename _Signature>
struct is_bind_expression<const volatile _Bind_result<_Result, _Signature>>
: public true_type { };
template<typename _Func, typename... _BoundArgs>
struct _Bind_check_arity { };
template<typename _Ret, typename... _Args, typename... _BoundArgs>
struct _Bind_check_arity<_Ret (*)(_Args...), _BoundArgs...>
{
static_assert(sizeof...(_BoundArgs) == sizeof...(_Args),
"Wrong number of arguments for function");
};
template<typename _Ret, typename... _Args, typename... _BoundArgs>
struct _Bind_check_arity<_Ret (*)(_Args......), _BoundArgs...>
{
static_assert(sizeof...(_BoundArgs) >= sizeof...(_Args),
"Wrong number of arguments for function");
};
template<typename _Tp, typename _Class, typename... _BoundArgs>
struct _Bind_check_arity<_Tp _Class::*, _BoundArgs...>
{
using _Arity = typename _Mem_fn<_Tp _Class::*>::_Arity;
using _Varargs = typename _Mem_fn<_Tp _Class::*>::_Varargs;
static_assert(_Varargs::value
? sizeof...(_BoundArgs) >= _Arity::value + 1
: sizeof...(_BoundArgs) == _Arity::value + 1,
"Wrong number of arguments for pointer-to-member");
};
// Trait type used to remove std::bind() from overload set via SFINAE
// when first argument has integer type, so that std::bind() will
// not be a better match than ::bind() from the BSD Sockets API.
template<typename _Tp, typename _Tp2 = typename decay<_Tp>::type>
using __is_socketlike = __or_<is_integral<_Tp2>, is_enum<_Tp2>>;
template<bool _SocketLike, typename _Func, typename... _BoundArgs>
struct _Bind_helper
: _Bind_check_arity<typename decay<_Func>::type, _BoundArgs...>
{
typedef typename decay<_Func>::type __func_type;
typedef _Bind<__func_type(typename decay<_BoundArgs>::type...)> type;
};
// Partial specialization for is_socketlike == true, does not define
// nested type so std::bind() will not participate in overload resolution
// when the first argument might be a socket file descriptor.
template<typename _Func, typename... _BoundArgs>
struct _Bind_helper<true, _Func, _BoundArgs...>
{ };
/**
* @brief Function template for std::bind.
* @ingroup binders
*/
template<typename _Func, typename... _BoundArgs>
inline typename
_Bind_helper<__is_socketlike<_Func>::value, _Func, _BoundArgs...>::type
bind(_Func&& __f, _BoundArgs&&... __args)
{
typedef _Bind_helper<false, _Func, _BoundArgs...> __helper_type;
return typename __helper_type::type(std::forward<_Func>(__f),
std::forward<_BoundArgs>(__args)...);
}
template<typename _Result, typename _Func, typename... _BoundArgs>
struct _Bindres_helper
: _Bind_check_arity<typename decay<_Func>::type, _BoundArgs...>
{
typedef typename decay<_Func>::type __functor_type;
typedef _Bind_result<_Result,
__functor_type(typename decay<_BoundArgs>::type...)>
type;
};
/**
* @brief Function template for std::bind<R>.
* @ingroup binders
*/
template<typename _Result, typename _Func, typename... _BoundArgs>
inline
typename _Bindres_helper<_Result, _Func, _BoundArgs...>::type
bind(_Func&& __f, _BoundArgs&&... __args)
{
typedef _Bindres_helper<_Result, _Func, _BoundArgs...> __helper_type;
return typename __helper_type::type(std::forward<_Func>(__f),
std::forward<_BoundArgs>(__args)...);
}
#if __cplusplus >= 201402L
/// Generalized negator.
template<typename _Fn>
class _Not_fn
{
template<typename _Fn2, typename... _Args>
using __inv_res_t = typename __invoke_result<_Fn2, _Args...>::type;
template<typename _Tp>
static decltype(!std::declval<_Tp>())
_S_not() noexcept(noexcept(!std::declval<_Tp>()));
public:
template<typename _Fn2>
_Not_fn(_Fn2&& __fn, int)
: _M_fn(std::forward<_Fn2>(__fn)) { }
_Not_fn(const _Not_fn& __fn) = default;
_Not_fn(_Not_fn&& __fn) = default;
~_Not_fn() = default;
// Macro to define operator() with given cv-qualifiers ref-qualifiers,
// forwarding _M_fn and the function arguments with the same qualifiers,
// and deducing the return type and exception-specification.
#define _GLIBCXX_NOT_FN_CALL_OP( _QUALS ) \
template<typename... _Args> \
decltype(_S_not<__inv_res_t<_Fn _QUALS, _Args...>>()) \
operator()(_Args&&... __args) _QUALS \
noexcept(__is_nothrow_invocable<_Fn _QUALS, _Args...>::value \
&& noexcept(_S_not<__inv_res_t<_Fn _QUALS, _Args...>>())) \
{ \
return !std::__invoke(std::forward< _Fn _QUALS >(_M_fn), \
std::forward<_Args>(__args)...); \
}
_GLIBCXX_NOT_FN_CALL_OP( & )
_GLIBCXX_NOT_FN_CALL_OP( const & )
_GLIBCXX_NOT_FN_CALL_OP( && )
_GLIBCXX_NOT_FN_CALL_OP( const && )
#undef _GLIBCXX_NOT_FN_CALL
private:
_Fn _M_fn;
};
template<typename _Tp, typename _Pred>
struct __is_byte_like : false_type { };
template<typename _Tp>
struct __is_byte_like<_Tp, equal_to<_Tp>>
: __bool_constant<sizeof(_Tp) == 1 && is_integral<_Tp>::value> { };
template<typename _Tp>
struct __is_byte_like<_Tp, equal_to<void>>
: __bool_constant<sizeof(_Tp) == 1 && is_integral<_Tp>::value> { };
#if __cplusplus >= 201703L
// Declare std::byte (full definition is in <cstddef>).
enum class byte : unsigned char;
template<>
struct __is_byte_like<byte, equal_to<byte>>
: true_type { };
template<>
struct __is_byte_like<byte, equal_to<void>>
: true_type { };
#define __cpp_lib_not_fn 201603
/// [func.not_fn] Function template not_fn
template<typename _Fn>
inline auto
not_fn(_Fn&& __fn)
noexcept(std::is_nothrow_constructible<std::decay_t<_Fn>, _Fn&&>::value)
{
return _Not_fn<std::decay_t<_Fn>>{std::forward<_Fn>(__fn), 0};
}
// Searchers
#define __cpp_lib_boyer_moore_searcher 201603
template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
class default_searcher
{
public:
default_searcher(_ForwardIterator1 __pat_first,
_ForwardIterator1 __pat_last,
_BinaryPredicate __pred = _BinaryPredicate())
: _M_m(__pat_first, __pat_last, std::move(__pred))
{ }
template<typename _ForwardIterator2>
pair<_ForwardIterator2, _ForwardIterator2>
operator()(_ForwardIterator2 __first, _ForwardIterator2 __last) const
{
_ForwardIterator2 __first_ret =
std::search(__first, __last, std::get<0>(_M_m), std::get<1>(_M_m),
std::get<2>(_M_m));
auto __ret = std::make_pair(__first_ret, __first_ret);
if (__ret.first != __last)
std::advance(__ret.second, std::distance(std::get<0>(_M_m),
std::get<1>(_M_m)));
return __ret;
}
private:
tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m;
};
template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
struct __boyer_moore_map_base
{
template<typename _RAIter>
__boyer_moore_map_base(_RAIter __pat, size_t __patlen,
_Hash&& __hf, _Pred&& __pred)
: _M_bad_char{ __patlen, std::move(__hf), std::move(__pred) }
{
if (__patlen > 0)
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
_M_bad_char[__pat[__i]] = __patlen - 1 - __i;
}
using __diff_type = _Tp;
__diff_type
_M_lookup(_Key __key, __diff_type __not_found) const
{
auto __iter = _M_bad_char.find(__key);
if (__iter == _M_bad_char.end())
return __not_found;
return __iter->second;
}
_Pred
_M_pred() const { return _M_bad_char.key_eq(); }
_GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred> _M_bad_char;
};
template<typename _Tp, size_t _Len, typename _Pred>
struct __boyer_moore_array_base
{
template<typename _RAIter, typename _Unused>
__boyer_moore_array_base(_RAIter __pat, size_t __patlen,
_Unused&&, _Pred&& __pred)
: _M_bad_char{ _GLIBCXX_STD_C::array<_Tp, _Len>{}, std::move(__pred) }
{
std::get<0>(_M_bad_char).fill(__patlen);
if (__patlen > 0)
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
{
auto __ch = __pat[__i];
using _UCh = make_unsigned_t<decltype(__ch)>;
auto __uch = static_cast<_UCh>(__ch);
std::get<0>(_M_bad_char)[__uch] = __patlen - 1 - __i;
}
}
using __diff_type = _Tp;
template<typename _Key>
__diff_type
_M_lookup(_Key __key, __diff_type __not_found) const
{
auto __ukey = static_cast<make_unsigned_t<_Key>>(__key);
if (__ukey >= _Len)
return __not_found;
return std::get<0>(_M_bad_char)[__ukey];
}
const _Pred&
_M_pred() const { return std::get<1>(_M_bad_char); }
tuple<_GLIBCXX_STD_C::array<_Tp, _Len>, _Pred> _M_bad_char;
};
// Use __boyer_moore_array_base when pattern consists of narrow characters
// (or std::byte) and uses std::equal_to as the predicate.
template<typename _RAIter, typename _Hash, typename _Pred,
typename _Val = typename iterator_traits<_RAIter>::value_type,
typename _Diff = typename iterator_traits<_RAIter>::difference_type>
using __boyer_moore_base_t
= conditional_t<__is_byte_like<_Val, _Pred>::value,
__boyer_moore_array_base<_Diff, 256, _Pred>,
__boyer_moore_map_base<_Val, _Diff, _Hash, _Pred>>;
template<typename _RAIter, typename _Hash
= hash<typename iterator_traits<_RAIter>::value_type>,
typename _BinaryPredicate = equal_to<>>
class boyer_moore_searcher
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
{
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
using typename _Base::__diff_type;
public:
boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last,
_Hash __hf = _Hash(),
_BinaryPredicate __pred = _BinaryPredicate());
template<typename _RandomAccessIterator2>
pair<_RandomAccessIterator2, _RandomAccessIterator2>
operator()(_RandomAccessIterator2 __first,
_RandomAccessIterator2 __last) const;
private:
bool
_M_is_prefix(_RAIter __word, __diff_type __len,
__diff_type __pos)
{
const auto& __pred = this->_M_pred();
__diff_type __suffixlen = __len - __pos;
for (__diff_type __i = 0; __i < __suffixlen; ++__i)
if (!__pred(__word[__i], __word[__pos + __i]))
return false;
return true;
}
__diff_type
_M_suffix_length(_RAIter __word, __diff_type __len,
__diff_type __pos)
{
const auto& __pred = this->_M_pred();
__diff_type __i = 0;
while (__pred(__word[__pos - __i], __word[__len - 1 - __i])
&& __i < __pos)
{
++__i;
}
return __i;
}
template<typename _Tp>
__diff_type
_M_bad_char_shift(_Tp __c) const
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
_RAIter _M_pat;
_RAIter _M_pat_end;
_GLIBCXX_STD_C::vector<__diff_type> _M_good_suffix;
};
template<typename _RAIter, typename _Hash
= hash<typename iterator_traits<_RAIter>::value_type>,
typename _BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
{
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
using typename _Base::__diff_type;
public:
boyer_moore_horspool_searcher(_RAIter __pat,
_RAIter __pat_end,
_Hash __hf = _Hash(),
_BinaryPredicate __pred
= _BinaryPredicate())
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
_M_pat(__pat), _M_pat_end(__pat_end)
{ }
template<typename _RandomAccessIterator2>
pair<_RandomAccessIterator2, _RandomAccessIterator2>
operator()(_RandomAccessIterator2 __first,
_RandomAccessIterator2 __last) const
{
const auto& __pred = this->_M_pred();
auto __patlen = _M_pat_end - _M_pat;
if (__patlen == 0)
return std::make_pair(__first, __first);
auto __len = __last - __first;
while (__len >= __patlen)
{
for (auto __scan = __patlen - 1;
__pred(__first[__scan], _M_pat[__scan]); --__scan)
if (__scan == 0)
return std::make_pair(__first, __first + __patlen);
auto __shift = _M_bad_char_shift(__first[__patlen - 1]);
__len -= __shift;
__first += __shift;
}
return std::make_pair(__last, __last);
}
private:
template<typename _Tp>
__diff_type
_M_bad_char_shift(_Tp __c) const
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
_RAIter _M_pat;
_RAIter _M_pat_end;
};
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
boyer_moore_searcher(_RAIter __pat, _RAIter __pat_end,
_Hash __hf, _BinaryPredicate __pred)
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
_M_pat(__pat), _M_pat_end(__pat_end), _M_good_suffix(__pat_end - __pat)
{
auto __patlen = __pat_end - __pat;
if (__patlen == 0)
return;
__diff_type __last_prefix = __patlen - 1;
for (__diff_type __p = __patlen - 1; __p >= 0; --__p)
{
if (_M_is_prefix(__pat, __patlen, __p + 1))
__last_prefix = __p + 1;
_M_good_suffix[__p] = __last_prefix + (__patlen - 1 - __p);
}
for (__diff_type __p = 0; __p < __patlen - 1; ++__p)
{
auto __slen = _M_suffix_length(__pat, __patlen, __p);
auto __pos = __patlen - 1 - __slen;
if (!__pred(__pat[__p - __slen], __pat[__pos]))
_M_good_suffix[__pos] = __patlen - 1 - __p + __slen;
}
}
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
template<typename _RandomAccessIterator2>
pair<_RandomAccessIterator2, _RandomAccessIterator2>
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
operator()(_RandomAccessIterator2 __first,
_RandomAccessIterator2 __last) const
{
auto __patlen = _M_pat_end - _M_pat;
if (__patlen == 0)
return std::make_pair(__first, __first);
const auto& __pred = this->_M_pred();
__diff_type __i = __patlen - 1;
auto __stringlen = __last - __first;
while (__i < __stringlen)
{
__diff_type __j = __patlen - 1;
while (__j >= 0 && __pred(__first[__i], _M_pat[__j]))
{
--__i;
--__j;
}
if (__j < 0)
{
const auto __match = __first + __i + 1;
return std::make_pair(__match, __match + __patlen);
}
__i += std::max(_M_bad_char_shift(__first[__i]),
_M_good_suffix[__j]);
}
return std::make_pair(__last, __last);
}
#endif // C++17
#endif // C++14
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_FUNCTIONAL
// C++11 <type_traits> -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/type_traits
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_TYPE_TRAITS
#define _GLIBCXX_TYPE_TRAITS 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <bits/c++config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup metaprogramming Metaprogramming
* @ingroup utilities
*
* Template utilities for compile-time introspection and modification,
* including type classification traits, type property inspection traits
* and type transformation traits.
*
* @{
*/
/// integral_constant
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type;
constexpr operator value_type() const noexcept { return value; }
#if __cplusplus > 201103L
#define __cpp_lib_integral_constant_callable 201304
constexpr value_type operator()() const noexcept { return value; }
#endif
};
template<typename _Tp, _Tp __v>
constexpr _Tp integral_constant<_Tp, __v>::value;
/// The type used as a compile-time boolean with true value.
typedef integral_constant<bool, true> true_type;
/// The type used as a compile-time boolean with false value.
typedef integral_constant<bool, false> false_type;
template<bool __v>
using __bool_constant = integral_constant<bool, __v>;
#if __cplusplus > 201402L
# define __cpp_lib_bool_constant 201505
template<bool __v>
using bool_constant = integral_constant<bool, __v>;
#endif
// Meta programming helper types.
template<bool, typename, typename>
struct conditional;
template<typename...>
struct __or_;
template<>
struct __or_<>
: public false_type
{ };
template<typename _B1>
struct __or_<_B1>
: public _B1
{ };
template<typename _B1, typename _B2>
struct __or_<_B1, _B2>
: public conditional<_B1::value, _B1, _B2>::type
{ };
template<typename _B1, typename _B2, typename _B3, typename... _Bn>
struct __or_<_B1, _B2, _B3, _Bn...>
: public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
{ };
template<typename...>
struct __and_;
template<>
struct __and_<>
: public true_type
{ };
template<typename _B1>
struct __and_<_B1>
: public _B1
{ };
template<typename _B1, typename _B2>
struct __and_<_B1, _B2>
: public conditional<_B1::value, _B2, _B1>::type
{ };
template<typename _B1, typename _B2, typename _B3, typename... _Bn>
struct __and_<_B1, _B2, _B3, _Bn...>
: public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
{ };
template<typename _Pp>
struct __not_
: public __bool_constant<!bool(_Pp::value)>
{ };
#if __cplusplus >= 201703L
#define __cpp_lib_logical_traits 201510
template<typename... _Bn>
struct conjunction
: __and_<_Bn...>
{ };
template<typename... _Bn>
struct disjunction
: __or_<_Bn...>
{ };
template<typename _Pp>
struct negation
: __not_<_Pp>
{ };
template<typename... _Bn>
inline constexpr bool conjunction_v = conjunction<_Bn...>::value;
template<typename... _Bn>
inline constexpr bool disjunction_v = disjunction<_Bn...>::value;
template<typename _Pp>
inline constexpr bool negation_v = negation<_Pp>::value;
#endif // C++17
// For several sfinae-friendly trait implementations we transport both the
// result information (as the member type) and the failure information (no
// member type). This is very similar to std::enable_if, but we cannot use
// them, because we need to derive from them as an implementation detail.
template<typename _Tp>
struct __success_type
{ typedef _Tp type; };
struct __failure_type
{ };
// Primary type categories.
template<typename>
struct remove_cv;
template<typename>
struct __is_void_helper
: public false_type { };
template<>
struct __is_void_helper<void>
: public true_type { };
/// is_void
template<typename _Tp>
struct is_void
: public __is_void_helper<typename remove_cv<_Tp>::type>::type
{ };
template<typename>
struct __is_integral_helper
: public false_type { };
template<>
struct __is_integral_helper<bool>
: public true_type { };
template<>
struct __is_integral_helper<char>
: public true_type { };
template<>
struct __is_integral_helper<signed char>
: public true_type { };
template<>
struct __is_integral_helper<unsigned char>
: public true_type { };
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
struct __is_integral_helper<wchar_t>
: public true_type { };
#endif
template<>
struct __is_integral_helper<char16_t>
: public true_type { };
template<>
struct __is_integral_helper<char32_t>
: public true_type { };
template<>
struct __is_integral_helper<short>
: public true_type { };
template<>
struct __is_integral_helper<unsigned short>
: public true_type { };
template<>
struct __is_integral_helper<int>
: public true_type { };
template<>
struct __is_integral_helper<unsigned int>
: public true_type { };
template<>
struct __is_integral_helper<long>
: public true_type { };
template<>
struct __is_integral_helper<unsigned long>
: public true_type { };
template<>
struct __is_integral_helper<long long>
: public true_type { };
template<>
struct __is_integral_helper<unsigned long long>
: public true_type { };
// Conditionalizing on __STRICT_ANSI__ here will break any port that
// uses one of these types for size_t.
#if defined(__GLIBCXX_TYPE_INT_N_0)
template<>
struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
: public true_type { };
template<>
struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
: public true_type { };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_1)
template<>
struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
: public true_type { };
template<>
struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
: public true_type { };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_2)
template<>
struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
: public true_type { };
template<>
struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
: public true_type { };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_3)
template<>
struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
: public true_type { };
template<>
struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
: public true_type { };
#endif
/// is_integral
template<typename _Tp>
struct is_integral
: public __is_integral_helper<typename remove_cv<_Tp>::type>::type
{ };
template<typename>
struct __is_floating_point_helper
: public false_type { };
template<>
struct __is_floating_point_helper<float>
: public true_type { };
template<>
struct __is_floating_point_helper<double>
: public true_type { };
template<>
struct __is_floating_point_helper<long double>
: public true_type { };
#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
template<>
struct __is_floating_point_helper<__float128>
: public true_type { };
#endif
/// is_floating_point
template<typename _Tp>
struct is_floating_point
: public __is_floating_point_helper<typename remove_cv<_Tp>::type>::type
{ };
/// is_array
template<typename>
struct is_array
: public false_type { };
template<typename _Tp, std::size_t _Size>
struct is_array<_Tp[_Size]>
: public true_type { };
template<typename _Tp>
struct is_array<_Tp[]>
: public true_type { };
template<typename>
struct __is_pointer_helper
: public false_type { };
template<typename _Tp>
struct __is_pointer_helper<_Tp*>
: public true_type { };
/// is_pointer
template<typename _Tp>
struct is_pointer
: public __is_pointer_helper<typename remove_cv<_Tp>::type>::type
{ };
/// is_lvalue_reference
template<typename>
struct is_lvalue_reference
: public false_type { };
template<typename _Tp>
struct is_lvalue_reference<_Tp&>
: public true_type { };
/// is_rvalue_reference
template<typename>
struct is_rvalue_reference
: public false_type { };
template<typename _Tp>
struct is_rvalue_reference<_Tp&&>
: public true_type { };
template<typename>
struct is_function;
template<typename>
struct __is_member_object_pointer_helper
: public false_type { };
template<typename _Tp, typename _Cp>
struct __is_member_object_pointer_helper<_Tp _Cp::*>
: public integral_constant<bool, !is_function<_Tp>::value> { };
/// is_member_object_pointer
template<typename _Tp>
struct is_member_object_pointer
: public __is_member_object_pointer_helper<
typename remove_cv<_Tp>::type>::type
{ };
template<typename>
struct __is_member_function_pointer_helper
: public false_type { };
template<typename _Tp, typename _Cp>
struct __is_member_function_pointer_helper<_Tp _Cp::*>
: public integral_constant<bool, is_function<_Tp>::value> { };
/// is_member_function_pointer
template<typename _Tp>
struct is_member_function_pointer
: public __is_member_function_pointer_helper<
typename remove_cv<_Tp>::type>::type
{ };
/// is_enum
template<typename _Tp>
struct is_enum
: public integral_constant<bool, __is_enum(_Tp)>
{ };
/// is_union
template<typename _Tp>
struct is_union
: public integral_constant<bool, __is_union(_Tp)>
{ };
/// is_class
template<typename _Tp>
struct is_class
: public integral_constant<bool, __is_class(_Tp)>
{ };
/// is_function
template<typename>
struct is_function
: public false_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) const _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) const & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) const && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) const _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) const & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) const && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) volatile _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) volatile & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) volatile && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) volatile _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) volatile & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) volatile && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) const volatile _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) const volatile & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes...) const volatile && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) const volatile _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) const volatile & _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
struct is_function<_Res(_ArgTypes......) const volatile && _GLIBCXX_NOEXCEPT_QUAL>
: public true_type { };
#define __cpp_lib_is_null_pointer 201309
template<typename>
struct __is_null_pointer_helper
: public false_type { };
template<>
struct __is_null_pointer_helper<std::nullptr_t>
: public true_type { };
/// is_null_pointer (LWG 2247).
template<typename _Tp>
struct is_null_pointer
: public __is_null_pointer_helper<typename remove_cv<_Tp>::type>::type
{ };
/// __is_nullptr_t (extension).
template<typename _Tp>
struct __is_nullptr_t
: public is_null_pointer<_Tp>
{ };
// Composite type categories.
/// is_reference
template<typename _Tp>
struct is_reference
: public __or_<is_lvalue_reference<_Tp>,
is_rvalue_reference<_Tp>>::type
{ };
/// is_arithmetic
template<typename _Tp>
struct is_arithmetic
: public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
{ };
/// is_fundamental
template<typename _Tp>
struct is_fundamental
: public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
is_null_pointer<_Tp>>::type
{ };
/// is_object
template<typename _Tp>
struct is_object
: public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
is_void<_Tp>>>::type
{ };
template<typename>
struct is_member_pointer;
/// is_scalar
template<typename _Tp>
struct is_scalar
: public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
{ };
/// is_compound
template<typename _Tp>
struct is_compound
: public integral_constant<bool, !is_fundamental<_Tp>::value> { };
template<typename _Tp>
struct __is_member_pointer_helper
: public false_type { };
template<typename _Tp, typename _Cp>
struct __is_member_pointer_helper<_Tp _Cp::*>
: public true_type { };
/// is_member_pointer
template<typename _Tp>
struct is_member_pointer
: public __is_member_pointer_helper<typename remove_cv<_Tp>::type>::type
{ };
// Utility to detect referenceable types ([defns.referenceable]).
template<typename _Tp>
struct __is_referenceable
: public __or_<is_object<_Tp>, is_reference<_Tp>>::type
{ };
template<typename _Res, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
struct __is_referenceable<_Res(_Args...) _GLIBCXX_NOEXCEPT_QUAL>
: public true_type
{ };
template<typename _Res, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
struct __is_referenceable<_Res(_Args......) _GLIBCXX_NOEXCEPT_QUAL>
: public true_type
{ };
// Type properties.
/// is_const
template<typename>
struct is_const
: public false_type { };
template<typename _Tp>
struct is_const<_Tp const>
: public true_type { };
/// is_volatile
template<typename>
struct is_volatile
: public false_type { };
template<typename _Tp>
struct is_volatile<_Tp volatile>
: public true_type { };
/// is_trivial
template<typename _Tp>
struct is_trivial
: public integral_constant<bool, __is_trivial(_Tp)>
{ };
// is_trivially_copyable
template<typename _Tp>
struct is_trivially_copyable
: public integral_constant<bool, __is_trivially_copyable(_Tp)>
{ };
/// is_standard_layout
template<typename _Tp>
struct is_standard_layout
: public integral_constant<bool, __is_standard_layout(_Tp)>
{ };
/// is_pod
// Could use is_standard_layout && is_trivial instead of the builtin.
template<typename _Tp>
struct is_pod
: public integral_constant<bool, __is_pod(_Tp)>
{ };
/// is_literal_type
template<typename _Tp>
struct is_literal_type
: public integral_constant<bool, __is_literal_type(_Tp)>
{ };
/// is_empty
template<typename _Tp>
struct is_empty
: public integral_constant<bool, __is_empty(_Tp)>
{ };
/// is_polymorphic
template<typename _Tp>
struct is_polymorphic
: public integral_constant<bool, __is_polymorphic(_Tp)>
{ };
#if __cplusplus >= 201402L
#define __cpp_lib_is_final 201402L
/// is_final
template<typename _Tp>
struct is_final
: public integral_constant<bool, __is_final(_Tp)>
{ };
#endif
/// is_abstract
template<typename _Tp>
struct is_abstract
: public integral_constant<bool, __is_abstract(_Tp)>
{ };
template<typename _Tp,
bool = is_arithmetic<_Tp>::value>
struct __is_signed_helper
: public false_type { };
template<typename _Tp>
struct __is_signed_helper<_Tp, true>
: public integral_constant<bool, _Tp(-1) < _Tp(0)>
{ };
/// is_signed
template<typename _Tp>
struct is_signed
: public __is_signed_helper<_Tp>::type
{ };
/// is_unsigned
template<typename _Tp>
struct is_unsigned
: public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>
{ };
// Destructible and constructible type properties.
/**
* @brief Utility to simplify expressions used in unevaluated operands
* @ingroup utilities
*/
template<typename _Tp, typename _Up = _Tp&&>
_Up
__declval(int);
template<typename _Tp>
_Tp
__declval(long);
template<typename _Tp>
auto declval() noexcept -> decltype(__declval<_Tp>(0));
template<typename, unsigned = 0>
struct extent;
template<typename>
struct remove_all_extents;
template<typename _Tp>
struct __is_array_known_bounds
: public integral_constant<bool, (extent<_Tp>::value > 0)>
{ };
template<typename _Tp>
struct __is_array_unknown_bounds
: public __and_<is_array<_Tp>, __not_<extent<_Tp>>>
{ };
// In N3290 is_destructible does not say anything about function
// types and abstract types, see LWG 2049. This implementation
// describes function types as non-destructible and all complete
// object types as destructible, iff the explicit destructor
// call expression is wellformed.
struct __do_is_destructible_impl
{
template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
static true_type __test(int);
template<typename>
static false_type __test(...);
};
template<typename _Tp>
struct __is_destructible_impl
: public __do_is_destructible_impl
{
typedef decltype(__test<_Tp>(0)) type;
};
template<typename _Tp,
bool = __or_<is_void<_Tp>,
__is_array_unknown_bounds<_Tp>,
is_function<_Tp>>::value,
bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
struct __is_destructible_safe;
template<typename _Tp>
struct __is_destructible_safe<_Tp, false, false>
: public __is_destructible_impl<typename
remove_all_extents<_Tp>::type>::type
{ };
template<typename _Tp>
struct __is_destructible_safe<_Tp, true, false>
: public false_type { };
template<typename _Tp>
struct __is_destructible_safe<_Tp, false, true>
: public true_type { };
/// is_destructible
template<typename _Tp>
struct is_destructible
: public __is_destructible_safe<_Tp>::type
{ };
// is_nothrow_destructible requires that is_destructible is
// satisfied as well. We realize that by mimicing the
// implementation of is_destructible but refer to noexcept(expr)
// instead of decltype(expr).
struct __do_is_nt_destructible_impl
{
template<typename _Tp>
static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())>
__test(int);
template<typename>
static false_type __test(...);
};
template<typename _Tp>
struct __is_nt_destructible_impl
: public __do_is_nt_destructible_impl
{
typedef decltype(__test<_Tp>(0)) type;
};
template<typename _Tp,
bool = __or_<is_void<_Tp>,
__is_array_unknown_bounds<_Tp>,
is_function<_Tp>>::value,
bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
struct __is_nt_destructible_safe;
template<typename _Tp>
struct __is_nt_destructible_safe<_Tp, false, false>
: public __is_nt_destructible_impl<typename
remove_all_extents<_Tp>::type>::type
{ };
template<typename _Tp>
struct __is_nt_destructible_safe<_Tp, true, false>
: public false_type { };
template<typename _Tp>
struct __is_nt_destructible_safe<_Tp, false, true>
: public true_type { };
/// is_nothrow_destructible
template<typename _Tp>
struct is_nothrow_destructible
: public __is_nt_destructible_safe<_Tp>::type
{ };
/// is_constructible
template<typename _Tp, typename... _Args>
struct is_constructible
: public __bool_constant<__is_constructible(_Tp, _Args...)>
{ };
/// is_default_constructible
template<typename _Tp>
struct is_default_constructible
: public is_constructible<_Tp>::type
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_copy_constructible_impl;
template<typename _Tp>
struct __is_copy_constructible_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_copy_constructible_impl<_Tp, true>
: public is_constructible<_Tp, const _Tp&>
{ };
/// is_copy_constructible
template<typename _Tp>
struct is_copy_constructible
: public __is_copy_constructible_impl<_Tp>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_move_constructible_impl;
template<typename _Tp>
struct __is_move_constructible_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_move_constructible_impl<_Tp, true>
: public is_constructible<_Tp, _Tp&&>
{ };
/// is_move_constructible
template<typename _Tp>
struct is_move_constructible
: public __is_move_constructible_impl<_Tp>
{ };
template<bool, typename _Tp, typename... _Args>
struct __is_nt_constructible_impl
: public false_type
{ };
template<typename _Tp, typename... _Args>
struct __is_nt_constructible_impl<true, _Tp, _Args...>
: public __bool_constant<noexcept(_Tp(std::declval<_Args>()...))>
{ };
template<typename _Tp, typename _Arg>
struct __is_nt_constructible_impl<true, _Tp, _Arg>
: public __bool_constant<noexcept(static_cast<_Tp>(std::declval<_Arg>()))>
{ };
template<typename _Tp>
struct __is_nt_constructible_impl<true, _Tp>
: public __bool_constant<noexcept(_Tp())>
{ };
template<typename _Tp, size_t _Num>
struct __is_nt_constructible_impl<true, _Tp[_Num]>
: public __bool_constant<noexcept(typename remove_all_extents<_Tp>::type())>
{ };
template<typename _Tp, typename... _Args>
using __is_nothrow_constructible_impl
= __is_nt_constructible_impl<__is_constructible(_Tp, _Args...),
_Tp, _Args...>;
/// is_nothrow_constructible
template<typename _Tp, typename... _Args>
struct is_nothrow_constructible
: public __is_nothrow_constructible_impl<_Tp, _Args...>::type
{ };
/// is_nothrow_default_constructible
template<typename _Tp>
struct is_nothrow_default_constructible
: public __is_nothrow_constructible_impl<_Tp>::type
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_nothrow_copy_constructible_impl;
template<typename _Tp>
struct __is_nothrow_copy_constructible_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_nothrow_copy_constructible_impl<_Tp, true>
: public is_nothrow_constructible<_Tp, const _Tp&>
{ };
/// is_nothrow_copy_constructible
template<typename _Tp>
struct is_nothrow_copy_constructible
: public __is_nothrow_copy_constructible_impl<_Tp>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_nothrow_move_constructible_impl;
template<typename _Tp>
struct __is_nothrow_move_constructible_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_nothrow_move_constructible_impl<_Tp, true>
: public is_nothrow_constructible<_Tp, _Tp&&>
{ };
/// is_nothrow_move_constructible
template<typename _Tp>
struct is_nothrow_move_constructible
: public __is_nothrow_move_constructible_impl<_Tp>
{ };
/// is_assignable
template<typename _Tp, typename _Up>
struct is_assignable
: public __bool_constant<__is_assignable(_Tp, _Up)>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_copy_assignable_impl;
template<typename _Tp>
struct __is_copy_assignable_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_copy_assignable_impl<_Tp, true>
: public is_assignable<_Tp&, const _Tp&>
{ };
/// is_copy_assignable
template<typename _Tp>
struct is_copy_assignable
: public __is_copy_assignable_impl<_Tp>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_move_assignable_impl;
template<typename _Tp>
struct __is_move_assignable_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_move_assignable_impl<_Tp, true>
: public is_assignable<_Tp&, _Tp&&>
{ };
/// is_move_assignable
template<typename _Tp>
struct is_move_assignable
: public __is_move_assignable_impl<_Tp>
{ };
template<typename _Tp, typename _Up>
struct __is_nt_assignable_impl
: public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())>
{ };
/// is_nothrow_assignable
template<typename _Tp, typename _Up>
struct is_nothrow_assignable
: public __and_<is_assignable<_Tp, _Up>,
__is_nt_assignable_impl<_Tp, _Up>>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_nt_copy_assignable_impl;
template<typename _Tp>
struct __is_nt_copy_assignable_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_nt_copy_assignable_impl<_Tp, true>
: public is_nothrow_assignable<_Tp&, const _Tp&>
{ };
/// is_nothrow_copy_assignable
template<typename _Tp>
struct is_nothrow_copy_assignable
: public __is_nt_copy_assignable_impl<_Tp>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_nt_move_assignable_impl;
template<typename _Tp>
struct __is_nt_move_assignable_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_nt_move_assignable_impl<_Tp, true>
: public is_nothrow_assignable<_Tp&, _Tp&&>
{ };
/// is_nothrow_move_assignable
template<typename _Tp>
struct is_nothrow_move_assignable
: public __is_nt_move_assignable_impl<_Tp>
{ };
/// is_trivially_constructible
template<typename _Tp, typename... _Args>
struct is_trivially_constructible
: public __and_<is_constructible<_Tp, _Args...>, __bool_constant<
__is_trivially_constructible(_Tp, _Args...)>>::type
{ };
/// is_trivially_default_constructible
template<typename _Tp>
struct is_trivially_default_constructible
: public is_trivially_constructible<_Tp>::type
{ };
struct __do_is_implicitly_default_constructible_impl
{
template <typename _Tp>
static void __helper(const _Tp&);
template <typename _Tp>
static true_type __test(const _Tp&,
decltype(__helper<const _Tp&>({}))* = 0);
static false_type __test(...);
};
template<typename _Tp>
struct __is_implicitly_default_constructible_impl
: public __do_is_implicitly_default_constructible_impl
{
typedef decltype(__test(declval<_Tp>())) type;
};
template<typename _Tp>
struct __is_implicitly_default_constructible_safe
: public __is_implicitly_default_constructible_impl<_Tp>::type
{ };
template <typename _Tp>
struct __is_implicitly_default_constructible
: public __and_<is_default_constructible<_Tp>,
__is_implicitly_default_constructible_safe<_Tp>>
{ };
/// is_trivially_copy_constructible
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_trivially_copy_constructible_impl;
template<typename _Tp>
struct __is_trivially_copy_constructible_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_trivially_copy_constructible_impl<_Tp, true>
: public __and_<is_copy_constructible<_Tp>,
integral_constant<bool,
__is_trivially_constructible(_Tp, const _Tp&)>>
{ };
template<typename _Tp>
struct is_trivially_copy_constructible
: public __is_trivially_copy_constructible_impl<_Tp>
{ };
/// is_trivially_move_constructible
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_trivially_move_constructible_impl;
template<typename _Tp>
struct __is_trivially_move_constructible_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_trivially_move_constructible_impl<_Tp, true>
: public __and_<is_move_constructible<_Tp>,
integral_constant<bool,
__is_trivially_constructible(_Tp, _Tp&&)>>
{ };
template<typename _Tp>
struct is_trivially_move_constructible
: public __is_trivially_move_constructible_impl<_Tp>
{ };
/// is_trivially_assignable
template<typename _Tp, typename _Up>
struct is_trivially_assignable
: public __bool_constant<__is_trivially_assignable(_Tp, _Up)>
{ };
/// is_trivially_copy_assignable
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_trivially_copy_assignable_impl;
template<typename _Tp>
struct __is_trivially_copy_assignable_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_trivially_copy_assignable_impl<_Tp, true>
: public __and_<is_copy_assignable<_Tp>,
integral_constant<bool,
__is_trivially_assignable(_Tp&, const _Tp&)>>
{ };
template<typename _Tp>
struct is_trivially_copy_assignable
: public __is_trivially_copy_assignable_impl<_Tp>
{ };
/// is_trivially_move_assignable
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __is_trivially_move_assignable_impl;
template<typename _Tp>
struct __is_trivially_move_assignable_impl<_Tp, false>
: public false_type { };
template<typename _Tp>
struct __is_trivially_move_assignable_impl<_Tp, true>
: public __and_<is_move_assignable<_Tp>,
integral_constant<bool,
__is_trivially_assignable(_Tp&, _Tp&&)>>
{ };
template<typename _Tp>
struct is_trivially_move_assignable
: public __is_trivially_move_assignable_impl<_Tp>
{ };
/// is_trivially_destructible
template<typename _Tp>
struct is_trivially_destructible
: public __and_<is_destructible<_Tp>, integral_constant<bool,
__has_trivial_destructor(_Tp)>>
{ };
/// has_virtual_destructor
template<typename _Tp>
struct has_virtual_destructor
: public integral_constant<bool, __has_virtual_destructor(_Tp)>
{ };
// type property queries.
/// alignment_of
template<typename _Tp>
struct alignment_of
: public integral_constant<std::size_t, alignof(_Tp)> { };
/// rank
template<typename>
struct rank
: public integral_constant<std::size_t, 0> { };
template<typename _Tp, std::size_t _Size>
struct rank<_Tp[_Size]>
: public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
template<typename _Tp>
struct rank<_Tp[]>
: public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
/// extent
template<typename, unsigned _Uint>
struct extent
: public integral_constant<std::size_t, 0> { };
template<typename _Tp, unsigned _Uint, std::size_t _Size>
struct extent<_Tp[_Size], _Uint>
: public integral_constant<std::size_t,
_Uint == 0 ? _Size : extent<_Tp,
_Uint - 1>::value>
{ };
template<typename _Tp, unsigned _Uint>
struct extent<_Tp[], _Uint>
: public integral_constant<std::size_t,
_Uint == 0 ? 0 : extent<_Tp,
_Uint - 1>::value>
{ };
// Type relations.
/// is_same
template<typename, typename>
struct is_same
: public false_type { };
template<typename _Tp>
struct is_same<_Tp, _Tp>
: public true_type { };
/// is_base_of
template<typename _Base, typename _Derived>
struct is_base_of
: public integral_constant<bool, __is_base_of(_Base, _Derived)>
{ };
template<typename _From, typename _To,
bool = __or_<is_void<_From>, is_function<_To>,
is_array<_To>>::value>
struct __is_convertible_helper
{ typedef typename is_void<_To>::type type; };
template<typename _From, typename _To>
class __is_convertible_helper<_From, _To, false>
{
template<typename _To1>
static void __test_aux(_To1);
template<typename _From1, typename _To1,
typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
static true_type
__test(int);
template<typename, typename>
static false_type
__test(...);
public:
typedef decltype(__test<_From, _To>(0)) type;
};
/// is_convertible
template<typename _From, typename _To>
struct is_convertible
: public __is_convertible_helper<_From, _To>::type
{ };
// Const-volatile modifications.
/// remove_const
template<typename _Tp>
struct remove_const
{ typedef _Tp type; };
template<typename _Tp>
struct remove_const<_Tp const>
{ typedef _Tp type; };
/// remove_volatile
template<typename _Tp>
struct remove_volatile
{ typedef _Tp type; };
template<typename _Tp>
struct remove_volatile<_Tp volatile>
{ typedef _Tp type; };
/// remove_cv
template<typename _Tp>
struct remove_cv
{
typedef typename
remove_const<typename remove_volatile<_Tp>::type>::type type;
};
/// add_const
template<typename _Tp>
struct add_const
{ typedef _Tp const type; };
/// add_volatile
template<typename _Tp>
struct add_volatile
{ typedef _Tp volatile type; };
/// add_cv
template<typename _Tp>
struct add_cv
{
typedef typename
add_const<typename add_volatile<_Tp>::type>::type type;
};
#if __cplusplus > 201103L
#define __cpp_lib_transformation_trait_aliases 201304
/// Alias template for remove_const
template<typename _Tp>
using remove_const_t = typename remove_const<_Tp>::type;
/// Alias template for remove_volatile
template<typename _Tp>
using remove_volatile_t = typename remove_volatile<_Tp>::type;
/// Alias template for remove_cv
template<typename _Tp>
using remove_cv_t = typename remove_cv<_Tp>::type;
/// Alias template for add_const
template<typename _Tp>
using add_const_t = typename add_const<_Tp>::type;
/// Alias template for add_volatile
template<typename _Tp>
using add_volatile_t = typename add_volatile<_Tp>::type;
/// Alias template for add_cv
template<typename _Tp>
using add_cv_t = typename add_cv<_Tp>::type;
#endif
// Reference transformations.
/// remove_reference
template<typename _Tp>
struct remove_reference
{ typedef _Tp type; };
template<typename _Tp>
struct remove_reference<_Tp&>
{ typedef _Tp type; };
template<typename _Tp>
struct remove_reference<_Tp&&>
{ typedef _Tp type; };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __add_lvalue_reference_helper
{ typedef _Tp type; };
template<typename _Tp>
struct __add_lvalue_reference_helper<_Tp, true>
{ typedef _Tp& type; };
/// add_lvalue_reference
template<typename _Tp>
struct add_lvalue_reference
: public __add_lvalue_reference_helper<_Tp>
{ };
template<typename _Tp, bool = __is_referenceable<_Tp>::value>
struct __add_rvalue_reference_helper
{ typedef _Tp type; };
template<typename _Tp>
struct __add_rvalue_reference_helper<_Tp, true>
{ typedef _Tp&& type; };
/// add_rvalue_reference
template<typename _Tp>
struct add_rvalue_reference
: public __add_rvalue_reference_helper<_Tp>
{ };
#if __cplusplus > 201103L
/// Alias template for remove_reference
template<typename _Tp>
using remove_reference_t = typename remove_reference<_Tp>::type;
/// Alias template for add_lvalue_reference
template<typename _Tp>
using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
/// Alias template for add_rvalue_reference
template<typename _Tp>
using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
#endif
// Sign modifications.
// Utility for constructing identically cv-qualified types.
template<typename _Unqualified, bool _IsConst, bool _IsVol>
struct __cv_selector;
template<typename _Unqualified>
struct __cv_selector<_Unqualified, false, false>
{ typedef _Unqualified __type; };
template<typename _Unqualified>
struct __cv_selector<_Unqualified, false, true>
{ typedef volatile _Unqualified __type; };
template<typename _Unqualified>
struct __cv_selector<_Unqualified, true, false>
{ typedef const _Unqualified __type; };
template<typename _Unqualified>
struct __cv_selector<_Unqualified, true, true>
{ typedef const volatile _Unqualified __type; };
template<typename _Qualified, typename _Unqualified,
bool _IsConst = is_const<_Qualified>::value,
bool _IsVol = is_volatile<_Qualified>::value>
class __match_cv_qualifiers
{
typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
public:
typedef typename __match::__type __type;
};
// Utility for finding the unsigned versions of signed integral types.
template<typename _Tp>
struct __make_unsigned
{ typedef _Tp __type; };
template<>
struct __make_unsigned<char>
{ typedef unsigned char __type; };
template<>
struct __make_unsigned<signed char>
{ typedef unsigned char __type; };
template<>
struct __make_unsigned<short>
{ typedef unsigned short __type; };
template<>
struct __make_unsigned<int>
{ typedef unsigned int __type; };
template<>
struct __make_unsigned<long>
{ typedef unsigned long __type; };
template<>
struct __make_unsigned<long long>
{ typedef unsigned long long __type; };
#if defined(__GLIBCXX_TYPE_INT_N_0)
template<>
struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
{ typedef unsigned __GLIBCXX_TYPE_INT_N_0 __type; };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_1)
template<>
struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
{ typedef unsigned __GLIBCXX_TYPE_INT_N_1 __type; };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_2)
template<>
struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
{ typedef unsigned __GLIBCXX_TYPE_INT_N_2 __type; };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_3)
template<>
struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
{ typedef unsigned __GLIBCXX_TYPE_INT_N_3 __type; };
#endif
// Select between integral and enum: not possible to be both.
template<typename _Tp,
bool _IsInt = is_integral<_Tp>::value,
bool _IsEnum = is_enum<_Tp>::value>
class __make_unsigned_selector;
template<typename _Tp>
class __make_unsigned_selector<_Tp, true, false>
{
typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
typedef typename __unsignedt::__type __unsigned_type;
typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
public:
typedef typename __cv_unsigned::__type __type;
};
template<typename _Tp>
class __make_unsigned_selector<_Tp, false, true>
{
// With -fshort-enums, an enum may be as small as a char.
typedef unsigned char __smallest;
static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
static const bool __b3 = sizeof(_Tp) <= sizeof(unsigned long);
typedef conditional<__b3, unsigned long, unsigned long long> __cond3;
typedef typename __cond3::type __cond3_type;
typedef conditional<__b2, unsigned int, __cond3_type> __cond2;
typedef typename __cond2::type __cond2_type;
typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
typedef typename __cond1::type __cond1_type;
typedef typename conditional<__b0, __smallest, __cond1_type>::type
__unsigned_type;
typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
public:
typedef typename __cv_unsigned::__type __type;
};
// Given an integral/enum type, return the corresponding unsigned
// integer type.
// Primary template.
/// make_unsigned
template<typename _Tp>
struct make_unsigned
{ typedef typename __make_unsigned_selector<_Tp>::__type type; };
// Integral, but don't define.
template<>
struct make_unsigned<bool>;
// Utility for finding the signed versions of unsigned integral types.
template<typename _Tp>
struct __make_signed
{ typedef _Tp __type; };
template<>
struct __make_signed<char>
{ typedef signed char __type; };
template<>
struct __make_signed<unsigned char>
{ typedef signed char __type; };
template<>
struct __make_signed<unsigned short>
{ typedef signed short __type; };
template<>
struct __make_signed<unsigned int>
{ typedef signed int __type; };
template<>
struct __make_signed<unsigned long>
{ typedef signed long __type; };
template<>
struct __make_signed<unsigned long long>
{ typedef signed long long __type; };
#if defined(__GLIBCXX_TYPE_INT_N_0)
template<>
struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
{ typedef __GLIBCXX_TYPE_INT_N_0 __type; };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_1)
template<>
struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
{ typedef __GLIBCXX_TYPE_INT_N_1 __type; };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_2)
template<>
struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
{ typedef __GLIBCXX_TYPE_INT_N_2 __type; };
#endif
#if defined(__GLIBCXX_TYPE_INT_N_3)
template<>
struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
{ typedef __GLIBCXX_TYPE_INT_N_3 __type; };
#endif
// Select between integral and enum: not possible to be both.
template<typename _Tp,
bool _IsInt = is_integral<_Tp>::value,
bool _IsEnum = is_enum<_Tp>::value>
class __make_signed_selector;
template<typename _Tp>
class __make_signed_selector<_Tp, true, false>
{
typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
typedef typename __signedt::__type __signed_type;
typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
public:
typedef typename __cv_signed::__type __type;
};
template<typename _Tp>
class __make_signed_selector<_Tp, false, true>
{
typedef typename __make_unsigned_selector<_Tp>::__type __unsigned_type;
public:
typedef typename __make_signed_selector<__unsigned_type>::__type __type;
};
// Given an integral/enum type, return the corresponding signed
// integer type.
// Primary template.
/// make_signed
template<typename _Tp>
struct make_signed
{ typedef typename __make_signed_selector<_Tp>::__type type; };
// Integral, but don't define.
template<>
struct make_signed<bool>;
#if __cplusplus > 201103L
/// Alias template for make_signed
template<typename _Tp>
using make_signed_t = typename make_signed<_Tp>::type;
/// Alias template for make_unsigned
template<typename _Tp>
using make_unsigned_t = typename make_unsigned<_Tp>::type;
#endif
// Array modifications.
/// remove_extent
template<typename _Tp>
struct remove_extent
{ typedef _Tp type; };
template<typename _Tp, std::size_t _Size>
struct remove_extent<_Tp[_Size]>
{ typedef _Tp type; };
template<typename _Tp>
struct remove_extent<_Tp[]>
{ typedef _Tp type; };
/// remove_all_extents
template<typename _Tp>
struct remove_all_extents
{ typedef _Tp type; };
template<typename _Tp, std::size_t _Size>
struct remove_all_extents<_Tp[_Size]>
{ typedef typename remove_all_extents<_Tp>::type type; };
template<typename _Tp>
struct remove_all_extents<_Tp[]>
{ typedef typename remove_all_extents<_Tp>::type type; };
#if __cplusplus > 201103L
/// Alias template for remove_extent
template<typename _Tp>
using remove_extent_t = typename remove_extent<_Tp>::type;
/// Alias template for remove_all_extents
template<typename _Tp>
using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
#endif
// Pointer modifications.
template<typename _Tp, typename>
struct __remove_pointer_helper
{ typedef _Tp type; };
template<typename _Tp, typename _Up>
struct __remove_pointer_helper<_Tp, _Up*>
{ typedef _Up type; };
/// remove_pointer
template<typename _Tp>
struct remove_pointer
: public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
{ };
/// add_pointer
template<typename _Tp, bool = __or_<__is_referenceable<_Tp>,
is_void<_Tp>>::value>
struct __add_pointer_helper
{ typedef _Tp type; };
template<typename _Tp>
struct __add_pointer_helper<_Tp, true>
{ typedef typename remove_reference<_Tp>::type* type; };
template<typename _Tp>
struct add_pointer
: public __add_pointer_helper<_Tp>
{ };
#if __cplusplus > 201103L
/// Alias template for remove_pointer
template<typename _Tp>
using remove_pointer_t = typename remove_pointer<_Tp>::type;
/// Alias template for add_pointer
template<typename _Tp>
using add_pointer_t = typename add_pointer<_Tp>::type;
#endif
template<std::size_t _Len>
struct __aligned_storage_msa
{
union __type
{
unsigned char __data[_Len];
struct __attribute__((__aligned__)) { } __align;
};
};
/**
* @brief Alignment type.
*
* The value of _Align is a default-alignment which shall be the
* most stringent alignment requirement for any C++ object type
* whose size is no greater than _Len (3.9). The member typedef
* type shall be a POD type suitable for use as uninitialized
* storage for any object whose size is at most _Len and whose
* alignment is a divisor of _Align.
*/
template<std::size_t _Len, std::size_t _Align =
__alignof__(typename __aligned_storage_msa<_Len>::__type)>
struct aligned_storage
{
union type
{
unsigned char __data[_Len];
struct __attribute__((__aligned__((_Align)))) { } __align;
};
};
template <typename... _Types>
struct __strictest_alignment
{
static const size_t _S_alignment = 0;
static const size_t _S_size = 0;
};
template <typename _Tp, typename... _Types>
struct __strictest_alignment<_Tp, _Types...>
{
static const size_t _S_alignment =
alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
? alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
static const size_t _S_size =
sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
};
/**
* @brief Provide aligned storage for types.
*
* [meta.trans.other]
*
* Provides aligned storage for any of the provided types of at
* least size _Len.
*
* @see aligned_storage
*/
template <size_t _Len, typename... _Types>
struct aligned_union
{
private:
static_assert(sizeof...(_Types) != 0, "At least one type is required");
using __strictest = __strictest_alignment<_Types...>;
static const size_t _S_len = _Len > __strictest::_S_size
? _Len : __strictest::_S_size;
public:
/// The value of the strictest alignment of _Types.
static const size_t alignment_value = __strictest::_S_alignment;
/// The storage.
typedef typename aligned_storage<_S_len, alignment_value>::type type;
};
template <size_t _Len, typename... _Types>
const size_t aligned_union<_Len, _Types...>::alignment_value;
// Decay trait for arrays and functions, used for perfect forwarding
// in make_pair, make_tuple, etc.
template<typename _Up,
bool _IsArray = is_array<_Up>::value,
bool _IsFunction = is_function<_Up>::value>
struct __decay_selector;
// NB: DR 705.
template<typename _Up>
struct __decay_selector<_Up, false, false>
{ typedef typename remove_cv<_Up>::type __type; };
template<typename _Up>
struct __decay_selector<_Up, true, false>
{ typedef typename remove_extent<_Up>::type* __type; };
template<typename _Up>
struct __decay_selector<_Up, false, true>
{ typedef typename add_pointer<_Up>::type __type; };
/// decay
template<typename _Tp>
class decay
{
typedef typename remove_reference<_Tp>::type __remove_type;
public:
typedef typename __decay_selector<__remove_type>::__type type;
};
template<typename _Tp>
class reference_wrapper;
// Helper which adds a reference to a type when given a reference_wrapper
template<typename _Tp>
struct __strip_reference_wrapper
{
typedef _Tp __type;
};
template<typename _Tp>
struct __strip_reference_wrapper<reference_wrapper<_Tp> >
{
typedef _Tp& __type;
};
template<typename _Tp>
struct __decay_and_strip
{
typedef typename __strip_reference_wrapper<
typename decay<_Tp>::type>::__type __type;
};
// Primary template.
/// Define a member typedef @c type only if a boolean constant is true.
template<bool, typename _Tp = void>
struct enable_if
{ };
// Partial specialization for true.
template<typename _Tp>
struct enable_if<true, _Tp>
{ typedef _Tp type; };
template<typename... _Cond>
using _Require = typename enable_if<__and_<_Cond...>::value>::type;
// Primary template.
/// Define a member typedef @c type to one of two argument types.
template<bool _Cond, typename _Iftrue, typename _Iffalse>
struct conditional
{ typedef _Iftrue type; };
// Partial specialization for false.
template<typename _Iftrue, typename _Iffalse>
struct conditional<false, _Iftrue, _Iffalse>
{ typedef _Iffalse type; };
/// common_type
template<typename... _Tp>
struct common_type;
// Sfinae-friendly common_type implementation:
struct __do_common_type_impl
{
template<typename _Tp, typename _Up>
static __success_type<typename decay<decltype
(true ? std::declval<_Tp>()
: std::declval<_Up>())>::type> _S_test(int);
template<typename, typename>
static __failure_type _S_test(...);
};
template<typename _Tp, typename _Up>
struct __common_type_impl
: private __do_common_type_impl
{
typedef decltype(_S_test<_Tp, _Up>(0)) type;
};
struct __do_member_type_wrapper
{
template<typename _Tp>
static __success_type<typename _Tp::type> _S_test(int);
template<typename>
static __failure_type _S_test(...);
};
template<typename _Tp>
struct __member_type_wrapper
: private __do_member_type_wrapper
{
typedef decltype(_S_test<_Tp>(0)) type;
};
template<typename _CTp, typename... _Args>
struct __expanded_common_type_wrapper
{
typedef common_type<typename _CTp::type, _Args...> type;
};
template<typename... _Args>
struct __expanded_common_type_wrapper<__failure_type, _Args...>
{ typedef __failure_type type; };
template<>
struct common_type<>
{ };
template<typename _Tp>
struct common_type<_Tp>
: common_type<_Tp, _Tp>
{ };
template<typename _Tp, typename _Up>
struct common_type<_Tp, _Up>
: public __common_type_impl<_Tp, _Up>::type
{ };
template<typename _Tp, typename _Up, typename... _Vp>
struct common_type<_Tp, _Up, _Vp...>
: public __expanded_common_type_wrapper<typename __member_type_wrapper<
common_type<_Tp, _Up>>::type, _Vp...>::type
{ };
/// The underlying type of an enum.
template<typename _Tp>
struct underlying_type
{
typedef __underlying_type(_Tp) type;
};
template<typename _Tp>
struct __declval_protector
{
static const bool __stop = false;
};
template<typename _Tp>
auto declval() noexcept -> decltype(__declval<_Tp>(0))
{
static_assert(__declval_protector<_Tp>::__stop,
"declval() must not be used!");
return __declval<_Tp>(0);
}
// wchar_t, char16_t and char32_t are integral types but are neither
// signed integer types nor unsigned integer types, so must be
// transformed to the integer type with the smallest rank that has the
// same size and signedness.
// Use the partial specialization for enumeration types to do that,
// which means these explicit specializations must be defined after
// std::conditional has been defined.
#if defined(_GLIBCXX_USE_WCHAR_T)
template<>
struct __make_unsigned<wchar_t>
{
using __type
= typename __make_unsigned_selector<wchar_t, false, true>::__type;
};
template<>
struct __make_signed<wchar_t>
{
using __type
= typename __make_signed_selector<wchar_t, false, true>::__type;
};
#endif
template<>
struct __make_unsigned<char16_t>
{
using __type
= typename __make_unsigned_selector<char16_t, false, true>::__type;
};
template<>
struct __make_signed<char16_t>
{
using __type
= typename __make_signed_selector<char16_t, false, true>::__type;
};
template<>
struct __make_unsigned<char32_t>
{
using __type
= typename __make_unsigned_selector<char32_t, false, true>::__type;
};
template<>
struct __make_signed<char32_t>
{
using __type
= typename __make_signed_selector<char32_t, false, true>::__type;
};
/// result_of
template<typename _Signature>
class result_of;
// Sfinae-friendly result_of implementation:
#define __cpp_lib_result_of_sfinae 201210
struct __invoke_memfun_ref { };
struct __invoke_memfun_deref { };
struct __invoke_memobj_ref { };
struct __invoke_memobj_deref { };
struct __invoke_other { };
// Associate a tag type with a specialization of __success_type.
template<typename _Tp, typename _Tag>
struct __result_of_success : __success_type<_Tp>
{ using __invoke_type = _Tag; };
// [func.require] paragraph 1 bullet 1:
struct __result_of_memfun_ref_impl
{
template<typename _Fp, typename _Tp1, typename... _Args>
static __result_of_success<decltype(
(std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
), __invoke_memfun_ref> _S_test(int);
template<typename...>
static __failure_type _S_test(...);
};
template<typename _MemPtr, typename _Arg, typename... _Args>
struct __result_of_memfun_ref
: private __result_of_memfun_ref_impl
{
typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
};
// [func.require] paragraph 1 bullet 2:
struct __result_of_memfun_deref_impl
{
template<typename _Fp, typename _Tp1, typename... _Args>
static __result_of_success<decltype(
((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
), __invoke_memfun_deref> _S_test(int);
template<typename...>
static __failure_type _S_test(...);
};
template<typename _MemPtr, typename _Arg, typename... _Args>
struct __result_of_memfun_deref
: private __result_of_memfun_deref_impl
{
typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
};
// [func.require] paragraph 1 bullet 3:
struct __result_of_memobj_ref_impl
{
template<typename _Fp, typename _Tp1>
static __result_of_success<decltype(
std::declval<_Tp1>().*std::declval<_Fp>()
), __invoke_memobj_ref> _S_test(int);
template<typename, typename>
static __failure_type _S_test(...);
};
template<typename _MemPtr, typename _Arg>
struct __result_of_memobj_ref
: private __result_of_memobj_ref_impl
{
typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
};
// [func.require] paragraph 1 bullet 4:
struct __result_of_memobj_deref_impl
{
template<typename _Fp, typename _Tp1>
static __result_of_success<decltype(
(*std::declval<_Tp1>()).*std::declval<_Fp>()
), __invoke_memobj_deref> _S_test(int);
template<typename, typename>
static __failure_type _S_test(...);
};
template<typename _MemPtr, typename _Arg>
struct __result_of_memobj_deref
: private __result_of_memobj_deref_impl
{
typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
};
template<typename _MemPtr, typename _Arg>
struct __result_of_memobj;
template<typename _Res, typename _Class, typename _Arg>
struct __result_of_memobj<_Res _Class::*, _Arg>
{
typedef typename remove_cv<typename remove_reference<
_Arg>::type>::type _Argval;
typedef _Res _Class::* _MemPtr;
typedef typename conditional<__or_<is_same<_Argval, _Class>,
is_base_of<_Class, _Argval>>::value,
__result_of_memobj_ref<_MemPtr, _Arg>,
__result_of_memobj_deref<_MemPtr, _Arg>
>::type::type type;
};
template<typename _MemPtr, typename _Arg, typename... _Args>
struct __result_of_memfun;
template<typename _Res, typename _Class, typename _Arg, typename... _Args>
struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
{
typedef typename remove_cv<typename remove_reference<
_Arg>::type>::type _Argval;
typedef _Res _Class::* _MemPtr;
typedef typename conditional<__or_<is_same<_Argval, _Class>,
is_base_of<_Class, _Argval>>::value,
__result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
__result_of_memfun_deref<_MemPtr, _Arg, _Args...>
>::type::type type;
};
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2219. INVOKE-ing a pointer to member with a reference_wrapper
// as the object expression
// Used by result_of, invoke etc. to unwrap a reference_wrapper.
template<typename _Tp, typename _Up = typename decay<_Tp>::type>
struct __inv_unwrap
{
using type = _Tp;
};
template<typename _Tp, typename _Up>
struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
{
using type = _Up&;
};
template<bool, bool, typename _Functor, typename... _ArgTypes>
struct __result_of_impl
{
typedef __failure_type type;
};
template<typename _MemPtr, typename _Arg>
struct __result_of_impl<true, false, _MemPtr, _Arg>
: public __result_of_memobj<typename decay<_MemPtr>::type,
typename __inv_unwrap<_Arg>::type>
{ };
template<typename _MemPtr, typename _Arg, typename... _Args>
struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
: public __result_of_memfun<typename decay<_MemPtr>::type,
typename __inv_unwrap<_Arg>::type, _Args...>
{ };
// [func.require] paragraph 1 bullet 5:
struct __result_of_other_impl
{
template<typename _Fn, typename... _Args>
static __result_of_success<decltype(
std::declval<_Fn>()(std::declval<_Args>()...)
), __invoke_other> _S_test(int);
template<typename...>
static __failure_type _S_test(...);
};
template<typename _Functor, typename... _ArgTypes>
struct __result_of_impl<false, false, _Functor, _ArgTypes...>
: private __result_of_other_impl
{
typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type;
};
// __invoke_result (std::invoke_result for C++11)
template<typename _Functor, typename... _ArgTypes>
struct __invoke_result
: public __result_of_impl<
is_member_object_pointer<
typename remove_reference<_Functor>::type
>::value,
is_member_function_pointer<
typename remove_reference<_Functor>::type
>::value,
_Functor, _ArgTypes...
>::type
{ };
template<typename _Functor, typename... _ArgTypes>
struct result_of<_Functor(_ArgTypes...)>
: public __invoke_result<_Functor, _ArgTypes...>
{ };
#if __cplusplus >= 201402L
/// Alias template for aligned_storage
template<size_t _Len, size_t _Align =
__alignof__(typename __aligned_storage_msa<_Len>::__type)>
using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
template <size_t _Len, typename... _Types>
using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
/// Alias template for decay
template<typename _Tp>
using decay_t = typename decay<_Tp>::type;
/// Alias template for enable_if
template<bool _Cond, typename _Tp = void>
using enable_if_t = typename enable_if<_Cond, _Tp>::type;
/// Alias template for conditional
template<bool _Cond, typename _Iftrue, typename _Iffalse>
using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type;
/// Alias template for common_type
template<typename... _Tp>
using common_type_t = typename common_type<_Tp...>::type;
/// Alias template for underlying_type
template<typename _Tp>
using underlying_type_t = typename underlying_type<_Tp>::type;
/// Alias template for result_of
template<typename _Tp>
using result_of_t = typename result_of<_Tp>::type;
#endif // C++14
// __enable_if_t (std::enable_if_t for C++11)
template<bool _Cond, typename _Tp = void>
using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
// __void_t (std::void_t for C++11)
template<typename...> using __void_t = void;
#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++11
#define __cpp_lib_void_t 201411
/// A metafunction that always yields void, used for detecting valid types.
template<typename...> using void_t = void;
#endif
/// Implementation of the detection idiom (negative case).
template<typename _Default, typename _AlwaysVoid,
template<typename...> class _Op, typename... _Args>
struct __detector
{
using value_t = false_type;
using type = _Default;
};
/// Implementation of the detection idiom (positive case).
template<typename _Default, template<typename...> class _Op,
typename... _Args>
struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
{
using value_t = true_type;
using type = _Op<_Args...>;
};
// Detect whether _Op<_Args...> is a valid type, use _Default if not.
template<typename _Default, template<typename...> class _Op,
typename... _Args>
using __detected_or = __detector<_Default, void, _Op, _Args...>;
// _Op<_Args...> if that is a valid type, otherwise _Default.
template<typename _Default, template<typename...> class _Op,
typename... _Args>
using __detected_or_t
= typename __detected_or<_Default, _Op, _Args...>::type;
/// @} group metaprogramming
/**
* Use SFINAE to determine if the type _Tp has a publicly-accessible
* member type _NTYPE.
*/
#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
template<typename _Tp, typename = __void_t<>> \
struct __has_##_NTYPE \
: false_type \
{ }; \
template<typename _Tp> \
struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
: true_type \
{ };
template <typename _Tp>
struct __is_swappable;
template <typename _Tp>
struct __is_nothrow_swappable;
template<typename... _Elements>
class tuple;
template<typename>
struct __is_tuple_like_impl : false_type
{ };
template<typename... _Tps>
struct __is_tuple_like_impl<tuple<_Tps...>> : true_type
{ };
// Internal type trait that allows us to sfinae-protect tuple_cat.
template<typename _Tp>
struct __is_tuple_like
: public __is_tuple_like_impl<typename remove_cv<
typename remove_reference<_Tp>::type>::type>::type
{ };
template<typename _Tp>
inline
typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
is_move_constructible<_Tp>,
is_move_assignable<_Tp>>::value>::type
swap(_Tp&, _Tp&)
noexcept(__and_<is_nothrow_move_constructible<_Tp>,
is_nothrow_move_assignable<_Tp>>::value);
template<typename _Tp, size_t _Nm>
inline
typename enable_if<__is_swappable<_Tp>::value>::type
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
noexcept(__is_nothrow_swappable<_Tp>::value);
namespace __swappable_details {
using std::swap;
struct __do_is_swappable_impl
{
template<typename _Tp, typename
= decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
static true_type __test(int);
template<typename>
static false_type __test(...);
};
struct __do_is_nothrow_swappable_impl
{
template<typename _Tp>
static __bool_constant<
noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
> __test(int);
template<typename>
static false_type __test(...);
};
} // namespace __swappable_details
template<typename _Tp>
struct __is_swappable_impl
: public __swappable_details::__do_is_swappable_impl
{
typedef decltype(__test<_Tp>(0)) type;
};
template<typename _Tp>
struct __is_nothrow_swappable_impl
: public __swappable_details::__do_is_nothrow_swappable_impl
{
typedef decltype(__test<_Tp>(0)) type;
};
template<typename _Tp>
struct __is_swappable
: public __is_swappable_impl<_Tp>::type
{ };
template<typename _Tp>
struct __is_nothrow_swappable
: public __is_nothrow_swappable_impl<_Tp>::type
{ };
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
#define __cpp_lib_is_swappable 201603
/// Metafunctions used for detecting swappable types: p0185r1
/// is_swappable
template<typename _Tp>
struct is_swappable
: public __is_swappable_impl<_Tp>::type
{ };
/// is_nothrow_swappable
template<typename _Tp>
struct is_nothrow_swappable
: public __is_nothrow_swappable_impl<_Tp>::type
{ };
#if __cplusplus >= 201402L
/// is_swappable_v
template<typename _Tp>
_GLIBCXX17_INLINE constexpr bool is_swappable_v =
is_swappable<_Tp>::value;
/// is_nothrow_swappable_v
template<typename _Tp>
_GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_v =
is_nothrow_swappable<_Tp>::value;
#endif // __cplusplus >= 201402L
namespace __swappable_with_details {
using std::swap;
struct __do_is_swappable_with_impl
{
template<typename _Tp, typename _Up, typename
= decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
typename
= decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))>
static true_type __test(int);
template<typename, typename>
static false_type __test(...);
};
struct __do_is_nothrow_swappable_with_impl
{
template<typename _Tp, typename _Up>
static __bool_constant<
noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
&&
noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()))
> __test(int);
template<typename, typename>
static false_type __test(...);
};
} // namespace __swappable_with_details
template<typename _Tp, typename _Up>
struct __is_swappable_with_impl
: public __swappable_with_details::__do_is_swappable_with_impl
{
typedef decltype(__test<_Tp, _Up>(0)) type;
};
// Optimization for the homogenous lvalue case, not required:
template<typename _Tp>
struct __is_swappable_with_impl<_Tp&, _Tp&>
: public __swappable_details::__do_is_swappable_impl
{
typedef decltype(__test<_Tp&>(0)) type;
};
template<typename _Tp, typename _Up>
struct __is_nothrow_swappable_with_impl
: public __swappable_with_details::__do_is_nothrow_swappable_with_impl
{
typedef decltype(__test<_Tp, _Up>(0)) type;
};
// Optimization for the homogenous lvalue case, not required:
template<typename _Tp>
struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
: public __swappable_details::__do_is_nothrow_swappable_impl
{
typedef decltype(__test<_Tp&>(0)) type;
};
/// is_swappable_with
template<typename _Tp, typename _Up>
struct is_swappable_with
: public __is_swappable_with_impl<_Tp, _Up>::type
{ };
/// is_nothrow_swappable_with
template<typename _Tp, typename _Up>
struct is_nothrow_swappable_with
: public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
{ };
#if __cplusplus >= 201402L
/// is_swappable_with_v
template<typename _Tp, typename _Up>
_GLIBCXX17_INLINE constexpr bool is_swappable_with_v =
is_swappable_with<_Tp, _Up>::value;
/// is_nothrow_swappable_with_v
template<typename _Tp, typename _Up>
_GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_with_v =
is_nothrow_swappable_with<_Tp, _Up>::value;
#endif // __cplusplus >= 201402L
#endif// c++1z or gnu++11
// __is_invocable (std::is_invocable for C++11)
template<typename _Result, typename _Ret, typename = void>
struct __is_invocable_impl : false_type { };
template<typename _Result, typename _Ret>
struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>>
: __or_<is_void<_Ret>, is_convertible<typename _Result::type, _Ret>>::type
{ };
template<typename _Fn, typename... _ArgTypes>
struct __is_invocable
: __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
{ };
template<typename _Fn, typename _Tp, typename... _Args>
constexpr bool __call_is_nt(__invoke_memfun_ref)
{
using _Up = typename __inv_unwrap<_Tp>::type;
return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
std::declval<_Args>()...));
}
template<typename _Fn, typename _Tp, typename... _Args>
constexpr bool __call_is_nt(__invoke_memfun_deref)
{
return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
std::declval<_Args>()...));
}
template<typename _Fn, typename _Tp>
constexpr bool __call_is_nt(__invoke_memobj_ref)
{
using _Up = typename __inv_unwrap<_Tp>::type;
return noexcept(std::declval<_Up>().*std::declval<_Fn>());
}
template<typename _Fn, typename _Tp>
constexpr bool __call_is_nt(__invoke_memobj_deref)
{
return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
}
template<typename _Fn, typename... _Args>
constexpr bool __call_is_nt(__invoke_other)
{
return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
}
template<typename _Result, typename _Fn, typename... _Args>
struct __call_is_nothrow
: __bool_constant<
std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
>
{ };
template<typename _Fn, typename... _Args>
using __call_is_nothrow_
= __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
// __is_nothrow_invocable (std::is_nothrow_invocable for C++11)
template<typename _Fn, typename... _Args>
struct __is_nothrow_invocable
: __and_<__is_invocable<_Fn, _Args...>,
__call_is_nothrow_<_Fn, _Args...>>::type
{ };
struct __nonesuch {
__nonesuch() = delete;
~__nonesuch() = delete;
__nonesuch(__nonesuch const&) = delete;
void operator=(__nonesuch const&) = delete;
};
#if __cplusplus >= 201703L
# define __cpp_lib_is_invocable 201703
/// std::invoke_result
template<typename _Functor, typename... _ArgTypes>
struct invoke_result
: public __invoke_result<_Functor, _ArgTypes...>
{ };
/// std::invoke_result_t
template<typename _Fn, typename... _Args>
using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
/// std::is_invocable
template<typename _Fn, typename... _ArgTypes>
struct is_invocable
: __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
{ };
/// std::is_invocable_r
template<typename _Ret, typename _Fn, typename... _ArgTypes>
struct is_invocable_r
: __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
{ };
/// std::is_nothrow_invocable
template<typename _Fn, typename... _ArgTypes>
struct is_nothrow_invocable
: __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
__call_is_nothrow_<_Fn, _ArgTypes...>>::type
{ };
template<typename _Result, typename _Ret, typename = void>
struct __is_nt_invocable_impl : false_type { };
template<typename _Result, typename _Ret>
struct __is_nt_invocable_impl<_Result, _Ret,
__void_t<typename _Result::type>>
: __or_<is_void<_Ret>,
__and_<is_convertible<typename _Result::type, _Ret>,
is_nothrow_constructible<_Ret, typename _Result::type>>>
{ };
/// std::is_nothrow_invocable_r
template<typename _Ret, typename _Fn, typename... _ArgTypes>
struct is_nothrow_invocable_r
: __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
__call_is_nothrow_<_Fn, _ArgTypes...>>::type
{ };
/// std::is_invocable_v
template<typename _Fn, typename... _Args>
inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
/// std::is_nothrow_invocable_v
template<typename _Fn, typename... _Args>
inline constexpr bool is_nothrow_invocable_v
= is_nothrow_invocable<_Fn, _Args...>::value;
/// std::is_invocable_r_v
template<typename _Fn, typename... _Args>
inline constexpr bool is_invocable_r_v
= is_invocable_r<_Fn, _Args...>::value;
/// std::is_nothrow_invocable_r_v
template<typename _Fn, typename... _Args>
inline constexpr bool is_nothrow_invocable_r_v
= is_nothrow_invocable_r<_Fn, _Args...>::value;
#endif // C++17
#if __cplusplus >= 201703L
# define __cpp_lib_type_trait_variable_templates 201510L
template <typename _Tp>
inline constexpr bool is_void_v = is_void<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_integral_v = is_integral<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_array_v = is_array<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_lvalue_reference_v =
is_lvalue_reference<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_rvalue_reference_v =
is_rvalue_reference<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_member_object_pointer_v =
is_member_object_pointer<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_member_function_pointer_v =
is_member_function_pointer<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_enum_v = is_enum<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_union_v = is_union<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_class_v = is_class<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_function_v = is_function<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_reference_v = is_reference<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_object_v = is_object<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_compound_v = is_compound<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_const_v = is_const<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_volatile_v = is_volatile<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_trivially_copyable_v =
is_trivially_copyable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_pod_v = is_pod<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_empty_v = is_empty<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_abstract_v = is_abstract<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_final_v = is_final<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_signed_v = is_signed<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
template <typename _Tp, typename... _Args>
inline constexpr bool is_constructible_v =
is_constructible<_Tp, _Args...>::value;
template <typename _Tp>
inline constexpr bool is_default_constructible_v =
is_default_constructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_copy_constructible_v =
is_copy_constructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_move_constructible_v =
is_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
inline constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value;
template <typename _Tp>
inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_destructible_v = is_destructible<_Tp>::value;
template <typename _Tp, typename... _Args>
inline constexpr bool is_trivially_constructible_v =
is_trivially_constructible<_Tp, _Args...>::value;
template <typename _Tp>
inline constexpr bool is_trivially_default_constructible_v =
is_trivially_default_constructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_trivially_copy_constructible_v =
is_trivially_copy_constructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_trivially_move_constructible_v =
is_trivially_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
inline constexpr bool is_trivially_assignable_v =
is_trivially_assignable<_Tp, _Up>::value;
template <typename _Tp>
inline constexpr bool is_trivially_copy_assignable_v =
is_trivially_copy_assignable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_trivially_move_assignable_v =
is_trivially_move_assignable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_trivially_destructible_v =
is_trivially_destructible<_Tp>::value;
template <typename _Tp, typename... _Args>
inline constexpr bool is_nothrow_constructible_v =
is_nothrow_constructible<_Tp, _Args...>::value;
template <typename _Tp>
inline constexpr bool is_nothrow_default_constructible_v =
is_nothrow_default_constructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_nothrow_copy_constructible_v =
is_nothrow_copy_constructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_nothrow_move_constructible_v =
is_nothrow_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
inline constexpr bool is_nothrow_assignable_v =
is_nothrow_assignable<_Tp, _Up>::value;
template <typename _Tp>
inline constexpr bool is_nothrow_copy_assignable_v =
is_nothrow_copy_assignable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_nothrow_move_assignable_v =
is_nothrow_move_assignable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_nothrow_destructible_v =
is_nothrow_destructible<_Tp>::value;
template <typename _Tp>
inline constexpr bool has_virtual_destructor_v =
has_virtual_destructor<_Tp>::value;
template <typename _Tp>
inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
template <typename _Tp>
inline constexpr size_t rank_v = rank<_Tp>::value;
template <typename _Tp, unsigned _Idx = 0>
inline constexpr size_t extent_v = extent<_Tp, _Idx>::value;
template <typename _Tp, typename _Up>
inline constexpr bool is_same_v = is_same<_Tp, _Up>::value;
template <typename _Base, typename _Derived>
inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
template <typename _From, typename _To>
inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
#if __GNUC__ >= 7
# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
#elif defined(__is_identifier)
// For non-GNU compilers:
# if ! __is_identifier(__has_unique_object_representations)
# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
# endif
#endif
#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
# define __cpp_lib_has_unique_object_representations 201606
/// has_unique_object_representations
template<typename _Tp>
struct has_unique_object_representations
: bool_constant<__has_unique_object_representations(
remove_cv_t<remove_all_extents_t<_Tp>>
)>
{ };
template<typename _Tp>
inline constexpr bool has_unique_object_representations_v
= has_unique_object_representations<_Tp>::value;
#endif
#undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
#if __GNUC__ >= 7
# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
#elif defined(__is_identifier)
// For non-GNU compilers:
# if ! __is_identifier(__is_aggregate)
# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
# endif
#endif
#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
#define __cpp_lib_is_aggregate 201703
/// is_aggregate
template<typename _Tp>
struct is_aggregate
: bool_constant<__is_aggregate(remove_cv_t<_Tp>)> { };
/// is_aggregate_v
template<typename _Tp>
inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
#endif
#undef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
#endif // C++17
#if __cplusplus > 201703L
/// Byte order
enum class endian
{
little = __ORDER_LITTLE_ENDIAN__,
big = __ORDER_BIG_ENDIAN__,
native = __BYTE_ORDER__
};
#endif // C++2a
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_TYPE_TRAITS
// Output streams -*- C++ -*-
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/ostream
* This is a Standard C++ Library header.
*/
//
// ISO C++ 14882: 27.6.2 Output streams
//
#ifndef _GLIBCXX_OSTREAM
#define _GLIBCXX_OSTREAM 1
#pragma GCC system_header
#include <ios>
#include <bits/ostream_insert.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Template class basic_ostream.
* @ingroup io
*
* @tparam _CharT Type of character stream.
* @tparam _Traits Traits for character type, defaults to
* char_traits<_CharT>.
*
* This is the base class for all output streams. It provides text
* formatting of all builtin types, and communicates with any class
* derived from basic_streambuf to do the actual output.
*/
template<typename _CharT, typename _Traits>
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
{
public:
// Types (inherited from basic_ios):
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard Types:
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
__num_put_type;
typedef ctype<_CharT> __ctype_type;
/**
* @brief Base constructor.
*
* This ctor is almost never called by the user directly, rather from
* derived classes' initialization lists, which pass a pointer to
* their own stream buffer.
*/
explicit
basic_ostream(__streambuf_type* __sb)
{ this->init(__sb); }
/**
* @brief Base destructor.
*
* This does very little apart from providing a virtual base dtor.
*/
virtual
~basic_ostream() { }
/// Safe prefix/suffix operations.
class sentry;
friend class sentry;
//@{
/**
* @brief Interface for manipulators.
*
* Manipulators such as @c std::endl and @c std::hex use these
* functions in constructs like "std::cout << std::endl". For more
* information, see the iomanip header.
*/
__ostream_type&
operator<<(__ostream_type& (*__pf)(__ostream_type&))
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 60. What is a formatted input function?
// The inserters for manipulators are *not* formatted output functions.
return __pf(*this);
}
__ostream_type&
operator<<(__ios_type& (*__pf)(__ios_type&))
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 60. What is a formatted input function?
// The inserters for manipulators are *not* formatted output functions.
__pf(*this);
return *this;
}
__ostream_type&
operator<<(ios_base& (*__pf) (ios_base&))
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 60. What is a formatted input function?
// The inserters for manipulators are *not* formatted output functions.
__pf(*this);
return *this;
}
//@}
//@{
/**
* @name Inserters
*
* All the @c operator<< functions (aka <em>formatted output
* functions</em>) have some common behavior. Each starts by
* constructing a temporary object of type std::basic_ostream::sentry.
* This can have several effects, concluding with the setting of a
* status flag; see the sentry documentation for more.
*
* If the sentry status is good, the function tries to generate
* whatever data is appropriate for the type of the argument.
*
* If an exception is thrown during insertion, ios_base::badbit
* will be turned on in the stream's error state without causing an
* ios_base::failure to be thrown. The original exception will then
* be rethrown.
*/
//@{
/**
* @brief Integer arithmetic inserters
* @param __n A variable of builtin integral type.
* @return @c *this if successful
*
* These functions use the stream's current locale (specifically, the
* @c num_get facet) to perform numeric formatting.
*/
__ostream_type&
operator<<(long __n)
{ return _M_insert(__n); }
__ostream_type&
operator<<(unsigned long __n)
{ return _M_insert(__n); }
__ostream_type&
operator<<(bool __n)
{ return _M_insert(__n); }
__ostream_type&
operator<<(short __n);
__ostream_type&
operator<<(unsigned short __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
return _M_insert(static_cast<unsigned long>(__n));
}
__ostream_type&
operator<<(int __n);
__ostream_type&
operator<<(unsigned int __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
return _M_insert(static_cast<unsigned long>(__n));
}
#ifdef _GLIBCXX_USE_LONG_LONG
__ostream_type&
operator<<(long long __n)
{ return _M_insert(__n); }
__ostream_type&
operator<<(unsigned long long __n)
{ return _M_insert(__n); }
#endif
//@}
//@{
/**
* @brief Floating point arithmetic inserters
* @param __f A variable of builtin floating point type.
* @return @c *this if successful
*
* These functions use the stream's current locale (specifically, the
* @c num_get facet) to perform numeric formatting.
*/
__ostream_type&
operator<<(double __f)
{ return _M_insert(__f); }
__ostream_type&
operator<<(float __f)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
return _M_insert(static_cast<double>(__f));
}
__ostream_type&
operator<<(long double __f)
{ return _M_insert(__f); }
//@}
/**
* @brief Pointer arithmetic inserters
* @param __p A variable of pointer type.
* @return @c *this if successful
*
* These functions use the stream's current locale (specifically, the
* @c num_get facet) to perform numeric formatting.
*/
__ostream_type&
operator<<(const void* __p)
{ return _M_insert(__p); }
/**
* @brief Extracting from another streambuf.
* @param __sb A pointer to a streambuf
*
* This function behaves like one of the basic arithmetic extractors,
* in that it also constructs a sentry object and has the same error
* handling behavior.
*
* If @p __sb is NULL, the stream will set failbit in its error state.
*
* Characters are extracted from @p __sb and inserted into @c *this
* until one of the following occurs:
*
* - the input stream reaches end-of-file,
* - insertion into the output sequence fails (in this case, the
* character that would have been inserted is not extracted), or
* - an exception occurs while getting a character from @p __sb, which
* sets failbit in the error state
*
* If the function inserts no characters, failbit is set.
*/
__ostream_type&
operator<<(__streambuf_type* __sb);
//@}
//@{
/**
* @name Unformatted Output Functions
*
* All the unformatted output functions have some common behavior.
* Each starts by constructing a temporary object of type
* std::basic_ostream::sentry. This has several effects, concluding
* with the setting of a status flag; see the sentry documentation
* for more.
*
* If the sentry status is good, the function tries to generate
* whatever data is appropriate for the type of the argument.
*
* If an exception is thrown during insertion, ios_base::badbit
* will be turned on in the stream's error state. If badbit is on in
* the stream's exceptions mask, the exception will be rethrown
* without completing its actions.
*/
/**
* @brief Simple insertion.
* @param __c The character to insert.
* @return *this
*
* Tries to insert @p __c.
*
* @note This function is not overloaded on signed char and
* unsigned char.
*/
__ostream_type&
put(char_type __c);
/**
* @brief Core write functionality, without sentry.
* @param __s The array to insert.
* @param __n Maximum number of characters to insert.
*/
void
_M_write(const char_type* __s, streamsize __n)
{
const streamsize __put = this->rdbuf()->sputn(__s, __n);
if (__put != __n)
this->setstate(ios_base::badbit);
}
/**
* @brief Character string insertion.
* @param __s The array to insert.
* @param __n Maximum number of characters to insert.
* @return *this
*
* Characters are copied from @p __s and inserted into the stream until
* one of the following happens:
*
* - @p __n characters are inserted
* - inserting into the output sequence fails (in this case, badbit
* will be set in the stream's error state)
*
* @note This function is not overloaded on signed char and
* unsigned char.
*/
__ostream_type&
write(const char_type* __s, streamsize __n);
//@}
/**
* @brief Synchronizing the stream buffer.
* @return *this
*
* If @c rdbuf() is a null pointer, changes nothing.
*
* Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1,
* sets badbit.
*/
__ostream_type&
flush();
/**
* @brief Getting the current write position.
* @return A file position object.
*
* If @c fail() is not false, returns @c pos_type(-1) to indicate
* failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,out).
*/
pos_type
tellp();
/**
* @brief Changing the current write position.
* @param __pos A file position object.
* @return *this
*
* If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If
* that function fails, sets failbit.
*/
__ostream_type&
seekp(pos_type);
/**
* @brief Changing the current write position.
* @param __off A file offset object.
* @param __dir The direction in which to seek.
* @return *this
*
* If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir).
* If that function fails, sets failbit.
*/
__ostream_type&
seekp(off_type, ios_base::seekdir);
protected:
basic_ostream()
{ this->init(0); }
#if __cplusplus >= 201103L
// Non-standard constructor that does not call init()
basic_ostream(basic_iostream<_CharT, _Traits>&) { }
basic_ostream(const basic_ostream&) = delete;
basic_ostream(basic_ostream&& __rhs)
: __ios_type()
{ __ios_type::move(__rhs); }
// 27.7.3.3 Assign/swap
basic_ostream& operator=(const basic_ostream&) = delete;
basic_ostream&
operator=(basic_ostream&& __rhs)
{
swap(__rhs);
return *this;
}
void
swap(basic_ostream& __rhs)
{ __ios_type::swap(__rhs); }
#endif
template<typename _ValueT>
__ostream_type&
_M_insert(_ValueT __v);
};
/**
* @brief Performs setup work for output streams.
*
* Objects of this class are created before all of the standard
* inserters are run. It is responsible for <em>exception-safe prefix and
* suffix operations</em>.
*/
template <typename _CharT, typename _Traits>
class basic_ostream<_CharT, _Traits>::sentry
{
// Data Members.
bool _M_ok;
basic_ostream<_CharT, _Traits>& _M_os;
public:
/**
* @brief The constructor performs preparatory work.
* @param __os The output stream to guard.
*
* If the stream state is good (@a __os.good() is true), then if the
* stream is tied to another output stream, @c is.tie()->flush()
* is called to synchronize the output sequences.
*
* If the stream state is still good, then the sentry state becomes
* true (@a okay).
*/
explicit
sentry(basic_ostream<_CharT, _Traits>& __os);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/**
* @brief Possibly flushes the stream.
*
* If @c ios_base::unitbuf is set in @c os.flags(), and
* @c std::uncaught_exception() is true, the sentry destructor calls
* @c flush() on the output stream.
*/
~sentry()
{
// XXX MT
if (bool(_M_os.flags() & ios_base::unitbuf) && !uncaught_exception())
{
// Can't call flush directly or else will get into recursive lock.
if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
_M_os.setstate(ios_base::badbit);
}
}
#pragma GCC diagnostic pop
/**
* @brief Quick status checking.
* @return The sentry state.
*
* For ease of use, sentries may be converted to booleans. The
* return value is that of the sentry state (true == okay).
*/
#if __cplusplus >= 201103L
explicit
#endif
operator bool() const
{ return _M_ok; }
};
//@{
/**
* @brief Character inserters
* @param __out An output stream.
* @param __c A character.
* @return out
*
* Behaves like one of the formatted arithmetic inserters described in
* std::basic_ostream. After constructing a sentry object with good
* status, this function inserts a single character and any required
* padding (as determined by [22.2.2.2.2]). @c __out.width(0) is then
* called.
*
* If @p __c is of type @c char and the character type of the stream is not
* @c char, the character is widened before insertion.
*/
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
{ return __ostream_insert(__out, &__c, 1); }
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
{ return (__out << __out.widen(__c)); }
// Specialization
template <class _Traits>
inline basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, char __c)
{ return __ostream_insert(__out, &__c, 1); }
// Signed and unsigned
template<class _Traits>
inline basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
{ return (__out << static_cast<char>(__c)); }
template<class _Traits>
inline basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
{ return (__out << static_cast<char>(__c)); }
//@}
//@{
/**
* @brief String inserters
* @param __out An output stream.
* @param __s A character string.
* @return out
* @pre @p __s must be a non-NULL pointer
*
* Behaves like one of the formatted arithmetic inserters described in
* std::basic_ostream. After constructing a sentry object with good
* status, this function inserts @c traits::length(__s) characters starting
* at @p __s, widened if necessary, followed by any required padding (as
* determined by [22.2.2.2.2]). @c __out.width(0) is then called.
*/
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
{
if (!__s)
__out.setstate(ios_base::badbit);
else
__ostream_insert(__out, __s,
static_cast<streamsize>(_Traits::length(__s)));
return __out;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits> &
operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);
// Partial specializations
template<class _Traits>
inline basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
{
if (!__s)
__out.setstate(ios_base::badbit);
else
__ostream_insert(__out, __s,
static_cast<streamsize>(_Traits::length(__s)));
return __out;
}
// Signed and unsigned
template<class _Traits>
inline basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
{ return (__out << reinterpret_cast<const char*>(__s)); }
template<class _Traits>
inline basic_ostream<char, _Traits> &
operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
{ return (__out << reinterpret_cast<const char*>(__s)); }
//@}
// Standard basic_ostream manipulators
/**
* @brief Write a newline and flush the stream.
*
* This manipulator is often mistakenly used when a simple newline is
* desired, leading to poor buffering performance. See
* https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering
* for more on this subject.
*/
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
endl(basic_ostream<_CharT, _Traits>& __os)
{ return flush(__os.put(__os.widen('\n'))); }
/**
* @brief Write a null character into the output sequence.
*
* <em>Null character</em> is @c CharT() by definition. For CharT
* of @c char, this correctly writes the ASCII @c NUL character
* string terminator.
*/
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
ends(basic_ostream<_CharT, _Traits>& __os)
{ return __os.put(_CharT()); }
/**
* @brief Flushes the output stream.
*
* This manipulator simply calls the stream's @c flush() member function.
*/
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
flush(basic_ostream<_CharT, _Traits>& __os)
{ return __os.flush(); }
#if __cplusplus >= 201103L
template<typename _Ch, typename _Up>
basic_ostream<_Ch, _Up>&
__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*);
template<typename _Tp, typename = void>
struct __is_convertible_to_basic_ostream_impl
{
using __ostream_type = void;
};
template<typename _Tp>
using __do_is_convertible_to_basic_ostream_impl =
decltype(__is_convertible_to_basic_ostream_test
(declval<typename remove_reference<_Tp>::type*>()));
template<typename _Tp>
struct __is_convertible_to_basic_ostream_impl
<_Tp,
__void_t<__do_is_convertible_to_basic_ostream_impl<_Tp>>>
{
using __ostream_type =
__do_is_convertible_to_basic_ostream_impl<_Tp>;
};
template<typename _Tp>
struct __is_convertible_to_basic_ostream
: __is_convertible_to_basic_ostream_impl<_Tp>
{
public:
using type = __not_<is_void<
typename __is_convertible_to_basic_ostream_impl<_Tp>::__ostream_type>>;
constexpr static bool value = type::value;
};
template<typename _Ostream, typename _Tp, typename = void>
struct __is_insertable : false_type {};
template<typename _Ostream, typename _Tp>
struct __is_insertable<_Ostream, _Tp,
__void_t<decltype(declval<_Ostream&>()
<< declval<const _Tp&>())>>
: true_type {};
template<typename _Ostream>
using __rvalue_ostream_type =
typename __is_convertible_to_basic_ostream<
_Ostream>::__ostream_type;
/**
* @brief Generic inserter for rvalue stream
* @param __os An input stream.
* @param __x A reference to the object being inserted.
* @return os
*
* This is just a forwarding function to allow insertion to
* rvalue streams since they won't bind to the inserter functions
* that take an lvalue reference.
*/
template<typename _Ostream, typename _Tp>
inline
typename enable_if<__and_<__not_<is_lvalue_reference<_Ostream>>,
__is_convertible_to_basic_ostream<_Ostream>,
__is_insertable<
__rvalue_ostream_type<_Ostream>,
const _Tp&>>::value,
__rvalue_ostream_type<_Ostream>>::type
operator<<(_Ostream&& __os, const _Tp& __x)
{
__rvalue_ostream_type<_Ostream> __ret_os = __os;
__ret_os << __x;
return __ret_os;
}
#endif // C++11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/ostream.tcc>
#endif /* _GLIBCXX_OSTREAM */
// <queue> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file include/queue
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_QUEUE
#define _GLIBCXX_QUEUE 1
#pragma GCC system_header
#include <deque>
#include <vector>
#include <bits/stl_heap.h>
#include <bits/stl_function.h>
#include <bits/stl_queue.h>
#endif /* _GLIBCXX_QUEUE */
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file clocale
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c locale.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
#pragma GCC system_header
#include <bits/c++config.h>
#include <locale.h>
#ifndef _GLIBCXX_CLOCALE
#define _GLIBCXX_CLOCALE 1
// Get rid of those macros defined in <locale.h> in lieu of real functions.
#undef setlocale
#undef localeconv
namespace std
{
using ::lconv;
using ::setlocale;
using ::localeconv;
} // namespace std
#endif
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file csignal
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c signal.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
//
// ISO C++ 14882: 20.4.6 C library
//
#pragma GCC system_header
#include <bits/c++config.h>
#include <signal.h>
#ifndef _GLIBCXX_CSIGNAL
#define _GLIBCXX_CSIGNAL 1
// Get rid of those macros defined in <signal.h> in lieu of real functions.
#undef raise
namespace std
{
using ::sig_atomic_t;
using ::signal;
using ::raise;
} // namespace std
#endif
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/ctime
* This is a Standard C++ Library file. You should @c \#include this file
* in your programs, rather than any of the @a *.h implementation files.
*
* This is the C++ version of the Standard C Library header @c time.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/
//
// ISO C++ 14882: 20.5 Date and time
//
#pragma GCC system_header
#include <bits/c++config.h>
#include <time.h>
#ifndef _GLIBCXX_CTIME
#define _GLIBCXX_CTIME 1
// Get rid of those macros defined in <time.h> in lieu of real functions.
#undef clock
#undef difftime
#undef mktime
#undef time
#undef asctime
#undef ctime
#undef gmtime
#undef localtime
#undef strftime
namespace std
{
using ::clock_t;
using ::time_t;
using ::tm;
using ::clock;
using ::difftime;
using ::mktime;
using ::time;
using ::asctime;
using ::ctime;
using ::gmtime;
using ::localtime;
using ::strftime;
} // namespace
#endif
// Hashtable implementation used by containers -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file backward/hashtable.h
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _BACKWARD_HASHTABLE_H
#define _BACKWARD_HASHTABLE_H 1
// Hashtable class, used to implement the hashed associative containers
// hash_set, hash_map, hash_multiset, and hash_multimap.
#include <vector>
#include <iterator>
#include <algorithm>
#include <bits/stl_function.h>
#include <backward/hash_fun.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
using std::forward_iterator_tag;
using std::input_iterator_tag;
using std::_Construct;
using std::_Destroy;
using std::distance;
using std::vector;
using std::pair;
using std::__iterator_category;
template<class _Val>
struct _Hashtable_node
{
_Hashtable_node* _M_next;
_Val _M_val;
};
template<class _Val, class _Key, class _HashFcn, class _ExtractKey,
class _EqualKey, class _Alloc = std::allocator<_Val> >
class hashtable;
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_iterator;
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_const_iterator;
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_iterator
{
typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
_Hashtable;
typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
_ExtractKey, _EqualKey, _Alloc>
iterator;
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
_ExtractKey, _EqualKey, _Alloc>
const_iterator;
typedef _Hashtable_node<_Val> _Node;
typedef forward_iterator_tag iterator_category;
typedef _Val value_type;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef _Val& reference;
typedef _Val* pointer;
_Node* _M_cur;
_Hashtable* _M_ht;
_Hashtable_iterator(_Node* __n, _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) { }
_Hashtable_iterator() { }
reference
operator*() const
{ return _M_cur->_M_val; }
pointer
operator->() const
{ return &(operator*()); }
iterator&
operator++();
iterator
operator++(int);
bool
operator==(const iterator& __it) const
{ return _M_cur == __it._M_cur; }
bool
operator!=(const iterator& __it) const
{ return _M_cur != __it._M_cur; }
};
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_const_iterator
{
typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
_Hashtable;
typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
_ExtractKey,_EqualKey,_Alloc>
iterator;
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
_ExtractKey, _EqualKey, _Alloc>
const_iterator;
typedef _Hashtable_node<_Val> _Node;
typedef forward_iterator_tag iterator_category;
typedef _Val value_type;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef const _Val& reference;
typedef const _Val* pointer;
const _Node* _M_cur;
const _Hashtable* _M_ht;
_Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) { }
_Hashtable_const_iterator() { }
_Hashtable_const_iterator(const iterator& __it)
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) { }
reference
operator*() const
{ return _M_cur->_M_val; }
pointer
operator->() const
{ return &(operator*()); }
const_iterator&
operator++();
const_iterator
operator++(int);
bool
operator==(const const_iterator& __it) const
{ return _M_cur == __it._M_cur; }
bool
operator!=(const const_iterator& __it) const
{ return _M_cur != __it._M_cur; }
};
// Note: assumes long is at least 32 bits.
enum { _S_num_primes = 29 };
template<typename _PrimeType>
struct _Hashtable_prime_list
{
static const _PrimeType __stl_prime_list[_S_num_primes];
static const _PrimeType*
_S_get_prime_list();
};
template<typename _PrimeType> const _PrimeType
_Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] =
{
5ul, 53ul, 97ul, 193ul, 389ul,
769ul, 1543ul, 3079ul, 6151ul, 12289ul,
24593ul, 49157ul, 98317ul, 196613ul, 393241ul,
786433ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul,
25165843ul, 50331653ul, 100663319ul, 201326611ul, 402653189ul,
805306457ul, 1610612741ul, 3221225473ul, 4294967291ul
};
template<class _PrimeType> inline const _PrimeType*
_Hashtable_prime_list<_PrimeType>::_S_get_prime_list()
{
return __stl_prime_list;
}
inline unsigned long
__stl_next_prime(unsigned long __n)
{
const unsigned long* __first = _Hashtable_prime_list<unsigned long>::_S_get_prime_list();
const unsigned long* __last = __first + (int)_S_num_primes;
const unsigned long* pos = std::lower_bound(__first, __last, __n);
return pos == __last ? *(__last - 1) : *pos;
}
// Forward declaration of operator==.
template<class _Val, class _Key, class _HF, class _Ex,
class _Eq, class _All>
class hashtable;
template<class _Val, class _Key, class _HF, class _Ex,
class _Eq, class _All>
bool
operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2);
// Hashtables handle allocators a bit differently than other
// containers do. If we're using standard-conforming allocators, then
// a hashtable unconditionally has a member variable to hold its
// allocator, even if it so happens that all instances of the
// allocator type are identical. This is because, for hashtables,
// this extra storage is negligible. Additionally, a base class
// wouldn't serve any other purposes; it wouldn't, for example,
// simplify the exception-handling code.
template<class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc>
class hashtable
{
public:
typedef _Key key_type;
typedef _Val value_type;
typedef _HashFcn hasher;
typedef _EqualKey key_equal;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
hasher
hash_funct() const
{ return _M_hash; }
key_equal
key_eq() const
{ return _M_equals; }
private:
typedef _Hashtable_node<_Val> _Node;
public:
typedef typename _Alloc::template rebind<value_type>::other allocator_type;
allocator_type
get_allocator() const
{ return _M_node_allocator; }
private:
typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;
_Node_Alloc _M_node_allocator;
_Node*
_M_get_node()
{ return _M_node_allocator.allocate(1); }
void
_M_put_node(_Node* __p)
{ _M_node_allocator.deallocate(__p, 1); }
private:
hasher _M_hash;
key_equal _M_equals;
_ExtractKey _M_get_key;
_Vector_type _M_buckets;
size_type _M_num_elements;
public:
typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey,
_EqualKey, _Alloc>
iterator;
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
_EqualKey, _Alloc>
const_iterator;
friend struct
_Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
friend struct
_Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
_EqualKey, _Alloc>;
public:
hashtable(size_type __n, const _HashFcn& __hf,
const _EqualKey& __eql, const _ExtractKey& __ext,
const allocator_type& __a = allocator_type())
: _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),
_M_get_key(__ext), _M_buckets(__a), _M_num_elements(0)
{ _M_initialize_buckets(__n); }
hashtable(size_type __n, const _HashFcn& __hf,
const _EqualKey& __eql,
const allocator_type& __a = allocator_type())
: _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),
_M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0)
{ _M_initialize_buckets(__n); }
hashtable(const hashtable& __ht)
: _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash),
_M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key),
_M_buckets(__ht.get_allocator()), _M_num_elements(0)
{ _M_copy_from(__ht); }
hashtable&
operator= (const hashtable& __ht)
{
if (&__ht != this)
{
clear();
_M_hash = __ht._M_hash;
_M_equals = __ht._M_equals;
_M_get_key = __ht._M_get_key;
_M_copy_from(__ht);
}
return *this;
}
~hashtable()
{ clear(); }
size_type
size() const
{ return _M_num_elements; }
size_type
max_size() const
{ return size_type(-1); }
bool
empty() const
{ return size() == 0; }
void
swap(hashtable& __ht)
{
std::swap(_M_hash, __ht._M_hash);
std::swap(_M_equals, __ht._M_equals);
std::swap(_M_get_key, __ht._M_get_key);
_M_buckets.swap(__ht._M_buckets);
std::swap(_M_num_elements, __ht._M_num_elements);
}
iterator
begin()
{
for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
if (_M_buckets[__n])
return iterator(_M_buckets[__n], this);
return end();
}
iterator
end()
{ return iterator(0, this); }
const_iterator
begin() const
{
for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
if (_M_buckets[__n])
return const_iterator(_M_buckets[__n], this);
return end();
}
const_iterator
end() const
{ return const_iterator(0, this); }
template<class _Vl, class _Ky, class _HF, class _Ex, class _Eq,
class _Al>
friend bool
operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);
public:
size_type
bucket_count() const
{ return _M_buckets.size(); }
size_type
max_bucket_count() const
{ return _Hashtable_prime_list<unsigned long>::
_S_get_prime_list()[(int)_S_num_primes - 1];
}
size_type
elems_in_bucket(size_type __bucket) const
{
size_type __result = 0;
for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next)
__result += 1;
return __result;
}
pair<iterator, bool>
insert_unique(const value_type& __obj)
{
resize(_M_num_elements + 1);
return insert_unique_noresize(__obj);
}
iterator
insert_equal(const value_type& __obj)
{
resize(_M_num_elements + 1);
return insert_equal_noresize(__obj);
}
pair<iterator, bool>
insert_unique_noresize(const value_type& __obj);
iterator
insert_equal_noresize(const value_type& __obj);
template<class _InputIterator>
void
insert_unique(_InputIterator __f, _InputIterator __l)
{ insert_unique(__f, __l, __iterator_category(__f)); }
template<class _InputIterator>
void
insert_equal(_InputIterator __f, _InputIterator __l)
{ insert_equal(__f, __l, __iterator_category(__f)); }
template<class _InputIterator>
void
insert_unique(_InputIterator __f, _InputIterator __l,
input_iterator_tag)
{
for ( ; __f != __l; ++__f)
insert_unique(*__f);
}
template<class _InputIterator>
void
insert_equal(_InputIterator __f, _InputIterator __l,
input_iterator_tag)
{
for ( ; __f != __l; ++__f)
insert_equal(*__f);
}
template<class _ForwardIterator>
void
insert_unique(_ForwardIterator __f, _ForwardIterator __l,
forward_iterator_tag)
{
size_type __n = distance(__f, __l);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f);
}
template<class _ForwardIterator>
void
insert_equal(_ForwardIterator __f, _ForwardIterator __l,
forward_iterator_tag)
{
size_type __n = distance(__f, __l);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f);
}
reference
find_or_insert(const value_type& __obj);
iterator
find(const key_type& __key)
{
size_type __n = _M_bkt_num_key(__key);
_Node* __first;
for (__first = _M_buckets[__n];
__first && !_M_equals(_M_get_key(__first->_M_val), __key);
__first = __first->_M_next)
{ }
return iterator(__first, this);
}
const_iterator
find(const key_type& __key) const
{
size_type __n = _M_bkt_num_key(__key);
const _Node* __first;
for (__first = _M_buckets[__n];
__first && !_M_equals(_M_get_key(__first->_M_val), __key);
__first = __first->_M_next)
{ }
return const_iterator(__first, this);
}
size_type
count(const key_type& __key) const
{
const size_type __n = _M_bkt_num_key(__key);
size_type __result = 0;
for (const _Node* __cur = _M_buckets[__n]; __cur;
__cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), __key))
++__result;
return __result;
}
pair<iterator, iterator>
equal_range(const key_type& __key);
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const;
size_type
erase(const key_type& __key);
void
erase(const iterator& __it);
void
erase(iterator __first, iterator __last);
void
erase(const const_iterator& __it);
void
erase(const_iterator __first, const_iterator __last);
void
resize(size_type __num_elements_hint);
void
clear();
private:
size_type
_M_next_size(size_type __n) const
{ return __stl_next_prime(__n); }
void
_M_initialize_buckets(size_type __n)
{
const size_type __n_buckets = _M_next_size(__n);
_M_buckets.reserve(__n_buckets);
_M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
_M_num_elements = 0;
}
size_type
_M_bkt_num_key(const key_type& __key) const
{ return _M_bkt_num_key(__key, _M_buckets.size()); }
size_type
_M_bkt_num(const value_type& __obj) const
{ return _M_bkt_num_key(_M_get_key(__obj)); }
size_type
_M_bkt_num_key(const key_type& __key, size_t __n) const
{ return _M_hash(__key) % __n; }
size_type
_M_bkt_num(const value_type& __obj, size_t __n) const
{ return _M_bkt_num_key(_M_get_key(__obj), __n); }
_Node*
_M_new_node(const value_type& __obj)
{
_Node* __n = _M_get_node();
__n->_M_next = 0;
__try
{
this->get_allocator().construct(&__n->_M_val, __obj);
return __n;
}
__catch(...)
{
_M_put_node(__n);
__throw_exception_again;
}
}
void
_M_delete_node(_Node* __n)
{
this->get_allocator().destroy(&__n->_M_val);
_M_put_node(__n);
}
void
_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
void
_M_erase_bucket(const size_type __n, _Node* __last);
void
_M_copy_from(const hashtable& __ht);
};
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
operator++()
{
const _Node* __old = _M_cur;
_M_cur = _M_cur->_M_next;
if (!_M_cur)
{
size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
_M_cur = _M_ht->_M_buckets[__bucket];
}
return *this;
}
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
operator++(int)
{
iterator __tmp = *this;
++*this;
return __tmp;
}
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
operator++()
{
const _Node* __old = _M_cur;
_M_cur = _M_cur->_M_next;
if (!_M_cur)
{
size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
_M_cur = _M_ht->_M_buckets[__bucket];
}
return *this;
}
template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All>
inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
operator++(int)
{
const_iterator __tmp = *this;
++*this;
return __tmp;
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
bool
operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
{
typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node;
if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
return false;
for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n)
{
_Node* __cur1 = __ht1._M_buckets[__n];
_Node* __cur2 = __ht2._M_buckets[__n];
// Check same length of lists
for (; __cur1 && __cur2;
__cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
{ }
if (__cur1 || __cur2)
return false;
// Now check one's elements are in the other
for (__cur1 = __ht1._M_buckets[__n] ; __cur1;
__cur1 = __cur1->_M_next)
{
bool _found__cur1 = false;
for (__cur2 = __ht2._M_buckets[__n];
__cur2; __cur2 = __cur2->_M_next)
{
if (__cur1->_M_val == __cur2->_M_val)
{
_found__cur1 = true;
break;
}
}
if (!_found__cur1)
return false;
}
}
return true;
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline bool
operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
{ return !(__ht1 == __ht2); }
template<class _Val, class _Key, class _HF, class _Extract, class _EqKey,
class _All>
inline void
swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2)
{ __ht1.swap(__ht2); }
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
insert_unique_noresize(const value_type& __obj)
{
const size_type __n = _M_bkt_num(__obj);
_Node* __first = _M_buckets[__n];
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
return pair<iterator, bool>(iterator(__cur, this), false);
_Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first;
_M_buckets[__n] = __tmp;
++_M_num_elements;
return pair<iterator, bool>(iterator(__tmp, this), true);
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
insert_equal_noresize(const value_type& __obj)
{
const size_type __n = _M_bkt_num(__obj);
_Node* __first = _M_buckets[__n];
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
{
_Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __cur->_M_next;
__cur->_M_next = __tmp;
++_M_num_elements;
return iterator(__tmp, this);
}
_Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first;
_M_buckets[__n] = __tmp;
++_M_num_elements;
return iterator(__tmp, this);
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
find_or_insert(const value_type& __obj)
{
resize(_M_num_elements + 1);
size_type __n = _M_bkt_num(__obj);
_Node* __first = _M_buckets[__n];
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
return __cur->_M_val;
_Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first;
_M_buckets[__n] = __tmp;
++_M_num_elements;
return __tmp->_M_val;
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
equal_range(const key_type& __key)
{
typedef pair<iterator, iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key);
for (_Node* __first = _M_buckets[__n]; __first;
__first = __first->_M_next)
if (_M_equals(_M_get_key(__first->_M_val), __key))
{
for (_Node* __cur = __first->_M_next; __cur;
__cur = __cur->_M_next)
if (!_M_equals(_M_get_key(__cur->_M_val), __key))
return _Pii(iterator(__first, this), iterator(__cur, this));
for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
if (_M_buckets[__m])
return _Pii(iterator(__first, this),
iterator(_M_buckets[__m], this));
return _Pii(iterator(__first, this), end());
}
return _Pii(end(), end());
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
equal_range(const key_type& __key) const
{
typedef pair<const_iterator, const_iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key);
for (const _Node* __first = _M_buckets[__n]; __first;
__first = __first->_M_next)
{
if (_M_equals(_M_get_key(__first->_M_val), __key))
{
for (const _Node* __cur = __first->_M_next; __cur;
__cur = __cur->_M_next)
if (!_M_equals(_M_get_key(__cur->_M_val), __key))
return _Pii(const_iterator(__first, this),
const_iterator(__cur, this));
for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
if (_M_buckets[__m])
return _Pii(const_iterator(__first, this),
const_iterator(_M_buckets[__m], this));
return _Pii(const_iterator(__first, this), end());
}
}
return _Pii(end(), end());
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const key_type& __key)
{
const size_type __n = _M_bkt_num_key(__key);
_Node* __first = _M_buckets[__n];
_Node* __saved_slot = 0;
size_type __erased = 0;
if (__first)
{
_Node* __cur = __first;
_Node* __next = __cur->_M_next;
while (__next)
{
if (_M_equals(_M_get_key(__next->_M_val), __key))
{
if (&_M_get_key(__next->_M_val) != &__key)
{
__cur->_M_next = __next->_M_next;
_M_delete_node(__next);
__next = __cur->_M_next;
++__erased;
--_M_num_elements;
}
else
{
__saved_slot = __cur;
__cur = __next;
__next = __cur->_M_next;
}
}
else
{
__cur = __next;
__next = __cur->_M_next;
}
}
bool __delete_first = _M_equals(_M_get_key(__first->_M_val), __key);
if (__saved_slot)
{
__next = __saved_slot->_M_next;
__saved_slot->_M_next = __next->_M_next;
_M_delete_node(__next);
++__erased;
--_M_num_elements;
}
if (__delete_first)
{
_M_buckets[__n] = __first->_M_next;
_M_delete_node(__first);
++__erased;
--_M_num_elements;
}
}
return __erased;
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const iterator& __it)
{
_Node* __p = __it._M_cur;
if (__p)
{
const size_type __n = _M_bkt_num(__p->_M_val);
_Node* __cur = _M_buckets[__n];
if (__cur == __p)
{
_M_buckets[__n] = __cur->_M_next;
_M_delete_node(__cur);
--_M_num_elements;
}
else
{
_Node* __next = __cur->_M_next;
while (__next)
{
if (__next == __p)
{
__cur->_M_next = __next->_M_next;
_M_delete_node(__next);
--_M_num_elements;
break;
}
else
{
__cur = __next;
__next = __cur->_M_next;
}
}
}
}
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(iterator __first, iterator __last)
{
size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val)
: _M_buckets.size();
size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val)
: _M_buckets.size();
if (__first._M_cur == __last._M_cur)
return;
else if (__f_bucket == __l_bucket)
_M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
else
{
_M_erase_bucket(__f_bucket, __first._M_cur, 0);
for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
_M_erase_bucket(__n, 0);
if (__l_bucket != _M_buckets.size())
_M_erase_bucket(__l_bucket, __last._M_cur);
}
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const_iterator __first, const_iterator __last)
{
erase(iterator(const_cast<_Node*>(__first._M_cur),
const_cast<hashtable*>(__first._M_ht)),
iterator(const_cast<_Node*>(__last._M_cur),
const_cast<hashtable*>(__last._M_ht)));
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
erase(const const_iterator& __it)
{ erase(iterator(const_cast<_Node*>(__it._M_cur),
const_cast<hashtable*>(__it._M_ht))); }
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
resize(size_type __num_elements_hint)
{
const size_type __old_n = _M_buckets.size();
if (__num_elements_hint > __old_n)
{
const size_type __n = _M_next_size(__num_elements_hint);
if (__n > __old_n)
{
_Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator());
__try
{
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket)
{
_Node* __first = _M_buckets[__bucket];
while (__first)
{
size_type __new_bucket = _M_bkt_num(__first->_M_val,
__n);
_M_buckets[__bucket] = __first->_M_next;
__first->_M_next = __tmp[__new_bucket];
__tmp[__new_bucket] = __first;
__first = _M_buckets[__bucket];
}
}
_M_buckets.swap(__tmp);
}
__catch(...)
{
for (size_type __bucket = 0; __bucket < __tmp.size();
++__bucket)
{
while (__tmp[__bucket])
{
_Node* __next = __tmp[__bucket]->_M_next;
_M_delete_node(__tmp[__bucket]);
__tmp[__bucket] = __next;
}
}
__throw_exception_again;
}
}
}
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
{
_Node* __cur = _M_buckets[__n];
if (__cur == __first)
_M_erase_bucket(__n, __last);
else
{
_Node* __next;
for (__next = __cur->_M_next;
__next != __first;
__cur = __next, __next = __cur->_M_next)
;
while (__next != __last)
{
__cur->_M_next = __next->_M_next;
_M_delete_node(__next);
__next = __cur->_M_next;
--_M_num_elements;
}
}
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
_M_erase_bucket(const size_type __n, _Node* __last)
{
_Node* __cur = _M_buckets[__n];
while (__cur != __last)
{
_Node* __next = __cur->_M_next;
_M_delete_node(__cur);
__cur = __next;
_M_buckets[__n] = __cur;
--_M_num_elements;
}
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
clear()
{
if (_M_num_elements == 0)
return;
for (size_type __i = 0; __i < _M_buckets.size(); ++__i)
{
_Node* __cur = _M_buckets[__i];
while (__cur != 0)
{
_Node* __next = __cur->_M_next;
_M_delete_node(__cur);
__cur = __next;
}
_M_buckets[__i] = 0;
}
_M_num_elements = 0;
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
_M_copy_from(const hashtable& __ht)
{
_M_buckets.clear();
_M_buckets.reserve(__ht._M_buckets.size());
_M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
__try
{
for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
const _Node* __cur = __ht._M_buckets[__i];
if (__cur)
{
_Node* __local_copy = _M_new_node(__cur->_M_val);
_M_buckets[__i] = __local_copy;
for (_Node* __next = __cur->_M_next;
__next;
__cur = __next, __next = __cur->_M_next)
{
__local_copy->_M_next = _M_new_node(__next->_M_val);
__local_copy = __local_copy->_M_next;
}
}
}
_M_num_elements = __ht._M_num_elements;
}
__catch(...)
{
clear();
__throw_exception_again;
}
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// auto_ptr implementation -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file backward/auto_ptr.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{memory}
*/
#ifndef _BACKWARD_AUTO_PTR_H
#define _BACKWARD_AUTO_PTR_H 1
#include <bits/c++config.h>
#include <debug/debug.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* A wrapper class to provide auto_ptr with reference semantics.
* For example, an auto_ptr can be assigned (or constructed from)
* the result of a function which returns an auto_ptr by value.
*
* All the auto_ptr_ref stuff should happen behind the scenes.
*/
template<typename _Tp1>
struct auto_ptr_ref
{
_Tp1* _M_ptr;
explicit
auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
} _GLIBCXX_DEPRECATED;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/**
* @brief A simple smart pointer providing strict ownership semantics.
*
* The Standard says:
* <pre>
* An @c auto_ptr owns the object it holds a pointer to. Copying
* an @c auto_ptr copies the pointer and transfers ownership to the
* destination. If more than one @c auto_ptr owns the same object
* at the same time the behavior of the program is undefined.
*
* The uses of @c auto_ptr include providing temporary
* exception-safety for dynamically allocated memory, passing
* ownership of dynamically allocated memory to a function, and
* returning dynamically allocated memory from a function. @c
* auto_ptr does not meet the CopyConstructible and Assignable
* requirements for Standard Library <a
* href="tables.html#65">container</a> elements and thus
* instantiating a Standard Library container with an @c auto_ptr
* results in undefined behavior.
* </pre>
* Quoted from [20.4.5]/3.
*
* Good examples of what can and cannot be done with auto_ptr can
* be found in the libstdc++ testsuite.
*
* _GLIBCXX_RESOLVE_LIB_DEFECTS
* 127. auto_ptr<> conversion issues
* These resolutions have all been incorporated.
*/
template<typename _Tp>
class auto_ptr
{
private:
_Tp* _M_ptr;
public:
/// The pointed-to type.
typedef _Tp element_type;
/**
* @brief An %auto_ptr is usually constructed from a raw pointer.
* @param __p A pointer (defaults to NULL).
*
* This object now @e owns the object pointed to by @a __p.
*/
explicit
auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
/**
* @brief An %auto_ptr can be constructed from another %auto_ptr.
* @param __a Another %auto_ptr of the same type.
*
* This object now @e owns the object previously owned by @a __a,
* which has given up ownership.
*/
auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
/**
* @brief An %auto_ptr can be constructed from another %auto_ptr.
* @param __a Another %auto_ptr of a different but related type.
*
* A pointer-to-Tp1 must be convertible to a
* pointer-to-Tp/element_type.
*
* This object now @e owns the object previously owned by @a __a,
* which has given up ownership.
*/
template<typename _Tp1>
auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
/**
* @brief %auto_ptr assignment operator.
* @param __a Another %auto_ptr of the same type.
*
* This object now @e owns the object previously owned by @a __a,
* which has given up ownership. The object that this one @e
* used to own and track has been deleted.
*/
auto_ptr&
operator=(auto_ptr& __a) throw()
{
reset(__a.release());
return *this;
}
/**
* @brief %auto_ptr assignment operator.
* @param __a Another %auto_ptr of a different but related type.
*
* A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.
*
* This object now @e owns the object previously owned by @a __a,
* which has given up ownership. The object that this one @e
* used to own and track has been deleted.
*/
template<typename _Tp1>
auto_ptr&
operator=(auto_ptr<_Tp1>& __a) throw()
{
reset(__a.release());
return *this;
}
/**
* When the %auto_ptr goes out of scope, the object it owns is
* deleted. If it no longer owns anything (i.e., @c get() is
* @c NULL), then this has no effect.
*
* The C++ standard says there is supposed to be an empty throw
* specification here, but omitting it is standard conforming. Its
* presence can be detected only if _Tp::~_Tp() throws, but this is
* prohibited. [17.4.3.6]/2
*/
~auto_ptr() { delete _M_ptr; }
/**
* @brief Smart pointer dereferencing.
*
* If this %auto_ptr no longer owns anything, then this
* operation will crash. (For a smart pointer, <em>no longer owns
* anything</em> is the same as being a null pointer, and you know
* what happens when you dereference one of those...)
*/
element_type&
operator*() const throw()
{
__glibcxx_assert(_M_ptr != 0);
return *_M_ptr;
}
/**
* @brief Smart pointer dereferencing.
*
* This returns the pointer itself, which the language then will
* automatically cause to be dereferenced.
*/
element_type*
operator->() const throw()
{
__glibcxx_assert(_M_ptr != 0);
return _M_ptr;
}
/**
* @brief Bypassing the smart pointer.
* @return The raw pointer being managed.
*
* You can get a copy of the pointer that this object owns, for
* situations such as passing to a function which only accepts
* a raw pointer.
*
* @note This %auto_ptr still owns the memory.
*/
element_type*
get() const throw() { return _M_ptr; }
/**
* @brief Bypassing the smart pointer.
* @return The raw pointer being managed.
*
* You can get a copy of the pointer that this object owns, for
* situations such as passing to a function which only accepts
* a raw pointer.
*
* @note This %auto_ptr no longer owns the memory. When this object
* goes out of scope, nothing will happen.
*/
element_type*
release() throw()
{
element_type* __tmp = _M_ptr;
_M_ptr = 0;
return __tmp;
}
/**
* @brief Forcibly deletes the managed object.
* @param __p A pointer (defaults to NULL).
*
* This object now @e owns the object pointed to by @a __p. The
* previous object has been deleted.
*/
void
reset(element_type* __p = 0) throw()
{
if (__p != _M_ptr)
{
delete _M_ptr;
_M_ptr = __p;
}
}
/**
* @brief Automatic conversions
*
* These operations are supposed to convert an %auto_ptr into and from
* an auto_ptr_ref automatically as needed. This would allow
* constructs such as
* @code
* auto_ptr<Derived> func_returning_auto_ptr(.....);
* ...
* auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
* @endcode
*
* But it doesn't work, and won't be fixed. For further details see
* http://cplusplus.github.io/LWG/lwg-closed.html#463
*/
auto_ptr(auto_ptr_ref<element_type> __ref) throw()
: _M_ptr(__ref._M_ptr) { }
auto_ptr&
operator=(auto_ptr_ref<element_type> __ref) throw()
{
if (__ref._M_ptr != this->get())
{
delete _M_ptr;
_M_ptr = __ref._M_ptr;
}
return *this;
}
template<typename _Tp1>
operator auto_ptr_ref<_Tp1>() throw()
{ return auto_ptr_ref<_Tp1>(this->release()); }
template<typename _Tp1>
operator auto_ptr<_Tp1>() throw()
{ return auto_ptr<_Tp1>(this->release()); }
} _GLIBCXX_DEPRECATED;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 541. shared_ptr template assignment and void
template<>
class auto_ptr<void>
{
public:
typedef void element_type;
} _GLIBCXX_DEPRECATED;
#if __cplusplus >= 201103L
template<_Lock_policy _Lp>
template<typename _Tp>
inline
__shared_count<_Lp>::__shared_count(std::auto_ptr<_Tp>&& __r)
: _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get()))
{ __r.release(); }
template<typename _Tp, _Lock_policy _Lp>
template<typename _Tp1, typename>
inline
__shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r)
: _M_ptr(__r.get()), _M_refcount()
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
static_assert( sizeof(_Tp1) > 0, "incomplete type" );
_Tp1* __tmp = __r.get();
_M_refcount = __shared_count<_Lp>(std::move(__r));
_M_enable_shared_from_this_with(__tmp);
}
template<typename _Tp>
template<typename _Tp1, typename>
inline
shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r)
: __shared_ptr<_Tp>(std::move(__r)) { }
template<typename _Tp, typename _Dp>
template<typename _Up, typename>
inline
unique_ptr<_Tp, _Dp>::unique_ptr(auto_ptr<_Up>&& __u) noexcept
: _M_t(__u.release(), deleter_type()) { }
#endif
#pragma GCC diagnostic pop
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _BACKWARD_AUTO_PTR_H */
// Hashing set implementation -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file backward/hash_set
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _BACKWARD_HASH_SET
#define _BACKWARD_HASH_SET 1
#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
#include "backward_warning.h"
#endif
#include <bits/c++config.h>
#include <backward/hashtable.h>
#include <bits/concept_check.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::equal_to;
using std::allocator;
using std::pair;
using std::_Identity;
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Value, class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_set
{
// concept requirements
__glibcxx_class_requires(_Value, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Alloc::pointer pointer;
typedef typename _Alloc::const_pointer const_pointer;
typedef typename _Alloc::reference reference;
typedef typename _Alloc::const_reference const_reference;
typedef typename _Ht::const_iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_set()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_set(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_set(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_set& __hs)
{ _M_ht.swap(__hs._M_ht); }
template<class _Val, class _HF, class _EqK, class _Al>
friend bool
operator==(const hash_set<_Val, _HF, _EqK, _Al>&,
const hash_set<_Val, _HF, _EqK, _Al>&);
iterator
begin() const
{ return _M_ht.begin(); }
iterator
end() const
{ return _M_ht.end(); }
pair<iterator, bool>
insert(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
return pair<iterator,bool>(__p.first, __p.second);
}
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f, __l); }
pair<iterator, bool>
insert_noresize(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p
= _M_ht.insert_unique_noresize(__obj);
return pair<iterator, bool>(__p.first, __p.second);
}
iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return __hs1._M_ht == __hs2._M_ht; }
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return !(__hs1 == __hs2); }
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void
swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ __hs1.swap(__hs2); }
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Value,
class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_multiset
{
// concept requirements
__glibcxx_class_requires(_Value, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Alloc::pointer pointer;
typedef typename _Alloc::const_pointer const_pointer;
typedef typename _Alloc::reference reference;
typedef typename _Alloc::const_reference const_reference;
typedef typename _Ht::const_iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_multiset()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_multiset(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_multiset(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_multiset& hs)
{ _M_ht.swap(hs._M_ht); }
template<class _Val, class _HF, class _EqK, class _Al>
friend bool
operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&,
const hash_multiset<_Val, _HF, _EqK, _Al>&);
iterator
begin() const
{ return _M_ht.begin(); }
iterator
end() const
{ return _M_ht.end(); }
iterator
insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
iterator
insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{ return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return __hs1._M_ht == __hs2._M_ht; }
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return !(__hs1 == __hs2); }
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void
swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ __hs1.swap(__hs2); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Specialization of insert_iterator so that it will work for hash_set
// and hash_multiset.
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>
_Container;
_Container* container;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>
_Container;
_Container* container;
typename _Container::iterator iter;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int) { return *this; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Functor implementations -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996-1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file backward/binders.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{functional}
*/
#ifndef _BACKWARD_BINDERS_H
#define _BACKWARD_BINDERS_H 1
// Suppress deprecated warning for this file.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// 20.3.6 binders
/** @defgroup binders Binder Classes
* @ingroup functors
*
* Binders turn functions/functors with two arguments into functors
* with a single argument, storing an argument to be applied later.
* For example, a variable @c B of type @c binder1st is constructed
* from a functor @c f and an argument @c x. Later, B's @c
* operator() is called with a single argument @c y. The return
* value is the value of @c f(x,y). @c B can be @a called with
* various arguments (y1, y2, ...) and will in turn call @c
* f(x,y1), @c f(x,y2), ...
*
* The function @c bind1st is provided to save some typing. It takes the
* function and an argument as parameters, and returns an instance of
* @c binder1st.
*
* The type @c binder2nd and its creator function @c bind2nd do the same
* thing, but the stored argument is passed as the second parameter instead
* of the first, e.g., @c bind2nd(std::minus<float>(),1.3) will create a
* functor whose @c operator() accepts a floating-point number, subtracts
* 1.3 from it, and returns the result. (If @c bind1st had been used,
* the functor would perform <em>1.3 - x</em> instead.
*
* Creator-wrapper functions like @c bind1st are intended to be used in
* calling algorithms. Their return values will be temporary objects.
* (The goal is to not require you to type names like
* @c std::binder1st<std::plus<int>> for declaring a variable to hold the
* return value from @c bind1st(std::plus<int>(),5).
*
* These become more useful when combined with the composition functions.
*
* These functions are deprecated in C++11 and can be replaced by
* @c std::bind (or @c std::tr1::bind) which is more powerful and flexible,
* supporting functions with any number of arguments. Uses of @c bind1st
* can be replaced by @c std::bind(f, x, std::placeholders::_1) and
* @c bind2nd by @c std::bind(f, std::placeholders::_1, x).
* @{
*/
/// One of the @link binders binder functors@endlink.
template<typename _Operation>
class binder1st
: public unary_function<typename _Operation::second_argument_type,
typename _Operation::result_type>
{
protected:
_Operation op;
typename _Operation::first_argument_type value;
public:
binder1st(const _Operation& __x,
const typename _Operation::first_argument_type& __y)
: op(__x), value(__y) { }
typename _Operation::result_type
operator()(const typename _Operation::second_argument_type& __x) const
{ return op(value, __x); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 109. Missing binders for non-const sequence elements
typename _Operation::result_type
operator()(typename _Operation::second_argument_type& __x) const
{ return op(value, __x); }
} _GLIBCXX_DEPRECATED;
/// One of the @link binders binder functors@endlink.
template<typename _Operation, typename _Tp>
inline binder1st<_Operation>
bind1st(const _Operation& __fn, const _Tp& __x)
{
typedef typename _Operation::first_argument_type _Arg1_type;
return binder1st<_Operation>(__fn, _Arg1_type(__x));
}
/// One of the @link binders binder functors@endlink.
template<typename _Operation>
class binder2nd
: public unary_function<typename _Operation::first_argument_type,
typename _Operation::result_type>
{
protected:
_Operation op;
typename _Operation::second_argument_type value;
public:
binder2nd(const _Operation& __x,
const typename _Operation::second_argument_type& __y)
: op(__x), value(__y) { }
typename _Operation::result_type
operator()(const typename _Operation::first_argument_type& __x) const
{ return op(__x, value); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 109. Missing binders for non-const sequence elements
typename _Operation::result_type
operator()(typename _Operation::first_argument_type& __x) const
{ return op(__x, value); }
} _GLIBCXX_DEPRECATED;
/// One of the @link binders binder functors@endlink.
template<typename _Operation, typename _Tp>
inline binder2nd<_Operation>
bind2nd(const _Operation& __fn, const _Tp& __x)
{
typedef typename _Operation::second_argument_type _Arg2_type;
return binder2nd<_Operation>(__fn, _Arg2_type(__x));
}
/** @} */
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#pragma GCC diagnostic pop
#endif /* _BACKWARD_BINDERS_H */
// Hashing map implementation -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file backward/hash_map
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _BACKWARD_HASH_MAP
#define _BACKWARD_HASH_MAP 1
#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
#include "backward_warning.h"
#endif
#include <bits/c++config.h>
#include <backward/hashtable.h>
#include <bits/concept_check.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::equal_to;
using std::allocator;
using std::pair;
using std::_Select1st;
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Key, class _Tp, class _HashFn = hash<_Key>,
class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> >
class hash_map
{
private:
typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,
_Select1st<pair<const _Key, _Tp> >,
_EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef _Tp data_type;
typedef _Tp mapped_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Ht::pointer pointer;
typedef typename _Ht::const_pointer const_pointer;
typedef typename _Ht::reference reference;
typedef typename _Ht::const_reference const_reference;
typedef typename _Ht::iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_map()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_map(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_map(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_map& __hs)
{ _M_ht.swap(__hs._M_ht); }
template<class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool
operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
iterator
begin()
{ return _M_ht.begin(); }
iterator
end()
{ return _M_ht.end(); }
const_iterator
begin() const
{ return _M_ht.begin(); }
const_iterator
end() const
{ return _M_ht.end(); }
pair<iterator, bool>
insert(const value_type& __obj)
{ return _M_ht.insert_unique(__obj); }
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f, __l); }
pair<iterator, bool>
insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); }
iterator
find(const key_type& __key)
{ return _M_ht.find(__key); }
const_iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
_Tp&
operator[](const key_type& __key)
{ return _M_ht.find_or_insert(value_type(__key, _Tp())).second; }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline bool
operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ return __hm1._M_ht == __hm2._M_ht; }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline bool
operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ return !(__hm1 == __hm2); }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline void
swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Key, class _Tp,
class _HashFn = hash<_Key>,
class _EqualKey = equal_to<_Key>,
class _Alloc = allocator<_Tp> >
class hash_multimap
{
// concept requirements
__glibcxx_class_requires(_Key, _SGIAssignableConcept)
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)
private:
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,
_Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
_Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef _Tp data_type;
typedef _Tp mapped_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Ht::pointer pointer;
typedef typename _Ht::const_pointer const_pointer;
typedef typename _Ht::reference reference;
typedef typename _Ht::const_reference const_reference;
typedef typename _Ht::iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_multimap()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_multimap(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_multimap(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_multimap& __hs)
{ _M_ht.swap(__hs._M_ht); }
template<class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool
operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
iterator
begin()
{ return _M_ht.begin(); }
iterator
end()
{ return _M_ht.end(); }
const_iterator
begin() const
{ return _M_ht.begin(); }
const_iterator
end() const
{ return _M_ht.end(); }
iterator
insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
iterator
insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
iterator
find(const key_type& __key)
{ return _M_ht.find(__key); }
const_iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{ return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
{ return __hm1._M_ht == __hm2._M_ht; }
template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
{ return !(__hm1 == __hm2); }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline void
swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Specialization of insert_iterator so that it will work for hash_map
// and hash_multimap.
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>
_Container;
_Container* container;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++() { return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
_Container;
_Container* container;
typename _Container::iterator iter;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// 'struct hash' from SGI -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996-1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file backward/hash_fun.h
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _BACKWARD_HASH_FUN_H
#define _BACKWARD_HASH_FUN_H 1
#include <bits/c++config.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
template<class _Key>
struct hash { };
inline size_t
__stl_hash_string(const char* __s)
{
unsigned long __h = 0;
for ( ; *__s; ++__s)
__h = 5 * __h + *__s;
return size_t(__h);
}
template<>
struct hash<char*>
{
size_t
operator()(const char* __s) const
{ return __stl_hash_string(__s); }
};
template<>
struct hash<const char*>
{
size_t
operator()(const char* __s) const
{ return __stl_hash_string(__s); }
};
template<>
struct hash<char>
{
size_t
operator()(char __x) const
{ return __x; }
};
template<>
struct hash<unsigned char>
{
size_t
operator()(unsigned char __x) const
{ return __x; }
};
template<>
struct hash<signed char>
{
size_t
operator()(unsigned char __x) const
{ return __x; }
};
template<>
struct hash<short>
{
size_t
operator()(short __x) const
{ return __x; }
};
template<>
struct hash<unsigned short>
{
size_t
operator()(unsigned short __x) const
{ return __x; }
};
template<>
struct hash<int>
{
size_t
operator()(int __x) const
{ return __x; }
};
template<>
struct hash<unsigned int>
{
size_t
operator()(unsigned int __x) const
{ return __x; }
};
template<>
struct hash<long>
{
size_t
operator()(long __x) const
{ return __x; }
};
template<>
struct hash<unsigned long>
{
size_t
operator()(unsigned long __x) const
{ return __x; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Backward-compat support -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
// WARNING: The classes defined in this header are DEPRECATED. This
// header is defined in section D.7.1 of the C++ standard, and it
// MAY BE REMOVED in a future standard revision. One should use the
// header <sstream> instead.
/** @file strstream
* This is a Standard C++ Library header.
*/
#ifndef _BACKWARD_STRSTREAM
#define _BACKWARD_STRSTREAM
#include "backward_warning.h"
#include <iosfwd>
#include <ios>
#include <istream>
#include <ostream>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Class strstreambuf, a streambuf class that manages an array of char.
// Note that this class is not a template.
class strstreambuf : public basic_streambuf<char, char_traits<char> >
{
public:
// Types.
typedef char_traits<char> _Traits;
typedef basic_streambuf<char, _Traits> _Base;
public:
// Constructor, destructor
explicit strstreambuf(streamsize __initial_capacity = 0);
strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
strstreambuf(char* __get, streamsize __n, char* __put = 0) throw ();
strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
strstreambuf(const char* __get, streamsize __n) throw ();
strstreambuf(const signed char* __get, streamsize __n) throw ();
strstreambuf(const unsigned char* __get, streamsize __n) throw ();
virtual ~strstreambuf();
public:
void freeze(bool = true) throw ();
char* str() throw ();
_GLIBCXX_PURE int pcount() const throw ();
protected:
virtual int_type overflow(int_type __c = _Traits::eof());
virtual int_type pbackfail(int_type __c = _Traits::eof());
virtual int_type underflow();
virtual _Base* setbuf(char* __buf, streamsize __n);
virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
ios_base::openmode __mode
= ios_base::in | ios_base::out);
virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
= ios_base::in | ios_base::out);
private:
strstreambuf&
operator=(const strstreambuf&);
strstreambuf(const strstreambuf&);
// Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
char* _M_alloc(size_t);
void _M_free(char*);
// Helper function used in constructors.
void _M_setup(char* __get, char* __put, streamsize __n) throw ();
private:
// Data members.
void* (*_M_alloc_fun)(size_t);
void (*_M_free_fun)(void*);
bool _M_dynamic : 1;
bool _M_frozen : 1;
bool _M_constant : 1;
};
// Class istrstream, an istream that manages a strstreambuf.
class istrstream : public basic_istream<char>
{
public:
explicit istrstream(char*);
explicit istrstream(const char*);
istrstream(char* , streamsize);
istrstream(const char*, streamsize);
virtual ~istrstream();
_GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
char* str() throw ();
private:
strstreambuf _M_buf;
};
// Class ostrstream
class ostrstream : public basic_ostream<char>
{
public:
ostrstream();
ostrstream(char*, int, ios_base::openmode = ios_base::out);
virtual ~ostrstream();
_GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
void freeze(bool = true) throw();
char* str() throw ();
_GLIBCXX_PURE int pcount() const throw ();
private:
strstreambuf _M_buf;
};
// Class strstream
class strstream : public basic_iostream<char>
{
public:
typedef char char_type;
typedef char_traits<char>::int_type int_type;
typedef char_traits<char>::pos_type pos_type;
typedef char_traits<char>::off_type off_type;
strstream();
strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
virtual ~strstream();
_GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
void freeze(bool = true) throw ();
_GLIBCXX_PURE int pcount() const throw ();
char* str() throw ();
private:
strstreambuf _M_buf;
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file backward/backward_warning.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{iosfwd}
*/
#ifndef _BACKWARD_BACKWARD_WARNING_H
#define _BACKWARD_BACKWARD_WARNING_H 1
#ifdef __DEPRECATED
#warning \
This file includes at least one deprecated or antiquated header which \
may be removed without further notice at a future date. Please use a \
non-deprecated interface with equivalent functionality instead. For a \
listing of replacement headers and interfaces, consult the file \
backward_warning.h. To disable this warning use -Wno-deprecated.
/*
A list of valid replacements is as follows:
Use: Instead of:
<sstream>, basic_stringbuf <strstream>, strstreambuf
<sstream>, basic_istringstream <strstream>, istrstream
<sstream>, basic_ostringstream <strstream>, ostrstream
<sstream>, basic_stringstream <strstream>, strstream
<unordered_set>, unordered_set <ext/hash_set>, hash_set
<unordered_set>, unordered_multiset <ext/hash_set>, hash_multiset
<unordered_map>, unordered_map <ext/hash_map>, hash_map
<unordered_map>, unordered_multimap <ext/hash_map>, hash_multimap
<functional>, bind <functional>, binder1st
<functional>, bind <functional>, binder2nd
<functional>, bind <functional>, bind1st
<functional>, bind <functional>, bind2nd
<memory>, unique_ptr <memory>, auto_ptr
*/
#endif
#endif
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/riemann_zeta.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) Handbook of Mathematical Functions,
// Ed. by Milton Abramowitz and Irene A. Stegun,
// Dover Publications, New-York, Section 5, pp. 807-808.
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Gamma, Exploring Euler's Constant, Julian Havil,
// Princeton, 2003.
#ifndef _GLIBCXX_TR1_RIEMANN_ZETA_TCC
#define _GLIBCXX_TR1_RIEMANN_ZETA_TCC 1
#include "special_function_util.h"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief Compute the Riemann zeta function @f$ \zeta(s) @f$
* by summation for s > 1.
*
* The Riemann zeta function is defined by:
* \f[
* \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
* \f]
* For s < 1 use the reflection formula:
* \f[
* \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
* \f]
*/
template<typename _Tp>
_Tp
__riemann_zeta_sum(_Tp __s)
{
// A user shouldn't get to this.
if (__s < _Tp(1))
std::__throw_domain_error(__N("Bad argument in zeta sum."));
const unsigned int max_iter = 10000;
_Tp __zeta = _Tp(0);
for (unsigned int __k = 1; __k < max_iter; ++__k)
{
_Tp __term = std::pow(static_cast<_Tp>(__k), -__s);
if (__term < std::numeric_limits<_Tp>::epsilon())
{
break;
}
__zeta += __term;
}
return __zeta;
}
/**
* @brief Evaluate the Riemann zeta function @f$ \zeta(s) @f$
* by an alternate series for s > 0.
*
* The Riemann zeta function is defined by:
* \f[
* \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
* \f]
* For s < 1 use the reflection formula:
* \f[
* \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
* \f]
*/
template<typename _Tp>
_Tp
__riemann_zeta_alt(_Tp __s)
{
_Tp __sgn = _Tp(1);
_Tp __zeta = _Tp(0);
for (unsigned int __i = 1; __i < 10000000; ++__i)
{
_Tp __term = __sgn / std::pow(__i, __s);
if (std::abs(__term) < std::numeric_limits<_Tp>::epsilon())
break;
__zeta += __term;
__sgn *= _Tp(-1);
}
__zeta /= _Tp(1) - std::pow(_Tp(2), _Tp(1) - __s);
return __zeta;
}
/**
* @brief Evaluate the Riemann zeta function by series for all s != 1.
* Convergence is great until largish negative numbers.
* Then the convergence of the > 0 sum gets better.
*
* The series is:
* \f[
* \zeta(s) = \frac{1}{1-2^{1-s}}
* \sum_{n=0}^{\infty} \frac{1}{2^{n+1}}
* \sum_{k=0}^{n} (-1)^k \frac{n!}{(n-k)!k!} (k+1)^{-s}
* \f]
* Havil 2003, p. 206.
*
* The Riemann zeta function is defined by:
* \f[
* \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
* \f]
* For s < 1 use the reflection formula:
* \f[
* \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
* \f]
*/
template<typename _Tp>
_Tp
__riemann_zeta_glob(_Tp __s)
{
_Tp __zeta = _Tp(0);
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
// Max e exponent before overflow.
const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10
* std::log(_Tp(10)) - _Tp(1);
// This series works until the binomial coefficient blows up
// so use reflection.
if (__s < _Tp(0))
{
#if _GLIBCXX_USE_C99_MATH_TR1
if (_GLIBCXX_MATH_NS::fmod(__s,_Tp(2)) == _Tp(0))
return _Tp(0);
else
#endif
{
_Tp __zeta = __riemann_zeta_glob(_Tp(1) - __s);
__zeta *= std::pow(_Tp(2)
* __numeric_constants<_Tp>::__pi(), __s)
* std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
#if _GLIBCXX_USE_C99_MATH_TR1
* std::exp(_GLIBCXX_MATH_NS::lgamma(_Tp(1) - __s))
#else
* std::exp(__log_gamma(_Tp(1) - __s))
#endif
/ __numeric_constants<_Tp>::__pi();
return __zeta;
}
}
_Tp __num = _Tp(0.5L);
const unsigned int __maxit = 10000;
for (unsigned int __i = 0; __i < __maxit; ++__i)
{
bool __punt = false;
_Tp __sgn = _Tp(1);
_Tp __term = _Tp(0);
for (unsigned int __j = 0; __j <= __i; ++__j)
{
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __bincoeff = _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __j))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i - __j));
#else
_Tp __bincoeff = __log_gamma(_Tp(1 + __i))
- __log_gamma(_Tp(1 + __j))
- __log_gamma(_Tp(1 + __i - __j));
#endif
if (__bincoeff > __max_bincoeff)
{
// This only gets hit for x << 0.
__punt = true;
break;
}
__bincoeff = std::exp(__bincoeff);
__term += __sgn * __bincoeff * std::pow(_Tp(1 + __j), -__s);
__sgn *= _Tp(-1);
}
if (__punt)
break;
__term *= __num;
__zeta += __term;
if (std::abs(__term/__zeta) < __eps)
break;
__num *= _Tp(0.5L);
}
__zeta /= _Tp(1) - std::pow(_Tp(2), _Tp(1) - __s);
return __zeta;
}
/**
* @brief Compute the Riemann zeta function @f$ \zeta(s) @f$
* using the product over prime factors.
* \f[
* \zeta(s) = \Pi_{i=1}^\infty \frac{1}{1 - p_i^{-s}}
* \f]
* where @f$ {p_i} @f$ are the prime numbers.
*
* The Riemann zeta function is defined by:
* \f[
* \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
* \f]
* For s < 1 use the reflection formula:
* \f[
* \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
* \f]
*/
template<typename _Tp>
_Tp
__riemann_zeta_product(_Tp __s)
{
static const _Tp __prime[] = {
_Tp(2), _Tp(3), _Tp(5), _Tp(7), _Tp(11), _Tp(13), _Tp(17), _Tp(19),
_Tp(23), _Tp(29), _Tp(31), _Tp(37), _Tp(41), _Tp(43), _Tp(47),
_Tp(53), _Tp(59), _Tp(61), _Tp(67), _Tp(71), _Tp(73), _Tp(79),
_Tp(83), _Tp(89), _Tp(97), _Tp(101), _Tp(103), _Tp(107), _Tp(109)
};
static const unsigned int __num_primes = sizeof(__prime) / sizeof(_Tp);
_Tp __zeta = _Tp(1);
for (unsigned int __i = 0; __i < __num_primes; ++__i)
{
const _Tp __fact = _Tp(1) - std::pow(__prime[__i], -__s);
__zeta *= __fact;
if (_Tp(1) - __fact < std::numeric_limits<_Tp>::epsilon())
break;
}
__zeta = _Tp(1) / __zeta;
return __zeta;
}
/**
* @brief Return the Riemann zeta function @f$ \zeta(s) @f$.
*
* The Riemann zeta function is defined by:
* \f[
* \zeta(s) = \sum_{k=1}^{\infty} k^{-s} for s > 1
* \frac{(2\pi)^s}{pi} sin(\frac{\pi s}{2})
* \Gamma (1 - s) \zeta (1 - s) for s < 1
* \f]
* For s < 1 use the reflection formula:
* \f[
* \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
* \f]
*/
template<typename _Tp>
_Tp
__riemann_zeta(_Tp __s)
{
if (__isnan(__s))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__s == _Tp(1))
return std::numeric_limits<_Tp>::infinity();
else if (__s < -_Tp(19))
{
_Tp __zeta = __riemann_zeta_product(_Tp(1) - __s);
__zeta *= std::pow(_Tp(2) * __numeric_constants<_Tp>::__pi(), __s)
* std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
#if _GLIBCXX_USE_C99_MATH_TR1
* std::exp(_GLIBCXX_MATH_NS::lgamma(_Tp(1) - __s))
#else
* std::exp(__log_gamma(_Tp(1) - __s))
#endif
/ __numeric_constants<_Tp>::__pi();
return __zeta;
}
else if (__s < _Tp(20))
{
// Global double sum or McLaurin?
bool __glob = true;
if (__glob)
return __riemann_zeta_glob(__s);
else
{
if (__s > _Tp(1))
return __riemann_zeta_sum(__s);
else
{
_Tp __zeta = std::pow(_Tp(2)
* __numeric_constants<_Tp>::__pi(), __s)
* std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
#if _GLIBCXX_USE_C99_MATH_TR1
* _GLIBCXX_MATH_NS::tgamma(_Tp(1) - __s)
#else
* std::exp(__log_gamma(_Tp(1) - __s))
#endif
* __riemann_zeta_sum(_Tp(1) - __s);
return __zeta;
}
}
}
else
return __riemann_zeta_product(__s);
}
/**
* @brief Return the Hurwitz zeta function @f$ \zeta(x,s) @f$
* for all s != 1 and x > -1.
*
* The Hurwitz zeta function is defined by:
* @f[
* \zeta(x,s) = \sum_{n=0}^{\infty} \frac{1}{(n + x)^s}
* @f]
* The Riemann zeta function is a special case:
* @f[
* \zeta(s) = \zeta(1,s)
* @f]
*
* This functions uses the double sum that converges for s != 1
* and x > -1:
* @f[
* \zeta(x,s) = \frac{1}{s-1}
* \sum_{n=0}^{\infty} \frac{1}{n + 1}
* \sum_{k=0}^{n} (-1)^k \frac{n!}{(n-k)!k!} (x+k)^{-s}
* @f]
*/
template<typename _Tp>
_Tp
__hurwitz_zeta_glob(_Tp __a, _Tp __s)
{
_Tp __zeta = _Tp(0);
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
// Max e exponent before overflow.
const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10
* std::log(_Tp(10)) - _Tp(1);
const unsigned int __maxit = 10000;
for (unsigned int __i = 0; __i < __maxit; ++__i)
{
bool __punt = false;
_Tp __sgn = _Tp(1);
_Tp __term = _Tp(0);
for (unsigned int __j = 0; __j <= __i; ++__j)
{
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __bincoeff = _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __j))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __i - __j));
#else
_Tp __bincoeff = __log_gamma(_Tp(1 + __i))
- __log_gamma(_Tp(1 + __j))
- __log_gamma(_Tp(1 + __i - __j));
#endif
if (__bincoeff > __max_bincoeff)
{
// This only gets hit for x << 0.
__punt = true;
break;
}
__bincoeff = std::exp(__bincoeff);
__term += __sgn * __bincoeff * std::pow(_Tp(__a + __j), -__s);
__sgn *= _Tp(-1);
}
if (__punt)
break;
__term /= _Tp(__i + 1);
if (std::abs(__term / __zeta) < __eps)
break;
__zeta += __term;
}
__zeta /= __s - _Tp(1);
return __zeta;
}
/**
* @brief Return the Hurwitz zeta function @f$ \zeta(x,s) @f$
* for all s != 1 and x > -1.
*
* The Hurwitz zeta function is defined by:
* @f[
* \zeta(x,s) = \sum_{n=0}^{\infty} \frac{1}{(n + x)^s}
* @f]
* The Riemann zeta function is a special case:
* @f[
* \zeta(s) = \zeta(1,s)
* @f]
*/
template<typename _Tp>
inline _Tp
__hurwitz_zeta(_Tp __a, _Tp __s)
{ return __hurwitz_zeta_glob(__a, __s); }
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_RIEMANN_ZETA_TCC
// TR1 ctgmath -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/ctgmath
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CTGMATH
#define _GLIBCXX_TR1_CTGMATH 1
#include <tr1/cmath>
#endif // _GLIBCXX_TR1_CTGMATH
// TR1 float.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/float.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_FLOAT_H
#define _TR1_FLOAT_H 1
#include <tr1/cfloat>
#endif
// TR1 complex -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/complex
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_COMPLEX
#define _GLIBCXX_TR1_COMPLEX 1
#pragma GCC system_header
#include <complex>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/**
* @addtogroup complex_numbers
* @{
*/
#if __cplusplus >= 201103L
using std::acos;
using std::asin;
using std::atan;
using std::acosh;
using std::asinh;
using std::atanh;
#else
template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);
template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);
#endif
// The std::fabs return type in C++11 mode is different (just _Tp).
template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&);
#if __cplusplus < 201103L
template<typename _Tp>
inline std::complex<_Tp>
__complex_acos(const std::complex<_Tp>& __z)
{
const std::complex<_Tp> __t = std::tr1::asin(__z);
const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acos(__complex__ float __z)
{ return __builtin_cacosf(__z); }
inline __complex__ double
__complex_acos(__complex__ double __z)
{ return __builtin_cacos(__z); }
inline __complex__ long double
__complex_acos(const __complex__ long double& __z)
{ return __builtin_cacosl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
acos(const std::complex<_Tp>& __z)
{ return __complex_acos(__z.__rep()); }
#else
/// acos(__z) [8.1.2].
// Effects: Behaves the same as C99 function cacos, defined
// in subclause 7.3.5.1.
template<typename _Tp>
inline std::complex<_Tp>
acos(const std::complex<_Tp>& __z)
{ return __complex_acos(__z); }
#endif
template<typename _Tp>
inline std::complex<_Tp>
__complex_asin(const std::complex<_Tp>& __z)
{
std::complex<_Tp> __t(-__z.imag(), __z.real());
__t = std::tr1::asinh(__t);
return std::complex<_Tp>(__t.imag(), -__t.real());
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_asin(__complex__ float __z)
{ return __builtin_casinf(__z); }
inline __complex__ double
__complex_asin(__complex__ double __z)
{ return __builtin_casin(__z); }
inline __complex__ long double
__complex_asin(const __complex__ long double& __z)
{ return __builtin_casinl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
asin(const std::complex<_Tp>& __z)
{ return __complex_asin(__z.__rep()); }
#else
/// asin(__z) [8.1.3].
// Effects: Behaves the same as C99 function casin, defined
// in subclause 7.3.5.2.
template<typename _Tp>
inline std::complex<_Tp>
asin(const std::complex<_Tp>& __z)
{ return __complex_asin(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_atan(const std::complex<_Tp>& __z)
{
const _Tp __r2 = __z.real() * __z.real();
const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
_Tp __num = __z.imag() + _Tp(1.0);
_Tp __den = __z.imag() - _Tp(1.0);
__num = __r2 + __num * __num;
__den = __r2 + __den * __den;
return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),
_Tp(0.25) * log(__num / __den));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_atan(__complex__ float __z)
{ return __builtin_catanf(__z); }
inline __complex__ double
__complex_atan(__complex__ double __z)
{ return __builtin_catan(__z); }
inline __complex__ long double
__complex_atan(const __complex__ long double& __z)
{ return __builtin_catanl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
atan(const std::complex<_Tp>& __z)
{ return __complex_atan(__z.__rep()); }
#else
/// atan(__z) [8.1.4].
// Effects: Behaves the same as C99 function catan, defined
// in subclause 7.3.5.3.
template<typename _Tp>
inline std::complex<_Tp>
atan(const std::complex<_Tp>& __z)
{ return __complex_atan(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_acosh(const std::complex<_Tp>& __z)
{
// Kahan's formula.
return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0)))
+ std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acosh(__complex__ float __z)
{ return __builtin_cacoshf(__z); }
inline __complex__ double
__complex_acosh(__complex__ double __z)
{ return __builtin_cacosh(__z); }
inline __complex__ long double
__complex_acosh(const __complex__ long double& __z)
{ return __builtin_cacoshl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
acosh(const std::complex<_Tp>& __z)
{ return __complex_acosh(__z.__rep()); }
#else
/// acosh(__z) [8.1.5].
// Effects: Behaves the same as C99 function cacosh, defined
// in subclause 7.3.6.1.
template<typename _Tp>
inline std::complex<_Tp>
acosh(const std::complex<_Tp>& __z)
{ return __complex_acosh(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_asinh(const std::complex<_Tp>& __z)
{
std::complex<_Tp> __t((__z.real() - __z.imag())
* (__z.real() + __z.imag()) + _Tp(1.0),
_Tp(2.0) * __z.real() * __z.imag());
__t = std::sqrt(__t);
return std::log(__t + __z);
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_asinh(__complex__ float __z)
{ return __builtin_casinhf(__z); }
inline __complex__ double
__complex_asinh(__complex__ double __z)
{ return __builtin_casinh(__z); }
inline __complex__ long double
__complex_asinh(const __complex__ long double& __z)
{ return __builtin_casinhl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
asinh(const std::complex<_Tp>& __z)
{ return __complex_asinh(__z.__rep()); }
#else
/// asinh(__z) [8.1.6].
// Effects: Behaves the same as C99 function casin, defined
// in subclause 7.3.6.2.
template<typename _Tp>
inline std::complex<_Tp>
asinh(const std::complex<_Tp>& __z)
{ return __complex_asinh(__z); }
#endif
template<typename _Tp>
std::complex<_Tp>
__complex_atanh(const std::complex<_Tp>& __z)
{
const _Tp __i2 = __z.imag() * __z.imag();
const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
_Tp __num = _Tp(1.0) + __z.real();
_Tp __den = _Tp(1.0) - __z.real();
__num = __i2 + __num * __num;
__den = __i2 + __den * __den;
return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),
_Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_atanh(__complex__ float __z)
{ return __builtin_catanhf(__z); }
inline __complex__ double
__complex_atanh(__complex__ double __z)
{ return __builtin_catanh(__z); }
inline __complex__ long double
__complex_atanh(const __complex__ long double& __z)
{ return __builtin_catanhl(__z); }
template<typename _Tp>
inline std::complex<_Tp>
atanh(const std::complex<_Tp>& __z)
{ return __complex_atanh(__z.__rep()); }
#else
/// atanh(__z) [8.1.7].
// Effects: Behaves the same as C99 function catanh, defined
// in subclause 7.3.6.3.
template<typename _Tp>
inline std::complex<_Tp>
atanh(const std::complex<_Tp>& __z)
{ return __complex_atanh(__z); }
#endif
#endif // C++11
template<typename _Tp>
inline std::complex<_Tp>
/// fabs(__z) [8.1.8].
// Effects: Behaves the same as C99 function cabs, defined
// in subclause 7.3.8.1.
fabs(const std::complex<_Tp>& __z)
{ return std::abs(__z); }
/// Additional overloads [8.1.9].
#if __cplusplus < 201103L
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
arg(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
: __type();
#else
return std::arg(std::complex<__type>(__x));
#endif
}
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
imag(_Tp)
{ return _Tp(); }
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
norm(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __type(__x) * __type(__x);
}
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
real(_Tp __x)
{ return __x; }
#endif
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
pow(const std::complex<_Tp>& __x, const _Up& __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(std::complex<__type>(__x), __type(__y));
}
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
pow(const _Tp& __x, const std::complex<_Up>& __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(__type(__x), std::complex<__type>(__y));
}
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(std::complex<__type>(__x),
std::complex<__type>(__y));
}
using std::arg;
template<typename _Tp>
inline std::complex<_Tp>
conj(const std::complex<_Tp>& __z)
{ return std::conj(__z); }
template<typename _Tp>
inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
conj(_Tp __x)
{ return __x; }
using std::imag;
using std::norm;
using std::polar;
template<typename _Tp, typename _Up>
inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
polar(const _Tp& __rho, const _Up& __theta)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::polar(__type(__rho), __type(__theta));
}
using std::real;
template<typename _Tp>
inline std::complex<_Tp>
pow(const std::complex<_Tp>& __x, const _Tp& __y)
{ return std::pow(__x, __y); }
template<typename _Tp>
inline std::complex<_Tp>
pow(const _Tp& __x, const std::complex<_Tp>& __y)
{ return std::pow(__x, __y); }
template<typename _Tp>
inline std::complex<_Tp>
pow(const std::complex<_Tp>& __x, const std::complex<_Tp>& __y)
{ return std::pow(__x, __y); }
// @} group complex_numbers
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_COMPLEX
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/ell_integral.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) B. C. Carlson Numer. Math. 33, 1 (1979)
// (2) B. C. Carlson, Special Functions of Applied Mathematics (1977)
// (3) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (4) Numerical Recipes in C, 2nd ed, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press
// (1992), pp. 261-269
#ifndef _GLIBCXX_TR1_ELL_INTEGRAL_TCC
#define _GLIBCXX_TR1_ELL_INTEGRAL_TCC 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief Return the Carlson elliptic function @f$ R_F(x,y,z) @f$
* of the first kind.
*
* The Carlson elliptic function of the first kind is defined by:
* @f[
* R_F(x,y,z) = \frac{1}{2} \int_0^\infty
* \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{1/2}}
* @f]
*
* @param __x The first of three symmetric arguments.
* @param __y The second of three symmetric arguments.
* @param __z The third of three symmetric arguments.
* @return The Carlson elliptic function of the first kind.
*/
template<typename _Tp>
_Tp
__ellint_rf(_Tp __x, _Tp __y, _Tp __z)
{
const _Tp __min = std::numeric_limits<_Tp>::min();
const _Tp __max = std::numeric_limits<_Tp>::max();
const _Tp __lolim = _Tp(5) * __min;
const _Tp __uplim = __max / _Tp(5);
if (__x < _Tp(0) || __y < _Tp(0) || __z < _Tp(0))
std::__throw_domain_error(__N("Argument less than zero "
"in __ellint_rf."));
else if (__x + __y < __lolim || __x + __z < __lolim
|| __y + __z < __lolim)
std::__throw_domain_error(__N("Argument too small in __ellint_rf"));
else
{
const _Tp __c0 = _Tp(1) / _Tp(4);
const _Tp __c1 = _Tp(1) / _Tp(24);
const _Tp __c2 = _Tp(1) / _Tp(10);
const _Tp __c3 = _Tp(3) / _Tp(44);
const _Tp __c4 = _Tp(1) / _Tp(14);
_Tp __xn = __x;
_Tp __yn = __y;
_Tp __zn = __z;
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __errtol = std::pow(__eps, _Tp(1) / _Tp(6));
_Tp __mu;
_Tp __xndev, __yndev, __zndev;
const unsigned int __max_iter = 100;
for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
{
__mu = (__xn + __yn + __zn) / _Tp(3);
__xndev = 2 - (__mu + __xn) / __mu;
__yndev = 2 - (__mu + __yn) / __mu;
__zndev = 2 - (__mu + __zn) / __mu;
_Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev));
__epsilon = std::max(__epsilon, std::abs(__zndev));
if (__epsilon < __errtol)
break;
const _Tp __xnroot = std::sqrt(__xn);
const _Tp __ynroot = std::sqrt(__yn);
const _Tp __znroot = std::sqrt(__zn);
const _Tp __lambda = __xnroot * (__ynroot + __znroot)
+ __ynroot * __znroot;
__xn = __c0 * (__xn + __lambda);
__yn = __c0 * (__yn + __lambda);
__zn = __c0 * (__zn + __lambda);
}
const _Tp __e2 = __xndev * __yndev - __zndev * __zndev;
const _Tp __e3 = __xndev * __yndev * __zndev;
const _Tp __s = _Tp(1) + (__c1 * __e2 - __c2 - __c3 * __e3) * __e2
+ __c4 * __e3;
return __s / std::sqrt(__mu);
}
}
/**
* @brief Return the complete elliptic integral of the first kind
* @f$ K(k) @f$ by series expansion.
*
* The complete elliptic integral of the first kind is defined as
* @f[
* K(k) = F(k,\pi/2) = \int_0^{\pi/2}\frac{d\theta}
* {\sqrt{1 - k^2sin^2\theta}}
* @f]
*
* This routine is not bad as long as |k| is somewhat smaller than 1
* but is not is good as the Carlson elliptic integral formulation.
*
* @param __k The argument of the complete elliptic function.
* @return The complete elliptic function of the first kind.
*/
template<typename _Tp>
_Tp
__comp_ellint_1_series(_Tp __k)
{
const _Tp __kk = __k * __k;
_Tp __term = __kk / _Tp(4);
_Tp __sum = _Tp(1) + __term;
const unsigned int __max_iter = 1000;
for (unsigned int __i = 2; __i < __max_iter; ++__i)
{
__term *= (2 * __i - 1) * __kk / (2 * __i);
if (__term < std::numeric_limits<_Tp>::epsilon())
break;
__sum += __term;
}
return __numeric_constants<_Tp>::__pi_2() * __sum;
}
/**
* @brief Return the complete elliptic integral of the first kind
* @f$ K(k) @f$ using the Carlson formulation.
*
* The complete elliptic integral of the first kind is defined as
* @f[
* K(k) = F(k,\pi/2) = \int_0^{\pi/2}\frac{d\theta}
* {\sqrt{1 - k^2 sin^2\theta}}
* @f]
* where @f$ F(k,\phi) @f$ is the incomplete elliptic integral of the
* first kind.
*
* @param __k The argument of the complete elliptic function.
* @return The complete elliptic function of the first kind.
*/
template<typename _Tp>
_Tp
__comp_ellint_1(_Tp __k)
{
if (__isnan(__k))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (std::abs(__k) >= _Tp(1))
return std::numeric_limits<_Tp>::quiet_NaN();
else
return __ellint_rf(_Tp(0), _Tp(1) - __k * __k, _Tp(1));
}
/**
* @brief Return the incomplete elliptic integral of the first kind
* @f$ F(k,\phi) @f$ using the Carlson formulation.
*
* The incomplete elliptic integral of the first kind is defined as
* @f[
* F(k,\phi) = \int_0^{\phi}\frac{d\theta}
* {\sqrt{1 - k^2 sin^2\theta}}
* @f]
*
* @param __k The argument of the elliptic function.
* @param __phi The integral limit argument of the elliptic function.
* @return The elliptic function of the first kind.
*/
template<typename _Tp>
_Tp
__ellint_1(_Tp __k, _Tp __phi)
{
if (__isnan(__k) || __isnan(__phi))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (std::abs(__k) > _Tp(1))
std::__throw_domain_error(__N("Bad argument in __ellint_1."));
else
{
// Reduce phi to -pi/2 < phi < +pi/2.
const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi()
+ _Tp(0.5L));
const _Tp __phi_red = __phi
- __n * __numeric_constants<_Tp>::__pi();
const _Tp __s = std::sin(__phi_red);
const _Tp __c = std::cos(__phi_red);
const _Tp __F = __s
* __ellint_rf(__c * __c,
_Tp(1) - __k * __k * __s * __s, _Tp(1));
if (__n == 0)
return __F;
else
return __F + _Tp(2) * __n * __comp_ellint_1(__k);
}
}
/**
* @brief Return the complete elliptic integral of the second kind
* @f$ E(k) @f$ by series expansion.
*
* The complete elliptic integral of the second kind is defined as
* @f[
* E(k,\pi/2) = \int_0^{\pi/2}\sqrt{1 - k^2 sin^2\theta}
* @f]
*
* This routine is not bad as long as |k| is somewhat smaller than 1
* but is not is good as the Carlson elliptic integral formulation.
*
* @param __k The argument of the complete elliptic function.
* @return The complete elliptic function of the second kind.
*/
template<typename _Tp>
_Tp
__comp_ellint_2_series(_Tp __k)
{
const _Tp __kk = __k * __k;
_Tp __term = __kk;
_Tp __sum = __term;
const unsigned int __max_iter = 1000;
for (unsigned int __i = 2; __i < __max_iter; ++__i)
{
const _Tp __i2m = 2 * __i - 1;
const _Tp __i2 = 2 * __i;
__term *= __i2m * __i2m * __kk / (__i2 * __i2);
if (__term < std::numeric_limits<_Tp>::epsilon())
break;
__sum += __term / __i2m;
}
return __numeric_constants<_Tp>::__pi_2() * (_Tp(1) - __sum);
}
/**
* @brief Return the Carlson elliptic function of the second kind
* @f$ R_D(x,y,z) = R_J(x,y,z,z) @f$ where
* @f$ R_J(x,y,z,p) @f$ is the Carlson elliptic function
* of the third kind.
*
* The Carlson elliptic function of the second kind is defined by:
* @f[
* R_D(x,y,z) = \frac{3}{2} \int_0^\infty
* \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{3/2}}
* @f]
*
* Based on Carlson's algorithms:
* - B. C. Carlson Numer. Math. 33, 1 (1979)
* - B. C. Carlson, Special Functions of Applied Mathematics (1977)
* - Numerical Recipes in C, 2nd ed, pp. 261-269,
* by Press, Teukolsky, Vetterling, Flannery (1992)
*
* @param __x The first of two symmetric arguments.
* @param __y The second of two symmetric arguments.
* @param __z The third argument.
* @return The Carlson elliptic function of the second kind.
*/
template<typename _Tp>
_Tp
__ellint_rd(_Tp __x, _Tp __y, _Tp __z)
{
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __errtol = std::pow(__eps / _Tp(8), _Tp(1) / _Tp(6));
const _Tp __min = std::numeric_limits<_Tp>::min();
const _Tp __max = std::numeric_limits<_Tp>::max();
const _Tp __lolim = _Tp(2) / std::pow(__max, _Tp(2) / _Tp(3));
const _Tp __uplim = std::pow(_Tp(0.1L) * __errtol / __min, _Tp(2) / _Tp(3));
if (__x < _Tp(0) || __y < _Tp(0))
std::__throw_domain_error(__N("Argument less than zero "
"in __ellint_rd."));
else if (__x + __y < __lolim || __z < __lolim)
std::__throw_domain_error(__N("Argument too small "
"in __ellint_rd."));
else
{
const _Tp __c0 = _Tp(1) / _Tp(4);
const _Tp __c1 = _Tp(3) / _Tp(14);
const _Tp __c2 = _Tp(1) / _Tp(6);
const _Tp __c3 = _Tp(9) / _Tp(22);
const _Tp __c4 = _Tp(3) / _Tp(26);
_Tp __xn = __x;
_Tp __yn = __y;
_Tp __zn = __z;
_Tp __sigma = _Tp(0);
_Tp __power4 = _Tp(1);
_Tp __mu;
_Tp __xndev, __yndev, __zndev;
const unsigned int __max_iter = 100;
for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
{
__mu = (__xn + __yn + _Tp(3) * __zn) / _Tp(5);
__xndev = (__mu - __xn) / __mu;
__yndev = (__mu - __yn) / __mu;
__zndev = (__mu - __zn) / __mu;
_Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev));
__epsilon = std::max(__epsilon, std::abs(__zndev));
if (__epsilon < __errtol)
break;
_Tp __xnroot = std::sqrt(__xn);
_Tp __ynroot = std::sqrt(__yn);
_Tp __znroot = std::sqrt(__zn);
_Tp __lambda = __xnroot * (__ynroot + __znroot)
+ __ynroot * __znroot;
__sigma += __power4 / (__znroot * (__zn + __lambda));
__power4 *= __c0;
__xn = __c0 * (__xn + __lambda);
__yn = __c0 * (__yn + __lambda);
__zn = __c0 * (__zn + __lambda);
}
// Note: __ea is an SPU badname.
_Tp __eaa = __xndev * __yndev;
_Tp __eb = __zndev * __zndev;
_Tp __ec = __eaa - __eb;
_Tp __ed = __eaa - _Tp(6) * __eb;
_Tp __ef = __ed + __ec + __ec;
_Tp __s1 = __ed * (-__c1 + __c3 * __ed
/ _Tp(3) - _Tp(3) * __c4 * __zndev * __ef
/ _Tp(2));
_Tp __s2 = __zndev
* (__c2 * __ef
+ __zndev * (-__c3 * __ec - __zndev * __c4 - __eaa));
return _Tp(3) * __sigma + __power4 * (_Tp(1) + __s1 + __s2)
/ (__mu * std::sqrt(__mu));
}
}
/**
* @brief Return the complete elliptic integral of the second kind
* @f$ E(k) @f$ using the Carlson formulation.
*
* The complete elliptic integral of the second kind is defined as
* @f[
* E(k,\pi/2) = \int_0^{\pi/2}\sqrt{1 - k^2 sin^2\theta}
* @f]
*
* @param __k The argument of the complete elliptic function.
* @return The complete elliptic function of the second kind.
*/
template<typename _Tp>
_Tp
__comp_ellint_2(_Tp __k)
{
if (__isnan(__k))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (std::abs(__k) == 1)
return _Tp(1);
else if (std::abs(__k) > _Tp(1))
std::__throw_domain_error(__N("Bad argument in __comp_ellint_2."));
else
{
const _Tp __kk = __k * __k;
return __ellint_rf(_Tp(0), _Tp(1) - __kk, _Tp(1))
- __kk * __ellint_rd(_Tp(0), _Tp(1) - __kk, _Tp(1)) / _Tp(3);
}
}
/**
* @brief Return the incomplete elliptic integral of the second kind
* @f$ E(k,\phi) @f$ using the Carlson formulation.
*
* The incomplete elliptic integral of the second kind is defined as
* @f[
* E(k,\phi) = \int_0^{\phi} \sqrt{1 - k^2 sin^2\theta}
* @f]
*
* @param __k The argument of the elliptic function.
* @param __phi The integral limit argument of the elliptic function.
* @return The elliptic function of the second kind.
*/
template<typename _Tp>
_Tp
__ellint_2(_Tp __k, _Tp __phi)
{
if (__isnan(__k) || __isnan(__phi))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (std::abs(__k) > _Tp(1))
std::__throw_domain_error(__N("Bad argument in __ellint_2."));
else
{
// Reduce phi to -pi/2 < phi < +pi/2.
const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi()
+ _Tp(0.5L));
const _Tp __phi_red = __phi
- __n * __numeric_constants<_Tp>::__pi();
const _Tp __kk = __k * __k;
const _Tp __s = std::sin(__phi_red);
const _Tp __ss = __s * __s;
const _Tp __sss = __ss * __s;
const _Tp __c = std::cos(__phi_red);
const _Tp __cc = __c * __c;
const _Tp __E = __s
* __ellint_rf(__cc, _Tp(1) - __kk * __ss, _Tp(1))
- __kk * __sss
* __ellint_rd(__cc, _Tp(1) - __kk * __ss, _Tp(1))
/ _Tp(3);
if (__n == 0)
return __E;
else
return __E + _Tp(2) * __n * __comp_ellint_2(__k);
}
}
/**
* @brief Return the Carlson elliptic function
* @f$ R_C(x,y) = R_F(x,y,y) @f$ where @f$ R_F(x,y,z) @f$
* is the Carlson elliptic function of the first kind.
*
* The Carlson elliptic function is defined by:
* @f[
* R_C(x,y) = \frac{1}{2} \int_0^\infty
* \frac{dt}{(t + x)^{1/2}(t + y)}
* @f]
*
* Based on Carlson's algorithms:
* - B. C. Carlson Numer. Math. 33, 1 (1979)
* - B. C. Carlson, Special Functions of Applied Mathematics (1977)
* - Numerical Recipes in C, 2nd ed, pp. 261-269,
* by Press, Teukolsky, Vetterling, Flannery (1992)
*
* @param __x The first argument.
* @param __y The second argument.
* @return The Carlson elliptic function.
*/
template<typename _Tp>
_Tp
__ellint_rc(_Tp __x, _Tp __y)
{
const _Tp __min = std::numeric_limits<_Tp>::min();
const _Tp __max = std::numeric_limits<_Tp>::max();
const _Tp __lolim = _Tp(5) * __min;
const _Tp __uplim = __max / _Tp(5);
if (__x < _Tp(0) || __y < _Tp(0) || __x + __y < __lolim)
std::__throw_domain_error(__N("Argument less than zero "
"in __ellint_rc."));
else
{
const _Tp __c0 = _Tp(1) / _Tp(4);
const _Tp __c1 = _Tp(1) / _Tp(7);
const _Tp __c2 = _Tp(9) / _Tp(22);
const _Tp __c3 = _Tp(3) / _Tp(10);
const _Tp __c4 = _Tp(3) / _Tp(8);
_Tp __xn = __x;
_Tp __yn = __y;
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __errtol = std::pow(__eps / _Tp(30), _Tp(1) / _Tp(6));
_Tp __mu;
_Tp __sn;
const unsigned int __max_iter = 100;
for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
{
__mu = (__xn + _Tp(2) * __yn) / _Tp(3);
__sn = (__yn + __mu) / __mu - _Tp(2);
if (std::abs(__sn) < __errtol)
break;
const _Tp __lambda = _Tp(2) * std::sqrt(__xn) * std::sqrt(__yn)
+ __yn;
__xn = __c0 * (__xn + __lambda);
__yn = __c0 * (__yn + __lambda);
}
_Tp __s = __sn * __sn
* (__c3 + __sn*(__c1 + __sn * (__c4 + __sn * __c2)));
return (_Tp(1) + __s) / std::sqrt(__mu);
}
}
/**
* @brief Return the Carlson elliptic function @f$ R_J(x,y,z,p) @f$
* of the third kind.
*
* The Carlson elliptic function of the third kind is defined by:
* @f[
* R_J(x,y,z,p) = \frac{3}{2} \int_0^\infty
* \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{1/2}(t + p)}
* @f]
*
* Based on Carlson's algorithms:
* - B. C. Carlson Numer. Math. 33, 1 (1979)
* - B. C. Carlson, Special Functions of Applied Mathematics (1977)
* - Numerical Recipes in C, 2nd ed, pp. 261-269,
* by Press, Teukolsky, Vetterling, Flannery (1992)
*
* @param __x The first of three symmetric arguments.
* @param __y The second of three symmetric arguments.
* @param __z The third of three symmetric arguments.
* @param __p The fourth argument.
* @return The Carlson elliptic function of the fourth kind.
*/
template<typename _Tp>
_Tp
__ellint_rj(_Tp __x, _Tp __y, _Tp __z, _Tp __p)
{
const _Tp __min = std::numeric_limits<_Tp>::min();
const _Tp __max = std::numeric_limits<_Tp>::max();
const _Tp __lolim = std::pow(_Tp(5) * __min, _Tp(1)/_Tp(3));
const _Tp __uplim = _Tp(0.3L)
* std::pow(_Tp(0.2L) * __max, _Tp(1)/_Tp(3));
if (__x < _Tp(0) || __y < _Tp(0) || __z < _Tp(0))
std::__throw_domain_error(__N("Argument less than zero "
"in __ellint_rj."));
else if (__x + __y < __lolim || __x + __z < __lolim
|| __y + __z < __lolim || __p < __lolim)
std::__throw_domain_error(__N("Argument too small "
"in __ellint_rj"));
else
{
const _Tp __c0 = _Tp(1) / _Tp(4);
const _Tp __c1 = _Tp(3) / _Tp(14);
const _Tp __c2 = _Tp(1) / _Tp(3);
const _Tp __c3 = _Tp(3) / _Tp(22);
const _Tp __c4 = _Tp(3) / _Tp(26);
_Tp __xn = __x;
_Tp __yn = __y;
_Tp __zn = __z;
_Tp __pn = __p;
_Tp __sigma = _Tp(0);
_Tp __power4 = _Tp(1);
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __errtol = std::pow(__eps / _Tp(8), _Tp(1) / _Tp(6));
_Tp __lambda, __mu;
_Tp __xndev, __yndev, __zndev, __pndev;
const unsigned int __max_iter = 100;
for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
{
__mu = (__xn + __yn + __zn + _Tp(2) * __pn) / _Tp(5);
__xndev = (__mu - __xn) / __mu;
__yndev = (__mu - __yn) / __mu;
__zndev = (__mu - __zn) / __mu;
__pndev = (__mu - __pn) / __mu;
_Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev));
__epsilon = std::max(__epsilon, std::abs(__zndev));
__epsilon = std::max(__epsilon, std::abs(__pndev));
if (__epsilon < __errtol)
break;
const _Tp __xnroot = std::sqrt(__xn);
const _Tp __ynroot = std::sqrt(__yn);
const _Tp __znroot = std::sqrt(__zn);
const _Tp __lambda = __xnroot * (__ynroot + __znroot)
+ __ynroot * __znroot;
const _Tp __alpha1 = __pn * (__xnroot + __ynroot + __znroot)
+ __xnroot * __ynroot * __znroot;
const _Tp __alpha2 = __alpha1 * __alpha1;
const _Tp __beta = __pn * (__pn + __lambda)
* (__pn + __lambda);
__sigma += __power4 * __ellint_rc(__alpha2, __beta);
__power4 *= __c0;
__xn = __c0 * (__xn + __lambda);
__yn = __c0 * (__yn + __lambda);
__zn = __c0 * (__zn + __lambda);
__pn = __c0 * (__pn + __lambda);
}
// Note: __ea is an SPU badname.
_Tp __eaa = __xndev * (__yndev + __zndev) + __yndev * __zndev;
_Tp __eb = __xndev * __yndev * __zndev;
_Tp __ec = __pndev * __pndev;
_Tp __e2 = __eaa - _Tp(3) * __ec;
_Tp __e3 = __eb + _Tp(2) * __pndev * (__eaa - __ec);
_Tp __s1 = _Tp(1) + __e2 * (-__c1 + _Tp(3) * __c3 * __e2 / _Tp(4)
- _Tp(3) * __c4 * __e3 / _Tp(2));
_Tp __s2 = __eb * (__c2 / _Tp(2)
+ __pndev * (-__c3 - __c3 + __pndev * __c4));
_Tp __s3 = __pndev * __eaa * (__c2 - __pndev * __c3)
- __c2 * __pndev * __ec;
return _Tp(3) * __sigma + __power4 * (__s1 + __s2 + __s3)
/ (__mu * std::sqrt(__mu));
}
}
/**
* @brief Return the complete elliptic integral of the third kind
* @f$ \Pi(k,\nu) = \Pi(k,\nu,\pi/2) @f$ using the
* Carlson formulation.
*
* The complete elliptic integral of the third kind is defined as
* @f[
* \Pi(k,\nu) = \int_0^{\pi/2}
* \frac{d\theta}
* {(1 - \nu \sin^2\theta)\sqrt{1 - k^2 \sin^2\theta}}
* @f]
*
* @param __k The argument of the elliptic function.
* @param __nu The second argument of the elliptic function.
* @return The complete elliptic function of the third kind.
*/
template<typename _Tp>
_Tp
__comp_ellint_3(_Tp __k, _Tp __nu)
{
if (__isnan(__k) || __isnan(__nu))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__nu == _Tp(1))
return std::numeric_limits<_Tp>::infinity();
else if (std::abs(__k) > _Tp(1))
std::__throw_domain_error(__N("Bad argument in __comp_ellint_3."));
else
{
const _Tp __kk = __k * __k;
return __ellint_rf(_Tp(0), _Tp(1) - __kk, _Tp(1))
+ __nu
* __ellint_rj(_Tp(0), _Tp(1) - __kk, _Tp(1), _Tp(1) - __nu)
/ _Tp(3);
}
}
/**
* @brief Return the incomplete elliptic integral of the third kind
* @f$ \Pi(k,\nu,\phi) @f$ using the Carlson formulation.
*
* The incomplete elliptic integral of the third kind is defined as
* @f[
* \Pi(k,\nu,\phi) = \int_0^{\phi}
* \frac{d\theta}
* {(1 - \nu \sin^2\theta)
* \sqrt{1 - k^2 \sin^2\theta}}
* @f]
*
* @param __k The argument of the elliptic function.
* @param __nu The second argument of the elliptic function.
* @param __phi The integral limit argument of the elliptic function.
* @return The elliptic function of the third kind.
*/
template<typename _Tp>
_Tp
__ellint_3(_Tp __k, _Tp __nu, _Tp __phi)
{
if (__isnan(__k) || __isnan(__nu) || __isnan(__phi))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (std::abs(__k) > _Tp(1))
std::__throw_domain_error(__N("Bad argument in __ellint_3."));
else
{
// Reduce phi to -pi/2 < phi < +pi/2.
const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi()
+ _Tp(0.5L));
const _Tp __phi_red = __phi
- __n * __numeric_constants<_Tp>::__pi();
const _Tp __kk = __k * __k;
const _Tp __s = std::sin(__phi_red);
const _Tp __ss = __s * __s;
const _Tp __sss = __ss * __s;
const _Tp __c = std::cos(__phi_red);
const _Tp __cc = __c * __c;
const _Tp __Pi = __s
* __ellint_rf(__cc, _Tp(1) - __kk * __ss, _Tp(1))
+ __nu * __sss
* __ellint_rj(__cc, _Tp(1) - __kk * __ss, _Tp(1),
_Tp(1) - __nu * __ss) / _Tp(3);
if (__n == 0)
return __Pi;
else
return __Pi + _Tp(2) * __n * __comp_ellint_3(__k, __nu);
}
}
} // namespace __detail
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_ELL_INTEGRAL_TCC
// TR1 wctype.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/wctype.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_WCTYPE_H
#define _GLIBCXX_TR1_WCTYPE_H 1
#include <tr1/cwctype>
#endif // _GLIBCXX_TR1_WCTYPE_H
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/gamma.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) Handbook of Mathematical Functions,
// ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 6, pp. 253-266
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
// 2nd ed, pp. 213-216
// (4) Gamma, Exploring Euler's Constant, Julian Havil,
// Princeton, 2003.
#ifndef _GLIBCXX_TR1_GAMMA_TCC
#define _GLIBCXX_TR1_GAMMA_TCC 1
#include <tr1/special_function_util.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// Implementation-space details.
namespace __detail
{
/**
* @brief This returns Bernoulli numbers from a table or by summation
* for larger values.
*
* Recursion is unstable.
*
* @param __n the order n of the Bernoulli number.
* @return The Bernoulli number of order n.
*/
template <typename _Tp>
_Tp
__bernoulli_series(unsigned int __n)
{
static const _Tp __num[28] = {
_Tp(1UL), -_Tp(1UL) / _Tp(2UL),
_Tp(1UL) / _Tp(6UL), _Tp(0UL),
-_Tp(1UL) / _Tp(30UL), _Tp(0UL),
_Tp(1UL) / _Tp(42UL), _Tp(0UL),
-_Tp(1UL) / _Tp(30UL), _Tp(0UL),
_Tp(5UL) / _Tp(66UL), _Tp(0UL),
-_Tp(691UL) / _Tp(2730UL), _Tp(0UL),
_Tp(7UL) / _Tp(6UL), _Tp(0UL),
-_Tp(3617UL) / _Tp(510UL), _Tp(0UL),
_Tp(43867UL) / _Tp(798UL), _Tp(0UL),
-_Tp(174611) / _Tp(330UL), _Tp(0UL),
_Tp(854513UL) / _Tp(138UL), _Tp(0UL),
-_Tp(236364091UL) / _Tp(2730UL), _Tp(0UL),
_Tp(8553103UL) / _Tp(6UL), _Tp(0UL)
};
if (__n == 0)
return _Tp(1);
if (__n == 1)
return -_Tp(1) / _Tp(2);
// Take care of the rest of the odd ones.
if (__n % 2 == 1)
return _Tp(0);
// Take care of some small evens that are painful for the series.
if (__n < 28)
return __num[__n];
_Tp __fact = _Tp(1);
if ((__n / 2) % 2 == 0)
__fact *= _Tp(-1);
for (unsigned int __k = 1; __k <= __n; ++__k)
__fact *= __k / (_Tp(2) * __numeric_constants<_Tp>::__pi());
__fact *= _Tp(2);
_Tp __sum = _Tp(0);
for (unsigned int __i = 1; __i < 1000; ++__i)
{
_Tp __term = std::pow(_Tp(__i), -_Tp(__n));
if (__term < std::numeric_limits<_Tp>::epsilon())
break;
__sum += __term;
}
return __fact * __sum;
}
/**
* @brief This returns Bernoulli number \f$B_n\f$.
*
* @param __n the order n of the Bernoulli number.
* @return The Bernoulli number of order n.
*/
template<typename _Tp>
inline _Tp
__bernoulli(int __n)
{ return __bernoulli_series<_Tp>(__n); }
/**
* @brief Return \f$log(\Gamma(x))\f$ by asymptotic expansion
* with Bernoulli number coefficients. This is like
* Sterling's approximation.
*
* @param __x The argument of the log of the gamma function.
* @return The logarithm of the gamma function.
*/
template<typename _Tp>
_Tp
__log_gamma_bernoulli(_Tp __x)
{
_Tp __lg = (__x - _Tp(0.5L)) * std::log(__x) - __x
+ _Tp(0.5L) * std::log(_Tp(2)
* __numeric_constants<_Tp>::__pi());
const _Tp __xx = __x * __x;
_Tp __help = _Tp(1) / __x;
for ( unsigned int __i = 1; __i < 20; ++__i )
{
const _Tp __2i = _Tp(2 * __i);
__help /= __2i * (__2i - _Tp(1)) * __xx;
__lg += __bernoulli<_Tp>(2 * __i) * __help;
}
return __lg;
}
/**
* @brief Return \f$log(\Gamma(x))\f$ by the Lanczos method.
* This method dominates all others on the positive axis I think.
*
* @param __x The argument of the log of the gamma function.
* @return The logarithm of the gamma function.
*/
template<typename _Tp>
_Tp
__log_gamma_lanczos(_Tp __x)
{
const _Tp __xm1 = __x - _Tp(1);
static const _Tp __lanczos_cheb_7[9] = {
_Tp( 0.99999999999980993227684700473478L),
_Tp( 676.520368121885098567009190444019L),
_Tp(-1259.13921672240287047156078755283L),
_Tp( 771.3234287776530788486528258894L),
_Tp(-176.61502916214059906584551354L),
_Tp( 12.507343278686904814458936853L),
_Tp(-0.13857109526572011689554707L),
_Tp( 9.984369578019570859563e-6L),
_Tp( 1.50563273514931155834e-7L)
};
static const _Tp __LOGROOT2PI
= _Tp(0.9189385332046727417803297364056176L);
_Tp __sum = __lanczos_cheb_7[0];
for(unsigned int __k = 1; __k < 9; ++__k)
__sum += __lanczos_cheb_7[__k] / (__xm1 + __k);
const _Tp __term1 = (__xm1 + _Tp(0.5L))
* std::log((__xm1 + _Tp(7.5L))
/ __numeric_constants<_Tp>::__euler());
const _Tp __term2 = __LOGROOT2PI + std::log(__sum);
const _Tp __result = __term1 + (__term2 - _Tp(7));
return __result;
}
/**
* @brief Return \f$ log(|\Gamma(x)|) \f$.
* This will return values even for \f$ x < 0 \f$.
* To recover the sign of \f$ \Gamma(x) \f$ for
* any argument use @a __log_gamma_sign.
*
* @param __x The argument of the log of the gamma function.
* @return The logarithm of the gamma function.
*/
template<typename _Tp>
_Tp
__log_gamma(_Tp __x)
{
if (__x > _Tp(0.5L))
return __log_gamma_lanczos(__x);
else
{
const _Tp __sin_fact
= std::abs(std::sin(__numeric_constants<_Tp>::__pi() * __x));
if (__sin_fact == _Tp(0))
std::__throw_domain_error(__N("Argument is nonpositive integer "
"in __log_gamma"));
return __numeric_constants<_Tp>::__lnpi()
- std::log(__sin_fact)
- __log_gamma_lanczos(_Tp(1) - __x);
}
}
/**
* @brief Return the sign of \f$ \Gamma(x) \f$.
* At nonpositive integers zero is returned.
*
* @param __x The argument of the gamma function.
* @return The sign of the gamma function.
*/
template<typename _Tp>
_Tp
__log_gamma_sign(_Tp __x)
{
if (__x > _Tp(0))
return _Tp(1);
else
{
const _Tp __sin_fact
= std::sin(__numeric_constants<_Tp>::__pi() * __x);
if (__sin_fact > _Tp(0))
return (1);
else if (__sin_fact < _Tp(0))
return -_Tp(1);
else
return _Tp(0);
}
}
/**
* @brief Return the logarithm of the binomial coefficient.
* The binomial coefficient is given by:
* @f[
* \left( \right) = \frac{n!}{(n-k)! k!}
* @f]
*
* @param __n The first argument of the binomial coefficient.
* @param __k The second argument of the binomial coefficient.
* @return The binomial coefficient.
*/
template<typename _Tp>
_Tp
__log_bincoef(unsigned int __n, unsigned int __k)
{
// Max e exponent before overflow.
static const _Tp __max_bincoeff
= std::numeric_limits<_Tp>::max_exponent10
* std::log(_Tp(10)) - _Tp(1);
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __coeff = _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __n))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __k))
- _GLIBCXX_MATH_NS::lgamma(_Tp(1 + __n - __k));
#else
_Tp __coeff = __log_gamma(_Tp(1 + __n))
- __log_gamma(_Tp(1 + __k))
- __log_gamma(_Tp(1 + __n - __k));
#endif
}
/**
* @brief Return the binomial coefficient.
* The binomial coefficient is given by:
* @f[
* \left( \right) = \frac{n!}{(n-k)! k!}
* @f]
*
* @param __n The first argument of the binomial coefficient.
* @param __k The second argument of the binomial coefficient.
* @return The binomial coefficient.
*/
template<typename _Tp>
_Tp
__bincoef(unsigned int __n, unsigned int __k)
{
// Max e exponent before overflow.
static const _Tp __max_bincoeff
= std::numeric_limits<_Tp>::max_exponent10
* std::log(_Tp(10)) - _Tp(1);
const _Tp __log_coeff = __log_bincoef<_Tp>(__n, __k);
if (__log_coeff > __max_bincoeff)
return std::numeric_limits<_Tp>::quiet_NaN();
else
return std::exp(__log_coeff);
}
/**
* @brief Return \f$ \Gamma(x) \f$.
*
* @param __x The argument of the gamma function.
* @return The gamma function.
*/
template<typename _Tp>
inline _Tp
__gamma(_Tp __x)
{ return std::exp(__log_gamma(__x)); }
/**
* @brief Return the digamma function by series expansion.
* The digamma or @f$ \psi(x) @f$ function is defined by
* @f[
* \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}
* @f]
*
* The series is given by:
* @f[
* \psi(x) = -\gamma_E - \frac{1}{x}
* \sum_{k=1}^{\infty} \frac{x}{k(x + k)}
* @f]
*/
template<typename _Tp>
_Tp
__psi_series(_Tp __x)
{
_Tp __sum = -__numeric_constants<_Tp>::__gamma_e() - _Tp(1) / __x;
const unsigned int __max_iter = 100000;
for (unsigned int __k = 1; __k < __max_iter; ++__k)
{
const _Tp __term = __x / (__k * (__k + __x));
__sum += __term;
if (std::abs(__term / __sum) < std::numeric_limits<_Tp>::epsilon())
break;
}
return __sum;
}
/**
* @brief Return the digamma function for large argument.
* The digamma or @f$ \psi(x) @f$ function is defined by
* @f[
* \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}
* @f]
*
* The asymptotic series is given by:
* @f[
* \psi(x) = \ln(x) - \frac{1}{2x}
* - \sum_{n=1}^{\infty} \frac{B_{2n}}{2 n x^{2n}}
* @f]
*/
template<typename _Tp>
_Tp
__psi_asymp(_Tp __x)
{
_Tp __sum = std::log(__x) - _Tp(0.5L) / __x;
const _Tp __xx = __x * __x;
_Tp __xp = __xx;
const unsigned int __max_iter = 100;
for (unsigned int __k = 1; __k < __max_iter; ++__k)
{
const _Tp __term = __bernoulli<_Tp>(2 * __k) / (2 * __k * __xp);
__sum -= __term;
if (std::abs(__term / __sum) < std::numeric_limits<_Tp>::epsilon())
break;
__xp *= __xx;
}
return __sum;
}
/**
* @brief Return the digamma function.
* The digamma or @f$ \psi(x) @f$ function is defined by
* @f[
* \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}
* @f]
* For negative argument the reflection formula is used:
* @f[
* \psi(x) = \psi(1-x) - \pi \cot(\pi x)
* @f]
*/
template<typename _Tp>
_Tp
__psi(_Tp __x)
{
const int __n = static_cast<int>(__x + 0.5L);
const _Tp __eps = _Tp(4) * std::numeric_limits<_Tp>::epsilon();
if (__n <= 0 && std::abs(__x - _Tp(__n)) < __eps)
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x < _Tp(0))
{
const _Tp __pi = __numeric_constants<_Tp>::__pi();
return __psi(_Tp(1) - __x)
- __pi * std::cos(__pi * __x) / std::sin(__pi * __x);
}
else if (__x > _Tp(100))
return __psi_asymp(__x);
else
return __psi_series(__x);
}
/**
* @brief Return the polygamma function @f$ \psi^{(n)}(x) @f$.
*
* The polygamma function is related to the Hurwitz zeta function:
* @f[
* \psi^{(n)}(x) = (-1)^{n+1} m! \zeta(m+1,x)
* @f]
*/
template<typename _Tp>
_Tp
__psi(unsigned int __n, _Tp __x)
{
if (__x <= _Tp(0))
std::__throw_domain_error(__N("Argument out of range "
"in __psi"));
else if (__n == 0)
return __psi(__x);
else
{
const _Tp __hzeta = __hurwitz_zeta(_Tp(__n + 1), __x);
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __ln_nfact = _GLIBCXX_MATH_NS::lgamma(_Tp(__n + 1));
#else
const _Tp __ln_nfact = __log_gamma(_Tp(__n + 1));
#endif
_Tp __result = std::exp(__ln_nfact) * __hzeta;
if (__n % 2 == 1)
__result = -__result;
return __result;
}
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_TR1_GAMMA_TCC
// TR1 unordered_map implementation -*- C++ -*-
// Copyright (C) 2010-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/unordered_map.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/unordered_map}
*/
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
// NB: When we get typedef templates these class definitions
// will be unnecessary.
template<class _Key, class _Tp,
class _Hash = hash<_Key>,
class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
bool __cache_hash_code = false>
class __unordered_map
: public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, false, true>
{
typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, false, true>
_Base;
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
__unordered_map(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(),
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
template<typename _InputIterator>
__unordered_map(_InputIterator __f, _InputIterator __l,
size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(),
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
};
template<class _Key, class _Tp,
class _Hash = hash<_Key>,
class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
bool __cache_hash_code = false>
class __unordered_multimap
: public _Hashtable<_Key, std::pair<const _Key, _Tp>,
_Alloc,
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, false, false>
{
typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
_Alloc,
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, false, false>
_Base;
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
__unordered_multimap(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(),
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
template<typename _InputIterator>
__unordered_multimap(_InputIterator __f, _InputIterator __l,
typename _Base::size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(),
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
};
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
bool __cache_hash_code>
inline void
swap(__unordered_map<_Key, _Tp, _Hash, _Pred,
_Alloc, __cache_hash_code>& __x,
__unordered_map<_Key, _Tp, _Hash, _Pred,
_Alloc, __cache_hash_code>& __y)
{ __x.swap(__y); }
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
bool __cache_hash_code>
inline void
swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred,
_Alloc, __cache_hash_code>& __x,
__unordered_multimap<_Key, _Tp, _Hash, _Pred,
_Alloc, __cache_hash_code>& __y)
{ __x.swap(__y); }
/**
* @brief A standard container composed of unique keys (containing
* at most one of each key value) that associates values of another type
* with the keys.
*
* @ingroup unordered_associative_containers
*
* Meets the requirements of a <a href="tables.html#65">container</a>, and
* <a href="tables.html#xx">unordered associative container</a>
*
* @param Key Type of key objects.
* @param Tp Type of mapped objects.
* @param Hash Hashing function object type, defaults to hash<Value>.
* @param Pred Predicate function object type, defaults to equal_to<Value>.
* @param Alloc Allocator type, defaults to allocator<Key>.
*
* The resulting value type of the container is std::pair<const Key, Tp>.
*/
template<class _Key, class _Tp,
class _Hash = hash<_Key>,
class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
class unordered_map
: public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
{
typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
public:
typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
unordered_map(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a)
{ }
template<typename _InputIterator>
unordered_map(_InputIterator __f, _InputIterator __l,
size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
};
/**
* @brief A standard container composed of equivalent keys
* (possibly containing multiple of each key value) that associates
* values of another type with the keys.
*
* @ingroup unordered_associative_containers
*
* Meets the requirements of a <a href="tables.html#65">container</a>, and
* <a href="tables.html#xx">unordered associative container</a>
*
* @param Key Type of key objects.
* @param Tp Type of mapped objects.
* @param Hash Hashing function object type, defaults to hash<Value>.
* @param Pred Predicate function object type, defaults to equal_to<Value>.
* @param Alloc Allocator type, defaults to allocator<Key>.
*
* The resulting value type of the container is std::pair<const Key, Tp>.
*/
template<class _Key, class _Tp,
class _Hash = hash<_Key>,
class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
class unordered_multimap
: public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
{
typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
public:
typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
unordered_multimap(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a)
{ }
template<typename _InputIterator>
unordered_multimap(_InputIterator __f, _InputIterator __l,
typename _Base::size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
};
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
}
_GLIBCXX_END_NAMESPACE_VERSION
}
// TR1 utility -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/utility
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_UTILITY
#define _GLIBCXX_TR1_UTILITY 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/stl_relops.h>
#include <bits/stl_pair.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
template<class _Tp>
class tuple_size;
template<int _Int, class _Tp>
class tuple_element;
// Various functions which give std::pair a tuple-like interface.
template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2> >
{ static const int value = 2; };
template<class _Tp1, class _Tp2>
const int
tuple_size<std::pair<_Tp1, _Tp2> >::value;
template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2> >
{ typedef _Tp1 type; };
template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2> >
{ typedef _Tp2 type; };
template<int _Int>
struct __pair_get;
template<>
struct __pair_get<0>
{
template<typename _Tp1, typename _Tp2>
static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
template<typename _Tp1, typename _Tp2>
static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
};
template<>
struct __pair_get<1>
{
template<typename _Tp1, typename _Tp2>
static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
};
template<int _Int, class _Tp1, class _Tp2>
inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__get(__in); }
template<int _Int, class _Tp1, class _Tp2>
inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(const std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__const_get(__in); }
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_UTILITY
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/beta_function.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) Handbook of Mathematical Functions,
// ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 6, pp. 253-266
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
// 2nd ed, pp. 213-216
// (4) Gamma, Exploring Euler's Constant, Julian Havil,
// Princeton, 2003.
#ifndef _GLIBCXX_TR1_BETA_FUNCTION_TCC
#define _GLIBCXX_TR1_BETA_FUNCTION_TCC 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief Return the beta function: \f$B(x,y)\f$.
*
* The beta function is defined by
* @f[
* B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
* @f]
*
* @param __x The first argument of the beta function.
* @param __y The second argument of the beta function.
* @return The beta function.
*/
template<typename _Tp>
_Tp
__beta_gamma(_Tp __x, _Tp __y)
{
_Tp __bet;
#if _GLIBCXX_USE_C99_MATH_TR1
if (__x > __y)
{
__bet = _GLIBCXX_MATH_NS::tgamma(__x)
/ _GLIBCXX_MATH_NS::tgamma(__x + __y);
__bet *= _GLIBCXX_MATH_NS::tgamma(__y);
}
else
{
__bet = _GLIBCXX_MATH_NS::tgamma(__y)
/ _GLIBCXX_MATH_NS::tgamma(__x + __y);
__bet *= _GLIBCXX_MATH_NS::tgamma(__x);
}
#else
if (__x > __y)
{
__bet = __gamma(__x) / __gamma(__x + __y);
__bet *= __gamma(__y);
}
else
{
__bet = __gamma(__y) / __gamma(__x + __y);
__bet *= __gamma(__x);
}
#endif
return __bet;
}
/**
* @brief Return the beta function \f$B(x,y)\f$ using
* the log gamma functions.
*
* The beta function is defined by
* @f[
* B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
* @f]
*
* @param __x The first argument of the beta function.
* @param __y The second argument of the beta function.
* @return The beta function.
*/
template<typename _Tp>
_Tp
__beta_lgamma(_Tp __x, _Tp __y)
{
#if _GLIBCXX_USE_C99_MATH_TR1
_Tp __bet = _GLIBCXX_MATH_NS::lgamma(__x)
+ _GLIBCXX_MATH_NS::lgamma(__y)
- _GLIBCXX_MATH_NS::lgamma(__x + __y);
#else
_Tp __bet = __log_gamma(__x)
+ __log_gamma(__y)
- __log_gamma(__x + __y);
#endif
__bet = std::exp(__bet);
return __bet;
}
/**
* @brief Return the beta function \f$B(x,y)\f$ using
* the product form.
*
* The beta function is defined by
* @f[
* B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
* @f]
*
* @param __x The first argument of the beta function.
* @param __y The second argument of the beta function.
* @return The beta function.
*/
template<typename _Tp>
_Tp
__beta_product(_Tp __x, _Tp __y)
{
_Tp __bet = (__x + __y) / (__x * __y);
unsigned int __max_iter = 1000000;
for (unsigned int __k = 1; __k < __max_iter; ++__k)
{
_Tp __term = (_Tp(1) + (__x + __y) / __k)
/ ((_Tp(1) + __x / __k) * (_Tp(1) + __y / __k));
__bet *= __term;
}
return __bet;
}
/**
* @brief Return the beta function \f$ B(x,y) \f$.
*
* The beta function is defined by
* @f[
* B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
* @f]
*
* @param __x The first argument of the beta function.
* @param __y The second argument of the beta function.
* @return The beta function.
*/
template<typename _Tp>
inline _Tp
__beta(_Tp __x, _Tp __y)
{
if (__isnan(__x) || __isnan(__y))
return std::numeric_limits<_Tp>::quiet_NaN();
else
return __beta_lgamma(__x, __y);
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_BETA_FUNCTION_TCC
// TR1 hashtable.h header -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/hashtable.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly.
* @headername{tr1/unordered_set, tr1/unordered_map}
*/
#ifndef _GLIBCXX_TR1_HASHTABLE_H
#define _GLIBCXX_TR1_HASHTABLE_H 1
#pragma GCC system_header
#include <tr1/hashtable_policy.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
// Class template _Hashtable, class definition.
// Meaning of class template _Hashtable's template parameters
// _Key and _Value: arbitrary CopyConstructible types.
// _Allocator: an allocator type ([lib.allocator.requirements]) whose
// value type is Value. As a conforming extension, we allow for
// value type != Value.
// _ExtractKey: function object that takes a object of type Value
// and returns a value of type _Key.
// _Equal: function object that takes two objects of type k and returns
// a bool-like value that is true if the two objects are considered equal.
// _H1: the hash function. A unary function object with argument type
// Key and result type size_t. Return values should be distributed
// over the entire range [0, numeric_limits<size_t>:::max()].
// _H2: the range-hashing function (in the terminology of Tavori and
// Dreizin). A binary function object whose argument types and result
// type are all size_t. Given arguments r and N, the return value is
// in the range [0, N).
// _Hash: the ranged hash function (Tavori and Dreizin). A binary function
// whose argument types are _Key and size_t and whose result type is
// size_t. Given arguments k and N, the return value is in the range
// [0, N). Default: hash(k, N) = h2(h1(k), N). If _Hash is anything other
// than the default, _H1 and _H2 are ignored.
// _RehashPolicy: Policy class with three members, all of which govern
// the bucket count. _M_next_bkt(n) returns a bucket count no smaller
// than n. _M_bkt_for_elements(n) returns a bucket count appropriate
// for an element count of n. _M_need_rehash(n_bkt, n_elt, n_ins)
// determines whether, if the current bucket count is n_bkt and the
// current element count is n_elt, we need to increase the bucket
// count. If so, returns make_pair(true, n), where n is the new
// bucket count. If not, returns make_pair(false, <anything>).
// ??? Right now it is hard-wired that the number of buckets never
// shrinks. Should we allow _RehashPolicy to change that?
// __cache_hash_code: bool. true if we store the value of the hash
// function along with the value. This is a time-space tradeoff.
// Storing it may improve lookup speed by reducing the number of times
// we need to call the Equal function.
// __constant_iterators: bool. true if iterator and const_iterator are
// both constant iterator types. This is true for unordered_set and
// unordered_multiset, false for unordered_map and unordered_multimap.
// __unique_keys: bool. true if the return value of _Hashtable::count(k)
// is always at most one, false if it may be an arbitrary number. This
// true for unordered_set and unordered_map, false for unordered_multiset
// and unordered_multimap.
template<typename _Key, typename _Value, typename _Allocator,
typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash,
typename _RehashPolicy,
bool __cache_hash_code,
bool __constant_iterators,
bool __unique_keys>
class _Hashtable
: public __detail::_Rehash_base<_RehashPolicy,
_Hashtable<_Key, _Value, _Allocator,
_ExtractKey,
_Equal, _H1, _H2, _Hash,
_RehashPolicy,
__cache_hash_code,
__constant_iterators,
__unique_keys> >,
public __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
_H1, _H2, _Hash, __cache_hash_code>,
public __detail::_Map_base<_Key, _Value, _ExtractKey, __unique_keys,
_Hashtable<_Key, _Value, _Allocator,
_ExtractKey,
_Equal, _H1, _H2, _Hash,
_RehashPolicy,
__cache_hash_code,
__constant_iterators,
__unique_keys> >
{
public:
typedef _Allocator allocator_type;
typedef _Value value_type;
typedef _Key key_type;
typedef _Equal key_equal;
// mapped_type, if present, comes from _Map_base.
// hasher, if present, comes from _Hash_code_base.
typedef typename _Allocator::difference_type difference_type;
typedef typename _Allocator::size_type size_type;
typedef typename _Allocator::pointer pointer;
typedef typename _Allocator::const_pointer const_pointer;
typedef typename _Allocator::reference reference;
typedef typename _Allocator::const_reference const_reference;
typedef __detail::_Node_iterator<value_type, __constant_iterators,
__cache_hash_code>
local_iterator;
typedef __detail::_Node_const_iterator<value_type,
__constant_iterators,
__cache_hash_code>
const_local_iterator;
typedef __detail::_Hashtable_iterator<value_type, __constant_iterators,
__cache_hash_code>
iterator;
typedef __detail::_Hashtable_const_iterator<value_type,
__constant_iterators,
__cache_hash_code>
const_iterator;
template<typename _Key2, typename _Value2, typename _Ex2, bool __unique2,
typename _Hashtable2>
friend struct __detail::_Map_base;
private:
typedef __detail::_Hash_node<_Value, __cache_hash_code> _Node;
typedef typename _Allocator::template rebind<_Node>::other
_Node_allocator_type;
typedef typename _Allocator::template rebind<_Node*>::other
_Bucket_allocator_type;
typedef typename _Allocator::template rebind<_Value>::other
_Value_allocator_type;
_Node_allocator_type _M_node_allocator;
_Node** _M_buckets;
size_type _M_bucket_count;
size_type _M_element_count;
_RehashPolicy _M_rehash_policy;
_Node*
_M_allocate_node(const value_type& __v);
void
_M_deallocate_node(_Node* __n);
void
_M_deallocate_nodes(_Node**, size_type);
_Node**
_M_allocate_buckets(size_type __n);
void
_M_deallocate_buckets(_Node**, size_type __n);
public:
// Constructor, destructor, assignment, swap
_Hashtable(size_type __bucket_hint,
const _H1&, const _H2&, const _Hash&,
const _Equal&, const _ExtractKey&,
const allocator_type&);
template<typename _InputIterator>
_Hashtable(_InputIterator __first, _InputIterator __last,
size_type __bucket_hint,
const _H1&, const _H2&, const _Hash&,
const _Equal&, const _ExtractKey&,
const allocator_type&);
_Hashtable(const _Hashtable&);
_Hashtable&
operator=(const _Hashtable&);
~_Hashtable();
void swap(_Hashtable&);
// Basic container operations
iterator
begin()
{
iterator __i(_M_buckets);
if (!__i._M_cur_node)
__i._M_incr_bucket();
return __i;
}
const_iterator
begin() const
{
const_iterator __i(_M_buckets);
if (!__i._M_cur_node)
__i._M_incr_bucket();
return __i;
}
iterator
end()
{ return iterator(_M_buckets + _M_bucket_count); }
const_iterator
end() const
{ return const_iterator(_M_buckets + _M_bucket_count); }
size_type
size() const
{ return _M_element_count; }
bool
empty() const
{ return size() == 0; }
allocator_type
get_allocator() const
{ return allocator_type(_M_node_allocator); }
_Value_allocator_type
_M_get_Value_allocator() const
{ return _Value_allocator_type(_M_node_allocator); }
size_type
max_size() const
{ return _M_node_allocator.max_size(); }
// Observers
key_equal
key_eq() const
{ return this->_M_eq; }
// hash_function, if present, comes from _Hash_code_base.
// Bucket operations
size_type
bucket_count() const
{ return _M_bucket_count; }
size_type
max_bucket_count() const
{ return max_size(); }
size_type
bucket_size(size_type __n) const
{ return std::distance(begin(__n), end(__n)); }
size_type
bucket(const key_type& __k) const
{
return this->_M_bucket_index(__k, this->_M_hash_code(__k),
bucket_count());
}
local_iterator
begin(size_type __n)
{ return local_iterator(_M_buckets[__n]); }
local_iterator
end(size_type)
{ return local_iterator(0); }
const_local_iterator
begin(size_type __n) const
{ return const_local_iterator(_M_buckets[__n]); }
const_local_iterator
end(size_type) const
{ return const_local_iterator(0); }
float
load_factor() const
{
return static_cast<float>(size()) / static_cast<float>(bucket_count());
}
// max_load_factor, if present, comes from _Rehash_base.
// Generalization of max_load_factor. Extension, not found in TR1. Only
// useful if _RehashPolicy is something other than the default.
const _RehashPolicy&
__rehash_policy() const
{ return _M_rehash_policy; }
void
__rehash_policy(const _RehashPolicy&);
// Lookup.
iterator
find(const key_type& __k);
const_iterator
find(const key_type& __k) const;
size_type
count(const key_type& __k) const;
std::pair<iterator, iterator>
equal_range(const key_type& __k);
std::pair<const_iterator, const_iterator>
equal_range(const key_type& __k) const;
private: // Find, insert and erase helper functions
// ??? This dispatching is a workaround for the fact that we don't
// have partial specialization of member templates; it would be
// better to just specialize insert on __unique_keys. There may be a
// cleaner workaround.
typedef typename __gnu_cxx::__conditional_type<__unique_keys,
std::pair<iterator, bool>, iterator>::__type
_Insert_Return_Type;
typedef typename __gnu_cxx::__conditional_type<__unique_keys,
std::_Select1st<_Insert_Return_Type>,
std::_Identity<_Insert_Return_Type>
>::__type
_Insert_Conv_Type;
_Node*
_M_find_node(_Node*, const key_type&,
typename _Hashtable::_Hash_code_type) const;
iterator
_M_insert_bucket(const value_type&, size_type,
typename _Hashtable::_Hash_code_type);
std::pair<iterator, bool>
_M_insert(const value_type&, std::tr1::true_type);
iterator
_M_insert(const value_type&, std::tr1::false_type);
void
_M_erase_node(_Node*, _Node**);
public:
// Insert and erase
_Insert_Return_Type
insert(const value_type& __v)
{ return _M_insert(__v, std::tr1::integral_constant<bool,
__unique_keys>()); }
iterator
insert(iterator, const value_type& __v)
{ return iterator(_Insert_Conv_Type()(this->insert(__v))); }
const_iterator
insert(const_iterator, const value_type& __v)
{ return const_iterator(_Insert_Conv_Type()(this->insert(__v))); }
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last);
iterator
erase(iterator);
const_iterator
erase(const_iterator);
size_type
erase(const key_type&);
iterator
erase(iterator, iterator);
const_iterator
erase(const_iterator, const_iterator);
void
clear();
// Set number of buckets to be appropriate for container of n element.
void rehash(size_type __n);
private:
// Unconditionally change size of bucket array to n.
void _M_rehash(size_type __n);
};
// Definitions of class template _Hashtable's out-of-line member functions.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::_Node*
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_allocate_node(const value_type& __v)
{
_Node* __n = _M_node_allocator.allocate(1);
__try
{
_M_get_Value_allocator().construct(&__n->_M_v, __v);
__n->_M_next = 0;
return __n;
}
__catch(...)
{
_M_node_allocator.deallocate(__n, 1);
__throw_exception_again;
}
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_deallocate_node(_Node* __n)
{
_M_get_Value_allocator().destroy(&__n->_M_v);
_M_node_allocator.deallocate(__n, 1);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_deallocate_nodes(_Node** __array, size_type __n)
{
for (size_type __i = 0; __i < __n; ++__i)
{
_Node* __p = __array[__i];
while (__p)
{
_Node* __tmp = __p;
__p = __p->_M_next;
_M_deallocate_node(__tmp);
}
__array[__i] = 0;
}
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::_Node**
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_allocate_buckets(size_type __n)
{
_Bucket_allocator_type __alloc(_M_node_allocator);
// We allocate one extra bucket to hold a sentinel, an arbitrary
// non-null pointer. Iterator increment relies on this.
_Node** __p = __alloc.allocate(__n + 1);
std::fill(__p, __p + __n, (_Node*) 0);
__p[__n] = reinterpret_cast<_Node*>(0x1000);
return __p;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_deallocate_buckets(_Node** __p, size_type __n)
{
_Bucket_allocator_type __alloc(_M_node_allocator);
__alloc.deallocate(__p, __n + 1);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_Hashtable(size_type __bucket_hint,
const _H1& __h1, const _H2& __h2, const _Hash& __h,
const _Equal& __eq, const _ExtractKey& __exk,
const allocator_type& __a)
: __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),
__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
_H1, _H2, _Hash, __chc>(__exk, __eq,
__h1, __h2, __h),
__detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(),
_M_node_allocator(__a),
_M_bucket_count(0),
_M_element_count(0),
_M_rehash_policy()
{
_M_bucket_count = _M_rehash_policy._M_next_bkt(__bucket_hint);
_M_buckets = _M_allocate_buckets(_M_bucket_count);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
template<typename _InputIterator>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_Hashtable(_InputIterator __f, _InputIterator __l,
size_type __bucket_hint,
const _H1& __h1, const _H2& __h2, const _Hash& __h,
const _Equal& __eq, const _ExtractKey& __exk,
const allocator_type& __a)
: __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),
__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
_H1, _H2, _Hash, __chc>(__exk, __eq,
__h1, __h2, __h),
__detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(),
_M_node_allocator(__a),
_M_bucket_count(0),
_M_element_count(0),
_M_rehash_policy()
{
_M_bucket_count = std::max(_M_rehash_policy._M_next_bkt(__bucket_hint),
_M_rehash_policy.
_M_bkt_for_elements(__detail::
__distance_fw(__f,
__l)));
_M_buckets = _M_allocate_buckets(_M_bucket_count);
__try
{
for (; __f != __l; ++__f)
this->insert(*__f);
}
__catch(...)
{
clear();
_M_deallocate_buckets(_M_buckets, _M_bucket_count);
__throw_exception_again;
}
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_Hashtable(const _Hashtable& __ht)
: __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht),
__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
_H1, _H2, _Hash, __chc>(__ht),
__detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht),
_M_node_allocator(__ht._M_node_allocator),
_M_bucket_count(__ht._M_bucket_count),
_M_element_count(__ht._M_element_count),
_M_rehash_policy(__ht._M_rehash_policy)
{
_M_buckets = _M_allocate_buckets(_M_bucket_count);
__try
{
for (size_type __i = 0; __i < __ht._M_bucket_count; ++__i)
{
_Node* __n = __ht._M_buckets[__i];
_Node** __tail = _M_buckets + __i;
while (__n)
{
*__tail = _M_allocate_node(__n->_M_v);
this->_M_copy_code(*__tail, __n);
__tail = &((*__tail)->_M_next);
__n = __n->_M_next;
}
}
}
__catch(...)
{
clear();
_M_deallocate_buckets(_M_buckets, _M_bucket_count);
__throw_exception_again;
}
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>&
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
operator=(const _Hashtable& __ht)
{
_Hashtable __tmp(__ht);
this->swap(__tmp);
return *this;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
~_Hashtable()
{
clear();
_M_deallocate_buckets(_M_buckets, _M_bucket_count);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
swap(_Hashtable& __x)
{
// The only base class with member variables is hash_code_base. We
// define _Hash_code_base::_M_swap because different specializations
// have different members.
__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
_H1, _H2, _Hash, __chc>::_M_swap(__x);
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 431. Swapping containers with unequal allocators.
std::__alloc_swap<_Node_allocator_type>::_S_do_it(_M_node_allocator,
__x._M_node_allocator);
std::swap(_M_rehash_policy, __x._M_rehash_policy);
std::swap(_M_buckets, __x._M_buckets);
std::swap(_M_bucket_count, __x._M_bucket_count);
std::swap(_M_element_count, __x._M_element_count);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
__rehash_policy(const _RehashPolicy& __pol)
{
_M_rehash_policy = __pol;
size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count);
if (__n_bkt > _M_bucket_count)
_M_rehash(__n_bkt);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
find(const key_type& __k)
{
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
_Node* __p = _M_find_node(_M_buckets[__n], __k, __code);
return __p ? iterator(__p, _M_buckets + __n) : this->end();
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::const_iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
find(const key_type& __k) const
{
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
_Node* __p = _M_find_node(_M_buckets[__n], __k, __code);
return __p ? const_iterator(__p, _M_buckets + __n) : this->end();
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::size_type
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
count(const key_type& __k) const
{
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
std::size_t __result = 0;
for (_Node* __p = _M_buckets[__n]; __p; __p = __p->_M_next)
if (this->_M_compare(__k, __code, __p))
++__result;
return __result;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
std::pair<typename _Hashtable<_Key, _Value, _Allocator,
_ExtractKey, _Equal, _H1,
_H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator,
typename _Hashtable<_Key, _Value, _Allocator,
_ExtractKey, _Equal, _H1,
_H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
equal_range(const key_type& __k)
{
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
_Node** __head = _M_buckets + __n;
_Node* __p = _M_find_node(*__head, __k, __code);
if (__p)
{
_Node* __p1 = __p->_M_next;
for (; __p1; __p1 = __p1->_M_next)
if (!this->_M_compare(__k, __code, __p1))
break;
iterator __first(__p, __head);
iterator __last(__p1, __head);
if (!__p1)
__last._M_incr_bucket();
return std::make_pair(__first, __last);
}
else
return std::make_pair(this->end(), this->end());
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
std::pair<typename _Hashtable<_Key, _Value, _Allocator,
_ExtractKey, _Equal, _H1,
_H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::const_iterator,
typename _Hashtable<_Key, _Value, _Allocator,
_ExtractKey, _Equal, _H1,
_H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::const_iterator>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
equal_range(const key_type& __k) const
{
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
_Node** __head = _M_buckets + __n;
_Node* __p = _M_find_node(*__head, __k, __code);
if (__p)
{
_Node* __p1 = __p->_M_next;
for (; __p1; __p1 = __p1->_M_next)
if (!this->_M_compare(__k, __code, __p1))
break;
const_iterator __first(__p, __head);
const_iterator __last(__p1, __head);
if (!__p1)
__last._M_incr_bucket();
return std::make_pair(__first, __last);
}
else
return std::make_pair(this->end(), this->end());
}
// Find the node whose key compares equal to k, beginning the search
// at p (usually the head of a bucket). Return zero if no node is found.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey,
_Equal, _H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::_Node*
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_find_node(_Node* __p, const key_type& __k,
typename _Hashtable::_Hash_code_type __code) const
{
for (; __p; __p = __p->_M_next)
if (this->_M_compare(__k, __code, __p))
return __p;
return 0;
}
// Insert v in bucket n (assumes no element with its key already present).
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_insert_bucket(const value_type& __v, size_type __n,
typename _Hashtable::_Hash_code_type __code)
{
std::pair<bool, std::size_t> __do_rehash
= _M_rehash_policy._M_need_rehash(_M_bucket_count,
_M_element_count, 1);
// Allocate the new node before doing the rehash so that we don't
// do a rehash if the allocation throws.
_Node* __new_node = _M_allocate_node(__v);
__try
{
if (__do_rehash.first)
{
const key_type& __k = this->_M_extract(__v);
__n = this->_M_bucket_index(__k, __code, __do_rehash.second);
_M_rehash(__do_rehash.second);
}
__new_node->_M_next = _M_buckets[__n];
this->_M_store_code(__new_node, __code);
_M_buckets[__n] = __new_node;
++_M_element_count;
return iterator(__new_node, _M_buckets + __n);
}
__catch(...)
{
_M_deallocate_node(__new_node);
__throw_exception_again;
}
}
// Insert v if no element with its key is already present.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
std::pair<typename _Hashtable<_Key, _Value, _Allocator,
_ExtractKey, _Equal, _H1,
_H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator, bool>
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_insert(const value_type& __v, std::tr1::true_type)
{
const key_type& __k = this->_M_extract(__v);
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))
return std::make_pair(iterator(__p, _M_buckets + __n), false);
return std::make_pair(_M_insert_bucket(__v, __n, __code), true);
}
// Insert v unconditionally.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_insert(const value_type& __v, std::tr1::false_type)
{
std::pair<bool, std::size_t> __do_rehash
= _M_rehash_policy._M_need_rehash(_M_bucket_count,
_M_element_count, 1);
if (__do_rehash.first)
_M_rehash(__do_rehash.second);
const key_type& __k = this->_M_extract(__v);
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
// First find the node, avoid leaking new_node if compare throws.
_Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);
_Node* __new_node = _M_allocate_node(__v);
if (__prev)
{
__new_node->_M_next = __prev->_M_next;
__prev->_M_next = __new_node;
}
else
{
__new_node->_M_next = _M_buckets[__n];
_M_buckets[__n] = __new_node;
}
this->_M_store_code(__new_node, __code);
++_M_element_count;
return iterator(__new_node, _M_buckets + __n);
}
// For erase(iterator) and erase(const_iterator).
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_erase_node(_Node* __p, _Node** __b)
{
_Node* __cur = *__b;
if (__cur == __p)
*__b = __cur->_M_next;
else
{
_Node* __next = __cur->_M_next;
while (__next != __p)
{
__cur = __next;
__next = __cur->_M_next;
}
__cur->_M_next = __next->_M_next;
}
_M_deallocate_node(__p);
--_M_element_count;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
template<typename _InputIterator>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
insert(_InputIterator __first, _InputIterator __last)
{
size_type __n_elt = __detail::__distance_fw(__first, __last);
std::pair<bool, std::size_t> __do_rehash
= _M_rehash_policy._M_need_rehash(_M_bucket_count,
_M_element_count, __n_elt);
if (__do_rehash.first)
_M_rehash(__do_rehash.second);
for (; __first != __last; ++__first)
this->insert(*__first);
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
erase(iterator __it)
{
iterator __result = __it;
++__result;
_M_erase_node(__it._M_cur_node, __it._M_cur_bucket);
return __result;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::const_iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
erase(const_iterator __it)
{
const_iterator __result = __it;
++__result;
_M_erase_node(__it._M_cur_node, __it._M_cur_bucket);
return __result;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::size_type
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
erase(const key_type& __k)
{
typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
size_type __result = 0;
_Node** __slot = _M_buckets + __n;
while (*__slot && !this->_M_compare(__k, __code, *__slot))
__slot = &((*__slot)->_M_next);
_Node** __saved_slot = 0;
while (*__slot && this->_M_compare(__k, __code, *__slot))
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 526. Is it undefined if a function in the standard changes
// in parameters?
if (&this->_M_extract((*__slot)->_M_v) != &__k)
{
_Node* __p = *__slot;
*__slot = __p->_M_next;
_M_deallocate_node(__p);
--_M_element_count;
++__result;
}
else
{
__saved_slot = __slot;
__slot = &((*__slot)->_M_next);
}
}
if (__saved_slot)
{
_Node* __p = *__saved_slot;
*__saved_slot = __p->_M_next;
_M_deallocate_node(__p);
--_M_element_count;
++__result;
}
return __result;
}
// ??? This could be optimized by taking advantage of the bucket
// structure, but it's not clear that it's worth doing. It probably
// wouldn't even be an optimization unless the load factor is large.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
erase(iterator __first, iterator __last)
{
while (__first != __last)
__first = this->erase(__first);
return __last;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy,
__chc, __cit, __uk>::const_iterator
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
erase(const_iterator __first, const_iterator __last)
{
while (__first != __last)
__first = this->erase(__first);
return __last;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
clear()
{
_M_deallocate_nodes(_M_buckets, _M_bucket_count);
_M_element_count = 0;
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
rehash(size_type __n)
{
_M_rehash(std::max(_M_rehash_policy._M_next_bkt(__n),
_M_rehash_policy._M_bkt_for_elements(_M_element_count
+ 1)));
}
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_M_rehash(size_type __n)
{
_Node** __new_array = _M_allocate_buckets(__n);
__try
{
for (size_type __i = 0; __i < _M_bucket_count; ++__i)
while (_Node* __p = _M_buckets[__i])
{
std::size_t __new_index = this->_M_bucket_index(__p, __n);
_M_buckets[__i] = __p->_M_next;
__p->_M_next = __new_array[__new_index];
__new_array[__new_index] = __p;
}
_M_deallocate_buckets(_M_buckets, _M_bucket_count);
_M_bucket_count = __n;
_M_buckets = __new_array;
}
__catch(...)
{
// A failure here means that a hash function threw an exception.
// We can't restore the previous state without calling the hash
// function again, so the only sensible recovery is to delete
// everything.
_M_deallocate_nodes(__new_array, __n);
_M_deallocate_buckets(__new_array, __n);
_M_deallocate_nodes(_M_buckets, _M_bucket_count);
_M_element_count = 0;
__throw_exception_again;
}
}
} // namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_TR1_HASHTABLE_H
// class template array -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/array
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_ARRAY
#define _GLIBCXX_TR1_ARRAY 1
#pragma GCC system_header
#include <bits/stl_algobase.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/**
* @brief A standard container for storing a fixed size sequence of elements.
*
* @ingroup sequences
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
* <a href="tables.html#66">reversible container</a>, and a
* <a href="tables.html#67">sequence</a>.
*
* Sets support random access iterators.
*
* @param Tp Type of element. Required to be a complete type.
* @param N Number of elements.
*/
template<typename _Tp, std::size_t _Nm>
struct array
{
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Support for zero-sized arrays mandatory.
value_type _M_instance[_Nm ? _Nm : 1];
// No explicit construct/copy/destroy for aggregate type.
void
assign(const value_type& __u)
{ std::fill_n(begin(), size(), __u); }
void
swap(array& __other)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
iterator
begin()
{ return iterator(std::__addressof(_M_instance[0])); }
const_iterator
begin() const
{ return const_iterator(std::__addressof(_M_instance[0])); }
iterator
end()
{ return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator
end() const
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator
rbegin()
{ return reverse_iterator(end()); }
const_reverse_iterator
rbegin() const
{ return const_reverse_iterator(end()); }
reverse_iterator
rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
// Capacity.
size_type
size() const { return _Nm; }
size_type
max_size() const { return _Nm; }
bool
empty() const { return size() == 0; }
// Element access.
reference
operator[](size_type __n)
{ return _M_instance[__n]; }
const_reference
operator[](size_type __n) const
{ return _M_instance[__n]; }
reference
at(size_type __n)
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
const_reference
at(size_type __n) const
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
reference
front()
{ return *begin(); }
const_reference
front() const
{ return *begin(); }
reference
back()
{ return _Nm ? *(end() - 1) : *end(); }
const_reference
back() const
{ return _Nm ? *(end() - 1) : *end(); }
_Tp*
data()
{ return std::__addressof(_M_instance[0]); }
const _Tp*
data() const
{ return std::__addressof(_M_instance[0]); }
};
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
__b.begin(), __b.end());
}
template<typename _Tp, std::size_t _Nm>
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms [6.2.2.2].
template<typename _Tp, std::size_t _Nm>
inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
{ __one.swap(__two); }
// Tuple interface to class template array [6.2.2.5].
/// tuple_size
template<typename _Tp>
class tuple_size;
/// tuple_element
template<int _Int, typename _Tp>
class tuple_element;
template<typename _Tp, std::size_t _Nm>
struct tuple_size<array<_Tp, _Nm> >
{ static const int value = _Nm; };
template<typename _Tp, std::size_t _Nm>
const int
tuple_size<array<_Tp, _Nm> >::value;
template<int _Int, typename _Tp, std::size_t _Nm>
struct tuple_element<_Int, array<_Tp, _Nm> >
{ typedef _Tp type; };
template<int _Int, typename _Tp, std::size_t _Nm>
inline _Tp&
get(array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
template<int _Int, typename _Tp, std::size_t _Nm>
inline const _Tp&
get(const array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_ARRAY
// random number generation (out of line) -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/random.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/random}
*/
#ifndef _GLIBCXX_TR1_RANDOM_TCC
#define _GLIBCXX_TR1_RANDOM_TCC 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/*
* (Further) implementation-space details.
*/
namespace __detail
{
// General case for x = (ax + c) mod m -- use Schrage's algorithm to avoid
// integer overflow.
//
// Because a and c are compile-time integral constants the compiler kindly
// elides any unreachable paths.
//
// Preconditions: a > 0, m > 0.
//
template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
struct _Mod
{
static _Tp
__calc(_Tp __x)
{
if (__a == 1)
__x %= __m;
else
{
static const _Tp __q = __m / __a;
static const _Tp __r = __m % __a;
_Tp __t1 = __a * (__x % __q);
_Tp __t2 = __r * (__x / __q);
if (__t1 >= __t2)
__x = __t1 - __t2;
else
__x = __m - __t2 + __t1;
}
if (__c != 0)
{
const _Tp __d = __m - __x;
if (__d > __c)
__x += __c;
else
__x = __c - __d;
}
return __x;
}
};
// Special case for m == 0 -- use unsigned integer overflow as modulo
// operator.
template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
struct _Mod<_Tp, __a, __c, __m, true>
{
static _Tp
__calc(_Tp __x)
{ return __a * __x + __c; }
};
} // namespace __detail
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
linear_congruential<_UIntType, __a, __c, __m>::multiplier;
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
linear_congruential<_UIntType, __a, __c, __m>::increment;
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
linear_congruential<_UIntType, __a, __c, __m>::modulus;
/**
* Seeds the LCR with integral value @p __x0, adjusted so that the
* ring identity is never a member of the convergence set.
*/
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
void
linear_congruential<_UIntType, __a, __c, __m>::
seed(unsigned long __x0)
{
if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0)
&& (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0))
_M_x = __detail::__mod<_UIntType, 1, 0, __m>(1);
else
_M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0);
}
/**
* Seeds the LCR engine with a value generated by @p __g.
*/
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
template<class _Gen>
void
linear_congruential<_UIntType, __a, __c, __m>::
seed(_Gen& __g, false_type)
{
_UIntType __x0 = __g();
if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0)
&& (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0))
_M_x = __detail::__mod<_UIntType, 1, 0, __m>(1);
else
_M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0);
}
/**
* Gets the next generated value in sequence.
*/
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
typename linear_congruential<_UIntType, __a, __c, __m>::result_type
linear_congruential<_UIntType, __a, __c, __m>::
operator()()
{
_M_x = __detail::__mod<_UIntType, __a, __c, __m>(_M_x);
return _M_x;
}
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const linear_congruential<_UIntType, __a, __c, __m>& __lcr)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__os.widen(' '));
__os << __lcr._M_x;
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
linear_congruential<_UIntType, __a, __c, __m>& __lcr)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec);
__is >> __lcr._M_x;
__is.flags(__flags);
return __is;
}
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::word_size;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::state_size;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::shift_size;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::mask_bits;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const _UIntType
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::parameter_a;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::output_u;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::output_s;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const _UIntType
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::output_b;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::output_t;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const _UIntType
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::output_c;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
const int
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::output_l;
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
void
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::
seed(unsigned long __value)
{
_M_x[0] = __detail::__mod<_UIntType, 1, 0,
__detail::_Shift<_UIntType, __w>::__value>(__value);
for (int __i = 1; __i < state_size; ++__i)
{
_UIntType __x = _M_x[__i - 1];
__x ^= __x >> (__w - 2);
__x *= 1812433253ul;
__x += __i;
_M_x[__i] = __detail::__mod<_UIntType, 1, 0,
__detail::_Shift<_UIntType, __w>::__value>(__x);
}
_M_p = state_size;
}
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
template<class _Gen>
void
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::
seed(_Gen& __gen, false_type)
{
for (int __i = 0; __i < state_size; ++__i)
_M_x[__i] = __detail::__mod<_UIntType, 1, 0,
__detail::_Shift<_UIntType, __w>::__value>(__gen());
_M_p = state_size;
}
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
_UIntType __b, int __t, _UIntType __c, int __l>
typename
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::result_type
mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
__b, __t, __c, __l>::
operator()()
{
// Reload the vector - cost is O(n) amortized over n calls.
if (_M_p >= state_size)
{
const _UIntType __upper_mask = (~_UIntType()) << __r;
const _UIntType __lower_mask = ~__upper_mask;
for (int __k = 0; __k < (__n - __m); ++__k)
{
_UIntType __y = ((_M_x[__k] & __upper_mask)
| (_M_x[__k + 1] & __lower_mask));
_M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
^ ((__y & 0x01) ? __a : 0));
}
for (int __k = (__n - __m); __k < (__n - 1); ++__k)
{
_UIntType __y = ((_M_x[__k] & __upper_mask)
| (_M_x[__k + 1] & __lower_mask));
_M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)
^ ((__y & 0x01) ? __a : 0));
}
_UIntType __y = ((_M_x[__n - 1] & __upper_mask)
| (_M_x[0] & __lower_mask));
_M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
^ ((__y & 0x01) ? __a : 0));
_M_p = 0;
}
// Calculate o(x(i)).
result_type __z = _M_x[_M_p++];
__z ^= (__z >> __u);
__z ^= (__z << __s) & __b;
__z ^= (__z << __t) & __c;
__z ^= (__z >> __l);
return __z;
}
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s, _UIntType __b, int __t,
_UIntType __c, int __l,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const mersenne_twister<_UIntType, __w, __n, __m,
__r, __a, __u, __s, __b, __t, __c, __l>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
for (int __i = 0; __i < __n - 1; ++__i)
__os << __x._M_x[__i] << __space;
__os << __x._M_x[__n - 1];
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s, _UIntType __b, int __t,
_UIntType __c, int __l,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
mersenne_twister<_UIntType, __w, __n, __m,
__r, __a, __u, __s, __b, __t, __c, __l>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
for (int __i = 0; __i < __n; ++__i)
__is >> __x._M_x[__i];
__is.flags(__flags);
return __is;
}
template<typename _IntType, _IntType __m, int __s, int __r>
const _IntType
subtract_with_carry<_IntType, __m, __s, __r>::modulus;
template<typename _IntType, _IntType __m, int __s, int __r>
const int
subtract_with_carry<_IntType, __m, __s, __r>::long_lag;
template<typename _IntType, _IntType __m, int __s, int __r>
const int
subtract_with_carry<_IntType, __m, __s, __r>::short_lag;
template<typename _IntType, _IntType __m, int __s, int __r>
void
subtract_with_carry<_IntType, __m, __s, __r>::
seed(unsigned long __value)
{
if (__value == 0)
__value = 19780503;
std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>
__lcg(__value);
for (int __i = 0; __i < long_lag; ++__i)
_M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__lcg());
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
}
template<typename _IntType, _IntType __m, int __s, int __r>
template<class _Gen>
void
subtract_with_carry<_IntType, __m, __s, __r>::
seed(_Gen& __gen, false_type)
{
const int __n = (std::numeric_limits<_UIntType>::digits + 31) / 32;
for (int __i = 0; __i < long_lag; ++__i)
{
_UIntType __tmp = 0;
_UIntType __factor = 1;
for (int __j = 0; __j < __n; ++__j)
{
__tmp += __detail::__mod<__detail::_UInt32Type, 1, 0, 0>
(__gen()) * __factor;
__factor *= __detail::_Shift<_UIntType, 32>::__value;
}
_M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__tmp);
}
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
}
template<typename _IntType, _IntType __m, int __s, int __r>
typename subtract_with_carry<_IntType, __m, __s, __r>::result_type
subtract_with_carry<_IntType, __m, __s, __r>::
operator()()
{
// Derive short lag index from current index.
int __ps = _M_p - short_lag;
if (__ps < 0)
__ps += long_lag;
// Calculate new x(i) without overflow or division.
// NB: Thanks to the requirements for _IntType, _M_x[_M_p] + _M_carry
// cannot overflow.
_UIntType __xi;
if (_M_x[__ps] >= _M_x[_M_p] + _M_carry)
{
__xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;
_M_carry = 0;
}
else
{
__xi = modulus - _M_x[_M_p] - _M_carry + _M_x[__ps];
_M_carry = 1;
}
_M_x[_M_p] = __xi;
// Adjust current index to loop around in ring buffer.
if (++_M_p >= long_lag)
_M_p = 0;
return __xi;
}
template<typename _IntType, _IntType __m, int __s, int __r,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const subtract_with_carry<_IntType, __m, __s, __r>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
for (int __i = 0; __i < __r; ++__i)
__os << __x._M_x[__i] << __space;
__os << __x._M_carry;
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<typename _IntType, _IntType __m, int __s, int __r,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
subtract_with_carry<_IntType, __m, __s, __r>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
for (int __i = 0; __i < __r; ++__i)
__is >> __x._M_x[__i];
__is >> __x._M_carry;
__is.flags(__flags);
return __is;
}
template<typename _RealType, int __w, int __s, int __r>
const int
subtract_with_carry_01<_RealType, __w, __s, __r>::word_size;
template<typename _RealType, int __w, int __s, int __r>
const int
subtract_with_carry_01<_RealType, __w, __s, __r>::long_lag;
template<typename _RealType, int __w, int __s, int __r>
const int
subtract_with_carry_01<_RealType, __w, __s, __r>::short_lag;
template<typename _RealType, int __w, int __s, int __r>
void
subtract_with_carry_01<_RealType, __w, __s, __r>::
_M_initialize_npows()
{
for (int __j = 0; __j < __n; ++__j)
#if _GLIBCXX_USE_C99_MATH_TR1
_M_npows[__j] = std::tr1::ldexp(_RealType(1), -__w + __j * 32);
#else
_M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32);
#endif
}
template<typename _RealType, int __w, int __s, int __r>
void
subtract_with_carry_01<_RealType, __w, __s, __r>::
seed(unsigned long __value)
{
if (__value == 0)
__value = 19780503;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 512. Seeding subtract_with_carry_01 from a single unsigned long.
std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>
__lcg(__value);
this->seed(__lcg);
}
template<typename _RealType, int __w, int __s, int __r>
template<class _Gen>
void
subtract_with_carry_01<_RealType, __w, __s, __r>::
seed(_Gen& __gen, false_type)
{
for (int __i = 0; __i < long_lag; ++__i)
{
for (int __j = 0; __j < __n - 1; ++__j)
_M_x[__i][__j] = __detail::__mod<_UInt32Type, 1, 0, 0>(__gen());
_M_x[__i][__n - 1] = __detail::__mod<_UInt32Type, 1, 0,
__detail::_Shift<_UInt32Type, __w % 32>::__value>(__gen());
}
_M_carry = 1;
for (int __j = 0; __j < __n; ++__j)
if (_M_x[long_lag - 1][__j] != 0)
{
_M_carry = 0;
break;
}
_M_p = 0;
}
template<typename _RealType, int __w, int __s, int __r>
typename subtract_with_carry_01<_RealType, __w, __s, __r>::result_type
subtract_with_carry_01<_RealType, __w, __s, __r>::
operator()()
{
// Derive short lag index from current index.
int __ps = _M_p - short_lag;
if (__ps < 0)
__ps += long_lag;
_UInt32Type __new_carry;
for (int __j = 0; __j < __n - 1; ++__j)
{
if (_M_x[__ps][__j] > _M_x[_M_p][__j]
|| (_M_x[__ps][__j] == _M_x[_M_p][__j] && _M_carry == 0))
__new_carry = 0;
else
__new_carry = 1;
_M_x[_M_p][__j] = _M_x[__ps][__j] - _M_x[_M_p][__j] - _M_carry;
_M_carry = __new_carry;
}
if (_M_x[__ps][__n - 1] > _M_x[_M_p][__n - 1]
|| (_M_x[__ps][__n - 1] == _M_x[_M_p][__n - 1] && _M_carry == 0))
__new_carry = 0;
else
__new_carry = 1;
_M_x[_M_p][__n - 1] = __detail::__mod<_UInt32Type, 1, 0,
__detail::_Shift<_UInt32Type, __w % 32>::__value>
(_M_x[__ps][__n - 1] - _M_x[_M_p][__n - 1] - _M_carry);
_M_carry = __new_carry;
result_type __ret = 0.0;
for (int __j = 0; __j < __n; ++__j)
__ret += _M_x[_M_p][__j] * _M_npows[__j];
// Adjust current index to loop around in ring buffer.
if (++_M_p >= long_lag)
_M_p = 0;
return __ret;
}
template<typename _RealType, int __w, int __s, int __r,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const subtract_with_carry_01<_RealType, __w, __s, __r>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
for (int __i = 0; __i < __r; ++__i)
for (int __j = 0; __j < __x.__n; ++__j)
__os << __x._M_x[__i][__j] << __space;
__os << __x._M_carry;
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<typename _RealType, int __w, int __s, int __r,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
subtract_with_carry_01<_RealType, __w, __s, __r>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
for (int __i = 0; __i < __r; ++__i)
for (int __j = 0; __j < __x.__n; ++__j)
__is >> __x._M_x[__i][__j];
__is >> __x._M_carry;
__is.flags(__flags);
return __is;
}
template<class _UniformRandomNumberGenerator, int __p, int __r>
const int
discard_block<_UniformRandomNumberGenerator, __p, __r>::block_size;
template<class _UniformRandomNumberGenerator, int __p, int __r>
const int
discard_block<_UniformRandomNumberGenerator, __p, __r>::used_block;
template<class _UniformRandomNumberGenerator, int __p, int __r>
typename discard_block<_UniformRandomNumberGenerator,
__p, __r>::result_type
discard_block<_UniformRandomNumberGenerator, __p, __r>::
operator()()
{
if (_M_n >= used_block)
{
while (_M_n < block_size)
{
_M_b();
++_M_n;
}
_M_n = 0;
}
++_M_n;
return _M_b();
}
template<class _UniformRandomNumberGenerator, int __p, int __r,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const discard_block<_UniformRandomNumberGenerator,
__p, __r>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec | __ios_base::fixed
| __ios_base::left);
__os.fill(__space);
__os << __x._M_b << __space << __x._M_n;
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<class _UniformRandomNumberGenerator, int __p, int __r,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
discard_block<_UniformRandomNumberGenerator, __p, __r>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
__is >> __x._M_b >> __x._M_n;
__is.flags(__flags);
return __is;
}
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
const int
xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::shift1;
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
const int
xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::shift2;
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
void
xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::
_M_initialize_max()
{
const int __w = std::numeric_limits<result_type>::digits;
const result_type __m1 =
std::min(result_type(_M_b1.max() - _M_b1.min()),
__detail::_Shift<result_type, __w - __s1>::__value - 1);
const result_type __m2 =
std::min(result_type(_M_b2.max() - _M_b2.min()),
__detail::_Shift<result_type, __w - __s2>::__value - 1);
// NB: In TR1 s1 is not required to be >= s2.
if (__s1 < __s2)
_M_max = _M_initialize_max_aux(__m2, __m1, __s2 - __s1) << __s1;
else
_M_max = _M_initialize_max_aux(__m1, __m2, __s1 - __s2) << __s2;
}
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
typename xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::result_type
xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::
_M_initialize_max_aux(result_type __a, result_type __b, int __d)
{
const result_type __two2d = result_type(1) << __d;
const result_type __c = __a * __two2d;
if (__a == 0 || __b < __two2d)
return __c + __b;
const result_type __t = std::max(__c, __b);
const result_type __u = std::min(__c, __b);
result_type __ub = __u;
result_type __p;
for (__p = 0; __ub != 1; __ub >>= 1)
++__p;
const result_type __two2p = result_type(1) << __p;
const result_type __k = __t / __two2p;
if (__k & 1)
return (__k + 1) * __two2p - 1;
if (__c >= __b)
return (__k + 1) * __two2p + _M_initialize_max_aux((__t % __two2p)
/ __two2d,
__u % __two2p, __d);
else
return (__k + 1) * __two2p + _M_initialize_max_aux((__u % __two2p)
/ __two2d,
__t % __two2p, __d);
}
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
__os << __x.base1() << __space << __x.base2();
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::skipws);
__is >> __x._M_b1 >> __x._M_b2;
__is.flags(__flags);
return __is;
}
template<typename _IntType>
template<typename _UniformRandomNumberGenerator>
typename uniform_int<_IntType>::result_type
uniform_int<_IntType>::
_M_call(_UniformRandomNumberGenerator& __urng,
result_type __min, result_type __max, true_type)
{
// XXX Must be fixed to work well for *arbitrary* __urng.max(),
// __urng.min(), __max, __min. Currently works fine only in the
// most common case __urng.max() - __urng.min() >= __max - __min,
// with __urng.max() > __urng.min() >= 0.
typedef typename __gnu_cxx::__add_unsigned<typename
_UniformRandomNumberGenerator::result_type>::__type __urntype;
typedef typename __gnu_cxx::__add_unsigned<result_type>::__type
__utype;
typedef typename __gnu_cxx::__conditional_type<(sizeof(__urntype)
> sizeof(__utype)),
__urntype, __utype>::__type __uctype;
result_type __ret;
const __urntype __urnmin = __urng.min();
const __urntype __urnmax = __urng.max();
const __urntype __urnrange = __urnmax - __urnmin;
const __uctype __urange = __max - __min;
const __uctype __udenom = (__urnrange <= __urange
? 1 : __urnrange / (__urange + 1));
do
__ret = (__urntype(__urng()) - __urnmin) / __udenom;
while (__ret > __max - __min);
return __ret + __min;
}
template<typename _IntType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const uniform_int<_IntType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os << __x.min() << __space << __x.max();
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<typename _IntType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
uniform_int<_IntType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
__is >> __x._M_min >> __x._M_max;
__is.flags(__flags);
return __is;
}
template<typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const bernoulli_distribution& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(__gnu_cxx::__numeric_traits<double>::__max_digits10);
__os << __x.p();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _IntType, typename _RealType>
template<class _UniformRandomNumberGenerator>
typename geometric_distribution<_IntType, _RealType>::result_type
geometric_distribution<_IntType, _RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
// About the epsilon thing see this thread:
// http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html
const _RealType __naf =
(1 - std::numeric_limits<_RealType>::epsilon()) / 2;
// The largest _RealType convertible to _IntType.
const _RealType __thr =
std::numeric_limits<_IntType>::max() + __naf;
_RealType __cand;
do
__cand = std::ceil(std::log(__urng()) / _M_log_p);
while (__cand >= __thr);
return result_type(__cand + __naf);
}
template<typename _IntType, typename _RealType,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const geometric_distribution<_IntType, _RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x.p();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _IntType, typename _RealType>
void
poisson_distribution<_IntType, _RealType>::
_M_initialize()
{
#if _GLIBCXX_USE_C99_MATH_TR1
if (_M_mean >= 12)
{
const _RealType __m = std::floor(_M_mean);
_M_lm_thr = std::log(_M_mean);
_M_lfm = std::tr1::lgamma(__m + 1);
_M_sm = std::sqrt(__m);
const _RealType __pi_4 = 0.7853981633974483096156608458198757L;
const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m
/ __pi_4));
_M_d = std::tr1::round(std::max(_RealType(6),
std::min(__m, __dx)));
const _RealType __cx = 2 * __m + _M_d;
_M_scx = std::sqrt(__cx / 2);
_M_1cx = 1 / __cx;
_M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx);
_M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2)) / _M_d;
}
else
#endif
_M_lm_thr = std::exp(-_M_mean);
}
/**
* A rejection algorithm when mean >= 12 and a simple method based
* upon the multiplication of uniform random variates otherwise.
* NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
* is defined.
*
* Reference:
* Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag,
* New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!).
*/
template<typename _IntType, typename _RealType>
template<class _UniformRandomNumberGenerator>
typename poisson_distribution<_IntType, _RealType>::result_type
poisson_distribution<_IntType, _RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
#if _GLIBCXX_USE_C99_MATH_TR1
if (_M_mean >= 12)
{
_RealType __x;
// See comments above...
const _RealType __naf =
(1 - std::numeric_limits<_RealType>::epsilon()) / 2;
const _RealType __thr =
std::numeric_limits<_IntType>::max() + __naf;
const _RealType __m = std::floor(_M_mean);
// sqrt(pi / 2)
const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
const _RealType __c1 = _M_sm * __spi_2;
const _RealType __c2 = _M_c2b + __c1;
const _RealType __c3 = __c2 + 1;
const _RealType __c4 = __c3 + 1;
// e^(1 / 78)
const _RealType __e178 = 1.0129030479320018583185514777512983L;
const _RealType __c5 = __c4 + __e178;
const _RealType __c = _M_cb + __c5;
const _RealType __2cx = 2 * (2 * __m + _M_d);
bool __reject = true;
do
{
const _RealType __u = __c * __urng();
const _RealType __e = -std::log(__urng());
_RealType __w = 0.0;
if (__u <= __c1)
{
const _RealType __n = _M_nd(__urng);
const _RealType __y = -std::abs(__n) * _M_sm - 1;
__x = std::floor(__y);
__w = -__n * __n / 2;
if (__x < -__m)
continue;
}
else if (__u <= __c2)
{
const _RealType __n = _M_nd(__urng);
const _RealType __y = 1 + std::abs(__n) * _M_scx;
__x = std::ceil(__y);
__w = __y * (2 - __y) * _M_1cx;
if (__x > _M_d)
continue;
}
else if (__u <= __c3)
// NB: This case not in the book, nor in the Errata,
// but should be ok...
__x = -1;
else if (__u <= __c4)
__x = 0;
else if (__u <= __c5)
__x = 1;
else
{
const _RealType __v = -std::log(__urng());
const _RealType __y = _M_d + __v * __2cx / _M_d;
__x = std::ceil(__y);
__w = -_M_d * _M_1cx * (1 + __y / 2);
}
__reject = (__w - __e - __x * _M_lm_thr
> _M_lfm - std::tr1::lgamma(__x + __m + 1));
__reject |= __x + __m >= __thr;
} while (__reject);
return result_type(__x + __m + __naf);
}
else
#endif
{
_IntType __x = 0;
_RealType __prod = 1.0;
do
{
__prod *= __urng();
__x += 1;
}
while (__prod > _M_lm_thr);
return __x - 1;
}
}
template<typename _IntType, typename _RealType,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const poisson_distribution<_IntType, _RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x.mean() << __space << __x._M_nd;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _IntType, typename _RealType,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
poisson_distribution<_IntType, _RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::skipws);
__is >> __x._M_mean >> __x._M_nd;
__x._M_initialize();
__is.flags(__flags);
return __is;
}
template<typename _IntType, typename _RealType>
void
binomial_distribution<_IntType, _RealType>::
_M_initialize()
{
const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
_M_easy = true;
#if _GLIBCXX_USE_C99_MATH_TR1
if (_M_t * __p12 >= 8)
{
_M_easy = false;
const _RealType __np = std::floor(_M_t * __p12);
const _RealType __pa = __np / _M_t;
const _RealType __1p = 1 - __pa;
const _RealType __pi_4 = 0.7853981633974483096156608458198757L;
const _RealType __d1x =
std::sqrt(__np * __1p * std::log(32 * __np
/ (81 * __pi_4 * __1p)));
_M_d1 = std::tr1::round(std::max(_RealType(1), __d1x));
const _RealType __d2x =
std::sqrt(__np * __1p * std::log(32 * _M_t * __1p
/ (__pi_4 * __pa)));
_M_d2 = std::tr1::round(std::max(_RealType(1), __d2x));
// sqrt(pi / 2)
const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
_M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));
_M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p));
_M_c = 2 * _M_d1 / __np;
_M_a1 = std::exp(_M_c) * _M_s1 * __spi_2;
const _RealType __a12 = _M_a1 + _M_s2 * __spi_2;
const _RealType __s1s = _M_s1 * _M_s1;
_M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p))
* 2 * __s1s / _M_d1
* std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));
const _RealType __s2s = _M_s2 * _M_s2;
_M_s = (_M_a123 + 2 * __s2s / _M_d2
* std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
_M_lf = (std::tr1::lgamma(__np + 1)
+ std::tr1::lgamma(_M_t - __np + 1));
_M_lp1p = std::log(__pa / __1p);
_M_q = -std::log(1 - (__p12 - __pa) / __1p);
}
else
#endif
_M_q = -std::log(1 - __p12);
}
template<typename _IntType, typename _RealType>
template<class _UniformRandomNumberGenerator>
typename binomial_distribution<_IntType, _RealType>::result_type
binomial_distribution<_IntType, _RealType>::
_M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)
{
_IntType __x = 0;
_RealType __sum = 0;
do
{
const _RealType __e = -std::log(__urng());
__sum += __e / (__t - __x);
__x += 1;
}
while (__sum <= _M_q);
return __x - 1;
}
/**
* A rejection algorithm when t * p >= 8 and a simple waiting time
* method - the second in the referenced book - otherwise.
* NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
* is defined.
*
* Reference:
* Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag,
* New York, 1986, Ch. X, Sect. 4 (+ Errata!).
*/
template<typename _IntType, typename _RealType>
template<class _UniformRandomNumberGenerator>
typename binomial_distribution<_IntType, _RealType>::result_type
binomial_distribution<_IntType, _RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __ret;
const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
#if _GLIBCXX_USE_C99_MATH_TR1
if (!_M_easy)
{
_RealType __x;
// See comments above...
const _RealType __naf =
(1 - std::numeric_limits<_RealType>::epsilon()) / 2;
const _RealType __thr =
std::numeric_limits<_IntType>::max() + __naf;
const _RealType __np = std::floor(_M_t * __p12);
const _RealType __pa = __np / _M_t;
// sqrt(pi / 2)
const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
const _RealType __a1 = _M_a1;
const _RealType __a12 = __a1 + _M_s2 * __spi_2;
const _RealType __a123 = _M_a123;
const _RealType __s1s = _M_s1 * _M_s1;
const _RealType __s2s = _M_s2 * _M_s2;
bool __reject;
do
{
const _RealType __u = _M_s * __urng();
_RealType __v;
if (__u <= __a1)
{
const _RealType __n = _M_nd(__urng);
const _RealType __y = _M_s1 * std::abs(__n);
__reject = __y >= _M_d1;
if (!__reject)
{
const _RealType __e = -std::log(__urng());
__x = std::floor(__y);
__v = -__e - __n * __n / 2 + _M_c;
}
}
else if (__u <= __a12)
{
const _RealType __n = _M_nd(__urng);
const _RealType __y = _M_s2 * std::abs(__n);
__reject = __y >= _M_d2;
if (!__reject)
{
const _RealType __e = -std::log(__urng());
__x = std::floor(-__y);
__v = -__e - __n * __n / 2;
}
}
else if (__u <= __a123)
{
const _RealType __e1 = -std::log(__urng());
const _RealType __e2 = -std::log(__urng());
const _RealType __y = _M_d1 + 2 * __s1s * __e1 / _M_d1;
__x = std::floor(__y);
__v = (-__e2 + _M_d1 * (1 / (_M_t - __np)
-__y / (2 * __s1s)));
__reject = false;
}
else
{
const _RealType __e1 = -std::log(__urng());
const _RealType __e2 = -std::log(__urng());
const _RealType __y = _M_d2 + 2 * __s2s * __e1 / _M_d2;
__x = std::floor(-__y);
__v = -__e2 - _M_d2 * __y / (2 * __s2s);
__reject = false;
}
__reject = __reject || __x < -__np || __x > _M_t - __np;
if (!__reject)
{
const _RealType __lfx =
std::tr1::lgamma(__np + __x + 1)
+ std::tr1::lgamma(_M_t - (__np + __x) + 1);
__reject = __v > _M_lf - __lfx + __x * _M_lp1p;
}
__reject |= __x + __np >= __thr;
}
while (__reject);
__x += __np + __naf;
const _IntType __z = _M_waiting(__urng, _M_t - _IntType(__x));
__ret = _IntType(__x) + __z;
}
else
#endif
__ret = _M_waiting(__urng, _M_t);
if (__p12 != _M_p)
__ret = _M_t - __ret;
return __ret;
}
template<typename _IntType, typename _RealType,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const binomial_distribution<_IntType, _RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x.t() << __space << __x.p()
<< __space << __x._M_nd;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _IntType, typename _RealType,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
binomial_distribution<_IntType, _RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
__is >> __x._M_t >> __x._M_p >> __x._M_nd;
__x._M_initialize();
__is.flags(__flags);
return __is;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const uniform_real<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x.min() << __space << __x.max();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
uniform_real<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::skipws);
__is >> __x._M_min >> __x._M_max;
__is.flags(__flags);
return __is;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const exponential_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x.lambda();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
/**
* Polar method due to Marsaglia.
*
* Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag,
* New York, 1986, Ch. V, Sect. 4.4.
*/
template<typename _RealType>
template<class _UniformRandomNumberGenerator>
typename normal_distribution<_RealType>::result_type
normal_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __ret;
if (_M_saved_available)
{
_M_saved_available = false;
__ret = _M_saved;
}
else
{
result_type __x, __y, __r2;
do
{
__x = result_type(2.0) * __urng() - 1.0;
__y = result_type(2.0) * __urng() - 1.0;
__r2 = __x * __x + __y * __y;
}
while (__r2 > 1.0 || __r2 == 0.0);
const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);
_M_saved = __x * __mult;
_M_saved_available = true;
__ret = __y * __mult;
}
__ret = __ret * _M_sigma + _M_mean;
return __ret;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const normal_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x._M_saved_available << __space
<< __x.mean() << __space
<< __x.sigma();
if (__x._M_saved_available)
__os << __space << __x._M_saved;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
normal_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
__is >> __x._M_saved_available >> __x._M_mean
>> __x._M_sigma;
if (__x._M_saved_available)
__is >> __x._M_saved;
__is.flags(__flags);
return __is;
}
template<typename _RealType>
void
gamma_distribution<_RealType>::
_M_initialize()
{
if (_M_alpha >= 1)
_M_l_d = std::sqrt(2 * _M_alpha - 1);
else
_M_l_d = (std::pow(_M_alpha, _M_alpha / (1 - _M_alpha))
* (1 - _M_alpha));
}
/**
* Cheng's rejection algorithm GB for alpha >= 1 and a modification
* of Vaduva's rejection from Weibull algorithm due to Devroye for
* alpha < 1.
*
* References:
* Cheng, R. C. The Generation of Gamma Random Variables with Non-integral
* Shape Parameter. Applied Statistics, 26, 71-75, 1977.
*
* Vaduva, I. Computer Generation of Gamma Gandom Variables by Rejection
* and Composition Procedures. Math. Operationsforschung and Statistik,
* Series in Statistics, 8, 545-576, 1977.
*
* Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag,
* New York, 1986, Ch. IX, Sect. 3.4 (+ Errata!).
*/
template<typename _RealType>
template<class _UniformRandomNumberGenerator>
typename gamma_distribution<_RealType>::result_type
gamma_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __x;
bool __reject;
if (_M_alpha >= 1)
{
// alpha - log(4)
const result_type __b = _M_alpha
- result_type(1.3862943611198906188344642429163531L);
const result_type __c = _M_alpha + _M_l_d;
const result_type __1l = 1 / _M_l_d;
// 1 + log(9 / 2)
const result_type __k = 2.5040773967762740733732583523868748L;
do
{
const result_type __u = __urng();
const result_type __v = __urng();
const result_type __y = __1l * std::log(__v / (1 - __v));
__x = _M_alpha * std::exp(__y);
const result_type __z = __u * __v * __v;
const result_type __r = __b + __c * __y - __x;
__reject = __r < result_type(4.5) * __z - __k;
if (__reject)
__reject = __r < std::log(__z);
}
while (__reject);
}
else
{
const result_type __c = 1 / _M_alpha;
do
{
const result_type __z = -std::log(__urng());
const result_type __e = -std::log(__urng());
__x = std::pow(__z, __c);
__reject = __z + __e < _M_l_d + __x;
}
while (__reject);
}
return __x;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const gamma_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
__os << __x.alpha();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif
// TR1 climits -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/climits
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CLIMITS
#define _GLIBCXX_TR1_CLIMITS 1
#include <climits>
#ifndef LLONG_MIN
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
#endif
#ifndef LLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__
#endif
#ifndef ULLONG_MAX
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif
#endif // _GLIBCXX_TR1_CLIMITS
// TR1 functional header -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/functional
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_FUNCTIONAL
#define _GLIBCXX_TR1_FUNCTIONAL 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/stl_function.h>
#include <typeinfo>
#include <new>
#include <tr1/tuple>
#include <tr1/type_traits>
#include <bits/stringfwd.h>
#include <tr1/functional_hash.h>
#include <ext/type_traits.h>
#include <bits/move.h> // for std::__addressof
#if __cplusplus >= 201103L
# include <type_traits> // for integral_constant, true_type, false_type
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L
template<int> struct _Placeholder;
template<typename> class _Bind;
template<typename, typename> class _Bind_result;
#endif
namespace tr1
{
template<typename _MemberPointer>
class _Mem_fn;
template<typename _Tp, typename _Class>
_Mem_fn<_Tp _Class::*>
mem_fn(_Tp _Class::*);
/**
* Actual implementation of _Has_result_type, which uses SFINAE to
* determine if the type _Tp has a publicly-accessible member type
* result_type.
*/
template<typename _Tp>
class _Has_result_type_helper : __sfinae_types
{
template<typename _Up>
struct _Wrap_type
{ };
template<typename _Up>
static __one __test(_Wrap_type<typename _Up::result_type>*);
template<typename _Up>
static __two __test(...);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template<typename _Tp>
struct _Has_result_type
: integral_constant<bool,
_Has_result_type_helper<typename remove_cv<_Tp>::type>::value>
{ };
/**
*
*/
/// If we have found a result_type, extract it.
template<bool _Has_result_type, typename _Functor>
struct _Maybe_get_result_type
{ };
template<typename _Functor>
struct _Maybe_get_result_type<true, _Functor>
{
typedef typename _Functor::result_type result_type;
};
/**
* Base class for any function object that has a weak result type, as
* defined in 3.3/3 of TR1.
*/
template<typename _Functor>
struct _Weak_result_type_impl
: _Maybe_get_result_type<_Has_result_type<_Functor>::value, _Functor>
{
};
/// Retrieve the result type for a function type.
template<typename _Res, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res(_ArgTypes...)>
{
typedef _Res result_type;
};
/// Retrieve the result type for a function reference.
template<typename _Res, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res(&)(_ArgTypes...)>
{
typedef _Res result_type;
};
/// Retrieve the result type for a function pointer.
template<typename _Res, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res(*)(_ArgTypes...)>
{
typedef _Res result_type;
};
/// Retrieve result type for a member function pointer.
template<typename _Res, typename _Class, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)>
{
typedef _Res result_type;
};
/// Retrieve result type for a const member function pointer.
template<typename _Res, typename _Class, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const>
{
typedef _Res result_type;
};
/// Retrieve result type for a volatile member function pointer.
template<typename _Res, typename _Class, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile>
{
typedef _Res result_type;
};
/// Retrieve result type for a const volatile member function pointer.
template<typename _Res, typename _Class, typename... _ArgTypes>
struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)const volatile>
{
typedef _Res result_type;
};
/**
* Strip top-level cv-qualifiers from the function object and let
* _Weak_result_type_impl perform the real work.
*/
template<typename _Functor>
struct _Weak_result_type
: _Weak_result_type_impl<typename remove_cv<_Functor>::type>
{
};
template<typename _Signature>
class result_of;
/**
* Actual implementation of result_of. When _Has_result_type is
* true, gets its result from _Weak_result_type. Otherwise, uses
* the function object's member template result to extract the
* result type.
*/
template<bool _Has_result_type, typename _Signature>
struct _Result_of_impl;
// Handle member data pointers using _Mem_fn's logic
template<typename _Res, typename _Class, typename _T1>
struct _Result_of_impl<false, _Res _Class::*(_T1)>
{
typedef typename _Mem_fn<_Res _Class::*>
::template _Result_type<_T1>::type type;
};
/**
* Determine whether we can determine a result type from @c Functor
* alone.
*/
template<typename _Functor, typename... _ArgTypes>
class result_of<_Functor(_ArgTypes...)>
: public _Result_of_impl<
_Has_result_type<_Weak_result_type<_Functor> >::value,
_Functor(_ArgTypes...)>
{
};
/// We already know the result type for @c Functor; use it.
template<typename _Functor, typename... _ArgTypes>
struct _Result_of_impl<true, _Functor(_ArgTypes...)>
{
typedef typename _Weak_result_type<_Functor>::result_type type;
};
/**
* We need to compute the result type for this invocation the hard
* way.
*/
template<typename _Functor, typename... _ArgTypes>
struct _Result_of_impl<false, _Functor(_ArgTypes...)>
{
typedef typename _Functor
::template result<_Functor(_ArgTypes...)>::type type;
};
/**
* It is unsafe to access ::result when there are zero arguments, so we
* return @c void instead.
*/
template<typename _Functor>
struct _Result_of_impl<false, _Functor()>
{
typedef void type;
};
/// Determines if the type _Tp derives from unary_function.
template<typename _Tp>
struct _Derives_from_unary_function : __sfinae_types
{
private:
template<typename _T1, typename _Res>
static __one __test(const volatile unary_function<_T1, _Res>*);
// It's tempting to change "..." to const volatile void*, but
// that fails when _Tp is a function type.
static __two __test(...);
public:
static const bool value = sizeof(__test((_Tp*)0)) == 1;
};
/// Determines if the type _Tp derives from binary_function.
template<typename _Tp>
struct _Derives_from_binary_function : __sfinae_types
{
private:
template<typename _T1, typename _T2, typename _Res>
static __one __test(const volatile binary_function<_T1, _T2, _Res>*);
// It's tempting to change "..." to const volatile void*, but
// that fails when _Tp is a function type.
static __two __test(...);
public:
static const bool value = sizeof(__test((_Tp*)0)) == 1;
};
/// Turns a function type into a function pointer type
template<typename _Tp, bool _IsFunctionType = is_function<_Tp>::value>
struct _Function_to_function_pointer
{
typedef _Tp type;
};
template<typename _Tp>
struct _Function_to_function_pointer<_Tp, true>
{
typedef _Tp* type;
};
/**
* Invoke a function object, which may be either a member pointer or a
* function object. The first parameter will tell which.
*/
template<typename _Functor, typename... _Args>
inline
typename __gnu_cxx::__enable_if<
(!is_member_pointer<_Functor>::value
&& !is_function<_Functor>::value
&& !is_function<typename remove_pointer<_Functor>::type>::value),
typename result_of<_Functor(_Args...)>::type
>::__type
__invoke(_Functor& __f, _Args&... __args)
{
return __f(__args...);
}
template<typename _Functor, typename... _Args>
inline
typename __gnu_cxx::__enable_if<
(is_member_pointer<_Functor>::value
&& !is_function<_Functor>::value
&& !is_function<typename remove_pointer<_Functor>::type>::value),
typename result_of<_Functor(_Args...)>::type
>::__type
__invoke(_Functor& __f, _Args&... __args)
{
return mem_fn(__f)(__args...);
}
// To pick up function references (that will become function pointers)
template<typename _Functor, typename... _Args>
inline
typename __gnu_cxx::__enable_if<
(is_pointer<_Functor>::value
&& is_function<typename remove_pointer<_Functor>::type>::value),
typename result_of<_Functor(_Args...)>::type
>::__type
__invoke(_Functor __f, _Args&... __args)
{
return __f(__args...);
}
/**
* Knowing which of unary_function and binary_function _Tp derives
* from, derives from the same and ensures that reference_wrapper
* will have a weak result type. See cases below.
*/
template<bool _Unary, bool _Binary, typename _Tp>
struct _Reference_wrapper_base_impl;
// Not a unary_function or binary_function, so try a weak result type.
template<typename _Tp>
struct _Reference_wrapper_base_impl<false, false, _Tp>
: _Weak_result_type<_Tp>
{ };
// unary_function but not binary_function
template<typename _Tp>
struct _Reference_wrapper_base_impl<true, false, _Tp>
: unary_function<typename _Tp::argument_type,
typename _Tp::result_type>
{ };
// binary_function but not unary_function
template<typename _Tp>
struct _Reference_wrapper_base_impl<false, true, _Tp>
: binary_function<typename _Tp::first_argument_type,
typename _Tp::second_argument_type,
typename _Tp::result_type>
{ };
// Both unary_function and binary_function. Import result_type to
// avoid conflicts.
template<typename _Tp>
struct _Reference_wrapper_base_impl<true, true, _Tp>
: unary_function<typename _Tp::argument_type,
typename _Tp::result_type>,
binary_function<typename _Tp::first_argument_type,
typename _Tp::second_argument_type,
typename _Tp::result_type>
{
typedef typename _Tp::result_type result_type;
};
/**
* Derives from unary_function or binary_function when it
* can. Specializations handle all of the easy cases. The primary
* template determines what to do with a class type, which may
* derive from both unary_function and binary_function.
*/
template<typename _Tp>
struct _Reference_wrapper_base
: _Reference_wrapper_base_impl<
_Derives_from_unary_function<_Tp>::value,
_Derives_from_binary_function<_Tp>::value,
_Tp>
{ };
// - a function type (unary)
template<typename _Res, typename _T1>
struct _Reference_wrapper_base<_Res(_T1)>
: unary_function<_T1, _Res>
{ };
// - a function type (binary)
template<typename _Res, typename _T1, typename _T2>
struct _Reference_wrapper_base<_Res(_T1, _T2)>
: binary_function<_T1, _T2, _Res>
{ };
// - a function pointer type (unary)
template<typename _Res, typename _T1>
struct _Reference_wrapper_base<_Res(*)(_T1)>
: unary_function<_T1, _Res>
{ };
// - a function pointer type (binary)
template<typename _Res, typename _T1, typename _T2>
struct _Reference_wrapper_base<_Res(*)(_T1, _T2)>
: binary_function<_T1, _T2, _Res>
{ };
// - a pointer to member function type (unary, no qualifiers)
template<typename _Res, typename _T1>
struct _Reference_wrapper_base<_Res (_T1::*)()>
: unary_function<_T1*, _Res>
{ };
// - a pointer to member function type (binary, no qualifiers)
template<typename _Res, typename _T1, typename _T2>
struct _Reference_wrapper_base<_Res (_T1::*)(_T2)>
: binary_function<_T1*, _T2, _Res>
{ };
// - a pointer to member function type (unary, const)
template<typename _Res, typename _T1>
struct _Reference_wrapper_base<_Res (_T1::*)() const>
: unary_function<const _T1*, _Res>
{ };
// - a pointer to member function type (binary, const)
template<typename _Res, typename _T1, typename _T2>
struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const>
: binary_function<const _T1*, _T2, _Res>
{ };
// - a pointer to member function type (unary, volatile)
template<typename _Res, typename _T1>
struct _Reference_wrapper_base<_Res (_T1::*)() volatile>
: unary_function<volatile _T1*, _Res>
{ };
// - a pointer to member function type (binary, volatile)
template<typename _Res, typename _T1, typename _T2>
struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile>
: binary_function<volatile _T1*, _T2, _Res>
{ };
// - a pointer to member function type (unary, const volatile)
template<typename _Res, typename _T1>
struct _Reference_wrapper_base<_Res (_T1::*)() const volatile>
: unary_function<const volatile _T1*, _Res>
{ };
// - a pointer to member function type (binary, const volatile)
template<typename _Res, typename _T1, typename _T2>
struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile>
: binary_function<const volatile _T1*, _T2, _Res>
{ };
/// reference_wrapper
template<typename _Tp>
class reference_wrapper
: public _Reference_wrapper_base<typename remove_cv<_Tp>::type>
{
// If _Tp is a function type, we can't form result_of<_Tp(...)>,
// so turn it into a function pointer type.
typedef typename _Function_to_function_pointer<_Tp>::type
_M_func_type;
_Tp* _M_data;
public:
typedef _Tp type;
explicit
reference_wrapper(_Tp& __indata)
: _M_data(std::__addressof(__indata))
{ }
reference_wrapper(const reference_wrapper<_Tp>& __inref):
_M_data(__inref._M_data)
{ }
reference_wrapper&
operator=(const reference_wrapper<_Tp>& __inref)
{
_M_data = __inref._M_data;
return *this;
}
operator _Tp&() const
{ return this->get(); }
_Tp&
get() const
{ return *_M_data; }
template<typename... _Args>
typename result_of<_M_func_type(_Args...)>::type
operator()(_Args&... __args) const
{
return __invoke(get(), __args...);
}
};
// Denotes a reference should be taken to a variable.
template<typename _Tp>
inline reference_wrapper<_Tp>
ref(_Tp& __t)
{ return reference_wrapper<_Tp>(__t); }
// Denotes a const reference should be taken to a variable.
template<typename _Tp>
inline reference_wrapper<const _Tp>
cref(const _Tp& __t)
{ return reference_wrapper<const _Tp>(__t); }
template<typename _Tp>
inline reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t)
{ return ref(__t.get()); }
template<typename _Tp>
inline reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t)
{ return cref(__t.get()); }
template<typename _Tp, bool>
struct _Mem_fn_const_or_non
{
typedef const _Tp& type;
};
template<typename _Tp>
struct _Mem_fn_const_or_non<_Tp, false>
{
typedef _Tp& type;
};
/**
* Derives from @c unary_function or @c binary_function, or perhaps
* nothing, depending on the number of arguments provided. The
* primary template is the basis case, which derives nothing.
*/
template<typename _Res, typename... _ArgTypes>
struct _Maybe_unary_or_binary_function { };
/// Derives from @c unary_function, as appropriate.
template<typename _Res, typename _T1>
struct _Maybe_unary_or_binary_function<_Res, _T1>
: std::unary_function<_T1, _Res> { };
/// Derives from @c binary_function, as appropriate.
template<typename _Res, typename _T1, typename _T2>
struct _Maybe_unary_or_binary_function<_Res, _T1, _T2>
: std::binary_function<_T1, _T2, _Res> { };
/// Implementation of @c mem_fn for member function pointers.
template<typename _Res, typename _Class, typename... _ArgTypes>
class _Mem_fn<_Res (_Class::*)(_ArgTypes...)>
: public _Maybe_unary_or_binary_function<_Res, _Class*, _ArgTypes...>
{
typedef _Res (_Class::*_Functor)(_ArgTypes...);
template<typename _Tp>
_Res
_M_call(_Tp& __object, const volatile _Class *,
_ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
template<typename _Tp>
_Res
_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
{ return ((*__ptr).*__pmf)(__args...); }
public:
typedef _Res result_type;
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
// Handle objects
_Res
operator()(_Class& __object, _ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
// Handle pointers
_Res
operator()(_Class* __object, _ArgTypes... __args) const
{ return (__object->*__pmf)(__args...); }
// Handle smart pointers, references and pointers to derived
template<typename _Tp>
_Res
operator()(_Tp& __object, _ArgTypes... __args) const
{ return _M_call(__object, &__object, __args...); }
private:
_Functor __pmf;
};
/// Implementation of @c mem_fn for const member function pointers.
template<typename _Res, typename _Class, typename... _ArgTypes>
class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const>
: public _Maybe_unary_or_binary_function<_Res, const _Class*,
_ArgTypes...>
{
typedef _Res (_Class::*_Functor)(_ArgTypes...) const;
template<typename _Tp>
_Res
_M_call(_Tp& __object, const volatile _Class *,
_ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
template<typename _Tp>
_Res
_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
{ return ((*__ptr).*__pmf)(__args...); }
public:
typedef _Res result_type;
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
// Handle objects
_Res
operator()(const _Class& __object, _ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
// Handle pointers
_Res
operator()(const _Class* __object, _ArgTypes... __args) const
{ return (__object->*__pmf)(__args...); }
// Handle smart pointers, references and pointers to derived
template<typename _Tp>
_Res operator()(_Tp& __object, _ArgTypes... __args) const
{ return _M_call(__object, &__object, __args...); }
private:
_Functor __pmf;
};
/// Implementation of @c mem_fn for volatile member function pointers.
template<typename _Res, typename _Class, typename... _ArgTypes>
class _Mem_fn<_Res (_Class::*)(_ArgTypes...) volatile>
: public _Maybe_unary_or_binary_function<_Res, volatile _Class*,
_ArgTypes...>
{
typedef _Res (_Class::*_Functor)(_ArgTypes...) volatile;
template<typename _Tp>
_Res
_M_call(_Tp& __object, const volatile _Class *,
_ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
template<typename _Tp>
_Res
_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
{ return ((*__ptr).*__pmf)(__args...); }
public:
typedef _Res result_type;
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
// Handle objects
_Res
operator()(volatile _Class& __object, _ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
// Handle pointers
_Res
operator()(volatile _Class* __object, _ArgTypes... __args) const
{ return (__object->*__pmf)(__args...); }
// Handle smart pointers, references and pointers to derived
template<typename _Tp>
_Res
operator()(_Tp& __object, _ArgTypes... __args) const
{ return _M_call(__object, &__object, __args...); }
private:
_Functor __pmf;
};
/// Implementation of @c mem_fn for const volatile member function pointers.
template<typename _Res, typename _Class, typename... _ArgTypes>
class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const volatile>
: public _Maybe_unary_or_binary_function<_Res, const volatile _Class*,
_ArgTypes...>
{
typedef _Res (_Class::*_Functor)(_ArgTypes...) const volatile;
template<typename _Tp>
_Res
_M_call(_Tp& __object, const volatile _Class *,
_ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
template<typename _Tp>
_Res
_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
{ return ((*__ptr).*__pmf)(__args...); }
public:
typedef _Res result_type;
explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
// Handle objects
_Res
operator()(const volatile _Class& __object, _ArgTypes... __args) const
{ return (__object.*__pmf)(__args...); }
// Handle pointers
_Res
operator()(const volatile _Class* __object, _ArgTypes... __args) const
{ return (__object->*__pmf)(__args...); }
// Handle smart pointers, references and pointers to derived
template<typename _Tp>
_Res operator()(_Tp& __object, _ArgTypes... __args) const
{ return _M_call(__object, &__object, __args...); }
private:
_Functor __pmf;
};
template<typename _Res, typename _Class>
class _Mem_fn<_Res _Class::*>
{
// This bit of genius is due to Peter Dimov, improved slightly by
// Douglas Gregor.
template<typename _Tp>
_Res&
_M_call(_Tp& __object, _Class *) const
{ return __object.*__pm; }
template<typename _Tp, typename _Up>
_Res&
_M_call(_Tp& __object, _Up * const *) const
{ return (*__object).*__pm; }
template<typename _Tp, typename _Up>
const _Res&
_M_call(_Tp& __object, const _Up * const *) const
{ return (*__object).*__pm; }
template<typename _Tp>
const _Res&
_M_call(_Tp& __object, const _Class *) const
{ return __object.*__pm; }
template<typename _Tp>
const _Res&
_M_call(_Tp& __ptr, const volatile void*) const
{ return (*__ptr).*__pm; }
template<typename _Tp> static _Tp& __get_ref();
template<typename _Tp>
static __sfinae_types::__one __check_const(_Tp&, _Class*);
template<typename _Tp, typename _Up>
static __sfinae_types::__one __check_const(_Tp&, _Up * const *);
template<typename _Tp, typename _Up>
static __sfinae_types::__two __check_const(_Tp&, const _Up * const *);
template<typename _Tp>
static __sfinae_types::__two __check_const(_Tp&, const _Class*);
template<typename _Tp>
static __sfinae_types::__two __check_const(_Tp&, const volatile void*);
public:
template<typename _Tp>
struct _Result_type
: _Mem_fn_const_or_non<_Res,
(sizeof(__sfinae_types::__two)
== sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))>
{ };
template<typename _Signature>
struct result;
template<typename _CVMem, typename _Tp>
struct result<_CVMem(_Tp)>
: public _Result_type<_Tp> { };
template<typename _CVMem, typename _Tp>
struct result<_CVMem(_Tp&)>
: public _Result_type<_Tp> { };
explicit
_Mem_fn(_Res _Class::*__pm) : __pm(__pm) { }
// Handle objects
_Res&
operator()(_Class& __object) const
{ return __object.*__pm; }
const _Res&
operator()(const _Class& __object) const
{ return __object.*__pm; }
// Handle pointers
_Res&
operator()(_Class* __object) const
{ return __object->*__pm; }
const _Res&
operator()(const _Class* __object) const
{ return __object->*__pm; }
// Handle smart pointers and derived
template<typename _Tp>
typename _Result_type<_Tp>::type
operator()(_Tp& __unknown) const
{ return _M_call(__unknown, &__unknown); }
private:
_Res _Class::*__pm;
};
/**
* @brief Returns a function object that forwards to the member
* pointer @a pm.
*/
template<typename _Tp, typename _Class>
inline _Mem_fn<_Tp _Class::*>
mem_fn(_Tp _Class::* __pm)
{
return _Mem_fn<_Tp _Class::*>(__pm);
}
/**
* @brief Determines if the given type _Tp is a function object
* should be treated as a subexpression when evaluating calls to
* function objects returned by bind(). [TR1 3.6.1]
*/
template<typename _Tp>
struct is_bind_expression
{ static const bool value = false; };
template<typename _Tp>
const bool is_bind_expression<_Tp>::value;
/**
* @brief Determines if the given type _Tp is a placeholder in a
* bind() expression and, if so, which placeholder it is. [TR1 3.6.2]
*/
template<typename _Tp>
struct is_placeholder
{ static const int value = 0; };
template<typename _Tp>
const int is_placeholder<_Tp>::value;
/// The type of placeholder objects defined by libstdc++.
template<int _Num> struct _Placeholder { };
/** @namespace std::tr1::placeholders
* @brief Sub-namespace for tr1/functional.
*/
namespace placeholders
{
/* Define a large number of placeholders. There is no way to
* simplify this with variadic templates, because we're introducing
* unique names for each.
*/
namespace
{
_Placeholder<1> _1;
_Placeholder<2> _2;
_Placeholder<3> _3;
_Placeholder<4> _4;
_Placeholder<5> _5;
_Placeholder<6> _6;
_Placeholder<7> _7;
_Placeholder<8> _8;
_Placeholder<9> _9;
_Placeholder<10> _10;
_Placeholder<11> _11;
_Placeholder<12> _12;
_Placeholder<13> _13;
_Placeholder<14> _14;
_Placeholder<15> _15;
_Placeholder<16> _16;
_Placeholder<17> _17;
_Placeholder<18> _18;
_Placeholder<19> _19;
_Placeholder<20> _20;
_Placeholder<21> _21;
_Placeholder<22> _22;
_Placeholder<23> _23;
_Placeholder<24> _24;
_Placeholder<25> _25;
_Placeholder<26> _26;
_Placeholder<27> _27;
_Placeholder<28> _28;
_Placeholder<29> _29;
}
}
/**
* Partial specialization of is_placeholder that provides the placeholder
* number for the placeholder objects defined by libstdc++.
*/
template<int _Num>
struct is_placeholder<_Placeholder<_Num> >
{ static const int value = _Num; };
template<int _Num>
const int is_placeholder<_Placeholder<_Num> >::value;
#if __cplusplus >= 201103L
template<int _Num>
struct is_placeholder<std::_Placeholder<_Num>>
: std::integral_constant<int, _Num>
{ };
template<int _Num>
struct is_placeholder<const std::_Placeholder<_Num>>
: std::integral_constant<int, _Num>
{ };
#endif
/**
* Stores a tuple of indices. Used by bind() to extract the elements
* in a tuple.
*/
template<int... _Indexes>
struct _Index_tuple { };
/// Builds an _Index_tuple<0, 1, 2, ..., _Num-1>.
template<std::size_t _Num, typename _Tuple = _Index_tuple<> >
struct _Build_index_tuple;
template<std::size_t _Num, int... _Indexes>
struct _Build_index_tuple<_Num, _Index_tuple<_Indexes...> >
: _Build_index_tuple<_Num - 1,
_Index_tuple<_Indexes..., sizeof...(_Indexes)> >
{
};
template<int... _Indexes>
struct _Build_index_tuple<0, _Index_tuple<_Indexes...> >
{
typedef _Index_tuple<_Indexes...> __type;
};
/**
* Used by _Safe_tuple_element to indicate that there is no tuple
* element at this position.
*/
struct _No_tuple_element;
/**
* Implementation helper for _Safe_tuple_element. This primary
* template handles the case where it is safe to use @c
* tuple_element.
*/
template<int __i, typename _Tuple, bool _IsSafe>
struct _Safe_tuple_element_impl
: tuple_element<__i, _Tuple> { };
/**
* Implementation helper for _Safe_tuple_element. This partial
* specialization handles the case where it is not safe to use @c
* tuple_element. We just return @c _No_tuple_element.
*/
template<int __i, typename _Tuple>
struct _Safe_tuple_element_impl<__i, _Tuple, false>
{
typedef _No_tuple_element type;
};
/**
* Like tuple_element, but returns @c _No_tuple_element when
* tuple_element would return an error.
*/
template<int __i, typename _Tuple>
struct _Safe_tuple_element
: _Safe_tuple_element_impl<__i, _Tuple,
(__i >= 0 && __i < tuple_size<_Tuple>::value)>
{
};
/**
* Maps an argument to bind() into an actual argument to the bound
* function object [TR1 3.6.3/5]. Only the first parameter should
* be specified: the rest are used to determine among the various
* implementations. Note that, although this class is a function
* object, it isn't entirely normal because it takes only two
* parameters regardless of the number of parameters passed to the
* bind expression. The first parameter is the bound argument and
* the second parameter is a tuple containing references to the
* rest of the arguments.
*/
template<typename _Arg,
bool _IsBindExp = is_bind_expression<_Arg>::value,
bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)>
class _Mu;
/**
* If the argument is reference_wrapper<_Tp>, returns the
* underlying reference. [TR1 3.6.3/5 bullet 1]
*/
template<typename _Tp>
class _Mu<reference_wrapper<_Tp>, false, false>
{
public:
typedef _Tp& result_type;
/* Note: This won't actually work for const volatile
* reference_wrappers, because reference_wrapper::get() is const
* but not volatile-qualified. This might be a defect in the TR.
*/
template<typename _CVRef, typename _Tuple>
result_type
operator()(_CVRef& __arg, const _Tuple&) const volatile
{ return __arg.get(); }
};
/**
* If the argument is a bind expression, we invoke the underlying
* function object with the same cv-qualifiers as we are given and
* pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2]
*/
template<typename _Arg>
class _Mu<_Arg, true, false>
{
public:
template<typename _Signature> class result;
// Determine the result type when we pass the arguments along. This
// involves passing along the cv-qualifiers placed on _Mu and
// unwrapping the argument bundle.
template<typename _CVMu, typename _CVArg, typename... _Args>
class result<_CVMu(_CVArg, tuple<_Args...>)>
: public result_of<_CVArg(_Args...)> { };
template<typename _CVArg, typename... _Args>
typename result_of<_CVArg(_Args...)>::type
operator()(_CVArg& __arg,
const tuple<_Args...>& __tuple) const volatile
{
// Construct an index tuple and forward to __call
typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
_Indexes;
return this->__call(__arg, __tuple, _Indexes());
}
private:
// Invokes the underlying function object __arg by unpacking all
// of the arguments in the tuple.
template<typename _CVArg, typename... _Args, int... _Indexes>
typename result_of<_CVArg(_Args...)>::type
__call(_CVArg& __arg, const tuple<_Args...>& __tuple,
const _Index_tuple<_Indexes...>&) const volatile
{
return __arg(tr1::get<_Indexes>(__tuple)...);
}
};
/**
* If the argument is a placeholder for the Nth argument, returns
* a reference to the Nth argument to the bind function object.
* [TR1 3.6.3/5 bullet 3]
*/
template<typename _Arg>
class _Mu<_Arg, false, true>
{
public:
template<typename _Signature> class result;
template<typename _CVMu, typename _CVArg, typename _Tuple>
class result<_CVMu(_CVArg, _Tuple)>
{
// Add a reference, if it hasn't already been done for us.
// This allows us to be a little bit sloppy in constructing
// the tuple that we pass to result_of<...>.
typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value
- 1), _Tuple>::type
__base_type;
public:
typedef typename add_reference<__base_type>::type type;
};
template<typename _Tuple>
typename result<_Mu(_Arg, _Tuple)>::type
operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile
{
return ::std::tr1::get<(is_placeholder<_Arg>::value - 1)>(__tuple);
}
};
/**
* If the argument is just a value, returns a reference to that
* value. The cv-qualifiers on the reference are the same as the
* cv-qualifiers on the _Mu object. [TR1 3.6.3/5 bullet 4]
*/
template<typename _Arg>
class _Mu<_Arg, false, false>
{
public:
template<typename _Signature> struct result;
template<typename _CVMu, typename _CVArg, typename _Tuple>
struct result<_CVMu(_CVArg, _Tuple)>
{
typedef typename add_reference<_CVArg>::type type;
};
// Pick up the cv-qualifiers of the argument
template<typename _CVArg, typename _Tuple>
_CVArg&
operator()(_CVArg& __arg, const _Tuple&) const volatile
{ return __arg; }
};
/**
* Maps member pointers into instances of _Mem_fn but leaves all
* other function objects untouched. Used by tr1::bind(). The
* primary template handles the non--member-pointer case.
*/
template<typename _Tp>
struct _Maybe_wrap_member_pointer
{
typedef _Tp type;
static const _Tp&
__do_wrap(const _Tp& __x)
{ return __x; }
};
/**
* Maps member pointers into instances of _Mem_fn but leaves all
* other function objects untouched. Used by tr1::bind(). This
* partial specialization handles the member pointer case.
*/
template<typename _Tp, typename _Class>
struct _Maybe_wrap_member_pointer<_Tp _Class::*>
{
typedef _Mem_fn<_Tp _Class::*> type;
static type
__do_wrap(_Tp _Class::* __pm)
{ return type(__pm); }
};
/// Type of the function object returned from bind().
template<typename _Signature>
struct _Bind;
template<typename _Functor, typename... _Bound_args>
class _Bind<_Functor(_Bound_args...)>
: public _Weak_result_type<_Functor>
{
typedef _Bind __self_type;
typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
_Bound_indexes;
_Functor _M_f;
tuple<_Bound_args...> _M_bound_args;
// Call unqualified
template<typename... _Args, int... _Indexes>
typename result_of<
_Functor(typename result_of<_Mu<_Bound_args>
(_Bound_args, tuple<_Args...>)>::type...)
>::type
__call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>)
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as const
template<typename... _Args, int... _Indexes>
typename result_of<
const _Functor(typename result_of<_Mu<_Bound_args>
(const _Bound_args, tuple<_Args...>)
>::type...)>::type
__call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as volatile
template<typename... _Args, int... _Indexes>
typename result_of<
volatile _Functor(typename result_of<_Mu<_Bound_args>
(volatile _Bound_args, tuple<_Args...>)
>::type...)>::type
__call(const tuple<_Args...>& __args,
_Index_tuple<_Indexes...>) volatile
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as const volatile
template<typename... _Args, int... _Indexes>
typename result_of<
const volatile _Functor(typename result_of<_Mu<_Bound_args>
(const volatile _Bound_args,
tuple<_Args...>)
>::type...)>::type
__call(const tuple<_Args...>& __args,
_Index_tuple<_Indexes...>) const volatile
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
public:
explicit _Bind(_Functor __f, _Bound_args... __bound_args)
: _M_f(__f), _M_bound_args(__bound_args...) { }
// Call unqualified
template<typename... _Args>
typename result_of<
_Functor(typename result_of<_Mu<_Bound_args>
(_Bound_args, tuple<_Args...>)>::type...)
>::type
operator()(_Args&... __args)
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
// Call as const
template<typename... _Args>
typename result_of<
const _Functor(typename result_of<_Mu<_Bound_args>
(const _Bound_args, tuple<_Args...>)>::type...)
>::type
operator()(_Args&... __args) const
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
// Call as volatile
template<typename... _Args>
typename result_of<
volatile _Functor(typename result_of<_Mu<_Bound_args>
(volatile _Bound_args, tuple<_Args...>)>::type...)
>::type
operator()(_Args&... __args) volatile
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
// Call as const volatile
template<typename... _Args>
typename result_of<
const volatile _Functor(typename result_of<_Mu<_Bound_args>
(const volatile _Bound_args,
tuple<_Args...>)>::type...)
>::type
operator()(_Args&... __args) const volatile
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
};
/// Type of the function object returned from bind<R>().
template<typename _Result, typename _Signature>
struct _Bind_result;
template<typename _Result, typename _Functor, typename... _Bound_args>
class _Bind_result<_Result, _Functor(_Bound_args...)>
{
typedef _Bind_result __self_type;
typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
_Bound_indexes;
_Functor _M_f;
tuple<_Bound_args...> _M_bound_args;
// Call unqualified
template<typename... _Args, int... _Indexes>
_Result
__call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>)
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as const
template<typename... _Args, int... _Indexes>
_Result
__call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as volatile
template<typename... _Args, int... _Indexes>
_Result
__call(const tuple<_Args...>& __args,
_Index_tuple<_Indexes...>) volatile
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
// Call as const volatile
template<typename... _Args, int... _Indexes>
_Result
__call(const tuple<_Args...>& __args,
_Index_tuple<_Indexes...>) const volatile
{
return _M_f(_Mu<_Bound_args>()
(tr1::get<_Indexes>(_M_bound_args), __args)...);
}
public:
typedef _Result result_type;
explicit
_Bind_result(_Functor __f, _Bound_args... __bound_args)
: _M_f(__f), _M_bound_args(__bound_args...) { }
// Call unqualified
template<typename... _Args>
result_type
operator()(_Args&... __args)
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
// Call as const
template<typename... _Args>
result_type
operator()(_Args&... __args) const
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
// Call as volatile
template<typename... _Args>
result_type
operator()(_Args&... __args) volatile
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
// Call as const volatile
template<typename... _Args>
result_type
operator()(_Args&... __args) const volatile
{
return this->__call(tr1::tie(__args...), _Bound_indexes());
}
};
/// Class template _Bind is always a bind expression.
template<typename _Signature>
struct is_bind_expression<_Bind<_Signature> >
{ static const bool value = true; };
template<typename _Signature>
const bool is_bind_expression<_Bind<_Signature> >::value;
/// Class template _Bind is always a bind expression.
template<typename _Signature>
struct is_bind_expression<const _Bind<_Signature> >
{ static const bool value = true; };
template<typename _Signature>
const bool is_bind_expression<const _Bind<_Signature> >::value;
/// Class template _Bind is always a bind expression.
template<typename _Signature>
struct is_bind_expression<volatile _Bind<_Signature> >
{ static const bool value = true; };
template<typename _Signature>
const bool is_bind_expression<volatile _Bind<_Signature> >::value;
/// Class template _Bind is always a bind expression.
template<typename _Signature>
struct is_bind_expression<const volatile _Bind<_Signature> >
{ static const bool value = true; };
template<typename _Signature>
const bool is_bind_expression<const volatile _Bind<_Signature> >::value;
/// Class template _Bind_result is always a bind expression.
template<typename _Result, typename _Signature>
struct is_bind_expression<_Bind_result<_Result, _Signature> >
{ static const bool value = true; };
template<typename _Result, typename _Signature>
const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value;
/// Class template _Bind_result is always a bind expression.
template<typename _Result, typename _Signature>
struct is_bind_expression<const _Bind_result<_Result, _Signature> >
{ static const bool value = true; };
template<typename _Result, typename _Signature>
const bool
is_bind_expression<const _Bind_result<_Result, _Signature> >::value;
/// Class template _Bind_result is always a bind expression.
template<typename _Result, typename _Signature>
struct is_bind_expression<volatile _Bind_result<_Result, _Signature> >
{ static const bool value = true; };
template<typename _Result, typename _Signature>
const bool
is_bind_expression<volatile _Bind_result<_Result, _Signature> >::value;
/// Class template _Bind_result is always a bind expression.
template<typename _Result, typename _Signature>
struct
is_bind_expression<const volatile _Bind_result<_Result, _Signature> >
{ static const bool value = true; };
template<typename _Result, typename _Signature>
const bool
is_bind_expression<const volatile _Bind_result<_Result,
_Signature> >::value;
#if __cplusplus >= 201103L
template<typename _Signature>
struct is_bind_expression<std::_Bind<_Signature>>
: true_type { };
template<typename _Signature>
struct is_bind_expression<const std::_Bind<_Signature>>
: true_type { };
template<typename _Signature>
struct is_bind_expression<volatile std::_Bind<_Signature>>
: true_type { };
template<typename _Signature>
struct is_bind_expression<const volatile std::_Bind<_Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<std::_Bind_result<_Result, _Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<const std::_Bind_result<_Result, _Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<volatile std::_Bind_result<_Result, _Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<const volatile std::_Bind_result<_Result,
_Signature>>
: true_type { };
#endif
/// bind
template<typename _Functor, typename... _ArgTypes>
inline
_Bind<typename _Maybe_wrap_member_pointer<_Functor>::type(_ArgTypes...)>
bind(_Functor __f, _ArgTypes... __args)
{
typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type;
typedef typename __maybe_type::type __functor_type;
typedef _Bind<__functor_type(_ArgTypes...)> __result_type;
return __result_type(__maybe_type::__do_wrap(__f), __args...);
}
template<typename _Result, typename _Functor, typename... _ArgTypes>
inline
_Bind_result<_Result,
typename _Maybe_wrap_member_pointer<_Functor>::type
(_ArgTypes...)>
bind(_Functor __f, _ArgTypes... __args)
{
typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type;
typedef typename __maybe_type::type __functor_type;
typedef _Bind_result<_Result, __functor_type(_ArgTypes...)>
__result_type;
return __result_type(__maybe_type::__do_wrap(__f), __args...);
}
/**
* @brief Exception class thrown when class template function's
* operator() is called with an empty target.
* @ingroup exceptions
*/
class bad_function_call : public std::exception { };
/**
* The integral constant expression 0 can be converted into a
* pointer to this type. It is used by the function template to
* accept NULL pointers.
*/
struct _M_clear_type;
/**
* Trait identifying @a location-invariant types, meaning that the
* address of the object (or any of its members) will not escape.
* Also implies a trivial copy constructor and assignment operator.
*/
template<typename _Tp>
struct __is_location_invariant
: integral_constant<bool,
(is_pointer<_Tp>::value
|| is_member_pointer<_Tp>::value)>
{
};
class _Undefined_class;
union _Nocopy_types
{
void* _M_object;
const void* _M_const_object;
void (*_M_function_pointer)();
void (_Undefined_class::*_M_member_pointer)();
};
union _Any_data
{
void* _M_access() { return &_M_pod_data[0]; }
const void* _M_access() const { return &_M_pod_data[0]; }
template<typename _Tp>
_Tp&
_M_access()
{ return *static_cast<_Tp*>(_M_access()); }
template<typename _Tp>
const _Tp&
_M_access() const
{ return *static_cast<const _Tp*>(_M_access()); }
_Nocopy_types _M_unused;
char _M_pod_data[sizeof(_Nocopy_types)];
};
enum _Manager_operation
{
__get_type_info,
__get_functor_ptr,
__clone_functor,
__destroy_functor
};
// Simple type wrapper that helps avoid annoying const problems
// when casting between void pointers and pointers-to-pointers.
template<typename _Tp>
struct _Simple_type_wrapper
{
_Simple_type_wrapper(_Tp __value) : __value(__value) { }
_Tp __value;
};
template<typename _Tp>
struct __is_location_invariant<_Simple_type_wrapper<_Tp> >
: __is_location_invariant<_Tp>
{
};
// Converts a reference to a function object into a callable
// function object.
template<typename _Functor>
inline _Functor&
__callable_functor(_Functor& __f)
{ return __f; }
template<typename _Member, typename _Class>
inline _Mem_fn<_Member _Class::*>
__callable_functor(_Member _Class::* &__p)
{ return mem_fn(__p); }
template<typename _Member, typename _Class>
inline _Mem_fn<_Member _Class::*>
__callable_functor(_Member _Class::* const &__p)
{ return mem_fn(__p); }
template<typename _Signature>
class function;
/// Base class of all polymorphic function object wrappers.
class _Function_base
{
public:
static const std::size_t _M_max_size = sizeof(_Nocopy_types);
static const std::size_t _M_max_align = __alignof__(_Nocopy_types);
template<typename _Functor>
class _Base_manager
{
protected:
static const bool __stored_locally =
(__is_location_invariant<_Functor>::value
&& sizeof(_Functor) <= _M_max_size
&& __alignof__(_Functor) <= _M_max_align
&& (_M_max_align % __alignof__(_Functor) == 0));
typedef integral_constant<bool, __stored_locally> _Local_storage;
// Retrieve a pointer to the function object
static _Functor*
_M_get_pointer(const _Any_data& __source)
{
const _Functor* __ptr =
__stored_locally? std::__addressof(__source._M_access<_Functor>())
/* have stored a pointer */ : __source._M_access<_Functor*>();
return const_cast<_Functor*>(__ptr);
}
// Clone a location-invariant function object that fits within
// an _Any_data structure.
static void
_M_clone(_Any_data& __dest, const _Any_data& __source, true_type)
{
new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
}
// Clone a function object that is not location-invariant or
// that cannot fit into an _Any_data structure.
static void
_M_clone(_Any_data& __dest, const _Any_data& __source, false_type)
{
__dest._M_access<_Functor*>() =
new _Functor(*__source._M_access<_Functor*>());
}
// Destroying a location-invariant object may still require
// destruction.
static void
_M_destroy(_Any_data& __victim, true_type)
{
__victim._M_access<_Functor>().~_Functor();
}
// Destroying an object located on the heap.
static void
_M_destroy(_Any_data& __victim, false_type)
{
delete __victim._M_access<_Functor*>();
}
public:
static bool
_M_manager(_Any_data& __dest, const _Any_data& __source,
_Manager_operation __op)
{
switch (__op)
{
#if __cpp_rtti
case __get_type_info:
__dest._M_access<const type_info*>() = &typeid(_Functor);
break;
#endif
case __get_functor_ptr:
__dest._M_access<_Functor*>() = _M_get_pointer(__source);
break;
case __clone_functor:
_M_clone(__dest, __source, _Local_storage());
break;
case __destroy_functor:
_M_destroy(__dest, _Local_storage());
break;
}
return false;
}
static void
_M_init_functor(_Any_data& __functor, const _Functor& __f)
{ _M_init_functor(__functor, __f, _Local_storage()); }
template<typename _Signature>
static bool
_M_not_empty_function(const function<_Signature>& __f)
{ return static_cast<bool>(__f); }
template<typename _Tp>
static bool
_M_not_empty_function(const _Tp*& __fp)
{ return __fp; }
template<typename _Class, typename _Tp>
static bool
_M_not_empty_function(_Tp _Class::* const& __mp)
{ return __mp; }
template<typename _Tp>
static bool
_M_not_empty_function(const _Tp&)
{ return true; }
private:
static void
_M_init_functor(_Any_data& __functor, const _Functor& __f, true_type)
{ new (__functor._M_access()) _Functor(__f); }
static void
_M_init_functor(_Any_data& __functor, const _Functor& __f, false_type)
{ __functor._M_access<_Functor*>() = new _Functor(__f); }
};
template<typename _Functor>
class _Ref_manager : public _Base_manager<_Functor*>
{
typedef _Function_base::_Base_manager<_Functor*> _Base;
public:
static bool
_M_manager(_Any_data& __dest, const _Any_data& __source,
_Manager_operation __op)
{
switch (__op)
{
#if __cpp_rtti
case __get_type_info:
__dest._M_access<const type_info*>() = &typeid(_Functor);
break;
#endif
case __get_functor_ptr:
__dest._M_access<_Functor*>() = *_Base::_M_get_pointer(__source);
return is_const<_Functor>::value;
break;
default:
_Base::_M_manager(__dest, __source, __op);
}
return false;
}
static void
_M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f)
{
_Base::_M_init_functor(__functor, std::__addressof(__f.get()));
}
};
_Function_base() : _M_manager(0) { }
~_Function_base()
{
if (_M_manager)
_M_manager(_M_functor, _M_functor, __destroy_functor);
}
bool _M_empty() const { return !_M_manager; }
typedef bool (*_Manager_type)(_Any_data&, const _Any_data&,
_Manager_operation);
_Any_data _M_functor;
_Manager_type _M_manager;
};
template<typename _Signature, typename _Functor>
class _Function_handler;
template<typename _Res, typename _Functor, typename... _ArgTypes>
class _Function_handler<_Res(_ArgTypes...), _Functor>
: public _Function_base::_Base_manager<_Functor>
{
typedef _Function_base::_Base_manager<_Functor> _Base;
public:
static _Res
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
{
return (*_Base::_M_get_pointer(__functor))(__args...);
}
};
template<typename _Functor, typename... _ArgTypes>
class _Function_handler<void(_ArgTypes...), _Functor>
: public _Function_base::_Base_manager<_Functor>
{
typedef _Function_base::_Base_manager<_Functor> _Base;
public:
static void
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
{
(*_Base::_M_get_pointer(__functor))(__args...);
}
};
template<typename _Res, typename _Functor, typename... _ArgTypes>
class _Function_handler<_Res(_ArgTypes...), reference_wrapper<_Functor> >
: public _Function_base::_Ref_manager<_Functor>
{
typedef _Function_base::_Ref_manager<_Functor> _Base;
public:
static _Res
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
{
return
__callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
}
};
template<typename _Functor, typename... _ArgTypes>
class _Function_handler<void(_ArgTypes...), reference_wrapper<_Functor> >
: public _Function_base::_Ref_manager<_Functor>
{
typedef _Function_base::_Ref_manager<_Functor> _Base;
public:
static void
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
{
__callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
}
};
template<typename _Class, typename _Member, typename _Res,
typename... _ArgTypes>
class _Function_handler<_Res(_ArgTypes...), _Member _Class::*>
: public _Function_handler<void(_ArgTypes...), _Member _Class::*>
{
typedef _Function_handler<void(_ArgTypes...), _Member _Class::*>
_Base;
public:
static _Res
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
{
return tr1::
mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
}
};
template<typename _Class, typename _Member, typename... _ArgTypes>
class _Function_handler<void(_ArgTypes...), _Member _Class::*>
: public _Function_base::_Base_manager<
_Simple_type_wrapper< _Member _Class::* > >
{
typedef _Member _Class::* _Functor;
typedef _Simple_type_wrapper<_Functor> _Wrapper;
typedef _Function_base::_Base_manager<_Wrapper> _Base;
public:
static bool
_M_manager(_Any_data& __dest, const _Any_data& __source,
_Manager_operation __op)
{
switch (__op)
{
#if __cpp_rtti
case __get_type_info:
__dest._M_access<const type_info*>() = &typeid(_Functor);
break;
#endif
case __get_functor_ptr:
__dest._M_access<_Functor*>() =
&_Base::_M_get_pointer(__source)->__value;
break;
default:
_Base::_M_manager(__dest, __source, __op);
}
return false;
}
static void
_M_invoke(const _Any_data& __functor, _ArgTypes... __args)
{
tr1::mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
}
};
/// class function
template<typename _Res, typename... _ArgTypes>
class function<_Res(_ArgTypes...)>
: public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>,
private _Function_base
{
#if __cplusplus < 201103L
/// This class is used to implement the safe_bool idiom.
struct _Hidden_type
{
_Hidden_type* _M_bool;
};
/// This typedef is used to implement the safe_bool idiom.
typedef _Hidden_type* _Hidden_type::* _Safe_bool;
#endif
typedef _Res _Signature_type(_ArgTypes...);
struct _Useless { };
public:
typedef _Res result_type;
// [3.7.2.1] construct/copy/destroy
/**
* @brief Default construct creates an empty function call wrapper.
* @post @c !(bool)*this
*/
function() : _Function_base() { }
/**
* @brief Default construct creates an empty function call wrapper.
* @post @c !(bool)*this
*/
function(_M_clear_type*) : _Function_base() { }
/**
* @brief %Function copy constructor.
* @param x A %function object with identical call signature.
* @post @c (bool)*this == (bool)x
*
* The newly-created %function contains a copy of the target of @a
* x (if it has one).
*/
function(const function& __x);
/**
* @brief Builds a %function that targets a copy of the incoming
* function object.
* @param f A %function object that is callable with parameters of
* type @c T1, @c T2, ..., @c TN and returns a value convertible
* to @c Res.
*
* The newly-created %function object will target a copy of @a
* f. If @a f is @c reference_wrapper<F>, then this function
* object will contain a reference to the function object @c
* f.get(). If @a f is a NULL function pointer or NULL
* pointer-to-member, the newly-created object will be empty.
*
* If @a f is a non-NULL function pointer or an object of type @c
* reference_wrapper<F>, this function will not throw.
*/
template<typename _Functor>
function(_Functor __f,
typename __gnu_cxx::__enable_if<
!is_integral<_Functor>::value, _Useless>::__type
= _Useless());
/**
* @brief %Function assignment operator.
* @param x A %function with identical call signature.
* @post @c (bool)*this == (bool)x
* @returns @c *this
*
* The target of @a x is copied to @c *this. If @a x has no
* target, then @c *this will be empty.
*
* If @a x targets a function pointer or a reference to a function
* object, then this operation will not throw an %exception.
*/
function&
operator=(const function& __x)
{
function(__x).swap(*this);
return *this;
}
/**
* @brief %Function assignment to zero.
* @post @c !(bool)*this
* @returns @c *this
*
* The target of @c *this is deallocated, leaving it empty.
*/
function&
operator=(_M_clear_type*)
{
if (_M_manager)
{
_M_manager(_M_functor, _M_functor, __destroy_functor);
_M_manager = 0;
_M_invoker = 0;
}
return *this;
}
/**
* @brief %Function assignment to a new target.
* @param f A %function object that is callable with parameters of
* type @c T1, @c T2, ..., @c TN and returns a value convertible
* to @c Res.
* @return @c *this
*
* This %function object wrapper will target a copy of @a
* f. If @a f is @c reference_wrapper<F>, then this function
* object will contain a reference to the function object @c
* f.get(). If @a f is a NULL function pointer or NULL
* pointer-to-member, @c this object will be empty.
*
* If @a f is a non-NULL function pointer or an object of type @c
* reference_wrapper<F>, this function will not throw.
*/
template<typename _Functor>
typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value,
function&>::__type
operator=(_Functor __f)
{
function(__f).swap(*this);
return *this;
}
// [3.7.2.2] function modifiers
/**
* @brief Swap the targets of two %function objects.
* @param f A %function with identical call signature.
*
* Swap the targets of @c this function object and @a f. This
* function will not throw an %exception.
*/
void swap(function& __x)
{
std::swap(_M_functor, __x._M_functor);
std::swap(_M_manager, __x._M_manager);
std::swap(_M_invoker, __x._M_invoker);
}
// [3.7.2.3] function capacity
/**
* @brief Determine if the %function wrapper has a target.
*
* @return @c true when this %function object contains a target,
* or @c false when it is empty.
*
* This function will not throw an %exception.
*/
#if __cplusplus >= 201103L
explicit operator bool() const
{ return !_M_empty(); }
#else
operator _Safe_bool() const
{
if (_M_empty())
return 0;
else
return &_Hidden_type::_M_bool;
}
#endif
// [3.7.2.4] function invocation
/**
* @brief Invokes the function targeted by @c *this.
* @returns the result of the target.
* @throws bad_function_call when @c !(bool)*this
*
* The function call operator invokes the target function object
* stored by @c this.
*/
_Res operator()(_ArgTypes... __args) const;
#if __cpp_rtti
// [3.7.2.5] function target access
/**
* @brief Determine the type of the target of this function object
* wrapper.
*
* @returns the type identifier of the target function object, or
* @c typeid(void) if @c !(bool)*this.
*
* This function will not throw an %exception.
*/
const type_info& target_type() const;
/**
* @brief Access the stored target function object.
*
* @return Returns a pointer to the stored target function object,
* if @c typeid(Functor).equals(target_type()); otherwise, a NULL
* pointer.
*
* This function will not throw an %exception.
*/
template<typename _Functor> _Functor* target();
/// @overload
template<typename _Functor> const _Functor* target() const;
#endif
private:
// [3.7.2.6] undefined operators
template<typename _Function>
void operator==(const function<_Function>&) const;
template<typename _Function>
void operator!=(const function<_Function>&) const;
typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
_Invoker_type _M_invoker;
};
template<typename _Res, typename... _ArgTypes>
function<_Res(_ArgTypes...)>::
function(const function& __x)
: _Function_base()
{
if (static_cast<bool>(__x))
{
__x._M_manager(_M_functor, __x._M_functor, __clone_functor);
_M_invoker = __x._M_invoker;
_M_manager = __x._M_manager;
}
}
template<typename _Res, typename... _ArgTypes>
template<typename _Functor>
function<_Res(_ArgTypes...)>::
function(_Functor __f,
typename __gnu_cxx::__enable_if<
!is_integral<_Functor>::value, _Useless>::__type)
: _Function_base()
{
typedef _Function_handler<_Signature_type, _Functor> _My_handler;
if (_My_handler::_M_not_empty_function(__f))
{
_My_handler::_M_init_functor(_M_functor, __f);
_M_invoker = &_My_handler::_M_invoke;
_M_manager = &_My_handler::_M_manager;
}
}
template<typename _Res, typename... _ArgTypes>
_Res
function<_Res(_ArgTypes...)>::
operator()(_ArgTypes... __args) const
{
if (_M_empty())
_GLIBCXX_THROW_OR_ABORT(bad_function_call());
return _M_invoker(_M_functor, __args...);
}
#if __cpp_rtti
template<typename _Res, typename... _ArgTypes>
const type_info&
function<_Res(_ArgTypes...)>::
target_type() const
{
if (_M_manager)
{
_Any_data __typeinfo_result;
_M_manager(__typeinfo_result, _M_functor, __get_type_info);
return *__typeinfo_result._M_access<const type_info*>();
}
else
return typeid(void);
}
template<typename _Res, typename... _ArgTypes>
template<typename _Functor>
_Functor*
function<_Res(_ArgTypes...)>::
target()
{
if (typeid(_Functor) == target_type() && _M_manager)
{
_Any_data __ptr;
if (_M_manager(__ptr, _M_functor, __get_functor_ptr)
&& !is_const<_Functor>::value)
return 0;
else
return __ptr._M_access<_Functor*>();
}
else
return 0;
}
template<typename _Res, typename... _ArgTypes>
template<typename _Functor>
const _Functor*
function<_Res(_ArgTypes...)>::
target() const
{
if (typeid(_Functor) == target_type() && _M_manager)
{
_Any_data __ptr;
_M_manager(__ptr, _M_functor, __get_functor_ptr);
return __ptr._M_access<const _Functor*>();
}
else
return 0;
}
#endif
// [3.7.2.7] null pointer comparisons
/**
* @brief Compares a polymorphic function object wrapper against 0
* (the NULL pointer).
* @returns @c true if the wrapper has no target, @c false otherwise
*
* This function will not throw an %exception.
*/
template<typename _Signature>
inline bool
operator==(const function<_Signature>& __f, _M_clear_type*)
{ return !static_cast<bool>(__f); }
/// @overload
template<typename _Signature>
inline bool
operator==(_M_clear_type*, const function<_Signature>& __f)
{ return !static_cast<bool>(__f); }
/**
* @brief Compares a polymorphic function object wrapper against 0
* (the NULL pointer).
* @returns @c false if the wrapper has no target, @c true otherwise
*
* This function will not throw an %exception.
*/
template<typename _Signature>
inline bool
operator!=(const function<_Signature>& __f, _M_clear_type*)
{ return static_cast<bool>(__f); }
/// @overload
template<typename _Signature>
inline bool
operator!=(_M_clear_type*, const function<_Signature>& __f)
{ return static_cast<bool>(__f); }
// [3.7.2.8] specialized algorithms
/**
* @brief Swap the targets of two polymorphic function object wrappers.
*
* This function will not throw an %exception.
*/
template<typename _Signature>
inline void
swap(function<_Signature>& __x, function<_Signature>& __y)
{ __x.swap(__y); }
}
#if __cplusplus >= 201103L
template<typename> struct is_placeholder;
template<int _Num>
struct is_placeholder<tr1::_Placeholder<_Num>>
: integral_constant<int, _Num>
{ };
template<int _Num>
struct is_placeholder<const tr1::_Placeholder<_Num>>
: integral_constant<int, _Num>
{ };
template<typename> struct is_bind_expression;
template<typename _Signature>
struct is_bind_expression<tr1::_Bind<_Signature>>
: true_type { };
template<typename _Signature>
struct is_bind_expression<const tr1::_Bind<_Signature>>
: true_type { };
template<typename _Signature>
struct is_bind_expression<volatile tr1::_Bind<_Signature>>
: true_type { };
template<typename _Signature>
struct is_bind_expression<const volatile tr1::_Bind<_Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<tr1::_Bind_result<_Result, _Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<const tr1::_Bind_result<_Result, _Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<volatile tr1::_Bind_result<_Result, _Signature>>
: true_type { };
template<typename _Result, typename _Signature>
struct is_bind_expression<const volatile tr1::_Bind_result<_Result,
_Signature>>
: true_type { };
#endif // C++11
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_FUNCTIONAL
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/poly_hermite.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) Handbook of Mathematical Functions,
// Ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications, Section 22 pp. 773-802
#ifndef _GLIBCXX_TR1_POLY_HERMITE_TCC
#define _GLIBCXX_TR1_POLY_HERMITE_TCC 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief This routine returns the Hermite polynomial
* of order n: \f$ H_n(x) \f$ by recursion on n.
*
* The Hermite polynomial is defined by:
* @f[
* H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
* @f]
*
* @param __n The order of the Hermite polynomial.
* @param __x The argument of the Hermite polynomial.
* @return The value of the Hermite polynomial of order n
* and argument x.
*/
template<typename _Tp>
_Tp
__poly_hermite_recursion(unsigned int __n, _Tp __x)
{
// Compute H_0.
_Tp __H_0 = 1;
if (__n == 0)
return __H_0;
// Compute H_1.
_Tp __H_1 = 2 * __x;
if (__n == 1)
return __H_1;
// Compute H_n.
_Tp __H_n, __H_nm1, __H_nm2;
unsigned int __i;
for (__H_nm2 = __H_0, __H_nm1 = __H_1, __i = 2; __i <= __n; ++__i)
{
__H_n = 2 * (__x * __H_nm1 - (__i - 1) * __H_nm2);
__H_nm2 = __H_nm1;
__H_nm1 = __H_n;
}
return __H_n;
}
/**
* @brief This routine returns the Hermite polynomial
* of order n: \f$ H_n(x) \f$.
*
* The Hermite polynomial is defined by:
* @f[
* H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
* @f]
*
* @param __n The order of the Hermite polynomial.
* @param __x The argument of the Hermite polynomial.
* @return The value of the Hermite polynomial of order n
* and argument x.
*/
template<typename _Tp>
inline _Tp
__poly_hermite(unsigned int __n, _Tp __x)
{
if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else
return __poly_hermite_recursion(__n, __x);
}
} // namespace __detail
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_POLY_HERMITE_TCC
// TR1 type_traits -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/type_traits
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_TYPE_TRAITS
#define _GLIBCXX_TR1_TYPE_TRAITS 1
#pragma GCC system_header
#include <bits/c++config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/**
* @addtogroup metaprogramming
* @{
*/
struct __sfinae_types
{
typedef char __one;
typedef struct { char __arr[2]; } __two;
};
#define _DEFINE_SPEC_0_HELPER \
template<>
#define _DEFINE_SPEC_1_HELPER \
template<typename _Tp>
#define _DEFINE_SPEC_2_HELPER \
template<typename _Tp, typename _Cp>
#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
_DEFINE_SPEC_##_Order##_HELPER \
struct _Trait<_Type> \
: public integral_constant<bool, _Value> { };
// helper classes [4.3].
/// integral_constant
template<typename _Tp, _Tp __v>
struct integral_constant
{
static const _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type;
};
/// typedef for true_type
typedef integral_constant<bool, true> true_type;
/// typedef for false_type
typedef integral_constant<bool, false> false_type;
template<typename _Tp, _Tp __v>
const _Tp integral_constant<_Tp, __v>::value;
/// remove_cv
template<typename>
struct remove_cv;
template<typename>
struct __is_void_helper
: public false_type { };
_DEFINE_SPEC(0, __is_void_helper, void, true)
// primary type categories [4.5.1].
/// is_void
template<typename _Tp>
struct is_void
: public integral_constant<bool, (__is_void_helper<typename
remove_cv<_Tp>::type>::value)>
{ };
template<typename>
struct __is_integral_helper
: public false_type { };
_DEFINE_SPEC(0, __is_integral_helper, bool, true)
_DEFINE_SPEC(0, __is_integral_helper, char, true)
_DEFINE_SPEC(0, __is_integral_helper, signed char, true)
_DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
#ifdef _GLIBCXX_USE_WCHAR_T
_DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
#endif
_DEFINE_SPEC(0, __is_integral_helper, short, true)
_DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
_DEFINE_SPEC(0, __is_integral_helper, int, true)
_DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
_DEFINE_SPEC(0, __is_integral_helper, long, true)
_DEFINE_SPEC(0, __is_integral_helper, unsigned long, true)
_DEFINE_SPEC(0, __is_integral_helper, long long, true)
_DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
/// is_integral
template<typename _Tp>
struct is_integral
: public integral_constant<bool, (__is_integral_helper<typename
remove_cv<_Tp>::type>::value)>
{ };
template<typename>
struct __is_floating_point_helper
: public false_type { };
_DEFINE_SPEC(0, __is_floating_point_helper, float, true)
_DEFINE_SPEC(0, __is_floating_point_helper, double, true)
_DEFINE_SPEC(0, __is_floating_point_helper, long double, true)
/// is_floating_point
template<typename _Tp>
struct is_floating_point
: public integral_constant<bool, (__is_floating_point_helper<typename
remove_cv<_Tp>::type>::value)>
{ };
/// is_array
template<typename>
struct is_array
: public false_type { };
template<typename _Tp, std::size_t _Size>
struct is_array<_Tp[_Size]>
: public true_type { };
template<typename _Tp>
struct is_array<_Tp[]>
: public true_type { };
template<typename>
struct __is_pointer_helper
: public false_type { };
_DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true)
/// is_pointer
template<typename _Tp>
struct is_pointer
: public integral_constant<bool, (__is_pointer_helper<typename
remove_cv<_Tp>::type>::value)>
{ };
/// is_reference
template<typename _Tp>
struct is_reference;
/// is_function
template<typename _Tp>
struct is_function;
template<typename>
struct __is_member_object_pointer_helper
: public false_type { };
_DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*,
!is_function<_Tp>::value)
/// is_member_object_pointer
template<typename _Tp>
struct is_member_object_pointer
: public integral_constant<bool, (__is_member_object_pointer_helper<
typename remove_cv<_Tp>::type>::value)>
{ };
template<typename>
struct __is_member_function_pointer_helper
: public false_type { };
_DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*,
is_function<_Tp>::value)
/// is_member_function_pointer
template<typename _Tp>
struct is_member_function_pointer
: public integral_constant<bool, (__is_member_function_pointer_helper<
typename remove_cv<_Tp>::type>::value)>
{ };
/// is_enum
template<typename _Tp>
struct is_enum
: public integral_constant<bool, __is_enum(_Tp)>
{ };
/// is_union
template<typename _Tp>
struct is_union
: public integral_constant<bool, __is_union(_Tp)>
{ };
/// is_class
template<typename _Tp>
struct is_class
: public integral_constant<bool, __is_class(_Tp)>
{ };
/// is_function
template<typename>
struct is_function
: public false_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes...)>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes......)>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes...) const>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes......) const>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes...) volatile>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes......) volatile>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes...) const volatile>
: public true_type { };
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes......) const volatile>
: public true_type { };
// composite type traits [4.5.2].
/// is_arithmetic
template<typename _Tp>
struct is_arithmetic
: public integral_constant<bool, (is_integral<_Tp>::value
|| is_floating_point<_Tp>::value)>
{ };
/// is_fundamental
template<typename _Tp>
struct is_fundamental
: public integral_constant<bool, (is_arithmetic<_Tp>::value
|| is_void<_Tp>::value)>
{ };
/// is_object
template<typename _Tp>
struct is_object
: public integral_constant<bool, !(is_function<_Tp>::value
|| is_reference<_Tp>::value
|| is_void<_Tp>::value)>
{ };
/// is_member_pointer
template<typename _Tp>
struct is_member_pointer;
/// is_scalar
template<typename _Tp>
struct is_scalar
: public integral_constant<bool, (is_arithmetic<_Tp>::value
|| is_enum<_Tp>::value
|| is_pointer<_Tp>::value
|| is_member_pointer<_Tp>::value)>
{ };
/// is_compound
template<typename _Tp>
struct is_compound
: public integral_constant<bool, !is_fundamental<_Tp>::value> { };
/// is_member_pointer
template<typename _Tp>
struct __is_member_pointer_helper
: public false_type { };
_DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true)
template<typename _Tp>
struct is_member_pointer
: public integral_constant<bool, (__is_member_pointer_helper<
typename remove_cv<_Tp>::type>::value)>
{ };
// type properties [4.5.3].
/// is_const
template<typename>
struct is_const
: public false_type { };
template<typename _Tp>
struct is_const<_Tp const>
: public true_type { };
/// is_volatile
template<typename>
struct is_volatile
: public false_type { };
template<typename _Tp>
struct is_volatile<_Tp volatile>
: public true_type { };
/// is_empty
template<typename _Tp>
struct is_empty
: public integral_constant<bool, __is_empty(_Tp)>
{ };
/// is_polymorphic
template<typename _Tp>
struct is_polymorphic
: public integral_constant<bool, __is_polymorphic(_Tp)>
{ };
/// is_abstract
template<typename _Tp>
struct is_abstract
: public integral_constant<bool, __is_abstract(_Tp)>
{ };
/// has_virtual_destructor
template<typename _Tp>
struct has_virtual_destructor
: public integral_constant<bool, __has_virtual_destructor(_Tp)>
{ };
/// alignment_of
template<typename _Tp>
struct alignment_of
: public integral_constant<std::size_t, __alignof__(_Tp)> { };
/// rank
template<typename>
struct rank
: public integral_constant<std::size_t, 0> { };
template<typename _Tp, std::size_t _Size>
struct rank<_Tp[_Size]>
: public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
template<typename _Tp>
struct rank<_Tp[]>
: public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
/// extent
template<typename, unsigned _Uint = 0>
struct extent
: public integral_constant<std::size_t, 0> { };
template<typename _Tp, unsigned _Uint, std::size_t _Size>
struct extent<_Tp[_Size], _Uint>
: public integral_constant<std::size_t,
_Uint == 0 ? _Size : extent<_Tp,
_Uint - 1>::value>
{ };
template<typename _Tp, unsigned _Uint>
struct extent<_Tp[], _Uint>
: public integral_constant<std::size_t,
_Uint == 0 ? 0 : extent<_Tp,
_Uint - 1>::value>
{ };
// relationships between types [4.6].
/// is_same
template<typename, typename>
struct is_same
: public false_type { };
template<typename _Tp>
struct is_same<_Tp, _Tp>
: public true_type { };
// const-volatile modifications [4.7.1].
/// remove_const
template<typename _Tp>
struct remove_const
{ typedef _Tp type; };
template<typename _Tp>
struct remove_const<_Tp const>
{ typedef _Tp type; };
/// remove_volatile
template<typename _Tp>
struct remove_volatile
{ typedef _Tp type; };
template<typename _Tp>
struct remove_volatile<_Tp volatile>
{ typedef _Tp type; };
/// remove_cv
template<typename _Tp>
struct remove_cv
{
typedef typename
remove_const<typename remove_volatile<_Tp>::type>::type type;
};
/// add_const
template<typename _Tp>
struct add_const
{ typedef _Tp const type; };
/// add_volatile
template<typename _Tp>
struct add_volatile
{ typedef _Tp volatile type; };
/// add_cv
template<typename _Tp>
struct add_cv
{
typedef typename
add_const<typename add_volatile<_Tp>::type>::type type;
};
// array modifications [4.7.3].
/// remove_extent
template<typename _Tp>
struct remove_extent
{ typedef _Tp type; };
template<typename _Tp, std::size_t _Size>
struct remove_extent<_Tp[_Size]>
{ typedef _Tp type; };
template<typename _Tp>
struct remove_extent<_Tp[]>
{ typedef _Tp type; };
/// remove_all_extents
template<typename _Tp>
struct remove_all_extents
{ typedef _Tp type; };
template<typename _Tp, std::size_t _Size>
struct remove_all_extents<_Tp[_Size]>
{ typedef typename remove_all_extents<_Tp>::type type; };
template<typename _Tp>
struct remove_all_extents<_Tp[]>
{ typedef typename remove_all_extents<_Tp>::type type; };
// pointer modifications [4.7.4].
template<typename _Tp, typename>
struct __remove_pointer_helper
{ typedef _Tp type; };
template<typename _Tp, typename _Up>
struct __remove_pointer_helper<_Tp, _Up*>
{ typedef _Up type; };
/// remove_pointer
template<typename _Tp>
struct remove_pointer
: public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
{ };
template<typename>
struct remove_reference;
/// add_pointer
template<typename _Tp>
struct add_pointer
{ typedef typename remove_reference<_Tp>::type* type; };
template<typename>
struct is_reference
: public false_type { };
template<typename _Tp>
struct is_reference<_Tp&>
: public true_type { };
template<typename _Tp>
struct is_pod
: public integral_constant<bool, __is_pod(_Tp) || is_void<_Tp>::value>
{ };
template<typename _Tp>
struct has_trivial_constructor
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename _Tp>
struct has_trivial_copy
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename _Tp>
struct has_trivial_assign
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename _Tp>
struct has_trivial_destructor
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename _Tp>
struct has_nothrow_constructor
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename _Tp>
struct has_nothrow_copy
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename _Tp>
struct has_nothrow_assign
: public integral_constant<bool, is_pod<_Tp>::value>
{ };
template<typename>
struct __is_signed_helper
: public false_type { };
_DEFINE_SPEC(0, __is_signed_helper, signed char, true)
_DEFINE_SPEC(0, __is_signed_helper, short, true)
_DEFINE_SPEC(0, __is_signed_helper, int, true)
_DEFINE_SPEC(0, __is_signed_helper, long, true)
_DEFINE_SPEC(0, __is_signed_helper, long long, true)
template<typename _Tp>
struct is_signed
: public integral_constant<bool, (__is_signed_helper<typename
remove_cv<_Tp>::type>::value)>
{ };
template<typename>
struct __is_unsigned_helper
: public false_type { };
_DEFINE_SPEC(0, __is_unsigned_helper, unsigned char, true)
_DEFINE_SPEC(0, __is_unsigned_helper, unsigned short, true)
_DEFINE_SPEC(0, __is_unsigned_helper, unsigned int, true)
_DEFINE_SPEC(0, __is_unsigned_helper, unsigned long, true)
_DEFINE_SPEC(0, __is_unsigned_helper, unsigned long long, true)
template<typename _Tp>
struct is_unsigned
: public integral_constant<bool, (__is_unsigned_helper<typename
remove_cv<_Tp>::type>::value)>
{ };
template<typename _Base, typename _Derived>
struct __is_base_of_helper
{
typedef typename remove_cv<_Base>::type _NoCv_Base;
typedef typename remove_cv<_Derived>::type _NoCv_Derived;
static const bool __value = (is_same<_Base, _Derived>::value
|| (__is_base_of(_Base, _Derived)
&& !is_same<_NoCv_Base,
_NoCv_Derived>::value));
};
template<typename _Base, typename _Derived>
struct is_base_of
: public integral_constant<bool,
__is_base_of_helper<_Base, _Derived>::__value>
{ };
template<typename _From, typename _To>
struct __is_convertible_simple
: public __sfinae_types
{
private:
static __one __test(_To);
static __two __test(...);
static _From __makeFrom();
public:
static const bool __value = sizeof(__test(__makeFrom())) == 1;
};
template<typename _Tp>
struct add_reference;
template<typename _Tp>
struct __is_int_or_cref
{
typedef typename remove_reference<_Tp>::type __rr_Tp;
static const bool __value = (is_integral<_Tp>::value
|| (is_integral<__rr_Tp>::value
&& is_const<__rr_Tp>::value
&& !is_volatile<__rr_Tp>::value));
};
template<typename _From, typename _To,
bool = (is_void<_From>::value || is_void<_To>::value
|| is_function<_To>::value || is_array<_To>::value
// This special case is here only to avoid warnings.
|| (is_floating_point<typename
remove_reference<_From>::type>::value
&& __is_int_or_cref<_To>::__value))>
struct __is_convertible_helper
{
// "An imaginary lvalue of type From...".
static const bool __value = (__is_convertible_simple<typename
add_reference<_From>::type, _To>::__value);
};
template<typename _From, typename _To>
struct __is_convertible_helper<_From, _To, true>
{ static const bool __value = (is_void<_To>::value
|| (__is_int_or_cref<_To>::__value
&& !is_void<_From>::value)); };
template<typename _From, typename _To>
struct is_convertible
: public integral_constant<bool,
__is_convertible_helper<_From, _To>::__value>
{ };
// reference modifications [4.7.2].
template<typename _Tp>
struct remove_reference
{ typedef _Tp type; };
template<typename _Tp>
struct remove_reference<_Tp&>
{ typedef _Tp type; };
// NB: Careful with reference to void.
template<typename _Tp, bool = (is_void<_Tp>::value
|| is_reference<_Tp>::value)>
struct __add_reference_helper
{ typedef _Tp& type; };
template<typename _Tp>
struct __add_reference_helper<_Tp, true>
{ typedef _Tp type; };
template<typename _Tp>
struct add_reference
: public __add_reference_helper<_Tp>
{ };
// other transformations [4.8].
template<std::size_t _Len, std::size_t _Align>
struct aligned_storage
{
union type
{
unsigned char __data[_Len];
struct __attribute__((__aligned__((_Align)))) { } __align;
};
};
#undef _DEFINE_SPEC_0_HELPER
#undef _DEFINE_SPEC_1_HELPER
#undef _DEFINE_SPEC_2_HELPER
#undef _DEFINE_SPEC
/// @} group metaprogramming
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_TYPE_TRAITS
// TR1 wchar.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/wchar.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_WCHAR_H
#define _GLIBCXX_TR1_WCHAR_H 1
#include <tr1/cwchar>
#endif // _GLIBCXX_TR1_WCHAR_H
// TR1 ctime -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/ctime
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CTIME
#define _GLIBCXX_TR1_CTIME 1
#include <ctime>
#endif // _GLIBCXX_TR1_CTIME
// TR1 ccomplex -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/ccomplex
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CCOMPLEX
#define _GLIBCXX_TR1_CCOMPLEX 1
#include <tr1/complex>
#endif // _GLIBCXX_TR1_CCOMPLEX
// TR1 complex.h -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/complex.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_COMPLEX_H
#define _GLIBCXX_TR1_COMPLEX_H 1
#include <tr1/ccomplex>
#endif // _GLIBCXX_TR1_COMPLEX_H
// TR1 cstdlib -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cstdlib
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CSTDLIB
#define _GLIBCXX_TR1_CSTDLIB 1
#pragma GCC system_header
#include <cstdlib>
#if _GLIBCXX_HOSTED
#if _GLIBCXX_USE_C99_STDLIB
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
// types
using std::lldiv_t;
// functions
using std::llabs;
using std::lldiv;
#endif
using std::atoll;
using std::strtoll;
using std::strtoull;
using std::strtof;
using std::strtold;
// overloads
using std::abs;
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using std::div;
#endif
}
}
#endif // _GLIBCXX_USE_C99_STDLIB
#endif // _GLIBCXX_HOSTED
#endif // _GLIBCXX_TR1_CSTDLIB
// TR1 unordered_set implementation -*- C++ -*-
// Copyright (C) 2010-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/unordered_set.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/unordered_set}
*/
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
// NB: When we get typedef templates these class definitions
// will be unnecessary.
template<class _Value,
class _Hash = hash<_Value>,
class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value>,
bool __cache_hash_code = false>
class __unordered_set
: public _Hashtable<_Value, _Value, _Alloc,
std::_Identity<_Value>, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, true, true>
{
typedef _Hashtable<_Value, _Value, _Alloc,
std::_Identity<_Value>, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, true, true>
_Base;
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
__unordered_set(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(), __eql,
std::_Identity<_Value>(), __a)
{ }
template<typename _InputIterator>
__unordered_set(_InputIterator __f, _InputIterator __l,
size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(), __eql,
std::_Identity<_Value>(), __a)
{ }
};
template<class _Value,
class _Hash = hash<_Value>,
class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value>,
bool __cache_hash_code = false>
class __unordered_multiset
: public _Hashtable<_Value, _Value, _Alloc,
std::_Identity<_Value>, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, true, false>
{
typedef _Hashtable<_Value, _Value, _Alloc,
std::_Identity<_Value>, _Pred,
_Hash, __detail::_Mod_range_hashing,
__detail::_Default_ranged_hash,
__detail::_Prime_rehash_policy,
__cache_hash_code, true, false>
_Base;
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
__unordered_multiset(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(), __eql,
std::_Identity<_Value>(), __a)
{ }
template<typename _InputIterator>
__unordered_multiset(_InputIterator __f, _InputIterator __l,
typename _Base::size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
__detail::_Default_ranged_hash(), __eql,
std::_Identity<_Value>(), __a)
{ }
};
template<class _Value, class _Hash, class _Pred, class _Alloc,
bool __cache_hash_code>
inline void
swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x,
__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y)
{ __x.swap(__y); }
template<class _Value, class _Hash, class _Pred, class _Alloc,
bool __cache_hash_code>
inline void
swap(__unordered_multiset<_Value, _Hash, _Pred,
_Alloc, __cache_hash_code>& __x,
__unordered_multiset<_Value, _Hash, _Pred,
_Alloc, __cache_hash_code>& __y)
{ __x.swap(__y); }
/**
* @brief A standard container composed of unique keys (containing
* at most one of each key value) in which the elements' keys are
* the elements themselves.
*
* @ingroup unordered_associative_containers
*
* Meets the requirements of a <a href="tables.html#65">container</a>, and
* <a href="tables.html#xx">unordered associative container</a>
*
* @param Value Type of key objects.
* @param Hash Hashing function object type, defaults to hash<Value>.
* @param Pred Predicate function object type, defaults to equal_to<Value>.
* @param Alloc Allocator type, defaults to allocator<Key>.
*/
template<class _Value,
class _Hash = hash<_Value>,
class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value> >
class unordered_set
: public __unordered_set<_Value, _Hash, _Pred, _Alloc>
{
typedef __unordered_set<_Value, _Hash, _Pred, _Alloc> _Base;
public:
typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
unordered_set(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a)
{ }
template<typename _InputIterator>
unordered_set(_InputIterator __f, _InputIterator __l,
size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
};
/**
* @brief A standard container composed of equivalent keys
* (possibly containing multiple of each key value) in which the
* elements' keys are the elements themselves.
*
* @ingroup unordered_associative_containers
*
* Meets the requirements of a <a href="tables.html#65">container</a>, and
* <a href="tables.html#xx">unordered associative container</a>
*
* @param Value Type of key objects.
* @param Hash Hashing function object type, defaults to hash<Value>.
* @param Pred Predicate function object type, defaults to equal_to<Value>.
* @param Alloc Allocator type, defaults to allocator<Key>.
*/
template<class _Value,
class _Hash = hash<_Value>,
class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value> >
class unordered_multiset
: public __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
{
typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base;
public:
typedef typename _Base::value_type value_type;
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal;
typedef typename _Base::allocator_type allocator_type;
explicit
unordered_multiset(size_type __n = 10,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a)
{ }
template<typename _InputIterator>
unordered_multiset(_InputIterator __f, _InputIterator __l,
typename _Base::size_type __n = 0,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
};
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
{ __x.swap(__y); }
}
_GLIBCXX_END_NAMESPACE_VERSION
}
// TR1 ctype.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/ctype.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_CTYPE_H
#define _TR1_CTYPE_H 1
#include <tr1/cctype>
#endif
// TR1 functional_hash.h header -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/functional_hash.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/functional}
*/
#ifndef _GLIBCXX_TR1_FUNCTIONAL_HASH_H
#define _GLIBCXX_TR1_FUNCTIONAL_HASH_H 1
#pragma GCC system_header
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/// Class template hash.
// Declaration of default hash functor std::tr1::hash. The types for
// which std::tr1::hash<T> is well-defined is in clause 6.3.3. of the PDTR.
template<typename _Tp>
struct hash : public std::unary_function<_Tp, size_t>
{
size_t
operator()(_Tp __val) const;
};
/// Partial specializations for pointer types.
template<typename _Tp>
struct hash<_Tp*> : public std::unary_function<_Tp*, size_t>
{
size_t
operator()(_Tp* __p) const
{ return reinterpret_cast<size_t>(__p); }
};
/// Explicit specializations for integer types.
#define _TR1_hashtable_define_trivial_hash(_Tp) \
template<> \
inline size_t \
hash<_Tp>::operator()(_Tp __val) const \
{ return static_cast<size_t>(__val); }
_TR1_hashtable_define_trivial_hash(bool);
_TR1_hashtable_define_trivial_hash(char);
_TR1_hashtable_define_trivial_hash(signed char);
_TR1_hashtable_define_trivial_hash(unsigned char);
_TR1_hashtable_define_trivial_hash(wchar_t);
_TR1_hashtable_define_trivial_hash(short);
_TR1_hashtable_define_trivial_hash(int);
_TR1_hashtable_define_trivial_hash(long);
_TR1_hashtable_define_trivial_hash(long long);
_TR1_hashtable_define_trivial_hash(unsigned short);
_TR1_hashtable_define_trivial_hash(unsigned int);
_TR1_hashtable_define_trivial_hash(unsigned long);
_TR1_hashtable_define_trivial_hash(unsigned long long);
#undef _TR1_hashtable_define_trivial_hash
// Fowler / Noll / Vo (FNV) Hash (type FNV-1a)
// (Used by the next specializations of std::tr1::hash.)
// N.B. These functions should work on unsigned char, otherwise they do not
// correctly implement the FNV-1a algorithm (see PR59406).
// The existing behaviour is retained for backwards compatibility.
/// Dummy generic implementation (for sizeof(size_t) != 4, 8).
template<size_t>
struct _Fnv_hash_base
{
template<typename _Tp>
static size_t
hash(const _Tp* __ptr, size_t __clength)
{
size_t __result = 0;
const char* __cptr = reinterpret_cast<const char*>(__ptr);
for (; __clength; --__clength)
__result = (__result * 131) + *__cptr++;
return __result;
}
};
template<>
struct _Fnv_hash_base<4>
{
template<typename _Tp>
static size_t
hash(const _Tp* __ptr, size_t __clength)
{
size_t __result = static_cast<size_t>(2166136261UL);
const char* __cptr = reinterpret_cast<const char*>(__ptr);
for (; __clength; --__clength)
{
__result ^= static_cast<size_t>(*__cptr++);
__result *= static_cast<size_t>(16777619UL);
}
return __result;
}
};
template<>
struct _Fnv_hash_base<8>
{
template<typename _Tp>
static size_t
hash(const _Tp* __ptr, size_t __clength)
{
size_t __result
= static_cast<size_t>(14695981039346656037ULL);
const char* __cptr = reinterpret_cast<const char*>(__ptr);
for (; __clength; --__clength)
{
__result ^= static_cast<size_t>(*__cptr++);
__result *= static_cast<size_t>(1099511628211ULL);
}
return __result;
}
};
struct _Fnv_hash
: public _Fnv_hash_base<sizeof(size_t)>
{
using _Fnv_hash_base<sizeof(size_t)>::hash;
template<typename _Tp>
static size_t
hash(const _Tp& __val)
{ return hash(&__val, sizeof(__val)); }
};
/// Explicit specializations for float.
template<>
inline size_t
hash<float>::operator()(float __val) const
{
// 0 and -0 both hash to zero.
return __val != 0.0f ? std::tr1::_Fnv_hash::hash(__val) : 0;
}
/// Explicit specializations for double.
template<>
inline size_t
hash<double>::operator()(double __val) const
{
// 0 and -0 both hash to zero.
return __val != 0.0 ? std::tr1::_Fnv_hash::hash(__val) : 0;
}
/// Explicit specializations for long double.
template<>
_GLIBCXX_PURE size_t
hash<long double>::operator()(long double __val) const;
/// Explicit specialization of member operator for non-builtin types.
template<>
_GLIBCXX_PURE size_t
hash<string>::operator()(string) const;
template<>
_GLIBCXX_PURE size_t
hash<const string&>::operator()(const string&) const;
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
_GLIBCXX_PURE size_t
hash<wstring>::operator()(wstring) const;
template<>
_GLIBCXX_PURE size_t
hash<const wstring&>::operator()(const wstring&) const;
#endif
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_FUNCTIONAL_HASH_H
// TR1 stdio.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/stdio.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_STDIO_H
#define _TR1_STDIO_H 1
#include <tr1/cstdio>
#endif
// Internal policy header for TR1 unordered_set and unordered_map -*- C++ -*-
// Copyright (C) 2010-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/hashtable_policy.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly.
* @headername{tr1/unordered_map, tr1/unordered_set}
*/
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
namespace __detail
{
// Helper function: return distance(first, last) for forward
// iterators, or 0 for input iterators.
template<class _Iterator>
inline typename std::iterator_traits<_Iterator>::difference_type
__distance_fw(_Iterator __first, _Iterator __last,
std::input_iterator_tag)
{ return 0; }
template<class _Iterator>
inline typename std::iterator_traits<_Iterator>::difference_type
__distance_fw(_Iterator __first, _Iterator __last,
std::forward_iterator_tag)
{ return std::distance(__first, __last); }
template<class _Iterator>
inline typename std::iterator_traits<_Iterator>::difference_type
__distance_fw(_Iterator __first, _Iterator __last)
{
typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag;
return __distance_fw(__first, __last, _Tag());
}
// Auxiliary types used for all instantiations of _Hashtable: nodes
// and iterators.
// Nodes, used to wrap elements stored in the hash table. A policy
// template parameter of class template _Hashtable controls whether
// nodes also store a hash code. In some cases (e.g. strings) this
// may be a performance win.
template<typename _Value, bool __cache_hash_code>
struct _Hash_node;
template<typename _Value>
struct _Hash_node<_Value, true>
{
_Value _M_v;
std::size_t _M_hash_code;
_Hash_node* _M_next;
};
template<typename _Value>
struct _Hash_node<_Value, false>
{
_Value _M_v;
_Hash_node* _M_next;
};
// Local iterators, used to iterate within a bucket but not between
// buckets.
template<typename _Value, bool __cache>
struct _Node_iterator_base
{
_Node_iterator_base(_Hash_node<_Value, __cache>* __p)
: _M_cur(__p) { }
void
_M_incr()
{ _M_cur = _M_cur->_M_next; }
_Hash_node<_Value, __cache>* _M_cur;
};
template<typename _Value, bool __cache>
inline bool
operator==(const _Node_iterator_base<_Value, __cache>& __x,
const _Node_iterator_base<_Value, __cache>& __y)
{ return __x._M_cur == __y._M_cur; }
template<typename _Value, bool __cache>
inline bool
operator!=(const _Node_iterator_base<_Value, __cache>& __x,
const _Node_iterator_base<_Value, __cache>& __y)
{ return __x._M_cur != __y._M_cur; }
template<typename _Value, bool __constant_iterators, bool __cache>
struct _Node_iterator
: public _Node_iterator_base<_Value, __cache>
{
typedef _Value value_type;
typedef typename
__gnu_cxx::__conditional_type<__constant_iterators,
const _Value*, _Value*>::__type
pointer;
typedef typename
__gnu_cxx::__conditional_type<__constant_iterators,
const _Value&, _Value&>::__type
reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
_Node_iterator()
: _Node_iterator_base<_Value, __cache>(0) { }
explicit
_Node_iterator(_Hash_node<_Value, __cache>* __p)
: _Node_iterator_base<_Value, __cache>(__p) { }
reference
operator*() const
{ return this->_M_cur->_M_v; }
pointer
operator->() const
{ return std::__addressof(this->_M_cur->_M_v); }
_Node_iterator&
operator++()
{
this->_M_incr();
return *this;
}
_Node_iterator
operator++(int)
{
_Node_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
template<typename _Value, bool __constant_iterators, bool __cache>
struct _Node_const_iterator
: public _Node_iterator_base<_Value, __cache>
{
typedef _Value value_type;
typedef const _Value* pointer;
typedef const _Value& reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
_Node_const_iterator()
: _Node_iterator_base<_Value, __cache>(0) { }
explicit
_Node_const_iterator(_Hash_node<_Value, __cache>* __p)
: _Node_iterator_base<_Value, __cache>(__p) { }
_Node_const_iterator(const _Node_iterator<_Value, __constant_iterators,
__cache>& __x)
: _Node_iterator_base<_Value, __cache>(__x._M_cur) { }
reference
operator*() const
{ return this->_M_cur->_M_v; }
pointer
operator->() const
{ return std::__addressof(this->_M_cur->_M_v); }
_Node_const_iterator&
operator++()
{
this->_M_incr();
return *this;
}
_Node_const_iterator
operator++(int)
{
_Node_const_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
template<typename _Value, bool __cache>
struct _Hashtable_iterator_base
{
_Hashtable_iterator_base(_Hash_node<_Value, __cache>* __node,
_Hash_node<_Value, __cache>** __bucket)
: _M_cur_node(__node), _M_cur_bucket(__bucket) { }
void
_M_incr()
{
_M_cur_node = _M_cur_node->_M_next;
if (!_M_cur_node)
_M_incr_bucket();
}
void
_M_incr_bucket();
_Hash_node<_Value, __cache>* _M_cur_node;
_Hash_node<_Value, __cache>** _M_cur_bucket;
};
// Global iterators, used for arbitrary iteration within a hash
// table. Larger and more expensive than local iterators.
template<typename _Value, bool __cache>
void
_Hashtable_iterator_base<_Value, __cache>::
_M_incr_bucket()
{
++_M_cur_bucket;
// This loop requires the bucket array to have a non-null sentinel.
while (!*_M_cur_bucket)
++_M_cur_bucket;
_M_cur_node = *_M_cur_bucket;
}
template<typename _Value, bool __cache>
inline bool
operator==(const _Hashtable_iterator_base<_Value, __cache>& __x,
const _Hashtable_iterator_base<_Value, __cache>& __y)
{ return __x._M_cur_node == __y._M_cur_node; }
template<typename _Value, bool __cache>
inline bool
operator!=(const _Hashtable_iterator_base<_Value, __cache>& __x,
const _Hashtable_iterator_base<_Value, __cache>& __y)
{ return __x._M_cur_node != __y._M_cur_node; }
template<typename _Value, bool __constant_iterators, bool __cache>
struct _Hashtable_iterator
: public _Hashtable_iterator_base<_Value, __cache>
{
typedef _Value value_type;
typedef typename
__gnu_cxx::__conditional_type<__constant_iterators,
const _Value*, _Value*>::__type
pointer;
typedef typename
__gnu_cxx::__conditional_type<__constant_iterators,
const _Value&, _Value&>::__type
reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
_Hashtable_iterator()
: _Hashtable_iterator_base<_Value, __cache>(0, 0) { }
_Hashtable_iterator(_Hash_node<_Value, __cache>* __p,
_Hash_node<_Value, __cache>** __b)
: _Hashtable_iterator_base<_Value, __cache>(__p, __b) { }
explicit
_Hashtable_iterator(_Hash_node<_Value, __cache>** __b)
: _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { }
reference
operator*() const
{ return this->_M_cur_node->_M_v; }
pointer
operator->() const
{ return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_iterator&
operator++()
{
this->_M_incr();
return *this;
}
_Hashtable_iterator
operator++(int)
{
_Hashtable_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
template<typename _Value, bool __constant_iterators, bool __cache>
struct _Hashtable_const_iterator
: public _Hashtable_iterator_base<_Value, __cache>
{
typedef _Value value_type;
typedef const _Value* pointer;
typedef const _Value& reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
_Hashtable_const_iterator()
: _Hashtable_iterator_base<_Value, __cache>(0, 0) { }
_Hashtable_const_iterator(_Hash_node<_Value, __cache>* __p,
_Hash_node<_Value, __cache>** __b)
: _Hashtable_iterator_base<_Value, __cache>(__p, __b) { }
explicit
_Hashtable_const_iterator(_Hash_node<_Value, __cache>** __b)
: _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { }
_Hashtable_const_iterator(const _Hashtable_iterator<_Value,
__constant_iterators, __cache>& __x)
: _Hashtable_iterator_base<_Value, __cache>(__x._M_cur_node,
__x._M_cur_bucket) { }
reference
operator*() const
{ return this->_M_cur_node->_M_v; }
pointer
operator->() const
{ return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_const_iterator&
operator++()
{
this->_M_incr();
return *this;
}
_Hashtable_const_iterator
operator++(int)
{
_Hashtable_const_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
// Many of class template _Hashtable's template parameters are policy
// classes. These are defaults for the policies.
// Default range hashing function: use division to fold a large number
// into the range [0, N).
struct _Mod_range_hashing
{
typedef std::size_t first_argument_type;
typedef std::size_t second_argument_type;
typedef std::size_t result_type;
result_type
operator()(first_argument_type __num, second_argument_type __den) const
{ return __num % __den; }
};
// Default ranged hash function H. In principle it should be a
// function object composed from objects of type H1 and H2 such that
// h(k, N) = h2(h1(k), N), but that would mean making extra copies of
// h1 and h2. So instead we'll just use a tag to tell class template
// hashtable to do that composition.
struct _Default_ranged_hash { };
// Default value for rehash policy. Bucket size is (usually) the
// smallest prime that keeps the load factor small enough.
struct _Prime_rehash_policy
{
_Prime_rehash_policy(float __z = 1.0)
: _M_max_load_factor(__z), _M_growth_factor(2.f), _M_next_resize(0) { }
float
max_load_factor() const
{ return _M_max_load_factor; }
// Return a bucket size no smaller than n.
std::size_t
_M_next_bkt(std::size_t __n) const;
// Return a bucket count appropriate for n elements
std::size_t
_M_bkt_for_elements(std::size_t __n) const;
// __n_bkt is current bucket count, __n_elt is current element count,
// and __n_ins is number of elements to be inserted. Do we need to
// increase bucket count? If so, return make_pair(true, n), where n
// is the new bucket count. If not, return make_pair(false, 0).
std::pair<bool, std::size_t>
_M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
std::size_t __n_ins) const;
enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 };
float _M_max_load_factor;
float _M_growth_factor;
mutable std::size_t _M_next_resize;
};
extern const unsigned long __prime_list[];
// XXX This is a hack. There's no good reason for any of
// _Prime_rehash_policy's member functions to be inline.
// Return a prime no smaller than n.
inline std::size_t
_Prime_rehash_policy::
_M_next_bkt(std::size_t __n) const
{
// Don't include the last prime in the search, so that anything
// higher than the second-to-last prime returns a past-the-end
// iterator that can be dereferenced to get the last prime.
const unsigned long* __p
= std::lower_bound(__prime_list, __prime_list + _S_n_primes - 1, __n);
_M_next_resize =
static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
return *__p;
}
// Return the smallest prime p such that alpha p >= n, where alpha
// is the load factor.
inline std::size_t
_Prime_rehash_policy::
_M_bkt_for_elements(std::size_t __n) const
{
const float __min_bkts = __n / _M_max_load_factor;
return _M_next_bkt(__builtin_ceil(__min_bkts));
}
// Finds the smallest prime p such that alpha p > __n_elt + __n_ins.
// If p > __n_bkt, return make_pair(true, p); otherwise return
// make_pair(false, 0). In principle this isn't very different from
// _M_bkt_for_elements.
// The only tricky part is that we're caching the element count at
// which we need to rehash, so we don't have to do a floating-point
// multiply for every insertion.
inline std::pair<bool, std::size_t>
_Prime_rehash_policy::
_M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
std::size_t __n_ins) const
{
if (__n_elt + __n_ins > _M_next_resize)
{
float __min_bkts = ((float(__n_ins) + float(__n_elt))
/ _M_max_load_factor);
if (__min_bkts > __n_bkt)
{
__min_bkts = std::max(__min_bkts, _M_growth_factor * __n_bkt);
return std::make_pair(true,
_M_next_bkt(__builtin_ceil(__min_bkts)));
}
else
{
_M_next_resize = static_cast<std::size_t>
(__builtin_ceil(__n_bkt * _M_max_load_factor));
return std::make_pair(false, 0);
}
}
else
return std::make_pair(false, 0);
}
// Base classes for std::tr1::_Hashtable. We define these base
// classes because in some cases we want to do different things
// depending on the value of a policy class. In some cases the
// policy class affects which member functions and nested typedefs
// are defined; we handle that by specializing base class templates.
// Several of the base class templates need to access other members
// of class template _Hashtable, so we use the "curiously recurring
// template pattern" for them.
// class template _Map_base. If the hashtable has a value type of the
// form pair<T1, T2> and a key extraction policy that returns the
// first part of the pair, the hashtable gets a mapped_type typedef.
// If it satisfies those criteria and also has unique keys, then it
// also gets an operator[].
template<typename _Key, typename _Value, typename _Ex, bool __unique,
typename _Hashtable>
struct _Map_base { };
template<typename _Key, typename _Pair, typename _Hashtable>
struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, false, _Hashtable>
{
typedef typename _Pair::second_type mapped_type;
};
template<typename _Key, typename _Pair, typename _Hashtable>
struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>
{
typedef typename _Pair::second_type mapped_type;
mapped_type&
operator[](const _Key& __k);
};
template<typename _Key, typename _Pair, typename _Hashtable>
typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
true, _Hashtable>::mapped_type&
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
operator[](const _Key& __k)
{
_Hashtable* __h = static_cast<_Hashtable*>(this);
typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
std::size_t __n = __h->_M_bucket_index(__k, __code,
__h->_M_bucket_count);
typename _Hashtable::_Node* __p =
__h->_M_find_node(__h->_M_buckets[__n], __k, __code);
if (!__p)
return __h->_M_insert_bucket(std::make_pair(__k, mapped_type()),
__n, __code)->second;
return (__p->_M_v).second;
}
// class template _Rehash_base. Give hashtable the max_load_factor
// functions iff the rehash policy is _Prime_rehash_policy.
template<typename _RehashPolicy, typename _Hashtable>
struct _Rehash_base { };
template<typename _Hashtable>
struct _Rehash_base<_Prime_rehash_policy, _Hashtable>
{
float
max_load_factor() const
{
const _Hashtable* __this = static_cast<const _Hashtable*>(this);
return __this->__rehash_policy().max_load_factor();
}
void
max_load_factor(float __z)
{
_Hashtable* __this = static_cast<_Hashtable*>(this);
__this->__rehash_policy(_Prime_rehash_policy(__z));
}
};
// Class template _Hash_code_base. Encapsulates two policy issues that
// aren't quite orthogonal.
// (1) the difference between using a ranged hash function and using
// the combination of a hash function and a range-hashing function.
// In the former case we don't have such things as hash codes, so
// we have a dummy type as placeholder.
// (2) Whether or not we cache hash codes. Caching hash codes is
// meaningless if we have a ranged hash function.
// We also put the key extraction and equality comparison function
// objects here, for convenience.
// Primary template: unused except as a hook for specializations.
template<typename _Key, typename _Value,
typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash,
bool __cache_hash_code>
struct _Hash_code_base;
// Specialization: ranged hash function, no caching hash codes. H1
// and H2 are provided but ignored. We define a dummy hash code type.
template<typename _Key, typename _Value,
typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash>
struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
_Hash, false>
{
protected:
_Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,
const _H1&, const _H2&, const _Hash& __h)
: _M_extract(__ex), _M_eq(__eq), _M_ranged_hash(__h) { }
typedef void* _Hash_code_type;
_Hash_code_type
_M_hash_code(const _Key& __key) const
{ return 0; }
std::size_t
_M_bucket_index(const _Key& __k, _Hash_code_type,
std::size_t __n) const
{ return _M_ranged_hash(__k, __n); }
std::size_t
_M_bucket_index(const _Hash_node<_Value, false>* __p,
std::size_t __n) const
{ return _M_ranged_hash(_M_extract(__p->_M_v), __n); }
bool
_M_compare(const _Key& __k, _Hash_code_type,
_Hash_node<_Value, false>* __n) const
{ return _M_eq(__k, _M_extract(__n->_M_v)); }
void
_M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const
{ }
void
_M_copy_code(_Hash_node<_Value, false>*,
const _Hash_node<_Value, false>*) const
{ }
void
_M_swap(_Hash_code_base& __x)
{
std::swap(_M_extract, __x._M_extract);
std::swap(_M_eq, __x._M_eq);
std::swap(_M_ranged_hash, __x._M_ranged_hash);
}
protected:
_ExtractKey _M_extract;
_Equal _M_eq;
_Hash _M_ranged_hash;
};
// No specialization for ranged hash function while caching hash codes.
// That combination is meaningless, and trying to do it is an error.
// Specialization: ranged hash function, cache hash codes. This
// combination is meaningless, so we provide only a declaration
// and no definition.
template<typename _Key, typename _Value,
typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash>
struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
_Hash, true>;
// Specialization: hash function and range-hashing function, no
// caching of hash codes. H is provided but ignored. Provides
// typedef and accessor required by TR1.
template<typename _Key, typename _Value,
typename _ExtractKey, typename _Equal,
typename _H1, typename _H2>
struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
_Default_ranged_hash, false>
{
typedef _H1 hasher;
hasher
hash_function() const
{ return _M_h1; }
protected:
_Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,
const _H1& __h1, const _H2& __h2,
const _Default_ranged_hash&)
: _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { }
typedef std::size_t _Hash_code_type;
_Hash_code_type
_M_hash_code(const _Key& __k) const
{ return _M_h1(__k); }
std::size_t
_M_bucket_index(const _Key&, _Hash_code_type __c,
std::size_t __n) const
{ return _M_h2(__c, __n); }
std::size_t
_M_bucket_index(const _Hash_node<_Value, false>* __p,
std::size_t __n) const
{ return _M_h2(_M_h1(_M_extract(__p->_M_v)), __n); }
bool
_M_compare(const _Key& __k, _Hash_code_type,
_Hash_node<_Value, false>* __n) const
{ return _M_eq(__k, _M_extract(__n->_M_v)); }
void
_M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const
{ }
void
_M_copy_code(_Hash_node<_Value, false>*,
const _Hash_node<_Value, false>*) const
{ }
void
_M_swap(_Hash_code_base& __x)
{
std::swap(_M_extract, __x._M_extract);
std::swap(_M_eq, __x._M_eq);
std::swap(_M_h1, __x._M_h1);
std::swap(_M_h2, __x._M_h2);
}
protected:
_ExtractKey _M_extract;
_Equal _M_eq;
_H1 _M_h1;
_H2 _M_h2;
};
// Specialization: hash function and range-hashing function,
// caching hash codes. H is provided but ignored. Provides
// typedef and accessor required by TR1.
template<typename _Key, typename _Value,
typename _ExtractKey, typename _Equal,
typename _H1, typename _H2>
struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
_Default_ranged_hash, true>
{
typedef _H1 hasher;
hasher
hash_function() const
{ return _M_h1; }
protected:
_Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,
const _H1& __h1, const _H2& __h2,
const _Default_ranged_hash&)
: _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { }
typedef std::size_t _Hash_code_type;
_Hash_code_type
_M_hash_code(const _Key& __k) const
{ return _M_h1(__k); }
std::size_t
_M_bucket_index(const _Key&, _Hash_code_type __c,
std::size_t __n) const
{ return _M_h2(__c, __n); }
std::size_t
_M_bucket_index(const _Hash_node<_Value, true>* __p,
std::size_t __n) const
{ return _M_h2(__p->_M_hash_code, __n); }
bool
_M_compare(const _Key& __k, _Hash_code_type __c,
_Hash_node<_Value, true>* __n) const
{ return __c == __n->_M_hash_code && _M_eq(__k, _M_extract(__n->_M_v)); }
void
_M_store_code(_Hash_node<_Value, true>* __n, _Hash_code_type __c) const
{ __n->_M_hash_code = __c; }
void
_M_copy_code(_Hash_node<_Value, true>* __to,
const _Hash_node<_Value, true>* __from) const
{ __to->_M_hash_code = __from->_M_hash_code; }
void
_M_swap(_Hash_code_base& __x)
{
std::swap(_M_extract, __x._M_extract);
std::swap(_M_eq, __x._M_eq);
std::swap(_M_h1, __x._M_h1);
std::swap(_M_h2, __x._M_h2);
}
protected:
_ExtractKey _M_extract;
_Equal _M_eq;
_H1 _M_h1;
_H2 _M_h2;
};
} // namespace __detail
}
_GLIBCXX_END_NAMESPACE_VERSION
}
// TR1 stdbool.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/stdbool.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_STDBOOL_H
#define _TR1_STDBOOL_H 1
#include <tr1/cstdbool>
#endif
// <tr1/shared_ptr.h> -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// shared_count.hpp
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
// shared_ptr.hpp
// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
// Copyright (C) 2001, 2002, 2003 Peter Dimov
// weak_ptr.hpp
// Copyright (C) 2001, 2002, 2003 Peter Dimov
// enable_shared_from_this.hpp
// Copyright (C) 2002 Peter Dimov
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// GCC Note: based on version 1.32.0 of the Boost library.
/** @file tr1/shared_ptr.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/memory}
*/
#ifndef _TR1_SHARED_PTR_H
#define _TR1_SHARED_PTR_H 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/**
* @brief Exception possibly thrown by @c shared_ptr.
* @ingroup exceptions
*/
class bad_weak_ptr : public std::exception
{
public:
virtual char const*
what() const throw()
{ return "tr1::bad_weak_ptr"; }
};
// Substitute for bad_weak_ptr object in the case of -fno-exceptions.
inline void
__throw_bad_weak_ptr()
{ _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); }
using __gnu_cxx::_Lock_policy;
using __gnu_cxx::__default_lock_policy;
using __gnu_cxx::_S_single;
using __gnu_cxx::_S_mutex;
using __gnu_cxx::_S_atomic;
// Empty helper class except when the template argument is _S_mutex.
template<_Lock_policy _Lp>
class _Mutex_base
{
protected:
// The atomic policy uses fully-fenced builtins, single doesn't care.
enum { _S_need_barriers = 0 };
};
template<>
class _Mutex_base<_S_mutex>
: public __gnu_cxx::__mutex
{
protected:
// This policy is used when atomic builtins are not available.
// The replacement atomic operations might not have the necessary
// memory barriers.
enum { _S_need_barriers = 1 };
};
template<_Lock_policy _Lp = __default_lock_policy>
class _Sp_counted_base
: public _Mutex_base<_Lp>
{
public:
_Sp_counted_base()
: _M_use_count(1), _M_weak_count(1) { }
virtual
~_Sp_counted_base() // nothrow
{ }
// Called when _M_use_count drops to zero, to release the resources
// managed by *this.
virtual void
_M_dispose() = 0; // nothrow
// Called when _M_weak_count drops to zero.
virtual void
_M_destroy() // nothrow
{ delete this; }
virtual void*
_M_get_deleter(const std::type_info&) = 0;
void
_M_add_ref_copy()
{ __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
void
_M_add_ref_lock();
void
_M_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
_M_dispose();
// There must be a memory barrier between dispose() and destroy()
// to ensure that the effects of dispose() are observed in the
// thread that runs destroy().
// See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
if (_Mutex_base<_Lp>::_S_need_barriers)
{
__atomic_thread_fence (__ATOMIC_ACQ_REL);
}
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
-1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
_M_destroy();
}
}
}
void
_M_weak_add_ref() // nothrow
{ __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
void
_M_weak_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
if (_Mutex_base<_Lp>::_S_need_barriers)
{
// See _M_release(),
// destroy() must observe results of dispose()
__atomic_thread_fence (__ATOMIC_ACQ_REL);
}
_M_destroy();
}
}
long
_M_get_use_count() const // nothrow
{
// No memory barrier is used here so there is no synchronization
// with other threads.
return const_cast<const volatile _Atomic_word&>(_M_use_count);
}
private:
_Sp_counted_base(_Sp_counted_base const&);
_Sp_counted_base& operator=(_Sp_counted_base const&);
_Atomic_word _M_use_count; // #shared
_Atomic_word _M_weak_count; // #weak + (#shared != 0)
};
template<>
inline void
_Sp_counted_base<_S_single>::
_M_add_ref_lock()
{
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_mutex>::
_M_add_ref_lock()
{
__gnu_cxx::__scoped_lock sentry(*this);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_atomic>::
_M_add_ref_lock()
{
// Perform lock-free add-if-not-zero operation.
_Atomic_word __count = _M_use_count;
do
{
if (__count == 0)
__throw_bad_weak_ptr();
// Replace the current counter value with the old value + 1, as
// long as it's not changed meanwhile.
}
while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1,
true, __ATOMIC_ACQ_REL,
__ATOMIC_RELAXED));
}
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
class _Sp_counted_base_impl
: public _Sp_counted_base<_Lp>
{
public:
// Precondition: __d(__p) must not throw.
_Sp_counted_base_impl(_Ptr __p, _Deleter __d)
: _M_ptr(__p), _M_del(__d) { }
virtual void
_M_dispose() // nothrow
{ _M_del(_M_ptr); }
virtual void*
_M_get_deleter(const std::type_info& __ti)
{
#if __cpp_rtti
return __ti == typeid(_Deleter) ? &_M_del : 0;
#else
return 0;
#endif
}
private:
_Sp_counted_base_impl(const _Sp_counted_base_impl&);
_Sp_counted_base_impl& operator=(const _Sp_counted_base_impl&);
_Ptr _M_ptr; // copy constructor must not throw
_Deleter _M_del; // copy constructor must not throw
};
template<_Lock_policy _Lp = __default_lock_policy>
class __weak_count;
template<typename _Tp>
struct _Sp_deleter
{
typedef void result_type;
typedef _Tp* argument_type;
void operator()(_Tp* __p) const { delete __p; }
};
template<_Lock_policy _Lp = __default_lock_policy>
class __shared_count
{
public:
__shared_count()
: _M_pi(0) // nothrow
{ }
template<typename _Ptr>
__shared_count(_Ptr __p) : _M_pi(0)
{
__try
{
typedef typename std::tr1::remove_pointer<_Ptr>::type _Tp;
_M_pi = new _Sp_counted_base_impl<_Ptr, _Sp_deleter<_Tp>, _Lp>(
__p, _Sp_deleter<_Tp>());
}
__catch(...)
{
delete __p;
__throw_exception_again;
}
}
template<typename _Ptr, typename _Deleter>
__shared_count(_Ptr __p, _Deleter __d) : _M_pi(0)
{
__try
{
_M_pi = new _Sp_counted_base_impl<_Ptr, _Deleter, _Lp>(__p, __d);
}
__catch(...)
{
__d(__p); // Call _Deleter on __p.
__throw_exception_again;
}
}
// Special case for auto_ptr<_Tp> to provide the strong guarantee.
template<typename _Tp>
explicit
__shared_count(std::auto_ptr<_Tp>& __r)
: _M_pi(new _Sp_counted_base_impl<_Tp*,
_Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))
{ __r.release(); }
// Throw bad_weak_ptr when __r._M_get_use_count() == 0.
explicit
__shared_count(const __weak_count<_Lp>& __r);
~__shared_count() // nothrow
{
if (_M_pi != 0)
_M_pi->_M_release();
}
__shared_count(const __shared_count& __r)
: _M_pi(__r._M_pi) // nothrow
{
if (_M_pi != 0)
_M_pi->_M_add_ref_copy();
}
__shared_count&
operator=(const __shared_count& __r) // nothrow
{
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
if (__tmp != _M_pi)
{
if (__tmp != 0)
__tmp->_M_add_ref_copy();
if (_M_pi != 0)
_M_pi->_M_release();
_M_pi = __tmp;
}
return *this;
}
void
_M_swap(__shared_count& __r) // nothrow
{
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
__r._M_pi = _M_pi;
_M_pi = __tmp;
}
long
_M_get_use_count() const // nothrow
{ return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
bool
_M_unique() const // nothrow
{ return this->_M_get_use_count() == 1; }
friend inline bool
operator==(const __shared_count& __a, const __shared_count& __b)
{ return __a._M_pi == __b._M_pi; }
friend inline bool
operator<(const __shared_count& __a, const __shared_count& __b)
{ return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); }
void*
_M_get_deleter(const std::type_info& __ti) const
{ return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; }
private:
friend class __weak_count<_Lp>;
_Sp_counted_base<_Lp>* _M_pi;
};
template<_Lock_policy _Lp>
class __weak_count
{
public:
__weak_count()
: _M_pi(0) // nothrow
{ }
__weak_count(const __shared_count<_Lp>& __r)
: _M_pi(__r._M_pi) // nothrow
{
if (_M_pi != 0)
_M_pi->_M_weak_add_ref();
}
__weak_count(const __weak_count<_Lp>& __r)
: _M_pi(__r._M_pi) // nothrow
{
if (_M_pi != 0)
_M_pi->_M_weak_add_ref();
}
~__weak_count() // nothrow
{
if (_M_pi != 0)
_M_pi->_M_weak_release();
}
__weak_count<_Lp>&
operator=(const __shared_count<_Lp>& __r) // nothrow
{
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
if (__tmp != 0)
__tmp->_M_weak_add_ref();
if (_M_pi != 0)
_M_pi->_M_weak_release();
_M_pi = __tmp;
return *this;
}
__weak_count<_Lp>&
operator=(const __weak_count<_Lp>& __r) // nothrow
{
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
if (__tmp != 0)
__tmp->_M_weak_add_ref();
if (_M_pi != 0)
_M_pi->_M_weak_release();
_M_pi = __tmp;
return *this;
}
void
_M_swap(__weak_count<_Lp>& __r) // nothrow
{
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
__r._M_pi = _M_pi;
_M_pi = __tmp;
}
long
_M_get_use_count() const // nothrow
{ return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
friend inline bool
operator==(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b)
{ return __a._M_pi == __b._M_pi; }
friend inline bool
operator<(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b)
{ return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); }
private:
friend class __shared_count<_Lp>;
_Sp_counted_base<_Lp>* _M_pi;
};
// now that __weak_count is defined we can define this constructor:
template<_Lock_policy _Lp>
inline
__shared_count<_Lp>::
__shared_count(const __weak_count<_Lp>& __r)
: _M_pi(__r._M_pi)
{
if (_M_pi != 0)
_M_pi->_M_add_ref_lock();
else
__throw_bad_weak_ptr();
}
// Forward declarations.
template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
class __shared_ptr;
template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
class __weak_ptr;
template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
class __enable_shared_from_this;
template<typename _Tp>
class shared_ptr;
template<typename _Tp>
class weak_ptr;
template<typename _Tp>
class enable_shared_from_this;
// Support for enable_shared_from_this.
// Friend of __enable_shared_from_this.
template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
void
__enable_shared_from_this_helper(const __shared_count<_Lp>&,
const __enable_shared_from_this<_Tp1,
_Lp>*, const _Tp2*);
// Friend of enable_shared_from_this.
template<typename _Tp1, typename _Tp2>
void
__enable_shared_from_this_helper(const __shared_count<>&,
const enable_shared_from_this<_Tp1>*,
const _Tp2*);
template<_Lock_policy _Lp>
inline void
__enable_shared_from_this_helper(const __shared_count<_Lp>&, ...)
{ }
struct __static_cast_tag { };
struct __const_cast_tag { };
struct __dynamic_cast_tag { };
// A smart pointer with reference-counted copy semantics. The
// object pointed to is deleted when the last shared_ptr pointing to
// it is destroyed or reset.
template<typename _Tp, _Lock_policy _Lp>
class __shared_ptr
{
public:
typedef _Tp element_type;
__shared_ptr()
: _M_ptr(0), _M_refcount() // never throws
{ }
template<typename _Tp1>
explicit
__shared_ptr(_Tp1* __p)
: _M_ptr(__p), _M_refcount(__p)
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
typedef int _IsComplete[sizeof(_Tp1)];
__enable_shared_from_this_helper(_M_refcount, __p, __p);
}
template<typename _Tp1, typename _Deleter>
__shared_ptr(_Tp1* __p, _Deleter __d)
: _M_ptr(__p), _M_refcount(__p, __d)
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
// TODO requires _Deleter CopyConstructible and __d(__p) well-formed
__enable_shared_from_this_helper(_M_refcount, __p, __p);
}
// generated copy constructor, assignment, destructor are fine.
template<typename _Tp1>
__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
: _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
{ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
template<typename _Tp1>
explicit
__shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
: _M_refcount(__r._M_refcount) // may throw
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
// It is now safe to copy __r._M_ptr, as _M_refcount(__r._M_refcount)
// did not throw.
_M_ptr = __r._M_ptr;
}
#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
// Postcondition: use_count() == 1 and __r.get() == 0
template<typename _Tp1>
explicit
__shared_ptr(std::auto_ptr<_Tp1>& __r)
: _M_ptr(__r.get()), _M_refcount()
{ // TODO requries delete __r.release() well-formed
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
typedef int _IsComplete[sizeof(_Tp1)];
_Tp1* __tmp = __r.get();
_M_refcount = __shared_count<_Lp>(__r);
__enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
}
#endif
template<typename _Tp1>
__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __static_cast_tag)
: _M_ptr(static_cast<element_type*>(__r._M_ptr)),
_M_refcount(__r._M_refcount)
{ }
template<typename _Tp1>
__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __const_cast_tag)
: _M_ptr(const_cast<element_type*>(__r._M_ptr)),
_M_refcount(__r._M_refcount)
{ }
template<typename _Tp1>
__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __dynamic_cast_tag)
: _M_ptr(dynamic_cast<element_type*>(__r._M_ptr)),
_M_refcount(__r._M_refcount)
{
if (_M_ptr == 0) // need to allocate new counter -- the cast failed
_M_refcount = __shared_count<_Lp>();
}
template<typename _Tp1>
__shared_ptr&
operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
{
_M_ptr = __r._M_ptr;
_M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw
return *this;
}
#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
__shared_ptr&
operator=(std::auto_ptr<_Tp1>& __r)
{
__shared_ptr(__r).swap(*this);
return *this;
}
#endif
void
reset() // never throws
{ __shared_ptr().swap(*this); }
template<typename _Tp1>
void
reset(_Tp1* __p) // _Tp1 must be complete.
{
// Catch self-reset errors.
_GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr);
__shared_ptr(__p).swap(*this);
}
template<typename _Tp1, typename _Deleter>
void
reset(_Tp1* __p, _Deleter __d)
{ __shared_ptr(__p, __d).swap(*this); }
// Allow class instantiation when _Tp is [cv-qual] void.
typename std::tr1::add_reference<_Tp>::type
operator*() const // never throws
{
_GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
return *_M_ptr;
}
_Tp*
operator->() const // never throws
{
_GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
return _M_ptr;
}
_Tp*
get() const // never throws
{ return _M_ptr; }
// Implicit conversion to "bool"
private:
typedef _Tp* __shared_ptr::*__unspecified_bool_type;
public:
operator __unspecified_bool_type() const // never throws
{ return _M_ptr == 0 ? 0 : &__shared_ptr::_M_ptr; }
bool
unique() const // never throws
{ return _M_refcount._M_unique(); }
long
use_count() const // never throws
{ return _M_refcount._M_get_use_count(); }
void
swap(__shared_ptr<_Tp, _Lp>& __other) // never throws
{
std::swap(_M_ptr, __other._M_ptr);
_M_refcount._M_swap(__other._M_refcount);
}
private:
void*
_M_get_deleter(const std::type_info& __ti) const
{ return _M_refcount._M_get_deleter(__ti); }
template<typename _Tp1, _Lock_policy _Lp1>
bool
_M_less(const __shared_ptr<_Tp1, _Lp1>& __rhs) const
{ return _M_refcount < __rhs._M_refcount; }
template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&);
// Friends injected into enclosing namespace and found by ADL:
template<typename _Tp1>
friend inline bool
operator==(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)
{ return __a.get() == __b.get(); }
template<typename _Tp1>
friend inline bool
operator!=(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)
{ return __a.get() != __b.get(); }
template<typename _Tp1>
friend inline bool
operator<(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)
{ return __a._M_less(__b); }
_Tp* _M_ptr; // Contained pointer.
__shared_count<_Lp> _M_refcount; // Reference counter.
};
// 2.2.3.8 shared_ptr specialized algorithms.
template<typename _Tp, _Lock_policy _Lp>
inline void
swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
{ __a.swap(__b); }
// 2.2.3.9 shared_ptr casts
/* The seemingly equivalent
* shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))
* will eventually result in undefined behaviour,
* attempting to delete the same object twice.
*/
template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
inline __shared_ptr<_Tp, _Lp>
static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
{ return __shared_ptr<_Tp, _Lp>(__r, __static_cast_tag()); }
/* The seemingly equivalent
* shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))
* will eventually result in undefined behaviour,
* attempting to delete the same object twice.
*/
template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
inline __shared_ptr<_Tp, _Lp>
const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
{ return __shared_ptr<_Tp, _Lp>(__r, __const_cast_tag()); }
/* The seemingly equivalent
* shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))
* will eventually result in undefined behaviour,
* attempting to delete the same object twice.
*/
template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
inline __shared_ptr<_Tp, _Lp>
dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
{ return __shared_ptr<_Tp, _Lp>(__r, __dynamic_cast_tag()); }
// 2.2.3.7 shared_ptr I/O
template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
std::basic_ostream<_Ch, _Tr>&
operator<<(std::basic_ostream<_Ch, _Tr>& __os,
const __shared_ptr<_Tp, _Lp>& __p)
{
__os << __p.get();
return __os;
}
// 2.2.3.10 shared_ptr get_deleter (experimental)
template<typename _Del, typename _Tp, _Lock_policy _Lp>
inline _Del*
get_deleter(const __shared_ptr<_Tp, _Lp>& __p)
{
#if __cpp_rtti
return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del)));
#else
return 0;
#endif
}
template<typename _Tp, _Lock_policy _Lp>
class __weak_ptr
{
public:
typedef _Tp element_type;
__weak_ptr()
: _M_ptr(0), _M_refcount() // never throws
{ }
// Generated copy constructor, assignment, destructor are fine.
// The "obvious" converting constructor implementation:
//
// template<typename _Tp1>
// __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
// : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
// { }
//
// has a serious problem.
//
// __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr)
// conversion may require access to *__r._M_ptr (virtual inheritance).
//
// It is not possible to avoid spurious access violations since
// in multithreaded programs __r._M_ptr may be invalidated at any point.
template<typename _Tp1>
__weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
: _M_refcount(__r._M_refcount) // never throws
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
_M_ptr = __r.lock().get();
}
template<typename _Tp1>
__weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
: _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
{ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
template<typename _Tp1>
__weak_ptr&
operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws
{
_M_ptr = __r.lock().get();
_M_refcount = __r._M_refcount;
return *this;
}
template<typename _Tp1>
__weak_ptr&
operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
{
_M_ptr = __r._M_ptr;
_M_refcount = __r._M_refcount;
return *this;
}
__shared_ptr<_Tp, _Lp>
lock() const // never throws
{
#ifdef __GTHREADS
// Optimization: avoid throw overhead.
if (expired())
return __shared_ptr<element_type, _Lp>();
__try
{
return __shared_ptr<element_type, _Lp>(*this);
}
__catch(const bad_weak_ptr&)
{
// Q: How can we get here?
// A: Another thread may have invalidated r after the
// use_count test above.
return __shared_ptr<element_type, _Lp>();
}
#else
// Optimization: avoid try/catch overhead when single threaded.
return expired() ? __shared_ptr<element_type, _Lp>()
: __shared_ptr<element_type, _Lp>(*this);
#endif
} // XXX MT
long
use_count() const // never throws
{ return _M_refcount._M_get_use_count(); }
bool
expired() const // never throws
{ return _M_refcount._M_get_use_count() == 0; }
void
reset() // never throws
{ __weak_ptr().swap(*this); }
void
swap(__weak_ptr& __s) // never throws
{
std::swap(_M_ptr, __s._M_ptr);
_M_refcount._M_swap(__s._M_refcount);
}
private:
// Used by __enable_shared_from_this.
void
_M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount)
{
_M_ptr = __ptr;
_M_refcount = __refcount;
}
template<typename _Tp1>
bool
_M_less(const __weak_ptr<_Tp1, _Lp>& __rhs) const
{ return _M_refcount < __rhs._M_refcount; }
template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
friend class __enable_shared_from_this<_Tp, _Lp>;
friend class enable_shared_from_this<_Tp>;
// Friend injected into namespace and found by ADL.
template<typename _Tp1>
friend inline bool
operator<(const __weak_ptr& __lhs, const __weak_ptr<_Tp1, _Lp>& __rhs)
{ return __lhs._M_less(__rhs); }
_Tp* _M_ptr; // Contained pointer.
__weak_count<_Lp> _M_refcount; // Reference counter.
};
// 2.2.4.7 weak_ptr specialized algorithms.
template<typename _Tp, _Lock_policy _Lp>
inline void
swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b)
{ __a.swap(__b); }
template<typename _Tp, _Lock_policy _Lp>
class __enable_shared_from_this
{
protected:
__enable_shared_from_this() { }
__enable_shared_from_this(const __enable_shared_from_this&) { }
__enable_shared_from_this&
operator=(const __enable_shared_from_this&)
{ return *this; }
~__enable_shared_from_this() { }
public:
__shared_ptr<_Tp, _Lp>
shared_from_this()
{ return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); }
__shared_ptr<const _Tp, _Lp>
shared_from_this() const
{ return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); }
private:
template<typename _Tp1>
void
_M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const
{ _M_weak_this._M_assign(__p, __n); }
template<typename _Tp1>
friend void
__enable_shared_from_this_helper(const __shared_count<_Lp>& __pn,
const __enable_shared_from_this* __pe,
const _Tp1* __px)
{
if (__pe != 0)
__pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
}
mutable __weak_ptr<_Tp, _Lp> _M_weak_this;
};
// The actual shared_ptr, with forwarding constructors and
// assignment operators.
template<typename _Tp>
class shared_ptr
: public __shared_ptr<_Tp>
{
public:
shared_ptr()
: __shared_ptr<_Tp>() { }
template<typename _Tp1>
explicit
shared_ptr(_Tp1* __p)
: __shared_ptr<_Tp>(__p) { }
template<typename _Tp1, typename _Deleter>
shared_ptr(_Tp1* __p, _Deleter __d)
: __shared_ptr<_Tp>(__p, __d) { }
template<typename _Tp1>
shared_ptr(const shared_ptr<_Tp1>& __r)
: __shared_ptr<_Tp>(__r) { }
template<typename _Tp1>
explicit
shared_ptr(const weak_ptr<_Tp1>& __r)
: __shared_ptr<_Tp>(__r) { }
#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
explicit
shared_ptr(std::auto_ptr<_Tp1>& __r)
: __shared_ptr<_Tp>(__r) { }
#endif
template<typename _Tp1>
shared_ptr(const shared_ptr<_Tp1>& __r, __static_cast_tag)
: __shared_ptr<_Tp>(__r, __static_cast_tag()) { }
template<typename _Tp1>
shared_ptr(const shared_ptr<_Tp1>& __r, __const_cast_tag)
: __shared_ptr<_Tp>(__r, __const_cast_tag()) { }
template<typename _Tp1>
shared_ptr(const shared_ptr<_Tp1>& __r, __dynamic_cast_tag)
: __shared_ptr<_Tp>(__r, __dynamic_cast_tag()) { }
template<typename _Tp1>
shared_ptr&
operator=(const shared_ptr<_Tp1>& __r) // never throws
{
this->__shared_ptr<_Tp>::operator=(__r);
return *this;
}
#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
shared_ptr&
operator=(std::auto_ptr<_Tp1>& __r)
{
this->__shared_ptr<_Tp>::operator=(__r);
return *this;
}
#endif
};
// 2.2.3.8 shared_ptr specialized algorithms.
template<typename _Tp>
inline void
swap(__shared_ptr<_Tp>& __a, __shared_ptr<_Tp>& __b)
{ __a.swap(__b); }
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
static_pointer_cast(const shared_ptr<_Tp1>& __r)
{ return shared_ptr<_Tp>(__r, __static_cast_tag()); }
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
const_pointer_cast(const shared_ptr<_Tp1>& __r)
{ return shared_ptr<_Tp>(__r, __const_cast_tag()); }
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
dynamic_pointer_cast(const shared_ptr<_Tp1>& __r)
{ return shared_ptr<_Tp>(__r, __dynamic_cast_tag()); }
// The actual weak_ptr, with forwarding constructors and
// assignment operators.
template<typename _Tp>
class weak_ptr
: public __weak_ptr<_Tp>
{
public:
weak_ptr()
: __weak_ptr<_Tp>() { }
template<typename _Tp1>
weak_ptr(const weak_ptr<_Tp1>& __r)
: __weak_ptr<_Tp>(__r) { }
template<typename _Tp1>
weak_ptr(const shared_ptr<_Tp1>& __r)
: __weak_ptr<_Tp>(__r) { }
template<typename _Tp1>
weak_ptr&
operator=(const weak_ptr<_Tp1>& __r) // never throws
{
this->__weak_ptr<_Tp>::operator=(__r);
return *this;
}
template<typename _Tp1>
weak_ptr&
operator=(const shared_ptr<_Tp1>& __r) // never throws
{
this->__weak_ptr<_Tp>::operator=(__r);
return *this;
}
shared_ptr<_Tp>
lock() const // never throws
{
#ifdef __GTHREADS
if (this->expired())
return shared_ptr<_Tp>();
__try
{
return shared_ptr<_Tp>(*this);
}
__catch(const bad_weak_ptr&)
{
return shared_ptr<_Tp>();
}
#else
return this->expired() ? shared_ptr<_Tp>()
: shared_ptr<_Tp>(*this);
#endif
}
};
template<typename _Tp>
class enable_shared_from_this
{
protected:
enable_shared_from_this() { }
enable_shared_from_this(const enable_shared_from_this&) { }
enable_shared_from_this&
operator=(const enable_shared_from_this&)
{ return *this; }
~enable_shared_from_this() { }
public:
shared_ptr<_Tp>
shared_from_this()
{ return shared_ptr<_Tp>(this->_M_weak_this); }
shared_ptr<const _Tp>
shared_from_this() const
{ return shared_ptr<const _Tp>(this->_M_weak_this); }
private:
template<typename _Tp1>
void
_M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const
{ _M_weak_this._M_assign(__p, __n); }
template<typename _Tp1>
friend void
__enable_shared_from_this_helper(const __shared_count<>& __pn,
const enable_shared_from_this* __pe,
const _Tp1* __px)
{
if (__pe != 0)
__pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
}
mutable weak_ptr<_Tp> _M_weak_this;
};
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _TR1_SHARED_PTR_H
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/exp_integral.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
//
// (1) Handbook of Mathematical Functions,
// Ed. by Milton Abramowitz and Irene A. Stegun,
// Dover Publications, New-York, Section 5, pp. 228-251.
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
// 2nd ed, pp. 222-225.
//
#ifndef _GLIBCXX_TR1_EXP_INTEGRAL_TCC
#define _GLIBCXX_TR1_EXP_INTEGRAL_TCC 1
#include "special_function_util.h"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
template<typename _Tp> _Tp __expint_E1(_Tp);
/**
* @brief Return the exponential integral @f$ E_1(x) @f$
* by series summation. This should be good
* for @f$ x < 1 @f$.
*
* The exponential integral is given by
* \f[
* E_1(x) = \int_{1}^{\infty} \frac{e^{-xt}}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_E1_series(_Tp __x)
{
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
_Tp __term = _Tp(1);
_Tp __esum = _Tp(0);
_Tp __osum = _Tp(0);
const unsigned int __max_iter = 1000;
for (unsigned int __i = 1; __i < __max_iter; ++__i)
{
__term *= - __x / __i;
if (std::abs(__term) < __eps)
break;
if (__term >= _Tp(0))
__esum += __term / __i;
else
__osum += __term / __i;
}
return - __esum - __osum
- __numeric_constants<_Tp>::__gamma_e() - std::log(__x);
}
/**
* @brief Return the exponential integral @f$ E_1(x) @f$
* by asymptotic expansion.
*
* The exponential integral is given by
* \f[
* E_1(x) = \int_{1}^\infty \frac{e^{-xt}}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_E1_asymp(_Tp __x)
{
_Tp __term = _Tp(1);
_Tp __esum = _Tp(1);
_Tp __osum = _Tp(0);
const unsigned int __max_iter = 1000;
for (unsigned int __i = 1; __i < __max_iter; ++__i)
{
_Tp __prev = __term;
__term *= - __i / __x;
if (std::abs(__term) > std::abs(__prev))
break;
if (__term >= _Tp(0))
__esum += __term;
else
__osum += __term;
}
return std::exp(- __x) * (__esum + __osum) / __x;
}
/**
* @brief Return the exponential integral @f$ E_n(x) @f$
* by series summation.
*
* The exponential integral is given by
* \f[
* E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
* \f]
*
* @param __n The order of the exponential integral function.
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_En_series(unsigned int __n, _Tp __x)
{
const unsigned int __max_iter = 1000;
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const int __nm1 = __n - 1;
_Tp __ans = (__nm1 != 0
? _Tp(1) / __nm1 : -std::log(__x)
- __numeric_constants<_Tp>::__gamma_e());
_Tp __fact = _Tp(1);
for (int __i = 1; __i <= __max_iter; ++__i)
{
__fact *= -__x / _Tp(__i);
_Tp __del;
if ( __i != __nm1 )
__del = -__fact / _Tp(__i - __nm1);
else
{
_Tp __psi = -__numeric_constants<_Tp>::gamma_e();
for (int __ii = 1; __ii <= __nm1; ++__ii)
__psi += _Tp(1) / _Tp(__ii);
__del = __fact * (__psi - std::log(__x));
}
__ans += __del;
if (std::abs(__del) < __eps * std::abs(__ans))
return __ans;
}
std::__throw_runtime_error(__N("Series summation failed "
"in __expint_En_series."));
}
/**
* @brief Return the exponential integral @f$ E_n(x) @f$
* by continued fractions.
*
* The exponential integral is given by
* \f[
* E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
* \f]
*
* @param __n The order of the exponential integral function.
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_En_cont_frac(unsigned int __n, _Tp __x)
{
const unsigned int __max_iter = 1000;
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __fp_min = std::numeric_limits<_Tp>::min();
const int __nm1 = __n - 1;
_Tp __b = __x + _Tp(__n);
_Tp __c = _Tp(1) / __fp_min;
_Tp __d = _Tp(1) / __b;
_Tp __h = __d;
for ( unsigned int __i = 1; __i <= __max_iter; ++__i )
{
_Tp __a = -_Tp(__i * (__nm1 + __i));
__b += _Tp(2);
__d = _Tp(1) / (__a * __d + __b);
__c = __b + __a / __c;
const _Tp __del = __c * __d;
__h *= __del;
if (std::abs(__del - _Tp(1)) < __eps)
{
const _Tp __ans = __h * std::exp(-__x);
return __ans;
}
}
std::__throw_runtime_error(__N("Continued fraction failed "
"in __expint_En_cont_frac."));
}
/**
* @brief Return the exponential integral @f$ E_n(x) @f$
* by recursion. Use upward recursion for @f$ x < n @f$
* and downward recursion (Miller's algorithm) otherwise.
*
* The exponential integral is given by
* \f[
* E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
* \f]
*
* @param __n The order of the exponential integral function.
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_En_recursion(unsigned int __n, _Tp __x)
{
_Tp __En;
_Tp __E1 = __expint_E1(__x);
if (__x < _Tp(__n))
{
// Forward recursion is stable only for n < x.
__En = __E1;
for (unsigned int __j = 2; __j < __n; ++__j)
__En = (std::exp(-__x) - __x * __En) / _Tp(__j - 1);
}
else
{
// Backward recursion is stable only for n >= x.
__En = _Tp(1);
const int __N = __n + 20; // TODO: Check this starting number.
_Tp __save = _Tp(0);
for (int __j = __N; __j > 0; --__j)
{
__En = (std::exp(-__x) - __j * __En) / __x;
if (__j == __n)
__save = __En;
}
_Tp __norm = __En / __E1;
__En /= __norm;
}
return __En;
}
/**
* @brief Return the exponential integral @f$ Ei(x) @f$
* by series summation.
*
* The exponential integral is given by
* \f[
* Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_Ei_series(_Tp __x)
{
_Tp __term = _Tp(1);
_Tp __sum = _Tp(0);
const unsigned int __max_iter = 1000;
for (unsigned int __i = 1; __i < __max_iter; ++__i)
{
__term *= __x / __i;
__sum += __term / __i;
if (__term < std::numeric_limits<_Tp>::epsilon() * __sum)
break;
}
return __numeric_constants<_Tp>::__gamma_e() + __sum + std::log(__x);
}
/**
* @brief Return the exponential integral @f$ Ei(x) @f$
* by asymptotic expansion.
*
* The exponential integral is given by
* \f[
* Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_Ei_asymp(_Tp __x)
{
_Tp __term = _Tp(1);
_Tp __sum = _Tp(1);
const unsigned int __max_iter = 1000;
for (unsigned int __i = 1; __i < __max_iter; ++__i)
{
_Tp __prev = __term;
__term *= __i / __x;
if (__term < std::numeric_limits<_Tp>::epsilon())
break;
if (__term >= __prev)
break;
__sum += __term;
}
return std::exp(__x) * __sum / __x;
}
/**
* @brief Return the exponential integral @f$ Ei(x) @f$.
*
* The exponential integral is given by
* \f[
* Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_Ei(_Tp __x)
{
if (__x < _Tp(0))
return -__expint_E1(-__x);
else if (__x < -std::log(std::numeric_limits<_Tp>::epsilon()))
return __expint_Ei_series(__x);
else
return __expint_Ei_asymp(__x);
}
/**
* @brief Return the exponential integral @f$ E_1(x) @f$.
*
* The exponential integral is given by
* \f[
* E_1(x) = \int_{1}^\infty \frac{e^{-xt}}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_E1(_Tp __x)
{
if (__x < _Tp(0))
return -__expint_Ei(-__x);
else if (__x < _Tp(1))
return __expint_E1_series(__x);
else if (__x < _Tp(100)) // TODO: Find a good asymptotic switch point.
return __expint_En_cont_frac(1, __x);
else
return __expint_E1_asymp(__x);
}
/**
* @brief Return the exponential integral @f$ E_n(x) @f$
* for large argument.
*
* The exponential integral is given by
* \f[
* E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
* \f]
*
* This is something of an extension.
*
* @param __n The order of the exponential integral function.
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_asymp(unsigned int __n, _Tp __x)
{
_Tp __term = _Tp(1);
_Tp __sum = _Tp(1);
for (unsigned int __i = 1; __i <= __n; ++__i)
{
_Tp __prev = __term;
__term *= -(__n - __i + 1) / __x;
if (std::abs(__term) > std::abs(__prev))
break;
__sum += __term;
}
return std::exp(-__x) * __sum / __x;
}
/**
* @brief Return the exponential integral @f$ E_n(x) @f$
* for large order.
*
* The exponential integral is given by
* \f[
* E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
* \f]
*
* This is something of an extension.
*
* @param __n The order of the exponential integral function.
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint_large_n(unsigned int __n, _Tp __x)
{
const _Tp __xpn = __x + __n;
const _Tp __xpn2 = __xpn * __xpn;
_Tp __term = _Tp(1);
_Tp __sum = _Tp(1);
for (unsigned int __i = 1; __i <= __n; ++__i)
{
_Tp __prev = __term;
__term *= (__n - 2 * (__i - 1) * __x) / __xpn2;
if (std::abs(__term) < std::numeric_limits<_Tp>::epsilon())
break;
__sum += __term;
}
return std::exp(-__x) * __sum / __xpn;
}
/**
* @brief Return the exponential integral @f$ E_n(x) @f$.
*
* The exponential integral is given by
* \f[
* E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
* \f]
* This is something of an extension.
*
* @param __n The order of the exponential integral function.
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
_Tp
__expint(unsigned int __n, _Tp __x)
{
// Return NaN on NaN input.
if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__n <= 1 && __x == _Tp(0))
return std::numeric_limits<_Tp>::infinity();
else
{
_Tp __E0 = std::exp(__x) / __x;
if (__n == 0)
return __E0;
_Tp __E1 = __expint_E1(__x);
if (__n == 1)
return __E1;
if (__x == _Tp(0))
return _Tp(1) / static_cast<_Tp>(__n - 1);
_Tp __En = __expint_En_recursion(__n, __x);
return __En;
}
}
/**
* @brief Return the exponential integral @f$ Ei(x) @f$.
*
* The exponential integral is given by
* \f[
* Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
* \f]
*
* @param __x The argument of the exponential integral function.
* @return The exponential integral.
*/
template<typename _Tp>
inline _Tp
__expint(_Tp __x)
{
if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else
return __expint_Ei(__x);
}
} // namespace __detail
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_EXP_INTEGRAL_TCC
// TR1 unordered_set -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/unordered_set
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_UNORDERED_SET
#define _GLIBCXX_TR1_UNORDERED_SET 1
#pragma GCC system_header
#include <utility>
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
#include <bits/stringfwd.h>
#include <tr1/type_traits>
#include <tr1/functional_hash.h>
#include <tr1/hashtable.h>
#include <tr1/unordered_set.h>
#endif // _GLIBCXX_TR1_UNORDERED_SET
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/poly_laguerre.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) Handbook of Mathematical Functions,
// Ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 13, pp. 509-510, Section 22 pp. 773-802
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
#ifndef _GLIBCXX_TR1_POLY_LAGUERRE_TCC
#define _GLIBCXX_TR1_POLY_LAGUERRE_TCC 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief This routine returns the associated Laguerre polynomial
* of order @f$ n @f$, degree @f$ \alpha @f$ for large n.
* Abramowitz & Stegun, 13.5.21
*
* @param __n The order of the Laguerre function.
* @param __alpha The degree of the Laguerre function.
* @param __x The argument of the Laguerre function.
* @return The value of the Laguerre function of order n,
* degree @f$ \alpha @f$, and argument x.
*
* This is from the GNU Scientific Library.
*/
template<typename _Tpa, typename _Tp>
_Tp
__poly_laguerre_large_n(unsigned __n, _Tpa __alpha1, _Tp __x)
{
const _Tp __a = -_Tp(__n);
const _Tp __b = _Tp(__alpha1) + _Tp(1);
const _Tp __eta = _Tp(2) * __b - _Tp(4) * __a;
const _Tp __cos2th = __x / __eta;
const _Tp __sin2th = _Tp(1) - __cos2th;
const _Tp __th = std::acos(std::sqrt(__cos2th));
const _Tp __pre_h = __numeric_constants<_Tp>::__pi_2()
* __numeric_constants<_Tp>::__pi_2()
* __eta * __eta * __cos2th * __sin2th;
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __lg_b = _GLIBCXX_MATH_NS::lgamma(_Tp(__n) + __b);
const _Tp __lnfact = _GLIBCXX_MATH_NS::lgamma(_Tp(__n + 1));
#else
const _Tp __lg_b = __log_gamma(_Tp(__n) + __b);
const _Tp __lnfact = __log_gamma(_Tp(__n + 1));
#endif
_Tp __pre_term1 = _Tp(0.5L) * (_Tp(1) - __b)
* std::log(_Tp(0.25L) * __x * __eta);
_Tp __pre_term2 = _Tp(0.25L) * std::log(__pre_h);
_Tp __lnpre = __lg_b - __lnfact + _Tp(0.5L) * __x
+ __pre_term1 - __pre_term2;
_Tp __ser_term1 = std::sin(__a * __numeric_constants<_Tp>::__pi());
_Tp __ser_term2 = std::sin(_Tp(0.25L) * __eta
* (_Tp(2) * __th
- std::sin(_Tp(2) * __th))
+ __numeric_constants<_Tp>::__pi_4());
_Tp __ser = __ser_term1 + __ser_term2;
return std::exp(__lnpre) * __ser;
}
/**
* @brief Evaluate the polynomial based on the confluent hypergeometric
* function in a safe way, with no restriction on the arguments.
*
* The associated Laguerre function is defined by
* @f[
* L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!}
* _1F_1(-n; \alpha + 1; x)
* @f]
* where @f$ (\alpha)_n @f$ is the Pochhammer symbol and
* @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function.
*
* This function assumes x != 0.
*
* This is from the GNU Scientific Library.
*/
template<typename _Tpa, typename _Tp>
_Tp
__poly_laguerre_hyperg(unsigned int __n, _Tpa __alpha1, _Tp __x)
{
const _Tp __b = _Tp(__alpha1) + _Tp(1);
const _Tp __mx = -__x;
const _Tp __tc_sgn = (__x < _Tp(0) ? _Tp(1)
: ((__n % 2 == 1) ? -_Tp(1) : _Tp(1)));
// Get |x|^n/n!
_Tp __tc = _Tp(1);
const _Tp __ax = std::abs(__x);
for (unsigned int __k = 1; __k <= __n; ++__k)
__tc *= (__ax / __k);
_Tp __term = __tc * __tc_sgn;
_Tp __sum = __term;
for (int __k = int(__n) - 1; __k >= 0; --__k)
{
__term *= ((__b + _Tp(__k)) / _Tp(int(__n) - __k))
* _Tp(__k + 1) / __mx;
__sum += __term;
}
return __sum;
}
/**
* @brief This routine returns the associated Laguerre polynomial
* of order @f$ n @f$, degree @f$ \alpha @f$: @f$ L_n^\alpha(x) @f$
* by recursion.
*
* The associated Laguerre function is defined by
* @f[
* L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!}
* _1F_1(-n; \alpha + 1; x)
* @f]
* where @f$ (\alpha)_n @f$ is the Pochhammer symbol and
* @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function.
*
* The associated Laguerre polynomial is defined for integral
* @f$ \alpha = m @f$ by:
* @f[
* L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x)
* @f]
* where the Laguerre polynomial is defined by:
* @f[
* L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
* @f]
*
* @param __n The order of the Laguerre function.
* @param __alpha The degree of the Laguerre function.
* @param __x The argument of the Laguerre function.
* @return The value of the Laguerre function of order n,
* degree @f$ \alpha @f$, and argument x.
*/
template<typename _Tpa, typename _Tp>
_Tp
__poly_laguerre_recursion(unsigned int __n, _Tpa __alpha1, _Tp __x)
{
// Compute l_0.
_Tp __l_0 = _Tp(1);
if (__n == 0)
return __l_0;
// Compute l_1^alpha.
_Tp __l_1 = -__x + _Tp(1) + _Tp(__alpha1);
if (__n == 1)
return __l_1;
// Compute l_n^alpha by recursion on n.
_Tp __l_n2 = __l_0;
_Tp __l_n1 = __l_1;
_Tp __l_n = _Tp(0);
for (unsigned int __nn = 2; __nn <= __n; ++__nn)
{
__l_n = (_Tp(2 * __nn - 1) + _Tp(__alpha1) - __x)
* __l_n1 / _Tp(__nn)
- (_Tp(__nn - 1) + _Tp(__alpha1)) * __l_n2 / _Tp(__nn);
__l_n2 = __l_n1;
__l_n1 = __l_n;
}
return __l_n;
}
/**
* @brief This routine returns the associated Laguerre polynomial
* of order n, degree @f$ \alpha @f$: @f$ L_n^alpha(x) @f$.
*
* The associated Laguerre function is defined by
* @f[
* L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!}
* _1F_1(-n; \alpha + 1; x)
* @f]
* where @f$ (\alpha)_n @f$ is the Pochhammer symbol and
* @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function.
*
* The associated Laguerre polynomial is defined for integral
* @f$ \alpha = m @f$ by:
* @f[
* L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x)
* @f]
* where the Laguerre polynomial is defined by:
* @f[
* L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
* @f]
*
* @param __n The order of the Laguerre function.
* @param __alpha The degree of the Laguerre function.
* @param __x The argument of the Laguerre function.
* @return The value of the Laguerre function of order n,
* degree @f$ \alpha @f$, and argument x.
*/
template<typename _Tpa, typename _Tp>
_Tp
__poly_laguerre(unsigned int __n, _Tpa __alpha1, _Tp __x)
{
if (__x < _Tp(0))
std::__throw_domain_error(__N("Negative argument "
"in __poly_laguerre."));
// Return NaN on NaN input.
else if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__n == 0)
return _Tp(1);
else if (__n == 1)
return _Tp(1) + _Tp(__alpha1) - __x;
else if (__x == _Tp(0))
{
_Tp __prod = _Tp(__alpha1) + _Tp(1);
for (unsigned int __k = 2; __k <= __n; ++__k)
__prod *= (_Tp(__alpha1) + _Tp(__k)) / _Tp(__k);
return __prod;
}
else if (__n > 10000000 && _Tp(__alpha1) > -_Tp(1)
&& __x < _Tp(2) * (_Tp(__alpha1) + _Tp(1)) + _Tp(4 * __n))
return __poly_laguerre_large_n(__n, __alpha1, __x);
else if (_Tp(__alpha1) >= _Tp(0)
|| (__x > _Tp(0) && _Tp(__alpha1) < -_Tp(__n + 1)))
return __poly_laguerre_recursion(__n, __alpha1, __x);
else
return __poly_laguerre_hyperg(__n, __alpha1, __x);
}
/**
* @brief This routine returns the associated Laguerre polynomial
* of order n, degree m: @f$ L_n^m(x) @f$.
*
* The associated Laguerre polynomial is defined for integral
* @f$ \alpha = m @f$ by:
* @f[
* L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x)
* @f]
* where the Laguerre polynomial is defined by:
* @f[
* L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
* @f]
*
* @param __n The order of the Laguerre polynomial.
* @param __m The degree of the Laguerre polynomial.
* @param __x The argument of the Laguerre polynomial.
* @return The value of the associated Laguerre polynomial of order n,
* degree m, and argument x.
*/
template<typename _Tp>
inline _Tp
__assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
{ return __poly_laguerre<unsigned int, _Tp>(__n, __m, __x); }
/**
* @brief This routine returns the Laguerre polynomial
* of order n: @f$ L_n(x) @f$.
*
* The Laguerre polynomial is defined by:
* @f[
* L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
* @f]
*
* @param __n The order of the Laguerre polynomial.
* @param __x The argument of the Laguerre polynomial.
* @return The value of the Laguerre polynomial of order n
* and argument x.
*/
template<typename _Tp>
inline _Tp
__laguerre(unsigned int __n, _Tp __x)
{ return __poly_laguerre<unsigned int, _Tp>(__n, 0, __x); }
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_POLY_LAGUERRE_TCC
// class template tuple -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/tuple
* This is a TR1 C++ Library header.
*/
// Chris Jefferson <chris@bubblescope.net>
// Variadic Templates support by Douglas Gregor <doug.gregor@gmail.com>
#ifndef _GLIBCXX_TR1_TUPLE
#define _GLIBCXX_TR1_TUPLE 1
#pragma GCC system_header
#include <utility>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
// Adds a const reference to a non-reference type.
template<typename _Tp>
struct __add_c_ref
{ typedef const _Tp& type; };
template<typename _Tp>
struct __add_c_ref<_Tp&>
{ typedef _Tp& type; };
// Adds a reference to a non-reference type.
template<typename _Tp>
struct __add_ref
{ typedef _Tp& type; };
template<typename _Tp>
struct __add_ref<_Tp&>
{ typedef _Tp& type; };
/**
* Contains the actual implementation of the @c tuple template, stored
* as a recursive inheritance hierarchy from the first element (most
* derived class) to the last (least derived class). The @c Idx
* parameter gives the 0-based index of the element stored at this
* point in the hierarchy; we use it to implement a constant-time
* get() operation.
*/
template<int _Idx, typename... _Elements>
struct _Tuple_impl;
/**
* Zero-element tuple implementation. This is the basis case for the
* inheritance recursion.
*/
template<int _Idx>
struct _Tuple_impl<_Idx> { };
/**
* Recursive tuple implementation. Here we store the @c Head element
* and derive from a @c Tuple_impl containing the remaining elements
* (which contains the @c Tail).
*/
template<int _Idx, typename _Head, typename... _Tail>
struct _Tuple_impl<_Idx, _Head, _Tail...>
: public _Tuple_impl<_Idx + 1, _Tail...>
{
typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
_Head _M_head;
_Inherited& _M_tail() { return *this; }
const _Inherited& _M_tail() const { return *this; }
_Tuple_impl() : _Inherited(), _M_head() { }
explicit
_Tuple_impl(typename __add_c_ref<_Head>::type __head,
typename __add_c_ref<_Tail>::type... __tail)
: _Inherited(__tail...), _M_head(__head) { }
template<typename... _UElements>
_Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
: _Inherited(__in._M_tail()), _M_head(__in._M_head) { }
_Tuple_impl(const _Tuple_impl& __in)
: _Inherited(__in._M_tail()), _M_head(__in._M_head) { }
template<typename... _UElements>
_Tuple_impl&
operator=(const _Tuple_impl<_Idx, _UElements...>& __in)
{
_M_head = __in._M_head;
_M_tail() = __in._M_tail();
return *this;
}
_Tuple_impl&
operator=(const _Tuple_impl& __in)
{
_M_head = __in._M_head;
_M_tail() = __in._M_tail();
return *this;
}
};
template<typename... _Elements>
class tuple : public _Tuple_impl<0, _Elements...>
{
typedef _Tuple_impl<0, _Elements...> _Inherited;
public:
tuple() : _Inherited() { }
explicit
tuple(typename __add_c_ref<_Elements>::type... __elements)
: _Inherited(__elements...) { }
template<typename... _UElements>
tuple(const tuple<_UElements...>& __in)
: _Inherited(__in) { }
tuple(const tuple& __in)
: _Inherited(__in) { }
template<typename... _UElements>
tuple&
operator=(const tuple<_UElements...>& __in)
{
static_cast<_Inherited&>(*this) = __in;
return *this;
}
tuple&
operator=(const tuple& __in)
{
static_cast<_Inherited&>(*this) = __in;
return *this;
}
};
template<> class tuple<> { };
// 2-element tuple, with construction and assignment from a pair.
template<typename _T1, typename _T2>
class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
{
typedef _Tuple_impl<0, _T1, _T2> _Inherited;
public:
tuple() : _Inherited() { }
explicit
tuple(typename __add_c_ref<_T1>::type __a1,
typename __add_c_ref<_T2>::type __a2)
: _Inherited(__a1, __a2) { }
template<typename _U1, typename _U2>
tuple(const tuple<_U1, _U2>& __in)
: _Inherited(__in) { }
tuple(const tuple& __in)
: _Inherited(__in) { }
template<typename _U1, typename _U2>
tuple(const pair<_U1, _U2>& __in)
: _Inherited(_Tuple_impl<0,
typename __add_c_ref<_U1>::type,
typename __add_c_ref<_U2>::type>(__in.first,
__in.second))
{ }
template<typename _U1, typename _U2>
tuple&
operator=(const tuple<_U1, _U2>& __in)
{
static_cast<_Inherited&>(*this) = __in;
return *this;
}
tuple&
operator=(const tuple& __in)
{
static_cast<_Inherited&>(*this) = __in;
return *this;
}
template<typename _U1, typename _U2>
tuple&
operator=(const pair<_U1, _U2>& __in)
{
this->_M_head = __in.first;
this->_M_tail()._M_head = __in.second;
return *this;
}
};
/// Gives the type of the ith element of a given tuple type.
template<int __i, typename _Tp>
struct tuple_element;
/**
* Recursive case for tuple_element: strip off the first element in
* the tuple and retrieve the (i-1)th element of the remaining tuple.
*/
template<int __i, typename _Head, typename... _Tail>
struct tuple_element<__i, tuple<_Head, _Tail...> >
: tuple_element<__i - 1, tuple<_Tail...> > { };
/**
* Basis case for tuple_element: The first element is the one we're seeking.
*/
template<typename _Head, typename... _Tail>
struct tuple_element<0, tuple<_Head, _Tail...> >
{
typedef _Head type;
};
/// Finds the size of a given tuple type.
template<typename _Tp>
struct tuple_size;
/// class tuple_size
template<typename... _Elements>
struct tuple_size<tuple<_Elements...> >
{
static const int value = sizeof...(_Elements);
};
template<typename... _Elements>
const int tuple_size<tuple<_Elements...> >::value;
template<int __i, typename _Head, typename... _Tail>
inline typename __add_ref<_Head>::type
__get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
{
return __t._M_head;
}
template<int __i, typename _Head, typename... _Tail>
inline typename __add_c_ref<_Head>::type
__get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
{
return __t._M_head;
}
// Return a reference (const reference) to the ith element of a tuple.
// Any const or non-const ref elements are returned with their original type.
template<int __i, typename... _Elements>
inline typename __add_ref<
typename tuple_element<__i, tuple<_Elements...> >::type
>::type
get(tuple<_Elements...>& __t)
{
return __get_helper<__i>(__t);
}
template<int __i, typename... _Elements>
inline typename __add_c_ref<
typename tuple_element<__i, tuple<_Elements...> >::type
>::type
get(const tuple<_Elements...>& __t)
{
return __get_helper<__i>(__t);
}
// This class helps construct the various comparison operations on tuples
template<int __check_equal_size, int __i, int __j,
typename _Tp, typename _Up>
struct __tuple_compare;
template<int __i, int __j, typename _Tp, typename _Up>
struct __tuple_compare<0, __i, __j, _Tp, _Up>
{
static bool __eq(const _Tp& __t, const _Up& __u)
{
return (get<__i>(__t) == get<__i>(__u) &&
__tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u));
}
static bool __less(const _Tp& __t, const _Up& __u)
{
return ((get<__i>(__t) < get<__i>(__u))
|| !(get<__i>(__u) < get<__i>(__t)) &&
__tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u));
}
};
template<int __i, typename _Tp, typename _Up>
struct __tuple_compare<0, __i, __i, _Tp, _Up>
{
static bool __eq(const _Tp&, const _Up&)
{ return true; }
static bool __less(const _Tp&, const _Up&)
{ return false; }
};
template<typename... _TElements, typename... _UElements>
bool
operator==(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{
typedef tuple<_TElements...> _Tp;
typedef tuple<_UElements...> _Up;
return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u));
}
template<typename... _TElements, typename... _UElements>
bool
operator<(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{
typedef tuple<_TElements...> _Tp;
typedef tuple<_UElements...> _Up;
return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u));
}
template<typename... _TElements, typename... _UElements>
inline bool
operator!=(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return !(__t == __u); }
template<typename... _TElements, typename... _UElements>
inline bool
operator>(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return __u < __t; }
template<typename... _TElements, typename... _UElements>
inline bool
operator<=(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return !(__u < __t); }
template<typename... _TElements, typename... _UElements>
inline bool
operator>=(const tuple<_TElements...>& __t,
const tuple<_UElements...>& __u)
{ return !(__t < __u); }
template<typename _Tp>
class reference_wrapper;
// Helper which adds a reference to a type when given a reference_wrapper
template<typename _Tp>
struct __strip_reference_wrapper
{
typedef _Tp __type;
};
template<typename _Tp>
struct __strip_reference_wrapper<reference_wrapper<_Tp> >
{
typedef _Tp& __type;
};
template<typename _Tp>
struct __strip_reference_wrapper<const reference_wrapper<_Tp> >
{
typedef _Tp& __type;
};
template<typename... _Elements>
inline tuple<typename __strip_reference_wrapper<_Elements>::__type...>
make_tuple(_Elements... __args)
{
typedef tuple<typename __strip_reference_wrapper<_Elements>::__type...>
__result_type;
return __result_type(__args...);
}
template<typename... _Elements>
inline tuple<_Elements&...>
tie(_Elements&... __args)
{
return tuple<_Elements&...>(__args...);
}
// A class (and instance) which can be used in 'tie' when an element
// of a tuple is not required
struct _Swallow_assign
{
template<class _Tp>
_Swallow_assign&
operator=(const _Tp&)
{ return *this; }
};
// TODO: Put this in some kind of shared file.
namespace
{
_Swallow_assign ignore;
}; // anonymous namespace
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_TUPLE
// TR1 fenv.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/fenv.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_FENV_H
#define _TR1_FENV_H 1
#include <tr1/cfenv>
#endif
// TR1 math.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/math.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_MATH_H
#define _GLIBCXX_TR1_MATH_H 1
#include <tr1/cmath>
#if _GLIBCXX_USE_C99_MATH_TR1
using std::tr1::acos;
using std::tr1::acosh;
using std::tr1::asin;
using std::tr1::asinh;
using std::tr1::atan;
using std::tr1::atan2;
using std::tr1::atanh;
using std::tr1::cbrt;
using std::tr1::ceil;
using std::tr1::copysign;
using std::tr1::cos;
using std::tr1::cosh;
using std::tr1::erf;
using std::tr1::erfc;
using std::tr1::exp;
using std::tr1::exp2;
using std::tr1::expm1;
using std::tr1::fabs;
using std::tr1::fdim;
using std::tr1::floor;
using std::tr1::fma;
using std::tr1::fmax;
using std::tr1::fmin;
using std::tr1::fmod;
using std::tr1::frexp;
using std::tr1::hypot;
using std::tr1::ilogb;
using std::tr1::ldexp;
using std::tr1::lgamma;
using std::tr1::llrint;
using std::tr1::llround;
using std::tr1::log;
using std::tr1::log10;
using std::tr1::log1p;
using std::tr1::log2;
using std::tr1::logb;
using std::tr1::lrint;
using std::tr1::lround;
using std::tr1::nearbyint;
using std::tr1::nextafter;
using std::tr1::nexttoward;
using std::tr1::pow;
using std::tr1::remainder;
using std::tr1::remquo;
using std::tr1::rint;
using std::tr1::round;
using std::tr1::scalbln;
using std::tr1::scalbn;
using std::tr1::sin;
using std::tr1::sinh;
using std::tr1::sqrt;
using std::tr1::tan;
using std::tr1::tanh;
using std::tr1::tgamma;
using std::tr1::trunc;
#endif
using std::tr1::assoc_laguerref;
using std::tr1::assoc_laguerre;
using std::tr1::assoc_laguerrel;
using std::tr1::assoc_legendref;
using std::tr1::assoc_legendre;
using std::tr1::assoc_legendrel;
using std::tr1::betaf;
using std::tr1::beta;
using std::tr1::betal;
using std::tr1::comp_ellint_1f;
using std::tr1::comp_ellint_1;
using std::tr1::comp_ellint_1l;
using std::tr1::comp_ellint_2f;
using std::tr1::comp_ellint_2;
using std::tr1::comp_ellint_2l;
using std::tr1::comp_ellint_3f;
using std::tr1::comp_ellint_3;
using std::tr1::comp_ellint_3l;
using std::tr1::conf_hypergf;
using std::tr1::conf_hyperg;
using std::tr1::conf_hypergl;
using std::tr1::cyl_bessel_if;
using std::tr1::cyl_bessel_i;
using std::tr1::cyl_bessel_il;
using std::tr1::cyl_bessel_jf;
using std::tr1::cyl_bessel_j;
using std::tr1::cyl_bessel_jl;
using std::tr1::cyl_bessel_kf;
using std::tr1::cyl_bessel_k;
using std::tr1::cyl_bessel_kl;
using std::tr1::cyl_neumannf;
using std::tr1::cyl_neumann;
using std::tr1::cyl_neumannl;
using std::tr1::ellint_1f;
using std::tr1::ellint_1;
using std::tr1::ellint_1l;
using std::tr1::ellint_2f;
using std::tr1::ellint_2;
using std::tr1::ellint_2l;
using std::tr1::ellint_3f;
using std::tr1::ellint_3;
using std::tr1::ellint_3l;
using std::tr1::expintf;
using std::tr1::expint;
using std::tr1::expintl;
using std::tr1::hermitef;
using std::tr1::hermite;
using std::tr1::hermitel;
using std::tr1::hypergf;
using std::tr1::hyperg;
using std::tr1::hypergl;
using std::tr1::laguerref;
using std::tr1::laguerre;
using std::tr1::laguerrel;
using std::tr1::legendref;
using std::tr1::legendre;
using std::tr1::legendrel;
using std::tr1::riemann_zetaf;
using std::tr1::riemann_zeta;
using std::tr1::riemann_zetal;
using std::tr1::sph_besself;
using std::tr1::sph_bessel;
using std::tr1::sph_bessell;
using std::tr1::sph_legendref;
using std::tr1::sph_legendre;
using std::tr1::sph_legendrel;
using std::tr1::sph_neumannf;
using std::tr1::sph_neumann;
using std::tr1::sph_neumannl;
#endif // _GLIBCXX_TR1_MATH_H
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/hypergeometric.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based:
// (1) Handbook of Mathematical Functions,
// ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 6, pp. 555-566
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
#ifndef _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
#define _GLIBCXX_TR1_HYPERGEOMETRIC_TCC 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief This routine returns the confluent hypergeometric function
* by series expansion.
*
* @f[
* _1F_1(a;c;x) = \frac{\Gamma(c)}{\Gamma(a)}
* \sum_{n=0}^{\infty}
* \frac{\Gamma(a+n)}{\Gamma(c+n)}
* \frac{x^n}{n!}
* @f]
*
* If a and b are integers and a < 0 and either b > 0 or b < a
* then the series is a polynomial with a finite number of
* terms. If b is an integer and b <= 0 the confluent
* hypergeometric function is undefined.
*
* @param __a The "numerator" parameter.
* @param __c The "denominator" parameter.
* @param __x The argument of the confluent hypergeometric function.
* @return The confluent hypergeometric function.
*/
template<typename _Tp>
_Tp
__conf_hyperg_series(_Tp __a, _Tp __c, _Tp __x)
{
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
_Tp __term = _Tp(1);
_Tp __Fac = _Tp(1);
const unsigned int __max_iter = 100000;
unsigned int __i;
for (__i = 0; __i < __max_iter; ++__i)
{
__term *= (__a + _Tp(__i)) * __x
/ ((__c + _Tp(__i)) * _Tp(1 + __i));
if (std::abs(__term) < __eps)
{
break;
}
__Fac += __term;
}
if (__i == __max_iter)
std::__throw_runtime_error(__N("Series failed to converge "
"in __conf_hyperg_series."));
return __Fac;
}
/**
* @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
* by an iterative procedure described in
* Luke, Algorithms for the Computation of Mathematical Functions.
*
* Like the case of the 2F1 rational approximations, these are
* probably guaranteed to converge for x < 0, barring gross
* numerical instability in the pre-asymptotic regime.
*/
template<typename _Tp>
_Tp
__conf_hyperg_luke(_Tp __a, _Tp __c, _Tp __xin)
{
const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
const int __nmax = 20000;
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __x = -__xin;
const _Tp __x3 = __x * __x * __x;
const _Tp __t0 = __a / __c;
const _Tp __t1 = (__a + _Tp(1)) / (_Tp(2) * __c);
const _Tp __t2 = (__a + _Tp(2)) / (_Tp(2) * (__c + _Tp(1)));
_Tp __F = _Tp(1);
_Tp __prec;
_Tp __Bnm3 = _Tp(1);
_Tp __Bnm2 = _Tp(1) + __t1 * __x;
_Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
_Tp __Anm3 = _Tp(1);
_Tp __Anm2 = __Bnm2 - __t0 * __x;
_Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
+ __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
int __n = 3;
while(1)
{
_Tp __npam1 = _Tp(__n - 1) + __a;
_Tp __npcm1 = _Tp(__n - 1) + __c;
_Tp __npam2 = _Tp(__n - 2) + __a;
_Tp __npcm2 = _Tp(__n - 2) + __c;
_Tp __tnm1 = _Tp(2 * __n - 1);
_Tp __tnm3 = _Tp(2 * __n - 3);
_Tp __tnm5 = _Tp(2 * __n - 5);
_Tp __F1 = (_Tp(__n - 2) - __a) / (_Tp(2) * __tnm3 * __npcm1);
_Tp __F2 = (_Tp(__n) + __a) * __npam1
/ (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
_Tp __F3 = -__npam2 * __npam1 * (_Tp(__n - 2) - __a)
/ (_Tp(8) * __tnm3 * __tnm3 * __tnm5
* (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
_Tp __E = -__npam1 * (_Tp(__n - 1) - __c)
/ (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
_Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
+ (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
_Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
+ (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
_Tp __r = __An / __Bn;
__prec = std::abs((__F - __r) / __F);
__F = __r;
if (__prec < __eps || __n > __nmax)
break;
if (std::abs(__An) > __big || std::abs(__Bn) > __big)
{
__An /= __big;
__Bn /= __big;
__Anm1 /= __big;
__Bnm1 /= __big;
__Anm2 /= __big;
__Bnm2 /= __big;
__Anm3 /= __big;
__Bnm3 /= __big;
}
else if (std::abs(__An) < _Tp(1) / __big
|| std::abs(__Bn) < _Tp(1) / __big)
{
__An *= __big;
__Bn *= __big;
__Anm1 *= __big;
__Bnm1 *= __big;
__Anm2 *= __big;
__Bnm2 *= __big;
__Anm3 *= __big;
__Bnm3 *= __big;
}
++__n;
__Bnm3 = __Bnm2;
__Bnm2 = __Bnm1;
__Bnm1 = __Bn;
__Anm3 = __Anm2;
__Anm2 = __Anm1;
__Anm1 = __An;
}
if (__n >= __nmax)
std::__throw_runtime_error(__N("Iteration failed to converge "
"in __conf_hyperg_luke."));
return __F;
}
/**
* @brief Return the confluent hypogeometric function
* @f$ _1F_1(a;c;x) @f$.
*
* @todo Handle b == nonpositive integer blowup - return NaN.
*
* @param __a The @a numerator parameter.
* @param __c The @a denominator parameter.
* @param __x The argument of the confluent hypergeometric function.
* @return The confluent hypergeometric function.
*/
template<typename _Tp>
_Tp
__conf_hyperg(_Tp __a, _Tp __c, _Tp __x)
{
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __c_nint = _GLIBCXX_MATH_NS::nearbyint(__c);
#else
const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
#endif
if (__isnan(__a) || __isnan(__c) || __isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__c_nint == __c && __c_nint <= 0)
return std::numeric_limits<_Tp>::infinity();
else if (__a == _Tp(0))
return _Tp(1);
else if (__c == __a)
return std::exp(__x);
else if (__x < _Tp(0))
return __conf_hyperg_luke(__a, __c, __x);
else
return __conf_hyperg_series(__a, __c, __x);
}
/**
* @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
* by series expansion.
*
* The hypogeometric function is defined by
* @f[
* _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
* \sum_{n=0}^{\infty}
* \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
* \frac{x^n}{n!}
* @f]
*
* This works and it's pretty fast.
*
* @param __a The first @a numerator parameter.
* @param __a The second @a numerator parameter.
* @param __c The @a denominator parameter.
* @param __x The argument of the confluent hypergeometric function.
* @return The confluent hypergeometric function.
*/
template<typename _Tp>
_Tp
__hyperg_series(_Tp __a, _Tp __b, _Tp __c, _Tp __x)
{
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
_Tp __term = _Tp(1);
_Tp __Fabc = _Tp(1);
const unsigned int __max_iter = 100000;
unsigned int __i;
for (__i = 0; __i < __max_iter; ++__i)
{
__term *= (__a + _Tp(__i)) * (__b + _Tp(__i)) * __x
/ ((__c + _Tp(__i)) * _Tp(1 + __i));
if (std::abs(__term) < __eps)
{
break;
}
__Fabc += __term;
}
if (__i == __max_iter)
std::__throw_runtime_error(__N("Series failed to converge "
"in __hyperg_series."));
return __Fabc;
}
/**
* @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
* by an iterative procedure described in
* Luke, Algorithms for the Computation of Mathematical Functions.
*/
template<typename _Tp>
_Tp
__hyperg_luke(_Tp __a, _Tp __b, _Tp __c, _Tp __xin)
{
const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
const int __nmax = 20000;
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __x = -__xin;
const _Tp __x3 = __x * __x * __x;
const _Tp __t0 = __a * __b / __c;
const _Tp __t1 = (__a + _Tp(1)) * (__b + _Tp(1)) / (_Tp(2) * __c);
const _Tp __t2 = (__a + _Tp(2)) * (__b + _Tp(2))
/ (_Tp(2) * (__c + _Tp(1)));
_Tp __F = _Tp(1);
_Tp __Bnm3 = _Tp(1);
_Tp __Bnm2 = _Tp(1) + __t1 * __x;
_Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
_Tp __Anm3 = _Tp(1);
_Tp __Anm2 = __Bnm2 - __t0 * __x;
_Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
+ __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
int __n = 3;
while (1)
{
const _Tp __npam1 = _Tp(__n - 1) + __a;
const _Tp __npbm1 = _Tp(__n - 1) + __b;
const _Tp __npcm1 = _Tp(__n - 1) + __c;
const _Tp __npam2 = _Tp(__n - 2) + __a;
const _Tp __npbm2 = _Tp(__n - 2) + __b;
const _Tp __npcm2 = _Tp(__n - 2) + __c;
const _Tp __tnm1 = _Tp(2 * __n - 1);
const _Tp __tnm3 = _Tp(2 * __n - 3);
const _Tp __tnm5 = _Tp(2 * __n - 5);
const _Tp __n2 = __n * __n;
const _Tp __F1 = (_Tp(3) * __n2 + (__a + __b - _Tp(6)) * __n
+ _Tp(2) - __a * __b - _Tp(2) * (__a + __b))
/ (_Tp(2) * __tnm3 * __npcm1);
const _Tp __F2 = -(_Tp(3) * __n2 - (__a + __b + _Tp(6)) * __n
+ _Tp(2) - __a * __b) * __npam1 * __npbm1
/ (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
const _Tp __F3 = (__npam2 * __npam1 * __npbm2 * __npbm1
* (_Tp(__n - 2) - __a) * (_Tp(__n - 2) - __b))
/ (_Tp(8) * __tnm3 * __tnm3 * __tnm5
* (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
const _Tp __E = -__npam1 * __npbm1 * (_Tp(__n - 1) - __c)
/ (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
_Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
+ (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
_Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
+ (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
const _Tp __r = __An / __Bn;
const _Tp __prec = std::abs((__F - __r) / __F);
__F = __r;
if (__prec < __eps || __n > __nmax)
break;
if (std::abs(__An) > __big || std::abs(__Bn) > __big)
{
__An /= __big;
__Bn /= __big;
__Anm1 /= __big;
__Bnm1 /= __big;
__Anm2 /= __big;
__Bnm2 /= __big;
__Anm3 /= __big;
__Bnm3 /= __big;
}
else if (std::abs(__An) < _Tp(1) / __big
|| std::abs(__Bn) < _Tp(1) / __big)
{
__An *= __big;
__Bn *= __big;
__Anm1 *= __big;
__Bnm1 *= __big;
__Anm2 *= __big;
__Bnm2 *= __big;
__Anm3 *= __big;
__Bnm3 *= __big;
}
++__n;
__Bnm3 = __Bnm2;
__Bnm2 = __Bnm1;
__Bnm1 = __Bn;
__Anm3 = __Anm2;
__Anm2 = __Anm1;
__Anm1 = __An;
}
if (__n >= __nmax)
std::__throw_runtime_error(__N("Iteration failed to converge "
"in __hyperg_luke."));
return __F;
}
/**
* @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
* by the reflection formulae in Abramowitz & Stegun formula
* 15.3.6 for d = c - a - b not integral and formula 15.3.11 for
* d = c - a - b integral. This assumes a, b, c != negative
* integer.
*
* The hypogeometric function is defined by
* @f[
* _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
* \sum_{n=0}^{\infty}
* \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
* \frac{x^n}{n!}
* @f]
*
* The reflection formula for nonintegral @f$ d = c - a - b @f$ is:
* @f[
* _2F_1(a,b;c;x) = \frac{\Gamma(c)\Gamma(d)}{\Gamma(c-a)\Gamma(c-b)}
* _2F_1(a,b;1-d;1-x)
* + \frac{\Gamma(c)\Gamma(-d)}{\Gamma(a)\Gamma(b)}
* _2F_1(c-a,c-b;1+d;1-x)
* @f]
*
* The reflection formula for integral @f$ m = c - a - b @f$ is:
* @f[
* _2F_1(a,b;a+b+m;x) = \frac{\Gamma(m)\Gamma(a+b+m)}{\Gamma(a+m)\Gamma(b+m)}
* \sum_{k=0}^{m-1} \frac{(m+a)_k(m+b)_k}{k!(1-m)_k}
* -
* @f]
*/
template<typename _Tp>
_Tp
__hyperg_reflect(_Tp __a, _Tp __b, _Tp __c, _Tp __x)
{
const _Tp __d = __c - __a - __b;
const int __intd = std::floor(__d + _Tp(0.5L));
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __toler = _Tp(1000) * __eps;
const _Tp __log_max = std::log(std::numeric_limits<_Tp>::max());
const bool __d_integer = (std::abs(__d - __intd) < __toler);
if (__d_integer)
{
const _Tp __ln_omx = std::log(_Tp(1) - __x);
const _Tp __ad = std::abs(__d);
_Tp __F1, __F2;
_Tp __d1, __d2;
if (__d >= _Tp(0))
{
__d1 = __d;
__d2 = _Tp(0);
}
else
{
__d1 = _Tp(0);
__d2 = __d;
}
const _Tp __lng_c = __log_gamma(__c);
// Evaluate F1.
if (__ad < __eps)
{
// d = c - a - b = 0.
__F1 = _Tp(0);
}
else
{
bool __ok_d1 = true;
_Tp __lng_ad, __lng_ad1, __lng_bd1;
__try
{
__lng_ad = __log_gamma(__ad);
__lng_ad1 = __log_gamma(__a + __d1);
__lng_bd1 = __log_gamma(__b + __d1);
}
__catch(...)
{
__ok_d1 = false;
}
if (__ok_d1)
{
/* Gamma functions in the denominator are ok.
* Proceed with evaluation.
*/
_Tp __sum1 = _Tp(1);
_Tp __term = _Tp(1);
_Tp __ln_pre1 = __lng_ad + __lng_c + __d2 * __ln_omx
- __lng_ad1 - __lng_bd1;
/* Do F1 sum.
*/
for (int __i = 1; __i < __ad; ++__i)
{
const int __j = __i - 1;
__term *= (__a + __d2 + __j) * (__b + __d2 + __j)
/ (_Tp(1) + __d2 + __j) / __i * (_Tp(1) - __x);
__sum1 += __term;
}
if (__ln_pre1 > __log_max)
std::__throw_runtime_error(__N("Overflow of gamma functions"
" in __hyperg_luke."));
else
__F1 = std::exp(__ln_pre1) * __sum1;
}
else
{
// Gamma functions in the denominator were not ok.
// So the F1 term is zero.
__F1 = _Tp(0);
}
} // end F1 evaluation
// Evaluate F2.
bool __ok_d2 = true;
_Tp __lng_ad2, __lng_bd2;
__try
{
__lng_ad2 = __log_gamma(__a + __d2);
__lng_bd2 = __log_gamma(__b + __d2);
}
__catch(...)
{
__ok_d2 = false;
}
if (__ok_d2)
{
// Gamma functions in the denominator are ok.
// Proceed with evaluation.
const int __maxiter = 2000;
const _Tp __psi_1 = -__numeric_constants<_Tp>::__gamma_e();
const _Tp __psi_1pd = __psi(_Tp(1) + __ad);
const _Tp __psi_apd1 = __psi(__a + __d1);
const _Tp __psi_bpd1 = __psi(__b + __d1);
_Tp __psi_term = __psi_1 + __psi_1pd - __psi_apd1
- __psi_bpd1 - __ln_omx;
_Tp __fact = _Tp(1);
_Tp __sum2 = __psi_term;
_Tp __ln_pre2 = __lng_c + __d1 * __ln_omx
- __lng_ad2 - __lng_bd2;
// Do F2 sum.
int __j;
for (__j = 1; __j < __maxiter; ++__j)
{
// Values for psi functions use recurrence;
// Abramowitz & Stegun 6.3.5
const _Tp __term1 = _Tp(1) / _Tp(__j)
+ _Tp(1) / (__ad + __j);
const _Tp __term2 = _Tp(1) / (__a + __d1 + _Tp(__j - 1))
+ _Tp(1) / (__b + __d1 + _Tp(__j - 1));
__psi_term += __term1 - __term2;
__fact *= (__a + __d1 + _Tp(__j - 1))
* (__b + __d1 + _Tp(__j - 1))
/ ((__ad + __j) * __j) * (_Tp(1) - __x);
const _Tp __delta = __fact * __psi_term;
__sum2 += __delta;
if (std::abs(__delta) < __eps * std::abs(__sum2))
break;
}
if (__j == __maxiter)
std::__throw_runtime_error(__N("Sum F2 failed to converge "
"in __hyperg_reflect"));
if (__sum2 == _Tp(0))
__F2 = _Tp(0);
else
__F2 = std::exp(__ln_pre2) * __sum2;
}
else
{
// Gamma functions in the denominator not ok.
// So the F2 term is zero.
__F2 = _Tp(0);
} // end F2 evaluation
const _Tp __sgn_2 = (__intd % 2 == 1 ? -_Tp(1) : _Tp(1));
const _Tp __F = __F1 + __sgn_2 * __F2;
return __F;
}
else
{
// d = c - a - b not an integer.
// These gamma functions appear in the denominator, so we
// catch their harmless domain errors and set the terms to zero.
bool __ok1 = true;
_Tp __sgn_g1ca = _Tp(0), __ln_g1ca = _Tp(0);
_Tp __sgn_g1cb = _Tp(0), __ln_g1cb = _Tp(0);
__try
{
__sgn_g1ca = __log_gamma_sign(__c - __a);
__ln_g1ca = __log_gamma(__c - __a);
__sgn_g1cb = __log_gamma_sign(__c - __b);
__ln_g1cb = __log_gamma(__c - __b);
}
__catch(...)
{
__ok1 = false;
}
bool __ok2 = true;
_Tp __sgn_g2a = _Tp(0), __ln_g2a = _Tp(0);
_Tp __sgn_g2b = _Tp(0), __ln_g2b = _Tp(0);
__try
{
__sgn_g2a = __log_gamma_sign(__a);
__ln_g2a = __log_gamma(__a);
__sgn_g2b = __log_gamma_sign(__b);
__ln_g2b = __log_gamma(__b);
}
__catch(...)
{
__ok2 = false;
}
const _Tp __sgn_gc = __log_gamma_sign(__c);
const _Tp __ln_gc = __log_gamma(__c);
const _Tp __sgn_gd = __log_gamma_sign(__d);
const _Tp __ln_gd = __log_gamma(__d);
const _Tp __sgn_gmd = __log_gamma_sign(-__d);
const _Tp __ln_gmd = __log_gamma(-__d);
const _Tp __sgn1 = __sgn_gc * __sgn_gd * __sgn_g1ca * __sgn_g1cb;
const _Tp __sgn2 = __sgn_gc * __sgn_gmd * __sgn_g2a * __sgn_g2b;
_Tp __pre1, __pre2;
if (__ok1 && __ok2)
{
_Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
_Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
+ __d * std::log(_Tp(1) - __x);
if (__ln_pre1 < __log_max && __ln_pre2 < __log_max)
{
__pre1 = std::exp(__ln_pre1);
__pre2 = std::exp(__ln_pre2);
__pre1 *= __sgn1;
__pre2 *= __sgn2;
}
else
{
std::__throw_runtime_error(__N("Overflow of gamma functions "
"in __hyperg_reflect"));
}
}
else if (__ok1 && !__ok2)
{
_Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
if (__ln_pre1 < __log_max)
{
__pre1 = std::exp(__ln_pre1);
__pre1 *= __sgn1;
__pre2 = _Tp(0);
}
else
{
std::__throw_runtime_error(__N("Overflow of gamma functions "
"in __hyperg_reflect"));
}
}
else if (!__ok1 && __ok2)
{
_Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
+ __d * std::log(_Tp(1) - __x);
if (__ln_pre2 < __log_max)
{
__pre1 = _Tp(0);
__pre2 = std::exp(__ln_pre2);
__pre2 *= __sgn2;
}
else
{
std::__throw_runtime_error(__N("Overflow of gamma functions "
"in __hyperg_reflect"));
}
}
else
{
__pre1 = _Tp(0);
__pre2 = _Tp(0);
std::__throw_runtime_error(__N("Underflow of gamma functions "
"in __hyperg_reflect"));
}
const _Tp __F1 = __hyperg_series(__a, __b, _Tp(1) - __d,
_Tp(1) - __x);
const _Tp __F2 = __hyperg_series(__c - __a, __c - __b, _Tp(1) + __d,
_Tp(1) - __x);
const _Tp __F = __pre1 * __F1 + __pre2 * __F2;
return __F;
}
}
/**
* @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$.
*
* The hypogeometric function is defined by
* @f[
* _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
* \sum_{n=0}^{\infty}
* \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
* \frac{x^n}{n!}
* @f]
*
* @param __a The first @a numerator parameter.
* @param __a The second @a numerator parameter.
* @param __c The @a denominator parameter.
* @param __x The argument of the confluent hypergeometric function.
* @return The confluent hypergeometric function.
*/
template<typename _Tp>
_Tp
__hyperg(_Tp __a, _Tp __b, _Tp __c, _Tp __x)
{
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __a_nint = _GLIBCXX_MATH_NS::nearbyint(__a);
const _Tp __b_nint = _GLIBCXX_MATH_NS::nearbyint(__b);
const _Tp __c_nint = _GLIBCXX_MATH_NS::nearbyint(__c);
#else
const _Tp __a_nint = static_cast<int>(__a + _Tp(0.5L));
const _Tp __b_nint = static_cast<int>(__b + _Tp(0.5L));
const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
#endif
const _Tp __toler = _Tp(1000) * std::numeric_limits<_Tp>::epsilon();
if (std::abs(__x) >= _Tp(1))
std::__throw_domain_error(__N("Argument outside unit circle "
"in __hyperg."));
else if (__isnan(__a) || __isnan(__b)
|| __isnan(__c) || __isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__c_nint == __c && __c_nint <= _Tp(0))
return std::numeric_limits<_Tp>::infinity();
else if (std::abs(__c - __b) < __toler || std::abs(__c - __a) < __toler)
return std::pow(_Tp(1) - __x, __c - __a - __b);
else if (__a >= _Tp(0) && __b >= _Tp(0) && __c >= _Tp(0)
&& __x >= _Tp(0) && __x < _Tp(0.995L))
return __hyperg_series(__a, __b, __c, __x);
else if (std::abs(__a) < _Tp(10) && std::abs(__b) < _Tp(10))
{
// For integer a and b the hypergeometric function is a
// finite polynomial.
if (__a < _Tp(0) && std::abs(__a - __a_nint) < __toler)
return __hyperg_series(__a_nint, __b, __c, __x);
else if (__b < _Tp(0) && std::abs(__b - __b_nint) < __toler)
return __hyperg_series(__a, __b_nint, __c, __x);
else if (__x < -_Tp(0.25L))
return __hyperg_luke(__a, __b, __c, __x);
else if (__x < _Tp(0.5L))
return __hyperg_series(__a, __b, __c, __x);
else
if (std::abs(__c) > _Tp(10))
return __hyperg_series(__a, __b, __c, __x);
else
return __hyperg_reflect(__a, __b, __c, __x);
}
else
return __hyperg_luke(__a, __b, __c, __x);
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
// TR1 stdint.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/stdint.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_STDINT_H
#define _TR1_STDINT_H 1
#include <tr1/cstdint>
#endif
// TR1 cwctype -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cwctype
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CWCTYPE
#define _GLIBCXX_TR1_CWCTYPE 1
#pragma GCC system_header
#include <cwctype>
#ifdef _GLIBCXX_USE_WCHAR_T
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
#if _GLIBCXX_HAVE_ISWBLANK
using std::iswblank;
#endif
}
}
#endif // _GLIBCXX_USE_WCHAR_T
#endif // _GLIBCXX_TR1_CWCTYPE
// random number generation -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/**
* @file tr1/random
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_RANDOM
#define _GLIBCXX_TR1_RANDOM 1
#pragma GCC system_header
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iosfwd>
#include <limits>
#include <ext/type_traits.h>
#include <ext/numeric_traits.h>
#include <bits/concept_check.h>
#include <debug/debug.h>
#include <tr1/type_traits>
#include <tr1/cmath>
#include <tr1/random.h>
#include <tr1/random.tcc>
#endif // _GLIBCXX_TR1_RANDOM
// TR1 cmath -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cmath
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CMATH
#define _GLIBCXX_TR1_CMATH 1
#pragma GCC system_header
#include <cmath>
#ifdef _GLIBCXX_USE_C99_MATH_TR1
#undef acosh
#undef acoshf
#undef acoshl
#undef asinh
#undef asinhf
#undef asinhl
#undef atanh
#undef atanhf
#undef atanhl
#undef cbrt
#undef cbrtf
#undef cbrtl
#undef copysign
#undef copysignf
#undef copysignl
#undef erf
#undef erff
#undef erfl
#undef erfc
#undef erfcf
#undef erfcl
#undef exp2
#undef exp2f
#undef exp2l
#undef expm1
#undef expm1f
#undef expm1l
#undef fdim
#undef fdimf
#undef fdiml
#undef fma
#undef fmaf
#undef fmal
#undef fmax
#undef fmaxf
#undef fmaxl
#undef fmin
#undef fminf
#undef fminl
#undef hypot
#undef hypotf
#undef hypotl
#undef ilogb
#undef ilogbf
#undef ilogbl
#undef lgamma
#undef lgammaf
#undef lgammal
#undef llrint
#undef llrintf
#undef llrintl
#undef llround
#undef llroundf
#undef llroundl
#undef log1p
#undef log1pf
#undef log1pl
#undef log2
#undef log2f
#undef log2l
#undef logb
#undef logbf
#undef logbl
#undef lrint
#undef lrintf
#undef lrintl
#undef lround
#undef lroundf
#undef lroundl
#undef nan
#undef nanf
#undef nanl
#undef nearbyint
#undef nearbyintf
#undef nearbyintl
#undef nextafter
#undef nextafterf
#undef nextafterl
#undef nexttoward
#undef nexttowardf
#undef nexttowardl
#undef remainder
#undef remainderf
#undef remainderl
#undef remquo
#undef remquof
#undef remquol
#undef rint
#undef rintf
#undef rintl
#undef round
#undef roundf
#undef roundl
#undef scalbln
#undef scalblnf
#undef scalblnl
#undef scalbn
#undef scalbnf
#undef scalbnl
#undef tgamma
#undef tgammaf
#undef tgammal
#undef trunc
#undef truncf
#undef truncl
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
#if _GLIBCXX_USE_C99_MATH_TR1
// Using declarations to bring names from libc's <math.h> into std::tr1.
// types
using ::double_t;
using ::float_t;
// functions
using ::acosh;
using ::acoshf;
using ::acoshl;
using ::asinh;
using ::asinhf;
using ::asinhl;
using ::atanh;
using ::atanhf;
using ::atanhl;
using ::cbrt;
using ::cbrtf;
using ::cbrtl;
using ::copysign;
using ::copysignf;
using ::copysignl;
using ::erf;
using ::erff;
using ::erfl;
using ::erfc;
using ::erfcf;
using ::erfcl;
using ::exp2;
using ::exp2f;
using ::exp2l;
using ::expm1;
using ::expm1f;
using ::expm1l;
using ::fdim;
using ::fdimf;
using ::fdiml;
using ::fma;
using ::fmaf;
using ::fmal;
using ::fmax;
using ::fmaxf;
using ::fmaxl;
using ::fmin;
using ::fminf;
using ::fminl;
using ::hypot;
using ::hypotf;
using ::hypotl;
using ::ilogb;
using ::ilogbf;
using ::ilogbl;
using ::lgamma;
using ::lgammaf;
using ::lgammal;
using ::llrint;
using ::llrintf;
using ::llrintl;
using ::llround;
using ::llroundf;
using ::llroundl;
using ::log1p;
using ::log1pf;
using ::log1pl;
using ::log2;
using ::log2f;
using ::log2l;
using ::logb;
using ::logbf;
using ::logbl;
using ::lrint;
using ::lrintf;
using ::lrintl;
using ::lround;
using ::lroundf;
using ::lroundl;
using ::nan;
using ::nanf;
using ::nanl;
using ::nearbyint;
using ::nearbyintf;
using ::nearbyintl;
using ::nextafter;
using ::nextafterf;
using ::nextafterl;
using ::nexttoward;
using ::nexttowardf;
using ::nexttowardl;
using ::remainder;
using ::remainderf;
using ::remainderl;
using ::remquo;
using ::remquof;
using ::remquol;
using ::rint;
using ::rintf;
using ::rintl;
using ::round;
using ::roundf;
using ::roundl;
using ::scalbln;
using ::scalblnf;
using ::scalblnl;
using ::scalbn;
using ::scalbnf;
using ::scalbnl;
using ::tgamma;
using ::tgammaf;
using ::tgammal;
using ::trunc;
using ::truncf;
using ::truncl;
#endif
#if _GLIBCXX_USE_C99_MATH
#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
/// Function template definitions [8.16.3].
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
fpclassify(_Tp __f)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
FP_SUBNORMAL, FP_ZERO, __type(__f));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isfinite(_Tp __f)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isfinite(__type(__f));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isinf(_Tp __f)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isinf(__type(__f));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isnan(_Tp __f)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isnan(__type(__f));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isnormal(_Tp __f)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isnormal(__type(__f));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
signbit(_Tp __f)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_signbit(__type(__f));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isgreater(_Tp __f1, _Tp __f2)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isgreater(__type(__f1), __type(__f2));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isgreaterequal(_Tp __f1, _Tp __f2)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isgreaterequal(__type(__f1), __type(__f2));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isless(_Tp __f1, _Tp __f2)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isless(__type(__f1), __type(__f2));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
islessequal(_Tp __f1, _Tp __f2)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_islessequal(__type(__f1), __type(__f2));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
islessgreater(_Tp __f1, _Tp __f2)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_islessgreater(__type(__f1), __type(__f2));
}
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
int>::__type
isunordered(_Tp __f1, _Tp __f2)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __builtin_isunordered(__type(__f1), __type(__f2));
}
#endif
#endif
#if _GLIBCXX_USE_C99_MATH_TR1
/** Additional overloads [8.16.4].
* @{
*/
// For functions defined in C++03 the additional overloads are already
// declared in <cmath> so we can just re-declare them in std::tr1.
using std::acos;
using std::asin;
using std::atan;
using std::atan2;
using std::ceil;
using std::cos;
using std::cosh;
using std::exp;
using std::floor;
using std::fmod;
using std::frexp;
using std::ldexp;
using std::log;
using std::log10;
using std::sin;
using std::sinh;
using std::sqrt;
using std::tan;
using std::tanh;
#if __cplusplus >= 201103L
// Since C++11, <cmath> defines additional overloads for these functions
// in namespace std.
using std::acosh;
using std::asinh;
using std::atanh;
using std::cbrt;
using std::copysign;
using std::erf;
using std::erfc;
using std::exp2;
using std::expm1;
using std::fdim;
using std::fma;
using std::fmax;
using std::fmin;
using std::hypot;
using std::ilogb;
using std::lgamma;
using std::llrint;
using std::llround;
using std::log1p;
using std::log2;
using std::logb;
using std::lrint;
using std::lround;
using std::nan;
using std::nearbyint;
using std::nextafter;
using std::nexttoward;
using std::remainder;
using std::remquo;
using std::rint;
using std::round;
using std::scalbln;
using std::scalbn;
using std::tgamma;
using std::trunc;
#else // __cplusplus < 201103L
// In C++03 we need to provide the additional overloads.
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
acosh(float __x)
{ return __builtin_acoshf(__x); }
inline long double
acosh(long double __x)
{ return __builtin_acoshl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
acosh(_Tp __x)
{ return __builtin_acosh(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
asinh(float __x)
{ return __builtin_asinhf(__x); }
inline long double
asinh(long double __x)
{ return __builtin_asinhl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
asinh(_Tp __x)
{ return __builtin_asinh(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
atanh(float __x)
{ return __builtin_atanhf(__x); }
inline long double
atanh(long double __x)
{ return __builtin_atanhl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
atanh(_Tp __x)
{ return __builtin_atanh(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
cbrt(float __x)
{ return __builtin_cbrtf(__x); }
inline long double
cbrt(long double __x)
{ return __builtin_cbrtl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
cbrt(_Tp __x)
{ return __builtin_cbrt(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
copysign(float __x, float __y)
{ return __builtin_copysignf(__x, __y); }
inline long double
copysign(long double __x, long double __y)
{ return __builtin_copysignl(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
copysign(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return copysign(__type(__x), __type(__y));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
erf(float __x)
{ return __builtin_erff(__x); }
inline long double
erf(long double __x)
{ return __builtin_erfl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
erf(_Tp __x)
{ return __builtin_erf(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
erfc(float __x)
{ return __builtin_erfcf(__x); }
inline long double
erfc(long double __x)
{ return __builtin_erfcl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
erfc(_Tp __x)
{ return __builtin_erfc(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
exp2(float __x)
{ return __builtin_exp2f(__x); }
inline long double
exp2(long double __x)
{ return __builtin_exp2l(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
exp2(_Tp __x)
{ return __builtin_exp2(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
expm1(float __x)
{ return __builtin_expm1f(__x); }
inline long double
expm1(long double __x)
{ return __builtin_expm1l(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
expm1(_Tp __x)
{ return __builtin_expm1(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
fdim(float __x, float __y)
{ return __builtin_fdimf(__x, __y); }
inline long double
fdim(long double __x, long double __y)
{ return __builtin_fdiml(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
fdim(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return fdim(__type(__x), __type(__y));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
fma(float __x, float __y, float __z)
{ return __builtin_fmaf(__x, __y, __z); }
inline long double
fma(long double __x, long double __y, long double __z)
{ return __builtin_fmal(__x, __y, __z); }
#endif
template<typename _Tp, typename _Up, typename _Vp>
inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
fma(_Tp __x, _Up __y, _Vp __z)
{
typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
return fma(__type(__x), __type(__y), __type(__z));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
fmax(float __x, float __y)
{ return __builtin_fmaxf(__x, __y); }
inline long double
fmax(long double __x, long double __y)
{ return __builtin_fmaxl(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
fmax(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return fmax(__type(__x), __type(__y));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
fmin(float __x, float __y)
{ return __builtin_fminf(__x, __y); }
inline long double
fmin(long double __x, long double __y)
{ return __builtin_fminl(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
fmin(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return fmin(__type(__x), __type(__y));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
hypot(float __x, float __y)
{ return __builtin_hypotf(__x, __y); }
inline long double
hypot(long double __x, long double __y)
{ return __builtin_hypotl(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
hypot(_Tp __y, _Up __x)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return hypot(__type(__y), __type(__x));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline int
ilogb(float __x)
{ return __builtin_ilogbf(__x); }
inline int
ilogb(long double __x)
{ return __builtin_ilogbl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
int>::__type
ilogb(_Tp __x)
{ return __builtin_ilogb(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
lgamma(float __x)
{ return __builtin_lgammaf(__x); }
inline long double
lgamma(long double __x)
{ return __builtin_lgammal(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
lgamma(_Tp __x)
{ return __builtin_lgamma(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline long long
llrint(float __x)
{ return __builtin_llrintf(__x); }
inline long long
llrint(long double __x)
{ return __builtin_llrintl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
long long>::__type
llrint(_Tp __x)
{ return __builtin_llrint(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline long long
llround(float __x)
{ return __builtin_llroundf(__x); }
inline long long
llround(long double __x)
{ return __builtin_llroundl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
long long>::__type
llround(_Tp __x)
{ return __builtin_llround(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
log1p(float __x)
{ return __builtin_log1pf(__x); }
inline long double
log1p(long double __x)
{ return __builtin_log1pl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
log1p(_Tp __x)
{ return __builtin_log1p(__x); }
// DR 568.
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
log2(float __x)
{ return __builtin_log2f(__x); }
inline long double
log2(long double __x)
{ return __builtin_log2l(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
log2(_Tp __x)
{ return __builtin_log2(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
logb(float __x)
{ return __builtin_logbf(__x); }
inline long double
logb(long double __x)
{ return __builtin_logbl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
logb(_Tp __x)
{
return __builtin_logb(__x);
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline long
lrint(float __x)
{ return __builtin_lrintf(__x); }
inline long
lrint(long double __x)
{ return __builtin_lrintl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
long>::__type
lrint(_Tp __x)
{ return __builtin_lrint(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline long
lround(float __x)
{ return __builtin_lroundf(__x); }
inline long
lround(long double __x)
{ return __builtin_lroundl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
long>::__type
lround(_Tp __x)
{ return __builtin_lround(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
nearbyint(float __x)
{ return __builtin_nearbyintf(__x); }
inline long double
nearbyint(long double __x)
{ return __builtin_nearbyintl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
nearbyint(_Tp __x)
{ return __builtin_nearbyint(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
nextafter(float __x, float __y)
{ return __builtin_nextafterf(__x, __y); }
inline long double
nextafter(long double __x, long double __y)
{ return __builtin_nextafterl(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
nextafter(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return nextafter(__type(__x), __type(__y));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
nexttoward(float __x, long double __y)
{ return __builtin_nexttowardf(__x, __y); }
inline long double
nexttoward(long double __x, long double __y)
{ return __builtin_nexttowardl(__x, __y); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
nexttoward(_Tp __x, long double __y)
{ return __builtin_nexttoward(__x, __y); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
remainder(float __x, float __y)
{ return __builtin_remainderf(__x, __y); }
inline long double
remainder(long double __x, long double __y)
{ return __builtin_remainderl(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
remainder(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return remainder(__type(__x), __type(__y));
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
remquo(float __x, float __y, int* __pquo)
{ return __builtin_remquof(__x, __y, __pquo); }
inline long double
remquo(long double __x, long double __y, int* __pquo)
{ return __builtin_remquol(__x, __y, __pquo); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
remquo(_Tp __x, _Up __y, int* __pquo)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return remquo(__type(__x), __type(__y), __pquo);
}
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
rint(float __x)
{ return __builtin_rintf(__x); }
inline long double
rint(long double __x)
{ return __builtin_rintl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
rint(_Tp __x)
{ return __builtin_rint(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
round(float __x)
{ return __builtin_roundf(__x); }
inline long double
round(long double __x)
{ return __builtin_roundl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
round(_Tp __x)
{ return __builtin_round(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
scalbln(float __x, long __ex)
{ return __builtin_scalblnf(__x, __ex); }
inline long double
scalbln(long double __x, long __ex)
{ return __builtin_scalblnl(__x, __ex); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
scalbln(_Tp __x, long __ex)
{ return __builtin_scalbln(__x, __ex); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
scalbn(float __x, int __ex)
{ return __builtin_scalbnf(__x, __ex); }
inline long double
scalbn(long double __x, int __ex)
{ return __builtin_scalbnl(__x, __ex); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
scalbn(_Tp __x, int __ex)
{ return __builtin_scalbn(__x, __ex); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
tgamma(float __x)
{ return __builtin_tgammaf(__x); }
inline long double
tgamma(long double __x)
{ return __builtin_tgammal(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
tgamma(_Tp __x)
{ return __builtin_tgamma(__x); }
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
trunc(float __x)
{ return __builtin_truncf(__x); }
inline long double
trunc(long double __x)
{ return __builtin_truncl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
trunc(_Tp __x)
{ return __builtin_trunc(__x); }
#endif // __cplusplus < 201103L
// @}
#endif /* _GLIBCXX_USE_C99_MATH_TR1 */
// DR 550. What should the return type of pow(float,int) be?
// NB: C++11 and TR1 != C++03.
// We cannot do "using std::pow;" because that would bring in unwanted
// pow(*, int) overloads in C++03, with the wrong return type. Instead we
// define all the necessary overloads, but the std::tr1::pow(double, double)
// overload cannot be provided here, because <tr1/math.h> would add it to
// the global namespace where it would clash with ::pow(double,double) from
// libc (revealed by the fix of PR c++/54537).
// The solution is to forward std::tr1::pow(double,double) to
// std::pow(double,double) via the function template below. See
// the discussion about this issue here:
// http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01278.html
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
pow(float __x, float __y)
{ return std::pow(__x, __y); }
inline long double
pow(long double __x, long double __y)
{ return std::pow(__x, __y); }
#endif
template<typename _Tp, typename _Up>
inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
pow(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return std::pow(__type(__x), __type(__y));
}
#if __cplusplus >= 201103L
// We also deal with fabs in a special way, because "using std::fabs;"
// could bring in C++11's std::fabs<T>(const std::complex<T>&) with a
// different return type from std::tr1::fabs<T>(const std::complex<T>&).
// We define the necessary overloads, except std::tr1::fabs(double) which
// could clash with ::fabs(double) from libc.
// The function template handles double as well as integers, forwarding
// to std::fabs.
#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
inline float
fabs(float __x)
{ return __builtin_fabsf(__x); }
inline long double
fabs(long double __x)
{ return __builtin_fabsl(__x); }
#endif
#endif
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
fabs(_Tp __x)
{ return std::fabs(__x); }
#else // ! C++11
// For C++03 just use std::fabs as there is no overload for std::complex<>.
using std::fabs;
#endif // C++11
#if _GLIBCXX_USE_STD_SPEC_FUNCS
/**
* @defgroup tr1_math_spec_func Mathematical Special Functions
* @ingroup numerics
*
* A collection of advanced mathematical special functions.
* @{
*/
using std::assoc_laguerref;
using std::assoc_laguerrel;
using std::assoc_laguerre;
using std::assoc_legendref;
using std::assoc_legendrel;
using std::assoc_legendre;
using std::betaf;
using std::betal;
using std::beta;
using std::comp_ellint_1f;
using std::comp_ellint_1l;
using std::comp_ellint_1;
using std::comp_ellint_2f;
using std::comp_ellint_2l;
using std::comp_ellint_2;
using std::comp_ellint_3f;
using std::comp_ellint_3l;
using std::comp_ellint_3;
using std::cyl_bessel_if;
using std::cyl_bessel_il;
using std::cyl_bessel_i;
using std::cyl_bessel_jf;
using std::cyl_bessel_jl;
using std::cyl_bessel_j;
using std::cyl_bessel_kf;
using std::cyl_bessel_kl;
using std::cyl_bessel_k;
using std::cyl_neumannf;
using std::cyl_neumannl;
using std::cyl_neumann;
using std::ellint_1f;
using std::ellint_1l;
using std::ellint_1;
using std::ellint_2f;
using std::ellint_2l;
using std::ellint_2;
using std::ellint_3f;
using std::ellint_3l;
using std::ellint_3;
using std::expintf;
using std::expintl;
using std::expint;
using std::hermitef;
using std::hermitel;
using std::hermite;
using std::laguerref;
using std::laguerrel;
using std::laguerre;
using std::legendref;
using std::legendrel;
using std::legendre;
using std::riemann_zetaf;
using std::riemann_zetal;
using std::riemann_zeta;
using std::sph_besself;
using std::sph_bessell;
using std::sph_bessel;
using std::sph_legendref;
using std::sph_legendrel;
using std::sph_legendre;
using std::sph_neumannf;
using std::sph_neumannl;
using std::sph_neumann;
/* @} */ // tr1_math_spec_func
#else // ! _GLIBCXX_USE_STD_SPEC_FUNCS
} // namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/stl_algobase.h>
#include <limits>
#include <tr1/type_traits>
#include <tr1/gamma.tcc>
#include <tr1/bessel_function.tcc>
#include <tr1/beta_function.tcc>
#include <tr1/ell_integral.tcc>
#include <tr1/exp_integral.tcc>
#include <tr1/legendre_function.tcc>
#include <tr1/modified_bessel_func.tcc>
#include <tr1/poly_hermite.tcc>
#include <tr1/poly_laguerre.tcc>
#include <tr1/riemann_zeta.tcc>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/**
* @defgroup tr1_math_spec_func Mathematical Special Functions
* @ingroup numerics
*
* A collection of advanced mathematical special functions.
* @{
*/
inline float
assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
{ return __detail::__assoc_laguerre<float>(__n, __m, __x); }
inline long double
assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
{
return __detail::__assoc_laguerre<long double>(__n, __m, __x);
}
/// 5.2.1.1 Associated Laguerre polynomials.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__assoc_laguerre<__type>(__n, __m, __x);
}
inline float
assoc_legendref(unsigned int __l, unsigned int __m, float __x)
{ return __detail::__assoc_legendre_p<float>(__l, __m, __x); }
inline long double
assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
{ return __detail::__assoc_legendre_p<long double>(__l, __m, __x); }
/// 5.2.1.2 Associated Legendre functions.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__assoc_legendre_p<__type>(__l, __m, __x);
}
inline float
betaf(float __x, float __y)
{ return __detail::__beta<float>(__x, __y); }
inline long double
betal(long double __x, long double __y)
{ return __detail::__beta<long double>(__x, __y); }
/// 5.2.1.3 Beta functions.
template<typename _Tpx, typename _Tpy>
inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type
beta(_Tpx __x, _Tpy __y)
{
typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type;
return __detail::__beta<__type>(__x, __y);
}
inline float
comp_ellint_1f(float __k)
{ return __detail::__comp_ellint_1<float>(__k); }
inline long double
comp_ellint_1l(long double __k)
{ return __detail::__comp_ellint_1<long double>(__k); }
/// 5.2.1.4 Complete elliptic integrals of the first kind.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
comp_ellint_1(_Tp __k)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__comp_ellint_1<__type>(__k);
}
inline float
comp_ellint_2f(float __k)
{ return __detail::__comp_ellint_2<float>(__k); }
inline long double
comp_ellint_2l(long double __k)
{ return __detail::__comp_ellint_2<long double>(__k); }
/// 5.2.1.5 Complete elliptic integrals of the second kind.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
comp_ellint_2(_Tp __k)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__comp_ellint_2<__type>(__k);
}
inline float
comp_ellint_3f(float __k, float __nu)
{ return __detail::__comp_ellint_3<float>(__k, __nu); }
inline long double
comp_ellint_3l(long double __k, long double __nu)
{ return __detail::__comp_ellint_3<long double>(__k, __nu); }
/// 5.2.1.6 Complete elliptic integrals of the third kind.
template<typename _Tp, typename _Tpn>
inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type
comp_ellint_3(_Tp __k, _Tpn __nu)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type;
return __detail::__comp_ellint_3<__type>(__k, __nu);
}
inline float
cyl_bessel_if(float __nu, float __x)
{ return __detail::__cyl_bessel_i<float>(__nu, __x); }
inline long double
cyl_bessel_il(long double __nu, long double __x)
{ return __detail::__cyl_bessel_i<long double>(__nu, __x); }
/// 5.2.1.8 Regular modified cylindrical Bessel functions.
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_bessel_i(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_bessel_i<__type>(__nu, __x);
}
inline float
cyl_bessel_jf(float __nu, float __x)
{ return __detail::__cyl_bessel_j<float>(__nu, __x); }
inline long double
cyl_bessel_jl(long double __nu, long double __x)
{ return __detail::__cyl_bessel_j<long double>(__nu, __x); }
/// 5.2.1.9 Cylindrical Bessel functions (of the first kind).
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_bessel_j(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_bessel_j<__type>(__nu, __x);
}
inline float
cyl_bessel_kf(float __nu, float __x)
{ return __detail::__cyl_bessel_k<float>(__nu, __x); }
inline long double
cyl_bessel_kl(long double __nu, long double __x)
{ return __detail::__cyl_bessel_k<long double>(__nu, __x); }
/// 5.2.1.10 Irregular modified cylindrical Bessel functions.
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_bessel_k(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_bessel_k<__type>(__nu, __x);
}
inline float
cyl_neumannf(float __nu, float __x)
{ return __detail::__cyl_neumann_n<float>(__nu, __x); }
inline long double
cyl_neumannl(long double __nu, long double __x)
{ return __detail::__cyl_neumann_n<long double>(__nu, __x); }
/// 5.2.1.11 Cylindrical Neumann functions.
template<typename _Tpnu, typename _Tp>
inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
cyl_neumann(_Tpnu __nu, _Tp __x)
{
typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
return __detail::__cyl_neumann_n<__type>(__nu, __x);
}
inline float
ellint_1f(float __k, float __phi)
{ return __detail::__ellint_1<float>(__k, __phi); }
inline long double
ellint_1l(long double __k, long double __phi)
{ return __detail::__ellint_1<long double>(__k, __phi); }
/// 5.2.1.12 Incomplete elliptic integrals of the first kind.
template<typename _Tp, typename _Tpp>
inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
ellint_1(_Tp __k, _Tpp __phi)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
return __detail::__ellint_1<__type>(__k, __phi);
}
inline float
ellint_2f(float __k, float __phi)
{ return __detail::__ellint_2<float>(__k, __phi); }
inline long double
ellint_2l(long double __k, long double __phi)
{ return __detail::__ellint_2<long double>(__k, __phi); }
/// 5.2.1.13 Incomplete elliptic integrals of the second kind.
template<typename _Tp, typename _Tpp>
inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
ellint_2(_Tp __k, _Tpp __phi)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
return __detail::__ellint_2<__type>(__k, __phi);
}
inline float
ellint_3f(float __k, float __nu, float __phi)
{ return __detail::__ellint_3<float>(__k, __nu, __phi); }
inline long double
ellint_3l(long double __k, long double __nu, long double __phi)
{ return __detail::__ellint_3<long double>(__k, __nu, __phi); }
/// 5.2.1.14 Incomplete elliptic integrals of the third kind.
template<typename _Tp, typename _Tpn, typename _Tpp>
inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type
ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
{
typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type;
return __detail::__ellint_3<__type>(__k, __nu, __phi);
}
inline float
expintf(float __x)
{ return __detail::__expint<float>(__x); }
inline long double
expintl(long double __x)
{ return __detail::__expint<long double>(__x); }
/// 5.2.1.15 Exponential integrals.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
expint(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__expint<__type>(__x);
}
inline float
hermitef(unsigned int __n, float __x)
{ return __detail::__poly_hermite<float>(__n, __x); }
inline long double
hermitel(unsigned int __n, long double __x)
{ return __detail::__poly_hermite<long double>(__n, __x); }
/// 5.2.1.16 Hermite polynomials.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
hermite(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__poly_hermite<__type>(__n, __x);
}
inline float
laguerref(unsigned int __n, float __x)
{ return __detail::__laguerre<float>(__n, __x); }
inline long double
laguerrel(unsigned int __n, long double __x)
{ return __detail::__laguerre<long double>(__n, __x); }
/// 5.2.1.18 Laguerre polynomials.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
laguerre(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__laguerre<__type>(__n, __x);
}
inline float
legendref(unsigned int __n, float __x)
{ return __detail::__poly_legendre_p<float>(__n, __x); }
inline long double
legendrel(unsigned int __n, long double __x)
{ return __detail::__poly_legendre_p<long double>(__n, __x); }
/// 5.2.1.19 Legendre polynomials.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
legendre(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__poly_legendre_p<__type>(__n, __x);
}
inline float
riemann_zetaf(float __x)
{ return __detail::__riemann_zeta<float>(__x); }
inline long double
riemann_zetal(long double __x)
{ return __detail::__riemann_zeta<long double>(__x); }
/// 5.2.1.20 Riemann zeta function.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
riemann_zeta(_Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__riemann_zeta<__type>(__x);
}
inline float
sph_besself(unsigned int __n, float __x)
{ return __detail::__sph_bessel<float>(__n, __x); }
inline long double
sph_bessell(unsigned int __n, long double __x)
{ return __detail::__sph_bessel<long double>(__n, __x); }
/// 5.2.1.21 Spherical Bessel functions.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
sph_bessel(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__sph_bessel<__type>(__n, __x);
}
inline float
sph_legendref(unsigned int __l, unsigned int __m, float __theta)
{ return __detail::__sph_legendre<float>(__l, __m, __theta); }
inline long double
sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
{ return __detail::__sph_legendre<long double>(__l, __m, __theta); }
/// 5.2.1.22 Spherical associated Legendre functions.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__sph_legendre<__type>(__l, __m, __theta);
}
inline float
sph_neumannf(unsigned int __n, float __x)
{ return __detail::__sph_neumann<float>(__n, __x); }
inline long double
sph_neumannl(unsigned int __n, long double __x)
{ return __detail::__sph_neumann<long double>(__n, __x); }
/// 5.2.1.23 Spherical Neumann functions.
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
sph_neumann(unsigned int __n, _Tp __x)
{
typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
return __detail::__sph_neumann<__type>(__n, __x);
}
/* @} */ // tr1_math_spec_func
#endif // _GLIBCXX_USE_STD_SPEC_FUNCS
} // namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#if _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
using __gnu_cxx::conf_hypergf;
using __gnu_cxx::conf_hypergl;
using __gnu_cxx::conf_hyperg;
using __gnu_cxx::hypergf;
using __gnu_cxx::hypergl;
using __gnu_cxx::hyperg;
} // namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#else // ! (_GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__))
#include <bits/stl_algobase.h>
#include <limits>
#include <tr1/type_traits>
#include <tr1/hypergeometric.tcc>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
inline float
conf_hypergf(float __a, float __c, float __x)
{ return __detail::__conf_hyperg<float>(__a, __c, __x); }
inline long double
conf_hypergl(long double __a, long double __c, long double __x)
{ return __detail::__conf_hyperg<long double>(__a, __c, __x); }
/// 5.2.1.7 Confluent hypergeometric functions.
template<typename _Tpa, typename _Tpc, typename _Tp>
inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type
conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x)
{
typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type;
return __detail::__conf_hyperg<__type>(__a, __c, __x);
}
inline float
hypergf(float __a, float __b, float __c, float __x)
{ return __detail::__hyperg<float>(__a, __b, __c, __x); }
inline long double
hypergl(long double __a, long double __b, long double __c, long double __x)
{ return __detail::__hyperg<long double>(__a, __b, __c, __x); }
/// 5.2.1.17 Hypergeometric functions.
template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp>
inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type
hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x)
{
typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type;
return __detail::__hyperg<__type>(__a, __b, __c, __x);
}
} // namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__)
#endif // _GLIBCXX_TR1_CMATH
// TR1 cstdint -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cstdint
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CSTDINT
#define _GLIBCXX_TR1_CSTDINT 1
#pragma GCC system_header
#include <bits/c++config.h>
// For 8.22.1/1 (see C99, Notes 219, 220, 222)
# if _GLIBCXX_HAVE_STDINT_H
# ifndef __STDC_LIMIT_MACROS
# define _UNDEF__STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
# endif
# ifndef __STDC_CONSTANT_MACROS
# define _UNDEF__STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
# endif
# include <stdint.h>
# ifdef _UNDEF__STDC_LIMIT_MACROS
# undef __STDC_LIMIT_MACROS
# undef _UNDEF__STDC_LIMIT_MACROS
# endif
# ifdef _UNDEF__STDC_CONSTANT_MACROS
# undef __STDC_CONSTANT_MACROS
# undef _UNDEF__STDC_CONSTANT_MACROS
# endif
# endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int_fast8_t;
using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;
using ::int_least8_t;
using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;
using ::intmax_t;
using ::intptr_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
using ::uint_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;
using ::uint_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;
using ::uintmax_t;
using ::uintptr_t;
}
}
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // _GLIBCXX_TR1_CSTDINT
// TR1 tgmath.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/tgmath.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_TGMATH_H
#define _GLIBCXX_TR1_TGMATH_H 1
#include <tr1/ctgmath>
#endif // _GLIBCXX_TR1_TGMATH_H
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/legendre_function.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on:
// (1) Handbook of Mathematical Functions,
// ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 8, pp. 331-341
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
// 2nd ed, pp. 252-254
#ifndef _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC
#define _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC 1
#include "special_function_util.h"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief Return the Legendre polynomial by recursion on order
* @f$ l @f$.
*
* The Legendre function of @f$ l @f$ and @f$ x @f$,
* @f$ P_l(x) @f$, is defined by:
* @f[
* P_l(x) = \frac{1}{2^l l!}\frac{d^l}{dx^l}(x^2 - 1)^{l}
* @f]
*
* @param l The order of the Legendre polynomial. @f$l >= 0@f$.
* @param x The argument of the Legendre polynomial. @f$|x| <= 1@f$.
*/
template<typename _Tp>
_Tp
__poly_legendre_p(unsigned int __l, _Tp __x)
{
if ((__x < _Tp(-1)) || (__x > _Tp(+1)))
std::__throw_domain_error(__N("Argument out of range"
" in __poly_legendre_p."));
else if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x == +_Tp(1))
return +_Tp(1);
else if (__x == -_Tp(1))
return (__l % 2 == 1 ? -_Tp(1) : +_Tp(1));
else
{
_Tp __p_lm2 = _Tp(1);
if (__l == 0)
return __p_lm2;
_Tp __p_lm1 = __x;
if (__l == 1)
return __p_lm1;
_Tp __p_l = 0;
for (unsigned int __ll = 2; __ll <= __l; ++__ll)
{
// This arrangement is supposed to be better for roundoff
// protection, Arfken, 2nd Ed, Eq 12.17a.
__p_l = _Tp(2) * __x * __p_lm1 - __p_lm2
- (__x * __p_lm1 - __p_lm2) / _Tp(__ll);
__p_lm2 = __p_lm1;
__p_lm1 = __p_l;
}
return __p_l;
}
}
/**
* @brief Return the associated Legendre function by recursion
* on @f$ l @f$.
*
* The associated Legendre function is derived from the Legendre function
* @f$ P_l(x) @f$ by the Rodrigues formula:
* @f[
* P_l^m(x) = (1 - x^2)^{m/2}\frac{d^m}{dx^m}P_l(x)
* @f]
*
* @param l The order of the associated Legendre function.
* @f$ l >= 0 @f$.
* @param m The order of the associated Legendre function.
* @f$ m <= l @f$.
* @param x The argument of the associated Legendre function.
* @f$ |x| <= 1 @f$.
*/
template<typename _Tp>
_Tp
__assoc_legendre_p(unsigned int __l, unsigned int __m, _Tp __x)
{
if (__x < _Tp(-1) || __x > _Tp(+1))
std::__throw_domain_error(__N("Argument out of range"
" in __assoc_legendre_p."));
else if (__m > __l)
std::__throw_domain_error(__N("Degree out of range"
" in __assoc_legendre_p."));
else if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__m == 0)
return __poly_legendre_p(__l, __x);
else
{
_Tp __p_mm = _Tp(1);
if (__m > 0)
{
// Two square roots seem more accurate more of the time
// than just one.
_Tp __root = std::sqrt(_Tp(1) - __x) * std::sqrt(_Tp(1) + __x);
_Tp __fact = _Tp(1);
for (unsigned int __i = 1; __i <= __m; ++__i)
{
__p_mm *= -__fact * __root;
__fact += _Tp(2);
}
}
if (__l == __m)
return __p_mm;
_Tp __p_mp1m = _Tp(2 * __m + 1) * __x * __p_mm;
if (__l == __m + 1)
return __p_mp1m;
_Tp __p_lm2m = __p_mm;
_Tp __P_lm1m = __p_mp1m;
_Tp __p_lm = _Tp(0);
for (unsigned int __j = __m + 2; __j <= __l; ++__j)
{
__p_lm = (_Tp(2 * __j - 1) * __x * __P_lm1m
- _Tp(__j + __m - 1) * __p_lm2m) / _Tp(__j - __m);
__p_lm2m = __P_lm1m;
__P_lm1m = __p_lm;
}
return __p_lm;
}
}
/**
* @brief Return the spherical associated Legendre function.
*
* The spherical associated Legendre function of @f$ l @f$, @f$ m @f$,
* and @f$ \theta @f$ is defined as @f$ Y_l^m(\theta,0) @f$ where
* @f[
* Y_l^m(\theta,\phi) = (-1)^m[\frac{(2l+1)}{4\pi}
* \frac{(l-m)!}{(l+m)!}]
* P_l^m(\cos\theta) \exp^{im\phi}
* @f]
* is the spherical harmonic function and @f$ P_l^m(x) @f$ is the
* associated Legendre function.
*
* This function differs from the associated Legendre function by
* argument (@f$x = \cos(\theta)@f$) and by a normalization factor
* but this factor is rather large for large @f$ l @f$ and @f$ m @f$
* and so this function is stable for larger differences of @f$ l @f$
* and @f$ m @f$.
*
* @param l The order of the spherical associated Legendre function.
* @f$ l >= 0 @f$.
* @param m The order of the spherical associated Legendre function.
* @f$ m <= l @f$.
* @param theta The radian angle argument of the spherical associated
* Legendre function.
*/
template <typename _Tp>
_Tp
__sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
{
if (__isnan(__theta))
return std::numeric_limits<_Tp>::quiet_NaN();
const _Tp __x = std::cos(__theta);
if (__l < __m)
{
std::__throw_domain_error(__N("Bad argument "
"in __sph_legendre."));
}
else if (__m == 0)
{
_Tp __P = __poly_legendre_p(__l, __x);
_Tp __fact = std::sqrt(_Tp(2 * __l + 1)
/ (_Tp(4) * __numeric_constants<_Tp>::__pi()));
__P *= __fact;
return __P;
}
else if (__x == _Tp(1) || __x == -_Tp(1))
{
// m > 0 here
return _Tp(0);
}
else
{
// m > 0 and |x| < 1 here
// Starting value for recursion.
// Y_m^m(x) = sqrt( (2m+1)/(4pi m) gamma(m+1/2)/gamma(m) )
// (-1)^m (1-x^2)^(m/2) / pi^(1/4)
const _Tp __sgn = ( __m % 2 == 1 ? -_Tp(1) : _Tp(1));
const _Tp __y_mp1m_factor = __x * std::sqrt(_Tp(2 * __m + 3));
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __lncirc = _GLIBCXX_MATH_NS::log1p(-__x * __x);
#else
const _Tp __lncirc = std::log(_Tp(1) - __x * __x);
#endif
// Gamma(m+1/2) / Gamma(m)
#if _GLIBCXX_USE_C99_MATH_TR1
const _Tp __lnpoch = _GLIBCXX_MATH_NS::lgamma(_Tp(__m + _Tp(0.5L)))
- _GLIBCXX_MATH_NS::lgamma(_Tp(__m));
#else
const _Tp __lnpoch = __log_gamma(_Tp(__m + _Tp(0.5L)))
- __log_gamma(_Tp(__m));
#endif
const _Tp __lnpre_val =
-_Tp(0.25L) * __numeric_constants<_Tp>::__lnpi()
+ _Tp(0.5L) * (__lnpoch + __m * __lncirc);
_Tp __sr = std::sqrt((_Tp(2) + _Tp(1) / __m)
/ (_Tp(4) * __numeric_constants<_Tp>::__pi()));
_Tp __y_mm = __sgn * __sr * std::exp(__lnpre_val);
_Tp __y_mp1m = __y_mp1m_factor * __y_mm;
if (__l == __m)
{
return __y_mm;
}
else if (__l == __m + 1)
{
return __y_mp1m;
}
else
{
_Tp __y_lm = _Tp(0);
// Compute Y_l^m, l > m+1, upward recursion on l.
for ( int __ll = __m + 2; __ll <= __l; ++__ll)
{
const _Tp __rat1 = _Tp(__ll - __m) / _Tp(__ll + __m);
const _Tp __rat2 = _Tp(__ll - __m - 1) / _Tp(__ll + __m - 1);
const _Tp __fact1 = std::sqrt(__rat1 * _Tp(2 * __ll + 1)
* _Tp(2 * __ll - 1));
const _Tp __fact2 = std::sqrt(__rat1 * __rat2 * _Tp(2 * __ll + 1)
/ _Tp(2 * __ll - 3));
__y_lm = (__x * __y_mp1m * __fact1
- (__ll + __m - 1) * __y_mm * __fact2) / _Tp(__ll - __m);
__y_mm = __y_mp1m;
__y_mp1m = __y_lm;
}
return __y_lm;
}
}
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC
// TR1 cfenv -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cfenv
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CFENV
#define _GLIBCXX_TR1_CFENV 1
#pragma GCC system_header
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_FENV_H
# include <fenv.h>
#endif
#ifdef _GLIBCXX_USE_C99_FENV_TR1
#undef feclearexcept
#undef fegetexceptflag
#undef feraiseexcept
#undef fesetexceptflag
#undef fetestexcept
#undef fegetround
#undef fesetround
#undef fegetenv
#undef feholdexcept
#undef fesetenv
#undef feupdateenv
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
// types
using ::fenv_t;
using ::fexcept_t;
// functions
using ::feclearexcept;
using ::fegetexceptflag;
using ::feraiseexcept;
using ::fesetexceptflag;
using ::fetestexcept;
using ::fegetround;
using ::fesetround;
using ::fegetenv;
using ::feholdexcept;
using ::fesetenv;
using ::feupdateenv;
}
}
#endif // _GLIBCXX_USE_C99_FENV_TR1
#endif // _GLIBCXX_TR1_CFENV
// TR1 inttypes.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/inttypes.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_INTTYPES_H
#define _GLIBCXX_TR1_INTTYPES_H 1
#include <tr1/cinttypes>
#endif // _GLIBCXX_TR1_INTTYPES_H
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/modified_bessel_func.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland.
//
// References:
// (1) Handbook of Mathematical Functions,
// Ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 9, pp. 355-434, Section 10 pp. 435-478
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
// 2nd ed, pp. 246-249.
#ifndef _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC
#define _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC 1
#include "special_function_util.h"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief Compute the modified Bessel functions @f$ I_\nu(x) @f$ and
* @f$ K_\nu(x) @f$ and their first derivatives
* @f$ I'_\nu(x) @f$ and @f$ K'_\nu(x) @f$ respectively.
* These four functions are computed together for numerical
* stability.
*
* @param __nu The order of the Bessel functions.
* @param __x The argument of the Bessel functions.
* @param __Inu The output regular modified Bessel function.
* @param __Knu The output irregular modified Bessel function.
* @param __Ipnu The output derivative of the regular
* modified Bessel function.
* @param __Kpnu The output derivative of the irregular
* modified Bessel function.
*/
template <typename _Tp>
void
__bessel_ik(_Tp __nu, _Tp __x,
_Tp & __Inu, _Tp & __Knu, _Tp & __Ipnu, _Tp & __Kpnu)
{
if (__x == _Tp(0))
{
if (__nu == _Tp(0))
{
__Inu = _Tp(1);
__Ipnu = _Tp(0);
}
else if (__nu == _Tp(1))
{
__Inu = _Tp(0);
__Ipnu = _Tp(0.5L);
}
else
{
__Inu = _Tp(0);
__Ipnu = _Tp(0);
}
__Knu = std::numeric_limits<_Tp>::infinity();
__Kpnu = -std::numeric_limits<_Tp>::infinity();
return;
}
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
const _Tp __fp_min = _Tp(10) * std::numeric_limits<_Tp>::epsilon();
const int __max_iter = 15000;
const _Tp __x_min = _Tp(2);
const int __nl = static_cast<int>(__nu + _Tp(0.5L));
const _Tp __mu = __nu - __nl;
const _Tp __mu2 = __mu * __mu;
const _Tp __xi = _Tp(1) / __x;
const _Tp __xi2 = _Tp(2) * __xi;
_Tp __h = __nu * __xi;
if ( __h < __fp_min )
__h = __fp_min;
_Tp __b = __xi2 * __nu;
_Tp __d = _Tp(0);
_Tp __c = __h;
int __i;
for ( __i = 1; __i <= __max_iter; ++__i )
{
__b += __xi2;
__d = _Tp(1) / (__b + __d);
__c = __b + _Tp(1) / __c;
const _Tp __del = __c * __d;
__h *= __del;
if (std::abs(__del - _Tp(1)) < __eps)
break;
}
if (__i > __max_iter)
std::__throw_runtime_error(__N("Argument x too large "
"in __bessel_ik; "
"try asymptotic expansion."));
_Tp __Inul = __fp_min;
_Tp __Ipnul = __h * __Inul;
_Tp __Inul1 = __Inul;
_Tp __Ipnu1 = __Ipnul;
_Tp __fact = __nu * __xi;
for (int __l = __nl; __l >= 1; --__l)
{
const _Tp __Inutemp = __fact * __Inul + __Ipnul;
__fact -= __xi;
__Ipnul = __fact * __Inutemp + __Inul;
__Inul = __Inutemp;
}
_Tp __f = __Ipnul / __Inul;
_Tp __Kmu, __Knu1;
if (__x < __x_min)
{
const _Tp __x2 = __x / _Tp(2);
const _Tp __pimu = __numeric_constants<_Tp>::__pi() * __mu;
const _Tp __fact = (std::abs(__pimu) < __eps
? _Tp(1) : __pimu / std::sin(__pimu));
_Tp __d = -std::log(__x2);
_Tp __e = __mu * __d;
const _Tp __fact2 = (std::abs(__e) < __eps
? _Tp(1) : std::sinh(__e) / __e);
_Tp __gam1, __gam2, __gampl, __gammi;
__gamma_temme(__mu, __gam1, __gam2, __gampl, __gammi);
_Tp __ff = __fact
* (__gam1 * std::cosh(__e) + __gam2 * __fact2 * __d);
_Tp __sum = __ff;
__e = std::exp(__e);
_Tp __p = __e / (_Tp(2) * __gampl);
_Tp __q = _Tp(1) / (_Tp(2) * __e * __gammi);
_Tp __c = _Tp(1);
__d = __x2 * __x2;
_Tp __sum1 = __p;
int __i;
for (__i = 1; __i <= __max_iter; ++__i)
{
__ff = (__i * __ff + __p + __q) / (__i * __i - __mu2);
__c *= __d / __i;
__p /= __i - __mu;
__q /= __i + __mu;
const _Tp __del = __c * __ff;
__sum += __del;
const _Tp __del1 = __c * (__p - __i * __ff);
__sum1 += __del1;
if (std::abs(__del) < __eps * std::abs(__sum))
break;
}
if (__i > __max_iter)
std::__throw_runtime_error(__N("Bessel k series failed to converge "
"in __bessel_ik."));
__Kmu = __sum;
__Knu1 = __sum1 * __xi2;
}
else
{
_Tp __b = _Tp(2) * (_Tp(1) + __x);
_Tp __d = _Tp(1) / __b;
_Tp __delh = __d;
_Tp __h = __delh;
_Tp __q1 = _Tp(0);
_Tp __q2 = _Tp(1);
_Tp __a1 = _Tp(0.25L) - __mu2;
_Tp __q = __c = __a1;
_Tp __a = -__a1;
_Tp __s = _Tp(1) + __q * __delh;
int __i;
for (__i = 2; __i <= __max_iter; ++__i)
{
__a -= 2 * (__i - 1);
__c = -__a * __c / __i;
const _Tp __qnew = (__q1 - __b * __q2) / __a;
__q1 = __q2;
__q2 = __qnew;
__q += __c * __qnew;
__b += _Tp(2);
__d = _Tp(1) / (__b + __a * __d);
__delh = (__b * __d - _Tp(1)) * __delh;
__h += __delh;
const _Tp __dels = __q * __delh;
__s += __dels;
if ( std::abs(__dels / __s) < __eps )
break;
}
if (__i > __max_iter)
std::__throw_runtime_error(__N("Steed's method failed "
"in __bessel_ik."));
__h = __a1 * __h;
__Kmu = std::sqrt(__numeric_constants<_Tp>::__pi() / (_Tp(2) * __x))
* std::exp(-__x) / __s;
__Knu1 = __Kmu * (__mu + __x + _Tp(0.5L) - __h) * __xi;
}
_Tp __Kpmu = __mu * __xi * __Kmu - __Knu1;
_Tp __Inumu = __xi / (__f * __Kmu - __Kpmu);
__Inu = __Inumu * __Inul1 / __Inul;
__Ipnu = __Inumu * __Ipnu1 / __Inul;
for ( __i = 1; __i <= __nl; ++__i )
{
const _Tp __Knutemp = (__mu + __i) * __xi2 * __Knu1 + __Kmu;
__Kmu = __Knu1;
__Knu1 = __Knutemp;
}
__Knu = __Kmu;
__Kpnu = __nu * __xi * __Kmu - __Knu1;
return;
}
/**
* @brief Return the regular modified Bessel function of order
* \f$ \nu \f$: \f$ I_{\nu}(x) \f$.
*
* The regular modified cylindrical Bessel function is:
* @f[
* I_{\nu}(x) = \sum_{k=0}^{\infty}
* \frac{(x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)}
* @f]
*
* @param __nu The order of the regular modified Bessel function.
* @param __x The argument of the regular modified Bessel function.
* @return The output regular modified Bessel function.
*/
template<typename _Tp>
_Tp
__cyl_bessel_i(_Tp __nu, _Tp __x)
{
if (__nu < _Tp(0) || __x < _Tp(0))
std::__throw_domain_error(__N("Bad argument "
"in __cyl_bessel_i."));
else if (__isnan(__nu) || __isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x * __x < _Tp(10) * (__nu + _Tp(1)))
return __cyl_bessel_ij_series(__nu, __x, +_Tp(1), 200);
else
{
_Tp __I_nu, __K_nu, __Ip_nu, __Kp_nu;
__bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
return __I_nu;
}
}
/**
* @brief Return the irregular modified Bessel function
* \f$ K_{\nu}(x) \f$ of order \f$ \nu \f$.
*
* The irregular modified Bessel function is defined by:
* @f[
* K_{\nu}(x) = \frac{\pi}{2}
* \frac{I_{-\nu}(x) - I_{\nu}(x)}{\sin \nu\pi}
* @f]
* where for integral \f$ \nu = n \f$ a limit is taken:
* \f$ lim_{\nu \to n} \f$.
*
* @param __nu The order of the irregular modified Bessel function.
* @param __x The argument of the irregular modified Bessel function.
* @return The output irregular modified Bessel function.
*/
template<typename _Tp>
_Tp
__cyl_bessel_k(_Tp __nu, _Tp __x)
{
if (__nu < _Tp(0) || __x < _Tp(0))
std::__throw_domain_error(__N("Bad argument "
"in __cyl_bessel_k."));
else if (__isnan(__nu) || __isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else
{
_Tp __I_nu, __K_nu, __Ip_nu, __Kp_nu;
__bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
return __K_nu;
}
}
/**
* @brief Compute the spherical modified Bessel functions
* @f$ i_n(x) @f$ and @f$ k_n(x) @f$ and their first
* derivatives @f$ i'_n(x) @f$ and @f$ k'_n(x) @f$
* respectively.
*
* @param __n The order of the modified spherical Bessel function.
* @param __x The argument of the modified spherical Bessel function.
* @param __i_n The output regular modified spherical Bessel function.
* @param __k_n The output irregular modified spherical
* Bessel function.
* @param __ip_n The output derivative of the regular modified
* spherical Bessel function.
* @param __kp_n The output derivative of the irregular modified
* spherical Bessel function.
*/
template <typename _Tp>
void
__sph_bessel_ik(unsigned int __n, _Tp __x,
_Tp & __i_n, _Tp & __k_n, _Tp & __ip_n, _Tp & __kp_n)
{
const _Tp __nu = _Tp(__n) + _Tp(0.5L);
_Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu;
__bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
const _Tp __factor = __numeric_constants<_Tp>::__sqrtpio2()
/ std::sqrt(__x);
__i_n = __factor * __I_nu;
__k_n = __factor * __K_nu;
__ip_n = __factor * __Ip_nu - __i_n / (_Tp(2) * __x);
__kp_n = __factor * __Kp_nu - __k_n / (_Tp(2) * __x);
return;
}
/**
* @brief Compute the Airy functions
* @f$ Ai(x) @f$ and @f$ Bi(x) @f$ and their first
* derivatives @f$ Ai'(x) @f$ and @f$ Bi(x) @f$
* respectively.
*
* @param __x The argument of the Airy functions.
* @param __Ai The output Airy function of the first kind.
* @param __Bi The output Airy function of the second kind.
* @param __Aip The output derivative of the Airy function
* of the first kind.
* @param __Bip The output derivative of the Airy function
* of the second kind.
*/
template <typename _Tp>
void
__airy(_Tp __x, _Tp & __Ai, _Tp & __Bi, _Tp & __Aip, _Tp & __Bip)
{
const _Tp __absx = std::abs(__x);
const _Tp __rootx = std::sqrt(__absx);
const _Tp __z = _Tp(2) * __absx * __rootx / _Tp(3);
const _Tp _S_NaN = std::numeric_limits<_Tp>::quiet_NaN();
const _Tp _S_inf = std::numeric_limits<_Tp>::infinity();
if (__isnan(__x))
__Bip = __Aip = __Bi = __Ai = std::numeric_limits<_Tp>::quiet_NaN();
else if (__z == _S_inf)
{
__Aip = __Ai = _Tp(0);
__Bip = __Bi = _S_inf;
}
else if (__z == -_S_inf)
__Bip = __Aip = __Bi = __Ai = _Tp(0);
else if (__x > _Tp(0))
{
_Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu;
__bessel_ik(_Tp(1) / _Tp(3), __z, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
__Ai = __rootx * __K_nu
/ (__numeric_constants<_Tp>::__sqrt3()
* __numeric_constants<_Tp>::__pi());
__Bi = __rootx * (__K_nu / __numeric_constants<_Tp>::__pi()
+ _Tp(2) * __I_nu / __numeric_constants<_Tp>::__sqrt3());
__bessel_ik(_Tp(2) / _Tp(3), __z, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
__Aip = -__x * __K_nu
/ (__numeric_constants<_Tp>::__sqrt3()
* __numeric_constants<_Tp>::__pi());
__Bip = __x * (__K_nu / __numeric_constants<_Tp>::__pi()
+ _Tp(2) * __I_nu
/ __numeric_constants<_Tp>::__sqrt3());
}
else if (__x < _Tp(0))
{
_Tp __J_nu, __Jp_nu, __N_nu, __Np_nu;
__bessel_jn(_Tp(1) / _Tp(3), __z, __J_nu, __N_nu, __Jp_nu, __Np_nu);
__Ai = __rootx * (__J_nu
- __N_nu / __numeric_constants<_Tp>::__sqrt3()) / _Tp(2);
__Bi = -__rootx * (__N_nu
+ __J_nu / __numeric_constants<_Tp>::__sqrt3()) / _Tp(2);
__bessel_jn(_Tp(2) / _Tp(3), __z, __J_nu, __N_nu, __Jp_nu, __Np_nu);
__Aip = __absx * (__N_nu / __numeric_constants<_Tp>::__sqrt3()
+ __J_nu) / _Tp(2);
__Bip = __absx * (__J_nu / __numeric_constants<_Tp>::__sqrt3()
- __N_nu) / _Tp(2);
}
else
{
// Reference:
// Abramowitz & Stegun, page 446 section 10.4.4 on Airy functions.
// The number is Ai(0) = 3^{-2/3}/\Gamma(2/3).
__Ai = _Tp(0.35502805388781723926L);
__Bi = __Ai * __numeric_constants<_Tp>::__sqrt3();
// Reference:
// Abramowitz & Stegun, page 446 section 10.4.5 on Airy functions.
// The number is Ai'(0) = -3^{-1/3}/\Gamma(1/3).
__Aip = -_Tp(0.25881940379280679840L);
__Bip = -__Aip * __numeric_constants<_Tp>::__sqrt3();
}
return;
}
} // namespace __detail
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC
// TR1 stdarg.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/stdarg.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_STDARG_H
#define _TR1_STDARG_H 1
#include <tr1/cstdarg>
#endif
// random number generation -*- C++ -*-
// Copyright (C) 2009-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/**
* @file tr1/random.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/random}
*/
#ifndef _GLIBCXX_TR1_RANDOM_H
#define _GLIBCXX_TR1_RANDOM_H 1
#pragma GCC system_header
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
// [5.1] Random number generation
/**
* @addtogroup tr1_random Random Number Generation
* A facility for generating random numbers on selected distributions.
* @{
*/
/*
* Implementation-space details.
*/
namespace __detail
{
template<typename _UIntType, int __w,
bool = __w < std::numeric_limits<_UIntType>::digits>
struct _Shift
{ static const _UIntType __value = 0; };
template<typename _UIntType, int __w>
struct _Shift<_UIntType, __w, true>
{ static const _UIntType __value = _UIntType(1) << __w; };
template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
struct _Mod;
// Dispatch based on modulus value to prevent divide-by-zero compile-time
// errors when m == 0.
template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
inline _Tp
__mod(_Tp __x)
{ return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4),
unsigned, unsigned long>::__type _UInt32Type;
/*
* An adaptor class for converting the output of any Generator into
* the input for a specific Distribution.
*/
template<typename _Engine, typename _Distribution>
struct _Adaptor
{
typedef typename remove_reference<_Engine>::type _BEngine;
typedef typename _BEngine::result_type _Engine_result_type;
typedef typename _Distribution::input_type result_type;
public:
_Adaptor(const _Engine& __g)
: _M_g(__g) { }
result_type
min() const
{
result_type __return_value;
if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = _M_g.min();
else
__return_value = result_type(0);
return __return_value;
}
result_type
max() const
{
result_type __return_value;
if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = _M_g.max();
else if (!is_integral<result_type>::value)
__return_value = result_type(1);
else
__return_value = std::numeric_limits<result_type>::max() - 1;
return __return_value;
}
/*
* Converts a value generated by the adapted random number generator
* into a value in the input domain for the dependent random number
* distribution.
*
* Because the type traits are compile time constants only the
* appropriate clause of the if statements will actually be emitted
* by the compiler.
*/
result_type
operator()()
{
result_type __return_value;
if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = _M_g();
else if (!is_integral<_Engine_result_type>::value
&& !is_integral<result_type>::value)
__return_value = result_type(_M_g() - _M_g.min())
/ result_type(_M_g.max() - _M_g.min());
else if (is_integral<_Engine_result_type>::value
&& !is_integral<result_type>::value)
__return_value = result_type(_M_g() - _M_g.min())
/ result_type(_M_g.max() - _M_g.min() + result_type(1));
else
__return_value = (((_M_g() - _M_g.min())
/ (_M_g.max() - _M_g.min()))
* std::numeric_limits<result_type>::max());
return __return_value;
}
private:
_Engine _M_g;
};
// Specialization for _Engine*.
template<typename _Engine, typename _Distribution>
struct _Adaptor<_Engine*, _Distribution>
{
typedef typename _Engine::result_type _Engine_result_type;
typedef typename _Distribution::input_type result_type;
public:
_Adaptor(_Engine* __g)
: _M_g(__g) { }
result_type
min() const
{
result_type __return_value;
if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = _M_g->min();
else
__return_value = result_type(0);
return __return_value;
}
result_type
max() const
{
result_type __return_value;
if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = _M_g->max();
else if (!is_integral<result_type>::value)
__return_value = result_type(1);
else
__return_value = std::numeric_limits<result_type>::max() - 1;
return __return_value;
}
result_type
operator()()
{
result_type __return_value;
if (is_integral<_Engine_result_type>::value
&& is_integral<result_type>::value)
__return_value = (*_M_g)();
else if (!is_integral<_Engine_result_type>::value
&& !is_integral<result_type>::value)
__return_value = result_type((*_M_g)() - _M_g->min())
/ result_type(_M_g->max() - _M_g->min());
else if (is_integral<_Engine_result_type>::value
&& !is_integral<result_type>::value)
__return_value = result_type((*_M_g)() - _M_g->min())
/ result_type(_M_g->max() - _M_g->min() + result_type(1));
else
__return_value = ((((*_M_g)() - _M_g->min())
/ (_M_g->max() - _M_g->min()))
* std::numeric_limits<result_type>::max());
return __return_value;
}
private:
_Engine* _M_g;
};
} // namespace __detail
/**
* Produces random numbers on a given distribution function using a
* non-uniform random number generation engine.
*
* @todo the engine_value_type needs to be studied more carefully.
*/
template<typename _Engine, typename _Dist>
class variate_generator
{
// Concept requirements.
__glibcxx_class_requires(_Engine, _CopyConstructibleConcept)
// __glibcxx_class_requires(_Engine, _EngineConcept)
// __glibcxx_class_requires(_Dist, _EngineConcept)
public:
typedef _Engine engine_type;
typedef __detail::_Adaptor<_Engine, _Dist> engine_value_type;
typedef _Dist distribution_type;
typedef typename _Dist::result_type result_type;
// tr1:5.1.1 table 5.1 requirement
typedef typename __gnu_cxx::__enable_if<
is_arithmetic<result_type>::value, result_type>::__type _IsValidType;
/**
* Constructs a variate generator with the uniform random number
* generator @p __eng for the random distribution @p __dist.
*
* @throws Any exceptions which may thrown by the copy constructors of
* the @p _Engine or @p _Dist objects.
*/
variate_generator(engine_type __eng, distribution_type __dist)
: _M_engine(__eng), _M_dist(__dist) { }
/**
* Gets the next generated value on the distribution.
*/
result_type
operator()()
{ return _M_dist(_M_engine); }
/**
* WTF?
*/
template<typename _Tp>
result_type
operator()(_Tp __value)
{ return _M_dist(_M_engine, __value); }
/**
* Gets a reference to the underlying uniform random number generator
* object.
*/
engine_value_type&
engine()
{ return _M_engine; }
/**
* Gets a const reference to the underlying uniform random number
* generator object.
*/
const engine_value_type&
engine() const
{ return _M_engine; }
/**
* Gets a reference to the underlying random distribution.
*/
distribution_type&
distribution()
{ return _M_dist; }
/**
* Gets a const reference to the underlying random distribution.
*/
const distribution_type&
distribution() const
{ return _M_dist; }
/**
* Gets the closed lower bound of the distribution interval.
*/
result_type
min() const
{ return this->distribution().min(); }
/**
* Gets the closed upper bound of the distribution interval.
*/
result_type
max() const
{ return this->distribution().max(); }
private:
engine_value_type _M_engine;
distribution_type _M_dist;
};
/**
* @addtogroup tr1_random_generators Random Number Generators
* @ingroup tr1_random
*
* These classes define objects which provide random or pseudorandom
* numbers, either from a discrete or a continuous interval. The
* random number generator supplied as a part of this library are
* all uniform random number generators which provide a sequence of
* random number uniformly distributed over their range.
*
* A number generator is a function object with an operator() that
* takes zero arguments and returns a number.
*
* A compliant random number generator must satisfy the following
* requirements. <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Random Number Generator Requirements</caption>
* <tr><td>To be documented.</td></tr> </table>
*
* @{
*/
/**
* @brief A model of a linear congruential random number generator.
*
* A random number generator that produces pseudorandom numbers using the
* linear function @f$x_{i+1}\leftarrow(ax_{i} + c) \bmod m @f$.
*
* The template parameter @p _UIntType must be an unsigned integral type
* large enough to store values up to (__m-1). If the template parameter
* @p __m is 0, the modulus @p __m used is
* std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template
* parameters @p __a and @p __c must be less than @p __m.
*
* The size of the state is @f$ 1 @f$.
*/
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential
{
__glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
// __glibcpp_class_requires(__a < __m && __c < __m)
public:
/** The type of the generated random value. */
typedef _UIntType result_type;
/** The multiplier. */
static const _UIntType multiplier = __a;
/** An increment. */
static const _UIntType increment = __c;
/** The modulus. */
static const _UIntType modulus = __m;
/**
* Constructs a %linear_congruential random number generator engine with
* seed @p __s. The default seed value is 1.
*
* @param __s The initial seed value.
*/
explicit
linear_congruential(unsigned long __x0 = 1)
{ this->seed(__x0); }
/**
* Constructs a %linear_congruential random number generator engine
* seeded from the generator function @p __g.
*
* @param __g The seed generator function.
*/
template<class _Gen>
linear_congruential(_Gen& __g)
{ this->seed(__g); }
/**
* Reseeds the %linear_congruential random number generator engine
* sequence to the seed @g __s.
*
* @param __s The new seed.
*/
void
seed(unsigned long __s = 1);
/**
* Reseeds the %linear_congruential random number generator engine
* sequence using values from the generator function @p __g.
*
* @param __g the seed generator function.
*/
template<class _Gen>
void
seed(_Gen& __g)
{ seed(__g, typename is_fundamental<_Gen>::type()); }
/**
* Gets the smallest possible value in the output range.
*
* The minimum depends on the @p __c parameter: if it is zero, the
* minimum generated must be > 0, otherwise 0 is allowed.
*/
result_type
min() const
{ return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }
/**
* Gets the largest possible value in the output range.
*/
result_type
max() const
{ return __m - 1; }
/**
* Gets the next random number in the sequence.
*/
result_type
operator()();
/**
* Compares two linear congruential random number generator
* objects of the same type for equality.
*
* @param __lhs A linear congruential random number generator object.
* @param __rhs Another linear congruential random number generator obj.
*
* @returns true if the two objects are equal, false otherwise.
*/
friend bool
operator==(const linear_congruential& __lhs,
const linear_congruential& __rhs)
{ return __lhs._M_x == __rhs._M_x; }
/**
* Compares two linear congruential random number generator
* objects of the same type for inequality.
*
* @param __lhs A linear congruential random number generator object.
* @param __rhs Another linear congruential random number generator obj.
*
* @returns true if the two objects are not equal, false otherwise.
*/
friend bool
operator!=(const linear_congruential& __lhs,
const linear_congruential& __rhs)
{ return !(__lhs == __rhs); }
/**
* Writes the textual representation of the state x(i) of x to @p __os.
*
* @param __os The output stream.
* @param __lcr A % linear_congruential random number generator.
* @returns __os.
*/
template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
_UIntType1 __m1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const linear_congruential<_UIntType1, __a1, __c1,
__m1>& __lcr);
/**
* Sets the state of the engine by reading its textual
* representation from @p __is.
*
* The textual representation must have been previously written using an
* output stream whose imbued locale and whose type's template
* specialization arguments _CharT and _Traits were the same as those of
* @p __is.
*
* @param __is The input stream.
* @param __lcr A % linear_congruential random number generator.
* @returns __is.
*/
template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
_UIntType1 __m1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr);
private:
template<class _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<class _Gen>
void
seed(_Gen& __g, false_type);
_UIntType _M_x;
};
/**
* The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.
*/
typedef linear_congruential<unsigned long, 16807, 0, 2147483647> minstd_rand0;
/**
* An alternative LCR (Lehmer Generator function) .
*/
typedef linear_congruential<unsigned long, 48271, 0, 2147483647> minstd_rand;
/**
* A generalized feedback shift register discrete random number generator.
*
* This algorithm avoids multiplication and division and is designed to be
* friendly to a pipelined architecture. If the parameters are chosen
* correctly, this generator will produce numbers with a very long period and
* fairly good apparent entropy, although still not cryptographically strong.
*
* The best way to use this generator is with the predefined mt19937 class.
*
* This algorithm was originally invented by Makoto Matsumoto and
* Takuji Nishimura.
*
* @var word_size The number of bits in each element of the state vector.
* @var state_size The degree of recursion.
* @var shift_size The period parameter.
* @var mask_bits The separation point bit index.
* @var parameter_a The last row of the twist matrix.
* @var output_u The first right-shift tempering matrix parameter.
* @var output_s The first left-shift tempering matrix parameter.
* @var output_b The first left-shift tempering matrix mask.
* @var output_t The second left-shift tempering matrix parameter.
* @var output_c The second left-shift tempering matrix mask.
* @var output_l The second right-shift tempering matrix parameter.
*/
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s, _UIntType __b, int __t,
_UIntType __c, int __l>
class mersenne_twister
{
__glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
public:
// types
typedef _UIntType result_type;
// parameter values
static const int word_size = __w;
static const int state_size = __n;
static const int shift_size = __m;
static const int mask_bits = __r;
static const _UIntType parameter_a = __a;
static const int output_u = __u;
static const int output_s = __s;
static const _UIntType output_b = __b;
static const int output_t = __t;
static const _UIntType output_c = __c;
static const int output_l = __l;
// constructors and member function
mersenne_twister()
{ seed(); }
explicit
mersenne_twister(unsigned long __value)
{ seed(__value); }
template<class _Gen>
mersenne_twister(_Gen& __g)
{ seed(__g); }
void
seed()
{ seed(5489UL); }
void
seed(unsigned long __value);
template<class _Gen>
void
seed(_Gen& __g)
{ seed(__g, typename is_fundamental<_Gen>::type()); }
result_type
min() const
{ return 0; }
result_type
max() const
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
result_type
operator()();
/**
* Compares two % mersenne_twister random number generator objects of
* the same type for equality.
*
* @param __lhs A % mersenne_twister random number generator object.
* @param __rhs Another % mersenne_twister random number generator
* object.
*
* @returns true if the two objects are equal, false otherwise.
*/
friend bool
operator==(const mersenne_twister& __lhs,
const mersenne_twister& __rhs)
{ return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
/**
* Compares two % mersenne_twister random number generator objects of
* the same type for inequality.
*
* @param __lhs A % mersenne_twister random number generator object.
* @param __rhs Another % mersenne_twister random number generator
* object.
*
* @returns true if the two objects are not equal, false otherwise.
*/
friend bool
operator!=(const mersenne_twister& __lhs,
const mersenne_twister& __rhs)
{ return !(__lhs == __rhs); }
/**
* Inserts the current state of a % mersenne_twister random number
* generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A % mersenne_twister random number generator engine.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
_UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
_UIntType1 __c1, int __l1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
__a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
/**
* Extracts the current state of a % mersenne_twister random number
* generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A % mersenne_twister random number generator engine.
*
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
_UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
_UIntType1 __c1, int __l1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
__a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
private:
template<class _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<class _Gen>
void
seed(_Gen& __g, false_type);
_UIntType _M_x[state_size];
int _M_p;
};
/**
* The classic Mersenne Twister.
*
* Reference:
* M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally
* Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions
* on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
*/
typedef mersenne_twister<
unsigned long, 32, 624, 397, 31,
0x9908b0dful, 11, 7,
0x9d2c5680ul, 15,
0xefc60000ul, 18
> mt19937;
/**
* @brief The Marsaglia-Zaman generator.
*
* This is a model of a Generalized Fibonacci discrete random number
* generator, sometimes referred to as the SWC generator.
*
* A discrete random number generator that produces pseudorandom
* numbers using @f$x_{i}\leftarrow(x_{i - s} - x_{i - r} -
* carry_{i-1}) \bmod m @f$.
*
* The size of the state is @f$ r @f$
* and the maximum period of the generator is @f$ m^r - m^s -1 @f$.
*
* N1688[4.13] says <em>the template parameter _IntType shall denote
* an integral type large enough to store values up to m</em>.
*
* @var _M_x The state of the generator. This is a ring buffer.
* @var _M_carry The carry.
* @var _M_p Current index of x(i - r).
*/
template<typename _IntType, _IntType __m, int __s, int __r>
class subtract_with_carry
{
__glibcxx_class_requires(_IntType, _IntegerConcept)
public:
/** The type of the generated random value. */
typedef _IntType result_type;
// parameter values
static const _IntType modulus = __m;
static const int long_lag = __r;
static const int short_lag = __s;
/**
* Constructs a default-initialized % subtract_with_carry random number
* generator.
*/
subtract_with_carry()
{ this->seed(); }
/**
* Constructs an explicitly seeded % subtract_with_carry random number
* generator.
*/
explicit
subtract_with_carry(unsigned long __value)
{ this->seed(__value); }
/**
* Constructs a %subtract_with_carry random number generator engine
* seeded from the generator function @p __g.
*
* @param __g The seed generator function.
*/
template<class _Gen>
subtract_with_carry(_Gen& __g)
{ this->seed(__g); }
/**
* Seeds the initial state @f$ x_0 @f$ of the random number generator.
*
* N1688[4.19] modifies this as follows. If @p __value == 0,
* sets value to 19780503. In any case, with a linear
* congruential generator lcg(i) having parameters @f$ m_{lcg} =
* 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value
* @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m
* \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$
* set carry to 1, otherwise sets carry to 0.
*/
void
seed(unsigned long __value = 19780503);
/**
* Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry
* random number generator.
*/
template<class _Gen>
void
seed(_Gen& __g)
{ seed(__g, typename is_fundamental<_Gen>::type()); }
/**
* Gets the inclusive minimum value of the range of random integers
* returned by this generator.
*/
result_type
min() const
{ return 0; }
/**
* Gets the inclusive maximum value of the range of random integers
* returned by this generator.
*/
result_type
max() const
{ return this->modulus - 1; }
/**
* Gets the next random number in the sequence.
*/
result_type
operator()();
/**
* Compares two % subtract_with_carry random number generator objects of
* the same type for equality.
*
* @param __lhs A % subtract_with_carry random number generator object.
* @param __rhs Another % subtract_with_carry random number generator
* object.
*
* @returns true if the two objects are equal, false otherwise.
*/
friend bool
operator==(const subtract_with_carry& __lhs,
const subtract_with_carry& __rhs)
{ return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
/**
* Compares two % subtract_with_carry random number generator objects of
* the same type for inequality.
*
* @param __lhs A % subtract_with_carry random number generator object.
* @param __rhs Another % subtract_with_carry random number generator
* object.
*
* @returns true if the two objects are not equal, false otherwise.
*/
friend bool
operator!=(const subtract_with_carry& __lhs,
const subtract_with_carry& __rhs)
{ return !(__lhs == __rhs); }
/**
* Inserts the current state of a % subtract_with_carry random number
* generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A % subtract_with_carry random number generator engine.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const subtract_with_carry<_IntType1, __m1, __s1,
__r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry random number
* generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A % subtract_with_carry random number generator engine.
*
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x);
private:
template<class _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<class _Gen>
void
seed(_Gen& __g, false_type);
typedef typename __gnu_cxx::__add_unsigned<_IntType>::__type _UIntType;
_UIntType _M_x[long_lag];
_UIntType _M_carry;
int _M_p;
};
/**
* @brief The Marsaglia-Zaman generator (floats version).
*
* @var _M_x The state of the generator. This is a ring buffer.
* @var _M_carry The carry.
* @var _M_p Current index of x(i - r).
* @var _M_npows Precomputed negative powers of 2.
*/
template<typename _RealType, int __w, int __s, int __r>
class subtract_with_carry_01
{
public:
/** The type of the generated random value. */
typedef _RealType result_type;
// parameter values
static const int word_size = __w;
static const int long_lag = __r;
static const int short_lag = __s;
/**
* Constructs a default-initialized % subtract_with_carry_01 random
* number generator.
*/
subtract_with_carry_01()
{
this->seed();
_M_initialize_npows();
}
/**
* Constructs an explicitly seeded % subtract_with_carry_01 random number
* generator.
*/
explicit
subtract_with_carry_01(unsigned long __value)
{
this->seed(__value);
_M_initialize_npows();
}
/**
* Constructs a % subtract_with_carry_01 random number generator engine
* seeded from the generator function @p __g.
*
* @param __g The seed generator function.
*/
template<class _Gen>
subtract_with_carry_01(_Gen& __g)
{
this->seed(__g);
_M_initialize_npows();
}
/**
* Seeds the initial state @f$ x_0 @f$ of the random number generator.
*/
void
seed(unsigned long __value = 19780503);
/**
* Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry_01
* random number generator.
*/
template<class _Gen>
void
seed(_Gen& __g)
{ seed(__g, typename is_fundamental<_Gen>::type()); }
/**
* Gets the minimum value of the range of random floats
* returned by this generator.
*/
result_type
min() const
{ return 0.0; }
/**
* Gets the maximum value of the range of random floats
* returned by this generator.
*/
result_type
max() const
{ return 1.0; }
/**
* Gets the next random number in the sequence.
*/
result_type
operator()();
/**
* Compares two % subtract_with_carry_01 random number generator objects
* of the same type for equality.
*
* @param __lhs A % subtract_with_carry_01 random number
* generator object.
* @param __rhs Another % subtract_with_carry_01 random number generator
* object.
*
* @returns true if the two objects are equal, false otherwise.
*/
friend bool
operator==(const subtract_with_carry_01& __lhs,
const subtract_with_carry_01& __rhs)
{
for (int __i = 0; __i < long_lag; ++__i)
if (!std::equal(__lhs._M_x[__i], __lhs._M_x[__i] + __n,
__rhs._M_x[__i]))
return false;
return true;
}
/**
* Compares two % subtract_with_carry_01 random number generator objects
* of the same type for inequality.
*
* @param __lhs A % subtract_with_carry_01 random number
* generator object.
*
* @param __rhs Another % subtract_with_carry_01 random number generator
* object.
*
* @returns true if the two objects are not equal, false otherwise.
*/
friend bool
operator!=(const subtract_with_carry_01& __lhs,
const subtract_with_carry_01& __rhs)
{ return !(__lhs == __rhs); }
/**
* Inserts the current state of a % subtract_with_carry_01 random number
* generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A % subtract_with_carry_01 random number generator engine.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, int __w1, int __s1, int __r1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const subtract_with_carry_01<_RealType1, __w1, __s1,
__r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry_01 random number
* generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A % subtract_with_carry_01 random number generator engine.
*
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
template<typename _RealType1, int __w1, int __s1, int __r1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
subtract_with_carry_01<_RealType1, __w1, __s1, __r1>& __x);
private:
template<class _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<class _Gen>
void
seed(_Gen& __g, false_type);
void
_M_initialize_npows();
static const int __n = (__w + 31) / 32;
typedef __detail::_UInt32Type _UInt32Type;
_UInt32Type _M_x[long_lag][__n];
_RealType _M_npows[__n];
_UInt32Type _M_carry;
int _M_p;
};
typedef subtract_with_carry_01<float, 24, 10, 24> ranlux_base_01;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 508. Bad parameters for ranlux64_base_01.
typedef subtract_with_carry_01<double, 48, 5, 12> ranlux64_base_01;
/**
* Produces random numbers from some base engine by discarding blocks of
* data.
*
* 0 <= @p __r <= @p __p
*/
template<class _UniformRandomNumberGenerator, int __p, int __r>
class discard_block
{
// __glibcxx_class_requires(typename base_type::result_type,
// ArithmeticTypeConcept)
public:
/** The type of the underlying generator engine. */
typedef _UniformRandomNumberGenerator base_type;
/** The type of the generated random value. */
typedef typename base_type::result_type result_type;
// parameter values
static const int block_size = __p;
static const int used_block = __r;
/**
* Constructs a default %discard_block engine.
*
* The underlying engine is default constructed as well.
*/
discard_block()
: _M_n(0) { }
/**
* Copy constructs a %discard_block engine.
*
* Copies an existing base class random number generator.
* @param rng An existing (base class) engine object.
*/
explicit
discard_block(const base_type& __rng)
: _M_b(__rng), _M_n(0) { }
/**
* Seed constructs a %discard_block engine.
*
* Constructs the underlying generator engine seeded with @p __s.
* @param __s A seed value for the base class engine.
*/
explicit
discard_block(unsigned long __s)
: _M_b(__s), _M_n(0) { }
/**
* Generator construct a %discard_block engine.
*
* @param __g A seed generator function.
*/
template<class _Gen>
discard_block(_Gen& __g)
: _M_b(__g), _M_n(0) { }
/**
* Reseeds the %discard_block object with the default seed for the
* underlying base class generator engine.
*/
void seed()
{
_M_b.seed();
_M_n = 0;
}
/**
* Reseeds the %discard_block object with the given seed generator
* function.
* @param __g A seed generator function.
*/
template<class _Gen>
void seed(_Gen& __g)
{
_M_b.seed(__g);
_M_n = 0;
}
/**
* Gets a const reference to the underlying generator engine object.
*/
const base_type&
base() const
{ return _M_b; }
/**
* Gets the minimum value in the generated random number range.
*/
result_type
min() const
{ return _M_b.min(); }
/**
* Gets the maximum value in the generated random number range.
*/
result_type
max() const
{ return _M_b.max(); }
/**
* Gets the next value in the generated random number sequence.
*/
result_type
operator()();
/**
* Compares two %discard_block random number generator objects of
* the same type for equality.
*
* @param __lhs A %discard_block random number generator object.
* @param __rhs Another %discard_block random number generator
* object.
*
* @returns true if the two objects are equal, false otherwise.
*/
friend bool
operator==(const discard_block& __lhs, const discard_block& __rhs)
{ return (__lhs._M_b == __rhs._M_b) && (__lhs._M_n == __rhs._M_n); }
/**
* Compares two %discard_block random number generator objects of
* the same type for inequality.
*
* @param __lhs A %discard_block random number generator object.
* @param __rhs Another %discard_block random number generator
* object.
*
* @returns true if the two objects are not equal, false otherwise.
*/
friend bool
operator!=(const discard_block& __lhs, const discard_block& __rhs)
{ return !(__lhs == __rhs); }
/**
* Inserts the current state of a %discard_block random number
* generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %discard_block random number generator engine.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const discard_block<_UniformRandomNumberGenerator1,
__p1, __r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry random number
* generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %discard_block random number generator engine.
*
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
discard_block<_UniformRandomNumberGenerator1,
__p1, __r1>& __x);
private:
base_type _M_b;
int _M_n;
};
/**
* James's luxury-level-3 integer adaptation of Luescher's generator.
*/
typedef discard_block<
subtract_with_carry<unsigned long, (1UL << 24), 10, 24>,
223,
24
> ranlux3;
/**
* James's luxury-level-4 integer adaptation of Luescher's generator.
*/
typedef discard_block<
subtract_with_carry<unsigned long, (1UL << 24), 10, 24>,
389,
24
> ranlux4;
typedef discard_block<
subtract_with_carry_01<float, 24, 10, 24>,
223,
24
> ranlux3_01;
typedef discard_block<
subtract_with_carry_01<float, 24, 10, 24>,
389,
24
> ranlux4_01;
/**
* A random number generator adaptor class that combines two random number
* generator engines into a single output sequence.
*/
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
class xor_combine
{
// __glibcxx_class_requires(typename _UniformRandomNumberGenerator1::
// result_type, ArithmeticTypeConcept)
// __glibcxx_class_requires(typename _UniformRandomNumberGenerator2::
// result_type, ArithmeticTypeConcept)
public:
/** The type of the first underlying generator engine. */
typedef _UniformRandomNumberGenerator1 base1_type;
/** The type of the second underlying generator engine. */
typedef _UniformRandomNumberGenerator2 base2_type;
private:
typedef typename base1_type::result_type _Result_type1;
typedef typename base2_type::result_type _Result_type2;
public:
/** The type of the generated random value. */
typedef typename __gnu_cxx::__conditional_type<(sizeof(_Result_type1)
> sizeof(_Result_type2)),
_Result_type1, _Result_type2>::__type result_type;
// parameter values
static const int shift1 = __s1;
static const int shift2 = __s2;
// constructors and member function
xor_combine()
: _M_b1(), _M_b2()
{ _M_initialize_max(); }
xor_combine(const base1_type& __rng1, const base2_type& __rng2)
: _M_b1(__rng1), _M_b2(__rng2)
{ _M_initialize_max(); }
xor_combine(unsigned long __s)
: _M_b1(__s), _M_b2(__s + 1)
{ _M_initialize_max(); }
template<class _Gen>
xor_combine(_Gen& __g)
: _M_b1(__g), _M_b2(__g)
{ _M_initialize_max(); }
void
seed()
{
_M_b1.seed();
_M_b2.seed();
}
template<class _Gen>
void
seed(_Gen& __g)
{
_M_b1.seed(__g);
_M_b2.seed(__g);
}
const base1_type&
base1() const
{ return _M_b1; }
const base2_type&
base2() const
{ return _M_b2; }
result_type
min() const
{ return 0; }
result_type
max() const
{ return _M_max; }
/**
* Gets the next random number in the sequence.
*/
// NB: Not exactly the TR1 formula, per N2079 instead.
result_type
operator()()
{
return ((result_type(_M_b1() - _M_b1.min()) << shift1)
^ (result_type(_M_b2() - _M_b2.min()) << shift2));
}
/**
* Compares two %xor_combine random number generator objects of
* the same type for equality.
*
* @param __lhs A %xor_combine random number generator object.
* @param __rhs Another %xor_combine random number generator
* object.
*
* @returns true if the two objects are equal, false otherwise.
*/
friend bool
operator==(const xor_combine& __lhs, const xor_combine& __rhs)
{
return (__lhs.base1() == __rhs.base1())
&& (__lhs.base2() == __rhs.base2());
}
/**
* Compares two %xor_combine random number generator objects of
* the same type for inequality.
*
* @param __lhs A %xor_combine random number generator object.
* @param __rhs Another %xor_combine random number generator
* object.
*
* @returns true if the two objects are not equal, false otherwise.
*/
friend bool
operator!=(const xor_combine& __lhs, const xor_combine& __rhs)
{ return !(__lhs == __rhs); }
/**
* Inserts the current state of a %xor_combine random number
* generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %xor_combine random number generator engine.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<class _UniformRandomNumberGenerator11, int __s11,
class _UniformRandomNumberGenerator21, int __s21,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const xor_combine<_UniformRandomNumberGenerator11, __s11,
_UniformRandomNumberGenerator21, __s21>& __x);
/**
* Extracts the current state of a %xor_combine random number
* generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %xor_combine random number generator engine.
*
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
template<class _UniformRandomNumberGenerator11, int __s11,
class _UniformRandomNumberGenerator21, int __s21,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
xor_combine<_UniformRandomNumberGenerator11, __s11,
_UniformRandomNumberGenerator21, __s21>& __x);
private:
void
_M_initialize_max();
result_type
_M_initialize_max_aux(result_type, result_type, int);
base1_type _M_b1;
base2_type _M_b2;
result_type _M_max;
};
/**
* A standard interface to a platform-specific non-deterministic
* random number generator (if any are available).
*/
class random_device
{
public:
// types
typedef unsigned int result_type;
// constructors, destructors and member functions
#ifdef _GLIBCXX_USE_RANDOM_TR1
explicit
random_device(const std::string& __token = "/dev/urandom")
{
if ((__token != "/dev/urandom" && __token != "/dev/random")
|| !(_M_file = std::fopen(__token.c_str(), "rb")))
std::__throw_runtime_error(__N("random_device::"
"random_device(const std::string&)"));
}
~random_device()
{ std::fclose(_M_file); }
#else
explicit
random_device(const std::string& __token = "mt19937")
: _M_mt(_M_strtoul(__token)) { }
private:
static unsigned long
_M_strtoul(const std::string& __str)
{
unsigned long __ret = 5489UL;
if (__str != "mt19937")
{
const char* __nptr = __str.c_str();
char* __endptr;
__ret = std::strtoul(__nptr, &__endptr, 0);
if (*__nptr == '\0' || *__endptr != '\0')
std::__throw_runtime_error(__N("random_device::_M_strtoul"
"(const std::string&)"));
}
return __ret;
}
public:
#endif
result_type
min() const
{ return std::numeric_limits<result_type>::min(); }
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
double
entropy() const
{ return 0.0; }
result_type
operator()()
{
#ifdef _GLIBCXX_USE_RANDOM_TR1
result_type __ret;
std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),
1, _M_file);
return __ret;
#else
return _M_mt();
#endif
}
private:
random_device(const random_device&);
void operator=(const random_device&);
#ifdef _GLIBCXX_USE_RANDOM_TR1
FILE* _M_file;
#else
mt19937 _M_mt;
#endif
};
/* @} */ // group tr1_random_generators
/**
* @addtogroup tr1_random_distributions Random Number Distributions
* @ingroup tr1_random
* @{
*/
/**
* @addtogroup tr1_random_distributions_discrete Discrete Distributions
* @ingroup tr1_random_distributions
* @{
*/
/**
* @brief Uniform discrete distribution for random numbers.
* A discrete random distribution on the range @f$[min, max]@f$ with equal
* probability throughout the range.
*/
template<typename _IntType = int>
class uniform_int
{
__glibcxx_class_requires(_IntType, _IntegerConcept)
public:
/** The type of the parameters of the distribution. */
typedef _IntType input_type;
/** The type of the range of the distribution. */
typedef _IntType result_type;
public:
/**
* Constructs a uniform distribution object.
*/
explicit
uniform_int(_IntType __min = 0, _IntType __max = 9)
: _M_min(__min), _M_max(__max)
{
_GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max);
}
/**
* Gets the inclusive lower bound of the distribution range.
*/
result_type
min() const
{ return _M_min; }
/**
* Gets the inclusive upper bound of the distribution range.
*/
result_type
max() const
{ return _M_max; }
/**
* Resets the distribution state.
*
* Does nothing for the uniform integer distribution.
*/
void
reset() { }
/**
* Gets a uniformly distributed random number in the range
* @f$(min, max)@f$.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{
typedef typename _UniformRandomNumberGenerator::result_type
_UResult_type;
return _M_call(__urng, _M_min, _M_max,
typename is_integral<_UResult_type>::type());
}
/**
* Gets a uniform random number in the range @f$[0, n)@f$.
*
* This function is aimed at use with std::random_shuffle.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng, result_type __n)
{
typedef typename _UniformRandomNumberGenerator::result_type
_UResult_type;
return _M_call(__urng, 0, __n - 1,
typename is_integral<_UResult_type>::type());
}
/**
* Inserts a %uniform_int random number distribution @p __x into the
* output stream @p os.
*
* @param __os An output stream.
* @param __x A %uniform_int random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _IntType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const uniform_int<_IntType1>& __x);
/**
* Extracts a %uniform_int random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %uniform_int random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _IntType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
uniform_int<_IntType1>& __x);
private:
template<typename _UniformRandomNumberGenerator>
result_type
_M_call(_UniformRandomNumberGenerator& __urng,
result_type __min, result_type __max, true_type);
template<typename _UniformRandomNumberGenerator>
result_type
_M_call(_UniformRandomNumberGenerator& __urng,
result_type __min, result_type __max, false_type)
{
return result_type((__urng() - __urng.min())
/ (__urng.max() - __urng.min())
* (__max - __min + 1)) + __min;
}
_IntType _M_min;
_IntType _M_max;
};
/**
* @brief A Bernoulli random number distribution.
*
* Generates a sequence of true and false values with likelihood @f$ p @f$
* that true will come up and @f$ (1 - p) @f$ that false will appear.
*/
class bernoulli_distribution
{
public:
typedef int input_type;
typedef bool result_type;
public:
/**
* Constructs a Bernoulli distribution with likelihood @p p.
*
* @param __p [IN] The likelihood of a true result being returned. Must
* be in the interval @f$ [0, 1] @f$.
*/
explicit
bernoulli_distribution(double __p = 0.5)
: _M_p(__p)
{
_GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));
}
/**
* Gets the @p p parameter of the distribution.
*/
double
p() const
{ return _M_p; }
/**
* Resets the distribution state.
*
* Does nothing for a Bernoulli distribution.
*/
void
reset() { }
/**
* Gets the next value in the Bernoullian sequence.
*/
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{
if ((__urng() - __urng.min()) < _M_p * (__urng.max() - __urng.min()))
return true;
return false;
}
/**
* Inserts a %bernoulli_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %bernoulli_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const bernoulli_distribution& __x);
/**
* Extracts a %bernoulli_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %bernoulli_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
bernoulli_distribution& __x)
{ return __is >> __x._M_p; }
private:
double _M_p;
};
/**
* @brief A discrete geometric random number distribution.
*
* The formula for the geometric probability mass function is
* @f$ p(i) = (1 - p)p^{i-1} @f$ where @f$ p @f$ is the parameter of the
* distribution.
*/
template<typename _IntType = int, typename _RealType = double>
class geometric_distribution
{
public:
// types
typedef _RealType input_type;
typedef _IntType result_type;
// constructors and member function
explicit
geometric_distribution(const _RealType& __p = _RealType(0.5))
: _M_p(__p)
{
_GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0));
_M_initialize();
}
/**
* Gets the distribution parameter @p p.
*/
_RealType
p() const
{ return _M_p; }
void
reset() { }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng);
/**
* Inserts a %geometric_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %geometric_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _IntType1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const geometric_distribution<_IntType1, _RealType1>& __x);
/**
* Extracts a %geometric_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %geometric_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
geometric_distribution& __x)
{
__is >> __x._M_p;
__x._M_initialize();
return __is;
}
private:
void
_M_initialize()
{ _M_log_p = std::log(_M_p); }
_RealType _M_p;
_RealType _M_log_p;
};
template<typename _RealType>
class normal_distribution;
/**
* @brief A discrete Poisson random number distribution.
*
* The formula for the Poisson probability mass function is
* @f$ p(i) = \frac{mean^i}{i!} e^{-mean} @f$ where @f$ mean @f$ is the
* parameter of the distribution.
*/
template<typename _IntType = int, typename _RealType = double>
class poisson_distribution
{
public:
// types
typedef _RealType input_type;
typedef _IntType result_type;
// constructors and member function
explicit
poisson_distribution(const _RealType& __mean = _RealType(1))
: _M_mean(__mean), _M_nd()
{
_GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);
_M_initialize();
}
/**
* Gets the distribution parameter @p mean.
*/
_RealType
mean() const
{ return _M_mean; }
void
reset()
{ _M_nd.reset(); }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng);
/**
* Inserts a %poisson_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %poisson_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _IntType1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const poisson_distribution<_IntType1, _RealType1>& __x);
/**
* Extracts a %poisson_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %poisson_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _IntType1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
poisson_distribution<_IntType1, _RealType1>& __x);
private:
void
_M_initialize();
// NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
normal_distribution<_RealType> _M_nd;
_RealType _M_mean;
// Hosts either log(mean) or the threshold of the simple method.
_RealType _M_lm_thr;
#if _GLIBCXX_USE_C99_MATH_TR1
_RealType _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
#endif
};
/**
* @brief A discrete binomial random number distribution.
*
* The formula for the binomial probability mass function is
* @f$ p(i) = \binom{n}{i} p^i (1 - p)^{t - i} @f$ where @f$ t @f$
* and @f$ p @f$ are the parameters of the distribution.
*/
template<typename _IntType = int, typename _RealType = double>
class binomial_distribution
{
public:
// types
typedef _RealType input_type;
typedef _IntType result_type;
// constructors and member function
explicit
binomial_distribution(_IntType __t = 1,
const _RealType& __p = _RealType(0.5))
: _M_t(__t), _M_p(__p), _M_nd()
{
_GLIBCXX_DEBUG_ASSERT((_M_t >= 0) && (_M_p >= 0.0) && (_M_p <= 1.0));
_M_initialize();
}
/**
* Gets the distribution @p t parameter.
*/
_IntType
t() const
{ return _M_t; }
/**
* Gets the distribution @p p parameter.
*/
_RealType
p() const
{ return _M_p; }
void
reset()
{ _M_nd.reset(); }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng);
/**
* Inserts a %binomial_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %binomial_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _IntType1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const binomial_distribution<_IntType1, _RealType1>& __x);
/**
* Extracts a %binomial_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %binomial_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _IntType1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
binomial_distribution<_IntType1, _RealType1>& __x);
private:
void
_M_initialize();
template<class _UniformRandomNumberGenerator>
result_type
_M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t);
// NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
normal_distribution<_RealType> _M_nd;
_RealType _M_q;
#if _GLIBCXX_USE_C99_MATH_TR1
_RealType _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
_M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
#endif
_RealType _M_p;
_IntType _M_t;
bool _M_easy;
};
/* @} */ // group tr1_random_distributions_discrete
/**
* @addtogroup tr1_random_distributions_continuous Continuous Distributions
* @ingroup tr1_random_distributions
* @{
*/
/**
* @brief Uniform continuous distribution for random numbers.
*
* A continuous random distribution on the range [min, max) with equal
* probability throughout the range. The URNG should be real-valued and
* deliver number in the range [0, 1).
*/
template<typename _RealType = double>
class uniform_real
{
public:
// types
typedef _RealType input_type;
typedef _RealType result_type;
public:
/**
* Constructs a uniform_real object.
*
* @param __min [IN] The lower bound of the distribution.
* @param __max [IN] The upper bound of the distribution.
*/
explicit
uniform_real(_RealType __min = _RealType(0),
_RealType __max = _RealType(1))
: _M_min(__min), _M_max(__max)
{
_GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max);
}
result_type
min() const
{ return _M_min; }
result_type
max() const
{ return _M_max; }
void
reset() { }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return (__urng() * (_M_max - _M_min)) + _M_min; }
/**
* Inserts a %uniform_real random number distribution @p __x into the
* output stream @p __os.
*
* @param __os An output stream.
* @param __x A %uniform_real random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const uniform_real<_RealType1>& __x);
/**
* Extracts a %uniform_real random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %uniform_real random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
uniform_real<_RealType1>& __x);
private:
_RealType _M_min;
_RealType _M_max;
};
/**
* @brief An exponential continuous distribution for random numbers.
*
* The formula for the exponential probability mass function is
* @f$ p(x) = \lambda e^{-\lambda x} @f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$ \frac{1}{\lambda} @f$</td></tr>
* <tr><td>Median</td><td>@f$ \frac{\ln 2}{\lambda} @f$</td></tr>
* <tr><td>Mode</td><td>@f$ zero @f$</td></tr>
* <tr><td>Range</td><td>@f$[0, \infty]@f$</td></tr>
* <tr><td>Standard Deviation</td><td>@f$ \frac{1}{\lambda} @f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class exponential_distribution
{
public:
// types
typedef _RealType input_type;
typedef _RealType result_type;
public:
/**
* Constructs an exponential distribution with inverse scale parameter
* @f$ \lambda @f$.
*/
explicit
exponential_distribution(const result_type& __lambda = result_type(1))
: _M_lambda(__lambda)
{
_GLIBCXX_DEBUG_ASSERT(_M_lambda > 0);
}
/**
* Gets the inverse scale parameter of the distribution.
*/
_RealType
lambda() const
{ return _M_lambda; }
/**
* Resets the distribution.
*
* Has no effect on exponential distributions.
*/
void
reset() { }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return -std::log(__urng()) / _M_lambda; }
/**
* Inserts a %exponential_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %exponential_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const exponential_distribution<_RealType1>& __x);
/**
* Extracts a %exponential_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %exponential_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
exponential_distribution& __x)
{ return __is >> __x._M_lambda; }
private:
result_type _M_lambda;
};
/**
* @brief A normal continuous distribution for random numbers.
*
* The formula for the normal probability mass function is
* @f$ p(x) = \frac{1}{\sigma \sqrt{2 \pi}}
* e^{- \frac{{x - mean}^ {2}}{2 \sigma ^ {2}} } @f$.
*/
template<typename _RealType = double>
class normal_distribution
{
public:
// types
typedef _RealType input_type;
typedef _RealType result_type;
public:
/**
* Constructs a normal distribution with parameters @f$ mean @f$ and
* @f$ \sigma @f$.
*/
explicit
normal_distribution(const result_type& __mean = result_type(0),
const result_type& __sigma = result_type(1))
: _M_mean(__mean), _M_sigma(__sigma), _M_saved_available(false)
{
_GLIBCXX_DEBUG_ASSERT(_M_sigma > 0);
}
/**
* Gets the mean of the distribution.
*/
_RealType
mean() const
{ return _M_mean; }
/**
* Gets the @f$ \sigma @f$ of the distribution.
*/
_RealType
sigma() const
{ return _M_sigma; }
/**
* Resets the distribution.
*/
void
reset()
{ _M_saved_available = false; }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng);
/**
* Inserts a %normal_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %normal_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const normal_distribution<_RealType1>& __x);
/**
* Extracts a %normal_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %normal_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
normal_distribution<_RealType1>& __x);
private:
result_type _M_mean;
result_type _M_sigma;
result_type _M_saved;
bool _M_saved_available;
};
/**
* @brief A gamma continuous distribution for random numbers.
*
* The formula for the gamma probability mass function is
* @f$ p(x) = \frac{1}{\Gamma(\alpha)} x^{\alpha - 1} e^{-x} @f$.
*/
template<typename _RealType = double>
class gamma_distribution
{
public:
// types
typedef _RealType input_type;
typedef _RealType result_type;
public:
/**
* Constructs a gamma distribution with parameters @f$ \alpha @f$.
*/
explicit
gamma_distribution(const result_type& __alpha_val = result_type(1))
: _M_alpha(__alpha_val)
{
_GLIBCXX_DEBUG_ASSERT(_M_alpha > 0);
_M_initialize();
}
/**
* Gets the @f$ \alpha @f$ of the distribution.
*/
_RealType
alpha() const
{ return _M_alpha; }
/**
* Resets the distribution.
*/
void
reset() { }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng);
/**
* Inserts a %gamma_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %gamma_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const gamma_distribution<_RealType1>& __x);
/**
* Extracts a %gamma_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %gamma_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
gamma_distribution& __x)
{
__is >> __x._M_alpha;
__x._M_initialize();
return __is;
}
private:
void
_M_initialize();
result_type _M_alpha;
// Hosts either lambda of GB or d of modified Vaduva's.
result_type _M_l_d;
};
/* @} */ // group tr1_random_distributions_continuous
/* @} */ // group tr1_random_distributions
/* @} */ // group tr1_random
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_RANDOM_H
// TR1 cctype -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cctype
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CCTYPE
#define _GLIBCXX_TR1_CCTYPE 1
#include <bits/c++config.h>
#include <cctype>
#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
#undef isblank
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
using ::isblank;
}
}
#endif
#endif // _GLIBCXX_TR1_CCTYPE
// TR1 cstdarg -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cstdarg
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CSTDARG
#define _GLIBCXX_TR1_CSTDARG 1
#include <cstdarg>
#endif // _GLIBCXX_TR1_CSTDARG
// TR1 cfloat -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cfloat
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CFLOAT
#define _GLIBCXX_TR1_CFLOAT 1
#include <cfloat>
#ifndef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__
#endif
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#endif //_GLIBCXX_TR1_CFLOAT
// TR1 limits.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/limits.h
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_LIMITS_H
#define _TR1_LIMITS_H 1
#include <tr1/climits>
#endif
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/bessel_function.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland.
//
// References:
// (1) Handbook of Mathematical Functions,
// ed. Milton Abramowitz and Irene A. Stegun,
// Dover Publications,
// Section 9, pp. 355-434, Section 10 pp. 435-478
// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
// 2nd ed, pp. 240-245
#ifndef _GLIBCXX_TR1_BESSEL_FUNCTION_TCC
#define _GLIBCXX_TR1_BESSEL_FUNCTION_TCC 1
#include "special_function_util.h"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
# define _GLIBCXX_MATH_NS ::std::tr1
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
// [5.2] Special functions
// Implementation-space details.
namespace __detail
{
/**
* @brief Compute the gamma functions required by the Temme series
* expansions of @f$ N_\nu(x) @f$ and @f$ K_\nu(x) @f$.
* @f[
* \Gamma_1 = \frac{1}{2\mu}
* [\frac{1}{\Gamma(1 - \mu)} - \frac{1}{\Gamma(1 + \mu)}]
* @f]
* and
* @f[
* \Gamma_2 = \frac{1}{2}
* [\frac{1}{\Gamma(1 - \mu)} + \frac{1}{\Gamma(1 + \mu)}]
* @f]
* where @f$ -1/2 <= \mu <= 1/2 @f$ is @f$ \mu = \nu - N @f$ and @f$ N @f$.
* is the nearest integer to @f$ \nu @f$.
* The values of \f$ \Gamma(1 + \mu) \f$ and \f$ \Gamma(1 - \mu) \f$
* are returned as well.
*
* The accuracy requirements on this are exquisite.
*
* @param __mu The input parameter of the gamma functions.
* @param __gam1 The output function \f$ \Gamma_1(\mu) \f$
* @param __gam2 The output function \f$ \Gamma_2(\mu) \f$
* @param __gampl The output function \f$ \Gamma(1 + \mu) \f$
* @param __gammi The output function \f$ \Gamma(1 - \mu) \f$
*/
template <typename _Tp>
void
__gamma_temme(_Tp __mu,
_Tp & __gam1, _Tp & __gam2, _Tp & __gampl, _Tp & __gammi)
{
#if _GLIBCXX_USE_C99_MATH_TR1
__gampl = _Tp(1) / _GLIBCXX_MATH_NS::tgamma(_Tp(1) + __mu);
__gammi = _Tp(1) / _GLIBCXX_MATH_NS::tgamma(_Tp(1) - __mu);
#else
__gampl = _Tp(1) / __gamma(_Tp(1) + __mu);
__gammi = _Tp(1) / __gamma(_Tp(1) - __mu);
#endif
if (std::abs(__mu) < std::numeric_limits<_Tp>::epsilon())
__gam1 = -_Tp(__numeric_constants<_Tp>::__gamma_e());
else
__gam1 = (__gammi - __gampl) / (_Tp(2) * __mu);
__gam2 = (__gammi + __gampl) / (_Tp(2));
return;
}
/**
* @brief Compute the Bessel @f$ J_\nu(x) @f$ and Neumann
* @f$ N_\nu(x) @f$ functions and their first derivatives
* @f$ J'_\nu(x) @f$ and @f$ N'_\nu(x) @f$ respectively.
* These four functions are computed together for numerical
* stability.
*
* @param __nu The order of the Bessel functions.
* @param __x The argument of the Bessel functions.
* @param __Jnu The output Bessel function of the first kind.
* @param __Nnu The output Neumann function (Bessel function of the second kind).
* @param __Jpnu The output derivative of the Bessel function of the first kind.
* @param __Npnu The output derivative of the Neumann function.
*/
template <typename _Tp>
void
__bessel_jn(_Tp __nu, _Tp __x,
_Tp & __Jnu, _Tp & __Nnu, _Tp & __Jpnu, _Tp & __Npnu)
{
if (__x == _Tp(0))
{
if (__nu == _Tp(0))
{
__Jnu = _Tp(1);
__Jpnu = _Tp(0);
}
else if (__nu == _Tp(1))
{
__Jnu = _Tp(0);
__Jpnu = _Tp(0.5L);
}
else
{
__Jnu = _Tp(0);
__Jpnu = _Tp(0);
}
__Nnu = -std::numeric_limits<_Tp>::infinity();
__Npnu = std::numeric_limits<_Tp>::infinity();
return;
}
const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
// When the multiplier is N i.e.
// fp_min = N * min()
// Then J_0 and N_0 tank at x = 8 * N (J_0 = 0 and N_0 = nan)!
//const _Tp __fp_min = _Tp(20) * std::numeric_limits<_Tp>::min();
const _Tp __fp_min = std::sqrt(std::numeric_limits<_Tp>::min());
const int __max_iter = 15000;
const _Tp __x_min = _Tp(2);
const int __nl = (__x < __x_min
? static_cast<int>(__nu + _Tp(0.5L))
: std::max(0, static_cast<int>(__nu - __x + _Tp(1.5L))));
const _Tp __mu = __nu - __nl;
const _Tp __mu2 = __mu * __mu;
const _Tp __xi = _Tp(1) / __x;
const _Tp __xi2 = _Tp(2) * __xi;
_Tp __w = __xi2 / __numeric_constants<_Tp>::__pi();
int __isign = 1;
_Tp __h = __nu * __xi;
if (__h < __fp_min)
__h = __fp_min;
_Tp __b = __xi2 * __nu;
_Tp __d = _Tp(0);
_Tp __c = __h;
int __i;
for (__i = 1; __i <= __max_iter; ++__i)
{
__b += __xi2;
__d = __b - __d;
if (std::abs(__d) < __fp_min)
__d = __fp_min;
__c = __b - _Tp(1) / __c;
if (std::abs(__c) < __fp_min)
__c = __fp_min;
__d = _Tp(1) / __d;
const _Tp __del = __c * __d;
__h *= __del;
if (__d < _Tp(0))
__isign = -__isign;
if (std::abs(__del - _Tp(1)) < __eps)
break;
}
if (__i > __max_iter)
std::__throw_runtime_error(__N("Argument x too large in __bessel_jn; "
"try asymptotic expansion."));
_Tp __Jnul = __isign * __fp_min;
_Tp __Jpnul = __h * __Jnul;
_Tp __Jnul1 = __Jnul;
_Tp __Jpnu1 = __Jpnul;
_Tp __fact = __nu * __xi;
for ( int __l = __nl; __l >= 1; --__l )
{
const _Tp __Jnutemp = __fact * __Jnul + __Jpnul;
__fact -= __xi;
__Jpnul = __fact * __Jnutemp - __Jnul;
__Jnul = __Jnutemp;
}
if (__Jnul == _Tp(0))
__Jnul = __eps;
_Tp __f= __Jpnul / __Jnul;
_Tp __Nmu, __Nnu1, __Npmu, __Jmu;
if (__x < __x_min)
{
const _Tp __x2 = __x / _Tp(2);
const _Tp __pimu = __numeric_constants<_Tp>::__pi() * __mu;
_Tp __fact = (std::abs(__pimu) < __eps
? _Tp(1) : __pimu / std::sin(__pimu));
_Tp __d = -std::log(__x2);
_Tp __e = __mu * __d;
_Tp __fact2 = (std::abs(__e) < __eps
? _Tp(1) : std::sinh(__e) / __e);
_Tp __gam1, __gam2, __gampl, __gammi;
__gamma_temme(__mu, __gam1, __gam2, __gampl, __gammi);
_Tp __ff = (_Tp(2) / __numeric_constants<_Tp>::__pi())
* __fact * (__gam1 * std::cosh(__e) + __gam2 * __fact2 * __d);
__e = std::exp(__e);
_Tp __p = __e / (__numeric_constants<_Tp>::__pi() * __gampl);
_Tp __q = _Tp(1) / (__e * __numeric_constants<_Tp>::__pi() * __gammi);
const _Tp __pimu2 = __pimu / _Tp(2);
_Tp __fact3 = (std::abs(__pimu2) < __eps
? _Tp(1) : std::sin(__pimu2) / __pimu2 );
_Tp __r = __numeric_constants<_Tp>::__pi() * __pimu2 * __fact3 * __fact3;
_Tp __c = _Tp(1);
__d = -__x2 * __x2;
_Tp __sum = __ff + __r * __q;
_Tp __sum1 = __p;
for (__i = 1; __i <= __max_iter; ++__i)
{
__ff = (__i * __ff + __p + __q) / (__i * __i - __mu2);
__c *= __d / _Tp(__i);
__p /= _Tp(__i) - __mu;
__q /= _Tp(__i) + __mu;
const _Tp __del = __c * (__ff + __r * __q);
__sum += __del;
const _Tp __del1 = __c * __p - __i * __del;
__sum1 += __del1;
if ( std::abs(__del) < __eps * (_Tp(1) + std::abs(__sum)) )
break;
}
if ( __i > __max_iter )
std::__throw_runtime_error(__N("Bessel y series failed to converge "
"in __bessel_jn."));
__Nmu = -__sum;
__Nnu1 = -__sum1 * __xi2;
__Npmu = __mu * __xi * __Nmu - __Nnu1;
__Jmu = __w / (__Npmu - __f * __Nmu);
}
else
{
_Tp __a = _Tp(0.25L) - __mu2;
_Tp __q = _Tp(1);
_Tp __p = -__xi / _Tp(2);
_Tp __br = _Tp(2) * __x;
_Tp __bi = _Tp(2);
_Tp __fact = __a * __xi / (__p * __p + __q * __q);
_Tp __cr = __br + __q * __fact;
_Tp __ci = __bi + __p * __fact;
_Tp __den = __br * __br + __bi * __bi;
_Tp __dr = __br / __den;
_Tp __di = -__bi / __den;
_Tp __dlr = __cr * __dr - __ci * __di;
_Tp __dli = __cr * __di + __ci * __dr;
_Tp __temp = __p * __dlr - __q * __dli;
__q = __p * __dli + __q * __dlr;
__p = __temp;
int __i;
for (__i = 2; __i <= __max_iter; ++__i)
{
__a += _Tp(2 * (__i - 1));
__bi += _Tp(2);
__dr = __a * __dr + __br;
__di = __a * __di + __bi;
if (std::abs(__dr) + std::abs(__di) < __fp_min)
__dr = __fp_min;
__fact = __a / (__cr * __cr + __ci * __ci);
__cr = __br + __cr * __fact;
__ci = __bi - __ci * __fact;
if (std::abs(__cr) + std::abs(__ci) < __fp_min)
__cr = __fp_min;
__den = __dr * __dr + __di * __di;
__dr /= __den;
__di /= -__den;
__dlr = __cr * __dr - __ci * __di;
__dli = __cr * __di + __ci * __dr;
__temp = __p * __dlr - __q * __dli;
__q = __p * __dli + __q * __dlr;
__p = __temp;
if (std::abs(__dlr - _Tp(1)) + std::abs(__dli) < __eps)
break;
}
if (__i > __max_iter)
std::__throw_runtime_error(__N("Lentz's method failed "
"in __bessel_jn."));
const _Tp __gam = (__p - __f) / __q;
__Jmu = std::sqrt(__w / ((__p - __f) * __gam + __q));
#if _GLIBCXX_USE_C99_MATH_TR1
__Jmu = _GLIBCXX_MATH_NS::copysign(__Jmu, __Jnul);
#else
if (__Jmu * __Jnul < _Tp(0))
__Jmu = -__Jmu;
#endif
__Nmu = __gam * __Jmu;
__Npmu = (__p + __q / __gam) * __Nmu;
__Nnu1 = __mu * __xi * __Nmu - __Npmu;
}
__fact = __Jmu / __Jnul;
__Jnu = __fact * __Jnul1;
__Jpnu = __fact * __Jpnu1;
for (__i = 1; __i <= __nl; ++__i)
{
const _Tp __Nnutemp = (__mu + __i) * __xi2 * __Nnu1 - __Nmu;
__Nmu = __Nnu1;
__Nnu1 = __Nnutemp;
}
__Nnu = __Nmu;
__Npnu = __nu * __xi * __Nmu - __Nnu1;
return;
}
/**
* @brief This routine computes the asymptotic cylindrical Bessel
* and Neumann functions of order nu: \f$ J_{\nu} \f$,
* \f$ N_{\nu} \f$.
*
* References:
* (1) Handbook of Mathematical Functions,
* ed. Milton Abramowitz and Irene A. Stegun,
* Dover Publications,
* Section 9 p. 364, Equations 9.2.5-9.2.10
*
* @param __nu The order of the Bessel functions.
* @param __x The argument of the Bessel functions.
* @param __Jnu The output Bessel function of the first kind.
* @param __Nnu The output Neumann function (Bessel function of the second kind).
*/
template <typename _Tp>
void
__cyl_bessel_jn_asymp(_Tp __nu, _Tp __x, _Tp & __Jnu, _Tp & __Nnu)
{
const _Tp __mu = _Tp(4) * __nu * __nu;
const _Tp __mum1 = __mu - _Tp(1);
const _Tp __mum9 = __mu - _Tp(9);
const _Tp __mum25 = __mu - _Tp(25);
const _Tp __mum49 = __mu - _Tp(49);
const _Tp __xx = _Tp(64) * __x * __x;
const _Tp __P = _Tp(1) - __mum1 * __mum9 / (_Tp(2) * __xx)
* (_Tp(1) - __mum25 * __mum49 / (_Tp(12) * __xx));
const _Tp __Q = __mum1 / (_Tp(8) * __x)
* (_Tp(1) - __mum9 * __mum25 / (_Tp(6) * __xx));
const _Tp __chi = __x - (__nu + _Tp(0.5L))
* __numeric_constants<_Tp>::__pi_2();
const _Tp __c = std::cos(__chi);
const _Tp __s = std::sin(__chi);
const _Tp __coef = std::sqrt(_Tp(2)
/ (__numeric_constants<_Tp>::__pi() * __x));
__Jnu = __coef * (__c * __P - __s * __Q);
__Nnu = __coef * (__s * __P + __c * __Q);
return;
}
/**
* @brief This routine returns the cylindrical Bessel functions
* of order \f$ \nu \f$: \f$ J_{\nu} \f$ or \f$ I_{\nu} \f$
* by series expansion.
*
* The modified cylindrical Bessel function is:
* @f[
* Z_{\nu}(x) = \sum_{k=0}^{\infty}
* \frac{\sigma^k (x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)}
* @f]
* where \f$ \sigma = +1 \f$ or\f$ -1 \f$ for
* \f$ Z = I \f$ or \f$ J \f$ respectively.
*
* See Abramowitz & Stegun, 9.1.10
* Abramowitz & Stegun, 9.6.7
* (1) Handbook of Mathematical Functions,
* ed. Milton Abramowitz and Irene A. Stegun,
* Dover Publications,
* Equation 9.1.10 p. 360 and Equation 9.6.10 p. 375
*
* @param __nu The order of the Bessel function.
* @param __x The argument of the Bessel function.
* @param __sgn The sign of the alternate terms
* -1 for the Bessel function of the first kind.
* +1 for the modified Bessel function of the first kind.
* @return The output Bessel function.
*/
template <typename _Tp>
_Tp
__cyl_bessel_ij_series(_Tp __nu, _Tp __x, _Tp __sgn,
unsigned int __max_iter)
{
if (__x == _Tp(0))
return __nu == _Tp(0) ? _Tp(1) : _Tp(0);
const _Tp __x2 = __x / _Tp(2);
_Tp __fact = __nu * std::log(__x2);
#if _GLIBCXX_USE_C99_MATH_TR1
__fact -= _GLIBCXX_MATH_NS::lgamma(__nu + _Tp(1));
#else
__fact -= __log_gamma(__nu + _Tp(1));
#endif
__fact = std::exp(__fact);
const _Tp __xx4 = __sgn * __x2 * __x2;
_Tp __Jn = _Tp(1);
_Tp __term = _Tp(1);
for (unsigned int __i = 1; __i < __max_iter; ++__i)
{
__term *= __xx4 / (_Tp(__i) * (__nu + _Tp(__i)));
__Jn += __term;
if (std::abs(__term / __Jn) < std::numeric_limits<_Tp>::epsilon())
break;
}
return __fact * __Jn;
}
/**
* @brief Return the Bessel function of order \f$ \nu \f$:
* \f$ J_{\nu}(x) \f$.
*
* The cylindrical Bessel function is:
* @f[
* J_{\nu}(x) = \sum_{k=0}^{\infty}
* \frac{(-1)^k (x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)}
* @f]
*
* @param __nu The order of the Bessel function.
* @param __x The argument of the Bessel function.
* @return The output Bessel function.
*/
template<typename _Tp>
_Tp
__cyl_bessel_j(_Tp __nu, _Tp __x)
{
if (__nu < _Tp(0) || __x < _Tp(0))
std::__throw_domain_error(__N("Bad argument "
"in __cyl_bessel_j."));
else if (__isnan(__nu) || __isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x * __x < _Tp(10) * (__nu + _Tp(1)))
return __cyl_bessel_ij_series(__nu, __x, -_Tp(1), 200);
else if (__x > _Tp(1000))
{
_Tp __J_nu, __N_nu;
__cyl_bessel_jn_asymp(__nu, __x, __J_nu, __N_nu);
return __J_nu;
}
else
{
_Tp __J_nu, __N_nu, __Jp_nu, __Np_nu;
__bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu);
return __J_nu;
}
}
/**
* @brief Return the Neumann function of order \f$ \nu \f$:
* \f$ N_{\nu}(x) \f$.
*
* The Neumann function is defined by:
* @f[
* N_{\nu}(x) = \frac{J_{\nu}(x) \cos \nu\pi - J_{-\nu}(x)}
* {\sin \nu\pi}
* @f]
* where for integral \f$ \nu = n \f$ a limit is taken:
* \f$ lim_{\nu \to n} \f$.
*
* @param __nu The order of the Neumann function.
* @param __x The argument of the Neumann function.
* @return The output Neumann function.
*/
template<typename _Tp>
_Tp
__cyl_neumann_n(_Tp __nu, _Tp __x)
{
if (__nu < _Tp(0) || __x < _Tp(0))
std::__throw_domain_error(__N("Bad argument "
"in __cyl_neumann_n."));
else if (__isnan(__nu) || __isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x > _Tp(1000))
{
_Tp __J_nu, __N_nu;
__cyl_bessel_jn_asymp(__nu, __x, __J_nu, __N_nu);
return __N_nu;
}
else
{
_Tp __J_nu, __N_nu, __Jp_nu, __Np_nu;
__bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu);
return __N_nu;
}
}
/**
* @brief Compute the spherical Bessel @f$ j_n(x) @f$
* and Neumann @f$ n_n(x) @f$ functions and their first
* derivatives @f$ j'_n(x) @f$ and @f$ n'_n(x) @f$
* respectively.
*
* @param __n The order of the spherical Bessel function.
* @param __x The argument of the spherical Bessel function.
* @param __j_n The output spherical Bessel function.
* @param __n_n The output spherical Neumann function.
* @param __jp_n The output derivative of the spherical Bessel function.
* @param __np_n The output derivative of the spherical Neumann function.
*/
template <typename _Tp>
void
__sph_bessel_jn(unsigned int __n, _Tp __x,
_Tp & __j_n, _Tp & __n_n, _Tp & __jp_n, _Tp & __np_n)
{
const _Tp __nu = _Tp(__n) + _Tp(0.5L);
_Tp __J_nu, __N_nu, __Jp_nu, __Np_nu;
__bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu);
const _Tp __factor = __numeric_constants<_Tp>::__sqrtpio2()
/ std::sqrt(__x);
__j_n = __factor * __J_nu;
__n_n = __factor * __N_nu;
__jp_n = __factor * __Jp_nu - __j_n / (_Tp(2) * __x);
__np_n = __factor * __Np_nu - __n_n / (_Tp(2) * __x);
return;
}
/**
* @brief Return the spherical Bessel function
* @f$ j_n(x) @f$ of order n.
*
* The spherical Bessel function is defined by:
* @f[
* j_n(x) = \left( \frac{\pi}{2x} \right) ^{1/2} J_{n+1/2}(x)
* @f]
*
* @param __n The order of the spherical Bessel function.
* @param __x The argument of the spherical Bessel function.
* @return The output spherical Bessel function.
*/
template <typename _Tp>
_Tp
__sph_bessel(unsigned int __n, _Tp __x)
{
if (__x < _Tp(0))
std::__throw_domain_error(__N("Bad argument "
"in __sph_bessel."));
else if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x == _Tp(0))
{
if (__n == 0)
return _Tp(1);
else
return _Tp(0);
}
else
{
_Tp __j_n, __n_n, __jp_n, __np_n;
__sph_bessel_jn(__n, __x, __j_n, __n_n, __jp_n, __np_n);
return __j_n;
}
}
/**
* @brief Return the spherical Neumann function
* @f$ n_n(x) @f$.
*
* The spherical Neumann function is defined by:
* @f[
* n_n(x) = \left( \frac{\pi}{2x} \right) ^{1/2} N_{n+1/2}(x)
* @f]
*
* @param __n The order of the spherical Neumann function.
* @param __x The argument of the spherical Neumann function.
* @return The output spherical Neumann function.
*/
template <typename _Tp>
_Tp
__sph_neumann(unsigned int __n, _Tp __x)
{
if (__x < _Tp(0))
std::__throw_domain_error(__N("Bad argument "
"in __sph_neumann."));
else if (__isnan(__x))
return std::numeric_limits<_Tp>::quiet_NaN();
else if (__x == _Tp(0))
return -std::numeric_limits<_Tp>::infinity();
else
{
_Tp __j_n, __n_n, __jp_n, __np_n;
__sph_bessel_jn(__n, __x, __j_n, __n_n, __jp_n, __np_n);
return __n_n;
}
}
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_BESSEL_FUNCTION_TCC
// Special functions -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/special_function_util.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{tr1/cmath}
*/
//
// ISO C++ 14882 TR1: 5.2 Special functions
//
// Written by Edward Smith-Rowland based on numerous mathematics books.
#ifndef _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H
#define _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H 1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
#else
# error do not include this header directly, use <cmath> or <tr1/cmath>
#endif
namespace __detail
{
/// A class to encapsulate type dependent floating point
/// constants. Not everything will be able to be expressed as
/// type logic.
template<typename _Tp>
struct __floating_point_constant
{
static const _Tp __value;
};
/// A structure for numeric constants.
template<typename _Tp>
struct __numeric_constants
{
/// Constant @f$ \pi @f$.
static _Tp __pi() throw()
{ return static_cast<_Tp>(3.1415926535897932384626433832795029L); }
/// Constant @f$ \pi / 2 @f$.
static _Tp __pi_2() throw()
{ return static_cast<_Tp>(1.5707963267948966192313216916397514L); }
/// Constant @f$ \pi / 3 @f$.
static _Tp __pi_3() throw()
{ return static_cast<_Tp>(1.0471975511965977461542144610931676L); }
/// Constant @f$ \pi / 4 @f$.
static _Tp __pi_4() throw()
{ return static_cast<_Tp>(0.7853981633974483096156608458198757L); }
/// Constant @f$ 1 / \pi @f$.
static _Tp __1_pi() throw()
{ return static_cast<_Tp>(0.3183098861837906715377675267450287L); }
/// Constant @f$ 2 / \sqrt(\pi) @f$.
static _Tp __2_sqrtpi() throw()
{ return static_cast<_Tp>(1.1283791670955125738961589031215452L); }
/// Constant @f$ \sqrt(2) @f$.
static _Tp __sqrt2() throw()
{ return static_cast<_Tp>(1.4142135623730950488016887242096981L); }
/// Constant @f$ \sqrt(3) @f$.
static _Tp __sqrt3() throw()
{ return static_cast<_Tp>(1.7320508075688772935274463415058723L); }
/// Constant @f$ \sqrt(\pi/2) @f$.
static _Tp __sqrtpio2() throw()
{ return static_cast<_Tp>(1.2533141373155002512078826424055226L); }
/// Constant @f$ 1 / sqrt(2) @f$.
static _Tp __sqrt1_2() throw()
{ return static_cast<_Tp>(0.7071067811865475244008443621048490L); }
/// Constant @f$ \log(\pi) @f$.
static _Tp __lnpi() throw()
{ return static_cast<_Tp>(1.1447298858494001741434273513530587L); }
/// Constant Euler's constant @f$ \gamma_E @f$.
static _Tp __gamma_e() throw()
{ return static_cast<_Tp>(0.5772156649015328606065120900824024L); }
/// Constant Euler-Mascheroni @f$ e @f$
static _Tp __euler() throw()
{ return static_cast<_Tp>(2.7182818284590452353602874713526625L); }
};
#if _GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
/// This is a wrapper for the isnan function. Otherwise, for NaN,
/// all comparisons result in false. If/when we build a std::isnan
/// out of intrinsics, this will disappear completely in favor of
/// std::isnan.
template<typename _Tp>
inline bool __isnan(_Tp __x)
{ return std::isnan(__x); }
#else
template<typename _Tp>
inline bool __isnan(const _Tp __x)
{ return __builtin_isnan(__x); }
template<>
inline bool __isnan<float>(float __x)
{ return __builtin_isnanf(__x); }
template<>
inline bool __isnan<long double>(long double __x)
{ return __builtin_isnanl(__x); }
#endif
} // namespace __detail
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H
// TR1 cstdbool -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cstdbool
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CSTDBOOL
#define _GLIBCXX_TR1_CSTDBOOL 1
#pragma GCC system_header
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#endif // _GLIBCXX_TR1_CSTDBOOL
// class template regex -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/**
* @file tr1/regex
* @author Stephen M. Webb <stephen.webb@bregmasoft.ca>
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_REGEX
#define _GLIBCXX_TR1_REGEX 1
#pragma GCC system_header
#include <algorithm>
#include <bitset>
#include <iterator>
#include <locale>
#include <stdexcept>
#include <string>
#include <vector>
#include <utility>
#include <sstream>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
/**
* @defgroup tr1_regex Regular Expressions
* A facility for performing regular expression pattern matching.
*/
//@{
/** @namespace std::regex_constants
* @brief ISO C++ 0x entities sub namespace for regex.
*/
namespace regex_constants
{
/**
* @name 5.1 Regular Expression Syntax Options
*/
//@{
enum __syntax_option
{
_S_icase,
_S_nosubs,
_S_optimize,
_S_collate,
_S_ECMAScript,
_S_basic,
_S_extended,
_S_awk,
_S_grep,
_S_egrep,
_S_syntax_last
};
/**
* @brief This is a bitmask type indicating how to interpret the regex.
*
* The @c syntax_option_type is implementation defined but it is valid to
* perform bitwise operations on these values and expect the right thing to
* happen.
*
* A valid value of type syntax_option_type shall have exactly one of the
* elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
* %set.
*/
typedef unsigned int syntax_option_type;
/**
* Specifies that the matching of regular expressions against a character
* sequence shall be performed without regard to case.
*/
static const syntax_option_type icase = 1 << _S_icase;
/**
* Specifies that when a regular expression is matched against a character
* container sequence, no sub-expression matches are to be stored in the
* supplied match_results structure.
*/
static const syntax_option_type nosubs = 1 << _S_nosubs;
/**
* Specifies that the regular expression engine should pay more attention to
* the speed with which regular expressions are matched, and less to the
* speed with which regular expression objects are constructed. Otherwise
* it has no detectable effect on the program output.
*/
static const syntax_option_type optimize = 1 << _S_optimize;
/**
* Specifies that character ranges of the form [a-b] should be locale
* sensitive.
*/
static const syntax_option_type collate = 1 << _S_collate;
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
* Language Specification, Standard Ecma-262, third edition, 1999], as
* modified in tr1 section [7.13]. This grammar is similar to that defined
* in the PERL scripting language but extended with elements found in the
* POSIX regular expression grammar.
*/
static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
* Portable Operating System Interface (POSIX), Base Definitions and
* Headers, Section 9, Regular Expressions [IEEE, Information Technology --
* Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
*/
static const syntax_option_type basic = 1 << _S_basic;
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
* Portable Operating System Interface (POSIX), Base Definitions and Headers,
* Section 9, Regular Expressions.
*/
static const syntax_option_type extended = 1 << _S_extended;
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
* identical to syntax_option_type extended, except that C-style escape
* sequences are supported. These sequences are:
* \\\\, \\a, \\b, \\f,
* \\n, \\r, \\t , \\v,
* \\', ', and \\ddd
* (where ddd is one, two, or three octal digits).
*/
static const syntax_option_type awk = 1 << _S_awk;
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
* identical to syntax_option_type basic, except that newlines are treated
* as whitespace.
*/
static const syntax_option_type grep = 1 << _S_grep;
/**
* Specifies that the grammar recognized by the regular expression engine is
* that used by POSIX utility grep when given the -E option in
* IEEE Std 1003.1-2001. This option is identical to syntax_option_type
* extended, except that newlines are treated as whitespace.
*/
static const syntax_option_type egrep = 1 << _S_egrep;
//@}
/**
* @name 5.2 Matching Rules
*
* Matching a regular expression against a sequence of characters [first,
* last) proceeds according to the rules of the grammar specified for the
* regular expression object, modified according to the effects listed
* below for any bitmask elements set.
*
*/
//@{
enum __match_flag
{
_S_not_bol,
_S_not_eol,
_S_not_bow,
_S_not_eow,
_S_any,
_S_not_null,
_S_continuous,
_S_prev_avail,
_S_sed,
_S_no_copy,
_S_first_only,
_S_match_flag_last
};
/**
* @brief This is a bitmask type indicating regex matching rules.
*
* The @c match_flag_type is implementation defined but it is valid to
* perform bitwise operations on these values and expect the right thing to
* happen.
*/
typedef std::bitset<_S_match_flag_last> match_flag_type;
/**
* The default matching rules.
*/
static const match_flag_type match_default = 0;
/**
* The first character in the sequence [first, last) is treated as though it
* is not at the beginning of a line, so the character (^) in the regular
* expression shall not match [first, first).
*/
static const match_flag_type match_not_bol = 1 << _S_not_bol;
/**
* The last character in the sequence [first, last) is treated as though it
* is not at the end of a line, so the character ($) in the regular
* expression shall not match [last, last).
*/
static const match_flag_type match_not_eol = 1 << _S_not_eol;
/**
* The expression \\b is not matched against the sub-sequence
* [first,first).
*/
static const match_flag_type match_not_bow = 1 << _S_not_bow;
/**
* The expression \\b should not be matched against the sub-sequence
* [last,last).
*/
static const match_flag_type match_not_eow = 1 << _S_not_eow;
/**
* If more than one match is possible then any match is an acceptable
* result.
*/
static const match_flag_type match_any = 1 << _S_any;
/**
* The expression does not match an empty sequence.
*/
static const match_flag_type match_not_null = 1 << _S_not_null;
/**
* The expression only matches a sub-sequence that begins at first .
*/
static const match_flag_type match_continuous = 1 << _S_continuous;
/**
* --first is a valid iterator position. When this flag is set then the
* flags match_not_bol and match_not_bow are ignored by the regular
* expression algorithms 7.11 and iterators 7.12.
*/
static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
/**
* When a regular expression match is to be replaced by a new string, the
* new string is constructed using the rules used by the ECMAScript replace
* function in ECMA- 262 [Ecma International, ECMAScript Language
* Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
* String.prototype.replace. In addition, during search and replace
* operations all non-overlapping occurrences of the regular expression
* are located and replaced, and sections of the input that did not match
* the expression are copied unchanged to the output string.
*
* Format strings (from ECMA-262 [15.5.4.11]):
* @li $$ The dollar-sign itself ($)
* @li $& The matched substring.
* @li $` The portion of @a string that precedes the matched substring.
* This would be match_results::prefix().
* @li $' The portion of @a string that follows the matched substring.
* This would be match_results::suffix().
* @li $n The nth capture, where n is in [1,9] and $n is not followed by a
* decimal digit. If n <= match_results::size() and the nth capture
* is undefined, use the empty string instead. If n >
* match_results::size(), the result is implementation-defined.
* @li $nn The nnth capture, where nn is a two-digit decimal number on
* [01, 99]. If nn <= match_results::size() and the nth capture is
* undefined, use the empty string instead. If
* nn > match_results::size(), the result is implementation-defined.
*/
static const match_flag_type format_default = 0;
/**
* When a regular expression match is to be replaced by a new string, the
* new string is constructed using the rules used by the POSIX sed utility
* in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
* Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
*/
static const match_flag_type format_sed = 1 << _S_sed;
/**
* During a search and replace operation, sections of the character
* container sequence being searched that do not match the regular
* expression shall not be copied to the output string.
*/
static const match_flag_type format_no_copy = 1 << _S_no_copy;
/**
* When specified during a search and replace operation, only the first
* occurrence of the regular expression shall be replaced.
*/
static const match_flag_type format_first_only = 1 << _S_first_only;
//@}
/**
* @name 5.3 Error Types
*/
//@{
enum error_type
{
_S_error_collate,
_S_error_ctype,
_S_error_escape,
_S_error_backref,
_S_error_brack,
_S_error_paren,
_S_error_brace,
_S_error_badbrace,
_S_error_range,
_S_error_space,
_S_error_badrepeat,
_S_error_complexity,
_S_error_stack,
_S_error_last
};
/** The expression contained an invalid collating element name. */
static const error_type error_collate(_S_error_collate);
/** The expression contained an invalid character class name. */
static const error_type error_ctype(_S_error_ctype);
/**
* The expression contained an invalid escaped character, or a trailing
* escape.
*/
static const error_type error_escape(_S_error_escape);
/** The expression contained an invalid back reference. */
static const error_type error_backref(_S_error_backref);
/** The expression contained mismatched [ and ]. */
static const error_type error_brack(_S_error_brack);
/** The expression contained mismatched ( and ). */
static const error_type error_paren(_S_error_paren);
/** The expression contained mismatched { and } */
static const error_type error_brace(_S_error_brace);
/** The expression contained an invalid range in a {} expression. */
static const error_type error_badbrace(_S_error_badbrace);
/**
* The expression contained an invalid character range,
* such as [b-a] in most encodings.
*/
static const error_type error_range(_S_error_range);
/**
* There was insufficient memory to convert the expression into a
* finite state machine.
*/
static const error_type error_space(_S_error_space);
/**
* One of <em>*?+{</em> was not preceded by a valid regular expression.
*/
static const error_type error_badrepeat(_S_error_badrepeat);
/**
* The complexity of an attempted match against a regular expression
* exceeded a pre-set level.
*/
static const error_type error_complexity(_S_error_complexity);
/**
* There was insufficient memory to determine whether the
* regular expression could match the specified character sequence.
*/
static const error_type error_stack(_S_error_stack);
//@}
}
// [7.8] Class regex_error
/**
* @brief A regular expression exception class.
* @ingroup exceptions
*
* The regular expression library throws objects of this class on error.
*/
class regex_error
: public std::runtime_error
{
public:
/**
* @brief Constructs a regex_error object.
*
* @param ecode the regex error code.
*/
explicit
regex_error(regex_constants::error_type __ecode)
: std::runtime_error("regex_error"), _M_code(__ecode)
{ }
/**
* @brief Gets the regex error code.
*
* @returns the regex error code.
*/
regex_constants::error_type
code() const
{ return _M_code; }
protected:
regex_constants::error_type _M_code;
};
// [7.7] Class regex_traits
/**
* @brief Describes aspects of a regular expression.
*
* A regular expression traits class that satisfies the requirements of tr1
* section [7.2].
*
* The class %regex is parameterized around a set of related types and
* functions used to complete the definition of its semantics. This class
* satisfies the requirements of such a traits class.
*/
template<typename _Ch_type>
struct regex_traits
{
public:
typedef _Ch_type char_type;
typedef std::basic_string<char_type> string_type;
typedef std::locale locale_type;
typedef std::ctype_base::mask char_class_type;
public:
/**
* @brief Constructs a default traits object.
*/
regex_traits()
{ }
/**
* @brief Gives the length of a C-style string starting at @p __p.
*
* @param __p a pointer to the start of a character sequence.
*
* @returns the number of characters between @p *__p and the first
* default-initialized value of type @p char_type. In other words, uses
* the C-string algorithm for determining the length of a sequence of
* characters.
*/
static std::size_t
length(const char_type* __p)
{ return string_type::traits_type::length(__p); }
/**
* @brief Performs the identity translation.
*
* @param c A character to the locale-specific character set.
*
* @returns c.
*/
char_type
translate(char_type __c) const
{ return __c; }
/**
* @brief Translates a character into a case-insensitive equivalent.
*
* @param c A character to the locale-specific character set.
*
* @returns the locale-specific lower-case equivalent of c.
* @throws std::bad_cast if the imbued locale does not support the ctype
* facet.
*/
char_type
translate_nocase(char_type __c) const
{
using std::ctype;
using std::use_facet;
return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
}
/**
* @brief Gets a sort key for a character sequence.
*
* @param first beginning of the character sequence.
* @param last one-past-the-end of the character sequence.
*
* Returns a sort key for the character sequence designated by the
* iterator range [F1, F2) such that if the character sequence [G1, G2)
* sorts before the character sequence [H1, H2) then
* v.transform(G1, G2) < v.transform(H1, H2).
*
* What this really does is provide a more efficient way to compare a
* string to multiple other strings in locales with fancy collation
* rules and equivalence classes.
*
* @returns a locale-specific sort key equivalent to the input range.
*
* @throws std::bad_cast if the current locale does not have a collate
* facet.
*/
template<typename _Fwd_iter>
string_type
transform(_Fwd_iter __first, _Fwd_iter __last) const
{
using std::collate;
using std::use_facet;
const collate<_Ch_type>& __c(use_facet<
collate<_Ch_type> >(_M_locale));
string_type __s(__first, __last);
return __c.transform(__s.data(), __s.data() + __s.size());
}
/**
* @brief Dunno.
*
* @param first beginning of the character sequence.
* @param last one-past-the-end of the character sequence.
*
* Effects: if typeid(use_facet<collate<_Ch_type> >) ==
* typeid(collate_byname<_Ch_type>) and the form of the sort key
* returned by collate_byname<_Ch_type>::transform(first, last) is known
* and can be converted into a primary sort key then returns that key,
* otherwise returns an empty string. WTF??
*
* @todo Implement this function.
*/
template<typename _Fwd_iter>
string_type
transform_primary(_Fwd_iter __first, _Fwd_iter __last) const;
/**
* @brief Gets a collation element by name.
*
* @param first beginning of the collation element name.
* @param last one-past-the-end of the collation element name.
*
* @returns a sequence of one or more characters that represents the
* collating element consisting of the character sequence designated by
* the iterator range [first, last). Returns an empty string if the
* character sequence is not a valid collating element.
*
* @todo Implement this function.
*/
template<typename _Fwd_iter>
string_type
lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const;
/**
* @brief Maps one or more characters to a named character
* classification.
*
* @param first beginning of the character sequence.
* @param last one-past-the-end of the character sequence.
*
* @returns an unspecified value that represents the character
* classification named by the character sequence designated by the
* iterator range [first, last). The value returned shall be independent
* of the case of the characters in the character sequence. If the name
* is not recognized then returns a value that compares equal to 0.
*
* At least the following names (or their wide-character equivalent) are
* supported.
* - d
* - w
* - s
* - alnum
* - alpha
* - blank
* - cntrl
* - digit
* - graph
* - lower
* - print
* - punct
* - space
* - upper
* - xdigit
*
* @todo Implement this function.
*/
template<typename _Fwd_iter>
char_class_type
lookup_classname(_Fwd_iter __first, _Fwd_iter __last) const;
/**
* @brief Determines if @p c is a member of an identified class.
*
* @param c a character.
* @param f a class type (as returned from lookup_classname).
*
* @returns true if the character @p c is a member of the classification
* represented by @p f, false otherwise.
*
* @throws std::bad_cast if the current locale does not have a ctype
* facet.
*/
bool
isctype(_Ch_type __c, char_class_type __f) const;
/**
* @brief Converts a digit to an int.
*
* @param ch a character representing a digit.
* @param radix the radix if the numeric conversion (limited to 8, 10,
* or 16).
*
* @returns the value represented by the digit ch in base radix if the
* character ch is a valid digit in base radix; otherwise returns -1.
*/
int
value(_Ch_type __ch, int __radix) const;
/**
* @brief Imbues the regex_traits object with a copy of a new locale.
*
* @param loc A locale.
*
* @returns a copy of the previous locale in use by the regex_traits
* object.
*
* @note Calling imbue with a different locale than the one currently in
* use invalidates all cached data held by *this.
*/
locale_type
imbue(locale_type __loc)
{
std::swap(_M_locale, __loc);
return __loc;
}
/**
* @brief Gets a copy of the current locale in use by the regex_traits
* object.
*/
locale_type
getloc() const
{ return _M_locale; }
protected:
locale_type _M_locale;
};
template<typename _Ch_type>
bool regex_traits<_Ch_type>::
isctype(_Ch_type __c, char_class_type __f) const
{
using std::ctype;
using std::use_facet;
const ctype<_Ch_type>& __ctype(use_facet<
ctype<_Ch_type> >(_M_locale));
if (__ctype.is(__c, __f))
return true;
#if 0
// special case of underscore in [[:w:]]
if (__c == __ctype.widen('_'))
{
const char* const __wb[] = "w";
char_class_type __wt = this->lookup_classname(__wb,
__wb + sizeof(__wb));
if (__f | __wt)
return true;
}
// special case of [[:space:]] in [[:blank:]]
if (__c == __ctype.isspace(__c))
{
const char* const __bb[] = "blank";
char_class_type __bt = this->lookup_classname(__bb,
__bb + sizeof(__bb));
if (__f | __bt)
return true;
}
#endif
return false;
}
template<typename _Ch_type>
int regex_traits<_Ch_type>::
value(_Ch_type __ch, int __radix) const
{
std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
int __v;
if (__radix == 8)
__is >> std::oct;
else if (__radix == 16)
__is >> std::hex;
__is >> __v;
return __is.fail() ? -1 : __v;
}
// [7.8] Class basic_regex
/**
* Objects of specializations of this class represent regular expressions
* constructed from sequences of character type @p _Ch_type.
*
* Storage for the regular expression is allocated and deallocated as
* necessary by the member functions of this class.
*/
template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
class basic_regex
{
public:
// types:
typedef _Ch_type value_type;
typedef regex_constants::syntax_option_type flag_type;
typedef typename _Rx_traits::locale_type locale_type;
typedef typename _Rx_traits::string_type string_type;
/**
* @name Constants
* tr1 [7.8.1] std [28.8.1]
*/
//@{
static const regex_constants::syntax_option_type icase
= regex_constants::icase;
static const regex_constants::syntax_option_type nosubs
= regex_constants::nosubs;
static const regex_constants::syntax_option_type optimize
= regex_constants::optimize;
static const regex_constants::syntax_option_type collate
= regex_constants::collate;
static const regex_constants::syntax_option_type ECMAScript
= regex_constants::ECMAScript;
static const regex_constants::syntax_option_type basic
= regex_constants::basic;
static const regex_constants::syntax_option_type extended
= regex_constants::extended;
static const regex_constants::syntax_option_type awk
= regex_constants::awk;
static const regex_constants::syntax_option_type grep
= regex_constants::grep;
static const regex_constants::syntax_option_type egrep
= regex_constants::egrep;
//@}
// [7.8.2] construct/copy/destroy
/**
* Constructs a basic regular expression that does not match any
* character sequence.
*/
basic_regex()
: _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0)
{ _M_compile(); }
/**
* @brief Constructs a basic regular expression from the sequence
* [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the
* flags in @p f.
*
* @param p A pointer to the start of a C-style null-terminated string
* containing a regular expression.
* @param f Flags indicating the syntax rules and options.
*
* @throws regex_error if @p p is not a valid regular expression.
*/
explicit
basic_regex(const _Ch_type* __p,
flag_type __f = regex_constants::ECMAScript)
: _M_flags(__f), _M_pattern(__p), _M_mark_count(0)
{ _M_compile(); }
/**
* @brief Constructs a basic regular expression from the sequence
* [p, p + len) interpreted according to the flags in @p f.
*
* @param p A pointer to the start of a string containing a regular
* expression.
* @param len The length of the string containing the regular expression.
* @param f Flags indicating the syntax rules and options.
*
* @throws regex_error if @p p is not a valid regular expression.
*/
basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
: _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0)
{ _M_compile(); }
/**
* @brief Copy-constructs a basic regular expression.
*
* @param rhs A @p regex object.
*/
basic_regex(const basic_regex& __rhs)
: _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern),
_M_mark_count(__rhs._M_mark_count)
{ _M_compile(); }
/**
* @brief Constructs a basic regular expression from the string
* @p s interpreted according to the flags in @p f.
*
* @param s A string containing a regular expression.
* @param f Flags indicating the syntax rules and options.
*
* @throws regex_error if @p s is not a valid regular expression.
*/
template<typename _Ch_traits, typename _Ch_alloc>
explicit
basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
flag_type __f = regex_constants::ECMAScript)
: _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
{ _M_compile(); }
/**
* @brief Constructs a basic regular expression from the range
* [first, last) interpreted according to the flags in @p f.
*
* @param first The start of a range containing a valid regular
* expression.
* @param last The end of a range containing a valid regular
* expression.
* @param f The format flags of the regular expression.
*
* @throws regex_error if @p [first, last) is not a valid regular
* expression.
*/
template<typename _InputIterator>
basic_regex(_InputIterator __first, _InputIterator __last,
flag_type __f = regex_constants::ECMAScript)
: _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
{ _M_compile(); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX11
/**
* @brief Constructs a basic regular expression from an initializer list.
*
* @param l The initializer list.
* @param f The format flags of the regular expression.
*
* @throws regex_error if @p l is not a valid regular expression.
*/
basic_regex(initializer_list<_Ch_type> __l,
flag_type __f = regex_constants::ECMAScript)
: _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
{ _M_compile(); }
#endif
/**
* @brief Destroys a basic regular expression.
*/
~basic_regex()
{ }
/**
* @brief Assigns one regular expression to another.
*/
basic_regex&
operator=(const basic_regex& __rhs)
{ return this->assign(__rhs); }
/**
* @brief Replaces a regular expression with a new one constructed from
* a C-style null-terminated string.
*
* @param A pointer to the start of a null-terminated C-style string
* containing a regular expression.
*/
basic_regex&
operator=(const _Ch_type* __p)
{ return this->assign(__p, flags()); }
/**
* @brief Replaces a regular expression with a new one constructed from
* a string.
*
* @param A pointer to a string containing a regular expression.
*/
template<typename _Ch_typeraits, typename _Allocator>
basic_regex&
operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
{ return this->assign(__s, flags()); }
// [7.8.3] assign
/**
* @brief the real assignment operator.
*
* @param that Another regular expression object.
*/
basic_regex&
assign(const basic_regex& __that)
{
basic_regex __tmp(__that);
this->swap(__tmp);
return *this;
}
/**
* @brief Assigns a new regular expression to a regex object from a
* C-style null-terminated string containing a regular expression
* pattern.
*
* @param p A pointer to a C-style null-terminated string containing
* a regular expression pattern.
* @param flags Syntax option flags.
*
* @throws regex_error if p does not contain a valid regular expression
* pattern interpreted according to @p flags. If regex_error is thrown,
* *this remains unchanged.
*/
basic_regex&
assign(const _Ch_type* __p,
flag_type __flags = regex_constants::ECMAScript)
{ return this->assign(string_type(__p), __flags); }
/**
* @brief Assigns a new regular expression to a regex object from a
* C-style string containing a regular expression pattern.
*
* @param p A pointer to a C-style string containing a
* regular expression pattern.
* @param len The length of the regular expression pattern string.
* @param flags Syntax option flags.
*
* @throws regex_error if p does not contain a valid regular expression
* pattern interpreted according to @p flags. If regex_error is thrown,
* *this remains unchanged.
*/
basic_regex&
assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
{ return this->assign(string_type(__p, __len), __flags); }
/**
* @brief Assigns a new regular expression to a regex object from a
* string containing a regular expression pattern.
*
* @param s A string containing a regular expression pattern.
* @param flags Syntax option flags.
*
* @throws regex_error if p does not contain a valid regular expression
* pattern interpreted according to @p flags. If regex_error is thrown,
* *this remains unchanged.
*/
template<typename _Ch_typeraits, typename _Allocator>
basic_regex&
assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
flag_type __f = regex_constants::ECMAScript)
{
basic_regex __tmp(__s, __f);
this->swap(__tmp);
return *this;
}
/**
* @brief Assigns a new regular expression to a regex object.
*
* @param first The start of a range containing a valid regular
* expression.
* @param last The end of a range containing a valid regular
* expression.
* @param flags Syntax option flags.
*
* @throws regex_error if p does not contain a valid regular expression
* pattern interpreted according to @p flags. If regex_error is thrown,
* the object remains unchanged.
*/
template<typename _InputIterator>
basic_regex&
assign(_InputIterator __first, _InputIterator __last,
flag_type __flags = regex_constants::ECMAScript)
{ return this->assign(string_type(__first, __last), __flags); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX11
/**
* @brief Assigns a new regular expression to a regex object.
*
* @param l An initializer list representing a regular expression.
* @param flags Syntax option flags.
*
* @throws regex_error if @p l does not contain a valid regular
* expression pattern interpreted according to @p flags. If regex_error
* is thrown, the object remains unchanged.
*/
basic_regex&
assign(initializer_list<_Ch_type> __l,
flag_type __f = regex_constants::ECMAScript)
{ return this->assign(__l.begin(), __l.end(), __f); }
#endif
// [7.8.4] const operations
/**
* @brief Gets the number of marked subexpressions within the regular
* expression.
*/
unsigned int
mark_count() const
{ return _M_mark_count; }
/**
* @brief Gets the flags used to construct the regular expression
* or in the last call to assign().
*/
flag_type
flags() const
{ return _M_flags; }
// [7.8.5] locale
/**
* @brief Imbues the regular expression object with the given locale.
*
* @param loc A locale.
*/
locale_type
imbue(locale_type __loc)
{ return _M_traits.imbue(__loc); }
/**
* @brief Gets the locale currently imbued in the regular expression
* object.
*/
locale_type
getloc() const
{ return _M_traits.getloc(); }
// [7.8.6] swap
/**
* @brief Swaps the contents of two regular expression objects.
*
* @param rhs Another regular expression object.
*/
void
swap(basic_regex& __rhs)
{
std::swap(_M_flags, __rhs._M_flags);
std::swap(_M_pattern, __rhs._M_pattern);
std::swap(_M_mark_count, __rhs._M_mark_count);
std::swap(_M_traits, __rhs._M_traits);
}
private:
/**
* @brief Compiles a regular expression pattern into a NFA.
* @todo Implement this function.
*/
void _M_compile();
protected:
flag_type _M_flags;
string_type _M_pattern;
unsigned int _M_mark_count;
_Rx_traits _M_traits;
};
/** @brief Standard regular expressions. */
typedef basic_regex<char> regex;
#ifdef _GLIBCXX_USE_WCHAR_T
/** @brief Standard wide-character regular expressions. */
typedef basic_regex<wchar_t> wregex;
#endif
// [7.8.6] basic_regex swap
/**
* @brief Swaps the contents of two regular expression objects.
* @param lhs First regular expression.
* @param rhs Second regular expression.
*/
template<typename _Ch_type, typename _Rx_traits>
inline void
swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
basic_regex<_Ch_type, _Rx_traits>& __rhs)
{ __lhs.swap(__rhs); }
// [7.9] Class template sub_match
/**
* A sequence of characters matched by a particular marked sub-expression.
*
* An object of this class is essentially a pair of iterators marking a
* matched subexpression within a regular expression pattern match. Such
* objects can be converted to and compared with std::basic_string objects
* of a similar base character type as the pattern matched by the regular
* expression.
*
* The iterators that make up the pair are the usual half-open interval
* referencing the actual original pattern matched.
*/
template<typename _BiIter>
class sub_match : public std::pair<_BiIter, _BiIter>
{
public:
typedef typename iterator_traits<_BiIter>::value_type value_type;
typedef typename iterator_traits<_BiIter>::difference_type
difference_type;
typedef _BiIter iterator;
public:
bool matched;
/**
* Gets the length of the matching sequence.
*/
difference_type
length() const
{ return this->matched ? std::distance(this->first, this->second) : 0; }
/**
* @brief Gets the matching sequence as a string.
*
* @returns the matching sequence as a string.
*
* This is the implicit conversion operator. It is identical to the
* str() member function except that it will want to pop up in
* unexpected places and cause a great deal of confusion and cursing
* from the unwary.
*/
operator basic_string<value_type>() const
{
return this->matched
? std::basic_string<value_type>(this->first, this->second)
: std::basic_string<value_type>();
}
/**
* @brief Gets the matching sequence as a string.
*
* @returns the matching sequence as a string.
*/
basic_string<value_type>
str() const
{
return this->matched
? std::basic_string<value_type>(this->first, this->second)
: std::basic_string<value_type>();
}
/**
* @brief Compares this and another matched sequence.
*
* @param s Another matched sequence to compare to this one.
*
* @retval <0 this matched sequence will collate before @p s.
* @retval =0 this matched sequence is equivalent to @p s.
* @retval <0 this matched sequence will collate after @p s.
*/
int
compare(const sub_match& __s) const
{ return this->str().compare(__s.str()); }
/**
* @brief Compares this sub_match to a string.
*
* @param s A string to compare to this sub_match.
*
* @retval <0 this matched sequence will collate before @p s.
* @retval =0 this matched sequence is equivalent to @p s.
* @retval <0 this matched sequence will collate after @p s.
*/
int
compare(const basic_string<value_type>& __s) const
{ return this->str().compare(__s); }
/**
* @brief Compares this sub_match to a C-style string.
*
* @param s A C-style string to compare to this sub_match.
*
* @retval <0 this matched sequence will collate before @p s.
* @retval =0 this matched sequence is equivalent to @p s.
* @retval <0 this matched sequence will collate after @p s.
*/
int
compare(const value_type* __s) const
{ return this->str().compare(__s); }
};
/** @brief Standard regex submatch over a C-style null-terminated string. */
typedef sub_match<const char*> csub_match;
/** @brief Standard regex submatch over a standard string. */
typedef sub_match<string::const_iterator> ssub_match;
#ifdef _GLIBCXX_USE_WCHAR_T
/** @brief Regex submatch over a C-style null-terminated wide string. */
typedef sub_match<const wchar_t*> wcsub_match;
/** @brief Regex submatch over a standard wide string. */
typedef sub_match<wstring::const_iterator> wssub_match;
#endif
// [7.9.2] sub_match non-member operators
/**
* @brief Tests the equivalence of two regular expression submatches.
* @param lhs First regular expression submatch.
* @param rhs Second regular expression submatch.
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _BiIter>
inline bool
operator==(const sub_match<_BiIter>& __lhs,
const sub_match<_BiIter>& __rhs)
{ return __lhs.compare(__rhs) == 0; }
/**
* @brief Tests the inequivalence of two regular expression submatches.
* @param lhs First regular expression submatch.
* @param rhs Second regular expression submatch.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _BiIter>
inline bool
operator!=(const sub_match<_BiIter>& __lhs,
const sub_match<_BiIter>& __rhs)
{ return __lhs.compare(__rhs) != 0; }
/**
* @brief Tests the ordering of two regular expression submatches.
* @param lhs First regular expression submatch.
* @param rhs Second regular expression submatch.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _BiIter>
inline bool
operator<(const sub_match<_BiIter>& __lhs,
const sub_match<_BiIter>& __rhs)
{ return __lhs.compare(__rhs) < 0; }
/**
* @brief Tests the ordering of two regular expression submatches.
* @param lhs First regular expression submatch.
* @param rhs Second regular expression submatch.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _BiIter>
inline bool
operator<=(const sub_match<_BiIter>& __lhs,
const sub_match<_BiIter>& __rhs)
{ return __lhs.compare(__rhs) <= 0; }
/**
* @brief Tests the ordering of two regular expression submatches.
* @param lhs First regular expression submatch.
* @param rhs Second regular expression submatch.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _BiIter>
inline bool
operator>=(const sub_match<_BiIter>& __lhs,
const sub_match<_BiIter>& __rhs)
{ return __lhs.compare(__rhs) >= 0; }
/**
* @brief Tests the ordering of two regular expression submatches.
* @param lhs First regular expression submatch.
* @param rhs Second regular expression submatch.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _BiIter>
inline bool
operator>(const sub_match<_BiIter>& __lhs,
const sub_match<_BiIter>& __rhs)
{ return __lhs.compare(__rhs) > 0; }
/**
* @brief Tests the equivalence of a string and a regular expression
* submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator==(const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs == __rhs.str(); }
/**
* @brief Tests the inequivalence of a string and a regular expression
* submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator!=(const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
{ return __lhs != __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator<(const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
{ return __lhs < __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator>(const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
{ return __lhs > __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator>=(const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
{ return __lhs >= __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator<=(const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
{ return __lhs <= __rhs.str(); }
/**
* @brief Tests the equivalence of a regular expression submatch and a
* string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator==(const sub_match<_Bi_iter>& __lhs,
const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __rhs)
{ return __lhs.str() == __rhs; }
/**
* @brief Tests the inequivalence of a regular expression submatch and a
* string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
inline bool
operator!=(const sub_match<_Bi_iter>& __lhs,
const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __rhs)
{ return __lhs.str() != __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
inline bool
operator<(const sub_match<_Bi_iter>& __lhs,
const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __rhs)
{ return __lhs.str() < __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
inline bool
operator>(const sub_match<_Bi_iter>& __lhs,
const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __rhs)
{ return __lhs.str() > __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
inline bool
operator>=(const sub_match<_Bi_iter>& __lhs,
const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __rhs)
{ return __lhs.str() >= __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
inline bool
operator<=(const sub_match<_Bi_iter>& __lhs,
const basic_string<
typename iterator_traits<_Bi_iter>::value_type,
_Ch_traits, _Ch_alloc>& __rhs)
{ return __lhs.str() <= __rhs; }
/**
* @brief Tests the equivalence of a C string and a regular expression
* submatch.
* @param lhs A C string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs == __rhs.str(); }
/**
* @brief Tests the inequivalence of an iterator value and a regular
* expression submatch.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs != __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs < __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs > __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs >= __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs <= __rhs.str(); }
/**
* @brief Tests the equivalence of a regular expression submatch and a
* string.
* @param lhs A regular expression submatch.
* @param rhs A pointer to a string?
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator==(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const* __rhs)
{ return __lhs.str() == __rhs; }
/**
* @brief Tests the inequivalence of a regular expression submatch and a
* string.
* @param lhs A regular expression submatch.
* @param rhs A pointer to a string.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator!=(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const* __rhs)
{ return __lhs.str() != __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const* __rhs)
{ return __lhs.str() < __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const* __rhs)
{ return __lhs.str() > __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>=(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const* __rhs)
{ return __lhs.str() >= __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A string.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<=(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const* __rhs)
{ return __lhs.str() <= __rhs; }
/**
* @brief Tests the equivalence of a string and a regular expression
* submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs == __rhs.str(); }
/**
* @brief Tests the inequivalence of a string and a regular expression
* submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs != __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs < __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs > __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs >= __rhs.str(); }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
* @param lhs A string.
* @param rhs A regular expression submatch.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{ return __lhs <= __rhs.str(); }
/**
* @brief Tests the equivalence of a regular expression submatch and a
* string.
* @param lhs A regular expression submatch.
* @param rhs A const string reference.
* @returns true if @a lhs is equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator==(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const& __rhs)
{ return __lhs.str() == __rhs; }
/**
* @brief Tests the inequivalence of a regular expression submatch and a
* string.
* @param lhs A regular expression submatch.
* @param rhs A const string reference.
* @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator!=(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const& __rhs)
{ return __lhs.str() != __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A const string reference.
* @returns true if @a lhs precedes @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const& __rhs)
{ return __lhs.str() < __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A const string reference.
* @returns true if @a lhs succeeds @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const& __rhs)
{ return __lhs.str() > __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A const string reference.
* @returns true if @a lhs does not precede @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator>=(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const& __rhs)
{ return __lhs.str() >= __rhs; }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
* @param lhs A regular expression submatch.
* @param rhs A const string reference.
* @returns true if @a lhs does not succeed @a rhs, false otherwise.
*/
template<typename _Bi_iter>
inline bool
operator<=(const sub_match<_Bi_iter>& __lhs,
typename iterator_traits<_Bi_iter>::value_type const& __rhs)
{ return __lhs.str() <= __rhs; }
/**
* @brief Inserts a matched string into an output stream.
*
* @param os The output stream.
* @param m A submatch string.
*
* @returns the output stream with the submatch string inserted.
*/
template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
inline
basic_ostream<_Ch_type, _Ch_traits>&
operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
const sub_match<_Bi_iter>& __m)
{ return __os << __m.str(); }
// [7.10] Class template match_results
/**
* @brief The results of a match or search operation.
*
* A collection of character sequences representing the result of a regular
* expression match. Storage for the collection is allocated and freed as
* necessary by the member functions of class template match_results.
*
* This class satisfies the Sequence requirements, with the exception that
* only the operations defined for a const-qualified Sequence are supported.
*
* The sub_match object stored at index 0 represents sub-expression 0, i.e.
* the whole match. In this case the sub_match member matched is always true.
* The sub_match object stored at index n denotes what matched the marked
* sub-expression n within the matched expression. If the sub-expression n
* participated in a regular expression match then the sub_match member
* matched evaluates to true, and members first and second denote the range
* of characters [first, second) which formed that match. Otherwise matched
* is false, and members first and second point to the end of the sequence
* that was searched.
*
* @nosubgrouping
*/
template<typename _Bi_iter,
typename _Allocator = allocator<sub_match<_Bi_iter> > >
class match_results
: private std::vector<std::tr1::sub_match<_Bi_iter>, _Allocator>
{
private:
typedef std::vector<std::tr1::sub_match<_Bi_iter>, _Allocator>
_Base_type;
public:
/**
* @name 10.? Public Types
*/
//@{
typedef sub_match<_Bi_iter> value_type;
typedef typename _Allocator::const_reference const_reference;
typedef const_reference reference;
typedef typename _Base_type::const_iterator const_iterator;
typedef const_iterator iterator;
typedef typename iterator_traits<_Bi_iter>::difference_type
difference_type;
typedef typename _Allocator::size_type size_type;
typedef _Allocator allocator_type;
typedef typename iterator_traits<_Bi_iter>::value_type char_type;
typedef basic_string<char_type> string_type;
//@}
public:
/**
* @name 10.1 Construction, Copying, and Destruction
*/
//@{
/**
* @brief Constructs a default %match_results container.
* @post size() returns 0 and str() returns an empty string.
*/
explicit
match_results(const _Allocator& __a = _Allocator())
: _Base_type(__a), _M_matched(false)
{ }
/**
* @brief Copy constructs a %match_results.
*/
match_results(const match_results& __rhs)
: _Base_type(__rhs), _M_matched(__rhs._M_matched),
_M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix)
{ }
/**
* @brief Assigns rhs to *this.
*/
match_results&
operator=(const match_results& __rhs)
{
match_results __tmp(__rhs);
this->swap(__tmp);
return *this;
}
/**
* @brief Destroys a %match_results object.
*/
~match_results()
{ }
//@}
/**
* @name 10.2 Size
*/
//@{
/**
* @brief Gets the number of matches and submatches.
*
* The number of matches for a given regular expression will be either 0
* if there was no match or mark_count() + 1 if a match was successful.
* Some matches may be empty.
*
* @returns the number of matches found.
*/
size_type
size() const
{ return _M_matched ? _Base_type::size() + 1 : 0; }
//size_type
//max_size() const;
using _Base_type::max_size;
/**
* @brief Indicates if the %match_results contains no results.
* @retval true The %match_results object is empty.
* @retval false The %match_results object is not empty.
*/
bool
empty() const
{ return size() == 0; }
//@}
/**
* @name 10.3 Element Access
*/
//@{
/**
* @brief Gets the length of the indicated submatch.
* @param sub indicates the submatch.
*
* This function returns the length of the indicated submatch, or the
* length of the entire match if @p sub is zero (the default).
*/
difference_type
length(size_type __sub = 0) const
{ return _M_matched ? this->str(__sub).length() : 0; }
/**
* @brief Gets the offset of the beginning of the indicated submatch.
* @param sub indicates the submatch.
*
* This function returns the offset from the beginning of the target
* sequence to the beginning of the submatch, unless the value of @p sub
* is zero (the default), in which case this function returns the offset
* from the beginning of the target sequence to the beginning of the
* match.
*/
difference_type
position(size_type __sub = 0) const
{
return _M_matched ? std::distance(this->prefix().first,
(*this)[__sub].first) : 0;
}
/**
* @brief Gets the match or submatch converted to a string type.
* @param sub indicates the submatch.
*
* This function gets the submatch (or match, if @p sub is zero) extracted
* from the target range and converted to the associated string type.
*/
string_type
str(size_type __sub = 0) const
{ return _M_matched ? (*this)[__sub].str() : string_type(); }
/**
* @brief Gets a %sub_match reference for the match or submatch.
* @param sub indicates the submatch.
*
* This function gets a reference to the indicated submatch, or the entire
* match if @p sub is zero.
*
* If @p sub >= size() then this function returns a %sub_match with a
* special value indicating no submatch.
*/
const_reference
operator[](size_type __sub) const
{ return _Base_type::operator[](__sub); }
/**
* @brief Gets a %sub_match representing the match prefix.
*
* This function gets a reference to a %sub_match object representing the
* part of the target range between the start of the target range and the
* start of the match.
*/
const_reference
prefix() const
{ return _M_prefix; }
/**
* @brief Gets a %sub_match representing the match suffix.
*
* This function gets a reference to a %sub_match object representing the
* part of the target range between the end of the match and the end of
* the target range.
*/
const_reference
suffix() const
{ return _M_suffix; }
/**
* @brief Gets an iterator to the start of the %sub_match collection.
*/
const_iterator
begin() const
{ return _Base_type::begin(); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX11
/**
* @brief Gets an iterator to the start of the %sub_match collection.
*/
const_iterator
cbegin() const
{ return _Base_type::begin(); }
#endif
/**
* @brief Gets an iterator to one-past-the-end of the collection.
*/
const_iterator
end() const
{ return _Base_type::end(); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX11
/**
* @brief Gets an iterator to one-past-the-end of the collection.
*/
const_iterator
cend() const
{ return _Base_type::end(); }
#endif
//@}
/**
* @name 10.4 Formatting
*
* These functions perform formatted substitution of the matched
* character sequences into their target. The format specifiers
* and escape sequences accepted by these functions are
* determined by their @p flags parameter as documented above.
*/
//@{
/**
* @todo Implement this function.
*/
template<typename _Out_iter>
_Out_iter
format(_Out_iter __out, const string_type& __fmt,
regex_constants::match_flag_type __flags
= regex_constants::format_default) const;
/**
* @todo Implement this function.
*/
string_type
format(const string_type& __fmt,
regex_constants::match_flag_type __flags
= regex_constants::format_default) const;
//@}
/**
* @name 10.5 Allocator
*/
//@{
/**
* @brief Gets a copy of the allocator.
*/
//allocator_type
//get_allocator() const;
using _Base_type::get_allocator;
//@}
/**
* @name 10.6 Swap
*/
//@{
/**
* @brief Swaps the contents of two match_results.
*/
void
swap(match_results& __that)
{
_Base_type::swap(__that);
std::swap(_M_matched, __that._M_matched);
std::swap(_M_prefix, __that._M_prefix);
std::swap(_M_suffix, __that._M_suffix);
}
//@}
private:
bool _M_matched;
value_type _M_prefix;
value_type _M_suffix;
};
typedef match_results<const char*> cmatch;
typedef match_results<string::const_iterator> smatch;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<wstring::const_iterator> wsmatch;
#endif
// match_results comparisons
/**
* @brief Compares two match_results for equality.
* @returns true if the two objects refer to the same match,
* false otherwise.
* @todo Implement this function.
*/
template<typename _Bi_iter, typename _Allocator>
inline bool
operator==(const match_results<_Bi_iter, _Allocator>& __m1,
const match_results<_Bi_iter, _Allocator>& __m2);
/**
* @brief Compares two match_results for inequality.
* @returns true if the two objects do not refer to the same match,
* false otherwise.
*/
template<typename _Bi_iter, class _Allocator>
inline bool
operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
const match_results<_Bi_iter, _Allocator>& __m2)
{ return !(__m1 == __m2); }
// [7.10.6] match_results swap
/**
* @brief Swaps two match results.
* @param lhs A match result.
* @param rhs A match result.
*
* The contents of the two match_results objects are swapped.
*/
template<typename _Bi_iter, typename _Allocator>
inline void
swap(match_results<_Bi_iter, _Allocator>& __lhs,
match_results<_Bi_iter, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
// [7.11.2] Function template regex_match
/**
* @name Matching, Searching, and Replacing
*/
//@{
/**
* @brief Determines if there is a match between the regular expression @p e
* and all of the character sequence [first, last).
*
* @param first Beginning of the character sequence to match.
* @param last One-past-the-end of the character sequence to match.
* @param m The match results.
* @param re The regular expression.
* @param flags Controls how the regular expression is matched.
*
* @retval true A match exists.
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
*
* @todo Implement this function.
*/
template<typename _Bi_iter, typename _Allocator,
typename _Ch_type, typename _Rx_traits>
bool
regex_match(_Bi_iter __first, _Bi_iter __last,
match_results<_Bi_iter, _Allocator>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default);
/**
* @brief Indicates if there is a match between the regular expression @p e
* and all of the character sequence [first, last).
*
* @param first Beginning of the character sequence to match.
* @param last One-past-the-end of the character sequence to match.
* @param re The regular expression.
* @param flags Controls how the regular expression is matched.
*
* @retval true A match exists.
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
*/
template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
bool
regex_match(_Bi_iter __first, _Bi_iter __last,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{
match_results<_Bi_iter> __what;
return regex_match(__first, __last, __what, __re, __flags);
}
/**
* @brief Determines if there is a match between the regular expression @p e
* and a C-style null-terminated string.
*
* @param s The C-style null-terminated string to match.
* @param m The match results.
* @param re The regular expression.
* @param f Controls how the regular expression is matched.
*
* @retval true A match exists.
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
inline bool
regex_match(const _Ch_type* __s,
match_results<const _Ch_type*, _Allocator>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __f
= regex_constants::match_default)
{ return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
/**
* @brief Determines if there is a match between the regular expression @p e
* and a string.
*
* @param s The string to match.
* @param m The match results.
* @param re The regular expression.
* @param flags Controls how the regular expression is matched.
*
* @retval true A match exists.
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _Ch_alloc,
typename _Allocator, typename _Ch_type, typename _Rx_traits>
inline bool
regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
match_results<typename basic_string<_Ch_type,
_Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{ return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
/**
* @brief Indicates if there is a match between the regular expression @p e
* and a C-style null-terminated string.
*
* @param s The C-style null-terminated string to match.
* @param re The regular expression.
* @param f Controls how the regular expression is matched.
*
* @retval true A match exists.
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_type, class _Rx_traits>
inline bool
regex_match(const _Ch_type* __s,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __f
= regex_constants::match_default)
{ return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
/**
* @brief Indicates if there is a match between the regular expression @p e
* and a string.
*
* @param s [IN] The string to match.
* @param re [IN] The regular expression.
* @param flags [IN] Controls how the regular expression is matched.
*
* @retval true A match exists.
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _Str_allocator,
typename _Ch_type, typename _Rx_traits>
inline bool
regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{ return regex_match(__s.begin(), __s.end(), __re, __flags); }
// [7.11.3] Function template regex_search
/**
* Searches for a regular expression within a range.
* @param first [IN] The start of the string to search.
* @param last [IN] One-past-the-end of the string to search.
* @param m [OUT] The match results.
* @param re [IN] The regular expression to search for.
* @param flags [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string, the content of %m is
* undefined.
*
* @throws an exception of type regex_error.
*
* @todo Implement this function.
*/
template<typename _Bi_iter, typename _Allocator,
typename _Ch_type, typename _Rx_traits>
inline bool
regex_search(_Bi_iter __first, _Bi_iter __last,
match_results<_Bi_iter, _Allocator>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default);
/**
* Searches for a regular expression within a range.
* @param first [IN] The start of the string to search.
* @param last [IN] One-past-the-end of the string to search.
* @param re [IN] The regular expression to search for.
* @param flags [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string.
* @doctodo
*
* @throws an exception of type regex_error.
*/
template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
inline bool
regex_search(_Bi_iter __first, _Bi_iter __last,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{
match_results<_Bi_iter> __what;
return regex_search(__first, __last, __what, __re, __flags);
}
/**
* @brief Searches for a regular expression within a C-string.
* @param s [IN] A C-string to search for the regex.
* @param m [OUT] The set of regex matches.
* @param e [IN] The regex to search for in @p s.
* @param f [IN] The search flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string, the content of %m is
* undefined.
* @doctodo
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_type, class _Allocator, class _Rx_traits>
inline bool
regex_search(const _Ch_type* __s,
match_results<const _Ch_type*, _Allocator>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __e,
regex_constants::match_flag_type __f
= regex_constants::match_default)
{ return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
/**
* @brief Searches for a regular expression within a C-string.
* @param s [IN] The C-string to search.
* @param e [IN] The regular expression to search for.
* @param f [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string.
* @doctodo
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_type, typename _Rx_traits>
inline bool
regex_search(const _Ch_type* __s,
const basic_regex<_Ch_type, _Rx_traits>& __e,
regex_constants::match_flag_type __f
= regex_constants::match_default)
{ return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
/**
* @brief Searches for a regular expression within a string.
* @param s [IN] The string to search.
* @param e [IN] The regular expression to search for.
* @param flags [IN] Search policy flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string.
* @doctodo
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _String_allocator,
typename _Ch_type, typename _Rx_traits>
inline bool
regex_search(const basic_string<_Ch_type, _Ch_traits,
_String_allocator>& __s,
const basic_regex<_Ch_type, _Rx_traits>& __e,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{ return regex_search(__s.begin(), __s.end(), __e, __flags); }
/**
* @brief Searches for a regular expression within a string.
* @param s [IN] A C++ string to search for the regex.
* @param m [OUT] The set of regex matches.
* @param e [IN] The regex to search for in @p s.
* @param f [IN] The search flags.
* @retval true A match was found within the string.
* @retval false No match was found within the string, the content of %m is
* undefined.
*
* @throws an exception of type regex_error.
*/
template<typename _Ch_traits, typename _Ch_alloc,
typename _Allocator, typename _Ch_type,
typename _Rx_traits>
inline bool
regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
match_results<typename basic_string<_Ch_type,
_Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __e,
regex_constants::match_flag_type __f
= regex_constants::match_default)
{ return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
// tr1 [7.11.4] std [28.11.4] Function template regex_replace
/**
* @doctodo
* @param out
* @param first
* @param last
* @param e
* @param fmt
* @param flags
*
* @returns out
* @throws an exception of type regex_error.
*
* @todo Implement this function.
*/
template<typename _Out_iter, typename _Bi_iter,
typename _Rx_traits, typename _Ch_type>
inline _Out_iter
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
const basic_regex<_Ch_type, _Rx_traits>& __e,
const basic_string<_Ch_type>& __fmt,
regex_constants::match_flag_type __flags
= regex_constants::match_default);
/**
* @doctodo
* @param s
* @param e
* @param fmt
* @param flags
*
* @returns a copy of string @p s with replacements.
*
* @throws an exception of type regex_error.
*/
template<typename _Rx_traits, typename _Ch_type>
inline basic_string<_Ch_type>
regex_replace(const basic_string<_Ch_type>& __s,
const basic_regex<_Ch_type, _Rx_traits>& __e,
const basic_string<_Ch_type>& __fmt,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{
std::string __result;
regex_replace(std::back_inserter(__result),
__s.begin(), __s.end(), __e, __fmt, __flags);
return __result;
}
//@}
// tr1 [7.12.1] std [28.12] Class template regex_iterator
/**
* An iterator adaptor that will provide repeated calls of regex_search over
* a range until no more matches remain.
*/
template<typename _Bi_iter,
typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
typename _Rx_traits = regex_traits<_Ch_type> >
class regex_iterator
{
public:
typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
typedef match_results<_Bi_iter> value_type;
typedef std::ptrdiff_t difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
typedef std::forward_iterator_tag iterator_category;
public:
/**
* @brief Provides a singular iterator, useful for indicating
* one-past-the-end of a range.
* @todo Implement this function.
* @doctodo
*/
regex_iterator();
/**
* Constructs a %regex_iterator...
* @param a [IN] The start of a text range to search.
* @param b [IN] One-past-the-end of the text range to search.
* @param re [IN] The regular expression to match.
* @param m [IN] Policy flags for match rules.
* @todo Implement this function.
* @doctodo
*/
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
regex_constants::match_flag_type __m
= regex_constants::match_default);
/**
* Copy constructs a %regex_iterator.
* @todo Implement this function.
* @doctodo
*/
regex_iterator(const regex_iterator& __rhs);
/**
* @todo Implement this function.
* @doctodo
*/
regex_iterator&
operator=(const regex_iterator& __rhs);
/**
* @todo Implement this function.
* @doctodo
*/
bool
operator==(const regex_iterator& __rhs);
/**
* @todo Implement this function.
* @doctodo
*/
bool
operator!=(const regex_iterator& __rhs);
/**
* @todo Implement this function.
* @doctodo
*/
const value_type&
operator*();
/**
* @todo Implement this function.
* @doctodo
*/
const value_type*
operator->();
/**
* @todo Implement this function.
* @doctodo
*/
regex_iterator&
operator++();
/**
* @todo Implement this function.
* @doctodo
*/
regex_iterator
operator++(int);
private:
// these members are shown for exposition only:
_Bi_iter begin;
_Bi_iter end;
const regex_type* pregex;
regex_constants::match_flag_type flags;
match_results<_Bi_iter> match;
};
typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
#endif
// [7.12.2] Class template regex_token_iterator
/**
* Iterates over submatches in a range (or @a splits a text string).
*
* The purpose of this iterator is to enumerate all, or all specified,
* matches of a regular expression within a text range. The dereferenced
* value of an iterator of this class is a std::tr1::sub_match object.
*/
template<typename _Bi_iter,
typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
typename _Rx_traits = regex_traits<_Ch_type> >
class regex_token_iterator
{
public:
typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
typedef sub_match<_Bi_iter> value_type;
typedef std::ptrdiff_t difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
typedef std::forward_iterator_tag iterator_category;
public:
/**
* @brief Default constructs a %regex_token_iterator.
* @todo Implement this function.
*
* A default-constructed %regex_token_iterator is a singular iterator
* that will compare equal to the one-past-the-end value for any
* iterator of the same type.
*/
regex_token_iterator();
/**
* Constructs a %regex_token_iterator...
* @param a [IN] The start of the text to search.
* @param b [IN] One-past-the-end of the text to search.
* @param re [IN] The regular expression to search for.
* @param submatch [IN] Which submatch to return. There are some
* special values for this parameter:
* - -1 each enumerated subexpression does NOT
* match the regular expression (aka field
* splitting)
* - 0 the entire string matching the
* subexpression is returned for each match
* within the text.
* - >0 enumerates only the indicated
* subexpression from a match within the text.
* @param m [IN] Policy flags for match rules.
*
* @todo Implement this function.
* @doctodo
*/
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
int __submatch = 0,
regex_constants::match_flag_type __m
= regex_constants::match_default);
/**
* Constructs a %regex_token_iterator...
* @param a [IN] The start of the text to search.
* @param b [IN] One-past-the-end of the text to search.
* @param re [IN] The regular expression to search for.
* @param submatches [IN] A list of subexpressions to return for each
* regular expression match within the text.
* @param m [IN] Policy flags for match rules.
*
* @todo Implement this function.
* @doctodo
*/
regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
const regex_type& __re,
const std::vector<int>& __submatches,
regex_constants::match_flag_type __m
= regex_constants::match_default);
/**
* Constructs a %regex_token_iterator...
* @param a [IN] The start of the text to search.
* @param b [IN] One-past-the-end of the text to search.
* @param re [IN] The regular expression to search for.
* @param submatches [IN] A list of subexpressions to return for each
* regular expression match within the text.
* @param m [IN] Policy flags for match rules.
* @todo Implement this function.
* @doctodo
*/
template<std::size_t _Nm>
regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
const regex_type& __re,
const int (&__submatches)[_Nm],
regex_constants::match_flag_type __m
= regex_constants::match_default);
/**
* @brief Copy constructs a %regex_token_iterator.
* @param rhs [IN] A %regex_token_iterator to copy.
* @todo Implement this function.
*/
regex_token_iterator(const regex_token_iterator& __rhs);
/**
* @brief Assigns a %regex_token_iterator to another.
* @param rhs [IN] A %regex_token_iterator to copy.
* @todo Implement this function.
*/
regex_token_iterator&
operator=(const regex_token_iterator& __rhs);
/**
* @brief Compares a %regex_token_iterator to another for equality.
* @todo Implement this function.
*/
bool
operator==(const regex_token_iterator& __rhs);
/**
* @brief Compares a %regex_token_iterator to another for inequality.
* @todo Implement this function.
*/
bool
operator!=(const regex_token_iterator& __rhs);
/**
* @brief Dereferences a %regex_token_iterator.
* @todo Implement this function.
*/
const value_type&
operator*();
/**
* @brief Selects a %regex_token_iterator member.
* @todo Implement this function.
*/
const value_type*
operator->();
/**
* @brief Increments a %regex_token_iterator.
* @todo Implement this function.
*/
regex_token_iterator&
operator++();
/**
* @brief Postincrements a %regex_token_iterator.
* @todo Implement this function.
*/
regex_token_iterator
operator++(int);
private: // data members for exposition only:
typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
position_iterator __position;
const value_type* __result;
value_type __suffix;
std::size_t __n;
std::vector<int> __subs;
};
/** @brief Token iterator for C-style NULL-terminated strings. */
typedef regex_token_iterator<const char*> cregex_token_iterator;
/** @brief Token iterator for standard strings. */
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
#ifdef _GLIBCXX_USE_WCHAR_T
/** @brief Token iterator for C-style NULL-terminated wide strings. */
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
/** @brief Token iterator for standard wide-character strings. */
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#endif
//@}
}
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_TR1_REGEX
// TR1 cinttypes -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cinttypes
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CINTTYPES
#define _GLIBCXX_TR1_CINTTYPES 1
#pragma GCC system_header
#include <tr1/cstdint>
// For 8.11.1/1 (see C99, Note 184)
#if _GLIBCXX_HAVE_INTTYPES_H
# ifndef __STDC_FORMAT_MACROS
# define _UNDEF__STDC_FORMAT_MACROS
# define __STDC_FORMAT_MACROS
# endif
# include <inttypes.h>
# ifdef _UNDEF__STDC_FORMAT_MACROS
# undef __STDC_FORMAT_MACROS
# undef _UNDEF__STDC_FORMAT_MACROS
# endif
#endif
#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
// types
using ::imaxdiv_t;
// functions
using ::imaxabs;
// May collide with _Longlong abs(_Longlong), and is not described
// anywhere outside the synopsis. Likely, a defect.
//
// intmax_t abs(intmax_t)
using ::imaxdiv;
// Likewise, with lldiv_t div(_Longlong, _Longlong).
//
// imaxdiv_t div(intmax_t, intmax_t)
using ::strtoimax;
using ::strtoumax;
#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
using ::wcstoimax;
using ::wcstoumax;
#endif
}
}
#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
#endif // _GLIBCXX_TR1_CINTTYPES
// <tr1/memory> -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/**
* @file tr1/memory
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_MEMORY
#define _GLIBCXX_TR1_MEMORY 1
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX11)
# error TR1 header cannot be included from C++11 header
#endif
#include <memory>
#include <exception> // std::exception
#include <typeinfo> // std::type_info in get_deleter
#include <bits/stl_algobase.h> // std::swap
#include <iosfwd> // std::basic_ostream
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/functexcept.h>
#include <bits/stl_function.h> // std::less
#include <debug/debug.h>
#include <tr1/type_traits>
#include <tr1/shared_ptr.h>
#endif // _GLIBCXX_TR1_MEMORY
// TR1 cwchar -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cwchar
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CWCHAR
#define _GLIBCXX_TR1_CWCHAR 1
#pragma GCC system_header
#include <cwchar>
#ifdef _GLIBCXX_USE_WCHAR_T
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
#if _GLIBCXX_HAVE_WCSTOF
using std::wcstof;
#endif
#if _GLIBCXX_HAVE_VFWSCANF
using std::vfwscanf;
#endif
#if _GLIBCXX_HAVE_VSWSCANF
using std::vswscanf;
#endif
#if _GLIBCXX_HAVE_VWSCANF
using std::vwscanf;
#endif
#if _GLIBCXX_USE_C99_WCHAR
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
#endif
}
}
#endif // _GLIBCXX_USE_WCHAR_T
#endif // _GLIBCXX_TR1_CWCHAR
// TR1 unordered_map -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/unordered_map
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_UNORDERED_MAP
#define _GLIBCXX_TR1_UNORDERED_MAP 1
#pragma GCC system_header
#include <utility>
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
#include <bits/stringfwd.h>
#include <tr1/type_traits>
#include <tr1/functional_hash.h>
#include <tr1/hashtable.h>
#include <tr1/unordered_map.h>
#endif // _GLIBCXX_TR1_UNORDERED_MAP
// TR1 cstdio -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/cstdio
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_CSTDIO
#define _GLIBCXX_TR1_CSTDIO 1
#pragma GCC system_header
#include <cstdio>
#if _GLIBCXX_USE_C99_STDIO
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
using std::snprintf;
using std::vsnprintf;
using std::vfscanf;
using std::vscanf;
using std::vsscanf;
}
}
#endif
#endif // _GLIBCXX_TR1_CSTDIO
// TR1 stdlib.h -*- C++ -*-
// Copyright (C) 2006-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1/stdlib.h
* This is a TR1 C++ Library header.
*/
#ifndef _GLIBCXX_TR1_STDLIB_H
#define _GLIBCXX_TR1_STDLIB_H 1
#include <tr1/cstdlib>
#if _GLIBCXX_HOSTED
#if _GLIBCXX_USE_C99_STDLIB
using std::tr1::atoll;
using std::tr1::strtoll;
using std::tr1::strtoull;
using std::tr1::abs;
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using std::tr1::div;
#endif
#endif
#endif
#endif // _GLIBCXX_TR1_STDLIB_H
// RTTI support for -*- C++ -*-
// Copyright (C) 1994-2018 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
// GCC is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// GCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file typeinfo
* This is a Standard C++ Library header.
*/
#ifndef _TYPEINFO
#define _TYPEINFO
#pragma GCC system_header
#include <bits/exception.h>
#if __cplusplus >= 201103L
#include <bits/hash_bytes.h>
#endif
#pragma GCC visibility push(default)
extern "C++" {
namespace __cxxabiv1
{
class __class_type_info;
} // namespace __cxxabiv1
// Determine whether typeinfo names for the same type are merged (in which
// case comparison can just compare pointers) or not (in which case strings
// must be compared), and whether comparison is to be implemented inline or
// not. We used to do inline pointer comparison by default if weak symbols
// are available, but even with weak symbols sometimes names are not merged
// when objects are loaded with RTLD_LOCAL, so now we always use strcmp by
// default. For ABI compatibility, we do the strcmp inline if weak symbols
// are available, and out-of-line if not. Out-of-line pointer comparison
// is used where the object files are to be portable to multiple systems,
// some of which may not be able to use pointer comparison, but the
// particular system for which libstdc++ is being built can use pointer
// comparison; in particular for most ARM EABI systems, where the ABI
// specifies out-of-line comparison. The compiler's target configuration
// can override the defaults by defining __GXX_TYPEINFO_EQUALITY_INLINE to
// 1 or 0 to indicate whether or not comparison is inline, and
// __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to indicate whether or not pointer
// comparison can be used.
#ifndef __GXX_MERGED_TYPEINFO_NAMES
// By default, typeinfo names are not merged.
#define __GXX_MERGED_TYPEINFO_NAMES 0
#endif
// By default follow the old inline rules to avoid ABI changes.
#ifndef __GXX_TYPEINFO_EQUALITY_INLINE
#if !__GXX_WEAK__
#define __GXX_TYPEINFO_EQUALITY_INLINE 0
#else
#define __GXX_TYPEINFO_EQUALITY_INLINE 1
#endif
#endif
namespace std
{
/**
* @brief Part of RTTI.
*
* The @c type_info class describes type information generated by
* an implementation.
*/
class type_info
{
public:
/** Destructor first. Being the first non-inline virtual function, this
* controls in which translation unit the vtable is emitted. The
* compiler makes use of that information to know where to emit
* the runtime-mandated type_info structures in the new-abi. */
virtual ~type_info();
/** Returns an @e implementation-defined byte string; this is not
* portable between compilers! */
const char* name() const _GLIBCXX_NOEXCEPT
{ return __name[0] == '*' ? __name + 1 : __name; }
#if !__GXX_TYPEINFO_EQUALITY_INLINE
// In old abi, or when weak symbols are not supported, there can
// be multiple instances of a type_info object for one
// type. Uniqueness must use the _name value, not object address.
bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT;
bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT;
#else
#if !__GXX_MERGED_TYPEINFO_NAMES
/** Returns true if @c *this precedes @c __arg in the implementation's
* collation order. */
// Even with the new abi, on systems that support dlopen
// we can run into cases where type_info names aren't merged,
// so we still need to do string comparison.
bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{ return (__name[0] == '*' && __arg.__name[0] == '*')
? __name < __arg.__name
: __builtin_strcmp (__name, __arg.__name) < 0; }
bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{
return ((__name == __arg.__name)
|| (__name[0] != '*' &&
__builtin_strcmp (__name, __arg.__name) == 0));
}
#else
// On some targets we can rely on type_info's NTBS being unique,
// and therefore address comparisons are sufficient.
bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{ return __name < __arg.__name; }
bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{ return __name == __arg.__name; }
#endif
#endif
bool operator!=(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{ return !operator==(__arg); }
#if __cplusplus >= 201103L
size_t hash_code() const noexcept
{
# if !__GXX_MERGED_TYPEINFO_NAMES
return _Hash_bytes(name(), __builtin_strlen(name()),
static_cast<size_t>(0xc70f6907UL));
# else
return reinterpret_cast<size_t>(__name);
# endif
}
#endif // C++11
// Return true if this is a pointer type of some kind
virtual bool __is_pointer_p() const;
// Return true if this is a function type
virtual bool __is_function_p() const;
// Try and catch a thrown type. Store an adjusted pointer to the
// caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
// THR_OBJ points to the thrown object. If THR_TYPE is a pointer
// type, then THR_OBJ is the pointer itself. OUTER indicates the
// number of outer pointers, and whether they were const
// qualified.
virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj,
unsigned __outer) const;
// Internally used during catch matching
virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
void **__obj_ptr) const;
protected:
const char *__name;
explicit type_info(const char *__n): __name(__n) { }
private:
/// Assigning type_info is not supported.
type_info& operator=(const type_info&);
type_info(const type_info&);
};
/**
* @brief Thrown during incorrect typecasting.
* @ingroup exceptions
*
* If you attempt an invalid @c dynamic_cast expression, an instance of
* this class (or something derived from this class) is thrown. */
class bad_cast : public exception
{
public:
bad_cast() _GLIBCXX_USE_NOEXCEPT { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_cast() _GLIBCXX_USE_NOEXCEPT;
// See comment in eh_exception.cc.
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
};
/**
* @brief Thrown when a NULL pointer in a @c typeid expression is used.
* @ingroup exceptions
*/
class bad_typeid : public exception
{
public:
bad_typeid () _GLIBCXX_USE_NOEXCEPT { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_typeid() _GLIBCXX_USE_NOEXCEPT;
// See comment in eh_exception.cc.
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
};
} // namespace std
} // extern "C++"
#pragma GCC visibility pop
#endif
// <ccomplex> -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file include/ccomplex
* This is a Standard C++ Library header.
*/
#pragma GCC system_header
#ifndef _GLIBCXX_CCOMPLEX
#define _GLIBCXX_CCOMPLEX 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#endif
extern "C++" {
#include <complex>
}
#endif
// <experimental/deque> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/deque
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_DEQUE
#define _GLIBCXX_EXPERIMENTAL_DEQUE 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <deque>
#include <algorithm>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Tp, typename _Alloc, typename _Predicate>
void
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
__cont.end());
}
template<typename _Tp, typename _Alloc, typename _Up>
void
erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
__cont.end());
}
namespace pmr {
template<typename _Tp>
using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_DEQUE
// Variable Templates For chrono -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/chrono
* This is a TS C++ Library header.
*/
//
// N3932 Variable Templates For Type Traits (Revision 1)
//
#ifndef _GLIBCXX_EXPERIMENTAL_CHRONO
#define _GLIBCXX_EXPERIMENTAL_CHRONO 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <chrono>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace chrono {
namespace experimental
{
inline namespace fundamentals_v1
{
// See C++14 §20.12.4, customization traits
template <typename _Rep>
constexpr bool treat_as_floating_point_v =
treat_as_floating_point<_Rep>::value;
} // namespace fundamentals_v1
} // namespace experimental
} // namespace chrono
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_CHRONO
// <experimental/forward_list> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/forward_list
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FORWARD_LIST
#define _GLIBCXX_EXPERIMENTAL_FORWARD_LIST 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <forward_list>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Tp, typename _Alloc, typename _Predicate>
inline void
erase_if(forward_list<_Tp, _Alloc>& __cont, _Predicate __pred)
{ __cont.remove_if(__pred); }
template<typename _Tp, typename _Alloc, typename _Up>
inline void
erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value)
{
using __elem_type = typename forward_list<_Tp, _Alloc>::value_type;
erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; });
}
namespace pmr {
template<typename _Tp>
using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_FORWARD_LIST
// Variable Templates For ratio -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/ratio
* This is a TS C++ Library header.
*/
//
// N3932 Variable Templates For Type Traits (Revision 1)
//
#ifndef _GLIBCXX_EXPERIMENTAL_RATIO
#define _GLIBCXX_EXPERIMENTAL_RATIO 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <ratio>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
// See C++14 §20.11.5, ratio comparison
template <typename _R1, typename _R2>
constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value;
template <typename _R1, typename _R2>
constexpr bool ratio_not_equal_v = ratio_not_equal<_R1, _R2>::value;
template <typename _R1, typename _R2>
constexpr bool ratio_less_v = ratio_less<_R1, _R2>::value;
template <typename _R1, typename _R2>
constexpr bool ratio_less_equal_v = ratio_less_equal<_R1, _R2>::value;
template <typename _R1, typename _R2>
constexpr bool ratio_greater_v = ratio_greater<_R1, _R2>::value;
template <typename _R1, typename _R2>
constexpr bool ratio_greater_equal_v = ratio_greater_equal<_R1, _R2>::value;
} // namespace fundamentals_v1
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_RATIO
// <experimental/utility> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/utility
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_UTILITY
#define _GLIBCXX_EXPERIMENTAL_UTILITY 1
#if __cplusplus >= 201402L
#include <utility>
#include <bits/uses_allocator.h>
#include <experimental/bits/lfts_config.h>
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental {
inline namespace fundamentals_v2 {
// 3.1.2, erased-type placeholder
using erased_type = std::__erased_type;
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_UTILITY
// <experimental/array> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/array
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_ARRAY
#define _GLIBCXX_EXPERIMENTAL_ARRAY 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <array>
#include <experimental/type_traits>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_make_array 201505
/**
* @defgroup make_array Array creation functions
* @ingroup experimental
*
* Array creation functions as described in N4529,
* Working Draft, C++ Extensions for Library Fundamentals, Version 2
*
* @{
*/
template<typename _Dest, typename... _Types>
struct __make_array_elem
{
using type = _Dest;
};
template<typename... _Types>
struct __make_array_elem<void, _Types...>
: common_type<_Types...>
{
template <typename>
struct __is_reference_wrapper : false_type
{};
template <typename _Up>
struct __is_reference_wrapper<reference_wrapper<_Up>> : true_type
{};
static_assert(!__or_<__is_reference_wrapper<decay_t<_Types>>...>::value,
"make_array must be used with an explicit target type when"
"any of the arguments is a reference_wrapper");
};
template <typename _Dest = void, typename... _Types>
constexpr
array<typename __make_array_elem<_Dest, _Types...>::type, sizeof...(_Types)>
make_array(_Types&&... __t)
{
return {{ std::forward<_Types>(__t)... }};
}
template <typename _Tp, size_t _Nm, size_t... _Idx>
constexpr array<remove_cv_t<_Tp>, _Nm>
__to_array(_Tp (&__a)[_Nm], index_sequence<_Idx...>)
{
return {{__a[_Idx]...}};
}
template <typename _Tp, size_t _Nm>
constexpr array<remove_cv_t<_Tp>, _Nm>
to_array(_Tp (&__a)[_Nm])
noexcept(is_nothrow_constructible<remove_cv_t<_Tp>, _Tp&>::value)
{
return __to_array(__a, make_index_sequence<_Nm>{});
}
// @} group make_array
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_ARRAY
// <experimental/memory_resource> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/memory_resource
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE
#define _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <memory>
#include <new>
#include <atomic>
#include <cstddef>
#include <experimental/bits/lfts_config.h>
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental {
inline namespace fundamentals_v2 {
namespace pmr {
#define __cpp_lib_experimental_memory_resources 201402L
class memory_resource;
template <typename _Tp>
class polymorphic_allocator;
template <typename _Alloc>
class __resource_adaptor_imp;
template <typename _Alloc>
using resource_adaptor = __resource_adaptor_imp<
typename allocator_traits<_Alloc>::template rebind_alloc<char>>;
template <typename _Tp>
struct __uses_allocator_construction_helper;
// Global memory resources
memory_resource* new_delete_resource() noexcept;
memory_resource* null_memory_resource() noexcept;
// The default memory resource
memory_resource* get_default_resource() noexcept;
memory_resource* set_default_resource(memory_resource* __r) noexcept;
// Standard memory resources
// 8.5 Class memory_resource
class memory_resource
{
protected:
static constexpr size_t _S_max_align = alignof(max_align_t);
public:
virtual ~memory_resource() { }
void*
allocate(size_t __bytes, size_t __alignment = _S_max_align)
{ return do_allocate(__bytes, __alignment); }
void
deallocate(void* __p, size_t __bytes, size_t __alignment = _S_max_align)
{ return do_deallocate(__p, __bytes, __alignment); }
bool
is_equal(const memory_resource& __other) const noexcept
{ return do_is_equal(__other); }
protected:
virtual void*
do_allocate(size_t __bytes, size_t __alignment) = 0;
virtual void
do_deallocate(void* __p, size_t __bytes, size_t __alignment) = 0;
virtual bool
do_is_equal(const memory_resource& __other) const noexcept = 0;
};
inline bool
operator==(const memory_resource& __a,
const memory_resource& __b) noexcept
{ return &__a == &__b || __a.is_equal(__b); }
inline bool
operator!=(const memory_resource& __a,
const memory_resource& __b) noexcept
{ return !(__a == __b); }
// 8.6 Class template polymorphic_allocator
template <class _Tp>
class polymorphic_allocator
{
using __uses_alloc1_ = __uses_alloc1<memory_resource*>;
using __uses_alloc2_ = __uses_alloc2<memory_resource*>;
template<typename _Tp1, typename... _Args>
void
_M_construct(__uses_alloc0, _Tp1* __p, _Args&&... __args)
{ ::new(__p) _Tp1(std::forward<_Args>(__args)...); }
template<typename _Tp1, typename... _Args>
void
_M_construct(__uses_alloc1_, _Tp1* __p, _Args&&... __args)
{ ::new(__p) _Tp1(allocator_arg, this->resource(),
std::forward<_Args>(__args)...); }
template<typename _Tp1, typename... _Args>
void
_M_construct(__uses_alloc2_, _Tp1* __p, _Args&&... __args)
{ ::new(__p) _Tp1(std::forward<_Args>(__args)...,
this->resource()); }
public:
using value_type = _Tp;
polymorphic_allocator() noexcept
: _M_resource(get_default_resource())
{ }
polymorphic_allocator(memory_resource* __r)
: _M_resource(__r)
{ _GLIBCXX_DEBUG_ASSERT(__r); }
polymorphic_allocator(const polymorphic_allocator& __other) = default;
template <typename _Up>
polymorphic_allocator(const polymorphic_allocator<_Up>&
__other) noexcept
: _M_resource(__other.resource())
{ }
polymorphic_allocator&
operator=(const polymorphic_allocator& __rhs) = default;
_Tp* allocate(size_t __n)
{ return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp),
alignof(_Tp))); }
void deallocate(_Tp* __p, size_t __n)
{ _M_resource->deallocate(__p, __n * sizeof(_Tp), alignof(_Tp)); }
template <typename _Tp1, typename... _Args> //used here
void construct(_Tp1* __p, _Args&&... __args)
{
memory_resource* const __resource = this->resource();
auto __use_tag
= __use_alloc<_Tp1, memory_resource*, _Args...>(__resource);
_M_construct(__use_tag, __p, std::forward<_Args>(__args)...);
}
// Specializations for pair using piecewise construction
template <typename _Tp1, typename _Tp2,
typename... _Args1, typename... _Args2>
void construct(pair<_Tp1, _Tp2>* __p, piecewise_construct_t,
tuple<_Args1...> __x,
tuple<_Args2...> __y)
{
memory_resource* const __resource = this->resource();
auto __x_use_tag =
__use_alloc<_Tp1, memory_resource*, _Args1...>(__resource);
auto __y_use_tag =
__use_alloc<_Tp2, memory_resource*, _Args2...>(__resource);
::new(__p) std::pair<_Tp1, _Tp2>(piecewise_construct,
_M_construct_p(__x_use_tag, __x),
_M_construct_p(__y_use_tag, __y));
}
template <typename _Tp1, typename _Tp2>
void construct(pair<_Tp1,_Tp2>* __p)
{ this->construct(__p, piecewise_construct, tuple<>(), tuple<>()); }
template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
void construct(pair<_Tp1,_Tp2>* __p, _Up&& __x, _Vp&& __y)
{ this->construct(__p, piecewise_construct,
forward_as_tuple(std::forward<_Up>(__x)),
forward_as_tuple(std::forward<_Vp>(__y))); }
template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
void construct(pair<_Tp1,_Tp2>* __p, const std::pair<_Up, _Vp>& __pr)
{ this->construct(__p, piecewise_construct, forward_as_tuple(__pr.first),
forward_as_tuple(__pr.second)); }
template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp>
void construct(pair<_Tp1,_Tp2>* __p, pair<_Up, _Vp>&& __pr)
{ this->construct(__p, piecewise_construct,
forward_as_tuple(std::forward<_Up>(__pr.first)),
forward_as_tuple(std::forward<_Vp>(__pr.second))); }
template <typename _Up>
void destroy(_Up* __p)
{ __p->~_Up(); }
// Return a default-constructed allocator (no allocator propagation)
polymorphic_allocator select_on_container_copy_construction() const
{ return polymorphic_allocator(); }
memory_resource* resource() const
{ return _M_resource; }
private:
template<typename _Tuple>
_Tuple&&
_M_construct_p(__uses_alloc0, _Tuple& __t)
{ return std::move(__t); }
template<typename... _Args>
decltype(auto)
_M_construct_p(__uses_alloc1_ __ua, tuple<_Args...>& __t)
{ return tuple_cat(make_tuple(allocator_arg, *(__ua._M_a)),
std::move(__t)); }
template<typename... _Args>
decltype(auto)
_M_construct_p(__uses_alloc2_ __ua, tuple<_Args...>& __t)
{ return tuple_cat(std::move(__t), make_tuple(*(__ua._M_a))); }
memory_resource* _M_resource;
};
template <class _Tp1, class _Tp2>
bool operator==(const polymorphic_allocator<_Tp1>& __a,
const polymorphic_allocator<_Tp2>& __b) noexcept
{ return *__a.resource() == *__b.resource(); }
template <class _Tp1, class _Tp2>
bool operator!=(const polymorphic_allocator<_Tp1>& __a,
const polymorphic_allocator<_Tp2>& __b) noexcept
{ return !(__a == __b); }
// 8.7.1 __resource_adaptor_imp
template <typename _Alloc>
class __resource_adaptor_imp : public memory_resource
{
static_assert(is_same<char,
typename allocator_traits<_Alloc>::value_type>::value,
"Allocator's value_type is char");
static_assert(is_same<char*,
typename allocator_traits<_Alloc>::pointer>::value,
"Allocator's pointer type is value_type*");
static_assert(is_same<const char*,
typename allocator_traits<_Alloc>::const_pointer>::value,
"Allocator's const_pointer type is value_type const*");
static_assert(is_same<void*,
typename allocator_traits<_Alloc>::void_pointer>::value,
"Allocator's void_pointer type is void*");
static_assert(is_same<const void*,
typename allocator_traits<_Alloc>::const_void_pointer>::value,
"Allocator's const_void_pointer type is void const*");
public:
using allocator_type = _Alloc;
__resource_adaptor_imp() = default;
__resource_adaptor_imp(const __resource_adaptor_imp&) = default;
__resource_adaptor_imp(__resource_adaptor_imp&&) = default;
explicit __resource_adaptor_imp(const _Alloc& __a2)
: _M_alloc(__a2)
{ }
explicit __resource_adaptor_imp(_Alloc&& __a2)
: _M_alloc(std::move(__a2))
{ }
__resource_adaptor_imp&
operator=(const __resource_adaptor_imp&) = default;
allocator_type get_allocator() const noexcept { return _M_alloc; }
protected:
virtual void*
do_allocate(size_t __bytes, size_t __alignment)
{
using _Aligned_alloc = std::__alloc_rebind<_Alloc, char>;
size_t __new_size = _S_aligned_size(__bytes,
_S_supported(__alignment) ?
__alignment : _S_max_align);
return _Aligned_alloc(_M_alloc).allocate(__new_size);
}
virtual void
do_deallocate(void* __p, size_t __bytes, size_t __alignment)
{
using _Aligned_alloc = std::__alloc_rebind<_Alloc, char>;
size_t __new_size = _S_aligned_size(__bytes,
_S_supported(__alignment) ?
__alignment : _S_max_align);
using _Ptr = typename allocator_traits<_Aligned_alloc>::pointer;
_Aligned_alloc(_M_alloc).deallocate(static_cast<_Ptr>(__p),
__new_size);
}
virtual bool
do_is_equal(const memory_resource& __other) const noexcept
{
auto __p = dynamic_cast<const __resource_adaptor_imp*>(&__other);
return __p ? (_M_alloc == __p->_M_alloc) : false;
}
private:
// Calculate Aligned Size
// Returns a size that is larger than or equal to __size and divisible
// by __alignment, where __alignment is required to be a power of 2.
static size_t
_S_aligned_size(size_t __size, size_t __alignment)
{ return ((__size - 1)|(__alignment - 1)) + 1; }
// Determine whether alignment meets one of those preconditions:
// 1. Equal to Zero
// 2. Is power of two
static bool
_S_supported (size_t __x)
{ return ((__x != 0) && !(__x & (__x - 1))); }
_Alloc _M_alloc;
};
// Global memory resources
inline memory_resource*
new_delete_resource() noexcept
{
using type = resource_adaptor<std::allocator<char>>;
alignas(type) static unsigned char __buf[sizeof(type)];
static type* __r = new(__buf) type;
return __r;
}
inline memory_resource*
null_memory_resource() noexcept
{
class type final : public memory_resource
{
void*
do_allocate(size_t, size_t) override
{ std::__throw_bad_alloc(); }
void
do_deallocate(void*, size_t, size_t) noexcept override
{ }
bool
do_is_equal(const memory_resource& __other) const noexcept override
{ return this == &__other; }
};
alignas(type) static unsigned char __buf[sizeof(type)];
static type* __r = new(__buf) type;
return __r;
}
// The default memory resource
inline std::atomic<memory_resource*>&
__get_default_resource()
{
using type = atomic<memory_resource*>;
alignas(type) static unsigned char __buf[sizeof(type)];
static type* __r = new(__buf) type(new_delete_resource());
return *__r;
}
inline memory_resource*
get_default_resource() noexcept
{ return __get_default_resource().load(); }
inline memory_resource*
set_default_resource(memory_resource* __r) noexcept
{
if (__r == nullptr)
__r = new_delete_resource();
return __get_default_resource().exchange(__r);
}
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE
// <experimental/map> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/map
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_MAP
#define _GLIBCXX_EXPERIMENTAL_MAP 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <map>
#include <experimental/bits/erase_if.h>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Key, typename _Tp, typename _Compare, typename _Alloc,
typename _Predicate>
inline void
erase_if(map<_Key, _Tp, _Compare, _Alloc>& __cont, _Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
template<typename _Key, typename _Tp, typename _Compare, typename _Alloc,
typename _Predicate>
inline void
erase_if(multimap<_Key, _Tp, _Compare, _Alloc>& __cont, _Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
namespace pmr {
template<typename _Key, typename _Tp, typename _Compare = less<_Key>>
using map
= std::map<_Key, _Tp, _Compare,
polymorphic_allocator<pair<const _Key, _Tp>>>;
template<typename _Key, typename _Tp, typename _Compare = less<_Key>>
using multimap
= std::multimap<_Key, _Tp, _Compare,
polymorphic_allocator<pair<const _Key, _Tp>>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_MAP
// <experimental/algorithm> -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/algorithm
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_ALGORITHM
#define _GLIBCXX_EXPERIMENTAL_ALGORITHM 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <algorithm>
#include <experimental/bits/lfts_config.h>
#include <experimental/random>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _ForwardIterator, typename _Searcher>
inline _ForwardIterator
search(_ForwardIterator __first, _ForwardIterator __last,
const _Searcher& __searcher)
{ return __searcher(__first, __last); }
#define __cpp_lib_experimental_sample 201402
/// Take a random sample from a population.
template<typename _PopulationIterator, typename _SampleIterator,
typename _Distance, typename _UniformRandomNumberGenerator>
_SampleIterator
sample(_PopulationIterator __first, _PopulationIterator __last,
_SampleIterator __out, _Distance __n,
_UniformRandomNumberGenerator&& __g)
{
using __pop_cat = typename
std::iterator_traits<_PopulationIterator>::iterator_category;
using __samp_cat = typename
std::iterator_traits<_SampleIterator>::iterator_category;
static_assert(
__or_<is_convertible<__pop_cat, forward_iterator_tag>,
is_convertible<__samp_cat, random_access_iterator_tag>>::value,
"output range must use a RandomAccessIterator when input range"
" does not meet the ForwardIterator requirements");
static_assert(is_integral<_Distance>::value,
"sample size must be an integer type");
typename iterator_traits<_PopulationIterator>::difference_type __d = __n;
return std::__sample(__first, __last, __pop_cat{}, __out, __samp_cat{},
__d,
std::forward<_UniformRandomNumberGenerator>(__g));
}
template<typename _PopulationIterator, typename _SampleIterator,
typename _Distance>
inline _SampleIterator
sample(_PopulationIterator __first, _PopulationIterator __last,
_SampleIterator __out, _Distance __n)
{
return experimental::sample(__first, __last, __out, __n,
_S_randint_engine());
}
template<typename _RandomAccessIterator>
inline void
shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ return std::shuffle(__first, __last, _S_randint_engine()); }
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_ALGORITHM
// <experimental/functional> -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/functional
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FUNCTIONAL
#define _GLIBCXX_EXPERIMENTAL_FUNCTIONAL 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <functional>
#include <tuple>
#include <iterator>
#include <unordered_map>
#include <vector>
#include <array>
#include <bits/stl_algo.h>
#ifdef _GLIBCXX_PARALLEL
# include <parallel/algorithm> // For std::__parallel::search
#endif
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
// See C++14 §20.9.9, Function object binders
/// Variable template for std::is_bind_expression
template<typename _Tp>
constexpr bool is_bind_expression_v = std::is_bind_expression<_Tp>::value;
/// Variable template for std::is_placeholder
template<typename _Tp>
constexpr int is_placeholder_v = std::is_placeholder<_Tp>::value;
#define __cpp_lib_experimental_boyer_moore_searching 201411
// Searchers
template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
class default_searcher
{
public:
default_searcher(_ForwardIterator1 __pat_first,
_ForwardIterator1 __pat_last,
_BinaryPredicate __pred = _BinaryPredicate())
: _M_m(__pat_first, __pat_last, std::move(__pred))
{ }
template<typename _ForwardIterator2>
_ForwardIterator2
operator()(_ForwardIterator2 __first, _ForwardIterator2 __last) const
{
return std::search(__first, __last,
std::get<0>(_M_m), std::get<1>(_M_m),
std::get<2>(_M_m));
}
private:
std::tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m;
};
template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
struct __boyer_moore_map_base
{
template<typename _RAIter>
__boyer_moore_map_base(_RAIter __pat, size_t __patlen,
_Hash&& __hf, _Pred&& __pred)
: _M_bad_char{ __patlen, std::move(__hf), std::move(__pred) }
{
if (__patlen > 0)
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
_M_bad_char[__pat[__i]] = __patlen - 1 - __i;
}
using __diff_type = _Tp;
__diff_type
_M_lookup(_Key __key, __diff_type __not_found) const
{
auto __iter = _M_bad_char.find(__key);
if (__iter == _M_bad_char.end())
return __not_found;
return __iter->second;
}
_Pred
_M_pred() const { return _M_bad_char.key_eq(); }
_GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred> _M_bad_char;
};
template<typename _Tp, size_t _Len, typename _Pred>
struct __boyer_moore_array_base
{
template<typename _RAIter, typename _Unused>
__boyer_moore_array_base(_RAIter __pat, size_t __patlen,
_Unused&&, _Pred&& __pred)
: _M_bad_char{ _GLIBCXX_STD_C::array<_Tp, _Len>{}, std::move(__pred) }
{
std::get<0>(_M_bad_char).fill(__patlen);
if (__patlen > 0)
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
{
auto __ch = __pat[__i];
using _UCh = std::make_unsigned_t<decltype(__ch)>;
auto __uch = static_cast<_UCh>(__ch);
std::get<0>(_M_bad_char)[__uch] = __patlen - 1 - __i;
}
}
using __diff_type = _Tp;
template<typename _Key>
__diff_type
_M_lookup(_Key __key, __diff_type __not_found) const
{
auto __ukey = static_cast<std::make_unsigned_t<_Key>>(__key);
if (__ukey >= _Len)
return __not_found;
return std::get<0>(_M_bad_char)[__ukey];
}
const _Pred&
_M_pred() const { return std::get<1>(_M_bad_char); }
std::tuple<_GLIBCXX_STD_C::array<_Tp, _Len>, _Pred> _M_bad_char;
};
// Use __boyer_moore_array_base when pattern consists of narrow characters
// (or std::byte) and uses std::equal_to as the predicate.
template<typename _RAIter, typename _Hash, typename _Pred,
typename _Val = typename iterator_traits<_RAIter>::value_type,
typename _Diff = typename iterator_traits<_RAIter>::difference_type>
using __boyer_moore_base_t
= std::conditional_t<std::__is_byte_like<_Val, _Pred>::value,
__boyer_moore_array_base<_Diff, 256, _Pred>,
__boyer_moore_map_base<_Val, _Diff, _Hash, _Pred>>;
template<typename _RAIter, typename _Hash
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
typename _BinaryPredicate = std::equal_to<>>
class boyer_moore_searcher
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
{
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
using typename _Base::__diff_type;
public:
boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last,
_Hash __hf = _Hash(),
_BinaryPredicate __pred = _BinaryPredicate());
template<typename _RandomAccessIterator2>
_RandomAccessIterator2
operator()(_RandomAccessIterator2 __first,
_RandomAccessIterator2 __last) const;
private:
bool
_M_is_prefix(_RAIter __word, __diff_type __len,
__diff_type __pos)
{
const auto& __pred = this->_M_pred();
__diff_type __suffixlen = __len - __pos;
for (__diff_type __i = 0; __i < __suffixlen; ++__i)
if (!__pred(__word[__i], __word[__pos + __i]))
return false;
return true;
}
__diff_type
_M_suffix_length(_RAIter __word, __diff_type __len,
__diff_type __pos)
{
const auto& __pred = this->_M_pred();
__diff_type __i = 0;
while (__pred(__word[__pos - __i], __word[__len - 1 - __i])
&& __i < __pos)
{
++__i;
}
return __i;
}
template<typename _Tp>
__diff_type
_M_bad_char_shift(_Tp __c) const
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
_RAIter _M_pat;
_RAIter _M_pat_end;
_GLIBCXX_STD_C::vector<__diff_type> _M_good_suffix;
};
template<typename _RAIter, typename _Hash
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
typename _BinaryPredicate = std::equal_to<>>
class boyer_moore_horspool_searcher
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
{
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
using typename _Base::__diff_type;
public:
boyer_moore_horspool_searcher(_RAIter __pat,
_RAIter __pat_end,
_Hash __hf = _Hash(),
_BinaryPredicate __pred
= _BinaryPredicate())
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
_M_pat(__pat), _M_pat_end(__pat_end)
{ }
template<typename _RandomAccessIterator2>
_RandomAccessIterator2
operator()(_RandomAccessIterator2 __first,
_RandomAccessIterator2 __last) const
{
const auto& __pred = this->_M_pred();
auto __patlen = _M_pat_end - _M_pat;
if (__patlen == 0)
return __first;
auto __len = __last - __first;
while (__len >= __patlen)
{
for (auto __scan = __patlen - 1;
__pred(__first[__scan], _M_pat[__scan]); --__scan)
if (__scan == 0)
return __first;
auto __shift = _M_bad_char_shift(__first[__patlen - 1]);
__len -= __shift;
__first += __shift;
}
return __last;
}
private:
template<typename _Tp>
__diff_type
_M_bad_char_shift(_Tp __c) const
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
_RAIter _M_pat;
_RAIter _M_pat_end;
};
/// Generator function for default_searcher
template<typename _ForwardIterator,
typename _BinaryPredicate = std::equal_to<>>
inline default_searcher<_ForwardIterator, _BinaryPredicate>
make_default_searcher(_ForwardIterator __pat_first,
_ForwardIterator __pat_last,
_BinaryPredicate __pred = _BinaryPredicate())
{ return { __pat_first, __pat_last, __pred }; }
/// Generator function for boyer_moore_searcher
template<typename _RAIter, typename _Hash
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
typename _BinaryPredicate = equal_to<>>
inline boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>
make_boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last,
_Hash __hf = _Hash(),
_BinaryPredicate __pred = _BinaryPredicate())
{ return { __pat_first, __pat_last, std::move(__hf), std::move(__pred) }; }
/// Generator function for boyer_moore_horspool_searcher
template<typename _RAIter, typename _Hash
= std::hash<typename std::iterator_traits<_RAIter>::value_type>,
typename _BinaryPredicate = equal_to<>>
inline boyer_moore_horspool_searcher<_RAIter, _Hash, _BinaryPredicate>
make_boyer_moore_horspool_searcher(_RAIter __pat_first, _RAIter __pat_last,
_Hash __hf = _Hash(),
_BinaryPredicate __pred
= _BinaryPredicate())
{ return { __pat_first, __pat_last, std::move(__hf), std::move(__pred) }; }
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
boyer_moore_searcher(_RAIter __pat, _RAIter __pat_end,
_Hash __hf, _BinaryPredicate __pred)
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
_M_pat(__pat), _M_pat_end(__pat_end), _M_good_suffix(__pat_end - __pat)
{
auto __patlen = __pat_end - __pat;
if (__patlen == 0)
return;
__diff_type __last_prefix = __patlen - 1;
for (__diff_type __p = __patlen - 1; __p >= 0; --__p)
{
if (_M_is_prefix(__pat, __patlen, __p + 1))
__last_prefix = __p + 1;
_M_good_suffix[__p] = __last_prefix + (__patlen - 1 - __p);
}
for (__diff_type __p = 0; __p < __patlen - 1; ++__p)
{
auto __slen = _M_suffix_length(__pat, __patlen, __p);
auto __pos = __patlen - 1 - __slen;
if (!__pred(__pat[__p - __slen], __pat[__pos]))
_M_good_suffix[__pos] = __patlen - 1 - __p + __slen;
}
}
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
template<typename _RandomAccessIterator2>
_RandomAccessIterator2
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
operator()(_RandomAccessIterator2 __first,
_RandomAccessIterator2 __last) const
{
auto __patlen = _M_pat_end - _M_pat;
if (__patlen == 0)
return __first;
const auto& __pred = this->_M_pred();
__diff_type __i = __patlen - 1;
auto __stringlen = __last - __first;
while (__i < __stringlen)
{
__diff_type __j = __patlen - 1;
while (__j >= 0 && __pred(__first[__i], _M_pat[__j]))
{
--__i;
--__j;
}
if (__j < 0)
return __first + __i + 1;
__i += std::max(_M_bad_char_shift(__first[__i]),
_M_good_suffix[__j]);
}
return __last;
}
} // namespace fundamentals_v1
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_not_fn 201406
/// [func.not_fn] Function template not_fn
template<typename _Fn>
inline auto
not_fn(_Fn&& __fn)
noexcept(std::is_nothrow_constructible<std::decay_t<_Fn>, _Fn&&>::value)
{
return std::_Not_fn<std::decay_t<_Fn>>{std::forward<_Fn>(__fn), 0};
}
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_FUNCTIONAL
// Variable Templates For Type Traits -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/type_traits
* This is a TS C++ Library header.
*/
//
// N3932 Variable Templates For Type Traits (Revision 1)
//
#ifndef _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS
#define _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <type_traits>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
#define __cpp_lib_experimental_type_trait_variable_templates 201402
// See C++14 §20.10.4.1, primary type categories
template <typename _Tp>
constexpr bool is_void_v = is_void<_Tp>::value;
template <typename _Tp>
constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
template <typename _Tp>
constexpr bool is_integral_v = is_integral<_Tp>::value;
template <typename _Tp>
constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
template <typename _Tp>
constexpr bool is_array_v = is_array<_Tp>::value;
template <typename _Tp>
constexpr bool is_pointer_v = is_pointer<_Tp>::value;
template <typename _Tp>
constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
template <typename _Tp>
constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
template <typename _Tp>
constexpr bool is_member_object_pointer_v =
is_member_object_pointer<_Tp>::value;
template <typename _Tp>
constexpr bool is_member_function_pointer_v =
is_member_function_pointer<_Tp>::value;
template <typename _Tp>
constexpr bool is_enum_v = is_enum<_Tp>::value;
template <typename _Tp>
constexpr bool is_union_v = is_union<_Tp>::value;
template <typename _Tp>
constexpr bool is_class_v = is_class<_Tp>::value;
template <typename _Tp>
constexpr bool is_function_v = is_function<_Tp>::value;
// See C++14 §20.10.4.2, composite type categories
template <typename _Tp>
constexpr bool is_reference_v = is_reference<_Tp>::value;
template <typename _Tp>
constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
template <typename _Tp>
constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
template <typename _Tp>
constexpr bool is_object_v = is_object<_Tp>::value;
template <typename _Tp>
constexpr bool is_scalar_v = is_scalar<_Tp>::value;
template <typename _Tp>
constexpr bool is_compound_v = is_compound<_Tp>::value;
template <typename _Tp>
constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
// See C++14 §20.10.4.3, type properties
template <typename _Tp>
constexpr bool is_const_v = is_const<_Tp>::value;
template <typename _Tp>
constexpr bool is_volatile_v = is_volatile<_Tp>::value;
template <typename _Tp>
constexpr bool is_trivial_v = is_trivial<_Tp>::value;
template <typename _Tp>
constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
template <typename _Tp>
constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
template <typename _Tp>
constexpr bool is_pod_v = is_pod<_Tp>::value;
template <typename _Tp>
constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
template <typename _Tp>
constexpr bool is_empty_v = is_empty<_Tp>::value;
template <typename _Tp>
constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
template <typename _Tp>
constexpr bool is_abstract_v = is_abstract<_Tp>::value;
template <typename _Tp>
constexpr bool is_final_v = is_final<_Tp>::value;
template <typename _Tp>
constexpr bool is_signed_v = is_signed<_Tp>::value;
template <typename _Tp>
constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
template <typename _Tp, typename... _Args>
constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value;
template <typename _Tp>
constexpr bool is_default_constructible_v =
is_default_constructible<_Tp>::value;
template <typename _Tp>
constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value;
template <typename _Tp>
constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value;
template <typename _Tp>
constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
template <typename _Tp>
constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
template <typename _Tp>
constexpr bool is_destructible_v = is_destructible<_Tp>::value;
template <typename _Tp, typename... _Args>
constexpr bool is_trivially_constructible_v =
is_trivially_constructible<_Tp, _Args...>::value;
template <typename _Tp>
constexpr bool is_trivially_default_constructible_v =
is_trivially_default_constructible<_Tp>::value;
template <typename _Tp>
constexpr bool is_trivially_copy_constructible_v =
is_trivially_copy_constructible<_Tp>::value;
template <typename _Tp>
constexpr bool is_trivially_move_constructible_v =
is_trivially_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
constexpr bool is_trivially_assignable_v =
is_trivially_assignable<_Tp, _Up>::value;
template <typename _Tp>
constexpr bool is_trivially_copy_assignable_v =
is_trivially_copy_assignable<_Tp>::value;
template <typename _Tp>
constexpr bool is_trivially_move_assignable_v =
is_trivially_move_assignable<_Tp>::value;
template <typename _Tp>
constexpr bool is_trivially_destructible_v =
is_trivially_destructible<_Tp>::value;
template <typename _Tp, typename... _Args>
constexpr bool is_nothrow_constructible_v =
is_nothrow_constructible<_Tp, _Args...>::value;
template <typename _Tp>
constexpr bool is_nothrow_default_constructible_v =
is_nothrow_default_constructible<_Tp>::value;
template <typename _Tp>
constexpr bool is_nothrow_copy_constructible_v =
is_nothrow_copy_constructible<_Tp>::value;
template <typename _Tp>
constexpr bool is_nothrow_move_constructible_v =
is_nothrow_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
constexpr bool is_nothrow_assignable_v =
is_nothrow_assignable<_Tp, _Up>::value;
template <typename _Tp>
constexpr bool is_nothrow_copy_assignable_v =
is_nothrow_copy_assignable<_Tp>::value;
template <typename _Tp>
constexpr bool is_nothrow_move_assignable_v =
is_nothrow_move_assignable<_Tp>::value;
template <typename _Tp>
constexpr bool is_nothrow_destructible_v =
is_nothrow_destructible<_Tp>::value;
template <typename _Tp>
constexpr bool has_virtual_destructor_v =
has_virtual_destructor<_Tp>::value;
// See C++14 §20.10.5, type property queries
template <typename _Tp>
constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
template <typename _Tp>
constexpr size_t rank_v = rank<_Tp>::value;
template <typename _Tp, unsigned _Idx = 0>
constexpr size_t extent_v = extent<_Tp, _Idx>::value;
// See C++14 §20.10.6, type relations
template <typename _Tp, typename _Up>
constexpr bool is_same_v = is_same<_Tp, _Up>::value;
template <typename _Base, typename _Derived>
constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
template <typename _From, typename _To>
constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
// 3.3.2, Other type transformations
// invocation_type (still unimplemented)
// raw_invocation_type (still unimplemented)
// invocation_type_t (still unimplemented)
// raw_invocation_type_t (still unimplemented)
} // namespace fundamentals_v1
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_detect 201505
// [meta.detect]
template<typename...> using void_t = void;
struct nonesuch
{
nonesuch() = delete;
~nonesuch() = delete;
nonesuch(nonesuch const&) = delete;
void operator=(nonesuch const&) = delete;
};
template<template<typename...> class _Op, typename... _Args>
using is_detected
= typename std::__detector<nonesuch, void, _Op, _Args...>::value_t;
template<template<typename...> class _Op, typename... _Args>
constexpr bool is_detected_v = is_detected<_Op, _Args...>::value;
template<template<typename...> class _Op, typename... _Args>
using detected_t
= typename std::__detector<nonesuch, void, _Op, _Args...>::type;
template<typename _Default, template<typename...> class _Op, typename... _Args>
using detected_or = std::__detected_or<_Default, _Op, _Args...>;
template<typename _Default, template<typename...> class _Op, typename... _Args>
using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
template<typename _Expected, template<typename...> class _Op, typename... _Args>
using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
template<typename _Expected, template<typename...> class _Op, typename... _Args>
constexpr bool is_detected_exact_v
= is_detected_exact<_Expected, _Op, _Args...>::value;
template<typename _To, template<typename...> class _Op, typename... _Args>
using is_detected_convertible
= is_convertible<detected_t<_Op, _Args...>, _To>;
template<typename _To, template<typename...> class _Op, typename... _Args>
constexpr bool is_detected_convertible_v
= is_detected_convertible<_To, _Op, _Args...>::value;
#define __cpp_lib_experimental_logical_traits 201511
template<typename... _Bn>
struct conjunction
: __and_<_Bn...>
{ };
template<typename... _Bn>
struct disjunction
: __or_<_Bn...>
{ };
template<typename _Pp>
struct negation
: __not_<_Pp>
{ };
template<typename... _Bn>
constexpr bool conjunction_v
= conjunction<_Bn...>::value;
template<typename... _Bn>
constexpr bool disjunction_v
= disjunction<_Bn...>::value;
template<typename _Pp>
constexpr bool negation_v
= negation<_Pp>::value;
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS
// <experimental/set> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/set
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_SET
#define _GLIBCXX_EXPERIMENTAL_SET 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <set>
#include <experimental/bits/erase_if.h>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Key, typename _Compare, typename _Alloc,
typename _Predicate>
inline void
erase_if(set<_Key, _Compare, _Alloc>& __cont, _Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
template<typename _Key, typename _Compare, typename _Alloc,
typename _Predicate>
inline void
erase_if(multiset<_Key, _Compare, _Alloc>& __cont, _Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
namespace pmr {
template<typename _Key, typename _Compare = less<_Key>>
using set = std::set<_Key, _Compare, polymorphic_allocator<_Key>>;
template<typename _Key, typename _Compare = less<_Key>>
using multiset = std::multiset<_Key, _Compare,
polymorphic_allocator<_Key>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_SET
// <optional> -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/optional
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_OPTIONAL
#define _GLIBCXX_EXPERIMENTAL_OPTIONAL 1
/**
* @defgroup experimental Experimental
*
* Components specified by various Technical Specifications.
*
* As indicated by the std::experimental namespace and the header paths,
* the contents of these Technical Specifications are experimental and not
* part of the C++ standard. As such the interfaces and implementations may
* change in the future, and there is <STRONG> no guarantee of compatibility
* between different GCC releases </STRONG> for these features.
*/
#if __cplusplus >= 201402L
#include <utility>
#include <type_traits>
#include <stdexcept>
#include <new>
#include <initializer_list>
#include <bits/functexcept.h>
#include <bits/functional_hash.h>
#include <bits/enable_special_members.h>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
/**
* @defgroup optional Optional values
* @ingroup experimental
*
* Class template for optional values and surrounding facilities, as
* described in n3793 "A proposal to add a utility class to represent
* optional objects (Revision 5)".
*
* @{
*/
#define __cpp_lib_experimental_optional 201411
// All subsequent [X.Y.n] references are against n3793.
// [X.Y.4]
template<typename _Tp>
class optional;
// [X.Y.5]
/// Tag type for in-place construction.
struct in_place_t { };
/// Tag for in-place construction.
constexpr in_place_t in_place { };
// [X.Y.6]
/// Tag type to disengage optional objects.
struct nullopt_t
{
// Do not user-declare default constructor at all for
// optional_value = {} syntax to work.
// nullopt_t() = delete;
// Used for constructing nullopt.
enum class _Construct { _Token };
// Must be constexpr for nullopt_t to be literal.
explicit constexpr nullopt_t(_Construct) { }
};
// [X.Y.6]
/// Tag to disengage optional objects.
constexpr nullopt_t nullopt { nullopt_t::_Construct::_Token };
// [X.Y.7]
/**
* @brief Exception class thrown when a disengaged optional object is
* dereferenced.
* @ingroup exceptions
*/
class bad_optional_access : public logic_error
{
public:
bad_optional_access() : logic_error("bad optional access") { }
// XXX This constructor is non-standard. Should not be inline
explicit bad_optional_access(const char* __arg) : logic_error(__arg) { }
virtual ~bad_optional_access() noexcept = default;
};
void
__throw_bad_optional_access(const char*)
__attribute__((__noreturn__));
// XXX Does not belong here.
inline void
__throw_bad_optional_access(const char* __s)
{ _GLIBCXX_THROW_OR_ABORT(bad_optional_access(__s)); }
#ifndef __cpp_lib_addressof_constexpr
template<typename _Tp, typename = void>
struct _Has_addressof_mem : std::false_type { };
template<typename _Tp>
struct _Has_addressof_mem<_Tp,
__void_t<decltype( std::declval<const _Tp&>().operator&() )>
>
: std::true_type { };
template<typename _Tp, typename = void>
struct _Has_addressof_free : std::false_type { };
template<typename _Tp>
struct _Has_addressof_free<_Tp,
__void_t<decltype( operator&(std::declval<const _Tp&>()) )>
>
: std::true_type { };
/**
* @brief Trait that detects the presence of an overloaded unary operator&.
*
* Practically speaking this detects the presence of such an operator when
* called on a const-qualified lvalue (e.g.
* declval<const _Tp&>().operator&()).
*/
template<typename _Tp>
struct _Has_addressof
: std::__or_<_Has_addressof_mem<_Tp>, _Has_addressof_free<_Tp>>::type
{ };
/**
* @brief An overload that attempts to take the address of an lvalue as a
* constant expression. Falls back to __addressof in the presence of an
* overloaded addressof operator (unary operator&), in which case the call
* will not be a constant expression.
*/
template<typename _Tp>
constexpr
enable_if_t<!_Has_addressof<_Tp>::value, _Tp*>
__constexpr_addressof(_Tp& __t)
{ return &__t; }
/**
* @brief Fallback overload that defers to __addressof.
*/
template<typename _Tp>
inline
enable_if_t<_Has_addressof<_Tp>::value, _Tp*>
__constexpr_addressof(_Tp& __t)
{ return std::__addressof(__t); }
#endif // __cpp_lib_addressof_constexpr
/**
* @brief Class template that holds the necessary state for @ref optional
* and that has the responsibility for construction and the special members.
*
* Such a separate base class template is necessary in order to
* conditionally enable the special members (e.g. copy/move constructors).
* Note that this means that @ref _Optional_base implements the
* functionality for copy and move assignment, but not for converting
* assignment.
*
* @see optional, _Enable_special_members
*/
template<typename _Tp, bool _ShouldProvideDestructor =
!is_trivially_destructible<_Tp>::value>
class _Optional_base
{
private:
// Remove const to avoid prohibition of reusing object storage for
// const-qualified types in [3.8/9]. This is strictly internal
// and even optional itself is oblivious to it.
using _Stored_type = remove_const_t<_Tp>;
public:
// [X.Y.4.1] Constructors.
// Constructors for disengaged optionals.
constexpr _Optional_base() noexcept
: _M_empty{} { }
constexpr _Optional_base(nullopt_t) noexcept
: _Optional_base{} { }
// Constructors for engaged optionals.
template<typename... _Args>
constexpr explicit _Optional_base(in_place_t, _Args&&... __args)
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
template<typename _Up, typename... _Args,
enable_if_t<is_constructible<_Tp,
initializer_list<_Up>&,
_Args&&...>::value,
int>...>
constexpr explicit _Optional_base(in_place_t,
initializer_list<_Up> __il,
_Args&&... __args)
: _M_payload(__il, std::forward<_Args>(__args)...),
_M_engaged(true) { }
// Copy and move constructors.
_Optional_base(const _Optional_base& __other)
{
if (__other._M_engaged)
this->_M_construct(__other._M_get());
}
_Optional_base(_Optional_base&& __other)
noexcept(is_nothrow_move_constructible<_Tp>())
{
if (__other._M_engaged)
this->_M_construct(std::move(__other._M_get()));
}
// [X.Y.4.3] (partly) Assignment.
_Optional_base&
operator=(const _Optional_base& __other)
{
if (this->_M_engaged && __other._M_engaged)
this->_M_get() = __other._M_get();
else
{
if (__other._M_engaged)
this->_M_construct(__other._M_get());
else
this->_M_reset();
}
return *this;
}
_Optional_base&
operator=(_Optional_base&& __other)
noexcept(__and_<is_nothrow_move_constructible<_Tp>,
is_nothrow_move_assignable<_Tp>>())
{
if (this->_M_engaged && __other._M_engaged)
this->_M_get() = std::move(__other._M_get());
else
{
if (__other._M_engaged)
this->_M_construct(std::move(__other._M_get()));
else
this->_M_reset();
}
return *this;
}
// [X.Y.4.2] Destructor.
~_Optional_base()
{
if (this->_M_engaged)
this->_M_payload.~_Stored_type();
}
// The following functionality is also needed by optional, hence the
// protected accessibility.
protected:
constexpr bool _M_is_engaged() const noexcept
{ return this->_M_engaged; }
// The _M_get operations have _M_engaged as a precondition.
constexpr _Tp&
_M_get() noexcept
{ return _M_payload; }
constexpr const _Tp&
_M_get() const noexcept
{ return _M_payload; }
// The _M_construct operation has !_M_engaged as a precondition
// while _M_destruct has _M_engaged as a precondition.
template<typename... _Args>
void
_M_construct(_Args&&... __args)
noexcept(is_nothrow_constructible<_Stored_type, _Args...>())
{
::new (std::__addressof(this->_M_payload))
_Stored_type(std::forward<_Args>(__args)...);
this->_M_engaged = true;
}
void
_M_destruct()
{
this->_M_engaged = false;
this->_M_payload.~_Stored_type();
}
// _M_reset is a 'safe' operation with no precondition.
void
_M_reset()
{
if (this->_M_engaged)
this->_M_destruct();
}
private:
struct _Empty_byte { };
union {
_Empty_byte _M_empty;
_Stored_type _M_payload;
};
bool _M_engaged = false;
};
/// Partial specialization that is exactly identical to the primary template
/// save for not providing a destructor, to fulfill triviality requirements.
template<typename _Tp>
class _Optional_base<_Tp, false>
{
private:
using _Stored_type = remove_const_t<_Tp>;
public:
constexpr _Optional_base() noexcept
: _M_empty{} { }
constexpr _Optional_base(nullopt_t) noexcept
: _Optional_base{} { }
template<typename... _Args>
constexpr explicit _Optional_base(in_place_t, _Args&&... __args)
: _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { }
template<typename _Up, typename... _Args,
enable_if_t<is_constructible<_Tp,
initializer_list<_Up>&,
_Args&&...>::value,
int>...>
constexpr explicit _Optional_base(in_place_t,
initializer_list<_Up> __il,
_Args&&... __args)
: _M_payload(__il, std::forward<_Args>(__args)...),
_M_engaged(true) { }
_Optional_base(const _Optional_base& __other)
{
if (__other._M_engaged)
this->_M_construct(__other._M_get());
}
_Optional_base(_Optional_base&& __other)
noexcept(is_nothrow_move_constructible<_Tp>())
{
if (__other._M_engaged)
this->_M_construct(std::move(__other._M_get()));
}
_Optional_base&
operator=(const _Optional_base& __other)
{
if (this->_M_engaged && __other._M_engaged)
this->_M_get() = __other._M_get();
else
{
if (__other._M_engaged)
this->_M_construct(__other._M_get());
else
this->_M_reset();
}
return *this;
}
_Optional_base&
operator=(_Optional_base&& __other)
noexcept(__and_<is_nothrow_move_constructible<_Tp>,
is_nothrow_move_assignable<_Tp>>())
{
if (this->_M_engaged && __other._M_engaged)
this->_M_get() = std::move(__other._M_get());
else
{
if (__other._M_engaged)
this->_M_construct(std::move(__other._M_get()));
else
this->_M_reset();
}
return *this;
}
// Sole difference
// ~_Optional_base() noexcept = default;
protected:
constexpr bool _M_is_engaged() const noexcept
{ return this->_M_engaged; }
_Tp&
_M_get() noexcept
{ return _M_payload; }
constexpr const _Tp&
_M_get() const noexcept
{ return _M_payload; }
template<typename... _Args>
void
_M_construct(_Args&&... __args)
noexcept(is_nothrow_constructible<_Stored_type, _Args...>())
{
::new (std::__addressof(this->_M_payload))
_Stored_type(std::forward<_Args>(__args)...);
this->_M_engaged = true;
}
void
_M_destruct()
{
this->_M_engaged = false;
this->_M_payload.~_Stored_type();
}
void
_M_reset()
{
if (this->_M_engaged)
this->_M_destruct();
}
private:
struct _Empty_byte { };
union
{
_Empty_byte _M_empty;
_Stored_type _M_payload;
};
bool _M_engaged = false;
};
template<typename _Tp>
class optional;
template<typename _Tp, typename _Up>
using __converts_from_optional =
__or_<is_constructible<_Tp, const optional<_Up>&>,
is_constructible<_Tp, optional<_Up>&>,
is_constructible<_Tp, const optional<_Up>&&>,
is_constructible<_Tp, optional<_Up>&&>,
is_convertible<const optional<_Up>&, _Tp>,
is_convertible<optional<_Up>&, _Tp>,
is_convertible<const optional<_Up>&&, _Tp>,
is_convertible<optional<_Up>&&, _Tp>>;
template<typename _Tp, typename _Up>
using __assigns_from_optional =
__or_<is_assignable<_Tp&, const optional<_Up>&>,
is_assignable<_Tp&, optional<_Up>&>,
is_assignable<_Tp&, const optional<_Up>&&>,
is_assignable<_Tp&, optional<_Up>&&>>;
/**
* @brief Class template for optional values.
*/
template<typename _Tp>
class optional
: private _Optional_base<_Tp>,
private _Enable_copy_move<
// Copy constructor.
is_copy_constructible<_Tp>::value,
// Copy assignment.
__and_<is_copy_constructible<_Tp>, is_copy_assignable<_Tp>>::value,
// Move constructor.
is_move_constructible<_Tp>::value,
// Move assignment.
__and_<is_move_constructible<_Tp>, is_move_assignable<_Tp>>::value,
// Unique tag type.
optional<_Tp>>
{
static_assert(__and_<__not_<is_same<remove_cv_t<_Tp>, nullopt_t>>,
__not_<is_same<remove_cv_t<_Tp>, in_place_t>>,
__not_<is_reference<_Tp>>>(),
"Invalid instantiation of optional<T>");
private:
using _Base = _Optional_base<_Tp>;
public:
using value_type = _Tp;
// _Optional_base has the responsibility for construction.
using _Base::_Base;
constexpr optional() = default;
// Converting constructors for engaged optionals.
template <typename _Up = _Tp,
enable_if_t<__and_<
__not_<is_same<optional<_Tp>, decay_t<_Up>>>,
is_constructible<_Tp, _Up&&>,
is_convertible<_Up&&, _Tp>
>::value, bool> = true>
constexpr optional(_Up&& __t)
: _Base(in_place, std::forward<_Up>(__t)) { }
template <typename _Up = _Tp,
enable_if_t<__and_<
__not_<is_same<optional<_Tp>, decay_t<_Up>>>,
is_constructible<_Tp, _Up&&>,
__not_<is_convertible<_Up&&, _Tp>>
>::value, bool> = false>
explicit constexpr optional(_Up&& __t)
: _Base(in_place, std::forward<_Up>(__t)) { }
template <typename _Up,
enable_if_t<__and_<
__not_<is_same<_Tp, _Up>>,
is_constructible<_Tp, const _Up&>,
is_convertible<const _Up&, _Tp>,
__not_<__converts_from_optional<_Tp, _Up>>
>::value, bool> = true>
constexpr optional(const optional<_Up>& __t)
{
if (__t)
emplace(*__t);
}
template <typename _Up,
enable_if_t<__and_<
__not_<is_same<_Tp, _Up>>,
is_constructible<_Tp, const _Up&>,
__not_<is_convertible<const _Up&, _Tp>>,
__not_<__converts_from_optional<_Tp, _Up>>
>::value, bool> = false>
explicit constexpr optional(const optional<_Up>& __t)
{
if (__t)
emplace(*__t);
}
template <typename _Up,
enable_if_t<__and_<
__not_<is_same<_Tp, _Up>>,
is_constructible<_Tp, _Up&&>,
is_convertible<_Up&&, _Tp>,
__not_<__converts_from_optional<_Tp, _Up>>
>::value, bool> = true>
constexpr optional(optional<_Up>&& __t)
{
if (__t)
emplace(std::move(*__t));
}
template <typename _Up,
enable_if_t<__and_<
__not_<is_same<_Tp, _Up>>,
is_constructible<_Tp, _Up&&>,
__not_<is_convertible<_Up&&, _Tp>>,
__not_<__converts_from_optional<_Tp, _Up>>
>::value, bool> = false>
explicit constexpr optional(optional<_Up>&& __t)
{
if (__t)
emplace(std::move(*__t));
}
// [X.Y.4.3] (partly) Assignment.
optional&
operator=(nullopt_t) noexcept
{
this->_M_reset();
return *this;
}
template<typename _Up = _Tp>
enable_if_t<__and_<
__not_<is_same<optional<_Tp>, decay_t<_Up>>>,
is_constructible<_Tp, _Up>,
__not_<__and_<is_scalar<_Tp>,
is_same<_Tp, decay_t<_Up>>>>,
is_assignable<_Tp&, _Up>>::value,
optional&>
operator=(_Up&& __u)
{
if (this->_M_is_engaged())
this->_M_get() = std::forward<_Up>(__u);
else
this->_M_construct(std::forward<_Up>(__u));
return *this;
}
template<typename _Up>
enable_if_t<__and_<
__not_<is_same<_Tp, _Up>>,
is_constructible<_Tp, const _Up&>,
is_assignable<_Tp&, _Up>,
__not_<__converts_from_optional<_Tp, _Up>>,
__not_<__assigns_from_optional<_Tp, _Up>>
>::value,
optional&>
operator=(const optional<_Up>& __u)
{
if (__u)
{
if (this->_M_is_engaged())
this->_M_get() = *__u;
else
this->_M_construct(*__u);
}
else
{
this->_M_reset();
}
return *this;
}
template<typename _Up>
enable_if_t<__and_<
__not_<is_same<_Tp, _Up>>,
is_constructible<_Tp, _Up>,
is_assignable<_Tp&, _Up>,
__not_<__converts_from_optional<_Tp, _Up>>,
__not_<__assigns_from_optional<_Tp, _Up>>
>::value,
optional&>
operator=(optional<_Up>&& __u)
{
if (__u)
{
if (this->_M_is_engaged())
this->_M_get() = std::move(*__u);
else
this->_M_construct(std::move(*__u));
}
else
{
this->_M_reset();
}
return *this;
}
template<typename... _Args>
enable_if_t<is_constructible<_Tp, _Args&&...>::value>
emplace(_Args&&... __args)
{
this->_M_reset();
this->_M_construct(std::forward<_Args>(__args)...);
}
template<typename _Up, typename... _Args>
enable_if_t<is_constructible<_Tp, initializer_list<_Up>&,
_Args&&...>::value>
emplace(initializer_list<_Up> __il, _Args&&... __args)
{
this->_M_reset();
this->_M_construct(__il, std::forward<_Args>(__args)...);
}
// [X.Y.4.2] Destructor is implicit, implemented in _Optional_base.
// [X.Y.4.4] Swap.
void
swap(optional& __other)
noexcept(is_nothrow_move_constructible<_Tp>()
&& __is_nothrow_swappable<_Tp>::value)
{
using std::swap;
if (this->_M_is_engaged() && __other._M_is_engaged())
swap(this->_M_get(), __other._M_get());
else if (this->_M_is_engaged())
{
__other._M_construct(std::move(this->_M_get()));
this->_M_destruct();
}
else if (__other._M_is_engaged())
{
this->_M_construct(std::move(__other._M_get()));
__other._M_destruct();
}
}
// [X.Y.4.5] Observers.
constexpr const _Tp*
operator->() const
{
#ifndef __cpp_lib_addressof_constexpr
return __constexpr_addressof(this->_M_get());
#else
return std::__addressof(this->_M_get());
#endif
}
_Tp*
operator->()
{ return std::__addressof(this->_M_get()); }
constexpr const _Tp&
operator*() const&
{ return this->_M_get(); }
constexpr _Tp&
operator*()&
{ return this->_M_get(); }
constexpr _Tp&&
operator*()&&
{ return std::move(this->_M_get()); }
constexpr const _Tp&&
operator*() const&&
{ return std::move(this->_M_get()); }
constexpr explicit operator bool() const noexcept
{ return this->_M_is_engaged(); }
constexpr const _Tp&
value() const&
{
return this->_M_is_engaged()
? this->_M_get()
: (__throw_bad_optional_access("Attempt to access value of a "
"disengaged optional object"),
this->_M_get());
}
constexpr _Tp&
value()&
{
return this->_M_is_engaged()
? this->_M_get()
: (__throw_bad_optional_access("Attempt to access value of a "
"disengaged optional object"),
this->_M_get());
}
constexpr _Tp&&
value()&&
{
return this->_M_is_engaged()
? std::move(this->_M_get())
: (__throw_bad_optional_access("Attempt to access value of a "
"disengaged optional object"),
std::move(this->_M_get()));
}
constexpr const _Tp&&
value() const&&
{
return this->_M_is_engaged()
? std::move(this->_M_get())
: (__throw_bad_optional_access("Attempt to access value of a "
"disengaged optional object"),
std::move(this->_M_get()));
}
template<typename _Up>
constexpr _Tp
value_or(_Up&& __u) const&
{
static_assert(__and_<is_copy_constructible<_Tp>,
is_convertible<_Up&&, _Tp>>(),
"Cannot return value");
return this->_M_is_engaged()
? this->_M_get()
: static_cast<_Tp>(std::forward<_Up>(__u));
}
template<typename _Up>
_Tp
value_or(_Up&& __u) &&
{
static_assert(__and_<is_move_constructible<_Tp>,
is_convertible<_Up&&, _Tp>>(),
"Cannot return value" );
return this->_M_is_engaged()
? std::move(this->_M_get())
: static_cast<_Tp>(std::forward<_Up>(__u));
}
};
// [X.Y.8] Comparisons between optional values.
template<typename _Tp>
constexpr bool
operator==(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
{
return static_cast<bool>(__lhs) == static_cast<bool>(__rhs)
&& (!__lhs || *__lhs == *__rhs);
}
template<typename _Tp>
constexpr bool
operator!=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Tp>
constexpr bool
operator<(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
{
return static_cast<bool>(__rhs) && (!__lhs || *__lhs < *__rhs);
}
template<typename _Tp>
constexpr bool
operator>(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
{ return __rhs < __lhs; }
template<typename _Tp>
constexpr bool
operator<=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Tp>
constexpr bool
operator>=(const optional<_Tp>& __lhs, const optional<_Tp>& __rhs)
{ return !(__lhs < __rhs); }
// [X.Y.9] Comparisons with nullopt.
template<typename _Tp>
constexpr bool
operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept
{ return !__lhs; }
template<typename _Tp>
constexpr bool
operator==(nullopt_t, const optional<_Tp>& __rhs) noexcept
{ return !__rhs; }
template<typename _Tp>
constexpr bool
operator!=(const optional<_Tp>& __lhs, nullopt_t) noexcept
{ return static_cast<bool>(__lhs); }
template<typename _Tp>
constexpr bool
operator!=(nullopt_t, const optional<_Tp>& __rhs) noexcept
{ return static_cast<bool>(__rhs); }
template<typename _Tp>
constexpr bool
operator<(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept
{ return false; }
template<typename _Tp>
constexpr bool
operator<(nullopt_t, const optional<_Tp>& __rhs) noexcept
{ return static_cast<bool>(__rhs); }
template<typename _Tp>
constexpr bool
operator>(const optional<_Tp>& __lhs, nullopt_t) noexcept
{ return static_cast<bool>(__lhs); }
template<typename _Tp>
constexpr bool
operator>(nullopt_t, const optional<_Tp>& /* __rhs */) noexcept
{ return false; }
template<typename _Tp>
constexpr bool
operator<=(const optional<_Tp>& __lhs, nullopt_t) noexcept
{ return !__lhs; }
template<typename _Tp>
constexpr bool
operator<=(nullopt_t, const optional<_Tp>& /* __rhs */) noexcept
{ return true; }
template<typename _Tp>
constexpr bool
operator>=(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept
{ return true; }
template<typename _Tp>
constexpr bool
operator>=(nullopt_t, const optional<_Tp>& __rhs) noexcept
{ return !__rhs; }
// [X.Y.10] Comparisons with value type.
template<typename _Tp>
constexpr bool
operator==(const optional<_Tp>& __lhs, const _Tp& __rhs)
{ return __lhs && *__lhs == __rhs; }
template<typename _Tp>
constexpr bool
operator==(const _Tp& __lhs, const optional<_Tp>& __rhs)
{ return __rhs && __lhs == *__rhs; }
template<typename _Tp>
constexpr bool
operator!=(const optional<_Tp>& __lhs, _Tp const& __rhs)
{ return !__lhs || !(*__lhs == __rhs); }
template<typename _Tp>
constexpr bool
operator!=(const _Tp& __lhs, const optional<_Tp>& __rhs)
{ return !__rhs || !(__lhs == *__rhs); }
template<typename _Tp>
constexpr bool
operator<(const optional<_Tp>& __lhs, const _Tp& __rhs)
{ return !__lhs || *__lhs < __rhs; }
template<typename _Tp>
constexpr bool
operator<(const _Tp& __lhs, const optional<_Tp>& __rhs)
{ return __rhs && __lhs < *__rhs; }
template<typename _Tp>
constexpr bool
operator>(const optional<_Tp>& __lhs, const _Tp& __rhs)
{ return __lhs && __rhs < *__lhs; }
template<typename _Tp>
constexpr bool
operator>(const _Tp& __lhs, const optional<_Tp>& __rhs)
{ return !__rhs || *__rhs < __lhs; }
template<typename _Tp>
constexpr bool
operator<=(const optional<_Tp>& __lhs, const _Tp& __rhs)
{ return !__lhs || !(__rhs < *__lhs); }
template<typename _Tp>
constexpr bool
operator<=(const _Tp& __lhs, const optional<_Tp>& __rhs)
{ return __rhs && !(*__rhs < __lhs); }
template<typename _Tp>
constexpr bool
operator>=(const optional<_Tp>& __lhs, const _Tp& __rhs)
{ return __lhs && !(*__lhs < __rhs); }
template<typename _Tp>
constexpr bool
operator>=(const _Tp& __lhs, const optional<_Tp>& __rhs)
{ return !__rhs || !(__lhs < *__rhs); }
// [X.Y.11]
template<typename _Tp>
inline void
swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs)
noexcept(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
template<typename _Tp>
constexpr optional<decay_t<_Tp>>
make_optional(_Tp&& __t)
{ return optional<decay_t<_Tp>> { std::forward<_Tp>(__t) }; }
// @} group optional
} // namespace fundamentals_v1
} // namespace experimental
// [X.Y.12]
template<typename _Tp>
struct hash<experimental::optional<_Tp>>
{
using result_type = size_t;
using argument_type = experimental::optional<_Tp>;
size_t
operator()(const experimental::optional<_Tp>& __t) const
noexcept(noexcept(hash<_Tp> {}(*__t)))
{
// We pick an arbitrary hash for disengaged optionals which hopefully
// usual values of _Tp won't typically hash to.
constexpr size_t __magic_disengaged_hash = static_cast<size_t>(-3333);
return __t ? hash<_Tp> {}(*__t) : __magic_disengaged_hash;
}
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_OPTIONAL
// <experimental/iterator> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/iterator
* This is a TS C++ Library header.
*/
//
// N4336 Working Draft, C++ Extensions for Library Fundamentals, Version 2
//
#ifndef _GLIBCXX_EXPERIMENTAL_ITERATOR
#define _GLIBCXX_EXPERIMENTAL_ITERATOR 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <iterator>
#include <iosfwd>
#include <experimental/type_traits>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_ostream_joiner 201411
/// Output iterator that inserts a delimiter between elements.
template<typename _DelimT, typename _CharT = char,
typename _Traits = char_traits<_CharT>>
class ostream_joiner
{
public:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef basic_ostream<_CharT, _Traits> ostream_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
ostream_joiner(ostream_type& __os, const _DelimT& __delimiter)
noexcept(is_nothrow_copy_constructible_v<_DelimT>)
: _M_out(std::__addressof(__os)), _M_delim(__delimiter)
{ }
ostream_joiner(ostream_type& __os, _DelimT&& __delimiter)
noexcept(is_nothrow_move_constructible_v<_DelimT>)
: _M_out(std::__addressof(__os)), _M_delim(std::move(__delimiter))
{ }
template<typename _Tp>
ostream_joiner&
operator=(const _Tp& __value)
{
if (!_M_first)
*_M_out << _M_delim;
_M_first = false;
*_M_out << __value;
return *this;
}
ostream_joiner& operator*() noexcept { return *this; }
ostream_joiner& operator++() noexcept { return *this; }
ostream_joiner& operator++(int) noexcept { return *this; }
private:
ostream_type* _M_out;
_DelimT _M_delim;
bool _M_first = true;
};
/// Object generator for ostream_joiner.
template<typename _CharT, typename _Traits, typename _DelimT>
inline ostream_joiner<decay_t<_DelimT>, _CharT, _Traits>
make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os,
_DelimT&& __delimiter)
{ return { __os, std::forward<_DelimT>(__delimiter) }; }
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_ITERATOR
// <experimental/list> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/list
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_LIST
#define _GLIBCXX_EXPERIMENTAL_LIST 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <list>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Tp, typename _Alloc, typename _Predicate>
inline void
erase_if(list<_Tp, _Alloc>& __cont, _Predicate __pred)
{ __cont.remove_if(__pred); }
template<typename _Tp, typename _Alloc, typename _Up>
inline void
erase(list<_Tp, _Alloc>& __cont, const _Up& __value)
{
using __elem_type = typename list<_Tp, _Alloc>::value_type;
erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; });
}
namespace pmr {
template<typename _Tp>
using list = std::list<_Tp, polymorphic_allocator<_Tp>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_LIST
// Components for manipulating non-owning sequences of characters -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/string_view
* This is a TS C++ Library header.
*/
//
// N3762 basic_string_view library
//
#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW
#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <string>
#include <limits>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
#define __cpp_lib_experimental_string_view 201411
/**
* @class basic_string_view <experimental/string_view>
* @brief A non-owning reference to a string.
*
* @ingroup strings
* @ingroup sequences
* @ingroup experimental
*
* @tparam _CharT Type of character
* @tparam _Traits Traits for character type, defaults to
* char_traits<_CharT>.
*
* A basic_string_view looks like this:
*
* @code
* _CharT* _M_str
* size_t _M_len
* @endcode
*/
template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
class basic_string_view
{
public:
// types
using traits_type = _Traits;
using value_type = _CharT;
using pointer = const _CharT*;
using const_pointer = const _CharT*;
using reference = const _CharT&;
using const_reference = const _CharT&;
using const_iterator = const _CharT*;
using iterator = const_iterator;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using reverse_iterator = const_reverse_iterator;
using size_type = size_t;
using difference_type = ptrdiff_t;
static constexpr size_type npos = size_type(-1);
// [string.view.cons], construct/copy
constexpr
basic_string_view() noexcept
: _M_len{0}, _M_str{nullptr}
{ }
constexpr basic_string_view(const basic_string_view&) noexcept = default;
template<typename _Allocator>
basic_string_view(const basic_string<_CharT, _Traits,
_Allocator>& __str) noexcept
: _M_len{__str.length()}, _M_str{__str.data()}
{ }
constexpr basic_string_view(const _CharT* __str)
: _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
_M_str{__str}
{ }
constexpr basic_string_view(const _CharT* __str, size_type __len)
: _M_len{__len},
_M_str{__str}
{ }
basic_string_view&
operator=(const basic_string_view&) noexcept = default;
// [string.view.iterators], iterators
constexpr const_iterator
begin() const noexcept
{ return this->_M_str; }
constexpr const_iterator
end() const noexcept
{ return this->_M_str + this->_M_len; }
constexpr const_iterator
cbegin() const noexcept
{ return this->_M_str; }
constexpr const_iterator
cend() const noexcept
{ return this->_M_str + this->_M_len; }
const_reverse_iterator
rbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
const_reverse_iterator
rend() const noexcept
{ return const_reverse_iterator(this->begin()); }
const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(this->begin()); }
// [string.view.capacity], capacity
constexpr size_type
size() const noexcept
{ return this->_M_len; }
constexpr size_type
length() const noexcept
{ return _M_len; }
constexpr size_type
max_size() const noexcept
{
return (npos - sizeof(size_type) - sizeof(void*))
/ sizeof(value_type) / 4;
}
constexpr bool
empty() const noexcept
{ return this->_M_len == 0; }
// [string.view.access], element access
constexpr const _CharT&
operator[](size_type __pos) const
{
__glibcxx_assert(__pos < this->_M_len);
return *(this->_M_str + __pos);
}
constexpr const _CharT&
at(size_type __pos) const
{
return __pos < this->_M_len
? *(this->_M_str + __pos)
: (__throw_out_of_range_fmt(__N("basic_string_view::at: __pos "
"(which is %zu) >= this->size() "
"(which is %zu)"),
__pos, this->size()),
*this->_M_str);
}
constexpr const _CharT&
front() const
{
__glibcxx_assert(this->_M_len > 0);
return *this->_M_str;
}
constexpr const _CharT&
back() const
{
__glibcxx_assert(this->_M_len > 0);
return *(this->_M_str + this->_M_len - 1);
}
constexpr const _CharT*
data() const noexcept
{ return this->_M_str; }
// [string.view.modifiers], modifiers:
constexpr void
remove_prefix(size_type __n)
{
__glibcxx_assert(this->_M_len >= __n);
this->_M_str += __n;
this->_M_len -= __n;
}
constexpr void
remove_suffix(size_type __n)
{ this->_M_len -= __n; }
constexpr void
swap(basic_string_view& __sv) noexcept
{
auto __tmp = *this;
*this = __sv;
__sv = __tmp;
}
// [string.view.ops], string operations:
template<typename _Allocator>
explicit operator basic_string<_CharT, _Traits, _Allocator>() const
{
return { this->_M_str, this->_M_len };
}
template<typename _Allocator = std::allocator<_CharT>>
basic_string<_CharT, _Traits, _Allocator>
to_string(const _Allocator& __alloc = _Allocator()) const
{
return { this->_M_str, this->_M_len, __alloc };
}
size_type
copy(_CharT* __str, size_type __n, size_type __pos = 0) const
{
__glibcxx_requires_string_len(__str, __n);
if (__pos > this->_M_len)
__throw_out_of_range_fmt(__N("basic_string_view::copy: __pos "
"(which is %zu) > this->size() "
"(which is %zu)"),
__pos, this->size());
size_type __rlen{std::min(__n, size_type{this->_M_len - __pos})};
for (auto __begin = this->_M_str + __pos,
__end = __begin + __rlen; __begin != __end;)
*__str++ = *__begin++;
return __rlen;
}
// [string.view.ops], string operations:
constexpr basic_string_view
substr(size_type __pos = 0, size_type __n = npos) const
{
return __pos <= this->_M_len
? basic_string_view{this->_M_str + __pos,
std::min(__n, size_type{this->_M_len - __pos})}
: (__throw_out_of_range_fmt(__N("basic_string_view::substr: __pos "
"(which is %zu) > this->size() "
"(which is %zu)"),
__pos, this->size()), basic_string_view{});
}
constexpr int
compare(basic_string_view __str) const noexcept
{
int __ret = traits_type::compare(this->_M_str, __str._M_str,
std::min(this->_M_len, __str._M_len));
if (__ret == 0)
__ret = _S_compare(this->_M_len, __str._M_len);
return __ret;
}
constexpr int
compare(size_type __pos1, size_type __n1, basic_string_view __str) const
{ return this->substr(__pos1, __n1).compare(__str); }
constexpr int
compare(size_type __pos1, size_type __n1,
basic_string_view __str, size_type __pos2, size_type __n2) const
{ return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); }
constexpr int
compare(const _CharT* __str) const noexcept
{ return this->compare(basic_string_view{__str}); }
constexpr int
compare(size_type __pos1, size_type __n1, const _CharT* __str) const
{ return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
constexpr int
compare(size_type __pos1, size_type __n1,
const _CharT* __str, size_type __n2) const
{
return this->substr(__pos1, __n1)
.compare(basic_string_view(__str, __n2));
}
constexpr size_type
find(basic_string_view __str, size_type __pos = 0) const noexcept
{ return this->find(__str._M_str, __pos, __str._M_len); }
constexpr size_type
find(_CharT __c, size_type __pos=0) const noexcept;
constexpr size_type
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
constexpr size_type
find(const _CharT* __str, size_type __pos=0) const noexcept
{ return this->find(__str, __pos, traits_type::length(__str)); }
constexpr size_type
rfind(basic_string_view __str, size_type __pos = npos) const noexcept
{ return this->rfind(__str._M_str, __pos, __str._M_len); }
constexpr size_type
rfind(_CharT __c, size_type __pos = npos) const noexcept;
constexpr size_type
rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
constexpr size_type
rfind(const _CharT* __str, size_type __pos = npos) const noexcept
{ return this->rfind(__str, __pos, traits_type::length(__str)); }
constexpr size_type
find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
{ return this->find_first_of(__str._M_str, __pos, __str._M_len); }
constexpr size_type
find_first_of(_CharT __c, size_type __pos = 0) const noexcept
{ return this->find(__c, __pos); }
constexpr size_type
find_first_of(const _CharT* __str, size_type __pos, size_type __n) const;
constexpr size_type
find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
{ return this->find_first_of(__str, __pos, traits_type::length(__str)); }
constexpr size_type
find_last_of(basic_string_view __str,
size_type __pos = npos) const noexcept
{ return this->find_last_of(__str._M_str, __pos, __str._M_len); }
constexpr size_type
find_last_of(_CharT __c, size_type __pos=npos) const noexcept
{ return this->rfind(__c, __pos); }
constexpr size_type
find_last_of(const _CharT* __str, size_type __pos, size_type __n) const;
constexpr size_type
find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
{ return this->find_last_of(__str, __pos, traits_type::length(__str)); }
constexpr size_type
find_first_not_of(basic_string_view __str,
size_type __pos = 0) const noexcept
{ return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
constexpr size_type
find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
constexpr size_type
find_first_not_of(const _CharT* __str,
size_type __pos, size_type __n) const;
constexpr size_type
find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
{
return this->find_first_not_of(__str, __pos,
traits_type::length(__str));
}
constexpr size_type
find_last_not_of(basic_string_view __str,
size_type __pos = npos) const noexcept
{ return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
constexpr size_type
find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
constexpr size_type
find_last_not_of(const _CharT* __str,
size_type __pos, size_type __n) const;
constexpr size_type
find_last_not_of(const _CharT* __str,
size_type __pos = npos) const noexcept
{
return this->find_last_not_of(__str, __pos,
traits_type::length(__str));
}
private:
static constexpr int
_S_compare(size_type __n1, size_type __n2) noexcept
{
return difference_type(__n1 - __n2) > std::numeric_limits<int>::max()
? std::numeric_limits<int>::max()
: difference_type(__n1 - __n2) < std::numeric_limits<int>::min()
? std::numeric_limits<int>::min()
: static_cast<int>(difference_type(__n1 - __n2));
}
size_t _M_len;
const _CharT* _M_str;
};
// [string.view.comparison], non-member basic_string_view comparison functions
namespace __detail
{
// Identity transform to create a non-deduced context, so that only one
// argument participates in template argument deduction and the other
// argument gets implicitly converted to the deduced type. See n3766.html.
template<typename _Tp>
using __idt = common_type_t<_Tp>;
}
template<typename _CharT, typename _Traits>
constexpr bool
operator==(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator==(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator!=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
operator!=(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
operator< (basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator< (basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator> (basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator> (basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator<=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator<=(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator>=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator>=(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
// [string.view.io], Inserters and extractors
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
basic_string_view<_CharT,_Traits> __str)
{ return __ostream_insert(__os, __str.data(), __str.size()); }
// basic_string_view typedef names
using string_view = basic_string_view<char>;
#ifdef _GLIBCXX_USE_WCHAR_T
using wstring_view = basic_string_view<wchar_t>;
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
using u16string_view = basic_string_view<char16_t>;
using u32string_view = basic_string_view<char32_t>;
#endif
} // namespace fundamentals_v1
} // namespace experimental
// [string.view.hash], hash support:
template<typename _Tp>
struct hash;
template<>
struct hash<experimental::string_view>
: public __hash_base<size_t, experimental::string_view>
{
size_t
operator()(const experimental::string_view& __str) const noexcept
{ return std::_Hash_impl::hash(__str.data(), __str.length()); }
};
template<>
struct __is_fast_hash<hash<experimental::string_view>> : std::false_type
{ };
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
struct hash<experimental::wstring_view>
: public __hash_base<size_t, wstring>
{
size_t
operator()(const experimental::wstring_view& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(wchar_t)); }
};
template<>
struct __is_fast_hash<hash<experimental::wstring_view>> : std::false_type
{ };
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
template<>
struct hash<experimental::u16string_view>
: public __hash_base<size_t, experimental::u16string_view>
{
size_t
operator()(const experimental::u16string_view& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(char16_t)); }
};
template<>
struct __is_fast_hash<hash<experimental::u16string_view>> : std::false_type
{ };
template<>
struct hash<experimental::u32string_view>
: public __hash_base<size_t, experimental::u32string_view>
{
size_t
operator()(const experimental::u32string_view& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(char32_t)); }
};
template<>
struct __is_fast_hash<hash<experimental::u32string_view>> : std::false_type
{ };
#endif
namespace experimental
{
// I added these EMSR.
inline namespace literals
{
inline namespace string_view_literals
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
inline constexpr basic_string_view<char>
operator""sv(const char* __str, size_t __len) noexcept
{ return basic_string_view<char>{__str, __len}; }
#ifdef _GLIBCXX_USE_WCHAR_T
inline constexpr basic_string_view<wchar_t>
operator""sv(const wchar_t* __str, size_t __len) noexcept
{ return basic_string_view<wchar_t>{__str, __len}; }
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
inline constexpr basic_string_view<char16_t>
operator""sv(const char16_t* __str, size_t __len) noexcept
{ return basic_string_view<char16_t>{__str, __len}; }
inline constexpr basic_string_view<char32_t>
operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
#endif
#pragma GCC diagnostic pop
} // namespace string_literals
} // namespace literals
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <experimental/bits/string_view.tcc>
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW
// <experimental/unordered_set> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/unordered_set
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_UNORDERED_SET
#define _GLIBCXX_EXPERIMENTAL_UNORDERED_SET 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <unordered_set>
#include <experimental/bits/erase_if.h>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Key, typename _Hash, typename _CPred, typename _Alloc,
typename _Predicate>
inline void
erase_if(unordered_set<_Key, _Hash, _CPred, _Alloc>& __cont,
_Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
template<typename _Key, typename _Hash, typename _CPred, typename _Alloc,
typename _Predicate>
inline void
erase_if(unordered_multiset<_Key, _Hash, _CPred, _Alloc>& __cont,
_Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
namespace pmr {
template<typename _Key, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>>
using unordered_set
= std::unordered_set<_Key, _Hash, _Pred, polymorphic_allocator<_Key>>;
template<typename _Key, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>>
using unordered_multiset
= std::unordered_multiset<_Key, _Hash, _Pred,
polymorphic_allocator<_Key>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_UNORDERED_SET
// <experimental/string> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/string
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_STRING
#define _GLIBCXX_EXPERIMENTAL_STRING 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <string>
#include <algorithm>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _CharT, typename _Traits, typename _Alloc,
typename _Predicate>
inline void
erase_if(basic_string<_CharT, _Traits, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
__cont.end());
}
template<typename _CharT, typename _Traits, typename _Alloc, typename _Up>
inline void
erase(basic_string<_CharT, _Traits, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
__cont.end());
}
#if _GLIBCXX_USE_CXX11_ABI
namespace pmr
{
// basic_string using polymorphic allocator in namespace pmr
template<typename _CharT, typename _Traits = char_traits<_CharT>>
using basic_string =
std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>;
// basic_string typedef names using polymorphic allocator in namespace
// std::experimental::pmr
typedef basic_string<char> string;
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
typedef basic_string<wchar_t> wstring;
} // namespace pmr
#endif
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_STRING
// <experimental/tuple> -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/tuple
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_TUPLE
#define _GLIBCXX_EXPERIMENTAL_TUPLE 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <tuple>
#include <bits/invoke.h>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
// See C++14 §20.4.2.5, tuple helper classes
template <typename _Tp>
constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
#define __cpp_lib_experimental_tuple 201402
template <typename _Fn, typename _Tuple, std::size_t... _Idx>
constexpr decltype(auto)
__apply_impl(_Fn&& __f, _Tuple&& __t, std::index_sequence<_Idx...>)
{
return std::__invoke(std::forward<_Fn>(__f),
std::get<_Idx>(std::forward<_Tuple>(__t))...);
}
template <typename _Fn, typename _Tuple>
constexpr decltype(auto)
apply(_Fn&& __f, _Tuple&& __t)
{
using _Indices =
std::make_index_sequence<tuple_size_v<std::decay_t<_Tuple>>>;
return experimental::__apply_impl(std::forward<_Fn>(__f),
std::forward<_Tuple>(__t),
_Indices{});
}
} // namespace fundamentals_v1
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_TUPLE
// <experimental/any> -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/any
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_ANY
#define _GLIBCXX_EXPERIMENTAL_ANY 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <typeinfo>
#include <new>
#include <utility>
#include <type_traits>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
/**
* @defgroup any Type-safe container of any type
* @ingroup experimental
*
* A type-safe container for single values of value types, as
* described in n3804 "Any Library Proposal (Revision 3)".
*
* @{
*/
#define __cpp_lib_experimental_any 201411
/**
* @brief Exception class thrown by a failed @c any_cast
* @ingroup exceptions
*/
class bad_any_cast : public bad_cast
{
public:
virtual const char* what() const noexcept { return "bad any_cast"; }
};
[[gnu::noreturn]] inline void __throw_bad_any_cast()
{
#if __cpp_exceptions
throw bad_any_cast{};
#else
__builtin_abort();
#endif
}
/**
* @brief A type-safe container of any type.
*
* An @c any object's state is either empty or it stores a contained object
* of CopyConstructible type.
*/
class any
{
// Holds either pointer to a heap object or the contained object itself.
union _Storage
{
// This constructor intentionally doesn't initialize anything.
_Storage() = default;
// Prevent trivial copies of this type, buffer might hold a non-POD.
_Storage(const _Storage&) = delete;
_Storage& operator=(const _Storage&) = delete;
void* _M_ptr;
aligned_storage<sizeof(_M_ptr), alignof(void*)>::type _M_buffer;
};
template<typename _Tp, typename _Safe = is_nothrow_move_constructible<_Tp>,
bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))
&& (alignof(_Tp) <= alignof(_Storage))>
using _Internal = std::integral_constant<bool, _Safe::value && _Fits>;
template<typename _Tp>
struct _Manager_internal; // uses small-object optimization
template<typename _Tp>
struct _Manager_external; // creates contained object on the heap
template<typename _Tp>
using _Manager = conditional_t<_Internal<_Tp>::value,
_Manager_internal<_Tp>,
_Manager_external<_Tp>>;
template<typename _Tp, typename _Decayed = decay_t<_Tp>>
using _Decay = enable_if_t<!is_same<_Decayed, any>::value, _Decayed>;
public:
// construct/destruct
/// Default constructor, creates an empty object.
any() noexcept : _M_manager(nullptr) { }
/// Copy constructor, copies the state of @p __other
any(const any& __other)
{
if (__other.empty())
_M_manager = nullptr;
else
{
_Arg __arg;
__arg._M_any = this;
__other._M_manager(_Op_clone, &__other, &__arg);
}
}
/**
* @brief Move constructor, transfer the state from @p __other
*
* @post @c __other.empty() (this postcondition is a GNU extension)
*/
any(any&& __other) noexcept
{
if (__other.empty())
_M_manager = nullptr;
else
{
_Arg __arg;
__arg._M_any = this;
__other._M_manager(_Op_xfer, &__other, &__arg);
}
}
/// Construct with a copy of @p __value as the contained object.
template <typename _ValueType, typename _Tp = _Decay<_ValueType>,
typename _Mgr = _Manager<_Tp>,
typename enable_if<is_constructible<_Tp, _ValueType&&>::value,
bool>::type = true>
any(_ValueType&& __value)
: _M_manager(&_Mgr::_S_manage)
{
_Mgr::_S_create(_M_storage, std::forward<_ValueType>(__value));
static_assert(is_copy_constructible<_Tp>::value,
"The contained object must be CopyConstructible");
}
/// Construct with a copy of @p __value as the contained object.
template <typename _ValueType, typename _Tp = _Decay<_ValueType>,
typename _Mgr = _Manager<_Tp>,
typename enable_if<!is_constructible<_Tp, _ValueType&&>::value,
bool>::type = false>
any(_ValueType&& __value)
: _M_manager(&_Mgr::_S_manage)
{
_Mgr::_S_create(_M_storage, __value);
static_assert(is_copy_constructible<_Tp>::value,
"The contained object must be CopyConstructible");
}
/// Destructor, calls @c clear()
~any() { clear(); }
// assignments
/// Copy the state of another object.
any& operator=(const any& __rhs)
{
*this = any(__rhs);
return *this;
}
/**
* @brief Move assignment operator
*
* @post @c __rhs.empty() (not guaranteed for other implementations)
*/
any& operator=(any&& __rhs) noexcept
{
if (__rhs.empty())
clear();
else if (this != &__rhs)
{
clear();
_Arg __arg;
__arg._M_any = this;
__rhs._M_manager(_Op_xfer, &__rhs, &__arg);
}
return *this;
}
/// Store a copy of @p __rhs as the contained object.
template<typename _ValueType>
enable_if_t<!is_same<any, decay_t<_ValueType>>::value, any&>
operator=(_ValueType&& __rhs)
{
*this = any(std::forward<_ValueType>(__rhs));
return *this;
}
// modifiers
/// If not empty, destroy the contained object.
void clear() noexcept
{
if (!empty())
{
_M_manager(_Op_destroy, this, nullptr);
_M_manager = nullptr;
}
}
/// Exchange state with another object.
void swap(any& __rhs) noexcept
{
if (empty() && __rhs.empty())
return;
if (!empty() && !__rhs.empty())
{
if (this == &__rhs)
return;
any __tmp;
_Arg __arg;
__arg._M_any = &__tmp;
__rhs._M_manager(_Op_xfer, &__rhs, &__arg);
__arg._M_any = &__rhs;
_M_manager(_Op_xfer, this, &__arg);
__arg._M_any = this;
__tmp._M_manager(_Op_xfer, &__tmp, &__arg);
}
else
{
any* __empty = empty() ? this : &__rhs;
any* __full = empty() ? &__rhs : this;
_Arg __arg;
__arg._M_any = __empty;
__full->_M_manager(_Op_xfer, __full, &__arg);
}
}
// observers
/// Reports whether there is a contained object or not.
bool empty() const noexcept { return _M_manager == nullptr; }
#if __cpp_rtti
/// The @c typeid of the contained object, or @c typeid(void) if empty.
const type_info& type() const noexcept
{
if (empty())
return typeid(void);
_Arg __arg;
_M_manager(_Op_get_type_info, this, &__arg);
return *__arg._M_typeinfo;
}
#endif
template<typename _Tp>
static constexpr bool __is_valid_cast()
{ return __or_<is_reference<_Tp>, is_copy_constructible<_Tp>>::value; }
private:
enum _Op {
_Op_access, _Op_get_type_info, _Op_clone, _Op_destroy, _Op_xfer
};
union _Arg
{
void* _M_obj;
const std::type_info* _M_typeinfo;
any* _M_any;
};
void (*_M_manager)(_Op, const any*, _Arg*);
_Storage _M_storage;
template<typename _Tp>
friend enable_if_t<is_object<_Tp>::value, void*>
__any_caster(const any* __any);
// Manage in-place contained object.
template<typename _Tp>
struct _Manager_internal
{
static void
_S_manage(_Op __which, const any* __anyp, _Arg* __arg);
template<typename _Up>
static void
_S_create(_Storage& __storage, _Up&& __value)
{
void* __addr = &__storage._M_buffer;
::new (__addr) _Tp(std::forward<_Up>(__value));
}
};
// Manage external contained object.
template<typename _Tp>
struct _Manager_external
{
static void
_S_manage(_Op __which, const any* __anyp, _Arg* __arg);
template<typename _Up>
static void
_S_create(_Storage& __storage, _Up&& __value)
{
__storage._M_ptr = new _Tp(std::forward<_Up>(__value));
}
};
};
/// Exchange the states of two @c any objects.
inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
/**
* @brief Access the contained object.
*
* @tparam _ValueType A const-reference or CopyConstructible type.
* @param __any The object to access.
* @return The contained object.
* @throw bad_any_cast If <code>
* __any.type() != typeid(remove_reference_t<_ValueType>)
* </code>
*/
template<typename _ValueType>
inline _ValueType any_cast(const any& __any)
{
static_assert(any::__is_valid_cast<_ValueType>(),
"Template argument must be a reference or CopyConstructible type");
auto __p = any_cast<add_const_t<remove_reference_t<_ValueType>>>(&__any);
if (__p)
return *__p;
__throw_bad_any_cast();
}
/**
* @brief Access the contained object.
*
* @tparam _ValueType A reference or CopyConstructible type.
* @param __any The object to access.
* @return The contained object.
* @throw bad_any_cast If <code>
* __any.type() != typeid(remove_reference_t<_ValueType>)
* </code>
*
* @{
*/
template<typename _ValueType>
inline _ValueType any_cast(any& __any)
{
static_assert(any::__is_valid_cast<_ValueType>(),
"Template argument must be a reference or CopyConstructible type");
auto __p = any_cast<remove_reference_t<_ValueType>>(&__any);
if (__p)
return *__p;
__throw_bad_any_cast();
}
template<typename _ValueType,
typename enable_if<!is_move_constructible<_ValueType>::value
|| is_lvalue_reference<_ValueType>::value,
bool>::type = true>
inline _ValueType any_cast(any&& __any)
{
static_assert(any::__is_valid_cast<_ValueType>(),
"Template argument must be a reference or CopyConstructible type");
auto __p = any_cast<remove_reference_t<_ValueType>>(&__any);
if (__p)
return *__p;
__throw_bad_any_cast();
}
template<typename _ValueType,
typename enable_if<is_move_constructible<_ValueType>::value
&& !is_lvalue_reference<_ValueType>::value,
bool>::type = false>
inline _ValueType any_cast(any&& __any)
{
static_assert(any::__is_valid_cast<_ValueType>(),
"Template argument must be a reference or CopyConstructible type");
auto __p = any_cast<remove_reference_t<_ValueType>>(&__any);
if (__p)
return std::move(*__p);
__throw_bad_any_cast();
}
// @}
/// @cond undocumented
template<typename _Tp>
enable_if_t<is_object<_Tp>::value, void*>
__any_caster(const any* __any)
{
// any_cast<T> returns non-null if __any->type() == typeid(T) and
// typeid(T) ignores cv-qualifiers so remove them:
using _Up = remove_cv_t<_Tp>;
// The contained value has a decayed type, so if decay_t<U> is not U,
// then it's not possible to have a contained value of type U.
using __does_not_decay = is_same<decay_t<_Up>, _Up>;
// Only copy constructible types can be used for contained values.
using __is_copyable = is_copy_constructible<_Up>;
// If the type _Tp could never be stored in an any we don't want to
// instantiate _Manager<_Tp>, so use _Manager<any::_Op> instead, which
// is explicitly specialized and has a no-op _S_manage function.
using _Vp = conditional_t<__and_<__does_not_decay, __is_copyable>::value,
_Up, any::_Op>;
// First try comparing function addresses, which works without RTTI
if (__any->_M_manager == &any::_Manager<_Vp>::_S_manage
#if __cpp_rtti
|| __any->type() == typeid(_Tp)
#endif
)
{
any::_Arg __arg;
__any->_M_manager(any::_Op_access, __any, &__arg);
return __arg._M_obj;
}
return nullptr;
}
// This overload exists so that std::any_cast<void(*)()>(a) is well-formed.
template<typename _Tp>
enable_if_t<!is_object<_Tp>::value, _Tp*>
__any_caster(const any*) noexcept
{ return nullptr; }
/// @endcond
/**
* @brief Access the contained object.
*
* @tparam _ValueType The type of the contained object.
* @param __any A pointer to the object to access.
* @return The address of the contained object if <code>
* __any != nullptr && __any.type() == typeid(_ValueType)
* </code>, otherwise a null pointer.
*
* @{
*/
template<typename _ValueType>
inline const _ValueType* any_cast(const any* __any) noexcept
{
if (__any)
return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
return nullptr;
}
template<typename _ValueType>
inline _ValueType* any_cast(any* __any) noexcept
{
if (__any)
return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
return nullptr;
}
// @}
template<typename _Tp>
void
any::_Manager_internal<_Tp>::
_S_manage(_Op __which, const any* __any, _Arg* __arg)
{
// The contained object is in _M_storage._M_buffer
auto __ptr = reinterpret_cast<const _Tp*>(&__any->_M_storage._M_buffer);
switch (__which)
{
case _Op_access:
__arg->_M_obj = const_cast<_Tp*>(__ptr);
break;
case _Op_get_type_info:
#if __cpp_rtti
__arg->_M_typeinfo = &typeid(_Tp);
#endif
break;
case _Op_clone:
::new(&__arg->_M_any->_M_storage._M_buffer) _Tp(*__ptr);
__arg->_M_any->_M_manager = __any->_M_manager;
break;
case _Op_destroy:
__ptr->~_Tp();
break;
case _Op_xfer:
::new(&__arg->_M_any->_M_storage._M_buffer) _Tp
(std::move(*const_cast<_Tp*>(__ptr)));
__ptr->~_Tp();
__arg->_M_any->_M_manager = __any->_M_manager;
const_cast<any*>(__any)->_M_manager = nullptr;
break;
}
}
template<typename _Tp>
void
any::_Manager_external<_Tp>::
_S_manage(_Op __which, const any* __any, _Arg* __arg)
{
// The contained object is *_M_storage._M_ptr
auto __ptr = static_cast<const _Tp*>(__any->_M_storage._M_ptr);
switch (__which)
{
case _Op_access:
__arg->_M_obj = const_cast<_Tp*>(__ptr);
break;
case _Op_get_type_info:
#if __cpp_rtti
__arg->_M_typeinfo = &typeid(_Tp);
#endif
break;
case _Op_clone:
__arg->_M_any->_M_storage._M_ptr = new _Tp(*__ptr);
__arg->_M_any->_M_manager = __any->_M_manager;
break;
case _Op_destroy:
delete __ptr;
break;
case _Op_xfer:
__arg->_M_any->_M_storage._M_ptr = __any->_M_storage._M_ptr;
__arg->_M_any->_M_manager = __any->_M_manager;
const_cast<any*>(__any)->_M_manager = nullptr;
break;
}
}
// Dummy specialization used by __any_caster.
template<>
struct any::_Manager_internal<any::_Op>
{
static void
_S_manage(_Op, const any*, _Arg*) { }
};
// @} group any
} // namespace fundamentals_v1
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_ANY
// <experimental/random> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/random
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_RANDOM
#define _GLIBCXX_EXPERIMENTAL_RANDOM 1
#if __cplusplus >= 201402L
#include <random>
#include <experimental/bits/lfts_config.h>
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental {
inline namespace fundamentals_v2 {
#define __cpp_lib_experimental_randint 201511
inline std::default_random_engine&
_S_randint_engine()
{
static thread_local default_random_engine __eng{random_device{}()};
return __eng;
}
// 13.2.2.1, Function template randint
template<typename _IntType>
inline _IntType
randint(_IntType __a, _IntType __b)
{
static_assert(is_integral<_IntType>::value && sizeof(_IntType) > 1,
"argument must be an integer type");
using _Dist = std::uniform_int_distribution<_IntType>;
// This relies on the fact our uniform_int_distribution is stateless,
// otherwise we'd need a static thread_local _Dist and pass it
// _Dist::param_type{__a, __b}.
return _Dist(__a, __b)(_S_randint_engine());
}
inline void
reseed()
{
_S_randint_engine().seed(random_device{}());
}
inline void
reseed(default_random_engine::result_type __value)
{
_S_randint_engine().seed(__value);
}
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_RANDOM
// <experimental/source_location> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/source_location
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_SRCLOC
#define _GLIBCXX_EXPERIMENTAL_SRCLOC 1
#if __cplusplus >= 201402L
#include <cstdint>
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental {
inline namespace fundamentals_v2 {
#define __cpp_lib_experimental_source_location 201505
struct source_location
{
#ifndef _GLIBCXX_USE_C99_STDINT_TR1
private:
using uint_least32_t = unsigned;
public:
#endif
// 14.1.2, source_location creation
static constexpr source_location
current(const char* __file = __builtin_FILE(),
const char* __func = __builtin_FUNCTION(),
int __line = __builtin_LINE(),
int __col = 0) noexcept
{
source_location __loc;
__loc._M_file = __file;
__loc._M_func = __func;
__loc._M_line = __line;
__loc._M_col = __col;
return __loc;
}
constexpr source_location() noexcept
: _M_file("unknown"), _M_func(_M_file), _M_line(0), _M_col(0)
{ }
// 14.1.3, source_location field access
constexpr uint_least32_t line() const noexcept { return _M_line; }
constexpr uint_least32_t column() const noexcept { return _M_col; }
constexpr const char* file_name() const noexcept { return _M_file; }
constexpr const char* function_name() const noexcept { return _M_func; }
private:
const char* _M_file;
const char* _M_func;
uint_least32_t _M_line;
uint_least32_t _M_col;
};
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_SRCLOC
// <experimental/propagate_const> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/propagate_const
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST
#define _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <type_traits>
#include <bits/functional_hash.h>
#include <bits/move.h>
#include <bits/stl_function.h>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
/**
* @defgroup propagate_const Const-propagating wrapper
* @ingroup experimental
*
* A const-propagating wrapper that propagates const to pointer-like members,
* as described in n4388 "A Proposal to Add a Const-Propagating Wrapper
* to the Standard Library".
*
* @{
*/
/// Const-propagating wrapper.
template <typename _Tp>
class propagate_const
{
public:
typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type;
private:
template <typename _Up>
struct __is_propagate_const : false_type
{ };
template <typename _Up>
struct __is_propagate_const<propagate_const<_Up>> : true_type
{ };
template <typename _Up>
friend constexpr const _Up&
get_underlying(const propagate_const<_Up>& __pt) noexcept;
template <typename _Up>
friend constexpr _Up&
get_underlying(propagate_const<_Up>& __pt) noexcept;
template <typename _Up>
static constexpr element_type*
__to_raw_pointer(_Up* __u)
{ return __u; }
template <typename _Up>
static constexpr element_type*
__to_raw_pointer(_Up& __u)
{ return __u.get(); }
template <typename _Up>
static constexpr const element_type*
__to_raw_pointer(const _Up* __u)
{ return __u; }
template <typename _Up>
static constexpr const element_type*
__to_raw_pointer(const _Up& __u)
{ return __u.get(); }
public:
static_assert(__and_<is_object<typename remove_pointer<_Tp>::type>,
__not_<is_array<_Tp>>,
__or_<is_class<_Tp>, is_pointer<_Tp>>>::value,
"propagate_const requires a class or a pointer to an"
" object type");
// [propagate_const.ctor], constructors
constexpr propagate_const() = default;
propagate_const(const propagate_const& __p) = delete;
constexpr propagate_const(propagate_const&& __p) = default;
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
is_convertible<_Up&&, _Tp>>::value, bool
>::type=true>
constexpr propagate_const(propagate_const<_Up>&& __pu)
: _M_t(std::move(get_underlying(__pu)))
{}
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
__not_<is_convertible<_Up&&, _Tp>>>::value,
bool>::type=false>
constexpr explicit propagate_const(propagate_const<_Up>&& __pu)
: _M_t(std::move(get_underlying(__pu)))
{}
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
is_convertible<_Up&&, _Tp>,
__not_<__is_propagate_const<
typename decay<_Up>::type>>
>::value, bool>::type=true>
constexpr propagate_const(_Up&& __u)
: _M_t(std::forward<_Up>(__u))
{}
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
__not_<is_convertible<_Up&&, _Tp>>,
__not_<__is_propagate_const<
typename decay<_Up>::type>>
>::value, bool>::type=false>
constexpr explicit propagate_const(_Up&& __u)
: _M_t(std::forward<_Up>(__u))
{}
// [propagate_const.assignment], assignment
propagate_const& operator=(const propagate_const& __p) = delete;
constexpr propagate_const& operator=(propagate_const&& __p) = default;
template <typename _Up, typename =
typename enable_if<is_convertible<_Up&&, _Tp>::value>::type>
constexpr propagate_const& operator=(propagate_const<_Up>&& __pu)
{
_M_t = std::move(get_underlying(__pu));
return *this;
}
template <typename _Up, typename =
typename enable_if<__and_<is_convertible<_Up&&, _Tp>,
__not_<__is_propagate_const<
typename decay<_Up>::type>>
>::value>::type>
constexpr propagate_const& operator=(_Up&& __u)
{
_M_t = std::forward<_Up>(__u);
return *this;
}
// [propagate_const.const_observers], const observers
explicit constexpr operator bool() const
{
return bool(_M_t);
}
constexpr const element_type* operator->() const
{
return get();
}
template <typename _Up = _Tp,
typename enable_if<__or_<is_pointer<_Up>,
is_convertible<_Up,
const element_type*>
>::value, bool>::type = true>
constexpr operator const element_type*() const
{
return get();
}
constexpr const element_type& operator*() const
{
return *get();
}
constexpr const element_type* get() const
{
return __to_raw_pointer(_M_t);
}
// [propagate_const.non_const_observers], non-const observers
constexpr element_type* operator->()
{
return get();
}
template <typename _Up = _Tp,
typename enable_if<__or_<is_pointer<_Up>,
is_convertible<_Up,
const element_type*>
>::value, bool>::type = true>
constexpr operator element_type*()
{
return get();
}
constexpr element_type& operator*()
{
return *get();
}
constexpr element_type* get()
{
return __to_raw_pointer(_M_t);
}
// [propagate_const.modifiers], modifiers
constexpr void
swap(propagate_const& __pt) noexcept(__is_nothrow_swappable<_Tp>::value)
{
using std::swap;
swap(_M_t, get_underlying(__pt));
}
private:
_Tp _M_t;
};
// [propagate_const.relational], relational operators
template <typename _Tp>
constexpr bool
operator==(const propagate_const<_Tp>& __pt, nullptr_t)
{
return get_underlying(__pt) == nullptr;
}
template <typename _Tp>
constexpr bool
operator==(nullptr_t, const propagate_const<_Tp>& __pu)
{
return nullptr == get_underlying(__pu);
}
template <typename _Tp>
constexpr bool
operator!=(const propagate_const<_Tp>& __pt, nullptr_t)
{
return get_underlying(__pt) != nullptr;
}
template <typename _Tp>
constexpr bool operator!=(nullptr_t, const propagate_const<_Tp>& __pu)
{
return nullptr != get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator==(const propagate_const<_Tp>& __pt,
const propagate_const<_Up>& __pu)
{
return get_underlying(__pt) == get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator!=(const propagate_const<_Tp>& __pt,
const propagate_const<_Up>& __pu)
{
return get_underlying(__pt) != get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator<(const propagate_const<_Tp>& __pt,
const propagate_const<_Up>& __pu)
{
return get_underlying(__pt) < get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator>(const propagate_const<_Tp>& __pt,
const propagate_const<_Up>& __pu)
{
return get_underlying(__pt) > get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator<=(const propagate_const<_Tp>& __pt,
const propagate_const<_Up>& __pu)
{
return get_underlying(__pt) <= get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator>=(const propagate_const<_Tp>& __pt,
const propagate_const<_Up>& __pu)
{
return get_underlying(__pt) >= get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator==(const propagate_const<_Tp>& __pt, const _Up& __u)
{
return get_underlying(__pt) == __u;
}
template <typename _Tp, typename _Up>
constexpr bool
operator!=(const propagate_const<_Tp>& __pt, const _Up& __u)
{
return get_underlying(__pt) != __u;
}
template <typename _Tp, typename _Up>
constexpr bool
operator<(const propagate_const<_Tp>& __pt, const _Up& __u)
{
return get_underlying(__pt) < __u;
}
template <typename _Tp, typename _Up>
constexpr bool
operator>(const propagate_const<_Tp>& __pt, const _Up& __u)
{
return get_underlying(__pt) > __u;
}
template <typename _Tp, typename _Up>
constexpr bool
operator<=(const propagate_const<_Tp>& __pt, const _Up& __u)
{
return get_underlying(__pt) <= __u;
}
template <typename _Tp, typename _Up>
constexpr bool
operator>=(const propagate_const<_Tp>& __pt, const _Up& __u)
{
return get_underlying(__pt) >= __u;
}
template <typename _Tp, typename _Up>
constexpr bool
operator==(const _Tp& __t, const propagate_const<_Up>& __pu)
{
return __t == get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator!=(const _Tp& __t, const propagate_const<_Up>& __pu)
{
return __t != get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator<(const _Tp& __t, const propagate_const<_Up>& __pu)
{
return __t < get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator>(const _Tp& __t, const propagate_const<_Up>& __pu)
{
return __t > get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator<=(const _Tp& __t, const propagate_const<_Up>& __pu)
{
return __t <= get_underlying(__pu);
}
template <typename _Tp, typename _Up>
constexpr bool
operator>=(const _Tp& __t, const propagate_const<_Up>& __pu)
{
return __t >= get_underlying(__pu);
}
// [propagate_const.algorithms], specialized algorithms
template <typename _Tp>
constexpr void
swap(propagate_const<_Tp>& __pt, propagate_const<_Tp>& __pt2)
noexcept(__is_nothrow_swappable<_Tp>::value)
{
__pt.swap(__pt2);
}
// [propagate_const.underlying], underlying pointer access
template <typename _Tp>
constexpr const _Tp&
get_underlying(const propagate_const<_Tp>& __pt) noexcept
{
return __pt._M_t;
}
template <typename _Tp>
constexpr _Tp&
get_underlying(propagate_const<_Tp>& __pt) noexcept
{
return __pt._M_t;
}
// @} group propagate_const
} // namespace fundamentals_v2
} // namespace experimental
// [propagate_const.hash], hash support
template <typename _Tp>
struct hash<experimental::propagate_const<_Tp>>
{
using result_type = size_t;
using argument_type = experimental::propagate_const<_Tp>;
size_t
operator()(const experimental::propagate_const<_Tp>& __t) const
noexcept(noexcept(hash<_Tp>{}(get_underlying(__t))))
{
return hash<_Tp>{}(get_underlying(__t));
}
};
// [propagate_const.comparison_function_objects], comparison function objects
template <typename _Tp>
struct equal_to<experimental::propagate_const<_Tp>>
{
constexpr bool
operator()(const experimental::propagate_const<_Tp>& __x,
const experimental::propagate_const<_Tp>& __y) const
{
return equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
}
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
typedef bool result_type;
};
template <typename _Tp>
struct not_equal_to<experimental::propagate_const<_Tp>>
{
constexpr bool
operator()(const experimental::propagate_const<_Tp>& __x,
const experimental::propagate_const<_Tp>& __y) const
{
return not_equal_to<_Tp>{}(get_underlying(__x), get_underlying(__y));
}
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
typedef bool result_type;
};
template <typename _Tp>
struct less<experimental::propagate_const<_Tp>>
{
constexpr bool
operator()(const experimental::propagate_const<_Tp>& __x,
const experimental::propagate_const<_Tp>& __y) const
{
return less<_Tp>{}(get_underlying(__x), get_underlying(__y));
}
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
typedef bool result_type;
};
template <typename _Tp>
struct greater<experimental::propagate_const<_Tp>>
{
constexpr bool
operator()(const experimental::propagate_const<_Tp>& __x,
const experimental::propagate_const<_Tp>& __y) const
{
return greater<_Tp>{}(get_underlying(__x), get_underlying(__y));
}
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
typedef bool result_type;
};
template <typename _Tp>
struct less_equal<experimental::propagate_const<_Tp>>
{
constexpr bool
operator()(const experimental::propagate_const<_Tp>& __x,
const experimental::propagate_const<_Tp>& __y) const
{
return less_equal<_Tp>{}(get_underlying(__x), get_underlying(__y));
}
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
typedef bool result_type;
};
template <typename _Tp>
struct greater_equal<experimental::propagate_const<_Tp>>
{
constexpr bool
operator()(const experimental::propagate_const<_Tp>& __x,
const experimental::propagate_const<_Tp>& __y) const
{
return greater_equal<_Tp>{}(get_underlying(__x), get_underlying(__y));
}
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
typedef bool result_type;
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST
// <experimental/regex> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/regex
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_REGEX
#define _GLIBCXX_EXPERIMENTAL_REGEX 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <regex>
#include <experimental/string>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
#if _GLIBCXX_USE_CXX11_ABI
namespace pmr
{
template<typename _BidirectionalIterator>
using match_results
= std::match_results<_BidirectionalIterator, polymorphic_allocator<
sub_match<_BidirectionalIterator>>>;
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<string::const_iterator> smatch;
typedef match_results<wstring::const_iterator> wsmatch;
} // namespace pmr
#endif
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_REGEX
// Variable Templates For system_error -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/system_error
* This is a TS C++ Library header.
*/
//
// N3932 Variable Templates For Type Traits (Revision 1)
//
#ifndef _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR
#define _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <system_error>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
// See C++14 §19.5, System error support
template <typename _Tp>
constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value;
template <typename _Tp>
constexpr bool is_error_condition_enum_v =
is_error_condition_enum<_Tp>::value;
} // namespace fundamentals_v1
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR
// Components for manipulating non-owning sequences of characters -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/string_view.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{experimental/string_view}
*/
//
// N3762 basic_string_view library
//
#ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
#define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
#pragma GCC system_header
#if __cplusplus >= 201402L
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v1
{
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
{
__glibcxx_requires_string_len(__str, __n);
if (__n == 0)
return __pos <= this->_M_len ? __pos : npos;
if (__n <= this->_M_len)
{
for (; __pos <= this->_M_len - __n; ++__pos)
if (traits_type::eq(this->_M_str[__pos], __str[0])
&& traits_type::compare(this->_M_str + __pos + 1,
__str + 1, __n - 1) == 0)
return __pos;
}
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find(_CharT __c, size_type __pos) const noexcept
{
size_type __ret = npos;
if (__pos < this->_M_len)
{
const size_type __n = this->_M_len - __pos;
const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
if (__p)
__ret = __p - this->_M_str;
}
return __ret;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
{
__glibcxx_requires_string_len(__str, __n);
if (__n <= this->_M_len)
{
__pos = std::min(size_type(this->_M_len - __n), __pos);
do
{
if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
return __pos;
}
while (__pos-- > 0);
}
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
rfind(_CharT __c, size_type __pos) const noexcept
{
size_type __size = this->_M_len;
if (__size > 0)
{
if (--__size > __pos)
__size = __pos;
for (++__size; __size-- > 0; )
if (traits_type::eq(this->_M_str[__size], __c))
return __size;
}
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__str, __n);
for (; __n && __pos < this->_M_len; ++__pos)
{
const _CharT* __p = traits_type::find(__str, __n,
this->_M_str[__pos]);
if (__p)
return __pos;
}
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__str, __n);
size_type __size = this->size();
if (__size && __n)
{
if (--__size > __pos)
__size = __pos;
do
{
if (traits_type::find(__str, __n, this->_M_str[__size]))
return __size;
}
while (__size-- != 0);
}
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__str, __n);
for (; __pos < this->_M_len; ++__pos)
if (!traits_type::find(__str, __n, this->_M_str[__pos]))
return __pos;
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_first_not_of(_CharT __c, size_type __pos) const noexcept
{
for (; __pos < this->_M_len; ++__pos)
if (!traits_type::eq(this->_M_str[__pos], __c))
return __pos;
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__str, __n);
size_type __size = this->_M_len;
if (__size)
{
if (--__size > __pos)
__size = __pos;
do
{
if (!traits_type::find(__str, __n, this->_M_str[__size]))
return __size;
}
while (__size--);
}
return npos;
}
template<typename _CharT, typename _Traits>
constexpr typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find_last_not_of(_CharT __c, size_type __pos) const noexcept
{
size_type __size = this->_M_len;
if (__size)
{
if (--__size > __pos)
__size = __pos;
do
{
if (!traits_type::eq(this->_M_str[__size], __c))
return __size;
}
while (__size--);
}
return npos;
}
} // namespace fundamentals_v1
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
// Filesystem declarations -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/fs_fwd.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{experimental/filesystem}
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H
#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <system_error>
#include <cstdint>
#include <chrono>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
namespace filesystem
{
inline namespace v1
{
#if _GLIBCXX_USE_CXX11_ABI
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
#endif
/**
* @defgroup filesystem-ts Filesystem TS
* @ingroup experimental
*
* Utilities for performing operations on file systems and their components,
* such as paths, regular files, and directories.
*
* @{
*/
class file_status;
_GLIBCXX_BEGIN_NAMESPACE_CXX11
class path;
class filesystem_error;
class directory_entry;
class directory_iterator;
class recursive_directory_iterator;
_GLIBCXX_END_NAMESPACE_CXX11
struct space_info
{
uintmax_t capacity;
uintmax_t free;
uintmax_t available;
};
enum class file_type : signed char {
none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
};
/// Bitmask type
enum class copy_options : unsigned short {
none = 0,
skip_existing = 1, overwrite_existing = 2, update_existing = 4,
recursive = 8,
copy_symlinks = 16, skip_symlinks = 32,
directories_only = 64, create_symlinks = 128, create_hard_links = 256
};
constexpr copy_options
operator&(copy_options __x, copy_options __y) noexcept
{
using __utype = typename std::underlying_type<copy_options>::type;
return static_cast<copy_options>(
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
constexpr copy_options
operator|(copy_options __x, copy_options __y) noexcept
{
using __utype = typename std::underlying_type<copy_options>::type;
return static_cast<copy_options>(
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
constexpr copy_options
operator^(copy_options __x, copy_options __y) noexcept
{
using __utype = typename std::underlying_type<copy_options>::type;
return static_cast<copy_options>(
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
constexpr copy_options
operator~(copy_options __x) noexcept
{
using __utype = typename std::underlying_type<copy_options>::type;
return static_cast<copy_options>(~static_cast<__utype>(__x));
}
inline copy_options&
operator&=(copy_options& __x, copy_options __y) noexcept
{ return __x = __x & __y; }
inline copy_options&
operator|=(copy_options& __x, copy_options __y) noexcept
{ return __x = __x | __y; }
inline copy_options&
operator^=(copy_options& __x, copy_options __y) noexcept
{ return __x = __x ^ __y; }
/// Bitmask type
enum class perms : unsigned {
none = 0,
owner_read = 0400,
owner_write = 0200,
owner_exec = 0100,
owner_all = 0700,
group_read = 040,
group_write = 020,
group_exec = 010,
group_all = 070,
others_read = 04,
others_write = 02,
others_exec = 01,
others_all = 07,
all = 0777,
set_uid = 04000,
set_gid = 02000,
sticky_bit = 01000,
mask = 07777,
unknown = 0xFFFF,
add_perms = 0x10000,
remove_perms = 0x20000,
symlink_nofollow = 0x40000
};
constexpr perms
operator&(perms __x, perms __y) noexcept
{
using __utype = typename std::underlying_type<perms>::type;
return static_cast<perms>(
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
constexpr perms
operator|(perms __x, perms __y) noexcept
{
using __utype = typename std::underlying_type<perms>::type;
return static_cast<perms>(
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
constexpr perms
operator^(perms __x, perms __y) noexcept
{
using __utype = typename std::underlying_type<perms>::type;
return static_cast<perms>(
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
constexpr perms
operator~(perms __x) noexcept
{
using __utype = typename std::underlying_type<perms>::type;
return static_cast<perms>(~static_cast<__utype>(__x));
}
inline perms&
operator&=(perms& __x, perms __y) noexcept
{ return __x = __x & __y; }
inline perms&
operator|=(perms& __x, perms __y) noexcept
{ return __x = __x | __y; }
inline perms&
operator^=(perms& __x, perms __y) noexcept
{ return __x = __x ^ __y; }
// Bitmask type
enum class directory_options : unsigned char {
none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
};
constexpr directory_options
operator&(directory_options __x, directory_options __y) noexcept
{
using __utype = typename std::underlying_type<directory_options>::type;
return static_cast<directory_options>(
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
constexpr directory_options
operator|(directory_options __x, directory_options __y) noexcept
{
using __utype = typename std::underlying_type<directory_options>::type;
return static_cast<directory_options>(
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
constexpr directory_options
operator^(directory_options __x, directory_options __y) noexcept
{
using __utype = typename std::underlying_type<directory_options>::type;
return static_cast<directory_options>(
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
constexpr directory_options
operator~(directory_options __x) noexcept
{
using __utype = typename std::underlying_type<directory_options>::type;
return static_cast<directory_options>(~static_cast<__utype>(__x));
}
inline directory_options&
operator&=(directory_options& __x, directory_options __y) noexcept
{ return __x = __x & __y; }
inline directory_options&
operator|=(directory_options& __x, directory_options __y) noexcept
{ return __x = __x | __y; }
inline directory_options&
operator^=(directory_options& __x, directory_options __y) noexcept
{ return __x = __x ^ __y; }
using file_time_type = std::chrono::system_clock::time_point;
// operational functions
void copy(const path& __from, const path& __to, copy_options __options);
void copy(const path& __from, const path& __to, copy_options __options,
error_code&) noexcept;
bool copy_file(const path& __from, const path& __to, copy_options __option);
bool copy_file(const path& __from, const path& __to, copy_options __option,
error_code&) noexcept;
path current_path();
file_status status(const path&);
file_status status(const path&, error_code&) noexcept;
bool status_known(file_status) noexcept;
file_status symlink_status(const path&);
file_status symlink_status(const path&, error_code&) noexcept;
bool is_regular_file(file_status) noexcept;
bool is_symlink(file_status) noexcept;
// @} group filesystem-ts
} // namespace v1
} // namespace filesystem
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H
// <experimental/bits/erase_if.h> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/erase_if.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
#define _GLIBCXX_EXPERIMENTAL_ERASE_IF_H 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <experimental/bits/lfts_config.h>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
namespace __detail
{
template<typename _Container, typename _Predicate>
void
__erase_nodes_if(_Container& __cont, _Predicate __pred)
{
for (auto __iter = __cont.begin(), __last = __cont.end();
__iter != __last;)
{
if (__pred(*__iter))
__iter = __cont.erase(__iter);
else
++__iter;
}
}
} // namespace __detail
} // inline namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_ERASE_IF_H
// Class filesystem::path -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/fs_path.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{experimental/filesystem}
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H
#define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <utility>
#include <type_traits>
#include <vector>
#include <locale>
#include <iosfwd>
#include <codecvt>
#include <system_error>
#include <bits/stl_algobase.h>
#include <bits/quoted_string.h>
#include <bits/locale_conv.h>
#if __cplusplus == 201402L
# include <experimental/string_view>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1
# include <algorithm>
#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
namespace filesystem
{
inline namespace v1
{
_GLIBCXX_BEGIN_NAMESPACE_CXX11
#if __cplusplus == 201402L
using std::experimental::basic_string_view;
#elif __cplusplus > 201402L
using std::basic_string_view;
#endif
/**
* @ingroup filesystem-ts
* @{
*/
/// A filesystem path.
class path
{
template<typename _CharT>
struct __is_encoded_char : std::false_type { };
template<typename _Iter,
typename _Iter_traits = std::iterator_traits<_Iter>>
using __is_path_iter_src
= __and_<__is_encoded_char<typename _Iter_traits::value_type>,
std::is_base_of<std::input_iterator_tag,
typename _Iter_traits::iterator_category>>;
template<typename _Iter>
static __is_path_iter_src<_Iter>
__is_path_src(_Iter, int);
template<typename _CharT, typename _Traits, typename _Alloc>
static __is_encoded_char<_CharT>
__is_path_src(const basic_string<_CharT, _Traits, _Alloc>&, int);
#if __cplusplus >= 201402L
template<typename _CharT, typename _Traits>
static __is_encoded_char<_CharT>
__is_path_src(const basic_string_view<_CharT, _Traits>&, int);
#endif
template<typename _Unknown>
static std::false_type
__is_path_src(const _Unknown&, ...);
template<typename _Tp1, typename _Tp2>
struct __constructible_from;
template<typename _Iter>
struct __constructible_from<_Iter, _Iter>
: __is_path_iter_src<_Iter>
{ };
template<typename _Source>
struct __constructible_from<_Source, void>
: decltype(__is_path_src(std::declval<_Source>(), 0))
{ };
template<typename _Tp1, typename _Tp2 = void,
typename _Tp1_nocv = typename remove_cv<_Tp1>::type,
typename _Tp1_noptr = typename remove_pointer<_Tp1>::type>
using _Path = typename
std::enable_if<__and_<__not_<is_same<_Tp1_nocv, path>>,
__not_<is_void<_Tp1_noptr>>,
__constructible_from<_Tp1, _Tp2>>::value,
path>::type;
template<typename _Source>
static _Source
_S_range_begin(_Source __begin) { return __begin; }
struct __null_terminated { };
template<typename _Source>
static __null_terminated
_S_range_end(_Source) { return {}; }
template<typename _CharT, typename _Traits, typename _Alloc>
static const _CharT*
_S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
{ return __str.data(); }
template<typename _CharT, typename _Traits, typename _Alloc>
static const _CharT*
_S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
{ return __str.data() + __str.size(); }
#if __cplusplus >= 201402L
template<typename _CharT, typename _Traits>
static const _CharT*
_S_range_begin(const basic_string_view<_CharT, _Traits>& __str)
{ return __str.data(); }
template<typename _CharT, typename _Traits>
static const _CharT*
_S_range_end(const basic_string_view<_CharT, _Traits>& __str)
{ return __str.data() + __str.size(); }
#endif
template<typename _Tp,
typename _Iter = decltype(_S_range_begin(std::declval<_Tp>())),
typename _Val = typename std::iterator_traits<_Iter>::value_type>
using __value_type_is_char
= typename std::enable_if<std::is_same<_Val, char>::value>::type;
public:
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
typedef wchar_t value_type;
static constexpr value_type preferred_separator = L'\\';
#else
typedef char value_type;
static constexpr value_type preferred_separator = '/';
#endif
typedef std::basic_string<value_type> string_type;
// constructors and destructor
path() noexcept { }
path(const path& __p) = default;
path(path&& __p) noexcept
: _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
{
if (_M_type == _Type::_Multi)
_M_split_cmpts();
__p.clear();
}
path(string_type&& __source)
: _M_pathname(std::move(__source))
{ _M_split_cmpts(); }
template<typename _Source,
typename _Require = _Path<_Source>>
path(_Source const& __source)
: _M_pathname(_S_convert(_S_range_begin(__source),
_S_range_end(__source)))
{ _M_split_cmpts(); }
template<typename _InputIterator,
typename _Require = _Path<_InputIterator, _InputIterator>>
path(_InputIterator __first, _InputIterator __last)
: _M_pathname(_S_convert(__first, __last))
{ _M_split_cmpts(); }
template<typename _Source,
typename _Require = _Path<_Source>,
typename _Require2 = __value_type_is_char<_Source>>
path(_Source const& __source, const locale& __loc)
: _M_pathname(_S_convert_loc(_S_range_begin(__source),
_S_range_end(__source), __loc))
{ _M_split_cmpts(); }
template<typename _InputIterator,
typename _Require = _Path<_InputIterator, _InputIterator>,
typename _Require2 = __value_type_is_char<_InputIterator>>
path(_InputIterator __first, _InputIterator __last, const locale& __loc)
: _M_pathname(_S_convert_loc(__first, __last, __loc))
{ _M_split_cmpts(); }
~path() = default;
// assignments
path& operator=(const path& __p) = default;
path& operator=(path&& __p) noexcept;
path& operator=(string_type&& __source);
path& assign(string_type&& __source);
template<typename _Source>
_Path<_Source>&
operator=(_Source const& __source)
{ return *this = path(__source); }
template<typename _Source>
_Path<_Source>&
assign(_Source const& __source)
{ return *this = path(__source); }
template<typename _InputIterator>
_Path<_InputIterator, _InputIterator>&
assign(_InputIterator __first, _InputIterator __last)
{ return *this = path(__first, __last); }
// appends
path& operator/=(const path& __p) { return _M_append(__p._M_pathname); }
template <class _Source>
_Path<_Source>&
operator/=(_Source const& __source)
{ return append(__source); }
template<typename _Source>
_Path<_Source>&
append(_Source const& __source)
{
return _M_append(_S_convert(_S_range_begin(__source),
_S_range_end(__source)));
}
template<typename _InputIterator>
_Path<_InputIterator, _InputIterator>&
append(_InputIterator __first, _InputIterator __last)
{ return _M_append(_S_convert(__first, __last)); }
// concatenation
path& operator+=(const path& __x);
path& operator+=(const string_type& __x);
path& operator+=(const value_type* __x);
path& operator+=(value_type __x);
#if __cplusplus >= 201402L
path& operator+=(basic_string_view<value_type> __x);
#endif
template<typename _Source>
_Path<_Source>&
operator+=(_Source const& __x) { return concat(__x); }
template<typename _CharT>
_Path<_CharT*, _CharT*>&
operator+=(_CharT __x);
template<typename _Source>
_Path<_Source>&
concat(_Source const& __x)
{ return *this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); }
template<typename _InputIterator>
_Path<_InputIterator, _InputIterator>&
concat(_InputIterator __first, _InputIterator __last)
{ return *this += _S_convert(__first, __last); }
// modifiers
void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); }
path& make_preferred();
path& remove_filename();
path& replace_filename(const path& __replacement);
path& replace_extension(const path& __replacement = path());
void swap(path& __rhs) noexcept;
// native format observers
const string_type& native() const noexcept { return _M_pathname; }
const value_type* c_str() const noexcept { return _M_pathname.c_str(); }
operator string_type() const { return _M_pathname; }
template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
typename _Allocator = std::allocator<_CharT>>
std::basic_string<_CharT, _Traits, _Allocator>
string(const _Allocator& __a = _Allocator()) const;
std::string string() const;
#if _GLIBCXX_USE_WCHAR_T
std::wstring wstring() const;
#endif
std::string u8string() const;
std::u16string u16string() const;
std::u32string u32string() const;
// generic format observers
template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
typename _Allocator = std::allocator<_CharT>>
std::basic_string<_CharT, _Traits, _Allocator>
generic_string(const _Allocator& __a = _Allocator()) const;
std::string generic_string() const;
#if _GLIBCXX_USE_WCHAR_T
std::wstring generic_wstring() const;
#endif
std::string generic_u8string() const;
std::u16string generic_u16string() const;
std::u32string generic_u32string() const;
// compare
int compare(const path& __p) const noexcept;
int compare(const string_type& __s) const;
int compare(const value_type* __s) const;
#if __cplusplus >= 201402L
int compare(const basic_string_view<value_type> __s) const;
#endif
// decomposition
path root_name() const;
path root_directory() const;
path root_path() const;
path relative_path() const;
path parent_path() const;
path filename() const;
path stem() const;
path extension() const;
// query
bool empty() const noexcept { return _M_pathname.empty(); }
bool has_root_name() const;
bool has_root_directory() const;
bool has_root_path() const;
bool has_relative_path() const;
bool has_parent_path() const;
bool has_filename() const;
bool has_stem() const;
bool has_extension() const;
bool is_absolute() const { return has_root_directory(); }
bool is_relative() const { return !is_absolute(); }
// iterators
class iterator;
typedef iterator const_iterator;
iterator begin() const;
iterator end() const;
private:
enum class _Type : unsigned char {
_Multi, _Root_name, _Root_dir, _Filename
};
path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type)
{
__glibcxx_assert(!empty());
__glibcxx_assert(_M_type != _Type::_Multi);
}
enum class _Split { _Stem, _Extension };
path& _M_append(const string_type& __str)
{
if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back())
&& !__str.empty() && !_S_is_dir_sep(__str.front()))
_M_pathname += preferred_separator;
_M_pathname += __str;
_M_split_cmpts();
return *this;
}
pair<const string_type*, size_t> _M_find_extension() const;
template<typename _CharT>
struct _Cvt;
static string_type
_S_convert(value_type* __src, __null_terminated)
{ return string_type(__src); }
static string_type
_S_convert(const value_type* __src, __null_terminated)
{ return string_type(__src); }
template<typename _Iter>
static string_type
_S_convert(_Iter __first, _Iter __last)
{
using __value_type = typename std::iterator_traits<_Iter>::value_type;
return _Cvt<typename remove_cv<__value_type>::type>::
_S_convert(__first, __last);
}
template<typename _InputIterator>
static string_type
_S_convert(_InputIterator __src, __null_terminated)
{
using _Tp = typename std::iterator_traits<_InputIterator>::value_type;
std::basic_string<typename remove_cv<_Tp>::type> __tmp;
for (; *__src != _Tp{}; ++__src)
__tmp.push_back(*__src);
return _S_convert(__tmp.c_str(), __tmp.c_str() + __tmp.size());
}
static string_type
_S_convert_loc(const char* __first, const char* __last,
const std::locale& __loc);
template<typename _Iter>
static string_type
_S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc)
{
const std::string __str(__first, __last);
return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc);
}
template<typename _InputIterator>
static string_type
_S_convert_loc(_InputIterator __src, __null_terminated,
const std::locale& __loc)
{
std::string __tmp;
while (*__src != '\0')
__tmp.push_back(*__src++);
return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc);
}
static bool _S_is_dir_sep(value_type __ch)
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
return __ch == L'/' || __ch == preferred_separator;
#else
return __ch == '/';
#endif
}
void _M_split_cmpts();
void _M_trim();
void _M_add_root_name(size_t __n);
void _M_add_root_dir(size_t __pos);
void _M_add_filename(size_t __pos, size_t __n);
string_type _M_pathname;
struct _Cmpt;
using _List = _GLIBCXX_STD_C::vector<_Cmpt>;
_List _M_cmpts; // empty unless _M_type == _Type::_Multi
_Type _M_type = _Type::_Multi;
};
inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
size_t hash_value(const path& __p) noexcept;
/// Compare paths
inline bool operator<(const path& __lhs, const path& __rhs) noexcept
{ return __lhs.compare(__rhs) < 0; }
/// Compare paths
inline bool operator<=(const path& __lhs, const path& __rhs) noexcept
{ return !(__rhs < __lhs); }
/// Compare paths
inline bool operator>(const path& __lhs, const path& __rhs) noexcept
{ return __rhs < __lhs; }
/// Compare paths
inline bool operator>=(const path& __lhs, const path& __rhs) noexcept
{ return !(__lhs < __rhs); }
/// Compare paths
inline bool operator==(const path& __lhs, const path& __rhs) noexcept
{ return __lhs.compare(__rhs) == 0; }
/// Compare paths
inline bool operator!=(const path& __lhs, const path& __rhs) noexcept
{ return !(__lhs == __rhs); }
/// Append one path to another
inline path operator/(const path& __lhs, const path& __rhs)
{
path __result(__lhs);
__result /= __rhs;
return __result;
}
/// Write a path to a stream
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p)
{
auto __tmp = __p.string<_CharT, _Traits>();
using __quoted_string
= std::__detail::_Quoted_string<decltype(__tmp)&, _CharT>;
__os << __quoted_string{__tmp, '"', '\\'};
return __os;
}
/// Read a path from a stream
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, path& __p)
{
basic_string<_CharT, _Traits> __tmp;
using __quoted_string
= std::__detail::_Quoted_string<decltype(__tmp)&, _CharT>;
if (__is >> __quoted_string{ __tmp, '"', '\\' })
__p = std::move(__tmp);
return __is;
}
// TODO constrain with _Path<Source> and __value_type_is_char
template<typename _Source>
inline path
u8path(const _Source& __source)
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
return path{ path::string_type{__source} };
#else
return path{ __source };
#endif
}
// TODO constrain with _Path<InputIterator, InputIterator> and __value_type_is_char
template<typename _InputIterator>
inline path
u8path(_InputIterator __first, _InputIterator __last)
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
return path{ path::string_type{__first, __last} };
#else
return path{ __first, __last };
#endif
}
class filesystem_error : public std::system_error
{
public:
filesystem_error(const string& __what_arg, error_code __ec)
: system_error(__ec, __what_arg) { }
filesystem_error(const string& __what_arg, const path& __p1,
error_code __ec)
: system_error(__ec, __what_arg), _M_path1(__p1) { }
filesystem_error(const string& __what_arg, const path& __p1,
const path& __p2, error_code __ec)
: system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2)
{ }
~filesystem_error();
const path& path1() const noexcept { return _M_path1; }
const path& path2() const noexcept { return _M_path2; }
const char* what() const noexcept { return _M_what.c_str(); }
private:
std::string _M_gen_what();
path _M_path1;
path _M_path2;
std::string _M_what = _M_gen_what();
};
template<>
struct path::__is_encoded_char<char> : std::true_type
{ using value_type = char; };
template<>
struct path::__is_encoded_char<wchar_t> : std::true_type
{ using value_type = wchar_t; };
template<>
struct path::__is_encoded_char<char16_t> : std::true_type
{ using value_type = char16_t; };
template<>
struct path::__is_encoded_char<char32_t> : std::true_type
{ using value_type = char32_t; };
template<typename _Tp>
struct path::__is_encoded_char<const _Tp> : __is_encoded_char<_Tp> { };
struct path::_Cmpt : path
{
_Cmpt(string_type __s, _Type __t, size_t __pos)
: path(std::move(__s), __t), _M_pos(__pos) { }
_Cmpt() : _M_pos(-1) { }
size_t _M_pos;
};
// specialize _Cvt for degenerate 'noconv' case
template<>
struct path::_Cvt<path::value_type>
{
template<typename _Iter>
static string_type
_S_convert(_Iter __first, _Iter __last)
{ return string_type{__first, __last}; }
};
template<typename _CharT>
struct path::_Cvt
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
static string_type
_S_wconvert(const char* __f, const char* __l, true_type)
{
using _Cvt = std::codecvt<wchar_t, char, mbstate_t>;
const auto& __cvt = std::use_facet<_Cvt>(std::locale{});
std::wstring __wstr;
if (__str_codecvt_in(__f, __l, __wstr, __cvt))
return __wstr;
_GLIBCXX_THROW_OR_ABORT(filesystem_error(
"Cannot convert character sequence",
std::make_error_code(errc::illegal_byte_sequence)));
}
static string_type
_S_wconvert(const _CharT* __f, const _CharT* __l, false_type)
{
std::codecvt_utf8<_CharT> __cvt;
std::string __str;
if (__str_codecvt_out(__f, __l, __str, __cvt))
{
const char* __f2 = __str.data();
const char* __l2 = __f2 + __str.size();
std::codecvt_utf8<wchar_t> __wcvt;
std::wstring __wstr;
if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt))
return __wstr;
}
_GLIBCXX_THROW_OR_ABORT(filesystem_error(
"Cannot convert character sequence",
std::make_error_code(errc::illegal_byte_sequence)));
}
static string_type
_S_convert(const _CharT* __f, const _CharT* __l)
{
return _S_wconvert(__f, __l, is_same<_CharT, char>{});
}
#else
static string_type
_S_convert(const _CharT* __f, const _CharT* __l)
{
std::codecvt_utf8<_CharT> __cvt;
std::string __str;
if (__str_codecvt_out(__f, __l, __str, __cvt))
return __str;
_GLIBCXX_THROW_OR_ABORT(filesystem_error(
"Cannot convert character sequence",
std::make_error_code(errc::illegal_byte_sequence)));
}
#endif
static string_type
_S_convert(_CharT* __f, _CharT* __l)
{
return _S_convert(const_cast<const _CharT*>(__f),
const_cast<const _CharT*>(__l));
}
template<typename _Iter>
static string_type
_S_convert(_Iter __first, _Iter __last)
{
const std::basic_string<_CharT> __str(__first, __last);
return _S_convert(__str.data(), __str.data() + __str.size());
}
template<typename _Iter, typename _Cont>
static string_type
_S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first,
__gnu_cxx::__normal_iterator<_Iter, _Cont> __last)
{ return _S_convert(__first.base(), __last.base()); }
};
/// An iterator for the components of a path
class path::iterator
{
public:
using difference_type = std::ptrdiff_t;
using value_type = path;
using reference = const path&;
using pointer = const path*;
using iterator_category = std::bidirectional_iterator_tag;
iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { }
iterator(const iterator&) = default;
iterator& operator=(const iterator&) = default;
reference operator*() const;
pointer operator->() const { return std::__addressof(**this); }
iterator& operator++();
iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; }
iterator& operator--();
iterator operator--(int) { auto __tmp = *this; --*this; return __tmp; }
friend bool operator==(const iterator& __lhs, const iterator& __rhs)
{ return __lhs._M_equals(__rhs); }
friend bool operator!=(const iterator& __lhs, const iterator& __rhs)
{ return !__lhs._M_equals(__rhs); }
private:
friend class path;
iterator(const path* __path, path::_List::const_iterator __iter)
: _M_path(__path), _M_cur(__iter), _M_at_end()
{ }
iterator(const path* __path, bool __at_end)
: _M_path(__path), _M_cur(), _M_at_end(__at_end)
{ }
bool _M_equals(iterator) const;
const path* _M_path;
path::_List::const_iterator _M_cur;
bool _M_at_end; // only used when type != _Multi
};
inline path&
path::operator=(path&& __p) noexcept
{
_M_pathname = std::move(__p._M_pathname);
_M_cmpts = std::move(__p._M_cmpts);
_M_type = __p._M_type;
__p.clear();
return *this;
}
inline path&
path::operator=(string_type&& __source)
{ return *this = path(std::move(__source)); }
inline path&
path::assign(string_type&& __source)
{ return *this = path(std::move(__source)); }
inline path&
path::operator+=(const path& __p)
{
return operator+=(__p.native());
}
inline path&
path::operator+=(const string_type& __x)
{
_M_pathname += __x;
_M_split_cmpts();
return *this;
}
inline path&
path::operator+=(const value_type* __x)
{
_M_pathname += __x;
_M_split_cmpts();
return *this;
}
inline path&
path::operator+=(value_type __x)
{
_M_pathname += __x;
_M_split_cmpts();
return *this;
}
#if __cplusplus >= 201402L
inline path&
path::operator+=(basic_string_view<value_type> __x)
{
_M_pathname.append(__x.data(), __x.size());
_M_split_cmpts();
return *this;
}
#endif
template<typename _CharT>
inline path::_Path<_CharT*, _CharT*>&
path::operator+=(_CharT __x)
{
auto* __addr = std::__addressof(__x);
return concat(__addr, __addr + 1);
}
inline path&
path::make_preferred()
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
std::replace(_M_pathname.begin(), _M_pathname.end(), L'/',
preferred_separator);
#endif
return *this;
}
inline void path::swap(path& __rhs) noexcept
{
_M_pathname.swap(__rhs._M_pathname);
_M_cmpts.swap(__rhs._M_cmpts);
std::swap(_M_type, __rhs._M_type);
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline std::basic_string<_CharT, _Traits, _Allocator>
path::string(const _Allocator& __a) const
{
if (is_same<_CharT, value_type>::value)
return { _M_pathname.begin(), _M_pathname.end(), __a };
const value_type* __first = _M_pathname.data();
const value_type* __last = __first + _M_pathname.size();
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
using _CharAlloc = __alloc_rebind<_Allocator, char>;
using _String = basic_string<char, char_traits<char>, _CharAlloc>;
using _WString = basic_string<_CharT, _Traits, _Allocator>;
// use codecvt_utf8<wchar_t> to convert native string to UTF-8
codecvt_utf8<value_type> __cvt;
_String __u8str{_CharAlloc{__a}};
if (__str_codecvt_out(__first, __last, __u8str, __cvt))
{
struct
{
const _String*
operator()(const _String& __from, _String&, true_type)
{ return std::__addressof(__from); }
_WString*
operator()(const _String& __from, _WString& __to, false_type)
{
// use codecvt_utf8<_CharT> to convert UTF-8 to wide string
codecvt_utf8<_CharT> __cvt;
const char* __f = __from.data();
const char* __l = __f + __from.size();
if (__str_codecvt_in(__f, __l, __to, __cvt))
return std::__addressof(__to);
return nullptr;
}
} __dispatch;
_WString __wstr;
if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
return *__p;
}
#else
codecvt_utf8<_CharT> __cvt;
basic_string<_CharT, _Traits, _Allocator> __wstr{__a};
if (__str_codecvt_in(__first, __last, __wstr, __cvt))
return __wstr;
#endif
_GLIBCXX_THROW_OR_ABORT(filesystem_error(
"Cannot convert character sequence",
std::make_error_code(errc::illegal_byte_sequence)));
}
inline std::string
path::string() const { return string<char>(); }
#if _GLIBCXX_USE_WCHAR_T
inline std::wstring
path::wstring() const { return string<wchar_t>(); }
#endif
inline std::string
path::u8string() const
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
std::string __str;
// convert from native encoding to UTF-8
codecvt_utf8<value_type> __cvt;
const value_type* __first = _M_pathname.data();
const value_type* __last = __first + _M_pathname.size();
if (__str_codecvt_out(__first, __last, __str, __cvt))
return __str;
_GLIBCXX_THROW_OR_ABORT(filesystem_error(
"Cannot convert character sequence",
std::make_error_code(errc::illegal_byte_sequence)));
#else
return _M_pathname;
#endif
}
inline std::u16string
path::u16string() const { return string<char16_t>(); }
inline std::u32string
path::u32string() const { return string<char32_t>(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline std::basic_string<_CharT, _Traits, _Allocator>
path::generic_string(const _Allocator& __a) const
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
const _CharT __slash = is_same<_CharT, wchar_t>::value
? _CharT(L'/')
: _CharT('/'); // Assume value is correct for the encoding.
#else
const _CharT __slash = _CharT('/');
#endif
basic_string<_CharT, _Traits, _Allocator> __str(__a);
__str.reserve(_M_pathname.size());
bool __add_slash = false;
for (auto& __elem : *this)
{
if (__elem._M_type == _Type::_Root_dir)
{
__str += __slash;
continue;
}
if (__add_slash)
__str += __slash;
__str += __elem.string<_CharT, _Traits, _Allocator>(__a);
__add_slash = __elem._M_type == _Type::_Filename;
}
return __str;
}
inline std::string
path::generic_string() const { return generic_string<char>(); }
#if _GLIBCXX_USE_WCHAR_T
inline std::wstring
path::generic_wstring() const { return generic_string<wchar_t>(); }
#endif
inline std::string
path::generic_u8string() const { return generic_string<char>(); }
inline std::u16string
path::generic_u16string() const { return generic_string<char16_t>(); }
inline std::u32string
path::generic_u32string() const { return generic_string<char32_t>(); }
inline int
path::compare(const string_type& __s) const { return compare(path(__s)); }
inline int
path::compare(const value_type* __s) const { return compare(path(__s)); }
#if __cplusplus >= 201402L
inline int
path::compare(basic_string_view<value_type> __s) const
{ return compare(path(__s)); }
#endif
inline path
path::filename() const { return empty() ? path() : *--end(); }
inline path
path::stem() const
{
auto ext = _M_find_extension();
if (ext.first && ext.second != 0)
return path{ext.first->substr(0, ext.second)};
return {};
}
inline path
path::extension() const
{
auto ext = _M_find_extension();
if (ext.first && ext.second != string_type::npos)
return path{ext.first->substr(ext.second)};
return {};
}
inline bool
path::has_stem() const
{
auto ext = _M_find_extension();
return ext.first && ext.second != 0;
}
inline bool
path::has_extension() const
{
auto ext = _M_find_extension();
return ext.first && ext.second != string_type::npos;
}
inline path::iterator
path::begin() const
{
if (_M_type == _Type::_Multi)
return iterator(this, _M_cmpts.begin());
return iterator(this, false);
}
inline path::iterator
path::end() const
{
if (_M_type == _Type::_Multi)
return iterator(this, _M_cmpts.end());
return iterator(this, true);
}
inline path::iterator&
path::iterator::operator++()
{
__glibcxx_assert(_M_path != nullptr);
if (_M_path->_M_type == _Type::_Multi)
{
__glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
++_M_cur;
}
else
{
__glibcxx_assert(!_M_at_end);
_M_at_end = true;
}
return *this;
}
inline path::iterator&
path::iterator::operator--()
{
__glibcxx_assert(_M_path != nullptr);
if (_M_path->_M_type == _Type::_Multi)
{
__glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
--_M_cur;
}
else
{
__glibcxx_assert(_M_at_end);
_M_at_end = false;
}
return *this;
}
inline path::iterator::reference
path::iterator::operator*() const
{
__glibcxx_assert(_M_path != nullptr);
if (_M_path->_M_type == _Type::_Multi)
{
__glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
return *_M_cur;
}
return *_M_path;
}
inline bool
path::iterator::_M_equals(iterator __rhs) const
{
if (_M_path != __rhs._M_path)
return false;
if (_M_path == nullptr)
return true;
if (_M_path->_M_type == path::_Type::_Multi)
return _M_cur == __rhs._M_cur;
return _M_at_end == __rhs._M_at_end;
}
// @} group filesystem-ts
_GLIBCXX_END_NAMESPACE_CXX11
} // namespace v1
} // namespace filesystem
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H
// Namespace declarations for Library Fundamentals TS -*- C++ -*-
// Copyright (C) 2016-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/lfts_config.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly.
*/
#if __cplusplus >= 201402L
#include <bits/c++config.h>
#if _GLIBCXX_INLINE_VERSION
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace chrono
{
namespace experimental
{
inline namespace fundamentals_v1 { }
inline namespace fundamentals_v2 { }
} // namespace experimental
} // namespace chrono
namespace experimental
{
inline namespace fundamentals_v1 { }
inline namespace fundamentals_v2 { }
inline namespace literals { inline namespace string_view_literals { } }
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif
#endif
// Experimental shared_ptr with array support -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/shared_ptr.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{experimental/memory}
*/
#ifndef _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H
#define _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <memory>
#include <experimental/type_traits>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
// 8.2.1
template<typename _Tp> class shared_ptr;
template<typename _Tp> class weak_ptr;
template<typename _Tp> class enable_shared_from_this;
template<typename _Yp, typename _Tp>
constexpr bool __sp_compatible_v
= std::__sp_compatible_with<_Yp*, _Tp*>::value;
template<typename _Tp, typename _Yp>
constexpr bool __sp_is_constructible_v
= std::__sp_is_constructible<_Tp, _Yp>::value;
template<typename _Tp>
class shared_ptr : public __shared_ptr<_Tp>
{
using _Base_type = __shared_ptr<_Tp>;
public:
using element_type = typename _Base_type::element_type;
private:
// Constraint for construction from a pointer of type _Yp*:
template<typename _Yp>
using _SafeConv = enable_if_t<__sp_is_constructible_v<_Tp, _Yp>>;
template<typename _Tp1, typename _Res = void>
using _Compatible
= enable_if_t<__sp_compatible_v<_Tp1, _Tp>, _Res>;
template<typename _Tp1, typename _Del,
typename _Ptr = typename unique_ptr<_Tp1, _Del>::pointer,
typename _Res = void>
using _UniqCompatible = enable_if_t<
__sp_compatible_v<_Tp1, _Tp>
&& experimental::is_convertible_v<_Ptr, element_type*>,
_Res>;
public:
// 8.2.1.1, shared_ptr constructors
constexpr shared_ptr() noexcept = default;
template<typename _Tp1, typename = _SafeConv<_Tp1>>
explicit
shared_ptr(_Tp1* __p) : _Base_type(__p)
{ _M_enable_shared_from_this_with(__p); }
template<typename _Tp1, typename _Deleter, typename = _SafeConv<_Tp1>>
shared_ptr(_Tp1* __p, _Deleter __d)
: _Base_type(__p, __d)
{ _M_enable_shared_from_this_with(__p); }
template<typename _Tp1, typename _Deleter, typename _Alloc,
typename = _SafeConv<_Tp1>>
shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
: _Base_type(__p, __d, __a)
{ _M_enable_shared_from_this_with(__p); }
template<typename _Deleter>
shared_ptr(nullptr_t __p, _Deleter __d)
: _Base_type(__p, __d) { }
template<typename _Deleter, typename _Alloc>
shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
: _Base_type(__p, __d, __a) { }
template<typename _Tp1>
shared_ptr(const shared_ptr<_Tp1>& __r, element_type* __p) noexcept
: _Base_type(__r, __p) { }
shared_ptr(const shared_ptr& __r) noexcept
: _Base_type(__r) { }
template<typename _Tp1, typename = _Compatible<_Tp1>>
shared_ptr(const shared_ptr<_Tp1>& __r) noexcept
: _Base_type(__r) { }
shared_ptr(shared_ptr&& __r) noexcept
: _Base_type(std::move(__r)) { }
template<typename _Tp1, typename = _Compatible<_Tp1>>
shared_ptr(shared_ptr<_Tp1>&& __r) noexcept
: _Base_type(std::move(__r)) { }
template<typename _Tp1, typename = _Compatible<_Tp1>>
explicit
shared_ptr(const weak_ptr<_Tp1>& __r)
: _Base_type(__r) { }
#if _GLIBCXX_USE_DEPRECATED
template<typename _Tp1, typename = _Compatible<_Tp1>>
shared_ptr(std::auto_ptr<_Tp1>&& __r)
: _Base_type(std::move(__r))
{ _M_enable_shared_from_this_with(static_cast<_Tp1*>(this->get())); }
#endif
template<typename _Tp1, typename _Del,
typename = _UniqCompatible<_Tp1, _Del>>
shared_ptr(unique_ptr<_Tp1, _Del>&& __r)
: _Base_type(std::move(__r))
{
// XXX assume conversion from __r.get() to this->get() to __elem_t*
// is a round trip, which might not be true in all cases.
using __elem_t = typename unique_ptr<_Tp1, _Del>::element_type;
_M_enable_shared_from_this_with(static_cast<__elem_t*>(this->get()));
}
constexpr shared_ptr(nullptr_t __p)
: _Base_type(__p) { }
// C++14 §20.8.2.2
~shared_ptr() = default;
// C++14 §20.8.2.3
shared_ptr& operator=(const shared_ptr&) noexcept = default;
template <typename _Tp1>
_Compatible<_Tp1, shared_ptr&>
operator=(const shared_ptr<_Tp1>& __r) noexcept
{
_Base_type::operator=(__r);
return *this;
}
shared_ptr&
operator=(shared_ptr&& __r) noexcept
{
_Base_type::operator=(std::move(__r));
return *this;
}
template <typename _Tp1>
_Compatible<_Tp1, shared_ptr&>
operator=(shared_ptr<_Tp1>&& __r) noexcept
{
_Base_type::operator=(std::move(__r));
return *this;
}
#if _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
_Compatible<_Tp1, shared_ptr&>
operator=(std::auto_ptr<_Tp1>&& __r)
{
__shared_ptr<_Tp>::operator=(std::move(__r));
return *this;
}
#endif
template <typename _Tp1, typename _Del>
_UniqCompatible<_Tp1, _Del, shared_ptr&>
operator=(unique_ptr<_Tp1, _Del>&& __r)
{
_Base_type::operator=(std::move(__r));
return *this;
}
// C++14 §20.8.2.2.4
// swap & reset
// 8.2.1.2 shared_ptr observers
// in __shared_ptr
private:
template<typename _Alloc, typename... _Args>
shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
_Args&&... __args)
: _Base_type(__tag, __a, std::forward<_Args>(__args)...)
{ _M_enable_shared_from_this_with(this->get()); }
template<typename _Tp1, typename _Alloc, typename... _Args>
friend shared_ptr<_Tp1>
allocate_shared(const _Alloc& __a, _Args&&... __args);
shared_ptr(const weak_ptr<_Tp>& __r, std::nothrow_t)
: _Base_type(__r, std::nothrow) { }
friend class weak_ptr<_Tp>;
template<typename _Yp>
using __esft_base_t =
decltype(__expt_enable_shared_from_this_base(std::declval<_Yp*>()));
// Detect an accessible and unambiguous enable_shared_from_this base.
template<typename _Yp, typename = void>
struct __has_esft_base
: false_type { };
template<typename _Yp>
struct __has_esft_base<_Yp, __void_t<__esft_base_t<_Yp>>>
: __bool_constant<!is_array_v<_Tp>> { }; // ignore base for arrays
template<typename _Yp>
typename enable_if<__has_esft_base<_Yp>::value>::type
_M_enable_shared_from_this_with(const _Yp* __p) noexcept
{
if (auto __base = __expt_enable_shared_from_this_base(__p))
{
__base->_M_weak_this
= shared_ptr<_Yp>(*this, const_cast<_Yp*>(__p));
}
}
template<typename _Yp>
typename enable_if<!__has_esft_base<_Yp>::value>::type
_M_enable_shared_from_this_with(const _Yp*) noexcept
{ }
};
// C++14 §20.8.2.2.7 //DOING
template<typename _Tp1, typename _Tp2>
bool operator==(const shared_ptr<_Tp1>& __a,
const shared_ptr<_Tp2>& __b) noexcept
{ return __a.get() == __b.get(); }
template<typename _Tp>
inline bool
operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
{ return !__a; }
template<typename _Tp>
inline bool
operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
{ return !__a; }
template<typename _Tp1, typename _Tp2>
inline bool
operator!=(const shared_ptr<_Tp1>& __a,
const shared_ptr<_Tp2>& __b) noexcept
{ return __a.get() != __b.get(); }
template<typename _Tp>
inline bool
operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
{ return (bool)__a; }
template<typename _Tp>
inline bool
operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
{ return (bool)__a; }
template<typename _Tp1, typename _Tp2>
inline bool
operator<(const shared_ptr<_Tp1>& __a,
const shared_ptr<_Tp2>& __b) noexcept
{
using __elem_t1 = typename shared_ptr<_Tp1>::element_type;
using __elem_t2 = typename shared_ptr<_Tp2>::element_type;
using _CT = common_type_t<__elem_t1*, __elem_t2*>;
return std::less<_CT>()(__a.get(), __b.get());
}
template<typename _Tp>
inline bool
operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return std::less<__elem_t*>()(__a.get(), nullptr);
}
template<typename _Tp>
inline bool
operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return std::less<__elem_t*>()(nullptr, __a.get());
}
template<typename _Tp1, typename _Tp2>
inline bool
operator<=(const shared_ptr<_Tp1>& __a,
const shared_ptr<_Tp2>& __b) noexcept
{ return !(__b < __a); }
template<typename _Tp>
inline bool
operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
{ return !(nullptr < __a); }
template<typename _Tp>
inline bool
operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
{ return !(__a < nullptr); }
template<typename _Tp1, typename _Tp2>
inline bool
operator>(const shared_ptr<_Tp1>& __a,
const shared_ptr<_Tp2>& __b) noexcept
{ return (__b < __a); }
template<typename _Tp>
inline bool
operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return std::less<__elem_t*>()(nullptr, __a.get());
}
template<typename _Tp>
inline bool
operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return std::less<__elem_t*>()(__a.get(), nullptr);
}
template<typename _Tp1, typename _Tp2>
inline bool
operator>=(const shared_ptr<_Tp1>& __a,
const shared_ptr<_Tp2>& __b) noexcept
{ return !(__a < __b); }
template<typename _Tp>
inline bool
operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
{ return !(__a < nullptr); }
template<typename _Tp>
inline bool
operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
{ return !(nullptr < __a); }
// C++14 §20.8.2.2.8
template<typename _Tp>
inline void
swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept
{ __a.swap(__b); }
// 8.2.1.3, shared_ptr casts
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
static_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return shared_ptr<_Tp>(__r, static_cast<__elem_t*>(__r.get()));
}
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
if (_Tp* __p = dynamic_cast<__elem_t*>(__r.get()))
return shared_ptr<_Tp>(__r, __p);
return shared_ptr<_Tp>();
}
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
const_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return shared_ptr<_Tp>(__r, const_cast<__elem_t*>(__r.get()));
}
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
reinterpret_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
{
using __elem_t = typename shared_ptr<_Tp>::element_type;
return shared_ptr<_Tp>(__r, reinterpret_cast<__elem_t*>(__r.get()));
}
// C++14 §20.8.2.3
template<typename _Tp>
class weak_ptr : public __weak_ptr<_Tp>
{
template<typename _Tp1, typename _Res = void>
using _Compatible = enable_if_t<__sp_compatible_v<_Tp1, _Tp>, _Res>;
using _Base_type = __weak_ptr<_Tp>;
public:
constexpr weak_ptr() noexcept = default;
template<typename _Tp1, typename = _Compatible<_Tp1>>
weak_ptr(const shared_ptr<_Tp1>& __r) noexcept
: _Base_type(__r) { }
weak_ptr(const weak_ptr&) noexcept = default;
template<typename _Tp1, typename = _Compatible<_Tp1>>
weak_ptr(const weak_ptr<_Tp1>& __r) noexcept
: _Base_type(__r) { }
weak_ptr(weak_ptr&&) noexcept = default;
template<typename _Tp1, typename = _Compatible<_Tp1>>
weak_ptr(weak_ptr<_Tp1>&& __r) noexcept
: _Base_type(std::move(__r)) { }
weak_ptr&
operator=(const weak_ptr& __r) noexcept = default;
template<typename _Tp1>
_Compatible<_Tp1, weak_ptr&>
operator=(const weak_ptr<_Tp1>& __r) noexcept
{
this->_Base_type::operator=(__r);
return *this;
}
template<typename _Tp1>
_Compatible<_Tp1, weak_ptr&>
operator=(const shared_ptr<_Tp1>& __r) noexcept
{
this->_Base_type::operator=(__r);
return *this;
}
weak_ptr&
operator=(weak_ptr&& __r) noexcept = default;
template<typename _Tp1>
_Compatible<_Tp1, weak_ptr&>
operator=(weak_ptr<_Tp1>&& __r) noexcept
{
this->_Base_type::operator=(std::move(__r));
return *this;
}
shared_ptr<_Tp>
lock() const noexcept
{ return shared_ptr<_Tp>(*this, std::nothrow); }
friend class enable_shared_from_this<_Tp>;
};
// C++14 §20.8.2.3.6
template<typename _Tp>
inline void
swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept
{ __a.swap(__b); }
/// C++14 §20.8.2.2.10
template<typename _Del, typename _Tp>
inline _Del*
get_deleter(const shared_ptr<_Tp>& __p) noexcept
{ return std::get_deleter<_Del>(__p); }
// C++14 §20.8.2.2.11
template<typename _Ch, typename _Tr, typename _Tp>
inline std::basic_ostream<_Ch, _Tr>&
operator<<(std::basic_ostream<_Ch, _Tr>& __os, const shared_ptr<_Tp>& __p)
{
__os << __p.get();
return __os;
}
// C++14 §20.8.2.4
template<typename _Tp = void> class owner_less;
/// Partial specialization of owner_less for shared_ptr.
template<typename _Tp>
struct owner_less<shared_ptr<_Tp>>
: public _Sp_owner_less<shared_ptr<_Tp>, weak_ptr<_Tp>>
{ };
/// Partial specialization of owner_less for weak_ptr.
template<typename _Tp>
struct owner_less<weak_ptr<_Tp>>
: public _Sp_owner_less<weak_ptr<_Tp>, shared_ptr<_Tp>>
{ };
template<>
class owner_less<void>
{
template<typename _Tp, typename _Up>
bool
operator()(shared_ptr<_Tp> const& __lhs,
shared_ptr<_Up> const& __rhs) const
{ return __lhs.owner_before(__rhs); }
template<typename _Tp, typename _Up>
bool
operator()(shared_ptr<_Tp> const& __lhs,
weak_ptr<_Up> const& __rhs) const
{ return __lhs.owner_before(__rhs); }
template<typename _Tp, typename _Up>
bool
operator()(weak_ptr<_Tp> const& __lhs,
shared_ptr<_Up> const& __rhs) const
{ return __lhs.owner_before(__rhs); }
template<typename _Tp, typename _Up>
bool
operator()(weak_ptr<_Tp> const& __lhs,
weak_ptr<_Up> const& __rhs) const
{ return __lhs.owner_before(__rhs); }
typedef void is_transparent;
};
// C++14 §20.8.2.6
template<typename _Tp>
inline bool
atomic_is_lock_free(const shared_ptr<_Tp>* __p)
{ return std::atomic_is_lock_free<_Tp, __default_lock_policy>(__p); }
template<typename _Tp>
shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p)
{ return std::atomic_load<_Tp>(__p); }
template<typename _Tp>
shared_ptr<_Tp>
atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order __mo)
{ return std::atomic_load_explicit<_Tp>(__p, __mo); }
template<typename _Tp>
void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
{ return std::atomic_store<_Tp>(__p, __r); }
template<typename _Tp>
shared_ptr<_Tp>
atomic_store_explicit(const shared_ptr<_Tp>* __p,
shared_ptr<_Tp> __r,
memory_order __mo)
{ return std::atomic_store_explicit<_Tp>(__p, __r, __mo); }
template<typename _Tp>
void atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
{ return std::atomic_exchange<_Tp>(__p, __r); }
template<typename _Tp>
shared_ptr<_Tp>
atomic_exchange_explicit(const shared_ptr<_Tp>* __p,
shared_ptr<_Tp> __r,
memory_order __mo)
{ return std::atomic_exchange_explicit<_Tp>(__p, __r, __mo); }
template<typename _Tp>
bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p,
shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w)
{ return std::atomic_compare_exchange_weak<_Tp>(__p, __v, __w); }
template<typename _Tp>
bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p,
shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w)
{ return std::atomic_compare_exchange_strong<_Tp>(__p, __v, __w); }
template<typename _Tp>
bool atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p,
shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w,
memory_order __success,
memory_order __failure)
{ return std::atomic_compare_exchange_weak_explicit<_Tp>(__p, __v, __w,
__success,
__failure); }
template<typename _Tp>
bool atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p,
shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w,
memory_order __success,
memory_order __failure)
{ return std::atomic_compare_exchange_strong_explicit<_Tp>(__p, __v, __w,
__success,
__failure); }
//enable_shared_from_this
template<typename _Tp>
class enable_shared_from_this
{
protected:
constexpr enable_shared_from_this() noexcept { }
enable_shared_from_this(const enable_shared_from_this&) noexcept { }
enable_shared_from_this&
operator=(const enable_shared_from_this&) noexcept
{ return *this; }
~enable_shared_from_this() { }
public:
shared_ptr<_Tp>
shared_from_this()
{ return shared_ptr<_Tp>(this->_M_weak_this); }
shared_ptr<const _Tp>
shared_from_this() const
{ return shared_ptr<const _Tp>(this->_M_weak_this); }
weak_ptr<_Tp>
weak_from_this() noexcept
{ return _M_weak_this; }
weak_ptr<const _Tp>
weak_from_this() const noexcept
{ return _M_weak_this; }
private:
template<typename _Tp1>
void
_M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const noexcept
{ _M_weak_this._M_assign(__p, __n); }
// Found by ADL when this is an associated class.
friend const enable_shared_from_this*
__expt_enable_shared_from_this_base(const enable_shared_from_this* __p)
{ return __p; }
template<typename>
friend class shared_ptr;
mutable weak_ptr<_Tp> _M_weak_this;
};
} // namespace fundamentals_v2
} // namespace experimental
/// std::hash specialization for shared_ptr.
template<typename _Tp>
struct hash<experimental::shared_ptr<_Tp>>
: public __hash_base<size_t, experimental::shared_ptr<_Tp>>
{
size_t
operator()(const experimental::shared_ptr<_Tp>& __s) const noexcept
{ return std::hash<_Tp*>()(__s.get()); }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H
// Filesystem directory utilities -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/fs_dir.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{experimental/filesystem}
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H
#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
# include <typeinfo>
# include <ext/concurrence.h>
# include <bits/unique_ptr.h>
# include <bits/shared_ptr.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
namespace filesystem
{
inline namespace v1
{
/**
* @ingroup filesystem-ts
* @{
*/
class file_status
{
public:
// constructors
explicit
file_status(file_type __ft = file_type::none,
perms __prms = perms::unknown) noexcept
: _M_type(__ft), _M_perms(__prms) { }
file_status(const file_status&) noexcept = default;
file_status(file_status&&) noexcept = default;
~file_status() = default;
file_status& operator=(const file_status&) noexcept = default;
file_status& operator=(file_status&&) noexcept = default;
// observers
file_type type() const noexcept { return _M_type; }
perms permissions() const noexcept { return _M_perms; }
// modifiers
void type(file_type __ft) noexcept { _M_type = __ft; }
void permissions(perms __prms) noexcept { _M_perms = __prms; }
private:
file_type _M_type;
perms _M_perms;
};
_GLIBCXX_BEGIN_NAMESPACE_CXX11
class directory_entry
{
public:
// constructors and destructor
directory_entry() noexcept = default;
directory_entry(const directory_entry&) = default;
directory_entry(directory_entry&&) noexcept = default;
explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { }
~directory_entry() = default;
// modifiers
directory_entry& operator=(const directory_entry&) = default;
directory_entry& operator=(directory_entry&&) noexcept = default;
void assign(const filesystem::path& __p) { _M_path = __p; }
void
replace_filename(const filesystem::path& __p)
{ _M_path = _M_path.parent_path() / __p; }
// observers
const filesystem::path& path() const noexcept { return _M_path; }
operator const filesystem::path&() const noexcept { return _M_path; }
file_status
status() const
{ return filesystem::status(_M_path); }
file_status
status(error_code& __ec) const noexcept
{ return filesystem::status(_M_path, __ec); }
file_status
symlink_status() const
{ return filesystem::symlink_status(_M_path); }
file_status
symlink_status(error_code& __ec) const noexcept
{ return filesystem::symlink_status(_M_path, __ec); }
bool
operator< (const directory_entry& __rhs) const noexcept
{ return _M_path < __rhs._M_path; }
bool
operator==(const directory_entry& __rhs) const noexcept
{ return _M_path == __rhs._M_path; }
bool
operator!=(const directory_entry& __rhs) const noexcept
{ return _M_path != __rhs._M_path; }
bool
operator<=(const directory_entry& __rhs) const noexcept
{ return _M_path <= __rhs._M_path; }
bool
operator> (const directory_entry& __rhs) const noexcept
{ return _M_path > __rhs._M_path; }
bool
operator>=(const directory_entry& __rhs) const noexcept
{ return _M_path >= __rhs._M_path; }
private:
filesystem::path _M_path;
};
struct _Dir;
class directory_iterator;
class recursive_directory_iterator;
struct __directory_iterator_proxy
{
const directory_entry& operator*() const& noexcept { return _M_entry; }
directory_entry operator*() && noexcept { return std::move(_M_entry); }
private:
friend class directory_iterator;
friend class recursive_directory_iterator;
explicit
__directory_iterator_proxy(const directory_entry& __e) : _M_entry(__e) { }
directory_entry _M_entry;
};
class directory_iterator
{
public:
typedef directory_entry value_type;
typedef ptrdiff_t difference_type;
typedef const directory_entry* pointer;
typedef const directory_entry& reference;
typedef input_iterator_tag iterator_category;
directory_iterator() = default;
explicit
directory_iterator(const path& __p)
: directory_iterator(__p, directory_options::none, nullptr) { }
directory_iterator(const path& __p, directory_options __options)
: directory_iterator(__p, __options, nullptr) { }
directory_iterator(const path& __p, error_code& __ec) noexcept
: directory_iterator(__p, directory_options::none, __ec) { }
directory_iterator(const path& __p,
directory_options __options,
error_code& __ec) noexcept
: directory_iterator(__p, __options, &__ec) { }
directory_iterator(const directory_iterator& __rhs) = default;
directory_iterator(directory_iterator&& __rhs) noexcept = default;
~directory_iterator() = default;
directory_iterator&
operator=(const directory_iterator& __rhs) = default;
directory_iterator&
operator=(directory_iterator&& __rhs) noexcept = default;
const directory_entry& operator*() const;
const directory_entry* operator->() const { return &**this; }
directory_iterator& operator++();
directory_iterator& increment(error_code& __ec) noexcept;
__directory_iterator_proxy operator++(int)
{
__directory_iterator_proxy __pr{**this};
++*this;
return __pr;
}
private:
directory_iterator(const path&, directory_options, error_code*);
friend bool
operator==(const directory_iterator& __lhs,
const directory_iterator& __rhs);
friend class recursive_directory_iterator;
std::shared_ptr<_Dir> _M_dir;
};
inline directory_iterator
begin(directory_iterator __iter) noexcept
{ return __iter; }
inline directory_iterator
end(directory_iterator) noexcept
{ return directory_iterator(); }
inline bool
operator==(const directory_iterator& __lhs, const directory_iterator& __rhs)
{
return !__rhs._M_dir.owner_before(__lhs._M_dir)
&& !__lhs._M_dir.owner_before(__rhs._M_dir);
}
inline bool
operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs)
{ return !(__lhs == __rhs); }
class recursive_directory_iterator
{
public:
typedef directory_entry value_type;
typedef ptrdiff_t difference_type;
typedef const directory_entry* pointer;
typedef const directory_entry& reference;
typedef input_iterator_tag iterator_category;
recursive_directory_iterator() = default;
explicit
recursive_directory_iterator(const path& __p)
: recursive_directory_iterator(__p, directory_options::none, nullptr) { }
recursive_directory_iterator(const path& __p, directory_options __options)
: recursive_directory_iterator(__p, __options, nullptr) { }
recursive_directory_iterator(const path& __p,
directory_options __options,
error_code& __ec) noexcept
: recursive_directory_iterator(__p, __options, &__ec) { }
recursive_directory_iterator(const path& __p, error_code& __ec) noexcept
: recursive_directory_iterator(__p, directory_options::none, &__ec) { }
recursive_directory_iterator(
const recursive_directory_iterator&) = default;
recursive_directory_iterator(recursive_directory_iterator&&) = default;
~recursive_directory_iterator();
// observers
directory_options options() const { return _M_options; }
int depth() const;
bool recursion_pending() const { return _M_pending; }
const directory_entry& operator*() const;
const directory_entry* operator->() const { return &**this; }
// modifiers
recursive_directory_iterator&
operator=(const recursive_directory_iterator& __rhs) noexcept;
recursive_directory_iterator&
operator=(recursive_directory_iterator&& __rhs) noexcept;
recursive_directory_iterator& operator++();
recursive_directory_iterator& increment(error_code& __ec) noexcept;
__directory_iterator_proxy operator++(int)
{
__directory_iterator_proxy __pr{**this};
++*this;
return __pr;
}
void pop();
void pop(error_code&);
void disable_recursion_pending() { _M_pending = false; }
private:
recursive_directory_iterator(const path&, directory_options, error_code*);
friend bool
operator==(const recursive_directory_iterator& __lhs,
const recursive_directory_iterator& __rhs);
struct _Dir_stack;
std::shared_ptr<_Dir_stack> _M_dirs;
directory_options _M_options = {};
bool _M_pending = false;
};
inline recursive_directory_iterator
begin(recursive_directory_iterator __iter) noexcept
{ return __iter; }
inline recursive_directory_iterator
end(recursive_directory_iterator) noexcept
{ return recursive_directory_iterator(); }
inline bool
operator==(const recursive_directory_iterator& __lhs,
const recursive_directory_iterator& __rhs)
{
return !__rhs._M_dirs.owner_before(__lhs._M_dirs)
&& !__lhs._M_dirs.owner_before(__rhs._M_dirs);
}
inline bool
operator!=(const recursive_directory_iterator& __lhs,
const recursive_directory_iterator& __rhs)
{ return !(__lhs == __rhs); }
_GLIBCXX_END_NAMESPACE_CXX11
// @} group filesystem-ts
} // namespace v1
} // namespace filesystem
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H
// Filesystem operational functions -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your __option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/bits/fs_fwd.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{experimental/filesystem}
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H
#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <cstdint>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
namespace filesystem
{
inline namespace v1
{
/**
* @ingroup filesystem-ts
* @{
*/
path absolute(const path& __p, const path& __base = current_path());
path canonical(const path& __p, const path& __base = current_path());
path canonical(const path& __p, error_code& __ec);
path canonical(const path& __p, const path& __base, error_code& __ec);
inline void
copy(const path& __from, const path& __to)
{ copy(__from, __to, copy_options::none); }
inline void
copy(const path& __from, const path& __to, error_code& __ec) noexcept
{ copy(__from, __to, copy_options::none, __ec); }
void copy(const path& __from, const path& __to, copy_options __options);
void copy(const path& __from, const path& __to, copy_options __options,
error_code& __ec) noexcept;
inline bool
copy_file(const path& __from, const path& __to)
{ return copy_file(__from, __to, copy_options::none); }
inline bool
copy_file(const path& __from, const path& __to, error_code& __ec) noexcept
{ return copy_file(__from, __to, copy_options::none, __ec); }
bool copy_file(const path& __from, const path& __to, copy_options __option);
bool copy_file(const path& __from, const path& __to, copy_options __option,
error_code& __ec) noexcept;
void copy_symlink(const path& __existing_symlink, const path& __new_symlink);
void copy_symlink(const path& __existing_symlink, const path& __new_symlink,
error_code& __ec) noexcept;
bool create_directories(const path& __p);
bool create_directories(const path& __p, error_code& __ec) noexcept;
bool create_directory(const path& __p);
bool create_directory(const path& __p, error_code& __ec) noexcept;
bool create_directory(const path& __p, const path& attributes);
bool create_directory(const path& __p, const path& attributes,
error_code& __ec) noexcept;
void create_directory_symlink(const path& __to, const path& __new_symlink);
void create_directory_symlink(const path& __to, const path& __new_symlink,
error_code& __ec) noexcept;
void create_hard_link(const path& __to, const path& __new_hard_link);
void create_hard_link(const path& __to, const path& __new_hard_link,
error_code& __ec) noexcept;
void create_symlink(const path& __to, const path& __new_symlink);
void create_symlink(const path& __to, const path& __new_symlink,
error_code& __ec) noexcept;
path current_path();
path current_path(error_code& __ec);
void current_path(const path& __p);
void current_path(const path& __p, error_code& __ec) noexcept;
bool
equivalent(const path& __p1, const path& __p2);
bool
equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept;
inline bool
exists(file_status __s) noexcept
{ return status_known(__s) && __s.type() != file_type::not_found; }
inline bool
exists(const path& __p)
{ return exists(status(__p)); }
inline bool
exists(const path& __p, error_code& __ec) noexcept
{
auto __s = status(__p, __ec);
if (status_known(__s))
{
__ec.clear();
return __s.type() != file_type::not_found;
}
return false;
}
uintmax_t file_size(const path& __p);
uintmax_t file_size(const path& __p, error_code& __ec) noexcept;
uintmax_t hard_link_count(const path& __p);
uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept;
inline bool
is_block_file(file_status __s) noexcept
{ return __s.type() == file_type::block; }
inline bool
is_block_file(const path& __p)
{ return is_block_file(status(__p)); }
inline bool
is_block_file(const path& __p, error_code& __ec) noexcept
{ return is_block_file(status(__p, __ec)); }
inline bool
is_character_file(file_status __s) noexcept
{ return __s.type() == file_type::character; }
inline bool
is_character_file(const path& __p)
{ return is_character_file(status(__p)); }
inline bool
is_character_file(const path& __p, error_code& __ec) noexcept
{ return is_character_file(status(__p, __ec)); }
inline bool
is_directory(file_status __s) noexcept
{ return __s.type() == file_type::directory; }
inline bool
is_directory(const path& __p)
{ return is_directory(status(__p)); }
inline bool
is_directory(const path& __p, error_code& __ec) noexcept
{ return is_directory(status(__p, __ec)); }
bool is_empty(const path& __p);
bool is_empty(const path& __p, error_code& __ec) noexcept;
inline bool
is_fifo(file_status __s) noexcept
{ return __s.type() == file_type::fifo; }
inline bool
is_fifo(const path& __p)
{ return is_fifo(status(__p)); }
inline bool
is_fifo(const path& __p, error_code& __ec) noexcept
{ return is_fifo(status(__p, __ec)); }
inline bool
is_other(file_status __s) noexcept
{
return exists(__s) && !is_regular_file(__s) && !is_directory(__s)
&& !is_symlink(__s);
}
inline bool
is_other(const path& __p)
{ return is_other(status(__p)); }
inline bool
is_other(const path& __p, error_code& __ec) noexcept
{ return is_other(status(__p, __ec)); }
inline bool
is_regular_file(file_status __s) noexcept
{ return __s.type() == file_type::regular; }
inline bool
is_regular_file(const path& __p)
{ return is_regular_file(status(__p)); }
inline bool
is_regular_file(const path& __p, error_code& __ec) noexcept
{ return is_regular_file(status(__p, __ec)); }
inline bool
is_socket(file_status __s) noexcept
{ return __s.type() == file_type::socket; }
inline bool
is_socket(const path& __p)
{ return is_socket(status(__p)); }
inline bool
is_socket(const path& __p, error_code& __ec) noexcept
{ return is_socket(status(__p, __ec)); }
inline bool
is_symlink(file_status __s) noexcept
{ return __s.type() == file_type::symlink; }
inline bool
is_symlink(const path& __p)
{ return is_symlink(symlink_status(__p)); }
inline bool
is_symlink(const path& __p, error_code& __ec) noexcept
{ return is_symlink(symlink_status(__p, __ec)); }
file_time_type last_write_time(const path& __p);
file_time_type last_write_time(const path& __p, error_code& __ec) noexcept;
void last_write_time(const path& __p, file_time_type __new_time);
void last_write_time(const path& __p, file_time_type __new_time,
error_code& __ec) noexcept;
void permissions(const path& __p, perms __prms);
void permissions(const path& __p, perms __prms, error_code& __ec) noexcept;
path read_symlink(const path& __p);
path read_symlink(const path& __p, error_code& __ec);
bool remove(const path& __p);
bool remove(const path& __p, error_code& __ec) noexcept;
uintmax_t remove_all(const path& __p);
uintmax_t remove_all(const path& __p, error_code& __ec) noexcept;
void rename(const path& __from, const path& __to);
void rename(const path& __from, const path& __to, error_code& __ec) noexcept;
void resize_file(const path& __p, uintmax_t __size);
void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept;
space_info space(const path& __p);
space_info space(const path& __p, error_code& __ec) noexcept;
file_status status(const path& __p);
file_status status(const path& __p, error_code& __ec) noexcept;
inline bool status_known(file_status __s) noexcept
{ return __s.type() != file_type::none; }
file_status symlink_status(const path& __p);
file_status symlink_status(const path& __p, error_code& __ec) noexcept;
path system_complete(const path& __p);
path system_complete(const path& __p, error_code& __ec);
path temp_directory_path();
path temp_directory_path(error_code& __ec);
// @} group filesystem-ts
} // namespace v1
} // namespace filesystem
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H
// <experimental/memory> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/memory
* This is a TS C++ Library header.
*/
//
// N4336 Working Draft, C++ Extensions for Library Fundamentals, Version 2
//
#ifndef _GLIBCXX_EXPERIMENTAL_MEMORY
#define _GLIBCXX_EXPERIMENTAL_MEMORY 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <memory>
#include <type_traits>
#include <utility>
#include <experimental/bits/shared_ptr.h>
#include <bits/functional_hash.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_observer_ptr 201411
template <typename _Tp>
class observer_ptr
{
public:
// publish our template parameter and variations thereof
using element_type = _Tp;
using __pointer = add_pointer_t<_Tp>; // exposition-only
using __reference = add_lvalue_reference_t<_Tp>; // exposition-only
// 3.2.2, observer_ptr constructors
// default c’tor
constexpr observer_ptr() noexcept
: __t()
{ }
// pointer-accepting c’tors
constexpr observer_ptr(nullptr_t) noexcept
: __t()
{ }
constexpr explicit observer_ptr(__pointer __p) noexcept
: __t(__p)
{ }
// copying c’tors (in addition to compiler-generated copy c’tor)
template <typename _Up,
typename = typename enable_if<
is_convertible<typename add_pointer<_Up>::type, __pointer
>::value
>::type>
constexpr observer_ptr(observer_ptr<_Up> __p) noexcept
: __t(__p.get())
{
}
// 3.2.3, observer_ptr observers
constexpr __pointer
get() const noexcept
{
return __t;
}
constexpr __reference
operator*() const
{
return *get();
}
constexpr __pointer
operator->() const noexcept
{
return get();
}
constexpr explicit operator bool() const noexcept
{
return get() != nullptr;
}
// 3.2.4, observer_ptr conversions
constexpr explicit operator __pointer() const noexcept
{
return get();
}
// 3.2.5, observer_ptr modifiers
constexpr __pointer
release() noexcept
{
__pointer __tmp = get();
reset();
return __tmp;
}
constexpr void
reset(__pointer __p = nullptr) noexcept
{
__t = __p;
}
constexpr void
swap(observer_ptr& __p) noexcept
{
std::swap(__t, __p.__t);
}
private:
__pointer __t;
}; // observer_ptr<>
template<typename _Tp>
void
swap(observer_ptr<_Tp>& __p1, observer_ptr<_Tp>& __p2) noexcept
{
__p1.swap(__p2);
}
template<typename _Tp>
observer_ptr<_Tp>
make_observer(_Tp* __p) noexcept
{
return observer_ptr<_Tp>(__p);
}
template<typename _Tp, typename _Up>
bool
operator==(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return __p1.get() == __p2.get();
}
template<typename _Tp, typename _Up>
bool
operator!=(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return !(__p1 == __p2);
}
template<typename _Tp>
bool
operator==(observer_ptr<_Tp> __p, nullptr_t) noexcept
{
return !__p;
}
template<typename _Tp>
bool
operator==(nullptr_t, observer_ptr<_Tp> __p) noexcept
{
return !__p;
}
template<typename _Tp>
bool
operator!=(observer_ptr<_Tp> __p, nullptr_t) noexcept
{
return bool(__p);
}
template<typename _Tp>
bool
operator!=(nullptr_t, observer_ptr<_Tp> __p) noexcept
{
return bool(__p);
}
template<typename _Tp, typename _Up>
bool
operator<(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return std::less<typename common_type<typename add_pointer<_Tp>::type,
typename add_pointer<_Up>::type
>::type
>{}(__p1.get(), __p2.get());
}
template<typename _Tp, typename _Up>
bool
operator>(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return __p2 < __p1;
}
template<typename _Tp, typename _Up>
bool
operator<=(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return !(__p2 < __p1);
}
template<typename _Tp, typename _Up>
bool
operator>=(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return !(__p1 < __p2);
}
} // namespace fundamentals_v2
} // namespace experimental
template <typename _Tp>
struct hash<experimental::observer_ptr<_Tp>>
{
using result_type = size_t;
using argument_type = experimental::observer_ptr<_Tp>;
size_t
operator()(const experimental::observer_ptr<_Tp>& __t) const
noexcept(noexcept(hash<typename add_pointer<_Tp>::type> {}(__t.get())))
{
return hash<typename add_pointer<_Tp>::type> {}(__t.get());
}
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_MEMORY
// <experimental/unordered_map> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/unordered_map
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_UNORDERED_MAP
#define _GLIBCXX_EXPERIMENTAL_UNORDERED_MAP 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <unordered_map>
#include <experimental/bits/erase_if.h>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
template<typename _Key, typename _Tp, typename _Hash, typename _CPred,
typename _Alloc, typename _Predicate>
inline void
erase_if(unordered_map<_Key, _Tp, _Hash, _CPred, _Alloc>& __cont,
_Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
template<typename _Key, typename _Tp, typename _Hash, typename _CPred,
typename _Alloc, typename _Predicate>
inline void
erase_if(unordered_multimap<_Key, _Tp, _Hash, _CPred, _Alloc>& __cont,
_Predicate __pred)
{ __detail::__erase_nodes_if(__cont, __pred); }
namespace pmr {
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>>
using unordered_map
= std::unordered_map<_Key, _Tp, _Hash, _Pred,
polymorphic_allocator<pair<const _Key, _Tp>>>;
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>>
using unordered_multimap
= std::unordered_multimap<_Key, _Tp, _Hash, _Pred,
polymorphic_allocator<pair<const _Key, _Tp>>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_UNORDERED_MAP
// <experimental/filesystem> -*- C++ -*-
// Copyright (C) 2014-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/filesystem
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_FILESYSTEM
#define _GLIBCXX_EXPERIMENTAL_FILESYSTEM 1
#pragma GCC system_header
#if __cplusplus >= 201103L
#include <experimental/bits/fs_fwd.h>
#include <experimental/bits/fs_path.h>
#include <experimental/bits/fs_dir.h>
#include <experimental/bits/fs_ops.h>
#define __cpp_lib_experimental_filesystem 201406
#endif // C++11
#endif // _GLIBCXX_EXPERIMENTAL_FILESYSTEM
// <experimental/vector> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/vector
* This is a TS C++ Library header.
*/
#ifndef _GLIBCXX_EXPERIMENTAL_VECTOR
#define _GLIBCXX_EXPERIMENTAL_VECTOR 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <vector>
#include <algorithm>
#include <experimental/memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_erase_if 201411
template<typename _Tp, typename _Alloc, typename _Predicate>
inline void
erase_if(vector<_Tp, _Alloc>& __cont, _Predicate __pred)
{
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
__cont.end());
}
template<typename _Tp, typename _Alloc, typename _Up>
inline void
erase(vector<_Tp, _Alloc>& __cont, const _Up& __value)
{
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
__cont.end());
}
namespace pmr {
template<typename _Tp>
using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
} // namespace pmr
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#endif // _GLIBCXX_EXPERIMENTAL_VECTOR
// <experimental/numeric> -*- C++ -*-
// Copyright (C) 2015-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file experimental/numeric
* This is a TS C++ Library header.
*/
//
// N4336 Working Draft, C++ Extensions for Library Fundamentals, Version 2
//
#ifndef _GLIBCXX_EXPERIMENTAL_NUMERIC
#define _GLIBCXX_EXPERIMENTAL_NUMERIC 1
#pragma GCC system_header
#if __cplusplus >= 201402L
#include <numeric>
#include <experimental/type_traits>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace experimental
{
inline namespace fundamentals_v2
{
#define __cpp_lib_experimental_gcd_lcm 201411
/// Greatest common divisor
template<typename _Mn, typename _Nn>
constexpr common_type_t<_Mn, _Nn>
gcd(_Mn __m, _Nn __n) noexcept
{
static_assert(is_integral_v<_Mn>,
"std::experimental::gcd arguments must be integers");
static_assert(is_integral_v<_Nn>,
"std::experimental::gcd arguments must be integers");
static_assert(_Mn(2) != _Mn(1),
"std::experimental::gcd arguments must not be bool");
static_assert(_Nn(2) != _Nn(1),
"std::experimental::gcd arguments must not be bool");
using _Up = make_unsigned_t<common_type_t<_Mn, _Nn>>;
return std::__detail::__gcd(std::__detail::__absu<_Up>(__m),
std::__detail::__absu<_Up>(__n));
}
/// Least common multiple
template<typename _Mn, typename _Nn>
constexpr common_type_t<_Mn, _Nn>
lcm(_Mn __m, _Nn __n)
{
static_assert(is_integral_v<_Mn>,
"std::experimental::lcm arguments must be integers");
static_assert(is_integral_v<_Nn>,
"std::experimental::lcm arguments must be integers");
static_assert(_Mn(2) != _Mn(1),
"std::experimental::lcm arguments must not be bool");
static_assert(_Nn(2) != _Nn(1),
"std::experimental::lcm arguments must not be bool");
using _Up = make_unsigned_t<common_type_t<_Mn, _Nn>>;
return std::__detail::__lcm(std::__detail::__absu<_Up>(__m),
std::__detail::__absu<_Up>(__n));
}
} // namespace fundamentals_v2
} // namespace experimental
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cplusplus <= 201103L
#endif // _GLIBCXX_EXPERIMENTAL_NUMERIC
// <stack> -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file include/stack
* This is a Standard C++ Library header.
*/
#ifndef _GLIBCXX_STACK
#define _GLIBCXX_STACK 1
#pragma GCC system_header
#include <deque>
#include <bits/stl_stack.h>
#endif /* _GLIBCXX_STACK */
// -*- C++ -*-
// Copyright (C) 2007-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/numeric_traits.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _EXT_NUMERIC_TRAITS
#define _EXT_NUMERIC_TRAITS 1
#pragma GCC system_header
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Compile time constants for builtin types.
// Sadly std::numeric_limits member functions cannot be used for this.
#define __glibcxx_signed(_Tp) ((_Tp)(-1) < 0)
#define __glibcxx_digits(_Tp) \
(sizeof(_Tp) * __CHAR_BIT__ - __glibcxx_signed(_Tp))
#define __glibcxx_min(_Tp) \
(__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
#define __glibcxx_max(_Tp) \
(__glibcxx_signed(_Tp) ? \
(((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)
template<typename _Value>
struct __numeric_traits_integer
{
// Only integers for initialization of member constant.
static const _Value __min = __glibcxx_min(_Value);
static const _Value __max = __glibcxx_max(_Value);
// NB: these two also available in std::numeric_limits as compile
// time constants, but <limits> is big and we avoid including it.
static const bool __is_signed = __glibcxx_signed(_Value);
static const int __digits = __glibcxx_digits(_Value);
};
template<typename _Value>
const _Value __numeric_traits_integer<_Value>::__min;
template<typename _Value>
const _Value __numeric_traits_integer<_Value>::__max;
template<typename _Value>
const bool __numeric_traits_integer<_Value>::__is_signed;
template<typename _Value>
const int __numeric_traits_integer<_Value>::__digits;
#undef __glibcxx_signed
#undef __glibcxx_digits
#undef __glibcxx_min
#undef __glibcxx_max
#define __glibcxx_floating(_Tp, _Fval, _Dval, _LDval) \
(std::__are_same<_Tp, float>::__value ? _Fval \
: std::__are_same<_Tp, double>::__value ? _Dval : _LDval)
#define __glibcxx_max_digits10(_Tp) \
(2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
__LDBL_MANT_DIG__) * 643L / 2136)
#define __glibcxx_digits10(_Tp) \
__glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
#define __glibcxx_max_exponent10(_Tp) \
__glibcxx_floating(_Tp, __FLT_MAX_10_EXP__, __DBL_MAX_10_EXP__, \
__LDBL_MAX_10_EXP__)
template<typename _Value>
struct __numeric_traits_floating
{
// Only floating point types. See N1822.
static const int __max_digits10 = __glibcxx_max_digits10(_Value);
// See above comment...
static const bool __is_signed = true;
static const int __digits10 = __glibcxx_digits10(_Value);
static const int __max_exponent10 = __glibcxx_max_exponent10(_Value);
};
template<typename _Value>
const int __numeric_traits_floating<_Value>::__max_digits10;
template<typename _Value>
const bool __numeric_traits_floating<_Value>::__is_signed;
template<typename _Value>
const int __numeric_traits_floating<_Value>::__digits10;
template<typename _Value>
const int __numeric_traits_floating<_Value>::__max_exponent10;
template<typename _Value>
struct __numeric_traits
: public __conditional_type<std::__is_integer<_Value>::__value,
__numeric_traits_integer<_Value>,
__numeric_traits_floating<_Value> >::__type
{ };
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#undef __glibcxx_floating
#undef __glibcxx_max_digits10
#undef __glibcxx_digits10
#undef __glibcxx_max_exponent10
#endif
// Allocator that wraps operator new -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/new_allocator.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _NEW_ALLOCATOR_H
#define _NEW_ALLOCATOR_H 1
#include <bits/c++config.h>
#include <new>
#include <bits/functexcept.h>
#include <bits/move.h>
#if __cplusplus >= 201103L
#include <type_traits>
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/**
* @brief An allocator that uses global new, as per [20.4].
* @ingroup allocators
*
* This is precisely the allocator defined in the C++ Standard.
* - all allocation calls operator new
* - all deallocation calls operator delete
*
* @tparam _Tp Type of allocated object.
*/
template<typename _Tp>
class new_allocator
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template<typename _Tp1>
struct rebind
{ typedef new_allocator<_Tp1> other; };
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2103. propagate_on_container_move_assignment
typedef std::true_type propagate_on_container_move_assignment;
#endif
new_allocator() _GLIBCXX_USE_NOEXCEPT { }
new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
new_allocator(const new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
pointer
address(reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
const_pointer
address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
// NB: __n is permitted to be 0. The C++ standard says nothing
// about what the return value is when __n == 0.
pointer
allocate(size_type __n, const void* = static_cast<const void*>(0))
{
if (__n > this->max_size())
std::__throw_bad_alloc();
#if __cpp_aligned_new
if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
{
std::align_val_t __al = std::align_val_t(alignof(_Tp));
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), __al));
}
#endif
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
}
// __p is not permitted to be a null pointer.
void
deallocate(pointer __p, size_type)
{
#if __cpp_aligned_new
if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
{
::operator delete(__p, std::align_val_t(alignof(_Tp)));
return;
}
#endif
::operator delete(__p);
}
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
{ return size_t(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
void
construct(_Up* __p, _Args&&... __args)
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
template<typename _Up>
void
destroy(_Up* __p) { __p->~_Up(); }
#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) _Tp(__val); }
void
destroy(pointer __p) { __p->~_Tp(); }
#endif
};
template<typename _Tp>
inline bool
operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
{ return true; }
template<typename _Tp>
inline bool
operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
{ return false; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// <vstring.h> Forward declarations -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/vstring_fwd.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/vstring.h}
*/
#ifndef _VSTRING_FWD_H
#define _VSTRING_FWD_H 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/char_traits.h>
#include <bits/allocator.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
class __sso_string_base;
template<typename _CharT, typename _Traits, typename _Alloc>
class __rc_string_base;
template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
typename _Alloc = std::allocator<_CharT>,
template
<typename, typename, typename> class _Base = __sso_string_base>
class __versa_string;
typedef __versa_string<char> __vstring;
typedef __vstring __sso_string;
typedef
__versa_string<char, std::char_traits<char>,
std::allocator<char>, __rc_string_base> __rc_string;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef __versa_string<wchar_t> __wvstring;
typedef __wvstring __wsso_string;
typedef
__versa_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>, __rc_string_base> __wrc_string;
#endif
#if ((__cplusplus >= 201103L) \
&& defined(_GLIBCXX_USE_C99_STDINT_TR1))
typedef __versa_string<char16_t> __u16vstring;
typedef __u16vstring __u16sso_string;
typedef
__versa_string<char16_t, std::char_traits<char16_t>,
std::allocator<char16_t>, __rc_string_base> __u16rc_string;
typedef __versa_string<char32_t> __u32vstring;
typedef __u32vstring __u32sso_string;
typedef
__versa_string<char32_t, std::char_traits<char32_t>,
std::allocator<char32_t>, __rc_string_base> __u32rc_string;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _VSTRING_FWD_H */
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/type_traits.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _EXT_TYPE_TRAITS
#define _EXT_TYPE_TRAITS 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
extern "C++" {
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Define a nested type if some predicate holds.
template<bool, typename>
struct __enable_if
{ };
template<typename _Tp>
struct __enable_if<true, _Tp>
{ typedef _Tp __type; };
// Conditional expression for types. If true, first, if false, second.
template<bool _Cond, typename _Iftrue, typename _Iffalse>
struct __conditional_type
{ typedef _Iftrue __type; };
template<typename _Iftrue, typename _Iffalse>
struct __conditional_type<false, _Iftrue, _Iffalse>
{ typedef _Iffalse __type; };
// Given an integral builtin type, return the corresponding unsigned type.
template<typename _Tp>
struct __add_unsigned
{
private:
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
public:
typedef typename __if_type::__type __type;
};
template<>
struct __add_unsigned<char>
{ typedef unsigned char __type; };
template<>
struct __add_unsigned<signed char>
{ typedef unsigned char __type; };
template<>
struct __add_unsigned<short>
{ typedef unsigned short __type; };
template<>
struct __add_unsigned<int>
{ typedef unsigned int __type; };
template<>
struct __add_unsigned<long>
{ typedef unsigned long __type; };
template<>
struct __add_unsigned<long long>
{ typedef unsigned long long __type; };
// Declare but don't define.
template<>
struct __add_unsigned<bool>;
template<>
struct __add_unsigned<wchar_t>;
// Given an integral builtin type, return the corresponding signed type.
template<typename _Tp>
struct __remove_unsigned
{
private:
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
public:
typedef typename __if_type::__type __type;
};
template<>
struct __remove_unsigned<char>
{ typedef signed char __type; };
template<>
struct __remove_unsigned<unsigned char>
{ typedef signed char __type; };
template<>
struct __remove_unsigned<unsigned short>
{ typedef short __type; };
template<>
struct __remove_unsigned<unsigned int>
{ typedef int __type; };
template<>
struct __remove_unsigned<unsigned long>
{ typedef long __type; };
template<>
struct __remove_unsigned<unsigned long long>
{ typedef long long __type; };
// Declare but don't define.
template<>
struct __remove_unsigned<bool>;
template<>
struct __remove_unsigned<wchar_t>;
// For use in string and vstring.
template<typename _Type>
inline bool
__is_null_pointer(_Type* __ptr)
{ return __ptr == 0; }
template<typename _Type>
inline bool
__is_null_pointer(_Type)
{ return false; }
#if __cplusplus >= 201103L
inline bool
__is_null_pointer(std::nullptr_t)
{ return true; }
#endif
// For complex and cmath
template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
struct __promote
{ typedef double __type; };
// No nested __type member for non-integer non-floating point types,
// allows this type to be used for SFINAE to constrain overloads in
// <cmath> and <complex> to only the intended types.
template<typename _Tp>
struct __promote<_Tp, false>
{ };
template<>
struct __promote<long double>
{ typedef long double __type; };
template<>
struct __promote<double>
{ typedef double __type; };
template<>
struct __promote<float>
{ typedef float __type; };
template<typename _Tp, typename _Up,
typename _Tp2 = typename __promote<_Tp>::__type,
typename _Up2 = typename __promote<_Up>::__type>
struct __promote_2
{
typedef __typeof__(_Tp2() + _Up2()) __type;
};
template<typename _Tp, typename _Up, typename _Vp,
typename _Tp2 = typename __promote<_Tp>::__type,
typename _Up2 = typename __promote<_Up>::__type,
typename _Vp2 = typename __promote<_Vp>::__type>
struct __promote_3
{
typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type;
};
template<typename _Tp, typename _Up, typename _Vp, typename _Wp,
typename _Tp2 = typename __promote<_Tp>::__type,
typename _Up2 = typename __promote<_Up>::__type,
typename _Vp2 = typename __promote<_Vp>::__type,
typename _Wp2 = typename __promote<_Wp>::__type>
struct __promote_4
{
typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
} // extern "C++"
#endif
// <extptr_allocator.h> -*- C++ -*-
// Copyright (C) 2008-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/**
* @file ext/extptr_allocator.h
* This file is a GNU extension to the Standard C++ Library.
*
* @author Bob Walters
*
* An example allocator which uses an alternative pointer type from
* bits/pointer.h. Supports test cases which confirm container support
* for alternative pointers.
*/
#ifndef _EXTPTR_ALLOCATOR_H
#define _EXTPTR_ALLOCATOR_H 1
#include <memory>
#include <ext/numeric_traits.h>
#include <ext/pointer.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief An example allocator which uses a non-standard pointer type.
* @ingroup allocators
*
* This allocator specifies that containers use a 'relative pointer' as it's
* pointer type. (See ext/pointer.h) Memory allocation in this example
* is still performed using std::allocator.
*/
template<typename _Tp>
class _ExtPtr_allocator
{
public:
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
// Note the non-standard pointer types.
typedef _Pointer_adapter<_Relative_pointer_impl<_Tp> > pointer;
typedef _Pointer_adapter<_Relative_pointer_impl<const _Tp> >
const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template<typename _Up>
struct rebind
{ typedef _ExtPtr_allocator<_Up> other; };
_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
: _M_real_alloc() { }
_ExtPtr_allocator(const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT
: _M_real_alloc(__rarg._M_real_alloc) { }
template<typename _Up>
_ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg)
_GLIBCXX_USE_NOEXCEPT
: _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
{ }
pointer address(reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
pointer allocate(size_type __n, void* __hint = 0)
{ return _M_real_alloc.allocate(__n,__hint); }
void deallocate(pointer __p, size_type __n)
{ _M_real_alloc.deallocate(__p.get(), __n); }
size_type max_size() const _GLIBCXX_USE_NOEXCEPT
{ return __numeric_traits<size_type>::__max / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
void
construct(_Up* __p, _Args&&... __args)
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
template<typename... _Args>
void
construct(pointer __p, _Args&&... __args)
{ construct(__p.get(), std::forward<_Args>(__args)...); }
template<typename _Up>
void
destroy(_Up* __p)
{ __p->~_Up(); }
void destroy(pointer __p)
{ destroy(__p.get()); }
#else
void construct(pointer __p, const _Tp& __val)
{ ::new(__p.get()) _Tp(__val); }
void destroy(pointer __p)
{ __p->~_Tp(); }
#endif
template<typename _Up>
inline bool
operator==(const _ExtPtr_allocator<_Up>& __rarg)
{ return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
inline bool
operator==(const _ExtPtr_allocator& __rarg)
{ return _M_real_alloc == __rarg._M_real_alloc; }
template<typename _Up>
inline bool
operator!=(const _ExtPtr_allocator<_Up>& __rarg)
{ return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
inline bool
operator!=(const _ExtPtr_allocator& __rarg)
{ return _M_real_alloc != __rarg._M_real_alloc; }
template<typename _Up>
inline friend void
swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&);
// A method specific to this implementation.
const std::allocator<_Tp>&
_M_getUnderlyingImp() const
{ return _M_real_alloc; }
private:
std::allocator<_Tp> _M_real_alloc;
};
// _ExtPtr_allocator<void> specialization.
template<>
class _ExtPtr_allocator<void>
{
public:
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef void value_type;
// Note the non-standard pointer types
typedef _Pointer_adapter<_Relative_pointer_impl<void> > pointer;
typedef _Pointer_adapter<_Relative_pointer_impl<const void> >
const_pointer;
template<typename _Up>
struct rebind
{ typedef _ExtPtr_allocator<_Up> other; };
private:
std::allocator<void> _M_real_alloc;
};
template<typename _Tp>
inline void
swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg)
{
std::allocator<_Tp> __tmp( __rarg._M_real_alloc );
__rarg._M_real_alloc = __larg._M_real_alloc;
__larg._M_real_alloc = __tmp;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _EXTPTR_ALLOCATOR_H */
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice and
// this permission notice appear in supporting documentation. None of
// the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied warranty.
/**
* @file ext/typelist.h
* This file is a GNU extension to the Standard C++ Library.
*
* Contains typelist_chain definitions.
* Typelists are an idea by Andrei Alexandrescu.
*/
#ifndef _TYPELIST_H
#define _TYPELIST_H 1
#include <ext/type_traits.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/** @namespace __gnu_cxx::typelist
* @brief GNU typelist extensions for public compile-time use.
*/
namespace typelist
{
struct null_type { };
template<typename Root>
struct node
{
typedef Root root;
};
// Forward declarations of functors.
template<typename Hd, typename Typelist>
struct chain
{
typedef Hd head;
typedef Typelist tail;
};
// Apply all typelist types to unary functor.
template<typename Fn, typename Typelist>
void
apply(Fn&, Typelist);
/// Apply all typelist types to generator functor.
template<typename Gn, typename Typelist>
void
apply_generator(Gn&, Typelist);
// Apply all typelist types and values to generator functor.
template<typename Gn, typename TypelistT, typename TypelistV>
void
apply_generator(Gn&, TypelistT, TypelistV);
template<typename Typelist0, typename Typelist1>
struct append;
template<typename Typelist_Typelist>
struct append_typelist;
template<typename Typelist, typename T>
struct contains;
template<typename Typelist, template<typename T> class Pred>
struct filter;
template<typename Typelist, int i>
struct at_index;
template<typename Typelist, template<typename T> class Transform>
struct transform;
template<typename Typelist_Typelist>
struct flatten;
template<typename Typelist>
struct from_first;
template<typename T1>
struct create1;
template<typename T1, typename T2>
struct create2;
template<typename T1, typename T2, typename T3>
struct create3;
template<typename T1, typename T2, typename T3, typename T4>
struct create4;
template<typename T1, typename T2, typename T3, typename T4, typename T5>
struct create5;
template<typename T1, typename T2, typename T3,
typename T4, typename T5, typename T6>
struct create6;
namespace detail
{
template<typename Fn, typename Typelist_Chain>
struct apply_;
template<typename Fn, typename Hd, typename Tl>
struct apply_<Fn, chain<Hd, Tl> >
{
void
operator()(Fn& f)
{
f.operator()(Hd());
apply_<Fn, Tl> next;
next(f);
}
};
template<typename Fn>
struct apply_<Fn, null_type>
{
void
operator()(Fn&) { }
};
template<typename Gn, typename Typelist_Chain>
struct apply_generator1_;
template<typename Gn, typename Hd, typename Tl>
struct apply_generator1_<Gn, chain<Hd, Tl> >
{
void
operator()(Gn& g)
{
g.template operator()<Hd>();
apply_generator1_<Gn, Tl> next;
next(g);
}
};
template<typename Gn>
struct apply_generator1_<Gn, null_type>
{
void
operator()(Gn&) { }
};
template<typename Gn, typename TypelistT_Chain, typename TypelistV_Chain>
struct apply_generator2_;
template<typename Gn, typename Hd1, typename TlT, typename Hd2, typename TlV>
struct apply_generator2_<Gn, chain<Hd1, TlT>, chain<Hd2, TlV> >
{
void
operator()(Gn& g)
{
g.template operator()<Hd1, Hd2>();
apply_generator2_<Gn, TlT, TlV> next;
next(g);
}
};
template<typename Gn>
struct apply_generator2_<Gn, null_type, null_type>
{
void
operator()(Gn&) { }
};
template<typename Typelist_Chain0, typename Typelist_Chain1>
struct append_;
template<typename Hd, typename Tl, typename Typelist_Chain>
struct append_<chain<Hd, Tl>, Typelist_Chain>
{
private:
typedef append_<Tl, Typelist_Chain> append_type;
public:
typedef chain<Hd, typename append_type::type> type;
};
template<typename Typelist_Chain>
struct append_<null_type, Typelist_Chain>
{
typedef Typelist_Chain type;
};
template<typename Typelist_Chain>
struct append_<Typelist_Chain, null_type>
{
typedef Typelist_Chain type;
};
template<>
struct append_<null_type, null_type>
{
typedef null_type type;
};
template<typename Typelist_Typelist_Chain>
struct append_typelist_;
template<typename Hd>
struct append_typelist_<chain<Hd, null_type> >
{
typedef chain<Hd, null_type> type;
};
template<typename Hd, typename Tl>
struct append_typelist_<chain< Hd, Tl> >
{
private:
typedef typename append_typelist_<Tl>::type rest_type;
public:
typedef typename append<Hd, node<rest_type> >::type::root type;
};
template<typename Typelist_Chain, typename T>
struct contains_;
template<typename T>
struct contains_<null_type, T>
{
enum
{
value = false
};
};
template<typename Hd, typename Tl, typename T>
struct contains_<chain<Hd, Tl>, T>
{
enum
{
value = contains_<Tl, T>::value
};
};
template<typename Tl, typename T>
struct contains_<chain<T, Tl>, T>
{
enum
{
value = true
};
};
template<typename Typelist_Chain, template<typename T> class Pred>
struct chain_filter_;
template<template<typename T> class Pred>
struct chain_filter_<null_type, Pred>
{
typedef null_type type;
};
template<typename Hd, typename Tl, template<typename T> class Pred>
struct chain_filter_<chain<Hd, Tl>, Pred>
{
private:
enum
{
include_hd = Pred<Hd>::value
};
typedef typename chain_filter_<Tl, Pred>::type rest_type;
typedef chain<Hd, rest_type> chain_type;
public:
typedef typename __conditional_type<include_hd, chain_type, rest_type>::__type type;
};
template<typename Typelist_Chain, int i>
struct chain_at_index_;
template<typename Hd, typename Tl>
struct chain_at_index_<chain<Hd, Tl>, 0>
{
typedef Hd type;
};
template<typename Hd, typename Tl, int i>
struct chain_at_index_<chain<Hd, Tl>, i>
{
typedef typename chain_at_index_<Tl, i - 1>::type type;
};
template<class Typelist_Chain, template<typename T> class Transform>
struct chain_transform_;
template<template<typename T> class Transform>
struct chain_transform_<null_type, Transform>
{
typedef null_type type;
};
template<class Hd, class Tl, template<typename T> class Transform>
struct chain_transform_<chain<Hd, Tl>, Transform>
{
private:
typedef typename chain_transform_<Tl, Transform>::type rest_type;
typedef typename Transform<Hd>::type transform_type;
public:
typedef chain<transform_type, rest_type> type;
};
template<typename Typelist_Typelist_Chain>
struct chain_flatten_;
template<typename Hd_Tl>
struct chain_flatten_<chain<Hd_Tl, null_type> >
{
typedef typename Hd_Tl::root type;
};
template<typename Hd_Typelist, class Tl_Typelist>
struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> >
{
private:
typedef typename chain_flatten_<Tl_Typelist>::type rest_type;
typedef append<Hd_Typelist, node<rest_type> > append_type;
public:
typedef typename append_type::type::root type;
};
} // namespace detail
#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type>
#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >
#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >
#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >
#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >
#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
#define _GLIBCXX_TYPELIST_CHAIN16(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN15(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15) >
#define _GLIBCXX_TYPELIST_CHAIN17(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN16(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16) >
#define _GLIBCXX_TYPELIST_CHAIN18(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN17(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17) >
#define _GLIBCXX_TYPELIST_CHAIN19(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN18(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18) >
#define _GLIBCXX_TYPELIST_CHAIN20(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN19(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19) >
template<typename Fn, typename Typelist>
void
apply(Fn& fn, Typelist)
{
detail::apply_<Fn, typename Typelist::root> a;
a(fn);
}
template<typename Fn, typename Typelist>
void
apply_generator(Fn& fn, Typelist)
{
detail::apply_generator1_<Fn, typename Typelist::root> a;
a(fn);
}
template<typename Fn, typename TypelistT, typename TypelistV>
void
apply_generator(Fn& fn, TypelistT, TypelistV)
{
typedef typename TypelistT::root rootT;
typedef typename TypelistV::root rootV;
detail::apply_generator2_<Fn, rootT, rootV> a;
a(fn);
}
template<typename Typelist0, typename Typelist1>
struct append
{
private:
typedef typename Typelist0::root root0_type;
typedef typename Typelist1::root root1_type;
typedef detail::append_<root0_type, root1_type> append_type;
public:
typedef node<typename append_type::type> type;
};
template<typename Typelist_Typelist>
struct append_typelist
{
private:
typedef typename Typelist_Typelist::root root_type;
typedef detail::append_typelist_<root_type> append_type;
public:
typedef node<typename append_type::type> type;
};
template<typename Typelist, typename T>
struct contains
{
private:
typedef typename Typelist::root root_type;
public:
enum
{
value = detail::contains_<root_type, T>::value
};
};
template<typename Typelist, template<typename T> class Pred>
struct filter
{
private:
typedef typename Typelist::root root_type;
typedef detail::chain_filter_<root_type, Pred> filter_type;
public:
typedef node<typename filter_type::type> type;
};
template<typename Typelist, int i>
struct at_index
{
private:
typedef typename Typelist::root root_type;
typedef detail::chain_at_index_<root_type, i> index_type;
public:
typedef typename index_type::type type;
};
template<typename Typelist, template<typename T> class Transform>
struct transform
{
private:
typedef typename Typelist::root root_type;
typedef detail::chain_transform_<root_type, Transform> transform_type;
public:
typedef node<typename transform_type::type> type;
};
template<typename Typelist_Typelist>
struct flatten
{
private:
typedef typename Typelist_Typelist::root root_type;
typedef typename detail::chain_flatten_<root_type>::type flatten_type;
public:
typedef node<flatten_type> type;
};
template<typename Typelist>
struct from_first
{
private:
typedef typename at_index<Typelist, 0>::type first_type;
public:
typedef node<chain<first_type, null_type> > type;
};
template<typename T1>
struct create1
{
typedef node<_GLIBCXX_TYPELIST_CHAIN1(T1)> type;
};
template<typename T1, typename T2>
struct create2
{
typedef node<_GLIBCXX_TYPELIST_CHAIN2(T1,T2)> type;
};
template<typename T1, typename T2, typename T3>
struct create3
{
typedef node<_GLIBCXX_TYPELIST_CHAIN3(T1,T2,T3)> type;
};
template<typename T1, typename T2, typename T3, typename T4>
struct create4
{
typedef node<_GLIBCXX_TYPELIST_CHAIN4(T1,T2,T3,T4)> type;
};
template<typename T1, typename T2, typename T3,
typename T4, typename T5>
struct create5
{
typedef node<_GLIBCXX_TYPELIST_CHAIN5(T1,T2,T3,T4,T5)> type;
};
template<typename T1, typename T2, typename T3,
typename T4, typename T5, typename T6>
struct create6
{
typedef node<_GLIBCXX_TYPELIST_CHAIN6(T1,T2,T3,T4,T5,T6)> type;
};
} // namespace typelist
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// String Conversions -*- C++ -*-
// Copyright (C) 2008-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/string_conversions.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _STRING_CONVERSIONS_H
#define _STRING_CONVERSIONS_H 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <bits/c++config.h>
#include <ext/numeric_traits.h>
#include <bits/functexcept.h>
#include <cstdlib>
#include <cwchar>
#include <cstdio>
#include <cerrno>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Helper for all the sto* functions.
template<typename _TRet, typename _Ret = _TRet, typename _CharT,
typename... _Base>
_Ret
__stoa(_TRet (*__convf) (const _CharT*, _CharT**, _Base...),
const char* __name, const _CharT* __str, std::size_t* __idx,
_Base... __base)
{
_Ret __ret;
_CharT* __endptr;
struct _Save_errno {
_Save_errno() : _M_errno(errno) { errno = 0; }
~_Save_errno() { if (errno == 0) errno = _M_errno; }
int _M_errno;
} const __save_errno;
struct _Range_chk {
static bool
_S_chk(_TRet, std::false_type) { return false; }
static bool
_S_chk(_TRet __val, std::true_type) // only called when _Ret is int
{
return __val < _TRet(__numeric_traits<int>::__min)
|| __val > _TRet(__numeric_traits<int>::__max);
}
};
const _TRet __tmp = __convf(__str, &__endptr, __base...);
if (__endptr == __str)
std::__throw_invalid_argument(__name);
else if (errno == ERANGE
|| _Range_chk::_S_chk(__tmp, std::is_same<_Ret, int>{}))
std::__throw_out_of_range(__name);
else
__ret = __tmp;
if (__idx)
*__idx = __endptr - __str;
return __ret;
}
// Helper for the to_string / to_wstring functions.
template<typename _String, typename _CharT = typename _String::value_type>
_String
__to_xstring(int (*__convf) (_CharT*, std::size_t, const _CharT*,
__builtin_va_list), std::size_t __n,
const _CharT* __fmt, ...)
{
// XXX Eventually the result should be constructed in-place in
// the __cxx11 string, likely with the help of internal hooks.
_CharT* __s = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
* __n));
__builtin_va_list __args;
__builtin_va_start(__args, __fmt);
const int __len = __convf(__s, __n, __fmt, __args);
__builtin_va_end(__args);
return _String(__s, __s + __len);
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // C++11
#endif // _STRING_CONVERSIONS_H
// POD character, std::char_traits specialization -*- C++ -*-
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/pod_char_traits.h
* This file is a GNU extension to the Standard C++ Library.
*/
// Gabriel Dos Reis <gdr@integrable-solutions.net>
// Benjamin Kosnik <bkoz@redhat.com>
#ifndef _POD_CHAR_TRAITS_H
#define _POD_CHAR_TRAITS_H 1
#pragma GCC system_header
#include <string>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// POD character abstraction.
// NB: The char_type parameter is a subset of int_type, as to allow
// int_type to properly hold the full range of char_type values as
// well as EOF.
/// @brief A POD class that serves as a character abstraction class.
template<typename _Value, typename _Int, typename _St = std::mbstate_t>
struct character
{
typedef _Value value_type;
typedef _Int int_type;
typedef _St state_type;
typedef character<_Value, _Int, _St> char_type;
value_type value;
template<typename V2>
static char_type
from(const V2& v)
{
char_type ret = { static_cast<value_type>(v) };
return ret;
}
template<typename V2>
static V2
to(const char_type& c)
{
V2 ret = { static_cast<V2>(c.value) };
return ret;
}
};
template<typename _Value, typename _Int, typename _St>
inline bool
operator==(const character<_Value, _Int, _St>& lhs,
const character<_Value, _Int, _St>& rhs)
{ return lhs.value == rhs.value; }
template<typename _Value, typename _Int, typename _St>
inline bool
operator<(const character<_Value, _Int, _St>& lhs,
const character<_Value, _Int, _St>& rhs)
{ return lhs.value < rhs.value; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// char_traits<__gnu_cxx::character> specialization.
template<typename _Value, typename _Int, typename _St>
struct char_traits<__gnu_cxx::character<_Value, _Int, _St> >
{
typedef __gnu_cxx::character<_Value, _Int, _St> char_type;
typedef typename char_type::int_type int_type;
typedef typename char_type::state_type state_type;
typedef fpos<state_type> pos_type;
typedef streamoff off_type;
static void
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
static int
compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
for (size_t __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i], __s2[__i]))
return lt(__s1[__i], __s2[__i]) ? -1 : 1;
return 0;
}
static size_t
length(const char_type* __s)
{
const char_type* __p = __s;
while (__p->value)
++__p;
return (__p - __s);
}
static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a)
{
for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
if (*__p == __a)
return __p;
return 0;
}
static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n)
{
if (__n == 0)
return __s1;
return static_cast<char_type*>
(__builtin_memmove(__s1, __s2, __n * sizeof(char_type)));
}
static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n)
{
if (__n == 0)
return __s1;
std::copy(__s2, __s2 + __n, __s1);
return __s1;
}
static char_type*
assign(char_type* __s, size_t __n, char_type __a)
{
std::fill_n(__s, __n, __a);
return __s;
}
static char_type
to_char_type(const int_type& __i)
{ return char_type::template from(__i); }
static int_type
to_int_type(const char_type& __c)
{ return char_type::template to<int_type>(__c); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static int_type
eof()
{
int_type __r = { static_cast<typename __gnu_cxx::__conditional_type
<std::__is_integer<int_type>::__value,
int_type, int>::__type>(-1) };
return __r;
}
static int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? int_type() : __c; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Random number extensions -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/random.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/random}
*/
#ifndef _EXT_RANDOM_TCC
#define _EXT_RANDOM_TCC 1
#pragma GCC system_header
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
void simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
seed(_UIntType __seed)
{
_M_state32[0] = static_cast<uint32_t>(__seed);
for (size_t __i = 1; __i < _M_nstate32; ++__i)
_M_state32[__i] = (1812433253UL
* (_M_state32[__i - 1] ^ (_M_state32[__i - 1] >> 30))
+ __i);
_M_pos = state_size;
_M_period_certification();
}
namespace {
inline uint32_t _Func1(uint32_t __x)
{
return (__x ^ (__x >> 27)) * UINT32_C(1664525);
}
inline uint32_t _Func2(uint32_t __x)
{
return (__x ^ (__x >> 27)) * UINT32_C(1566083941);
}
}
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
template<typename _Sseq>
typename std::enable_if<std::is_class<_Sseq>::value>::type
simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
seed(_Sseq& __q)
{
size_t __lag;
if (_M_nstate32 >= 623)
__lag = 11;
else if (_M_nstate32 >= 68)
__lag = 7;
else if (_M_nstate32 >= 39)
__lag = 5;
else
__lag = 3;
const size_t __mid = (_M_nstate32 - __lag) / 2;
std::fill(_M_state32, _M_state32 + _M_nstate32, UINT32_C(0x8b8b8b8b));
uint32_t __arr[_M_nstate32];
__q.generate(__arr + 0, __arr + _M_nstate32);
uint32_t __r = _Func1(_M_state32[0] ^ _M_state32[__mid]
^ _M_state32[_M_nstate32 - 1]);
_M_state32[__mid] += __r;
__r += _M_nstate32;
_M_state32[__mid + __lag] += __r;
_M_state32[0] = __r;
for (size_t __i = 1, __j = 0; __j < _M_nstate32; ++__j)
{
__r = _Func1(_M_state32[__i]
^ _M_state32[(__i + __mid) % _M_nstate32]
^ _M_state32[(__i + _M_nstate32 - 1) % _M_nstate32]);
_M_state32[(__i + __mid) % _M_nstate32] += __r;
__r += __arr[__j] + __i;
_M_state32[(__i + __mid + __lag) % _M_nstate32] += __r;
_M_state32[__i] = __r;
__i = (__i + 1) % _M_nstate32;
}
for (size_t __j = 0; __j < _M_nstate32; ++__j)
{
const size_t __i = (__j + 1) % _M_nstate32;
__r = _Func2(_M_state32[__i]
+ _M_state32[(__i + __mid) % _M_nstate32]
+ _M_state32[(__i + _M_nstate32 - 1) % _M_nstate32]);
_M_state32[(__i + __mid) % _M_nstate32] ^= __r;
__r -= __i;
_M_state32[(__i + __mid + __lag) % _M_nstate32] ^= __r;
_M_state32[__i] = __r;
}
_M_pos = state_size;
_M_period_certification();
}
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
void simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
_M_period_certification(void)
{
static const uint32_t __parity[4] = { __parity1, __parity2,
__parity3, __parity4 };
uint32_t __inner = 0;
for (size_t __i = 0; __i < 4; ++__i)
if (__parity[__i] != 0)
__inner ^= _M_state32[__i] & __parity[__i];
if (__builtin_parity(__inner) & 1)
return;
for (size_t __i = 0; __i < 4; ++__i)
if (__parity[__i] != 0)
{
_M_state32[__i] ^= 1 << (__builtin_ffs(__parity[__i]) - 1);
return;
}
__builtin_unreachable();
}
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
void simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
discard(unsigned long long __z)
{
while (__z > state_size - _M_pos)
{
__z -= state_size - _M_pos;
_M_gen_rand();
}
_M_pos += __z;
}
#ifndef _GLIBCXX_OPT_HAVE_RANDOM_SFMT_GEN_READ
namespace {
template<size_t __shift>
inline void __rshift(uint32_t *__out, const uint32_t *__in)
{
uint64_t __th = ((static_cast<uint64_t>(__in[3]) << 32)
| static_cast<uint64_t>(__in[2]));
uint64_t __tl = ((static_cast<uint64_t>(__in[1]) << 32)
| static_cast<uint64_t>(__in[0]));
uint64_t __oh = __th >> (__shift * 8);
uint64_t __ol = __tl >> (__shift * 8);
__ol |= __th << (64 - __shift * 8);
__out[1] = static_cast<uint32_t>(__ol >> 32);
__out[0] = static_cast<uint32_t>(__ol);
__out[3] = static_cast<uint32_t>(__oh >> 32);
__out[2] = static_cast<uint32_t>(__oh);
}
template<size_t __shift>
inline void __lshift(uint32_t *__out, const uint32_t *__in)
{
uint64_t __th = ((static_cast<uint64_t>(__in[3]) << 32)
| static_cast<uint64_t>(__in[2]));
uint64_t __tl = ((static_cast<uint64_t>(__in[1]) << 32)
| static_cast<uint64_t>(__in[0]));
uint64_t __oh = __th << (__shift * 8);
uint64_t __ol = __tl << (__shift * 8);
__oh |= __tl >> (64 - __shift * 8);
__out[1] = static_cast<uint32_t>(__ol >> 32);
__out[0] = static_cast<uint32_t>(__ol);
__out[3] = static_cast<uint32_t>(__oh >> 32);
__out[2] = static_cast<uint32_t>(__oh);
}
template<size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4>
inline void __recursion(uint32_t *__r,
const uint32_t *__a, const uint32_t *__b,
const uint32_t *__c, const uint32_t *__d)
{
uint32_t __x[4];
uint32_t __y[4];
__lshift<__sl2>(__x, __a);
__rshift<__sr2>(__y, __c);
__r[0] = (__a[0] ^ __x[0] ^ ((__b[0] >> __sr1) & __msk1)
^ __y[0] ^ (__d[0] << __sl1));
__r[1] = (__a[1] ^ __x[1] ^ ((__b[1] >> __sr1) & __msk2)
^ __y[1] ^ (__d[1] << __sl1));
__r[2] = (__a[2] ^ __x[2] ^ ((__b[2] >> __sr1) & __msk3)
^ __y[2] ^ (__d[2] << __sl1));
__r[3] = (__a[3] ^ __x[3] ^ ((__b[3] >> __sr1) & __msk4)
^ __y[3] ^ (__d[3] << __sl1));
}
}
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
void simd_fast_mersenne_twister_engine<_UIntType, __m,
__pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3,
__parity4>::
_M_gen_rand(void)
{
const uint32_t *__r1 = &_M_state32[_M_nstate32 - 8];
const uint32_t *__r2 = &_M_state32[_M_nstate32 - 4];
static constexpr size_t __pos1_32 = __pos1 * 4;
size_t __i;
for (__i = 0; __i < _M_nstate32 - __pos1_32; __i += 4)
{
__recursion<__sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4>
(&_M_state32[__i], &_M_state32[__i],
&_M_state32[__i + __pos1_32], __r1, __r2);
__r1 = __r2;
__r2 = &_M_state32[__i];
}
for (; __i < _M_nstate32; __i += 4)
{
__recursion<__sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4>
(&_M_state32[__i], &_M_state32[__i],
&_M_state32[__i + __pos1_32 - _M_nstate32], __r1, __r2);
__r1 = __r2;
__r2 = &_M_state32[__i];
}
_M_pos = 0;
}
#endif
#ifndef _GLIBCXX_OPT_HAVE_RANDOM_SFMT_OPERATOREQUAL
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
bool
operator==(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __lhs,
const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __rhs)
{
typedef __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4> __engine;
return (std::equal(__lhs._M_stateT,
__lhs._M_stateT + __engine::state_size,
__rhs._M_stateT)
&& __lhs._M_pos == __rhs._M_pos);
}
#endif
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4,
typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
for (size_t __i = 0; __i < __x._M_nstate32; ++__i)
__os << __x._M_state32[__i] << __space;
__os << __x._M_pos;
__os.flags(__flags);
__os.fill(__fill);
return __os;
}
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4,
typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2,
__msk1, __msk2, __msk3, __msk4,
__parity1, __parity2, __parity3, __parity4>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
for (size_t __i = 0; __i < __x._M_nstate32; ++__i)
__is >> __x._M_state32[__i];
__is >> __x._M_pos;
__is.flags(__flags);
return __is;
}
#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/**
* Iteration method due to M.D. J<o:>hnk.
*
* M.D. J<o:>hnk, Erzeugung von betaverteilten und gammaverteilten
* Zufallszahlen, Metrika, Volume 8, 1964
*/
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename beta_distribution<_RealType>::result_type
beta_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
result_type __x, __y;
do
{
__x = std::exp(std::log(__aurng()) / __param.alpha());
__y = std::exp(std::log(__aurng()) / __param.beta());
}
while (__x + __y > result_type(1));
return __x / (__x + __y);
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
beta_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
while (__f != __t)
{
result_type __x, __y;
do
{
__x = std::exp(std::log(__aurng()) / __param.alpha());
__y = std::exp(std::log(__aurng()) / __param.beta());
}
while (__x + __y > result_type(1));
*__f++ = __x / (__x + __y);
}
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::beta_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.alpha() << __space << __x.beta();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::beta_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __alpha_val, __beta_val;
__is >> __alpha_val >> __beta_val;
__x.param(typename __gnu_cxx::beta_distribution<_RealType>::
param_type(__alpha_val, __beta_val));
__is.flags(__flags);
return __is;
}
template<std::size_t _Dimen, typename _RealType>
template<typename _InputIterator1, typename _InputIterator2>
void
normal_mv_distribution<_Dimen, _RealType>::param_type::
_M_init_full(_InputIterator1 __meanbegin, _InputIterator1 __meanend,
_InputIterator2 __varcovbegin, _InputIterator2 __varcovend)
{
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
std::fill(std::copy(__meanbegin, __meanend, _M_mean.begin()),
_M_mean.end(), _RealType(0));
// Perform the Cholesky decomposition
auto __w = _M_t.begin();
for (size_t __j = 0; __j < _Dimen; ++__j)
{
_RealType __sum = _RealType(0);
auto __slitbegin = __w;
auto __cit = _M_t.begin();
for (size_t __i = 0; __i < __j; ++__i)
{
auto __slit = __slitbegin;
_RealType __s = *__varcovbegin++;
for (size_t __k = 0; __k < __i; ++__k)
__s -= *__slit++ * *__cit++;
*__w++ = __s /= *__cit++;
__sum += __s * __s;
}
__sum = *__varcovbegin - __sum;
if (__builtin_expect(__sum <= _RealType(0), 0))
std::__throw_runtime_error(__N("normal_mv_distribution::"
"param_type::_M_init_full"));
*__w++ = std::sqrt(__sum);
std::advance(__varcovbegin, _Dimen - __j);
}
}
template<std::size_t _Dimen, typename _RealType>
template<typename _InputIterator1, typename _InputIterator2>
void
normal_mv_distribution<_Dimen, _RealType>::param_type::
_M_init_lower(_InputIterator1 __meanbegin, _InputIterator1 __meanend,
_InputIterator2 __varcovbegin, _InputIterator2 __varcovend)
{
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
std::fill(std::copy(__meanbegin, __meanend, _M_mean.begin()),
_M_mean.end(), _RealType(0));
// Perform the Cholesky decomposition
auto __w = _M_t.begin();
for (size_t __j = 0; __j < _Dimen; ++__j)
{
_RealType __sum = _RealType(0);
auto __slitbegin = __w;
auto __cit = _M_t.begin();
for (size_t __i = 0; __i < __j; ++__i)
{
auto __slit = __slitbegin;
_RealType __s = *__varcovbegin++;
for (size_t __k = 0; __k < __i; ++__k)
__s -= *__slit++ * *__cit++;
*__w++ = __s /= *__cit++;
__sum += __s * __s;
}
__sum = *__varcovbegin++ - __sum;
if (__builtin_expect(__sum <= _RealType(0), 0))
std::__throw_runtime_error(__N("normal_mv_distribution::"
"param_type::_M_init_full"));
*__w++ = std::sqrt(__sum);
}
}
template<std::size_t _Dimen, typename _RealType>
template<typename _InputIterator1, typename _InputIterator2>
void
normal_mv_distribution<_Dimen, _RealType>::param_type::
_M_init_diagonal(_InputIterator1 __meanbegin, _InputIterator1 __meanend,
_InputIterator2 __varbegin, _InputIterator2 __varend)
{
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
std::fill(std::copy(__meanbegin, __meanend, _M_mean.begin()),
_M_mean.end(), _RealType(0));
auto __w = _M_t.begin();
size_t __step = 0;
while (__varbegin != __varend)
{
std::fill_n(__w, __step, _RealType(0));
__w += __step++;
if (__builtin_expect(*__varbegin < _RealType(0), 0))
std::__throw_runtime_error(__N("normal_mv_distribution::"
"param_type::_M_init_diagonal"));
*__w++ = std::sqrt(*__varbegin++);
}
}
template<std::size_t _Dimen, typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename normal_mv_distribution<_Dimen, _RealType>::result_type
normal_mv_distribution<_Dimen, _RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
result_type __ret;
_M_nd.__generate(__ret.begin(), __ret.end(), __urng);
auto __t_it = __param._M_t.crbegin();
for (size_t __i = _Dimen; __i > 0; --__i)
{
_RealType __sum = _RealType(0);
for (size_t __j = __i; __j > 0; --__j)
__sum += __ret[__j - 1] * *__t_it++;
__ret[__i - 1] = __sum;
}
return __ret;
}
template<std::size_t _Dimen, typename _RealType>
template<typename _ForwardIterator, typename _UniformRandomNumberGenerator>
void
normal_mv_distribution<_Dimen, _RealType>::
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator>)
while (__f != __t)
*__f++ = this->operator()(__urng, __param);
}
template<size_t _Dimen, typename _RealType>
bool
operator==(const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>&
__d1,
const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>&
__d2)
{
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd;
}
template<size_t _Dimen, typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
auto __mean = __x._M_param.mean();
for (auto __it : __mean)
__os << __it << __space;
auto __t = __x._M_param.varcov();
for (auto __it : __t)
__os << __it << __space;
__os << __x._M_nd;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<size_t _Dimen, typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
std::array<_RealType, _Dimen> __mean;
for (auto& __it : __mean)
__is >> __it;
std::array<_RealType, _Dimen * (_Dimen + 1) / 2> __varcov;
for (auto& __it : __varcov)
__is >> __it;
__is >> __x._M_nd;
__x.param(typename normal_mv_distribution<_Dimen, _RealType>::
param_type(__mean.begin(), __mean.end(),
__varcov.begin(), __varcov.end()));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
rice_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
while (__f != __t)
{
typename std::normal_distribution<result_type>::param_type
__px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma());
result_type __x = this->_M_ndx(__px, __urng);
result_type __y = this->_M_ndy(__py, __urng);
#if _GLIBCXX_USE_C99_MATH_TR1
*__f++ = std::hypot(__x, __y);
#else
*__f++ = std::sqrt(__x * __x + __y * __y);
#endif
}
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const rice_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.nu() << __space << __x.sigma();
__os << __space << __x._M_ndx;
__os << __space << __x._M_ndy;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
rice_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __nu_val, __sigma_val;
__is >> __nu_val >> __sigma_val;
__is >> __x._M_ndx;
__is >> __x._M_ndy;
__x.param(typename rice_distribution<_RealType>::
param_type(__nu_val, __sigma_val));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
nakagami_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
typename std::gamma_distribution<result_type>::param_type
__pg(__p.mu(), __p.omega() / __p.mu());
while (__f != __t)
*__f++ = std::sqrt(this->_M_gd(__pg, __urng));
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const nakagami_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.mu() << __space << __x.omega();
__os << __space << __x._M_gd;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
nakagami_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __mu_val, __omega_val;
__is >> __mu_val >> __omega_val;
__is >> __x._M_gd;
__x.param(typename nakagami_distribution<_RealType>::
param_type(__mu_val, __omega_val));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
pareto_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
result_type __mu_val = __p.mu();
result_type __malphinv = -result_type(1) / __p.alpha();
while (__f != __t)
*__f++ = __mu_val * std::pow(this->_M_ud(__urng), __malphinv);
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const pareto_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.alpha() << __space << __x.mu();
__os << __space << __x._M_ud;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
pareto_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __alpha_val, __mu_val;
__is >> __alpha_val >> __mu_val;
__is >> __x._M_ud;
__x.param(typename pareto_distribution<_RealType>::
param_type(__alpha_val, __mu_val));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename k_distribution<_RealType>::result_type
k_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __x = this->_M_gd1(__urng);
result_type __y = this->_M_gd2(__urng);
return std::sqrt(__x * __y);
}
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename k_distribution<_RealType>::result_type
k_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
typename std::gamma_distribution<result_type>::param_type
__p1(__p.lambda(), result_type(1) / __p.lambda()),
__p2(__p.nu(), __p.mu() / __p.nu());
result_type __x = this->_M_gd1(__p1, __urng);
result_type __y = this->_M_gd2(__p2, __urng);
return std::sqrt(__x * __y);
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
k_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
typename std::gamma_distribution<result_type>::param_type
__p1(__p.lambda(), result_type(1) / __p.lambda()),
__p2(__p.nu(), __p.mu() / __p.nu());
while (__f != __t)
{
result_type __x = this->_M_gd1(__p1, __urng);
result_type __y = this->_M_gd2(__p2, __urng);
*__f++ = std::sqrt(__x * __y);
}
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const k_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.lambda() << __space << __x.mu() << __space << __x.nu();
__os << __space << __x._M_gd1;
__os << __space << __x._M_gd2;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
k_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __lambda_val, __mu_val, __nu_val;
__is >> __lambda_val >> __mu_val >> __nu_val;
__is >> __x._M_gd1;
__is >> __x._M_gd2;
__x.param(typename k_distribution<_RealType>::
param_type(__lambda_val, __mu_val, __nu_val));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
arcsine_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
result_type __dif = __p.b() - __p.a();
result_type __sum = __p.a() + __p.b();
while (__f != __t)
{
result_type __x = std::sin(this->_M_ud(__urng));
*__f++ = (__x * __dif + __sum) / result_type(2);
}
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const arcsine_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.a() << __space << __x.b();
__os << __space << __x._M_ud;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
arcsine_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __a, __b;
__is >> __a >> __b;
__is >> __x._M_ud;
__x.param(typename arcsine_distribution<_RealType>::
param_type(__a, __b));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename hoyt_distribution<_RealType>::result_type
hoyt_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __x = this->_M_ad(__urng);
result_type __y = this->_M_ed(__urng);
return (result_type(2) * this->q()
/ (result_type(1) + this->q() * this->q()))
* std::sqrt(this->omega() * __x * __y);
}
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename hoyt_distribution<_RealType>::result_type
hoyt_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
result_type __q2 = __p.q() * __p.q();
result_type __num = result_type(0.5L) * (result_type(1) + __q2);
typename __gnu_cxx::arcsine_distribution<result_type>::param_type
__pa(__num, __num / __q2);
result_type __x = this->_M_ad(__pa, __urng);
result_type __y = this->_M_ed(__urng);
return (result_type(2) * __p.q() / (result_type(1) + __q2))
* std::sqrt(__p.omega() * __x * __y);
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
hoyt_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
result_type __2q = result_type(2) * __p.q();
result_type __q2 = __p.q() * __p.q();
result_type __q2p1 = result_type(1) + __q2;
result_type __num = result_type(0.5L) * __q2p1;
result_type __omega = __p.omega();
typename __gnu_cxx::arcsine_distribution<result_type>::param_type
__pa(__num, __num / __q2);
while (__f != __t)
{
result_type __x = this->_M_ad(__pa, __urng);
result_type __y = this->_M_ed(__urng);
*__f++ = (__2q / __q2p1) * std::sqrt(__omega * __x * __y);
}
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const hoyt_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.q() << __space << __x.omega();
__os << __space << __x._M_ad;
__os << __space << __x._M_ed;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
hoyt_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __q, __omega;
__is >> __q >> __omega;
__is >> __x._M_ad;
__is >> __x._M_ed;
__x.param(typename hoyt_distribution<_RealType>::
param_type(__q, __omega));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
triangular_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
while (__f != __t)
*__f++ = this->operator()(__urng, __param);
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::triangular_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.a() << __space << __x.b() << __space << __x.c();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::triangular_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __a, __b, __c;
__is >> __a >> __b >> __c;
__x.param(typename __gnu_cxx::triangular_distribution<_RealType>::
param_type(__a, __b, __c));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename von_mises_distribution<_RealType>::result_type
von_mises_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
const result_type __pi
= __gnu_cxx::__math_constants<result_type>::__pi;
std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
result_type __f;
while (1)
{
result_type __rnd = std::cos(__pi * __aurng());
__f = (result_type(1) + __p._M_r * __rnd) / (__p._M_r + __rnd);
result_type __c = __p._M_kappa * (__p._M_r - __f);
result_type __rnd2 = __aurng();
if (__c * (result_type(2) - __c) > __rnd2)
break;
if (std::log(__c / __rnd2) >= __c - result_type(1))
break;
}
result_type __res = std::acos(__f);
#if _GLIBCXX_USE_C99_MATH_TR1
__res = std::copysign(__res, __aurng() - result_type(0.5));
#else
if (__aurng() < result_type(0.5))
__res = -__res;
#endif
__res += __p._M_mu;
if (__res > __pi)
__res -= result_type(2) * __pi;
else if (__res < -__pi)
__res += result_type(2) * __pi;
return __res;
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
von_mises_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
while (__f != __t)
*__f++ = this->operator()(__urng, __param);
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::von_mises_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.mu() << __space << __x.kappa();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::von_mises_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __mu, __kappa;
__is >> __mu >> __kappa;
__x.param(typename __gnu_cxx::von_mises_distribution<_RealType>::
param_type(__mu, __kappa));
__is.flags(__flags);
return __is;
}
template<typename _UIntType>
template<typename _UniformRandomNumberGenerator>
typename hypergeometric_distribution<_UIntType>::result_type
hypergeometric_distribution<_UIntType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
std::__detail::_Adaptor<_UniformRandomNumberGenerator, double>
__aurng(__urng);
result_type __a = __param.successful_size();
result_type __b = __param.total_size();
result_type __k = 0;
if (__param.total_draws() < __param.total_size() / 2)
{
for (result_type __i = 0; __i < __param.total_draws(); ++__i)
{
if (__b * __aurng() < __a)
{
++__k;
if (__k == __param.successful_size())
return __k;
--__a;
}
--__b;
}
return __k;
}
else
{
for (result_type __i = 0; __i < __param.unsuccessful_size(); ++__i)
{
if (__b * __aurng() < __a)
{
++__k;
if (__k == __param.successful_size())
return __param.successful_size() - __k;
--__a;
}
--__b;
}
return __param.successful_size() - __k;
}
}
template<typename _UIntType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
hypergeometric_distribution<_UIntType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
while (__f != __t)
*__f++ = this->operator()(__urng);
}
template<typename _UIntType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::hypergeometric_distribution<_UIntType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_UIntType>::max_digits10);
__os << __x.total_size() << __space << __x.successful_size() << __space
<< __x.total_draws();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _UIntType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::hypergeometric_distribution<_UIntType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_UIntType __total_size, __successful_size, __total_draws;
__is >> __total_size >> __successful_size >> __total_draws;
__x.param(typename __gnu_cxx::hypergeometric_distribution<_UIntType>::
param_type(__total_size, __successful_size, __total_draws));
__is.flags(__flags);
return __is;
}
template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename logistic_distribution<_RealType>::result_type
logistic_distribution<_RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
result_type __arg = result_type(1);
while (__arg == result_type(1) || __arg == result_type(0))
__arg = __aurng();
return __p.a()
+ __p.b() * std::log(__arg / (result_type(1) - __arg));
}
template<typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
logistic_distribution<_RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
while (__f != __t)
{
result_type __arg = result_type(1);
while (__arg == result_type(1) || __arg == result_type(0))
__arg = __aurng();
*__f++ = __p.a()
+ __p.b() * std::log(__arg / (result_type(1) - __arg));
}
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const logistic_distribution<_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.a() << __space << __x.b();
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<typename _RealType, typename _CharT, typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
logistic_distribution<_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __a, __b;
__is >> __a >> __b;
__x.param(typename logistic_distribution<_RealType>::
param_type(__a, __b));
__is.flags(__flags);
return __is;
}
namespace {
// Helper class for the uniform_on_sphere_distribution generation
// function.
template<std::size_t _Dimen, typename _RealType>
class uniform_on_sphere_helper
{
typedef typename uniform_on_sphere_distribution<_Dimen, _RealType>::
result_type result_type;
public:
template<typename _NormalDistribution,
typename _UniformRandomNumberGenerator>
result_type operator()(_NormalDistribution& __nd,
_UniformRandomNumberGenerator& __urng)
{
result_type __ret;
typename result_type::value_type __norm;
do
{
auto __sum = _RealType(0);
std::generate(__ret.begin(), __ret.end(),
[&__nd, &__urng, &__sum](){
_RealType __t = __nd(__urng);
__sum += __t * __t;
return __t; });
__norm = std::sqrt(__sum);
}
while (__norm == _RealType(0) || ! __builtin_isfinite(__norm));
std::transform(__ret.begin(), __ret.end(), __ret.begin(),
[__norm](_RealType __val){ return __val / __norm; });
return __ret;
}
};
template<typename _RealType>
class uniform_on_sphere_helper<2, _RealType>
{
typedef typename uniform_on_sphere_distribution<2, _RealType>::
result_type result_type;
public:
template<typename _NormalDistribution,
typename _UniformRandomNumberGenerator>
result_type operator()(_NormalDistribution&,
_UniformRandomNumberGenerator& __urng)
{
result_type __ret;
_RealType __sq;
std::__detail::_Adaptor<_UniformRandomNumberGenerator,
_RealType> __aurng(__urng);
do
{
__ret[0] = _RealType(2) * __aurng() - _RealType(1);
__ret[1] = _RealType(2) * __aurng() - _RealType(1);
__sq = __ret[0] * __ret[0] + __ret[1] * __ret[1];
}
while (__sq == _RealType(0) || __sq > _RealType(1));
#if _GLIBCXX_USE_C99_MATH_TR1
// Yes, we do not just use sqrt(__sq) because hypot() is more
// accurate.
auto __norm = std::hypot(__ret[0], __ret[1]);
#else
auto __norm = std::sqrt(__sq);
#endif
__ret[0] /= __norm;
__ret[1] /= __norm;
return __ret;
}
};
}
template<std::size_t _Dimen, typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename uniform_on_sphere_distribution<_Dimen, _RealType>::result_type
uniform_on_sphere_distribution<_Dimen, _RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
uniform_on_sphere_helper<_Dimen, _RealType> __helper;
return __helper(_M_nd, __urng);
}
template<std::size_t _Dimen, typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
uniform_on_sphere_distribution<_Dimen, _RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
while (__f != __t)
*__f++ = this->operator()(__urng, __param);
}
template<std::size_t _Dimen, typename _RealType, typename _CharT,
typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __x)
{
return __os << __x._M_nd;
}
template<std::size_t _Dimen, typename _RealType, typename _CharT,
typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __x)
{
return __is >> __x._M_nd;
}
namespace {
// Helper class for the uniform_inside_sphere_distribution generation
// function.
template<std::size_t _Dimen, bool _SmallDimen, typename _RealType>
class uniform_inside_sphere_helper;
template<std::size_t _Dimen, typename _RealType>
class uniform_inside_sphere_helper<_Dimen, false, _RealType>
{
using result_type
= typename uniform_inside_sphere_distribution<_Dimen, _RealType>::
result_type;
public:
template<typename _UniformOnSphereDistribution,
typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformOnSphereDistribution& __uosd,
_UniformRandomNumberGenerator& __urng,
_RealType __radius)
{
std::__detail::_Adaptor<_UniformRandomNumberGenerator,
_RealType> __aurng(__urng);
_RealType __pow = 1 / _RealType(_Dimen);
_RealType __urt = __radius * std::pow(__aurng(), __pow);
result_type __ret = __uosd(__aurng);
std::transform(__ret.begin(), __ret.end(), __ret.begin(),
[__urt](_RealType __val)
{ return __val * __urt; });
return __ret;
}
};
// Helper class for the uniform_inside_sphere_distribution generation
// function specialized for small dimensions.
template<std::size_t _Dimen, typename _RealType>
class uniform_inside_sphere_helper<_Dimen, true, _RealType>
{
using result_type
= typename uniform_inside_sphere_distribution<_Dimen, _RealType>::
result_type;
public:
template<typename _UniformOnSphereDistribution,
typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformOnSphereDistribution&,
_UniformRandomNumberGenerator& __urng,
_RealType __radius)
{
result_type __ret;
_RealType __sq;
_RealType __radsq = __radius * __radius;
std::__detail::_Adaptor<_UniformRandomNumberGenerator,
_RealType> __aurng(__urng);
do
{
__sq = _RealType(0);
for (int i = 0; i < _Dimen; ++i)
{
__ret[i] = _RealType(2) * __aurng() - _RealType(1);
__sq += __ret[i] * __ret[i];
}
}
while (__sq > _RealType(1));
for (int i = 0; i < _Dimen; ++i)
__ret[i] *= __radius;
return __ret;
}
};
} // namespace
//
// Experiments have shown that rejection is more efficient than transform
// for dimensions less than 8.
//
template<std::size_t _Dimen, typename _RealType>
template<typename _UniformRandomNumberGenerator>
typename uniform_inside_sphere_distribution<_Dimen, _RealType>::result_type
uniform_inside_sphere_distribution<_Dimen, _RealType>::
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
uniform_inside_sphere_helper<_Dimen, _Dimen < 8, _RealType> __helper;
return __helper(_M_uosd, __urng, __p.radius());
}
template<std::size_t _Dimen, typename _RealType>
template<typename _OutputIterator,
typename _UniformRandomNumberGenerator>
void
uniform_inside_sphere_distribution<_Dimen, _RealType>::
__generate_impl(_OutputIterator __f, _OutputIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __param)
{
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
result_type>)
while (__f != __t)
*__f++ = this->operator()(__urng, __param);
}
template<std::size_t _Dimen, typename _RealType, typename _CharT,
typename _Traits>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::uniform_inside_sphere_distribution<_Dimen,
_RealType>& __x)
{
typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename __ostream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const std::streamsize __precision = __os.precision();
const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::scientific | __ios_base::left);
__os.fill(__space);
__os.precision(std::numeric_limits<_RealType>::max_digits10);
__os << __x.radius() << __space << __x._M_uosd;
__os.flags(__flags);
__os.fill(__fill);
__os.precision(__precision);
return __os;
}
template<std::size_t _Dimen, typename _RealType, typename _CharT,
typename _Traits>
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::uniform_inside_sphere_distribution<_Dimen,
_RealType>& __x)
{
typedef std::basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
const typename __ios_base::fmtflags __flags = __is.flags();
__is.flags(__ios_base::dec | __ios_base::skipws);
_RealType __radius_val;
__is >> __radius_val >> __x._M_uosd;
__x.param(typename uniform_inside_sphere_distribution<_Dimen, _RealType>::
param_type(__radius_val));
__is.flags(__flags);
return __is;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
#endif // _EXT_RANDOM_TCC
// Algorithm extensions -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ext/algorithm
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _EXT_ALGORITHM
#define _EXT_ALGORITHM 1
#pragma GCC system_header
#include <algorithm>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::ptrdiff_t;
using std::min;
using std::pair;
using std::input_iterator_tag;
using std::random_access_iterator_tag;
using std::iterator_traits;
//--------------------------------------------------
// copy_n (not part of the C++ standard)
template<typename _InputIterator, typename _Size, typename _OutputIterator>
pair<_InputIterator, _OutputIterator>
__copy_n(_InputIterator __first, _Size __count,
_OutputIterator __result,
input_iterator_tag)
{
for ( ; __count > 0; --__count)
{
*__result = *__first;
++__first;
++__result;
}
return pair<_InputIterator, _OutputIterator>(__first, __result);
}
template<typename _RAIterator, typename _Size, typename _OutputIterator>
inline pair<_RAIterator, _OutputIterator>
__copy_n(_RAIterator __first, _Size __count,
_OutputIterator __result,
random_access_iterator_tag)
{
_RAIterator __last = __first + __count;
return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first,
__last,
__result));
}
/**
* @brief Copies the range [first,first+count) into [result,result+count).
* @param __first An input iterator.
* @param __count The number of elements to copy.
* @param __result An output iterator.
* @return A std::pair composed of first+count and result+count.
*
* This is an SGI extension.
* This inline function will boil down to a call to @c memmove whenever
* possible. Failing that, if random access iterators are passed, then the
* loop count will be known (and therefore a candidate for compiler
* optimizations such as unrolling).
* @ingroup SGIextensions
*/
template<typename _InputIterator, typename _Size, typename _OutputIterator>
inline pair<_InputIterator, _OutputIterator>
copy_n(_InputIterator __first, _Size __count, _OutputIterator __result)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_InputIterator>::value_type>)
return __gnu_cxx::__copy_n(__first, __count, __result,
std::__iterator_category(__first));
}
template<typename _InputIterator1, typename _InputIterator2>
int
__lexicographical_compare_3way(_InputIterator1 __first1,
_InputIterator1 __last1,
_InputIterator2 __first2,
_InputIterator2 __last2)
{
while (__first1 != __last1 && __first2 != __last2)
{
if (*__first1 < *__first2)
return -1;
if (*__first2 < *__first1)
return 1;
++__first1;
++__first2;
}
if (__first2 == __last2)
return !(__first1 == __last1);
else
return -1;
}
inline int
__lexicographical_compare_3way(const unsigned char* __first1,
const unsigned char* __last1,
const unsigned char* __first2,
const unsigned char* __last2)
{
const ptrdiff_t __len1 = __last1 - __first1;
const ptrdiff_t __len2 = __last2 - __first2;
const int __result = __builtin_memcmp(__first1, __first2,
min(__len1, __len2));
return __result != 0 ? __result
: (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
}
inline int
__lexicographical_compare_3way(const char* __first1, const char* __last1,
const char* __first2, const char* __last2)
{
#if CHAR_MAX == SCHAR_MAX
return __lexicographical_compare_3way((const signed char*) __first1,
(const signed char*) __last1,
(const signed char*) __first2,
(const signed char*) __last2);
#else
return __lexicographical_compare_3way((const unsigned char*) __first1,
(const unsigned char*) __last1,
(const unsigned char*) __first2,
(const unsigned char*) __last2);
#endif
}
/**
* @brief @c memcmp on steroids.
* @param __first1 An input iterator.
* @param __last1 An input iterator.
* @param __first2 An input iterator.
* @param __last2 An input iterator.
* @return An int, as with @c memcmp.
*
* The return value will be less than zero if the first range is
* <em>lexigraphically less than</em> the second, greater than zero
* if the second range is <em>lexigraphically less than</em> the
* first, and zero otherwise.
* This is an SGI extension.
* @ingroup SGIextensions
*/
template<typename _InputIterator1, typename _InputIterator2>
int
lexicographical_compare_3way(_InputIterator1 __first1,
_InputIterator1 __last1,
_InputIterator2 __first2,
_InputIterator2 __last2)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
return __lexicographical_compare_3way(__first1, __last1, __first2,
__last2);
}
// count and count_if: this version, whose return type is void, was present
// in the HP STL, and is retained as an extension for backward compatibility.
template<typename _InputIterator, typename _Tp, typename _Size>
void
count(_InputIterator __first, _InputIterator __last,
const _Tp& __value,
_Size& __n)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_EqualityComparableConcept<
typename iterator_traits<_InputIterator>::value_type >)
__glibcxx_function_requires(_EqualityComparableConcept<_Tp>)
__glibcxx_requires_valid_range(__first, __last);
for ( ; __first != __last; ++__first)
if (*__first == __value)
++__n;
}
template<typename _InputIterator, typename _Predicate, typename _Size>
void
count_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred,
_Size& __n)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
for ( ; __first != __last; ++__first)
if (__pred(*__first))
++__n;
}
// random_sample and random_sample_n (extensions, not part of the standard).
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _ForwardIterator, typename _OutputIterator,
typename _Distance>
_OutputIterator
random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __out, const _Distance __n)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
_Distance __remaining = std::distance(__first, __last);
_Distance __m = min(__n, __remaining);
while (__m > 0)
{
if ((std::rand() % __remaining) < __m)
{
*__out = *__first;
++__out;
--__m;
}
--__remaining;
++__first;
}
return __out;
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _ForwardIterator, typename _OutputIterator,
typename _Distance, typename _RandomNumberGenerator>
_OutputIterator
random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __out, const _Distance __n,
_RandomNumberGenerator& __rand)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_function_requires(_UnaryFunctionConcept<
_RandomNumberGenerator, _Distance, _Distance>)
__glibcxx_requires_valid_range(__first, __last);
_Distance __remaining = std::distance(__first, __last);
_Distance __m = min(__n, __remaining);
while (__m > 0)
{
if (__rand(__remaining) < __m)
{
*__out = *__first;
++__out;
--__m;
}
--__remaining;
++__first;
}
return __out;
}
template<typename _InputIterator, typename _RandomAccessIterator,
typename _Distance>
_RandomAccessIterator
__random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out,
const _Distance __n)
{
_Distance __m = 0;
_Distance __t = __n;
for ( ; __first != __last && __m < __n; ++__m, ++__first)
__out[__m] = *__first;
while (__first != __last)
{
++__t;
_Distance __M = std::rand() % (__t);
if (__M < __n)
__out[__M] = *__first;
++__first;
}
return __out + __m;
}
template<typename _InputIterator, typename _RandomAccessIterator,
typename _RandomNumberGenerator, typename _Distance>
_RandomAccessIterator
__random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out,
_RandomNumberGenerator& __rand,
const _Distance __n)
{
// concept requirements
__glibcxx_function_requires(_UnaryFunctionConcept<
_RandomNumberGenerator, _Distance, _Distance>)
_Distance __m = 0;
_Distance __t = __n;
for ( ; __first != __last && __m < __n; ++__m, ++__first)
__out[__m] = *__first;
while (__first != __last)
{
++__t;
_Distance __M = __rand(__t);
if (__M < __n)
__out[__M] = *__first;
++__first;
}
return __out + __m;
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _InputIterator, typename _RandomAccessIterator>
inline _RandomAccessIterator
random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out_first,
_RandomAccessIterator __out_last)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_valid_range(__out_first, __out_last);
return __random_sample(__first, __last,
__out_first, __out_last - __out_first);
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _InputIterator, typename _RandomAccessIterator,
typename _RandomNumberGenerator>
inline _RandomAccessIterator
random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out_first,
_RandomAccessIterator __out_last,
_RandomNumberGenerator& __rand)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_valid_range(__out_first, __out_last);
return __random_sample(__first, __last,
__out_first, __rand,
__out_last - __out_first);
}
#if __cplusplus >= 201103L
using std::is_heap;
#else
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _RandomAccessIterator>
inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
// concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
return std::__is_heap(__first, __last - __first);
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _RandomAccessIterator, typename _StrictWeakOrdering>
inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_StrictWeakOrdering __comp)
{
// concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
typename iterator_traits<_RandomAccessIterator>::value_type,
typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
return std::__is_heap(__first, __comp, __last - __first);
}
#endif
#if __cplusplus >= 201103L
using std::is_sorted;
#else
// is_sorted, a predicated testing whether a range is sorted in
// nondescending order. This is an extension, not part of the C++
// standard.
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _ForwardIterator>
bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
if (__first == __last)
return true;
_ForwardIterator __next = __first;
for (++__next; __next != __last; __first = __next, ++__next)
if (*__next < *__first)
return false;
return true;
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _ForwardIterator, typename _StrictWeakOrdering>
bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last,
_StrictWeakOrdering __comp)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
typename iterator_traits<_ForwardIterator>::value_type,
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
if (__first == __last)
return true;
_ForwardIterator __next = __first;
for (++__next; __next != __last; __first = __next, ++__next)
if (__comp(*__next, *__first))
return false;
return true;
}
#endif // C++11
/**
* @brief Find the median of three values.
* @param __a A value.
* @param __b A value.
* @param __c A value.
* @return One of @p a, @p b or @p c.
*
* If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n
* then the value returned will be @c m.
* This is an SGI extension.
* @ingroup SGIextensions
*/
template<typename _Tp>
const _Tp&
__median(const _Tp& __a, const _Tp& __b, const _Tp& __c)
{
// concept requirements
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
if (__a < __b)
if (__b < __c)
return __b;
else if (__a < __c)
return __c;
else
return __a;
else if (__a < __c)
return __a;
else if (__b < __c)
return __c;
else
return __b;
}
/**
* @brief Find the median of three values using a predicate for comparison.
* @param __a A value.
* @param __b A value.
* @param __c A value.
* @param __comp A binary predicate.
* @return One of @p a, @p b or @p c.
*
* If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)
* and @p comp(m,n) are both true then the value returned will be @c m.
* This is an SGI extension.
* @ingroup SGIextensions
*/
template<typename _Tp, typename _Compare>
const _Tp&
__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)
{
// concept requirements
__glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
_Tp, _Tp>)
if (__comp(__a, __b))
if (__comp(__b, __c))
return __b;
else if (__comp(__a, __c))
return __c;
else
return __a;
else if (__comp(__a, __c))
return __a;
else if (__comp(__b, __c))
return __c;
else
return __b;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _EXT_ALGORITHM */
// Iostreams wrapper for stdio FILE* -*- C++ -*-
// Copyright (C) 2003-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/stdio_sync_filebuf.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _STDIO_SYNC_FILEBUF_H
#define _STDIO_SYNC_FILEBUF_H 1
#pragma GCC system_header
#include <streambuf>
#include <unistd.h>
#include <cstdio>
#include <bits/c++io.h> // For __c_file
#include <bits/move.h> // For __exchange
#ifdef _GLIBCXX_USE_WCHAR_T
#include <cwchar>
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Provides a layer of compatibility for C.
* @ingroup io
*
* This GNU extension provides extensions for working with standard
* C FILE*'s. It must be instantiated by the user with the type of
* character used in the file stream, e.g., stdio_filebuf<char>.
*/
template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
class stdio_sync_filebuf : public std::basic_streambuf<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
private:
typedef std::basic_streambuf<_CharT, _Traits> __streambuf_type;
// Underlying stdio FILE
std::__c_file* _M_file;
// Last character gotten. This is used when pbackfail is
// called from basic_streambuf::sungetc()
int_type _M_unget_buf;
public:
explicit
stdio_sync_filebuf(std::__c_file* __f)
: _M_file(__f), _M_unget_buf(traits_type::eof())
{ }
#if __cplusplus >= 201103L
stdio_sync_filebuf(stdio_sync_filebuf&& __fb) noexcept
: __streambuf_type(std::move(__fb)),
_M_file(__fb._M_file), _M_unget_buf(__fb._M_unget_buf)
{
__fb._M_file = nullptr;
__fb._M_unget_buf = traits_type::eof();
}
stdio_sync_filebuf&
operator=(stdio_sync_filebuf&& __fb) noexcept
{
__streambuf_type::operator=(__fb);
_M_file = std::__exchange(__fb._M_file, nullptr);
_M_unget_buf = std::__exchange(__fb._M_unget_buf, traits_type::eof());
return *this;
}
void
swap(stdio_sync_filebuf& __fb)
{
__streambuf_type::swap(__fb);
std::swap(_M_file, __fb._M_file);
std::swap(_M_unget_buf, __fb._M_unget_buf);
}
#endif
/**
* @return The underlying FILE*.
*
* This function can be used to access the underlying C file pointer.
* Note that there is no way for the library to track what you do
* with the file, so be careful.
*/
std::__c_file*
file() { return this->_M_file; }
protected:
int_type
syncgetc();
int_type
syncungetc(int_type __c);
int_type
syncputc(int_type __c);
virtual int_type
underflow()
{
int_type __c = this->syncgetc();
return this->syncungetc(__c);
}
virtual int_type
uflow()
{
// Store the gotten character in case we need to unget it.
_M_unget_buf = this->syncgetc();
return _M_unget_buf;
}
virtual int_type
pbackfail(int_type __c = traits_type::eof())
{
int_type __ret;
const int_type __eof = traits_type::eof();
// Check if the unget or putback was requested
if (traits_type::eq_int_type(__c, __eof)) // unget
{
if (!traits_type::eq_int_type(_M_unget_buf, __eof))
__ret = this->syncungetc(_M_unget_buf);
else // buffer invalid, fail.
__ret = __eof;
}
else // putback
__ret = this->syncungetc(__c);
// The buffered character is no longer valid, discard it.
_M_unget_buf = __eof;
return __ret;
}
virtual std::streamsize
xsgetn(char_type* __s, std::streamsize __n);
virtual int_type
overflow(int_type __c = traits_type::eof())
{
int_type __ret;
if (traits_type::eq_int_type(__c, traits_type::eof()))
{
if (std::fflush(_M_file))
__ret = traits_type::eof();
else
__ret = traits_type::not_eof(__c);
}
else
__ret = this->syncputc(__c);
return __ret;
}
virtual std::streamsize
xsputn(const char_type* __s, std::streamsize __n);
virtual int
sync()
{ return std::fflush(_M_file); }
virtual std::streampos
seekoff(std::streamoff __off, std::ios_base::seekdir __dir,
std::ios_base::openmode = std::ios_base::in | std::ios_base::out)
{
std::streampos __ret(std::streamoff(-1));
int __whence;
if (__dir == std::ios_base::beg)
__whence = SEEK_SET;
else if (__dir == std::ios_base::cur)
__whence = SEEK_CUR;
else
__whence = SEEK_END;
#ifdef _GLIBCXX_USE_LFS
if (!fseeko64(_M_file, __off, __whence))
__ret = std::streampos(ftello64(_M_file));
#else
if (!fseek(_M_file, __off, __whence))
__ret = std::streampos(std::ftell(_M_file));
#endif
return __ret;
}
virtual std::streampos
seekpos(std::streampos __pos,
std::ios_base::openmode __mode =
std::ios_base::in | std::ios_base::out)
{ return seekoff(std::streamoff(__pos), std::ios_base::beg, __mode); }
};
template<>
inline stdio_sync_filebuf<char>::int_type
stdio_sync_filebuf<char>::syncgetc()
{ return std::getc(_M_file); }
template<>
inline stdio_sync_filebuf<char>::int_type
stdio_sync_filebuf<char>::syncungetc(int_type __c)
{ return std::ungetc(__c, _M_file); }
template<>
inline stdio_sync_filebuf<char>::int_type
stdio_sync_filebuf<char>::syncputc(int_type __c)
{ return std::putc(__c, _M_file); }
template<>
inline std::streamsize
stdio_sync_filebuf<char>::xsgetn(char* __s, std::streamsize __n)
{
std::streamsize __ret = std::fread(__s, 1, __n, _M_file);
if (__ret > 0)
_M_unget_buf = traits_type::to_int_type(__s[__ret - 1]);
else
_M_unget_buf = traits_type::eof();
return __ret;
}
template<>
inline std::streamsize
stdio_sync_filebuf<char>::xsputn(const char* __s, std::streamsize __n)
{ return std::fwrite(__s, 1, __n, _M_file); }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
inline stdio_sync_filebuf<wchar_t>::int_type
stdio_sync_filebuf<wchar_t>::syncgetc()
{ return std::getwc(_M_file); }
template<>
inline stdio_sync_filebuf<wchar_t>::int_type
stdio_sync_filebuf<wchar_t>::syncungetc(int_type __c)
{ return std::ungetwc(__c, _M_file); }
template<>
inline stdio_sync_filebuf<wchar_t>::int_type
stdio_sync_filebuf<wchar_t>::syncputc(int_type __c)
{ return std::putwc(__c, _M_file); }
template<>
inline std::streamsize
stdio_sync_filebuf<wchar_t>::xsgetn(wchar_t* __s, std::streamsize __n)
{
std::streamsize __ret = 0;
const int_type __eof = traits_type::eof();
while (__n--)
{
int_type __c = this->syncgetc();
if (traits_type::eq_int_type(__c, __eof))
break;
__s[__ret] = traits_type::to_char_type(__c);
++__ret;
}
if (__ret > 0)
_M_unget_buf = traits_type::to_int_type(__s[__ret - 1]);
else
_M_unget_buf = traits_type::eof();
return __ret;
}
template<>
inline std::streamsize
stdio_sync_filebuf<wchar_t>::xsputn(const wchar_t* __s,
std::streamsize __n)
{
std::streamsize __ret = 0;
const int_type __eof = traits_type::eof();
while (__n--)
{
if (traits_type::eq_int_type(this->syncputc(*__s++), __eof))
break;
++__ret;
}
return __ret;
}
#endif
#if _GLIBCXX_EXTERN_TEMPLATE
extern template class stdio_sync_filebuf<char>;
#ifdef _GLIBCXX_USE_WCHAR_T
extern template class stdio_sync_filebuf<wchar_t>;
#endif
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Functional extensions -*- C++ -*-
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ext/functional
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _EXT_FUNCTIONAL
#define _EXT_FUNCTIONAL 1
#pragma GCC system_header
#include <functional>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::unary_function;
using std::binary_function;
using std::mem_fun1_t;
using std::const_mem_fun1_t;
using std::mem_fun1_ref_t;
using std::const_mem_fun1_ref_t;
/** The @c identity_element functions are not part of the C++
* standard; SGI provided them as an extension. Its argument is an
* operation, and its return value is the identity element for that
* operation. It is overloaded for addition and multiplication,
* and you can overload it for your own nefarious operations.
*
* @addtogroup SGIextensions
* @{
*/
/// An \link SGIextensions SGI extension \endlink.
template <class _Tp>
inline _Tp
identity_element(std::plus<_Tp>)
{ return _Tp(0); }
/// An \link SGIextensions SGI extension \endlink.
template <class _Tp>
inline _Tp
identity_element(std::multiplies<_Tp>)
{ return _Tp(1); }
/** @} */
/** As an extension to the binders, SGI provided composition functors and
* wrapper functions to aid in their creation. The @c unary_compose
* functor is constructed from two functions/functors, @c f and @c g.
* Calling @c operator() with a single argument @c x returns @c f(g(x)).
* The function @c compose1 takes the two functions and constructs a
* @c unary_compose variable for you.
*
* @c binary_compose is constructed from three functors, @c f, @c g1,
* and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function
* compose2 takes f, g1, and g2, and constructs the @c binary_compose
* instance for you. For example, if @c f returns an int, then
* \code
* int answer = (compose2(f,g1,g2))(x);
* \endcode
* is equivalent to
* \code
* int temp1 = g1(x);
* int temp2 = g2(x);
* int answer = f(temp1,temp2);
* \endcode
* But the first form is more compact, and can be passed around as a
* functor to other algorithms.
*
* @addtogroup SGIextensions
* @{
*/
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2>
class unary_compose
: public unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
_Operation2 _M_fn2;
public:
unary_compose(const _Operation1& __x, const _Operation2& __y)
: _M_fn1(__x), _M_fn2(__y) {}
typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __x) const
{ return _M_fn1(_M_fn2(__x)); }
};
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2>
inline unary_compose<_Operation1, _Operation2>
compose1(const _Operation1& __fn1, const _Operation2& __fn2)
{ return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); }
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2, class _Operation3>
class binary_compose
: public unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
_Operation2 _M_fn2;
_Operation3 _M_fn3;
public:
binary_compose(const _Operation1& __x, const _Operation2& __y,
const _Operation3& __z)
: _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __x) const
{ return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
};
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2, class _Operation3>
inline binary_compose<_Operation1, _Operation2, _Operation3>
compose2(const _Operation1& __fn1, const _Operation2& __fn2,
const _Operation3& __fn3)
{ return binary_compose<_Operation1, _Operation2, _Operation3>
(__fn1, __fn2, __fn3); }
/** @} */
/** As an extension, SGI provided a functor called @c identity. When a
* functor is required but no operations are desired, this can be used as a
* pass-through. Its @c operator() returns its argument unchanged.
*
* @addtogroup SGIextensions
*/
template <class _Tp>
struct identity
: public std::_Identity<_Tp> {};
/** @c select1st and @c select2nd are extensions provided by SGI. Their
* @c operator()s
* take a @c std::pair as an argument, and return either the first member
* or the second member, respectively. They can be used (especially with
* the composition functors) to @a strip data from a sequence before
* performing the remainder of an algorithm.
*
* @addtogroup SGIextensions
* @{
*/
/// An \link SGIextensions SGI extension \endlink.
template <class _Pair>
struct select1st
: public std::_Select1st<_Pair> {};
/// An \link SGIextensions SGI extension \endlink.
template <class _Pair>
struct select2nd
: public std::_Select2nd<_Pair> {};
/** @} */
// extension documented next
template <class _Arg1, class _Arg2>
struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1>
{
_Arg1
operator()(const _Arg1& __x, const _Arg2&) const
{ return __x; }
};
template <class _Arg1, class _Arg2>
struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2>
{
_Arg2
operator()(const _Arg1&, const _Arg2& __y) const
{ return __y; }
};
/** The @c operator() of the @c project1st functor takes two arbitrary
* arguments and returns the first one, while @c project2nd returns the
* second one. They are extensions provided by SGI.
*
* @addtogroup SGIextensions
* @{
*/
/// An \link SGIextensions SGI extension \endlink.
template <class _Arg1, class _Arg2>
struct project1st : public _Project1st<_Arg1, _Arg2> {};
/// An \link SGIextensions SGI extension \endlink.
template <class _Arg1, class _Arg2>
struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
/** @} */
// extension documented next
template <class _Result>
struct _Constant_void_fun
{
typedef _Result result_type;
result_type _M_val;
_Constant_void_fun(const result_type& __v) : _M_val(__v) {}
const result_type&
operator()() const
{ return _M_val; }
};
template <class _Result, class _Argument>
struct _Constant_unary_fun
{
typedef _Argument argument_type;
typedef _Result result_type;
result_type _M_val;
_Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
const result_type&
operator()(const _Argument&) const
{ return _M_val; }
};
template <class _Result, class _Arg1, class _Arg2>
struct _Constant_binary_fun
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
_Result _M_val;
_Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
const result_type&
operator()(const _Arg1&, const _Arg2&) const
{ return _M_val; }
};
/** These three functors are each constructed from a single arbitrary
* variable/value. Later, their @c operator()s completely ignore any
* arguments passed, and return the stored value.
* - @c constant_void_fun's @c operator() takes no arguments
* - @c constant_unary_fun's @c operator() takes one argument (ignored)
* - @c constant_binary_fun's @c operator() takes two arguments (ignored)
*
* The helper creator functions @c constant0, @c constant1, and
* @c constant2 each take a @a result argument and construct variables of
* the appropriate functor type.
*
* @addtogroup SGIextensions
* @{
*/
/// An \link SGIextensions SGI extension \endlink.
template <class _Result>
struct constant_void_fun
: public _Constant_void_fun<_Result>
{
constant_void_fun(const _Result& __v)
: _Constant_void_fun<_Result>(__v) {}
};
/// An \link SGIextensions SGI extension \endlink.
template <class _Result, class _Argument = _Result>
struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
{
constant_unary_fun(const _Result& __v)
: _Constant_unary_fun<_Result, _Argument>(__v) {}
};
/// An \link SGIextensions SGI extension \endlink.
template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1>
struct constant_binary_fun
: public _Constant_binary_fun<_Result, _Arg1, _Arg2>
{
constant_binary_fun(const _Result& __v)
: _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
};
/// An \link SGIextensions SGI extension \endlink.
template <class _Result>
inline constant_void_fun<_Result>
constant0(const _Result& __val)
{ return constant_void_fun<_Result>(__val); }
/// An \link SGIextensions SGI extension \endlink.
template <class _Result>
inline constant_unary_fun<_Result, _Result>
constant1(const _Result& __val)
{ return constant_unary_fun<_Result, _Result>(__val); }
/// An \link SGIextensions SGI extension \endlink.
template <class _Result>
inline constant_binary_fun<_Result,_Result,_Result>
constant2(const _Result& __val)
{ return constant_binary_fun<_Result, _Result, _Result>(__val); }
/** @} */
/** The @c subtractive_rng class is documented on
* <a href="http://www.sgi.com/tech/stl/">SGI's site</a>.
* Note that this code assumes that @c int is 32 bits.
*
* @ingroup SGIextensions
*/
class subtractive_rng
: public unary_function<unsigned int, unsigned int>
{
private:
unsigned int _M_table[55];
size_t _M_index1;
size_t _M_index2;
public:
/// Returns a number less than the argument.
unsigned int
operator()(unsigned int __limit)
{
_M_index1 = (_M_index1 + 1) % 55;
_M_index2 = (_M_index2 + 1) % 55;
_M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
return _M_table[_M_index1] % __limit;
}
void
_M_initialize(unsigned int __seed)
{
unsigned int __k = 1;
_M_table[54] = __seed;
size_t __i;
for (__i = 0; __i < 54; __i++)
{
size_t __ii = (21 * (__i + 1) % 55) - 1;
_M_table[__ii] = __k;
__k = __seed - __k;
__seed = _M_table[__ii];
}
for (int __loop = 0; __loop < 4; __loop++)
{
for (__i = 0; __i < 55; __i++)
_M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
}
_M_index1 = 0;
_M_index2 = 31;
}
/// Ctor allowing you to initialize the seed.
subtractive_rng(unsigned int __seed)
{ _M_initialize(__seed); }
/// Default ctor; initializes its state with some number you don't see.
subtractive_rng()
{ _M_initialize(161803398u); }
};
// Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,
// provided for backward compatibility, they are no longer part of
// the C++ standard.
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun1(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline const_mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/** @file ext/throw_allocator.h
* This file is a GNU extension to the Standard C++ Library.
*
* Contains two exception-generating types (throw_value, throw_allocator)
* intended to be used as value and allocator types while testing
* exception safety in templatized containers and algorithms. The
* allocator has additional log and debug features. The exception
* generated is of type forced_exception_error.
*/
#ifndef _THROW_ALLOCATOR_H
#define _THROW_ALLOCATOR_H 1
#include <cmath>
#include <ctime>
#include <map>
#include <string>
#include <ostream>
#include <stdexcept>
#include <utility>
#include <bits/functexcept.h>
#include <bits/move.h>
#if __cplusplus >= 201103L
# include <functional>
# include <random>
#else
# include <tr1/functional>
# include <tr1/random>
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Thown by exception safety machinery.
* @ingroup exceptions
*/
struct forced_error : public std::exception
{ };
// Substitute for forced_error object when -fno-exceptions.
inline void
__throw_forced_error()
{ _GLIBCXX_THROW_OR_ABORT(forced_error()); }
/**
* @brief Base class for checking address and label information
* about allocations. Create a std::map between the allocated
* address (void*) and a datum for annotations, which are a pair of
* numbers corresponding to label and allocated size.
*/
struct annotate_base
{
annotate_base()
{
label();
map_alloc();
}
static void
set_label(size_t l)
{ label() = l; }
static size_t
get_label()
{ return label(); }
void
insert(void* p, size_t size)
{
if (!p)
{
std::string error("annotate_base::insert null insert!\n");
log_to_string(error, make_entry(p, size));
std::__throw_logic_error(error.c_str());
}
const_iterator found = map_alloc().find(p);
if (found != map_alloc().end())
{
std::string error("annotate_base::insert double insert!\n");
log_to_string(error, make_entry(p, size));
log_to_string(error, *found);
std::__throw_logic_error(error.c_str());
}
map_alloc().insert(make_entry(p, size));
}
void
erase(void* p, size_t size)
{
check_allocated(p, size);
map_alloc().erase(p);
}
#if __cplusplus >= 201103L
void
insert_construct(void* p)
{
if (!p)
{
std::string error("annotate_base::insert_construct null!\n");
std::__throw_logic_error(error.c_str());
}
auto found = map_construct().find(p);
if (found != map_construct().end())
{
std::string error("annotate_base::insert_construct double insert!\n");
log_to_string(error, std::make_pair(p, get_label()));
log_to_string(error, *found);
std::__throw_logic_error(error.c_str());
}
map_construct().insert(std::make_pair(p, get_label()));
}
void
erase_construct(void* p)
{
check_constructed(p);
map_construct().erase(p);
}
#endif
// See if a particular address and allocation size has been saved.
inline void
check_allocated(void* p, size_t size)
{
const_iterator found = map_alloc().find(p);
if (found == map_alloc().end())
{
std::string error("annotate_base::check_allocated by value "
"null erase!\n");
log_to_string(error, make_entry(p, size));
std::__throw_logic_error(error.c_str());
}
if (found->second.second != size)
{
std::string error("annotate_base::check_allocated by value "
"wrong-size erase!\n");
log_to_string(error, make_entry(p, size));
log_to_string(error, *found);
std::__throw_logic_error(error.c_str());
}
}
// See if a given label has been allocated.
inline void
check(size_t label)
{
std::string found;
{
const_iterator beg = map_alloc().begin();
const_iterator end = map_alloc().end();
while (beg != end)
{
if (beg->second.first == label)
log_to_string(found, *beg);
++beg;
}
}
#if __cplusplus >= 201103L
{
auto beg = map_construct().begin();
auto end = map_construct().end();
while (beg != end)
{
if (beg->second == label)
log_to_string(found, *beg);
++beg;
}
}
#endif
if (!found.empty())
{
std::string error("annotate_base::check by label\n");
error += found;
std::__throw_logic_error(error.c_str());
}
}
// See if there is anything left allocated or constructed.
inline static void
check()
{
std::string found;
{
const_iterator beg = map_alloc().begin();
const_iterator end = map_alloc().end();
while (beg != end)
{
log_to_string(found, *beg);
++beg;
}
}
#if __cplusplus >= 201103L
{
auto beg = map_construct().begin();
auto end = map_construct().end();
while (beg != end)
{
log_to_string(found, *beg);
++beg;
}
}
#endif
if (!found.empty())
{
std::string error("annotate_base::check \n");
error += found;
std::__throw_logic_error(error.c_str());
}
}
#if __cplusplus >= 201103L
inline void
check_constructed(void* p)
{
auto found = map_construct().find(p);
if (found == map_construct().end())
{
std::string error("annotate_base::check_constructed not "
"constructed!\n");
log_to_string(error, std::make_pair(p, get_label()));
std::__throw_logic_error(error.c_str());
}
}
inline void
check_constructed(size_t label)
{
auto beg = map_construct().begin();
auto end = map_construct().end();
std::string found;
while (beg != end)
{
if (beg->second == label)
log_to_string(found, *beg);
++beg;
}
if (!found.empty())
{
std::string error("annotate_base::check_constructed by label\n");
error += found;
std::__throw_logic_error(error.c_str());
}
}
#endif
private:
typedef std::pair<size_t, size_t> data_type;
typedef std::map<void*, data_type> map_alloc_type;
typedef map_alloc_type::value_type entry_type;
typedef map_alloc_type::const_iterator const_iterator;
typedef map_alloc_type::const_reference const_reference;
#if __cplusplus >= 201103L
typedef std::map<void*, size_t> map_construct_type;
#endif
friend std::ostream&
operator<<(std::ostream&, const annotate_base&);
entry_type
make_entry(void* p, size_t size)
{ return std::make_pair(p, data_type(get_label(), size)); }
static void
log_to_string(std::string& s, const_reference ref)
{
char buf[40];
const char tab('\t');
s += "label: ";
unsigned long l = static_cast<unsigned long>(ref.second.first);
__builtin_sprintf(buf, "%lu", l);
s += buf;
s += tab;
s += "size: ";
l = static_cast<unsigned long>(ref.second.second);
__builtin_sprintf(buf, "%lu", l);
s += buf;
s += tab;
s += "address: ";
__builtin_sprintf(buf, "%p", ref.first);
s += buf;
s += '\n';
}
#if __cplusplus >= 201103L
static void
log_to_string(std::string& s, const std::pair<const void*, size_t>& ref)
{
char buf[40];
const char tab('\t');
s += "label: ";
unsigned long l = static_cast<unsigned long>(ref.second);
__builtin_sprintf(buf, "%lu", l);
s += buf;
s += tab;
s += "address: ";
__builtin_sprintf(buf, "%p", ref.first);
s += buf;
s += '\n';
}
#endif
static size_t&
label()
{
static size_t _S_label(std::numeric_limits<size_t>::max());
return _S_label;
}
static map_alloc_type&
map_alloc()
{
static map_alloc_type _S_map;
return _S_map;
}
#if __cplusplus >= 201103L
static map_construct_type&
map_construct()
{
static map_construct_type _S_map;
return _S_map;
}
#endif
};
inline std::ostream&
operator<<(std::ostream& os, const annotate_base& __b)
{
std::string error;
typedef annotate_base base_type;
{
base_type::const_iterator beg = __b.map_alloc().begin();
base_type::const_iterator end = __b.map_alloc().end();
for (; beg != end; ++beg)
__b.log_to_string(error, *beg);
}
#if __cplusplus >= 201103L
{
auto beg = __b.map_construct().begin();
auto end = __b.map_construct().end();
for (; beg != end; ++beg)
__b.log_to_string(error, *beg);
}
#endif
return os << error;
}
/**
* @brief Base struct for condition policy.
*
* Requires a public member function with the signature
* void throw_conditionally()
*/
struct condition_base
{
virtual ~condition_base() { };
};
/**
* @brief Base class for incremental control and throw.
*/
struct limit_condition : public condition_base
{
// Scope-level adjustor objects: set limit for throw at the
// beginning of a scope block, and restores to previous limit when
// object is destroyed on exiting the block.
struct adjustor_base
{
private:
const size_t _M_orig;
public:
adjustor_base() : _M_orig(limit()) { }
virtual
~adjustor_base() { set_limit(_M_orig); }
};
/// Never enter the condition.
struct never_adjustor : public adjustor_base
{
never_adjustor() { set_limit(std::numeric_limits<size_t>::max()); }
};
/// Always enter the condition.
struct always_adjustor : public adjustor_base
{
always_adjustor() { set_limit(count()); }
};
/// Enter the nth condition.
struct limit_adjustor : public adjustor_base
{
limit_adjustor(const size_t __l) { set_limit(__l); }
};
// Increment _S_count every time called.
// If _S_count matches the limit count, throw.
static void
throw_conditionally()
{
if (count() == limit())
__throw_forced_error();
++count();
}
static size_t&
count()
{
static size_t _S_count(0);
return _S_count;
}
static size_t&
limit()
{
static size_t _S_limit(std::numeric_limits<size_t>::max());
return _S_limit;
}
// Zero the throw counter, set limit to argument.
static void
set_limit(const size_t __l)
{
limit() = __l;
count() = 0;
}
};
/**
* @brief Base class for random probability control and throw.
*/
struct random_condition : public condition_base
{
// Scope-level adjustor objects: set probability for throw at the
// beginning of a scope block, and restores to previous
// probability when object is destroyed on exiting the block.
struct adjustor_base
{
private:
const double _M_orig;
public:
adjustor_base() : _M_orig(probability()) { }
virtual ~adjustor_base()
{ set_probability(_M_orig); }
};
/// Group condition.
struct group_adjustor : public adjustor_base
{
group_adjustor(size_t size)
{ set_probability(1 - std::pow(double(1 - probability()),
double(0.5 / (size + 1))));
}
};
/// Never enter the condition.
struct never_adjustor : public adjustor_base
{
never_adjustor() { set_probability(0); }
};
/// Always enter the condition.
struct always_adjustor : public adjustor_base
{
always_adjustor() { set_probability(1); }
};
random_condition()
{
probability();
engine();
}
static void
set_probability(double __p)
{ probability() = __p; }
static void
throw_conditionally()
{
if (generate() < probability())
__throw_forced_error();
}
void
seed(unsigned long __s)
{ engine().seed(__s); }
private:
#if __cplusplus >= 201103L
typedef std::uniform_real_distribution<double> distribution_type;
typedef std::mt19937 engine_type;
#else
typedef std::tr1::uniform_real<double> distribution_type;
typedef std::tr1::mt19937 engine_type;
#endif
static double
generate()
{
#if __cplusplus >= 201103L
const distribution_type distribution(0, 1);
static auto generator = std::bind(distribution, engine());
#else
// Use variate_generator to get normalized results.
typedef std::tr1::variate_generator<engine_type, distribution_type> gen_t;
distribution_type distribution(0, 1);
static gen_t generator(engine(), distribution);
#endif
double random = generator();
if (random < distribution.min() || random > distribution.max())
{
std::string __s("random_condition::generate");
__s += "\n";
__s += "random number generated is: ";
char buf[40];
__builtin_sprintf(buf, "%f", random);
__s += buf;
std::__throw_out_of_range(__s.c_str());
}
return random;
}
static double&
probability()
{
static double _S_p;
return _S_p;
}
static engine_type&
engine()
{
static engine_type _S_e;
return _S_e;
}
};
/**
* @brief Class with exception generation control. Intended to be
* used as a value_type in templatized code.
*
* Note: Destructor not allowed to throw.
*/
template<typename _Cond>
struct throw_value_base : public _Cond
{
typedef _Cond condition_type;
using condition_type::throw_conditionally;
std::size_t _M_i;
#ifndef _GLIBCXX_IS_AGGREGATE
throw_value_base() : _M_i(0)
{ throw_conditionally(); }
throw_value_base(const throw_value_base& __v) : _M_i(__v._M_i)
{ throw_conditionally(); }
#if __cplusplus >= 201103L
// Shall not throw.
throw_value_base(throw_value_base&&) = default;
#endif
explicit throw_value_base(const std::size_t __i) : _M_i(__i)
{ throw_conditionally(); }
#endif
throw_value_base&
operator=(const throw_value_base& __v)
{
throw_conditionally();
_M_i = __v._M_i;
return *this;
}
#if __cplusplus >= 201103L
// Shall not throw.
throw_value_base&
operator=(throw_value_base&&) = default;
#endif
throw_value_base&
operator++()
{
throw_conditionally();
++_M_i;
return *this;
}
};
template<typename _Cond>
inline void
swap(throw_value_base<_Cond>& __a, throw_value_base<_Cond>& __b)
{
typedef throw_value_base<_Cond> throw_value;
throw_value::throw_conditionally();
throw_value orig(__a);
__a = __b;
__b = orig;
}
// General instantiable types requirements.
template<typename _Cond>
inline bool
operator==(const throw_value_base<_Cond>& __a,
const throw_value_base<_Cond>& __b)
{
typedef throw_value_base<_Cond> throw_value;
throw_value::throw_conditionally();
bool __ret = __a._M_i == __b._M_i;
return __ret;
}
template<typename _Cond>
inline bool
operator<(const throw_value_base<_Cond>& __a,
const throw_value_base<_Cond>& __b)
{
typedef throw_value_base<_Cond> throw_value;
throw_value::throw_conditionally();
bool __ret = __a._M_i < __b._M_i;
return __ret;
}
// Numeric algorithms instantiable types requirements.
template<typename _Cond>
inline throw_value_base<_Cond>
operator+(const throw_value_base<_Cond>& __a,
const throw_value_base<_Cond>& __b)
{
typedef throw_value_base<_Cond> throw_value;
throw_value::throw_conditionally();
throw_value __ret(__a._M_i + __b._M_i);
return __ret;
}
template<typename _Cond>
inline throw_value_base<_Cond>
operator-(const throw_value_base<_Cond>& __a,
const throw_value_base<_Cond>& __b)
{
typedef throw_value_base<_Cond> throw_value;
throw_value::throw_conditionally();
throw_value __ret(__a._M_i - __b._M_i);
return __ret;
}
template<typename _Cond>
inline throw_value_base<_Cond>
operator*(const throw_value_base<_Cond>& __a,
const throw_value_base<_Cond>& __b)
{
typedef throw_value_base<_Cond> throw_value;
throw_value::throw_conditionally();
throw_value __ret(__a._M_i * __b._M_i);
return __ret;
}
/// Type throwing via limit condition.
struct throw_value_limit : public throw_value_base<limit_condition>
{
typedef throw_value_base<limit_condition> base_type;
#ifndef _GLIBCXX_IS_AGGREGATE
throw_value_limit() { }
throw_value_limit(const throw_value_limit& __other)
: base_type(__other._M_i) { }
#if __cplusplus >= 201103L
throw_value_limit(throw_value_limit&&) = default;
#endif
explicit throw_value_limit(const std::size_t __i) : base_type(__i) { }
#endif
throw_value_limit&
operator=(const throw_value_limit& __other)
{
base_type::operator=(__other);
return *this;
}
#if __cplusplus >= 201103L
throw_value_limit&
operator=(throw_value_limit&&) = default;
#endif
};
/// Type throwing via random condition.
struct throw_value_random : public throw_value_base<random_condition>
{
typedef throw_value_base<random_condition> base_type;
#ifndef _GLIBCXX_IS_AGGREGATE
throw_value_random() { }
throw_value_random(const throw_value_random& __other)
: base_type(__other._M_i) { }
#if __cplusplus >= 201103L
throw_value_random(throw_value_random&&) = default;
#endif
explicit throw_value_random(const std::size_t __i) : base_type(__i) { }
#endif
throw_value_random&
operator=(const throw_value_random& __other)
{
base_type::operator=(__other);
return *this;
}
#if __cplusplus >= 201103L
throw_value_random&
operator=(throw_value_random&&) = default;
#endif
};
/**
* @brief Allocator class with logging and exception generation control.
* Intended to be used as an allocator_type in templatized code.
* @ingroup allocators
*
* Note: Deallocate not allowed to throw.
*/
template<typename _Tp, typename _Cond>
class throw_allocator_base
: public annotate_base, public _Cond
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2103. std::allocator propagate_on_container_move_assignment
typedef std::true_type propagate_on_container_move_assignment;
#endif
private:
typedef _Cond condition_type;
std::allocator<value_type> _M_allocator;
using condition_type::throw_conditionally;
public:
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
{ return _M_allocator.max_size(); }
pointer
address(reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
const_pointer
address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
pointer
allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
{
if (__n > this->max_size())
std::__throw_bad_alloc();
throw_conditionally();
pointer const a = _M_allocator.allocate(__n, hint);
insert(a, sizeof(value_type) * __n);
return a;
}
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
void
construct(_Up* __p, _Args&&... __args)
{
_M_allocator.construct(__p, std::forward<_Args>(__args)...);
insert_construct(__p);
}
template<typename _Up>
void
destroy(_Up* __p)
{
erase_construct(__p);
_M_allocator.destroy(__p);
}
#else
void
construct(pointer __p, const value_type& val)
{ return _M_allocator.construct(__p, val); }
void
destroy(pointer __p)
{ _M_allocator.destroy(__p); }
#endif
void
deallocate(pointer __p, size_type __n)
{
erase(__p, sizeof(value_type) * __n);
_M_allocator.deallocate(__p, __n);
}
void
check_allocated(pointer __p, size_type __n)
{
size_type __t = sizeof(value_type) * __n;
annotate_base::check_allocated(__p, __t);
}
void
check(size_type __n)
{ annotate_base::check(__n); }
};
template<typename _Tp, typename _Cond>
inline bool
operator==(const throw_allocator_base<_Tp, _Cond>&,
const throw_allocator_base<_Tp, _Cond>&)
{ return true; }
template<typename _Tp, typename _Cond>
inline bool
operator!=(const throw_allocator_base<_Tp, _Cond>&,
const throw_allocator_base<_Tp, _Cond>&)
{ return false; }
/// Allocator throwing via limit condition.
template<typename _Tp>
struct throw_allocator_limit
: public throw_allocator_base<_Tp, limit_condition>
{
template<typename _Tp1>
struct rebind
{ typedef throw_allocator_limit<_Tp1> other; };
throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { }
throw_allocator_limit(const throw_allocator_limit&)
_GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
throw_allocator_limit(const throw_allocator_limit<_Tp1>&)
_GLIBCXX_USE_NOEXCEPT { }
~throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { }
};
/// Allocator throwing via random condition.
template<typename _Tp>
struct throw_allocator_random
: public throw_allocator_base<_Tp, random_condition>
{
template<typename _Tp1>
struct rebind
{ typedef throw_allocator_random<_Tp1> other; };
throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { }
throw_allocator_random(const throw_allocator_random&)
_GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
throw_allocator_random(const throw_allocator_random<_Tp1>&)
_GLIBCXX_USE_NOEXCEPT { }
~throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#if __cplusplus >= 201103L
# include <bits/functional_hash.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
/// Explicit specialization of std::hash for __gnu_cxx::throw_value_limit.
template<>
struct hash<__gnu_cxx::throw_value_limit>
: public std::unary_function<__gnu_cxx::throw_value_limit, size_t>
{
size_t
operator()(const __gnu_cxx::throw_value_limit& __val) const
{
__gnu_cxx::throw_value_limit::throw_conditionally();
std::hash<std::size_t> __h;
size_t __result = __h(__val._M_i);
return __result;
}
};
/// Explicit specialization of std::hash for __gnu_cxx::throw_value_random.
template<>
struct hash<__gnu_cxx::throw_value_random>
: public std::unary_function<__gnu_cxx::throw_value_random, size_t>
{
size_t
operator()(const __gnu_cxx::throw_value_random& __val) const
{
__gnu_cxx::throw_value_random::throw_conditionally();
std::hash<std::size_t> __h;
size_t __result = __h(__val._M_i);
return __result;
}
};
} // end namespace std
#endif
#endif
// Allocator that wraps "C" malloc -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/malloc_allocator.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _MALLOC_ALLOCATOR_H
#define _MALLOC_ALLOCATOR_H 1
#include <cstdlib>
#include <cstddef>
#include <new>
#include <bits/functexcept.h>
#include <bits/move.h>
#if __cplusplus >= 201103L
#include <type_traits>
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/**
* @brief An allocator that uses malloc.
* @ingroup allocators
*
* This is precisely the allocator defined in the C++ Standard.
* - all allocation calls malloc
* - all deallocation calls free
*/
template<typename _Tp>
class malloc_allocator
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template<typename _Tp1>
struct rebind
{ typedef malloc_allocator<_Tp1> other; };
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2103. propagate_on_container_move_assignment
typedef std::true_type propagate_on_container_move_assignment;
#endif
malloc_allocator() _GLIBCXX_USE_NOEXCEPT { }
malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
malloc_allocator(const malloc_allocator<_Tp1>&)
_GLIBCXX_USE_NOEXCEPT { }
~malloc_allocator() _GLIBCXX_USE_NOEXCEPT { }
pointer
address(reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
const_pointer
address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
// NB: __n is permitted to be 0. The C++ standard says nothing
// about what the return value is when __n == 0.
pointer
allocate(size_type __n, const void* = 0)
{
if (__n > this->max_size())
std::__throw_bad_alloc();
pointer __ret = 0;
#if __cpp_aligned_new
#if __cplusplus > 201402L && _GLIBCXX_HAVE_ALIGNED_ALLOC
if (alignof(_Tp) > alignof(std::max_align_t))
{
__ret = static_cast<_Tp*>(::aligned_alloc(alignof(_Tp),
__n * sizeof(_Tp)));
}
#else
# define _GLIBCXX_CHECK_MALLOC_RESULT
#endif
#endif
if (!__ret)
__ret = static_cast<_Tp*>(std::malloc(__n * sizeof(_Tp)));
if (!__ret)
std::__throw_bad_alloc();
#ifdef _GLIBCXX_CHECK_MALLOC_RESULT
#undef _GLIBCXX_CHECK_MALLOC_RESULT
if (reinterpret_cast<std::size_t>(__ret) % alignof(_Tp))
{
// Memory returned by malloc is not suitably aligned for _Tp.
deallocate(__ret, __n);
std::__throw_bad_alloc();
}
#endif
return __ret;
}
// __p is not permitted to be a null pointer.
void
deallocate(pointer __p, size_type)
{ std::free(static_cast<void*>(__p)); }
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
{ return size_t(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
void
construct(_Up* __p, _Args&&... __args)
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
template<typename _Up>
void
destroy(_Up* __p) { __p->~_Up(); }
#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) value_type(__val); }
void
destroy(pointer __p) { __p->~_Tp(); }
#endif
};
template<typename _Tp>
inline bool
operator==(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&)
{ return true; }
template<typename _Tp>
inline bool
operator!=(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&)
{ return false; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// rb_tree extension -*- C++ -*-
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ext/rb_tree
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _RB_TREE
#define _RB_TREE 1
#pragma GCC system_header
#include <bits/stl_tree.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::_Rb_tree;
using std::allocator;
// Class rb_tree is not part of the C++ standard. It is provided for
// compatibility with the HP STL.
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template <class _Key, class _Value, class _KeyOfValue, class _Compare,
class _Alloc = allocator<_Value> >
struct rb_tree
: public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
{
typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;
typedef typename _Base::allocator_type allocator_type;
rb_tree(const _Compare& __comp = _Compare(),
const allocator_type& __a = allocator_type())
: _Base(__comp, __a) { }
~rb_tree() { }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Short-string-optimized versatile string base -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/sso_string_base.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/vstring.h}
*/
#ifndef _SSO_STRING_BASE_H
#define _SSO_STRING_BASE_H 1
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
class __sso_string_base
: protected __vstring_utility<_CharT, _Traits, _Alloc>
{
public:
typedef _Traits traits_type;
typedef typename _Traits::char_type value_type;
typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
typedef typename _CharT_alloc_type::size_type size_type;
private:
// Data Members:
typename _Util_Base::template _Alloc_hider<_CharT_alloc_type>
_M_dataplus;
size_type _M_string_length;
enum { _S_local_capacity = 15 };
union
{
_CharT _M_local_data[_S_local_capacity + 1];
size_type _M_allocated_capacity;
};
void
_M_data(_CharT* __p)
{ _M_dataplus._M_p = __p; }
void
_M_length(size_type __length)
{ _M_string_length = __length; }
void
_M_capacity(size_type __capacity)
{ _M_allocated_capacity = __capacity; }
bool
_M_is_local() const
{ return _M_data() == _M_local_data; }
// Create & Destroy
_CharT*
_M_create(size_type&, size_type);
void
_M_dispose()
{
if (!_M_is_local())
_M_destroy(_M_allocated_capacity);
}
void
_M_destroy(size_type __size) throw()
{ _M_get_allocator().deallocate(_M_data(), __size + 1); }
// _M_construct_aux is used to implement the 21.3.1 para 15 which
// requires special behaviour if _InIterator is an integral type
template<typename _InIterator>
void
_M_construct_aux(_InIterator __beg, _InIterator __end,
std::__false_type)
{
typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
_M_construct(__beg, __end, _Tag());
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
void
_M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
{ _M_construct_aux_2(static_cast<size_type>(__beg), __end); }
void
_M_construct_aux_2(size_type __req, _CharT __c)
{ _M_construct(__req, __c); }
template<typename _InIterator>
void
_M_construct(_InIterator __beg, _InIterator __end)
{
typedef typename std::__is_integer<_InIterator>::__type _Integral;
_M_construct_aux(__beg, __end, _Integral());
}
// For Input Iterators, used in istreambuf_iterators, etc.
template<typename _InIterator>
void
_M_construct(_InIterator __beg, _InIterator __end,
std::input_iterator_tag);
// For forward_iterators up to random_access_iterators, used for
// string::iterator, _CharT*, etc.
template<typename _FwdIterator>
void
_M_construct(_FwdIterator __beg, _FwdIterator __end,
std::forward_iterator_tag);
void
_M_construct(size_type __req, _CharT __c);
public:
size_type
_M_max_size() const
{ return (_M_get_allocator().max_size() - 1) / 2; }
_CharT*
_M_data() const
{ return _M_dataplus._M_p; }
size_type
_M_length() const
{ return _M_string_length; }
size_type
_M_capacity() const
{
return _M_is_local() ? size_type(_S_local_capacity)
: _M_allocated_capacity;
}
bool
_M_is_shared() const
{ return false; }
void
_M_set_leaked() { }
void
_M_leak() { }
void
_M_set_length(size_type __n)
{
_M_length(__n);
traits_type::assign(_M_data()[__n], _CharT());
}
__sso_string_base()
: _M_dataplus(_M_local_data)
{ _M_set_length(0); }
__sso_string_base(const _Alloc& __a);
__sso_string_base(const __sso_string_base& __rcs);
#if __cplusplus >= 201103L
__sso_string_base(__sso_string_base&& __rcs);
#endif
__sso_string_base(size_type __n, _CharT __c, const _Alloc& __a);
template<typename _InputIterator>
__sso_string_base(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a);
~__sso_string_base()
{ _M_dispose(); }
_CharT_alloc_type&
_M_get_allocator()
{ return _M_dataplus; }
const _CharT_alloc_type&
_M_get_allocator() const
{ return _M_dataplus; }
void
_M_swap(__sso_string_base& __rcs);
void
_M_assign(const __sso_string_base& __rcs);
void
_M_reserve(size_type __res);
void
_M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
size_type __len2);
void
_M_erase(size_type __pos, size_type __n);
void
_M_clear()
{ _M_set_length(0); }
bool
_M_compare(const __sso_string_base&) const
{ return false; }
};
template<typename _CharT, typename _Traits, typename _Alloc>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_swap(__sso_string_base& __rcs)
{
if (this == &__rcs)
return;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 431. Swapping containers with unequal allocators.
std::__alloc_swap<_CharT_alloc_type>::_S_do_it(_M_get_allocator(),
__rcs._M_get_allocator());
if (_M_is_local())
if (__rcs._M_is_local())
{
if (_M_length() && __rcs._M_length())
{
_CharT __tmp_data[_S_local_capacity + 1];
traits_type::copy(__tmp_data, __rcs._M_local_data,
_S_local_capacity + 1);
traits_type::copy(__rcs._M_local_data, _M_local_data,
_S_local_capacity + 1);
traits_type::copy(_M_local_data, __tmp_data,
_S_local_capacity + 1);
}
else if (__rcs._M_length())
{
traits_type::copy(_M_local_data, __rcs._M_local_data,
_S_local_capacity + 1);
_M_length(__rcs._M_length());
__rcs._M_set_length(0);
return;
}
else if (_M_length())
{
traits_type::copy(__rcs._M_local_data, _M_local_data,
_S_local_capacity + 1);
__rcs._M_length(_M_length());
_M_set_length(0);
return;
}
}
else
{
const size_type __tmp_capacity = __rcs._M_allocated_capacity;
traits_type::copy(__rcs._M_local_data, _M_local_data,
_S_local_capacity + 1);
_M_data(__rcs._M_data());
__rcs._M_data(__rcs._M_local_data);
_M_capacity(__tmp_capacity);
}
else
{
const size_type __tmp_capacity = _M_allocated_capacity;
if (__rcs._M_is_local())
{
traits_type::copy(_M_local_data, __rcs._M_local_data,
_S_local_capacity + 1);
__rcs._M_data(_M_data());
_M_data(_M_local_data);
}
else
{
_CharT* __tmp_ptr = _M_data();
_M_data(__rcs._M_data());
__rcs._M_data(__tmp_ptr);
_M_capacity(__rcs._M_allocated_capacity);
}
__rcs._M_capacity(__tmp_capacity);
}
const size_type __tmp_length = _M_length();
_M_length(__rcs._M_length());
__rcs._M_length(__tmp_length);
}
template<typename _CharT, typename _Traits, typename _Alloc>
_CharT*
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_create(size_type& __capacity, size_type __old_capacity)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 83. String::npos vs. string::max_size()
if (__capacity > _M_max_size())
std::__throw_length_error(__N("__sso_string_base::_M_create"));
// The below implements an exponential growth policy, necessary to
// meet amortized linear time requirements of the library: see
// http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
{
__capacity = 2 * __old_capacity;
// Never allocate a string bigger than max_size.
if (__capacity > _M_max_size())
__capacity = _M_max_size();
}
// NB: Need an array of char_type[__capacity], plus a terminating
// null char_type() element.
return _M_get_allocator().allocate(__capacity + 1);
}
template<typename _CharT, typename _Traits, typename _Alloc>
__sso_string_base<_CharT, _Traits, _Alloc>::
__sso_string_base(const _Alloc& __a)
: _M_dataplus(__a, _M_local_data)
{ _M_set_length(0); }
template<typename _CharT, typename _Traits, typename _Alloc>
__sso_string_base<_CharT, _Traits, _Alloc>::
__sso_string_base(const __sso_string_base& __rcs)
: _M_dataplus(__rcs._M_get_allocator(), _M_local_data)
{ _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); }
#if __cplusplus >= 201103L
template<typename _CharT, typename _Traits, typename _Alloc>
__sso_string_base<_CharT, _Traits, _Alloc>::
__sso_string_base(__sso_string_base&& __rcs)
: _M_dataplus(__rcs._M_get_allocator(), _M_local_data)
{
if (__rcs._M_is_local())
{
if (__rcs._M_length())
traits_type::copy(_M_local_data, __rcs._M_local_data,
_S_local_capacity + 1);
}
else
{
_M_data(__rcs._M_data());
_M_capacity(__rcs._M_allocated_capacity);
}
_M_set_length(__rcs._M_length());
__rcs._M_data(__rcs._M_local_data);
__rcs._M_set_length(0);
}
#endif
template<typename _CharT, typename _Traits, typename _Alloc>
__sso_string_base<_CharT, _Traits, _Alloc>::
__sso_string_base(size_type __n, _CharT __c, const _Alloc& __a)
: _M_dataplus(__a, _M_local_data)
{ _M_construct(__n, __c); }
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InputIterator>
__sso_string_base<_CharT, _Traits, _Alloc>::
__sso_string_base(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a)
: _M_dataplus(__a, _M_local_data)
{ _M_construct(__beg, __end); }
// NB: This is the special case for Input Iterators, used in
// istreambuf_iterators, etc.
// Input Iterators have a cost structure very different from
// pointers, calling for a different coding style.
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InIterator>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_construct(_InIterator __beg, _InIterator __end,
std::input_iterator_tag)
{
size_type __len = 0;
size_type __capacity = size_type(_S_local_capacity);
while (__beg != __end && __len < __capacity)
{
_M_data()[__len++] = *__beg;
++__beg;
}
__try
{
while (__beg != __end)
{
if (__len == __capacity)
{
// Allocate more space.
__capacity = __len + 1;
_CharT* __another = _M_create(__capacity, __len);
this->_S_copy(__another, _M_data(), __len);
_M_dispose();
_M_data(__another);
_M_capacity(__capacity);
}
_M_data()[__len++] = *__beg;
++__beg;
}
}
__catch(...)
{
_M_dispose();
__throw_exception_again;
}
_M_set_length(__len);
}
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InIterator>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_construct(_InIterator __beg, _InIterator __end,
std::forward_iterator_tag)
{
// NB: Not required, but considered best practice.
if (__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("__sso_string_base::"
"_M_construct null not valid"));
size_type __dnew = static_cast<size_type>(std::distance(__beg, __end));
if (__dnew > size_type(_S_local_capacity))
{
_M_data(_M_create(__dnew, size_type(0)));
_M_capacity(__dnew);
}
// Check for out_of_range and length_error exceptions.
__try
{ this->_S_copy_chars(_M_data(), __beg, __end); }
__catch(...)
{
_M_dispose();
__throw_exception_again;
}
_M_set_length(__dnew);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_construct(size_type __n, _CharT __c)
{
if (__n > size_type(_S_local_capacity))
{
_M_data(_M_create(__n, size_type(0)));
_M_capacity(__n);
}
if (__n)
this->_S_assign(_M_data(), __n, __c);
_M_set_length(__n);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_assign(const __sso_string_base& __rcs)
{
if (this != &__rcs)
{
const size_type __rsize = __rcs._M_length();
const size_type __capacity = _M_capacity();
if (__rsize > __capacity)
{
size_type __new_capacity = __rsize;
_CharT* __tmp = _M_create(__new_capacity, __capacity);
_M_dispose();
_M_data(__tmp);
_M_capacity(__new_capacity);
}
if (__rsize)
this->_S_copy(_M_data(), __rcs._M_data(), __rsize);
_M_set_length(__rsize);
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_reserve(size_type __res)
{
// Make sure we don't shrink below the current size.
if (__res < _M_length())
__res = _M_length();
const size_type __capacity = _M_capacity();
if (__res != __capacity)
{
if (__res > __capacity
|| __res > size_type(_S_local_capacity))
{
_CharT* __tmp = _M_create(__res, __capacity);
this->_S_copy(__tmp, _M_data(), _M_length() + 1);
_M_dispose();
_M_data(__tmp);
_M_capacity(__res);
}
else if (!_M_is_local())
{
this->_S_copy(_M_local_data, _M_data(), _M_length() + 1);
_M_destroy(__capacity);
_M_data(_M_local_data);
}
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
size_type __len2)
{
const size_type __how_much = _M_length() - __pos - __len1;
size_type __new_capacity = _M_length() + __len2 - __len1;
_CharT* __r = _M_create(__new_capacity, _M_capacity());
if (__pos)
this->_S_copy(__r, _M_data(), __pos);
if (__s && __len2)
this->_S_copy(__r + __pos, __s, __len2);
if (__how_much)
this->_S_copy(__r + __pos + __len2,
_M_data() + __pos + __len1, __how_much);
_M_dispose();
_M_data(__r);
_M_capacity(__new_capacity);
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_erase(size_type __pos, size_type __n)
{
const size_type __how_much = _M_length() - __pos - __n;
if (__how_much && __n)
this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
_M_set_length(_M_length() - __n);
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _SSO_STRING_BASE_H */
// <cast.h> -*- C++ -*-
// Copyright (C) 2008-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/cast.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/pointer.h}
*/
#ifndef _GLIBCXX_CAST_H
#define _GLIBCXX_CAST_H 1
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* These functions are here to allow containers to support non standard
* pointer types. For normal pointers, these resolve to the use of the
* standard cast operation. For other types the functions will perform
* the appropriate cast to/from the custom pointer class so long as that
* class meets the following conditions:
* 1) has a typedef element_type which names tehe type it points to.
* 2) has a get() const method which returns element_type*.
* 3) has a constructor which can take one element_type* argument.
*/
/**
* This type supports the semantics of the pointer cast operators (below.)
*/
template<typename _ToType>
struct _Caster
{ typedef typename _ToType::element_type* type; };
template<typename _ToType>
struct _Caster<_ToType*>
{ typedef _ToType* type; };
/**
* Casting operations for cases where _FromType is not a standard pointer.
* _ToType can be a standard or non-standard pointer. Given that _FromType
* is not a pointer, it must have a get() method that returns the standard
* pointer equivalent of the address it points to, and must have an
* element_type typedef which names the type it points to.
*/
template<typename _ToType, typename _FromType>
inline _ToType
__static_pointer_cast(const _FromType& __arg)
{ return _ToType(static_cast<typename _Caster<_ToType>::
type>(__arg.get())); }
template<typename _ToType, typename _FromType>
inline _ToType
__dynamic_pointer_cast(const _FromType& __arg)
{ return _ToType(dynamic_cast<typename _Caster<_ToType>::
type>(__arg.get())); }
template<typename _ToType, typename _FromType>
inline _ToType
__const_pointer_cast(const _FromType& __arg)
{ return _ToType(const_cast<typename _Caster<_ToType>::
type>(__arg.get())); }
template<typename _ToType, typename _FromType>
inline _ToType
__reinterpret_pointer_cast(const _FromType& __arg)
{ return _ToType(reinterpret_cast<typename _Caster<_ToType>::
type>(__arg.get())); }
/**
* Casting operations for cases where _FromType is a standard pointer.
* _ToType can be a standard or non-standard pointer.
*/
template<typename _ToType, typename _FromType>
inline _ToType
__static_pointer_cast(_FromType* __arg)
{ return _ToType(static_cast<typename _Caster<_ToType>::
type>(__arg)); }
template<typename _ToType, typename _FromType>
inline _ToType
__dynamic_pointer_cast(_FromType* __arg)
{ return _ToType(dynamic_cast<typename _Caster<_ToType>::
type>(__arg)); }
template<typename _ToType, typename _FromType>
inline _ToType
__const_pointer_cast(_FromType* __arg)
{ return _ToType(const_cast<typename _Caster<_ToType>::
type>(__arg)); }
template<typename _ToType, typename _FromType>
inline _ToType
__reinterpret_pointer_cast(_FromType* __arg)
{ return _ToType(reinterpret_cast<typename _Caster<_ToType>::
type>(__arg)); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // _GLIBCXX_CAST_H
// Allocators -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996-1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ext/pool_allocator.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _POOL_ALLOCATOR_H
#define _POOL_ALLOCATOR_H 1
#include <bits/c++config.h>
#include <cstdlib>
#include <new>
#include <bits/functexcept.h>
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/move.h>
#if __cplusplus >= 201103L
#include <type_traits>
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/**
* @brief Base class for __pool_alloc.
*
* Uses various allocators to fulfill underlying requests (and makes as
* few requests as possible when in default high-speed pool mode).
*
* Important implementation properties:
* 0. If globally mandated, then allocate objects from new
* 1. If the clients request an object of size > _S_max_bytes, the resulting
* object will be obtained directly from new
* 2. In all other cases, we allocate an object of size exactly
* _S_round_up(requested_size). Thus the client has enough size
* information that we can return the object to the proper free list
* without permanently losing part of the object.
*/
class __pool_alloc_base
{
protected:
enum { _S_align = 8 };
enum { _S_max_bytes = 128 };
enum { _S_free_list_size = (size_t)_S_max_bytes / (size_t)_S_align };
union _Obj
{
union _Obj* _M_free_list_link;
char _M_client_data[1]; // The client sees this.
};
static _Obj* volatile _S_free_list[_S_free_list_size];
// Chunk allocation state.
static char* _S_start_free;
static char* _S_end_free;
static size_t _S_heap_size;
size_t
_M_round_up(size_t __bytes)
{ return ((__bytes + (size_t)_S_align - 1) & ~((size_t)_S_align - 1)); }
_GLIBCXX_CONST _Obj* volatile*
_M_get_free_list(size_t __bytes) throw ();
__mutex&
_M_get_mutex() throw ();
// Returns an object of size __n, and optionally adds to size __n
// free list.
void*
_M_refill(size_t __n);
// Allocates a chunk for nobjs of size size. nobjs may be reduced
// if it is inconvenient to allocate the requested number.
char*
_M_allocate_chunk(size_t __n, int& __nobjs);
};
/**
* @brief Allocator using a memory pool with a single lock.
* @ingroup allocators
*/
template<typename _Tp>
class __pool_alloc : private __pool_alloc_base
{
private:
static _Atomic_word _S_force_new;
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template<typename _Tp1>
struct rebind
{ typedef __pool_alloc<_Tp1> other; };
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2103. propagate_on_container_move_assignment
typedef std::true_type propagate_on_container_move_assignment;
#endif
__pool_alloc() _GLIBCXX_USE_NOEXCEPT { }
__pool_alloc(const __pool_alloc&) _GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
__pool_alloc(const __pool_alloc<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
~__pool_alloc() _GLIBCXX_USE_NOEXCEPT { }
pointer
address(reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
const_pointer
address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
{ return size_t(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
void
construct(_Up* __p, _Args&&... __args)
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
template<typename _Up>
void
destroy(_Up* __p) { __p->~_Up(); }
#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) _Tp(__val); }
void
destroy(pointer __p) { __p->~_Tp(); }
#endif
pointer
allocate(size_type __n, const void* = 0);
void
deallocate(pointer __p, size_type __n);
};
template<typename _Tp>
inline bool
operator==(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&)
{ return true; }
template<typename _Tp>
inline bool
operator!=(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&)
{ return false; }
template<typename _Tp>
_Atomic_word
__pool_alloc<_Tp>::_S_force_new;
template<typename _Tp>
_Tp*
__pool_alloc<_Tp>::allocate(size_type __n, const void*)
{
pointer __ret = 0;
if (__builtin_expect(__n != 0, true))
{
if (__n > this->max_size())
std::__throw_bad_alloc();
const size_t __bytes = __n * sizeof(_Tp);
#if __cpp_aligned_new
if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
{
std::align_val_t __al = std::align_val_t(alignof(_Tp));
return static_cast<_Tp*>(::operator new(__bytes, __al));
}
#endif
// If there is a race through here, assume answer from getenv
// will resolve in same direction. Inspired by techniques
// to efficiently support threading found in basic_string.h.
if (_S_force_new == 0)
{
if (std::getenv("GLIBCXX_FORCE_NEW"))
__atomic_add_dispatch(&_S_force_new, 1);
else
__atomic_add_dispatch(&_S_force_new, -1);
}
if (__bytes > size_t(_S_max_bytes) || _S_force_new > 0)
__ret = static_cast<_Tp*>(::operator new(__bytes));
else
{
_Obj* volatile* __free_list = _M_get_free_list(__bytes);
__scoped_lock sentry(_M_get_mutex());
_Obj* __restrict__ __result = *__free_list;
if (__builtin_expect(__result == 0, 0))
__ret = static_cast<_Tp*>(_M_refill(_M_round_up(__bytes)));
else
{
*__free_list = __result->_M_free_list_link;
__ret = reinterpret_cast<_Tp*>(__result);
}
if (__ret == 0)
std::__throw_bad_alloc();
}
}
return __ret;
}
template<typename _Tp>
void
__pool_alloc<_Tp>::deallocate(pointer __p, size_type __n)
{
if (__builtin_expect(__n != 0 && __p != 0, true))
{
#if __cpp_aligned_new
if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
{
::operator delete(__p, std::align_val_t(alignof(_Tp)));
return;
}
#endif
const size_t __bytes = __n * sizeof(_Tp);
if (__bytes > static_cast<size_t>(_S_max_bytes) || _S_force_new > 0)
::operator delete(__p);
else
{
_Obj* volatile* __free_list = _M_get_free_list(__bytes);
_Obj* __q = reinterpret_cast<_Obj*>(__p);
__scoped_lock sentry(_M_get_mutex());
__q ->_M_free_list_link = *__free_list;
*__free_list = __q;
}
}
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Hashing set implementation -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file backward/hash_set
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _BACKWARD_HASH_SET
#define _BACKWARD_HASH_SET 1
#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
#include "backward_warning.h"
#endif
#include <bits/c++config.h>
#include <backward/hashtable.h>
#include <bits/concept_check.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::equal_to;
using std::allocator;
using std::pair;
using std::_Identity;
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Value, class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_set
{
// concept requirements
__glibcxx_class_requires(_Value, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Alloc::pointer pointer;
typedef typename _Alloc::const_pointer const_pointer;
typedef typename _Alloc::reference reference;
typedef typename _Alloc::const_reference const_reference;
typedef typename _Ht::const_iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_set()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_set(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_set(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_set& __hs)
{ _M_ht.swap(__hs._M_ht); }
template<class _Val, class _HF, class _EqK, class _Al>
friend bool
operator==(const hash_set<_Val, _HF, _EqK, _Al>&,
const hash_set<_Val, _HF, _EqK, _Al>&);
iterator
begin() const
{ return _M_ht.begin(); }
iterator
end() const
{ return _M_ht.end(); }
pair<iterator, bool>
insert(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
return pair<iterator,bool>(__p.first, __p.second);
}
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f, __l); }
pair<iterator, bool>
insert_noresize(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p
= _M_ht.insert_unique_noresize(__obj);
return pair<iterator, bool>(__p.first, __p.second);
}
iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return __hs1._M_ht == __hs2._M_ht; }
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return !(__hs1 == __hs2); }
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void
swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ __hs1.swap(__hs2); }
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Value,
class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_multiset
{
// concept requirements
__glibcxx_class_requires(_Value, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Alloc::pointer pointer;
typedef typename _Alloc::const_pointer const_pointer;
typedef typename _Alloc::reference reference;
typedef typename _Alloc::const_reference const_reference;
typedef typename _Ht::const_iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_multiset()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_multiset(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_multiset(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_multiset& hs)
{ _M_ht.swap(hs._M_ht); }
template<class _Val, class _HF, class _EqK, class _Al>
friend bool
operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&,
const hash_multiset<_Val, _HF, _EqK, _Al>&);
iterator
begin() const
{ return _M_ht.begin(); }
iterator
end() const
{ return _M_ht.end(); }
iterator
insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
iterator
insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{ return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return __hs1._M_ht == __hs2._M_ht; }
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ return !(__hs1 == __hs2); }
template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void
swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
{ __hs1.swap(__hs2); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Specialization of insert_iterator so that it will work for hash_set
// and hash_multiset.
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>
_Container;
_Container* container;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,
_EqualKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>
_Container;
_Container* container;
typename _Container::iterator iter;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int) { return *this; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Singly-linked list implementation -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file ext/slist
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _SLIST
#define _SLIST 1
#include <algorithm>
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/concept_check.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
using std::_Construct;
using std::_Destroy;
using std::allocator;
using std::__true_type;
using std::__false_type;
struct _Slist_node_base
{
_Slist_node_base* _M_next;
};
inline _Slist_node_base*
__slist_make_link(_Slist_node_base* __prev_node,
_Slist_node_base* __new_node)
{
__new_node->_M_next = __prev_node->_M_next;
__prev_node->_M_next = __new_node;
return __new_node;
}
inline _Slist_node_base*
__slist_previous(_Slist_node_base* __head,
const _Slist_node_base* __node)
{
while (__head && __head->_M_next != __node)
__head = __head->_M_next;
return __head;
}
inline const _Slist_node_base*
__slist_previous(const _Slist_node_base* __head,
const _Slist_node_base* __node)
{
while (__head && __head->_M_next != __node)
__head = __head->_M_next;
return __head;
}
inline void
__slist_splice_after(_Slist_node_base* __pos,
_Slist_node_base* __before_first,
_Slist_node_base* __before_last)
{
if (__pos != __before_first && __pos != __before_last)
{
_Slist_node_base* __first = __before_first->_M_next;
_Slist_node_base* __after = __pos->_M_next;
__before_first->_M_next = __before_last->_M_next;
__pos->_M_next = __first;
__before_last->_M_next = __after;
}
}
inline void
__slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __head)
{
_Slist_node_base* __before_last = __slist_previous(__head, 0);
if (__before_last != __head)
{
_Slist_node_base* __after = __pos->_M_next;
__pos->_M_next = __head->_M_next;
__head->_M_next = 0;
__before_last->_M_next = __after;
}
}
inline _Slist_node_base*
__slist_reverse(_Slist_node_base* __node)
{
_Slist_node_base* __result = __node;
__node = __node->_M_next;
__result->_M_next = 0;
while(__node)
{
_Slist_node_base* __next = __node->_M_next;
__node->_M_next = __result;
__result = __node;
__node = __next;
}
return __result;
}
inline size_t
__slist_size(_Slist_node_base* __node)
{
size_t __result = 0;
for (; __node != 0; __node = __node->_M_next)
++__result;
return __result;
}
template <class _Tp>
struct _Slist_node : public _Slist_node_base
{
_Tp _M_data;
};
struct _Slist_iterator_base
{
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
_Slist_node_base* _M_node;
_Slist_iterator_base(_Slist_node_base* __x)
: _M_node(__x) {}
void
_M_incr()
{ _M_node = _M_node->_M_next; }
bool
operator==(const _Slist_iterator_base& __x) const
{ return _M_node == __x._M_node; }
bool
operator!=(const _Slist_iterator_base& __x) const
{ return _M_node != __x._M_node; }
};
template <class _Tp, class _Ref, class _Ptr>
struct _Slist_iterator : public _Slist_iterator_base
{
typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
typedef _Slist_iterator<_Tp, _Ref, _Ptr> _Self;
typedef _Tp value_type;
typedef _Ptr pointer;
typedef _Ref reference;
typedef _Slist_node<_Tp> _Node;
explicit
_Slist_iterator(_Node* __x)
: _Slist_iterator_base(__x) {}
_Slist_iterator()
: _Slist_iterator_base(0) {}
_Slist_iterator(const iterator& __x)
: _Slist_iterator_base(__x._M_node) {}
reference
operator*() const
{ return ((_Node*) _M_node)->_M_data; }
pointer
operator->() const
{ return &(operator*()); }
_Self&
operator++()
{
_M_incr();
return *this;
}
_Self
operator++(int)
{
_Self __tmp = *this;
_M_incr();
return __tmp;
}
};
template <class _Tp, class _Alloc>
struct _Slist_base
: public _Alloc::template rebind<_Slist_node<_Tp> >::other
{
typedef typename _Alloc::template rebind<_Slist_node<_Tp> >::other
_Node_alloc;
typedef _Alloc allocator_type;
allocator_type
get_allocator() const
{ return *static_cast<const _Node_alloc*>(this); }
_Slist_base(const allocator_type& __a)
: _Node_alloc(__a)
{ this->_M_head._M_next = 0; }
~_Slist_base()
{ _M_erase_after(&this->_M_head, 0); }
protected:
_Slist_node_base _M_head;
_Slist_node<_Tp>*
_M_get_node()
{ return _Node_alloc::allocate(1); }
void
_M_put_node(_Slist_node<_Tp>* __p)
{ _Node_alloc::deallocate(__p, 1); }
protected:
_Slist_node_base* _M_erase_after(_Slist_node_base* __pos)
{
_Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next);
_Slist_node_base* __next_next = __next->_M_next;
__pos->_M_next = __next_next;
get_allocator().destroy(&__next->_M_data);
_M_put_node(__next);
return __next_next;
}
_Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
};
template <class _Tp, class _Alloc>
_Slist_node_base*
_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
_Slist_node_base* __last_node)
{
_Slist_node<_Tp>* __cur = (_Slist_node<_Tp>*) (__before_first->_M_next);
while (__cur != __last_node)
{
_Slist_node<_Tp>* __tmp = __cur;
__cur = (_Slist_node<_Tp>*) __cur->_M_next;
get_allocator().destroy(&__tmp->_M_data);
_M_put_node(__tmp);
}
__before_first->_M_next = __last_node;
return __last_node;
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template <class _Tp, class _Alloc = allocator<_Tp> >
class slist : private _Slist_base<_Tp,_Alloc>
{
// concept requirements
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
private:
typedef _Slist_base<_Tp,_Alloc> _Base;
public:
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
typedef typename _Base::allocator_type allocator_type;
allocator_type
get_allocator() const
{ return _Base::get_allocator(); }
private:
typedef _Slist_node<_Tp> _Node;
typedef _Slist_node_base _Node_base;
typedef _Slist_iterator_base _Iterator_base;
_Node*
_M_create_node(const value_type& __x)
{
_Node* __node = this->_M_get_node();
__try
{
get_allocator().construct(&__node->_M_data, __x);
__node->_M_next = 0;
}
__catch(...)
{
this->_M_put_node(__node);
__throw_exception_again;
}
return __node;
}
_Node*
_M_create_node()
{
_Node* __node = this->_M_get_node();
__try
{
get_allocator().construct(&__node->_M_data, value_type());
__node->_M_next = 0;
}
__catch(...)
{
this->_M_put_node(__node);
__throw_exception_again;
}
return __node;
}
public:
explicit
slist(const allocator_type& __a = allocator_type())
: _Base(__a) {}
slist(size_type __n, const value_type& __x,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ _M_insert_after_fill(&this->_M_head, __n, __x); }
explicit
slist(size_type __n)
: _Base(allocator_type())
{ _M_insert_after_fill(&this->_M_head, __n, value_type()); }
// We don't need any dispatching tricks here, because
// _M_insert_after_range already does them.
template <class _InputIterator>
slist(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ _M_insert_after_range(&this->_M_head, __first, __last); }
slist(const slist& __x)
: _Base(__x.get_allocator())
{ _M_insert_after_range(&this->_M_head, __x.begin(), __x.end()); }
slist&
operator= (const slist& __x);
~slist() {}
public:
// assign(), a generalized assignment member function. Two
// versions: one that takes a count, and one that takes a range.
// The range version is a member template, so we dispatch on whether
// or not the type is an integer.
void
assign(size_type __n, const _Tp& __val)
{ _M_fill_assign(__n, __val); }
void
_M_fill_assign(size_type __n, const _Tp& __val);
template <class _InputIterator>
void
assign(_InputIterator __first, _InputIterator __last)
{
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void
_M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ _M_fill_assign((size_type) __n, (_Tp) __val); }
template <class _InputIterator>
void
_M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type);
public:
iterator
begin()
{ return iterator((_Node*)this->_M_head._M_next); }
const_iterator
begin() const
{ return const_iterator((_Node*)this->_M_head._M_next);}
iterator
end()
{ return iterator(0); }
const_iterator
end() const
{ return const_iterator(0); }
// Experimental new feature: before_begin() returns a
// non-dereferenceable iterator that, when incremented, yields
// begin(). This iterator may be used as the argument to
// insert_after, erase_after, etc. Note that even for an empty
// slist, before_begin() is not the same iterator as end(). It
// is always necessary to increment before_begin() at least once to
// obtain end().
iterator
before_begin()
{ return iterator((_Node*) &this->_M_head); }
const_iterator
before_begin() const
{ return const_iterator((_Node*) &this->_M_head); }
size_type
size() const
{ return __slist_size(this->_M_head._M_next); }
size_type
max_size() const
{ return size_type(-1); }
bool
empty() const
{ return this->_M_head._M_next == 0; }
void
swap(slist& __x)
{ std::swap(this->_M_head._M_next, __x._M_head._M_next); }
public:
reference
front()
{ return ((_Node*) this->_M_head._M_next)->_M_data; }
const_reference
front() const
{ return ((_Node*) this->_M_head._M_next)->_M_data; }
void
push_front(const value_type& __x)
{ __slist_make_link(&this->_M_head, _M_create_node(__x)); }
void
push_front()
{ __slist_make_link(&this->_M_head, _M_create_node()); }
void
pop_front()
{
_Node* __node = (_Node*) this->_M_head._M_next;
this->_M_head._M_next = __node->_M_next;
get_allocator().destroy(&__node->_M_data);
this->_M_put_node(__node);
}
iterator
previous(const_iterator __pos)
{ return iterator((_Node*) __slist_previous(&this->_M_head,
__pos._M_node)); }
const_iterator
previous(const_iterator __pos) const
{ return const_iterator((_Node*) __slist_previous(&this->_M_head,
__pos._M_node)); }
private:
_Node*
_M_insert_after(_Node_base* __pos, const value_type& __x)
{ return (_Node*) (__slist_make_link(__pos, _M_create_node(__x))); }
_Node*
_M_insert_after(_Node_base* __pos)
{ return (_Node*) (__slist_make_link(__pos, _M_create_node())); }
void
_M_insert_after_fill(_Node_base* __pos,
size_type __n, const value_type& __x)
{
for (size_type __i = 0; __i < __n; ++__i)
__pos = __slist_make_link(__pos, _M_create_node(__x));
}
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InIterator>
void
_M_insert_after_range(_Node_base* __pos,
_InIterator __first, _InIterator __last)
{
typedef typename std::__is_integer<_InIterator>::__type _Integral;
_M_insert_after_range(__pos, __first, __last, _Integral());
}
template <class _Integer>
void
_M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
__true_type)
{ _M_insert_after_fill(__pos, __n, __x); }
template <class _InIterator>
void
_M_insert_after_range(_Node_base* __pos,
_InIterator __first, _InIterator __last,
__false_type)
{
while (__first != __last)
{
__pos = __slist_make_link(__pos, _M_create_node(*__first));
++__first;
}
}
public:
iterator
insert_after(iterator __pos, const value_type& __x)
{ return iterator(_M_insert_after(__pos._M_node, __x)); }
iterator
insert_after(iterator __pos)
{ return insert_after(__pos, value_type()); }
void
insert_after(iterator __pos, size_type __n, const value_type& __x)
{ _M_insert_after_fill(__pos._M_node, __n, __x); }
// We don't need any dispatching tricks here, because
// _M_insert_after_range already does them.
template <class _InIterator>
void
insert_after(iterator __pos, _InIterator __first, _InIterator __last)
{ _M_insert_after_range(__pos._M_node, __first, __last); }
iterator
insert(iterator __pos, const value_type& __x)
{ return iterator(_M_insert_after(__slist_previous(&this->_M_head,
__pos._M_node),
__x)); }
iterator
insert(iterator __pos)
{ return iterator(_M_insert_after(__slist_previous(&this->_M_head,
__pos._M_node),
value_type())); }
void
insert(iterator __pos, size_type __n, const value_type& __x)
{ _M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node),
__n, __x); }
// We don't need any dispatching tricks here, because
// _M_insert_after_range already does them.
template <class _InIterator>
void
insert(iterator __pos, _InIterator __first, _InIterator __last)
{ _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node),
__first, __last); }
public:
iterator
erase_after(iterator __pos)
{ return iterator((_Node*) this->_M_erase_after(__pos._M_node)); }
iterator
erase_after(iterator __before_first, iterator __last)
{
return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
__last._M_node));
}
iterator
erase(iterator __pos)
{
return iterator((_Node*) this->_M_erase_after
(__slist_previous(&this->_M_head, __pos._M_node)));
}
iterator
erase(iterator __first, iterator __last)
{
return iterator((_Node*) this->_M_erase_after
(__slist_previous(&this->_M_head, __first._M_node),
__last._M_node));
}
void
resize(size_type new_size, const _Tp& __x);
void
resize(size_type new_size)
{ resize(new_size, _Tp()); }
void
clear()
{ this->_M_erase_after(&this->_M_head, 0); }
public:
// Moves the range [__before_first + 1, __before_last + 1) to *this,
// inserting it immediately after __pos. This is constant time.
void
splice_after(iterator __pos,
iterator __before_first, iterator __before_last)
{
if (__before_first != __before_last)
__slist_splice_after(__pos._M_node, __before_first._M_node,
__before_last._M_node);
}
// Moves the element that follows __prev to *this, inserting it
// immediately after __pos. This is constant time.
void
splice_after(iterator __pos, iterator __prev)
{ __slist_splice_after(__pos._M_node,
__prev._M_node, __prev._M_node->_M_next); }
// Removes all of the elements from the list __x to *this, inserting
// them immediately after __pos. __x must not be *this. Complexity:
// linear in __x.size().
void
splice_after(iterator __pos, slist& __x)
{ __slist_splice_after(__pos._M_node, &__x._M_head); }
// Linear in distance(begin(), __pos), and linear in __x.size().
void
splice(iterator __pos, slist& __x)
{
if (__x._M_head._M_next)
__slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),
&__x._M_head,
__slist_previous(&__x._M_head, 0)); }
// Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
void
splice(iterator __pos, slist& __x, iterator __i)
{ __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),
__slist_previous(&__x._M_head, __i._M_node),
__i._M_node); }
// Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
// and in distance(__first, __last).
void
splice(iterator __pos, slist& __x, iterator __first, iterator __last)
{
if (__first != __last)
__slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),
__slist_previous(&__x._M_head, __first._M_node),
__slist_previous(__first._M_node,
__last._M_node));
}
public:
void
reverse()
{
if (this->_M_head._M_next)
this->_M_head._M_next = __slist_reverse(this->_M_head._M_next);
}
void
remove(const _Tp& __val);
void
unique();
void
merge(slist& __x);
void
sort();
template <class _Predicate>
void
remove_if(_Predicate __pred);
template <class _BinaryPredicate>
void
unique(_BinaryPredicate __pred);
template <class _StrictWeakOrdering>
void
merge(slist&, _StrictWeakOrdering);
template <class _StrictWeakOrdering>
void
sort(_StrictWeakOrdering __comp);
};
template <class _Tp, class _Alloc>
slist<_Tp, _Alloc>&
slist<_Tp, _Alloc>::operator=(const slist<_Tp, _Alloc>& __x)
{
if (&__x != this)
{
_Node_base* __p1 = &this->_M_head;
_Node* __n1 = (_Node*) this->_M_head._M_next;
const _Node* __n2 = (const _Node*) __x._M_head._M_next;
while (__n1 && __n2)
{
__n1->_M_data = __n2->_M_data;
__p1 = __n1;
__n1 = (_Node*) __n1->_M_next;
__n2 = (const _Node*) __n2->_M_next;
}
if (__n2 == 0)
this->_M_erase_after(__p1, 0);
else
_M_insert_after_range(__p1, const_iterator((_Node*)__n2),
const_iterator(0));
}
return *this;
}
template <class _Tp, class _Alloc>
void
slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val)
{
_Node_base* __prev = &this->_M_head;
_Node* __node = (_Node*) this->_M_head._M_next;
for (; __node != 0 && __n > 0; --__n)
{
__node->_M_data = __val;
__prev = __node;
__node = (_Node*) __node->_M_next;
}
if (__n > 0)
_M_insert_after_fill(__prev, __n, __val);
else
this->_M_erase_after(__prev, 0);
}
template <class _Tp, class _Alloc>
template <class _InputIterator>
void
slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first,
_InputIterator __last,
__false_type)
{
_Node_base* __prev = &this->_M_head;
_Node* __node = (_Node*) this->_M_head._M_next;
while (__node != 0 && __first != __last)
{
__node->_M_data = *__first;
__prev = __node;
__node = (_Node*) __node->_M_next;
++__first;
}
if (__first != __last)
_M_insert_after_range(__prev, __first, __last);
else
this->_M_erase_after(__prev, 0);
}
template <class _Tp, class _Alloc>
inline bool
operator==(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
{
typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
const_iterator __end1 = _SL1.end();
const_iterator __end2 = _SL2.end();
const_iterator __i1 = _SL1.begin();
const_iterator __i2 = _SL2.begin();
while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
{
++__i1;
++__i2;
}
return __i1 == __end1 && __i2 == __end2;
}
template <class _Tp, class _Alloc>
inline bool
operator<(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
{ return std::lexicographical_compare(_SL1.begin(), _SL1.end(),
_SL2.begin(), _SL2.end()); }
template <class _Tp, class _Alloc>
inline bool
operator!=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
{ return !(_SL1 == _SL2); }
template <class _Tp, class _Alloc>
inline bool
operator>(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
{ return _SL2 < _SL1; }
template <class _Tp, class _Alloc>
inline bool
operator<=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
{ return !(_SL2 < _SL1); }
template <class _Tp, class _Alloc>
inline bool
operator>=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
{ return !(_SL1 < _SL2); }
template <class _Tp, class _Alloc>
inline void
swap(slist<_Tp, _Alloc>& __x, slist<_Tp, _Alloc>& __y)
{ __x.swap(__y); }
template <class _Tp, class _Alloc>
void
slist<_Tp, _Alloc>::resize(size_type __len, const _Tp& __x)
{
_Node_base* __cur = &this->_M_head;
while (__cur->_M_next != 0 && __len > 0)
{
--__len;
__cur = __cur->_M_next;
}
if (__cur->_M_next)
this->_M_erase_after(__cur, 0);
else
_M_insert_after_fill(__cur, __len, __x);
}
template <class _Tp, class _Alloc>
void
slist<_Tp, _Alloc>::remove(const _Tp& __val)
{
_Node_base* __cur = &this->_M_head;
while (__cur && __cur->_M_next)
{
if (((_Node*) __cur->_M_next)->_M_data == __val)
this->_M_erase_after(__cur);
else
__cur = __cur->_M_next;
}
}
template <class _Tp, class _Alloc>
void
slist<_Tp, _Alloc>::unique()
{
_Node_base* __cur = this->_M_head._M_next;
if (__cur)
{
while (__cur->_M_next)
{
if (((_Node*)__cur)->_M_data
== ((_Node*)(__cur->_M_next))->_M_data)
this->_M_erase_after(__cur);
else
__cur = __cur->_M_next;
}
}
}
template <class _Tp, class _Alloc>
void
slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x)
{
_Node_base* __n1 = &this->_M_head;
while (__n1->_M_next && __x._M_head._M_next)
{
if (((_Node*) __x._M_head._M_next)->_M_data
< ((_Node*) __n1->_M_next)->_M_data)
__slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
__n1 = __n1->_M_next;
}
if (__x._M_head._M_next)
{
__n1->_M_next = __x._M_head._M_next;
__x._M_head._M_next = 0;
}
}
template <class _Tp, class _Alloc>
void
slist<_Tp, _Alloc>::sort()
{
if (this->_M_head._M_next && this->_M_head._M_next->_M_next)
{
slist __carry;
slist __counter[64];
int __fill = 0;
while (!empty())
{
__slist_splice_after(&__carry._M_head,
&this->_M_head, this->_M_head._M_next);
int __i = 0;
while (__i < __fill && !__counter[__i].empty())
{
__counter[__i].merge(__carry);
__carry.swap(__counter[__i]);
++__i;
}
__carry.swap(__counter[__i]);
if (__i == __fill)
++__fill;
}
for (int __i = 1; __i < __fill; ++__i)
__counter[__i].merge(__counter[__i-1]);
this->swap(__counter[__fill-1]);
}
}
template <class _Tp, class _Alloc>
template <class _Predicate>
void slist<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
_Node_base* __cur = &this->_M_head;
while (__cur->_M_next)
{
if (__pred(((_Node*) __cur->_M_next)->_M_data))
this->_M_erase_after(__cur);
else
__cur = __cur->_M_next;
}
}
template <class _Tp, class _Alloc>
template <class _BinaryPredicate>
void
slist<_Tp, _Alloc>::unique(_BinaryPredicate __pred)
{
_Node* __cur = (_Node*) this->_M_head._M_next;
if (__cur)
{
while (__cur->_M_next)
{
if (__pred(((_Node*)__cur)->_M_data,
((_Node*)(__cur->_M_next))->_M_data))
this->_M_erase_after(__cur);
else
__cur = (_Node*) __cur->_M_next;
}
}
}
template <class _Tp, class _Alloc>
template <class _StrictWeakOrdering>
void
slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x,
_StrictWeakOrdering __comp)
{
_Node_base* __n1 = &this->_M_head;
while (__n1->_M_next && __x._M_head._M_next)
{
if (__comp(((_Node*) __x._M_head._M_next)->_M_data,
((_Node*) __n1->_M_next)->_M_data))
__slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
__n1 = __n1->_M_next;
}
if (__x._M_head._M_next)
{
__n1->_M_next = __x._M_head._M_next;
__x._M_head._M_next = 0;
}
}
template <class _Tp, class _Alloc>
template <class _StrictWeakOrdering>
void
slist<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp)
{
if (this->_M_head._M_next && this->_M_head._M_next->_M_next)
{
slist __carry;
slist __counter[64];
int __fill = 0;
while (!empty())
{
__slist_splice_after(&__carry._M_head,
&this->_M_head, this->_M_head._M_next);
int __i = 0;
while (__i < __fill && !__counter[__i].empty())
{
__counter[__i].merge(__carry, __comp);
__carry.swap(__counter[__i]);
++__i;
}
__carry.swap(__counter[__i]);
if (__i == __fill)
++__fill;
}
for (int __i = 1; __i < __fill; ++__i)
__counter[__i].merge(__counter[__i-1], __comp);
this->swap(__counter[__fill-1]);
}
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Specialization of insert_iterator so that insertions will be constant
// time rather than linear time.
template <class _Tp, class _Alloc>
class insert_iterator<__gnu_cxx::slist<_Tp, _Alloc> >
{
protected:
typedef __gnu_cxx::slist<_Tp, _Alloc> _Container;
_Container* container;
typename _Container::iterator iter;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x)
{
if (__i == __x.begin())
iter = __x.before_begin();
else
iter = __x.previous(__i);
}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
iter = container->insert_after(iter, __value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// array allocator -*- C++ -*-
// Copyright (C) 2004-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/array_allocator.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _ARRAY_ALLOCATOR_H
#define _ARRAY_ALLOCATOR_H 1
#include <bits/c++config.h>
#include <new>
#include <bits/functexcept.h>
#include <tr1/array>
#include <bits/move.h>
#if __cplusplus >= 201103L
#include <type_traits>
#endif
// Suppress deprecated warning for this file.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/// Base class.
template<typename _Tp>
class array_allocator_base
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
pointer
address(reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
const_pointer
address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
void
deallocate(pointer, size_type)
{
// Does nothing.
}
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
{ return size_t(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
void
construct(_Up* __p, _Args&&... __args)
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
template<typename _Up>
void
destroy(_Up* __p) { __p->~_Up(); }
#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) value_type(__val); }
void
destroy(pointer __p) { __p->~_Tp(); }
#endif
} _GLIBCXX_DEPRECATED;
/**
* @brief An allocator that uses previously allocated memory.
* This memory can be externally, globally, or otherwise allocated.
* @ingroup allocators
*/
template<typename _Tp, typename _Array = std::tr1::array<_Tp, 1> >
class array_allocator : public array_allocator_base<_Tp>
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
typedef _Array array_type;
#if __cplusplus >= 201103L
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2103. std::allocator propagate_on_container_move_assignment
typedef std::true_type propagate_on_container_move_assignment;
typedef std::true_type is_always_equal;
#endif
private:
array_type* _M_array;
size_type _M_used;
public:
template<typename _Tp1, typename _Array1 = _Array>
struct rebind
{
typedef array_allocator<_Tp1, _Array1> other _GLIBCXX_DEPRECATED;
} _GLIBCXX_DEPRECATED;
array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT
: _M_array(__array), _M_used(size_type()) { }
array_allocator(const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT
: _M_array(__o._M_array), _M_used(__o._M_used) { }
template<typename _Tp1, typename _Array1>
array_allocator(const array_allocator<_Tp1, _Array1>&)
_GLIBCXX_USE_NOEXCEPT
: _M_array(0), _M_used(size_type()) { }
~array_allocator() _GLIBCXX_USE_NOEXCEPT { }
pointer
allocate(size_type __n, const void* = 0)
{
if (_M_array == 0 || _M_used + __n > _M_array->size())
std::__throw_bad_alloc();
pointer __ret = _M_array->begin() + _M_used;
_M_used += __n;
return __ret;
}
} _GLIBCXX_DEPRECATED;
template<typename _Tp, typename _Array>
inline bool
operator==(const array_allocator<_Tp, _Array>&,
const array_allocator<_Tp, _Array>&)
{ return true; }
template<typename _Tp, typename _Array>
inline bool
operator!=(const array_allocator<_Tp, _Array>&,
const array_allocator<_Tp, _Array>&)
{ return false; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#pragma GCC diagnostic pop
#endif
// HP/SGI iterator extensions -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996-1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ext/iterator
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _EXT_ITERATOR
#define _EXT_ITERATOR 1
#pragma GCC system_header
#include <bits/concept_check.h>
#include <iterator>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// There are two signatures for distance. In addition to the one
// taking two iterators and returning a result, there is another
// taking two iterators and a reference-to-result variable, and
// returning nothing. The latter seems to be an SGI extension.
// -- pedwards
template<typename _InputIterator, typename _Distance>
inline void
__distance(_InputIterator __first, _InputIterator __last,
_Distance& __n, std::input_iterator_tag)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
while (__first != __last)
{
++__first;
++__n;
}
}
template<typename _RandomAccessIterator, typename _Distance>
inline void
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Distance& __n, std::random_access_iterator_tag)
{
// concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__n += __last - __first;
}
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<typename _InputIterator, typename _Distance>
inline void
distance(_InputIterator __first, _InputIterator __last,
_Distance& __n)
{
// concept requirements -- taken care of in __distance
__distance(__first, __last, __n, std::__iterator_category(__first));
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Versatile string -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/vstring.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _VSTRING_H
#define _VSTRING_H 1
#pragma GCC system_header
#if __cplusplus >= 201103L
#include <initializer_list>
#endif
#include <ext/vstring_util.h>
#include <ext/rc_string_base.h>
#include <ext/sso_string_base.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @class __versa_string vstring.h
* @brief Template class __versa_string.
* @ingroup extensions
*
* Data structure managing sequences of characters and
* character-like objects.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
class __versa_string
: private _Base<_CharT, _Traits, _Alloc>
{
typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
// Types:
public:
typedef _Traits traits_type;
typedef typename _Traits::char_type value_type;
typedef _Alloc allocator_type;
typedef typename _CharT_alloc_type::size_type size_type;
typedef typename _CharT_alloc_type::difference_type difference_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename _CharT_alloc_type::pointer pointer;
typedef typename _CharT_alloc_type::const_pointer const_pointer;
typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
const_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
// Data Member (public):
/// Value returned by various member functions when they fail.
static const size_type npos = static_cast<size_type>(-1);
private:
size_type
_M_check(size_type __pos, const char* __s) const
{
if (__pos > this->size())
std::__throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > "
"this->size() (which is %zu)"),
__s, __pos, this->size());
return __pos;
}
void
_M_check_length(size_type __n1, size_type __n2, const char* __s) const
{
if (this->max_size() - (this->size() - __n1) < __n2)
std::__throw_length_error(__N(__s));
}
// NB: _M_limit doesn't check for a bad __pos value.
size_type
_M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT
{
const bool __testoff = __off < this->size() - __pos;
return __testoff ? __off : this->size() - __pos;
}
// True if _Rep and source do not overlap.
bool
_M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT
{
return (std::less<const _CharT*>()(__s, this->_M_data())
|| std::less<const _CharT*>()(this->_M_data()
+ this->size(), __s));
}
// For the internal use we have functions similar to `begin'/`end'
// but they do not call _M_leak.
iterator
_M_ibegin() const _GLIBCXX_NOEXCEPT
{ return iterator(this->_M_data()); }
iterator
_M_iend() const _GLIBCXX_NOEXCEPT
{ return iterator(this->_M_data() + this->_M_length()); }
public:
// Construct/copy/destroy:
// NB: We overload ctors in some cases instead of using default
// arguments, per 17.4.4.4 para. 2 item 2.
/**
* @brief Construct an empty string using allocator @a a.
*/
explicit
__versa_string(const _Alloc& __a = _Alloc()) _GLIBCXX_NOEXCEPT
: __vstring_base(__a) { }
// NB: per LWG issue 42, semantics different from IS:
/**
* @brief Construct string with copy of value of @a __str.
* @param __str Source string.
*/
__versa_string(const __versa_string& __str)
: __vstring_base(__str) { }
#if __cplusplus >= 201103L
/**
* @brief String move constructor.
* @param __str Source string.
*
* The newly-constructed %string contains the exact contents of
* @a __str. The contents of @a __str are a valid, but unspecified
* string.
*/
__versa_string(__versa_string&& __str) noexcept
: __vstring_base(std::move(__str)) { }
/**
* @brief Construct string from an initializer list.
* @param __l std::initializer_list of characters.
* @param __a Allocator to use (default is default allocator).
*/
__versa_string(std::initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc())
: __vstring_base(__l.begin(), __l.end(), __a) { }
#endif
/**
* @brief Construct string as copy of a substring.
* @param __str Source string.
* @param __pos Index of first character to copy from.
* @param __n Number of characters to copy (default remainder).
*/
__versa_string(const __versa_string& __str, size_type __pos,
size_type __n = npos)
: __vstring_base(__str._M_data()
+ __str._M_check(__pos,
"__versa_string::__versa_string"),
__str._M_data() + __str._M_limit(__pos, __n)
+ __pos, _Alloc()) { }
/**
* @brief Construct string as copy of a substring.
* @param __str Source string.
* @param __pos Index of first character to copy from.
* @param __n Number of characters to copy.
* @param __a Allocator to use.
*/
__versa_string(const __versa_string& __str, size_type __pos,
size_type __n, const _Alloc& __a)
: __vstring_base(__str._M_data()
+ __str._M_check(__pos,
"__versa_string::__versa_string"),
__str._M_data() + __str._M_limit(__pos, __n)
+ __pos, __a) { }
/**
* @brief Construct string initialized by a character array.
* @param __s Source character array.
* @param __n Number of characters to copy.
* @param __a Allocator to use (default is default allocator).
*
* NB: @a __s must have at least @a __n characters, '\\0' has no special
* meaning.
*/
__versa_string(const _CharT* __s, size_type __n,
const _Alloc& __a = _Alloc())
: __vstring_base(__s, __s + __n, __a) { }
/**
* @brief Construct string as copy of a C string.
* @param __s Source C string.
* @param __a Allocator to use (default is default allocator).
*/
__versa_string(const _CharT* __s, const _Alloc& __a = _Alloc())
: __vstring_base(__s, __s ? __s + traits_type::length(__s) :
__s + npos, __a) { }
/**
* @brief Construct string as multiple characters.
* @param __n Number of characters.
* @param __c Character to use.
* @param __a Allocator to use (default is default allocator).
*/
__versa_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
: __vstring_base(__n, __c, __a) { }
/**
* @brief Construct string as copy of a range.
* @param __beg Start of range.
* @param __end End of range.
* @param __a Allocator to use (default is default allocator).
*/
#if __cplusplus >= 201103L
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator>
#endif
__versa_string(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a = _Alloc())
: __vstring_base(__beg, __end, __a) { }
/**
* @brief Destroy the string instance.
*/
~__versa_string() _GLIBCXX_NOEXCEPT { }
/**
* @brief Assign the value of @a str to this string.
* @param __str Source string.
*/
__versa_string&
operator=(const __versa_string& __str)
{ return this->assign(__str); }
#if __cplusplus >= 201103L
/**
* @brief String move assignment operator.
* @param __str Source string.
*
* The contents of @a __str are moved into this string (without
* copying). @a __str is a valid, but unspecified string.
*/
__versa_string&
operator=(__versa_string&& __str) noexcept
{
// NB: DR 1204.
this->swap(__str);
return *this;
}
/**
* @brief Set value to string constructed from initializer list.
* @param __l std::initializer_list.
*/
__versa_string&
operator=(std::initializer_list<_CharT> __l)
{
this->assign(__l.begin(), __l.end());
return *this;
}
#endif
/**
* @brief Copy contents of @a __s into this string.
* @param __s Source null-terminated string.
*/
__versa_string&
operator=(const _CharT* __s)
{ return this->assign(__s); }
/**
* @brief Set value to string of length 1.
* @param __c Source character.
*
* Assigning to a character makes this string length 1 and
* (*this)[0] == @a __c.
*/
__versa_string&
operator=(_CharT __c)
{
this->assign(1, __c);
return *this;
}
// Iterators:
/**
* Returns a read/write iterator that points to the first character in
* the %string. Unshares the string.
*/
iterator
begin() _GLIBCXX_NOEXCEPT
{
this->_M_leak();
return iterator(this->_M_data());
}
/**
* Returns a read-only (constant) iterator that points to the first
* character in the %string.
*/
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(this->_M_data()); }
/**
* Returns a read/write iterator that points one past the last
* character in the %string. Unshares the string.
*/
iterator
end() _GLIBCXX_NOEXCEPT
{
this->_M_leak();
return iterator(this->_M_data() + this->size());
}
/**
* Returns a read-only (constant) iterator that points one past the
* last character in the %string.
*/
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(this->_M_data() + this->size()); }
/**
* Returns a read/write reverse iterator that points to the last
* character in the %string. Iteration is done in reverse element
* order. Unshares the string.
*/
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->end()); }
/**
* Returns a read-only (constant) reverse iterator that points
* to the last character in the %string. Iteration is done in
* reverse element order.
*/
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->end()); }
/**
* Returns a read/write reverse iterator that points to one before the
* first character in the %string. Iteration is done in reverse
* element order. Unshares the string.
*/
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->begin()); }
/**
* Returns a read-only (constant) reverse iterator that points
* to one before the first character in the %string. Iteration
* is done in reverse element order.
*/
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->begin()); }
#if __cplusplus >= 201103L
/**
* Returns a read-only (constant) iterator that points to the first
* character in the %string.
*/
const_iterator
cbegin() const noexcept
{ return const_iterator(this->_M_data()); }
/**
* Returns a read-only (constant) iterator that points one past the
* last character in the %string.
*/
const_iterator
cend() const noexcept
{ return const_iterator(this->_M_data() + this->size()); }
/**
* Returns a read-only (constant) reverse iterator that points
* to the last character in the %string. Iteration is done in
* reverse element order.
*/
const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
/**
* Returns a read-only (constant) reverse iterator that points
* to one before the first character in the %string. Iteration
* is done in reverse element order.
*/
const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(this->begin()); }
#endif
public:
// Capacity:
/// Returns the number of characters in the string, not including any
/// null-termination.
size_type
size() const _GLIBCXX_NOEXCEPT
{ return this->_M_length(); }
/// Returns the number of characters in the string, not including any
/// null-termination.
size_type
length() const _GLIBCXX_NOEXCEPT
{ return this->_M_length(); }
/// Returns the size() of the largest possible %string.
size_type
max_size() const _GLIBCXX_NOEXCEPT
{ return this->_M_max_size(); }
/**
* @brief Resizes the %string to the specified number of characters.
* @param __n Number of characters the %string should contain.
* @param __c Character to fill any new elements.
*
* This function will %resize the %string to the specified
* number of characters. If the number is smaller than the
* %string's current size the %string is truncated, otherwise
* the %string is extended and new elements are set to @a __c.
*/
void
resize(size_type __n, _CharT __c);
/**
* @brief Resizes the %string to the specified number of characters.
* @param __n Number of characters the %string should contain.
*
* This function will resize the %string to the specified
* length. If the new size is smaller than the %string's
* current size the %string is truncated, otherwise the %string
* is extended and new characters are default-constructed. For
* basic types such as char, this means setting them to 0.
*/
void
resize(size_type __n)
{ this->resize(__n, _CharT()); }
#if __cplusplus >= 201103L
/// A non-binding request to reduce capacity() to size().
void
shrink_to_fit() noexcept
{
if (capacity() > size())
{
__try
{ this->reserve(0); }
__catch(...)
{ }
}
}
#endif
/**
* Returns the total number of characters that the %string can
* hold before needing to allocate more memory.
*/
size_type
capacity() const _GLIBCXX_NOEXCEPT
{ return this->_M_capacity(); }
/**
* @brief Attempt to preallocate enough memory for specified number of
* characters.
* @param __res_arg Number of characters required.
* @throw std::length_error If @a __res_arg exceeds @c max_size().
*
* This function attempts to reserve enough memory for the
* %string to hold the specified number of characters. If the
* number requested is more than max_size(), length_error is
* thrown.
*
* The advantage of this function is that if optimal code is a
* necessity and the user can determine the string length that
* will be required, the user can reserve the memory in
* %advance, and thus prevent a possible reallocation of memory
* and copying of %string data.
*/
void
reserve(size_type __res_arg = 0)
{ this->_M_reserve(__res_arg); }
/**
* Erases the string, making it empty.
*/
void
clear() _GLIBCXX_NOEXCEPT
{ this->_M_clear(); }
/**
* Returns true if the %string is empty. Equivalent to
* <code>*this == ""</code>.
*/
bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
// Element access:
/**
* @brief Subscript access to the data contained in the %string.
* @param __pos The index of the character to access.
* @return Read-only (constant) reference to the character.
*
* This operator allows for easy, array-style, data access.
* Note that data access with this operator is unchecked and
* out_of_range lookups are not defined. (For checked lookups
* see at().)
*/
const_reference
operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
{
__glibcxx_assert(__pos <= this->size());
return this->_M_data()[__pos];
}
/**
* @brief Subscript access to the data contained in the %string.
* @param __pos The index of the character to access.
* @return Read/write reference to the character.
*
* This operator allows for easy, array-style, data access.
* Note that data access with this operator is unchecked and
* out_of_range lookups are not defined. (For checked lookups
* see at().) Unshares the string.
*/
reference
operator[](size_type __pos) _GLIBCXX_NOEXCEPT
{
// Allow pos == size() both in C++98 mode, as v3 extension,
// and in C++11 mode.
__glibcxx_assert(__pos <= this->size());
// In pedantic mode be strict in C++98 mode.
_GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L
|| __pos < this->size());
this->_M_leak();
return this->_M_data()[__pos];
}
/**
* @brief Provides access to the data contained in the %string.
* @param __n The index of the character to access.
* @return Read-only (const) reference to the character.
* @throw std::out_of_range If @a __n is an invalid index.
*
* This function provides for safer data access. The parameter
* is first checked that it is in the range of the string. The
* function throws out_of_range if the check fails.
*/
const_reference
at(size_type __n) const
{
if (__n >= this->size())
std::__throw_out_of_range_fmt(__N("__versa_string::at: __n "
"(which is %zu) >= this->size() "
"(which is %zu)"),
__n, this->size());
return this->_M_data()[__n];
}
/**
* @brief Provides access to the data contained in the %string.
* @param __n The index of the character to access.
* @return Read/write reference to the character.
* @throw std::out_of_range If @a __n is an invalid index.
*
* This function provides for safer data access. The parameter
* is first checked that it is in the range of the string. The
* function throws out_of_range if the check fails. Success
* results in unsharing the string.
*/
reference
at(size_type __n)
{
if (__n >= this->size())
std::__throw_out_of_range_fmt(__N("__versa_string::at: __n "
"(which is %zu) >= this->size() "
"(which is %zu)"),
__n, this->size());
this->_M_leak();
return this->_M_data()[__n];
}
#if __cplusplus >= 201103L
/**
* Returns a read/write reference to the data at the first
* element of the %string.
*/
reference
front() noexcept
{ return operator[](0); }
/**
* Returns a read-only (constant) reference to the data at the first
* element of the %string.
*/
const_reference
front() const noexcept
{ return operator[](0); }
/**
* Returns a read/write reference to the data at the last
* element of the %string.
*/
reference
back() noexcept
{ return operator[](this->size() - 1); }
/**
* Returns a read-only (constant) reference to the data at the
* last element of the %string.
*/
const_reference
back() const noexcept
{ return operator[](this->size() - 1); }
#endif
// Modifiers:
/**
* @brief Append a string to this string.
* @param __str The string to append.
* @return Reference to this string.
*/
__versa_string&
operator+=(const __versa_string& __str)
{ return this->append(__str); }
/**
* @brief Append a C string.
* @param __s The C string to append.
* @return Reference to this string.
*/
__versa_string&
operator+=(const _CharT* __s)
{ return this->append(__s); }
/**
* @brief Append a character.
* @param __c The character to append.
* @return Reference to this string.
*/
__versa_string&
operator+=(_CharT __c)
{
this->push_back(__c);
return *this;
}
#if __cplusplus >= 201103L
/**
* @brief Append an initializer_list of characters.
* @param __l The initializer_list of characters to be appended.
* @return Reference to this string.
*/
__versa_string&
operator+=(std::initializer_list<_CharT> __l)
{ return this->append(__l.begin(), __l.end()); }
#endif // C++11
/**
* @brief Append a string to this string.
* @param __str The string to append.
* @return Reference to this string.
*/
__versa_string&
append(const __versa_string& __str)
{ return _M_append(__str._M_data(), __str.size()); }
/**
* @brief Append a substring.
* @param __str The string to append.
* @param __pos Index of the first character of str to append.
* @param __n The number of characters to append.
* @return Reference to this string.
* @throw std::out_of_range if @a pos is not a valid index.
*
* This function appends @a __n characters from @a __str
* starting at @a __pos to this string. If @a __n is is larger
* than the number of available characters in @a __str, the
* remainder of @a __str is appended.
*/
__versa_string&
append(const __versa_string& __str, size_type __pos, size_type __n)
{ return _M_append(__str._M_data()
+ __str._M_check(__pos, "__versa_string::append"),
__str._M_limit(__pos, __n)); }
/**
* @brief Append a C substring.
* @param __s The C string to append.
* @param __n The number of characters to append.
* @return Reference to this string.
*/
__versa_string&
append(const _CharT* __s, size_type __n)
{
__glibcxx_requires_string_len(__s, __n);
_M_check_length(size_type(0), __n, "__versa_string::append");
return _M_append(__s, __n);
}
/**
* @brief Append a C string.
* @param __s The C string to append.
* @return Reference to this string.
*/
__versa_string&
append(const _CharT* __s)
{
__glibcxx_requires_string(__s);
const size_type __n = traits_type::length(__s);
_M_check_length(size_type(0), __n, "__versa_string::append");
return _M_append(__s, __n);
}
/**
* @brief Append multiple characters.
* @param __n The number of characters to append.
* @param __c The character to use.
* @return Reference to this string.
*
* Appends n copies of c to this string.
*/
__versa_string&
append(size_type __n, _CharT __c)
{ return _M_replace_aux(this->size(), size_type(0), __n, __c); }
#if __cplusplus >= 201103L
/**
* @brief Append an initializer_list of characters.
* @param __l The initializer_list of characters to append.
* @return Reference to this string.
*/
__versa_string&
append(std::initializer_list<_CharT> __l)
{ return this->append(__l.begin(), __l.end()); }
#endif // C++11
/**
* @brief Append a range of characters.
* @param __first Iterator referencing the first character to append.
* @param __last Iterator marking the end of the range.
* @return Reference to this string.
*
* Appends characters in the range [first,last) to this string.
*/
#if __cplusplus >= 201103L
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator>
#endif
__versa_string&
append(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_iend(), _M_iend(), __first, __last); }
/**
* @brief Append a single character.
* @param __c Character to append.
*/
void
push_back(_CharT __c)
{
const size_type __size = this->size();
if (__size + 1 > this->capacity() || this->_M_is_shared())
this->_M_mutate(__size, size_type(0), 0, size_type(1));
traits_type::assign(this->_M_data()[__size], __c);
this->_M_set_length(__size + 1);
}
/**
* @brief Set value to contents of another string.
* @param __str Source string to use.
* @return Reference to this string.
*/
__versa_string&
assign(const __versa_string& __str)
{
this->_M_assign(__str);
return *this;
}
#if __cplusplus >= 201103L
/**
* @brief Set value to contents of another string.
* @param __str Source string to use.
* @return Reference to this string.
*
* This function sets this string to the exact contents of @a __str.
* @a __str is a valid, but unspecified string.
*/
__versa_string&
assign(__versa_string&& __str) noexcept
{
this->swap(__str);
return *this;
}
#endif // C++11
/**
* @brief Set value to a substring of a string.
* @param __str The string to use.
* @param __pos Index of the first character of str.
* @param __n Number of characters to use.
* @return Reference to this string.
* @throw std::out_of_range if @a __pos is not a valid index.
*
* This function sets this string to the substring of @a __str
* consisting of @a __n characters at @a __pos. If @a __n is
* is larger than the number of available characters in @a
* __str, the remainder of @a __str is used.
*/
__versa_string&
assign(const __versa_string& __str, size_type __pos, size_type __n)
{ return _M_replace(size_type(0), this->size(), __str._M_data()
+ __str._M_check(__pos, "__versa_string::assign"),
__str._M_limit(__pos, __n)); }
/**
* @brief Set value to a C substring.
* @param __s The C string to use.
* @param __n Number of characters to use.
* @return Reference to this string.
*
* This function sets the value of this string to the first @a
* __n characters of @a __s. If @a __n is is larger than the
* number of available characters in @a __s, the remainder of
* @a __s is used.
*/
__versa_string&
assign(const _CharT* __s, size_type __n)
{
__glibcxx_requires_string_len(__s, __n);
return _M_replace(size_type(0), this->size(), __s, __n);
}
/**
* @brief Set value to contents of a C string.
* @param __s The C string to use.
* @return Reference to this string.
*
* This function sets the value of this string to the value of
* @a __s. The data is copied, so there is no dependence on @a
* __s once the function returns.
*/
__versa_string&
assign(const _CharT* __s)
{
__glibcxx_requires_string(__s);
return _M_replace(size_type(0), this->size(), __s,
traits_type::length(__s));
}
/**
* @brief Set value to multiple characters.
* @param __n Length of the resulting string.
* @param __c The character to use.
* @return Reference to this string.
*
* This function sets the value of this string to @a __n copies of
* character @a __c.
*/
__versa_string&
assign(size_type __n, _CharT __c)
{ return _M_replace_aux(size_type(0), this->size(), __n, __c); }
/**
* @brief Set value to a range of characters.
* @param __first Iterator referencing the first character to append.
* @param __last Iterator marking the end of the range.
* @return Reference to this string.
*
* Sets value of string to characters in the range
* [first,last).
*/
#if __cplusplus >= 201103L
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator>
#endif
__versa_string&
assign(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
#if __cplusplus >= 201103L
/**
* @brief Set value to an initializer_list of characters.
* @param __l The initializer_list of characters to assign.
* @return Reference to this string.
*/
__versa_string&
assign(std::initializer_list<_CharT> __l)
{ return this->assign(__l.begin(), __l.end()); }
#endif // C++11
#if __cplusplus >= 201103L
/**
* @brief Insert multiple characters.
* @param __p Const_iterator referencing location in string to
* insert at.
* @param __n Number of characters to insert
* @param __c The character to insert.
* @return Iterator referencing the first inserted char.
* @throw std::length_error If new length exceeds @c max_size().
*
* Inserts @a __n copies of character @a __c starting at the
* position referenced by iterator @a __p. If adding
* characters causes the length to exceed max_size(),
* length_error is thrown. The value of the string doesn't
* change if an error is thrown.
*/
iterator
insert(const_iterator __p, size_type __n, _CharT __c)
{
_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
const size_type __pos = __p - _M_ibegin();
this->replace(__p, __p, __n, __c);
return iterator(this->_M_data() + __pos);
}
#else
/**
* @brief Insert multiple characters.
* @param __p Iterator referencing location in string to insert at.
* @param __n Number of characters to insert
* @param __c The character to insert.
* @throw std::length_error If new length exceeds @c max_size().
*
* Inserts @a __n copies of character @a __c starting at the
* position referenced by iterator @a __p. If adding
* characters causes the length to exceed max_size(),
* length_error is thrown. The value of the string doesn't
* change if an error is thrown.
*/
void
insert(iterator __p, size_type __n, _CharT __c)
{ this->replace(__p, __p, __n, __c); }
#endif
#if __cplusplus >= 201103L
/**
* @brief Insert a range of characters.
* @param __p Const_iterator referencing location in string to
* insert at.
* @param __beg Start of range.
* @param __end End of range.
* @return Iterator referencing the first inserted char.
* @throw std::length_error If new length exceeds @c max_size().
*
* Inserts characters in range [beg,end). If adding characters
* causes the length to exceed max_size(), length_error is
* thrown. The value of the string doesn't change if an error
* is thrown.
*/
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
iterator
insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
{
_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
const size_type __pos = __p - _M_ibegin();
this->replace(__p, __p, __beg, __end);
return iterator(this->_M_data() + __pos);
}
#else
/**
* @brief Insert a range of characters.
* @param __p Iterator referencing location in string to insert at.
* @param __beg Start of range.
* @param __end End of range.
* @throw std::length_error If new length exceeds @c max_size().
*
* Inserts characters in range [beg,end). If adding characters
* causes the length to exceed max_size(), length_error is
* thrown. The value of the string doesn't change if an error
* is thrown.
*/
template<class _InputIterator>
void
insert(iterator __p, _InputIterator __beg, _InputIterator __end)
{ this->replace(__p, __p, __beg, __end); }
#endif
#if __cplusplus >= 201103L
/**
* @brief Insert an initializer_list of characters.
* @param __p Const_iterator referencing location in string to
* insert at.
* @param __l The initializer_list of characters to insert.
* @return Iterator referencing the first inserted char.
* @throw std::length_error If new length exceeds @c max_size().
*/
iterator
insert(const_iterator __p, std::initializer_list<_CharT> __l)
{ return this->insert(__p, __l.begin(), __l.end()); }
#endif // C++11
/**
* @brief Insert value of a string.
* @param __pos1 Iterator referencing location in string to insert at.
* @param __str The string to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Inserts value of @a __str starting at @a __pos1. If adding
* characters causes the length to exceed max_size(),
* length_error is thrown. The value of the string doesn't
* change if an error is thrown.
*/
__versa_string&
insert(size_type __pos1, const __versa_string& __str)
{ return this->replace(__pos1, size_type(0),
__str._M_data(), __str.size()); }
/**
* @brief Insert a substring.
* @param __pos1 Iterator referencing location in string to insert at.
* @param __str The string to insert.
* @param __pos2 Start of characters in str to insert.
* @param __n Number of characters to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
* @throw std::out_of_range If @a __pos1 > size() or
* @a __pos2 > @a __str.size().
*
* Starting at @a __pos1, insert @a __n character of @a __str
* beginning with @a __pos2. If adding characters causes the
* length to exceed max_size(), length_error is thrown. If @a
* __pos1 is beyond the end of this string or @a __pos2 is
* beyond the end of @a __str, out_of_range is thrown. The
* value of the string doesn't change if an error is thrown.
*/
__versa_string&
insert(size_type __pos1, const __versa_string& __str,
size_type __pos2, size_type __n)
{ return this->replace(__pos1, size_type(0), __str._M_data()
+ __str._M_check(__pos2, "__versa_string::insert"),
__str._M_limit(__pos2, __n)); }
/**
* @brief Insert a C substring.
* @param __pos Iterator referencing location in string to insert at.
* @param __s The C string to insert.
* @param __n The number of characters to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
* @throw std::out_of_range If @a __pos is beyond the end of this
* string.
*
* Inserts the first @a __n characters of @a __s starting at @a
* __pos. If adding characters causes the length to exceed
* max_size(), length_error is thrown. If @a __pos is beyond
* end(), out_of_range is thrown. The value of the string
* doesn't change if an error is thrown.
*/
__versa_string&
insert(size_type __pos, const _CharT* __s, size_type __n)
{ return this->replace(__pos, size_type(0), __s, __n); }
/**
* @brief Insert a C string.
* @param __pos Iterator referencing location in string to insert at.
* @param __s The C string to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
* @throw std::out_of_range If @a __pos is beyond the end of this
* string.
*
* Inserts the first @a __n characters of @a __s starting at @a
* __pos. If adding characters causes the length to exceed
* max_size(), length_error is thrown. If @a __pos is beyond
* end(), out_of_range is thrown. The value of the string
* doesn't change if an error is thrown.
*/
__versa_string&
insert(size_type __pos, const _CharT* __s)
{
__glibcxx_requires_string(__s);
return this->replace(__pos, size_type(0), __s,
traits_type::length(__s));
}
/**
* @brief Insert multiple characters.
* @param __pos Index in string to insert at.
* @param __n Number of characters to insert
* @param __c The character to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
* @throw std::out_of_range If @a __pos is beyond the end of this
* string.
*
* Inserts @a __n copies of character @a __c starting at index
* @a __pos. If adding characters causes the length to exceed
* max_size(), length_error is thrown. If @a __pos > length(),
* out_of_range is thrown. The value of the string doesn't
* change if an error is thrown.
*/
__versa_string&
insert(size_type __pos, size_type __n, _CharT __c)
{ return _M_replace_aux(_M_check(__pos, "__versa_string::insert"),
size_type(0), __n, __c); }
/**
* @brief Insert one character.
* @param __p Iterator referencing position in string to insert at.
* @param __c The character to insert.
* @return Iterator referencing newly inserted char.
* @throw std::length_error If new length exceeds @c max_size().
*
* Inserts character @a __c at position referenced by @a __p.
* If adding character causes the length to exceed max_size(),
* length_error is thrown. If @a __p is beyond end of string,
* out_of_range is thrown. The value of the string doesn't
* change if an error is thrown.
*/
iterator
#if __cplusplus >= 201103L
insert(const_iterator __p, _CharT __c)
#else
insert(iterator __p, _CharT __c)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
const size_type __pos = __p - _M_ibegin();
_M_replace_aux(__pos, size_type(0), size_type(1), __c);
this->_M_set_leaked();
return iterator(this->_M_data() + __pos);
}
/**
* @brief Remove characters.
* @param __pos Index of first character to remove (default 0).
* @param __n Number of characters to remove (default remainder).
* @return Reference to this string.
* @throw std::out_of_range If @a __pos is beyond the end of this
* string.
*
* Removes @a __n characters from this string starting at @a
* __pos. The length of the string is reduced by @a __n. If
* there are < @a __n characters to remove, the remainder of
* the string is truncated. If @a __p is beyond end of string,
* out_of_range is thrown. The value of the string doesn't
* change if an error is thrown.
*/
__versa_string&
erase(size_type __pos = 0, size_type __n = npos)
{
this->_M_erase(_M_check(__pos, "__versa_string::erase"),
_M_limit(__pos, __n));
return *this;
}
/**
* @brief Remove one character.
* @param __position Iterator referencing the character to remove.
* @return iterator referencing same location after removal.
*
* Removes the character at @a __position from this string. The
* value of the string doesn't change if an error is thrown.
*/
iterator
#if __cplusplus >= 201103L
erase(const_iterator __position)
#else
erase(iterator __position)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
&& __position < _M_iend());
const size_type __pos = __position - _M_ibegin();
this->_M_erase(__pos, size_type(1));
this->_M_set_leaked();
return iterator(this->_M_data() + __pos);
}
/**
* @brief Remove a range of characters.
* @param __first Iterator referencing the first character to remove.
* @param __last Iterator referencing the end of the range.
* @return Iterator referencing location of first after removal.
*
* Removes the characters in the range [first,last) from this
* string. The value of the string doesn't change if an error
* is thrown.
*/
iterator
#if __cplusplus >= 201103L
erase(const_iterator __first, const_iterator __last)
#else
erase(iterator __first, iterator __last)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
&& __last <= _M_iend());
const size_type __pos = __first - _M_ibegin();
this->_M_erase(__pos, __last - __first);
this->_M_set_leaked();
return iterator(this->_M_data() + __pos);
}
#if __cplusplus >= 201103L
/**
* @brief Remove the last character.
*
* The string must be non-empty.
*/
void
pop_back()
{ this->_M_erase(size()-1, 1); }
#endif // C++11
/**
* @brief Replace characters with value from another string.
* @param __pos Index of first character to replace.
* @param __n Number of characters to be replaced.
* @param __str String to insert.
* @return Reference to this string.
* @throw std::out_of_range If @a __pos is beyond the end of this
* string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [pos,pos+n) from this
* string. In place, the value of @a __str is inserted. If @a
* __pos is beyond end of string, out_of_range is thrown. If
* the length of the result exceeds max_size(), length_error is
* thrown. The value of the string doesn't change if an error
* is thrown.
*/
__versa_string&
replace(size_type __pos, size_type __n, const __versa_string& __str)
{ return this->replace(__pos, __n, __str._M_data(), __str.size()); }
/**
* @brief Replace characters with value from another string.
* @param __pos1 Index of first character to replace.
* @param __n1 Number of characters to be replaced.
* @param __str String to insert.
* @param __pos2 Index of first character of str to use.
* @param __n2 Number of characters from str to use.
* @return Reference to this string.
* @throw std::out_of_range If @a __pos1 > size() or @a __pos2 >
* str.size().
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [pos1,pos1 + n) from
* this string. In place, the value of @a __str is inserted.
* If @a __pos is beyond end of string, out_of_range is thrown.
* If the length of the result exceeds max_size(), length_error
* is thrown. The value of the string doesn't change if an
* error is thrown.
*/
__versa_string&
replace(size_type __pos1, size_type __n1, const __versa_string& __str,
size_type __pos2, size_type __n2)
{
return this->replace(__pos1, __n1, __str._M_data()
+ __str._M_check(__pos2,
"__versa_string::replace"),
__str._M_limit(__pos2, __n2));
}
/**
* @brief Replace characters with value of a C substring.
* @param __pos Index of first character to replace.
* @param __n1 Number of characters to be replaced.
* @param __s C string to insert.
* @param __n2 Number of characters from @a __s to use.
* @return Reference to this string.
* @throw std::out_of_range If @a __pos1 > size().
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [pos,pos + n1) from this
* string. In place, the first @a __n2 characters of @a __s
* are inserted, or all of @a __s if @a __n2 is too large. If
* @a __pos is beyond end of string, out_of_range is thrown.
* If the length of result exceeds max_size(), length_error is
* thrown. The value of the string doesn't change if an error
* is thrown.
*/
__versa_string&
replace(size_type __pos, size_type __n1, const _CharT* __s,
size_type __n2)
{
__glibcxx_requires_string_len(__s, __n2);
return _M_replace(_M_check(__pos, "__versa_string::replace"),
_M_limit(__pos, __n1), __s, __n2);
}
/**
* @brief Replace characters with value of a C string.
* @param __pos Index of first character to replace.
* @param __n1 Number of characters to be replaced.
* @param __s C string to insert.
* @return Reference to this string.
* @throw std::out_of_range If @a __pos > size().
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [pos,pos + n1) from this
* string. In place, the characters of @a __s are inserted. If
* @a pos is beyond end of string, out_of_range is thrown. If
* the length of result exceeds max_size(), length_error is thrown.
* The value of the string doesn't change if an error is thrown.
*/
__versa_string&
replace(size_type __pos, size_type __n1, const _CharT* __s)
{
__glibcxx_requires_string(__s);
return this->replace(__pos, __n1, __s, traits_type::length(__s));
}
/**
* @brief Replace characters with multiple characters.
* @param __pos Index of first character to replace.
* @param __n1 Number of characters to be replaced.
* @param __n2 Number of characters to insert.
* @param __c Character to insert.
* @return Reference to this string.
* @throw std::out_of_range If @a __pos > size().
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [pos,pos + n1) from this
* string. In place, @a __n2 copies of @a __c are inserted.
* If @a __pos is beyond end of string, out_of_range is thrown.
* If the length of result exceeds max_size(), length_error is
* thrown. The value of the string doesn't change if an error
* is thrown.
*/
__versa_string&
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
{ return _M_replace_aux(_M_check(__pos, "__versa_string::replace"),
_M_limit(__pos, __n1), __n2, __c); }
/**
* @brief Replace range of characters with string.
* @param __i1 Iterator referencing start of range to replace.
* @param __i2 Iterator referencing end of range to replace.
* @param __str String value to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [i1,i2). In place, the
* value of @a __str is inserted. If the length of result
* exceeds max_size(), length_error is thrown. The value of
* the string doesn't change if an error is thrown.
*/
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2,
const __versa_string& __str)
#else
replace(iterator __i1, iterator __i2, const __versa_string& __str)
#endif
{ return this->replace(__i1, __i2, __str._M_data(), __str.size()); }
/**
* @brief Replace range of characters with C substring.
* @param __i1 Iterator referencing start of range to replace.
* @param __i2 Iterator referencing end of range to replace.
* @param __s C string value to insert.
* @param __n Number of characters from s to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [i1,i2). In place, the
* first @a n characters of @a __s are inserted. If the length
* of result exceeds max_size(), length_error is thrown. The
* value of the string doesn't change if an error is thrown.
*/
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2,
const _CharT* __s, size_type __n)
#else
replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
}
/**
* @brief Replace range of characters with C string.
* @param __i1 Iterator referencing start of range to replace.
* @param __i2 Iterator referencing end of range to replace.
* @param __s C string value to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [i1,i2). In place, the
* characters of @a __s are inserted. If the length of result
* exceeds max_size(), length_error is thrown. The value of
* the string doesn't change if an error is thrown.
*/
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2, const _CharT* __s)
#else
replace(iterator __i1, iterator __i2, const _CharT* __s)
#endif
{
__glibcxx_requires_string(__s);
return this->replace(__i1, __i2, __s, traits_type::length(__s));
}
/**
* @brief Replace range of characters with multiple characters
* @param __i1 Iterator referencing start of range to replace.
* @param __i2 Iterator referencing end of range to replace.
* @param __n Number of characters to insert.
* @param __c Character to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [i1,i2). In place, @a
* __n copies of @a __c are inserted. If the length of result
* exceeds max_size(), length_error is thrown. The value of
* the string doesn't change if an error is thrown.
*/
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2, size_type __n,
_CharT __c)
#else
replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
}
/**
* @brief Replace range of characters with range.
* @param __i1 Iterator referencing start of range to replace.
* @param __i2 Iterator referencing end of range to replace.
* @param __k1 Iterator referencing start of range to insert.
* @param __k2 Iterator referencing end of range to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [i1,i2). In place,
* characters in the range [k1,k2) are inserted. If the length
* of result exceeds max_size(), length_error is thrown. The
* value of the string doesn't change if an error is thrown.
*/
#if __cplusplus >= 201103L
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
__versa_string&
replace(const_iterator __i1, const_iterator __i2,
_InputIterator __k1, _InputIterator __k2)
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
std::__false_type());
}
#else
template<class _InputIterator>
__versa_string&
replace(iterator __i1, iterator __i2,
_InputIterator __k1, _InputIterator __k2)
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
}
#endif
// Specializations for the common case of pointer and iterator:
// useful to avoid the overhead of temporary buffering in _M_replace.
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2,
_CharT* __k1, _CharT* __k2)
#else
replace(iterator __i1, iterator __i2,
_CharT* __k1, _CharT* __k2)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
__k1, __k2 - __k1);
}
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2,
const _CharT* __k1, const _CharT* __k2)
#else
replace(iterator __i1, iterator __i2,
const _CharT* __k1, const _CharT* __k2)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
__k1, __k2 - __k1);
}
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2,
iterator __k1, iterator __k2)
#else
replace(iterator __i1, iterator __i2,
iterator __k1, iterator __k2)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
__k1.base(), __k2 - __k1);
}
__versa_string&
#if __cplusplus >= 201103L
replace(const_iterator __i1, const_iterator __i2,
const_iterator __k1, const_iterator __k2)
#else
replace(iterator __i1, iterator __i2,
const_iterator __k1, const_iterator __k2)
#endif
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
__k1.base(), __k2 - __k1);
}
#if __cplusplus >= 201103L
/**
* @brief Replace range of characters with initializer_list.
* @param __i1 Iterator referencing start of range to replace.
* @param __i2 Iterator referencing end of range to replace.
* @param __l The initializer_list of characters to insert.
* @return Reference to this string.
* @throw std::length_error If new length exceeds @c max_size().
*
* Removes the characters in the range [i1,i2). In place,
* characters in the range [k1,k2) are inserted. If the length
* of result exceeds max_size(), length_error is thrown. The
* value of the string doesn't change if an error is thrown.
*/
__versa_string&
replace(const_iterator __i1, const_iterator __i2,
std::initializer_list<_CharT> __l)
{ return this->replace(__i1, __i2, __l.begin(), __l.end()); }
#endif // C++11
private:
template<class _Integer>
__versa_string&
_M_replace_dispatch(const_iterator __i1, const_iterator __i2,
_Integer __n, _Integer __val, std::__true_type)
{ return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
template<class _InputIterator>
__versa_string&
_M_replace_dispatch(const_iterator __i1, const_iterator __i2,
_InputIterator __k1, _InputIterator __k2,
std::__false_type);
__versa_string&
_M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
_CharT __c);
__versa_string&
_M_replace(size_type __pos, size_type __len1, const _CharT* __s,
const size_type __len2);
__versa_string&
_M_append(const _CharT* __s, size_type __n);
public:
/**
* @brief Copy substring into C string.
* @param __s C string to copy value into.
* @param __n Number of characters to copy.
* @param __pos Index of first character to copy.
* @return Number of characters actually copied
* @throw std::out_of_range If pos > size().
*
* Copies up to @a __n characters starting at @a __pos into the
* C string @a s. If @a __pos is greater than size(),
* out_of_range is thrown.
*/
size_type
copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
/**
* @brief Swap contents with another string.
* @param __s String to swap with.
*
* Exchanges the contents of this string with that of @a __s in
* constant time.
*/
void
swap(__versa_string& __s) _GLIBCXX_NOEXCEPT
{ this->_M_swap(__s); }
// String operations:
/**
* @brief Return const pointer to null-terminated contents.
*
* This is a handle to internal data. Do not modify or dire things may
* happen.
*/
const _CharT*
c_str() const _GLIBCXX_NOEXCEPT
{ return this->_M_data(); }
/**
* @brief Return const pointer to contents.
*
* This is a handle to internal data. Do not modify or dire things may
* happen.
*/
const _CharT*
data() const _GLIBCXX_NOEXCEPT
{ return this->_M_data(); }
/**
* @brief Return copy of allocator used to construct this string.
*/
allocator_type
get_allocator() const _GLIBCXX_NOEXCEPT
{ return allocator_type(this->_M_get_allocator()); }
/**
* @brief Find position of a C substring.
* @param __s C string to locate.
* @param __pos Index of character to search from.
* @param __n Number of characters from @a __s to search for.
* @return Index of start of first occurrence.
*
* Starting from @a __pos, searches forward for the first @a
* __n characters in @a __s within this string. If found,
* returns the index where it begins. If not found, returns
* npos.
*/
size_type
find(const _CharT* __s, size_type __pos, size_type __n) const;
/**
* @brief Find position of a string.
* @param __str String to locate.
* @param __pos Index of character to search from (default 0).
* @return Index of start of first occurrence.
*
* Starting from @a __pos, searches forward for value of @a
* __str within this string. If found, returns the index where
* it begins. If not found, returns npos.
*/
size_type
find(const __versa_string& __str, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
{ return this->find(__str.data(), __pos, __str.size()); }
/**
* @brief Find position of a C string.
* @param __s C string to locate.
* @param __pos Index of character to search from (default 0).
* @return Index of start of first occurrence.
*
* Starting from @a __pos, searches forward for the value of @a
* __s within this string. If found, returns the index where
* it begins. If not found, returns npos.
*/
size_type
find(const _CharT* __s, size_type __pos = 0) const
{
__glibcxx_requires_string(__s);
return this->find(__s, __pos, traits_type::length(__s));
}
/**
* @brief Find position of a character.
* @param __c Character to locate.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for @a __c within
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
size_type
find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
/**
* @brief Find last position of a string.
* @param __str String to locate.
* @param __pos Index of character to search back from (default end).
* @return Index of start of last occurrence.
*
* Starting from @a __pos, searches backward for value of @a
* __str within this string. If found, returns the index where
* it begins. If not found, returns npos.
*/
size_type
rfind(const __versa_string& __str, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
{ return this->rfind(__str.data(), __pos, __str.size()); }
/**
* @brief Find last position of a C substring.
* @param __s C string to locate.
* @param __pos Index of character to search back from.
* @param __n Number of characters from s to search for.
* @return Index of start of last occurrence.
*
* Starting from @a __pos, searches backward for the first @a
* __n characters in @a __s within this string. If found,
* returns the index where it begins. If not found, returns
* npos.
*/
size_type
rfind(const _CharT* __s, size_type __pos, size_type __n) const;
/**
* @brief Find last position of a C string.
* @param __s C string to locate.
* @param __pos Index of character to start search at (default end).
* @return Index of start of last occurrence.
*
* Starting from @a __pos, searches backward for the value of
* @a __s within this string. If found, returns the index
* where it begins. If not found, returns npos.
*/
size_type
rfind(const _CharT* __s, size_type __pos = npos) const
{
__glibcxx_requires_string(__s);
return this->rfind(__s, __pos, traits_type::length(__s));
}
/**
* @brief Find last position of a character.
* @param __c Character to locate.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for @a __c within
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
size_type
rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
/**
* @brief Find position of a character of string.
* @param __str String containing characters to locate.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for one of the characters of
* @a __str within this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
size_type
find_first_of(const __versa_string& __str, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
{ return this->find_first_of(__str.data(), __pos, __str.size()); }
/**
* @brief Find position of a character of C substring.
* @param __s String containing characters to locate.
* @param __pos Index of character to search from.
* @param __n Number of characters from s to search for.
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for one of the
* first @a __n characters of @a __s within this string. If
* found, returns the index where it was found. If not found,
* returns npos.
*/
size_type
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
/**
* @brief Find position of a character of C string.
* @param __s String containing characters to locate.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for one of the
* characters of @a __s within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
size_type
find_first_of(const _CharT* __s, size_type __pos = 0) const
{
__glibcxx_requires_string(__s);
return this->find_first_of(__s, __pos, traits_type::length(__s));
}
/**
* @brief Find position of a character.
* @param __c Character to locate.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for the character
* @a __c within this string. If found, returns the index
* where it was found. If not found, returns npos.
*
* Note: equivalent to find(c, pos).
*/
size_type
find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return this->find(__c, __pos); }
/**
* @brief Find last position of a character of string.
* @param __str String containing characters to locate.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for one of the
* characters of @a __str within this string. If found,
* returns the index where it was found. If not found, returns
* npos.
*/
size_type
find_last_of(const __versa_string& __str, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT
{ return this->find_last_of(__str.data(), __pos, __str.size()); }
/**
* @brief Find last position of a character of C substring.
* @param __s C string containing characters to locate.
* @param __pos Index of character to search back from.
* @param __n Number of characters from s to search for.
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for one of the
* first @a __n characters of @a __s within this string. If
* found, returns the index where it was found. If not found,
* returns npos.
*/
size_type
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
/**
* @brief Find last position of a character of C string.
* @param __s C string containing characters to locate.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for one of the
* characters of @a __s within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
size_type
find_last_of(const _CharT* __s, size_type __pos = npos) const
{
__glibcxx_requires_string(__s);
return this->find_last_of(__s, __pos, traits_type::length(__s));
}
/**
* @brief Find last position of a character.
* @param __c Character to locate.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for @a __c within
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*
* Note: equivalent to rfind(c, pos).
*/
size_type
find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT
{ return this->rfind(__c, __pos); }
/**
* @brief Find position of a character not in string.
* @param __str String containing characters to avoid.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for a character not
* contained in @a __str within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
size_type
find_first_not_of(const __versa_string& __str, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT
{ return this->find_first_not_of(__str.data(), __pos, __str.size()); }
/**
* @brief Find position of a character not in C substring.
* @param __s C string containing characters to avoid.
* @param __pos Index of character to search from.
* @param __n Number of characters from s to consider.
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for a character not
* contained in the first @a __n characters of @a __s within
* this string. If found, returns the index where it was
* found. If not found, returns npos.
*/
size_type
find_first_not_of(const _CharT* __s, size_type __pos,
size_type __n) const;
/**
* @brief Find position of a character not in C string.
* @param __s C string containing characters to avoid.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for a character not
* contained in @a __s within this string. If found, returns
* the index where it was found. If not found, returns npos.
*/
size_type
find_first_not_of(const _CharT* __s, size_type __pos = 0) const
{
__glibcxx_requires_string(__s);
return this->find_first_not_of(__s, __pos, traits_type::length(__s));
}
/**
* @brief Find position of a different character.
* @param __c Character to avoid.
* @param __pos Index of character to search from (default 0).
* @return Index of first occurrence.
*
* Starting from @a __pos, searches forward for a character
* other than @a __c within this string. If found, returns the
* index where it was found. If not found, returns npos.
*/
size_type
find_first_not_of(_CharT __c, size_type __pos = 0) const
_GLIBCXX_NOEXCEPT;
/**
* @brief Find last position of a character not in string.
* @param __str String containing characters to avoid.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for a character
* not contained in @a __str within this string. If found,
* returns the index where it was found. If not found, returns
* npos.
*/
size_type
find_last_not_of(const __versa_string& __str,
size_type __pos = npos) const _GLIBCXX_NOEXCEPT
{ return this->find_last_not_of(__str.data(), __pos, __str.size()); }
/**
* @brief Find last position of a character not in C substring.
* @param __s C string containing characters to avoid.
* @param __pos Index of character to search back from.
* @param __n Number of characters from s to consider.
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for a character
* not contained in the first @a __n characters of @a __s
* within this string. If found, returns the index where it
* was found. If not found, returns npos.
*/
size_type
find_last_not_of(const _CharT* __s, size_type __pos,
size_type __n) const;
/**
* @brief Find last position of a character not in C string.
* @param __s C string containing characters to avoid.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for a character
* not contained in @a __s within this string. If found,
* returns the index where it was found. If not found, returns
* npos.
*/
size_type
find_last_not_of(const _CharT* __s, size_type __pos = npos) const
{
__glibcxx_requires_string(__s);
return this->find_last_not_of(__s, __pos, traits_type::length(__s));
}
/**
* @brief Find last position of a different character.
* @param __c Character to avoid.
* @param __pos Index of character to search back from (default end).
* @return Index of last occurrence.
*
* Starting from @a __pos, searches backward for a character
* other than @a __c within this string. If found, returns the
* index where it was found. If not found, returns npos.
*/
size_type
find_last_not_of(_CharT __c, size_type __pos = npos) const
_GLIBCXX_NOEXCEPT;
/**
* @brief Get a substring.
* @param __pos Index of first character (default 0).
* @param __n Number of characters in substring (default remainder).
* @return The new string.
* @throw std::out_of_range If pos > size().
*
* Construct and return a new string using the @a __n
* characters starting at @a __pos. If the string is too
* short, use the remainder of the characters. If @a __pos is
* beyond the end of the string, out_of_range is thrown.
*/
__versa_string
substr(size_type __pos = 0, size_type __n = npos) const
{
return __versa_string(*this, _M_check(__pos, "__versa_string::substr"),
__n);
}
/**
* @brief Compare to a string.
* @param __str String to compare against.
* @return Integer < 0, 0, or > 0.
*
* Returns an integer < 0 if this string is ordered before @a
* __str, 0 if their values are equivalent, or > 0 if this
* string is ordered after @a __str. Determines the effective
* length rlen of the strings to compare as the smallest of
* size() and str.size(). The function then compares the two
* strings by calling traits::compare(data(), str.data(),rlen).
* If the result of the comparison is nonzero returns it,
* otherwise the shorter one is ordered first.
*/
int
compare(const __versa_string& __str) const
{
if (this->_M_compare(__str))
return 0;
const size_type __size = this->size();
const size_type __osize = __str.size();
const size_type __len = std::min(__size, __osize);
int __r = traits_type::compare(this->_M_data(), __str.data(), __len);
if (!__r)
__r = this->_S_compare(__size, __osize);
return __r;
}
/**
* @brief Compare substring to a string.
* @param __pos Index of first character of substring.
* @param __n Number of characters in substring.
* @param __str String to compare against.
* @return Integer < 0, 0, or > 0.
*
* Form the substring of this string from the @a __n characters
* starting at @a __pos. Returns an integer < 0 if the
* substring is ordered before @a __str, 0 if their values are
* equivalent, or > 0 if the substring is ordered after @a
* __str. Determines the effective length rlen of the strings
* to compare as the smallest of the length of the substring
* and @a __str.size(). The function then compares the two
* strings by calling
* traits::compare(substring.data(),str.data(),rlen). If the
* result of the comparison is nonzero returns it, otherwise
* the shorter one is ordered first.
*/
int
compare(size_type __pos, size_type __n,
const __versa_string& __str) const;
/**
* @brief Compare substring to a substring.
* @param __pos1 Index of first character of substring.
* @param __n1 Number of characters in substring.
* @param __str String to compare against.
* @param __pos2 Index of first character of substring of str.
* @param __n2 Number of characters in substring of str.
* @return Integer < 0, 0, or > 0.
*
* Form the substring of this string from the @a __n1
* characters starting at @a __pos1. Form the substring of @a
* __str from the @a __n2 characters starting at @a __pos2.
* Returns an integer < 0 if this substring is ordered before
* the substring of @a __str, 0 if their values are equivalent,
* or > 0 if this substring is ordered after the substring of
* @a __str. Determines the effective length rlen of the
* strings to compare as the smallest of the lengths of the
* substrings. The function then compares the two strings by
* calling
* traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).
* If the result of the comparison is nonzero returns it,
* otherwise the shorter one is ordered first.
*/
int
compare(size_type __pos1, size_type __n1, const __versa_string& __str,
size_type __pos2, size_type __n2) const;
/**
* @brief Compare to a C string.
* @param __s C string to compare against.
* @return Integer < 0, 0, or > 0.
*
* Returns an integer < 0 if this string is ordered before @a
* __s, 0 if their values are equivalent, or > 0 if this string
* is ordered after @a __s. Determines the effective length
* rlen of the strings to compare as the smallest of size() and
* the length of a string constructed from @a __s. The
* function then compares the two strings by calling
* traits::compare(data(),s,rlen). If the result of the
* comparison is nonzero returns it, otherwise the shorter one
* is ordered first.
*/
int
compare(const _CharT* __s) const;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 5 String::compare specification questionable
/**
* @brief Compare substring to a C string.
* @param __pos Index of first character of substring.
* @param __n1 Number of characters in substring.
* @param __s C string to compare against.
* @return Integer < 0, 0, or > 0.
*
* Form the substring of this string from the @a __n1
* characters starting at @a __pos. Returns an integer < 0 if
* the substring is ordered before @a __s, 0 if their values
* are equivalent, or > 0 if the substring is ordered after @a
* __s. Determines the effective length rlen of the strings to
* compare as the smallest of the length of the substring and
* the length of a string constructed from @a __s. The
* function then compares the two string by calling
* traits::compare(substring.data(),s,rlen). If the result of
* the comparison is nonzero returns it, otherwise the shorter
* one is ordered first.
*/
int
compare(size_type __pos, size_type __n1, const _CharT* __s) const;
/**
* @brief Compare substring against a character array.
* @param __pos Index of first character of substring.
* @param __n1 Number of characters in substring.
* @param __s character array to compare against.
* @param __n2 Number of characters of s.
* @return Integer < 0, 0, or > 0.
*
* Form the substring of this string from the @a __n1
* characters starting at @a __pos. Form a string from the
* first @a __n2 characters of @a __s. Returns an integer < 0
* if this substring is ordered before the string from @a __s,
* 0 if their values are equivalent, or > 0 if this substring
* is ordered after the string from @a __s. Determines the
* effective length rlen of the strings to compare as the
* smallest of the length of the substring and @a __n2. The
* function then compares the two strings by calling
* traits::compare(substring.data(),__s,rlen). If the result of
* the comparison is nonzero returns it, otherwise the shorter
* one is ordered first.
*
* NB: __s must have at least n2 characters, <em>\\0</em> has no special
* meaning.
*/
int
compare(size_type __pos, size_type __n1, const _CharT* __s,
size_type __n2) const;
};
// operator+
/**
* @brief Concatenate two strings.
* @param __lhs First string.
* @param __rhs Last string.
* @return New string with value of @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
/**
* @brief Concatenate C string and string.
* @param __lhs First string.
* @param __rhs Last string.
* @return New string with value of @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
/**
* @brief Concatenate character and string.
* @param __lhs First string.
* @param __rhs Last string.
* @return New string with @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(_CharT __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
/**
* @brief Concatenate string and C string.
* @param __lhs First string.
* @param __rhs Last string.
* @return New string with @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs);
/**
* @brief Concatenate string and character.
* @param __lhs First string.
* @param __rhs Last string.
* @return New string with @a __lhs followed by @a __rhs.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
_CharT __rhs);
#if __cplusplus >= 201103L
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return std::move(__lhs.append(__rhs)); }
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
{ return std::move(__rhs.insert(0, __lhs)); }
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
{
const auto __size = __lhs.size() + __rhs.size();
const bool __cond = (__size > __lhs.capacity()
&& __size <= __rhs.capacity());
return __cond ? std::move(__rhs.insert(0, __lhs))
: std::move(__lhs.append(__rhs));
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const _CharT* __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
{ return std::move(__rhs.insert(0, __lhs)); }
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(_CharT __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
{ return std::move(__rhs.insert(0, 1, __lhs)); }
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
const _CharT* __rhs)
{ return std::move(__lhs.append(__rhs)); }
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline __versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
_CharT __rhs)
{ return std::move(__lhs.append(1, __rhs)); }
#endif
// operator ==
/**
* @brief Test equivalence of two strings.
* @param __lhs First string.
* @param __rhs Second string.
* @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __lhs.compare(__rhs) == 0; }
template<typename _CharT,
template <typename, typename, typename> class _Base>
inline typename __enable_if<std::__is_char<_CharT>::__value, bool>::__type
operator==(const __versa_string<_CharT, std::char_traits<_CharT>,
std::allocator<_CharT>, _Base>& __lhs,
const __versa_string<_CharT, std::char_traits<_CharT>,
std::allocator<_CharT>, _Base>& __rhs)
{ return (__lhs.size() == __rhs.size()
&& !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(),
__lhs.size())); }
/**
* @brief Test equivalence of C string and string.
* @param __lhs C string.
* @param __rhs String.
* @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator==(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __rhs.compare(__lhs) == 0; }
/**
* @brief Test equivalence of string and C string.
* @param __lhs String.
* @param __rhs C string.
* @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{ return __lhs.compare(__rhs) == 0; }
// operator !=
/**
* @brief Test difference of two strings.
* @param __lhs First string.
* @param __rhs Second string.
* @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return !(__lhs == __rhs); }
/**
* @brief Test difference of C string and string.
* @param __lhs C string.
* @param __rhs String.
* @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator!=(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return !(__lhs == __rhs); }
/**
* @brief Test difference of string and C string.
* @param __lhs String.
* @param __rhs C string.
* @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{ return !(__lhs == __rhs); }
// operator <
/**
* @brief Test if string precedes string.
* @param __lhs First string.
* @param __rhs Second string.
* @return True if @a __lhs precedes @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __lhs.compare(__rhs) < 0; }
/**
* @brief Test if string precedes C string.
* @param __lhs String.
* @param __rhs C string.
* @return True if @a __lhs precedes @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{ return __lhs.compare(__rhs) < 0; }
/**
* @brief Test if C string precedes string.
* @param __lhs C string.
* @param __rhs String.
* @return True if @a __lhs precedes @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator<(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __rhs.compare(__lhs) > 0; }
// operator >
/**
* @brief Test if string follows string.
* @param __lhs First string.
* @param __rhs Second string.
* @return True if @a __lhs follows @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __lhs.compare(__rhs) > 0; }
/**
* @brief Test if string follows C string.
* @param __lhs String.
* @param __rhs C string.
* @return True if @a __lhs follows @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{ return __lhs.compare(__rhs) > 0; }
/**
* @brief Test if C string follows string.
* @param __lhs C string.
* @param __rhs String.
* @return True if @a __lhs follows @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator>(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __rhs.compare(__lhs) < 0; }
// operator <=
/**
* @brief Test if string doesn't follow string.
* @param __lhs First string.
* @param __rhs Second string.
* @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __lhs.compare(__rhs) <= 0; }
/**
* @brief Test if string doesn't follow C string.
* @param __lhs String.
* @param __rhs C string.
* @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{ return __lhs.compare(__rhs) <= 0; }
/**
* @brief Test if C string doesn't follow string.
* @param __lhs C string.
* @param __rhs String.
* @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator<=(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __rhs.compare(__lhs) >= 0; }
// operator >=
/**
* @brief Test if string doesn't precede string.
* @param __lhs First string.
* @param __rhs Second string.
* @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __lhs.compare(__rhs) >= 0; }
/**
* @brief Test if string doesn't precede C string.
* @param __lhs String.
* @param __rhs C string.
* @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{ return __lhs.compare(__rhs) >= 0; }
/**
* @brief Test if C string doesn't precede string.
* @param __lhs C string.
* @param __rhs String.
* @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline bool
operator>=(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ return __rhs.compare(__lhs) <= 0; }
/**
* @brief Swap contents of two strings.
* @param __lhs First string.
* @param __rhs Second string.
*
* Exchanges the contents of @a __lhs and @a __rhs in constant time.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline void
swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
__versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{ __lhs.swap(__rhs); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Read stream into a string.
* @param __is Input stream.
* @param __str Buffer to store into.
* @return Reference to the input stream.
*
* Stores characters from @a __is into @a __str until whitespace is
* found, the end of the stream is encountered, or str.max_size()
* is reached. If is.width() is non-zero, that is the limit on the
* number of characters stored into @a __str. Any previous
* contents of @a __str are erased.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::__versa_string<_CharT, _Traits,
_Alloc, _Base>& __str);
/**
* @brief Write string to a stream.
* @param __os Output stream.
* @param __str String to write out.
* @return Reference to the output stream.
*
* Output characters of @a __str into os following the same rules as for
* writing a C string.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc,
_Base>& __str)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 586. string inserter not a formatted function
return __ostream_insert(__os, __str.data(), __str.size());
}
/**
* @brief Read a line from stream into a string.
* @param __is Input stream.
* @param __str Buffer to store into.
* @param __delim Character marking end of line.
* @return Reference to the input stream.
*
* Stores characters from @a __is into @a __str until @a __delim is
* found, the end of the stream is encountered, or str.max_size()
* is reached. If is.width() is non-zero, that is the limit on the
* number of characters stored into @a __str. Any previous
* contents of @a __str are erased. If @a delim was encountered,
* it is extracted but not stored into @a __str.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
_CharT __delim);
/**
* @brief Read a line from stream into a string.
* @param __is Input stream.
* @param __str Buffer to store into.
* @return Reference to the input stream.
*
* Stores characters from is into @a __str until '\n' is
* found, the end of the stream is encountered, or str.max_size()
* is reached. If is.width() is non-zero, that is the limit on the
* number of characters stored into @a __str. Any previous
* contents of @a __str are erased. If end of line was
* encountered, it is extracted but not stored into @a __str.
*/
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
inline basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str)
{ return getline(__is, __str, __is.widen('\n')); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#if __cplusplus >= 201103L
#include <ext/string_conversions.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_C99_STDLIB
// 21.4 Numeric Conversions [string.conversions].
inline int
stoi(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(),
__idx, __base); }
inline long
stol(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(),
__idx, __base); }
inline unsigned long
stoul(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(),
__idx, __base); }
inline long long
stoll(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(),
__idx, __base); }
inline unsigned long long
stoull(const __vstring& __str, std::size_t* __idx, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(),
__idx, __base); }
// NB: strtof vs strtod.
inline float
stof(const __vstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); }
inline double
stod(const __vstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); }
inline long double
stold(const __vstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); }
#endif // _GLIBCXX_USE_C99_STDLIB
#if _GLIBCXX_USE_C99_STDIO
// NB: (v)snprintf vs sprintf.
// DR 1261.
inline __vstring
to_string(int __val)
{ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(int),
"%d", __val); }
inline __vstring
to_string(unsigned __val)
{ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
4 * sizeof(unsigned),
"%u", __val); }
inline __vstring
to_string(long __val)
{ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
4 * sizeof(long),
"%ld", __val); }
inline __vstring
to_string(unsigned long __val)
{ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
4 * sizeof(unsigned long),
"%lu", __val); }
inline __vstring
to_string(long long __val)
{ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
4 * sizeof(long long),
"%lld", __val); }
inline __vstring
to_string(unsigned long long __val)
{ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
4 * sizeof(unsigned long long),
"%llu", __val); }
inline __vstring
to_string(float __val)
{
const int __n = __numeric_traits<float>::__max_exponent10 + 20;
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
"%f", __val);
}
inline __vstring
to_string(double __val)
{
const int __n = __numeric_traits<double>::__max_exponent10 + 20;
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
"%f", __val);
}
inline __vstring
to_string(long double __val)
{
const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
"%Lf", __val);
}
#endif // _GLIBCXX_USE_C99_STDIO
#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR
inline int
stoi(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa<long, int>(&std::wcstol, "stoi", __str.c_str(),
__idx, __base); }
inline long
stol(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(),
__idx, __base); }
inline unsigned long
stoul(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(),
__idx, __base); }
inline long long
stoll(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(),
__idx, __base); }
inline unsigned long long
stoull(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(),
__idx, __base); }
// NB: wcstof vs wcstod.
inline float
stof(const __wvstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); }
inline double
stod(const __wvstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); }
inline long double
stold(const __wvstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); }
#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
// DR 1261.
inline __wvstring
to_wstring(int __val)
{ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
4 * sizeof(int),
L"%d", __val); }
inline __wvstring
to_wstring(unsigned __val)
{ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
4 * sizeof(unsigned),
L"%u", __val); }
inline __wvstring
to_wstring(long __val)
{ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
4 * sizeof(long),
L"%ld", __val); }
inline __wvstring
to_wstring(unsigned long __val)
{ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
4 * sizeof(unsigned long),
L"%lu", __val); }
inline __wvstring
to_wstring(long long __val)
{ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
4 * sizeof(long long),
L"%lld", __val); }
inline __wvstring
to_wstring(unsigned long long __val)
{ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
4 * sizeof(unsigned long long),
L"%llu", __val); }
inline __wvstring
to_wstring(float __val)
{
const int __n = __numeric_traits<float>::__max_exponent10 + 20;
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
L"%f", __val);
}
inline __wvstring
to_wstring(double __val)
{
const int __n = __numeric_traits<double>::__max_exponent10 + 20;
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
L"%f", __val);
}
inline __wvstring
to_wstring(long double __val)
{
const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
L"%Lf", __val);
}
#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF
#endif // _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_C99_WCHAR
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
#if __cplusplus >= 201103L
#include <bits/functional_hash.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// std::hash specialization for __vstring.
template<>
struct hash<__gnu_cxx::__vstring>
: public __hash_base<size_t, __gnu_cxx::__vstring>
{
size_t
operator()(const __gnu_cxx::__vstring& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(), __s.length()); }
};
#ifdef _GLIBCXX_USE_WCHAR_T
/// std::hash specialization for __wvstring.
template<>
struct hash<__gnu_cxx::__wvstring>
: public __hash_base<size_t, __gnu_cxx::__wvstring>
{
size_t
operator()(const __gnu_cxx::__wvstring& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(wchar_t)); }
};
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/// std::hash specialization for __u16vstring.
template<>
struct hash<__gnu_cxx::__u16vstring>
: public __hash_base<size_t, __gnu_cxx::__u16vstring>
{
size_t
operator()(const __gnu_cxx::__u16vstring& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(char16_t)); }
};
/// std::hash specialization for __u32vstring.
template<>
struct hash<__gnu_cxx::__u32vstring>
: public __hash_base<size_t, __gnu_cxx::__u32vstring>
{
size_t
operator()(const __gnu_cxx::__u32vstring& __s) const noexcept
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(char32_t)); }
};
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // C++11
#include <ext/vstring.tcc>
#endif /* _VSTRING_H */
// SGI's rope class -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ext/rope
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _ROPE
#define _ROPE 1
#pragma GCC system_header
#include <algorithm>
#include <iosfwd>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_function.h>
#include <bits/stl_numeric.h>
#include <bits/allocator.h>
#include <bits/gthr.h>
#include <tr1/functional>
# ifdef __GC
# define __GC_CONST const
# else
# define __GC_CONST // constant except for deallocation
# endif
#include <ext/memory> // For uninitialized_copy_n
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
enum { _S_max_rope_depth = 45 };
enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
} // namespace __detail
using std::size_t;
using std::ptrdiff_t;
using std::allocator;
using std::_Destroy;
// See libstdc++/36832.
template<typename _ForwardIterator, typename _Allocator>
void
_Destroy_const(_ForwardIterator __first,
_ForwardIterator __last, _Allocator __alloc)
{
for (; __first != __last; ++__first)
__alloc.destroy(&*__first);
}
template<typename _ForwardIterator, typename _Tp>
inline void
_Destroy_const(_ForwardIterator __first,
_ForwardIterator __last, allocator<_Tp>)
{ _Destroy(__first, __last); }
// The _S_eos function is used for those functions that
// convert to/from C-like strings to detect the end of the string.
// The end-of-C-string character.
// This is what the draft standard says it should be.
template <class _CharT>
inline _CharT
_S_eos(_CharT*)
{ return _CharT(); }
// Test for basic character types.
// For basic character types leaves having a trailing eos.
template <class _CharT>
inline bool
_S_is_basic_char_type(_CharT*)
{ return false; }
template <class _CharT>
inline bool
_S_is_one_byte_char_type(_CharT*)
{ return false; }
inline bool
_S_is_basic_char_type(char*)
{ return true; }
inline bool
_S_is_one_byte_char_type(char*)
{ return true; }
inline bool
_S_is_basic_char_type(wchar_t*)
{ return true; }
// Store an eos iff _CharT is a basic character type.
// Do not reference _S_eos if it isn't.
template <class _CharT>
inline void
_S_cond_store_eos(_CharT&) { }
inline void
_S_cond_store_eos(char& __c)
{ __c = 0; }
inline void
_S_cond_store_eos(wchar_t& __c)
{ __c = 0; }
// char_producers are logically functions that generate a section of
// a string. These can be converted to ropes. The resulting rope
// invokes the char_producer on demand. This allows, for example,
// files to be viewed as ropes without reading the entire file.
template <class _CharT>
class char_producer
{
public:
virtual ~char_producer() { }
virtual void
operator()(size_t __start_pos, size_t __len,
_CharT* __buffer) = 0;
// Buffer should really be an arbitrary output iterator.
// That way we could flatten directly into an ostream, etc.
// This is thoroughly impossible, since iterator types don't
// have runtime descriptions.
};
// Sequence buffers:
//
// Sequence must provide an append operation that appends an
// array to the sequence. Sequence buffers are useful only if
// appending an entire array is cheaper than appending element by element.
// This is true for many string representations.
// This should perhaps inherit from ostream<sequence::value_type>
// and be implemented correspondingly, so that they can be used
// for formatted. For the sake of portability, we don't do this yet.
//
// For now, sequence buffers behave as output iterators. But they also
// behave a little like basic_ostringstream<sequence::value_type> and a
// little like containers.
template<class _Sequence, size_t _Buf_sz = 100>
class sequence_buffer
: public std::iterator<std::output_iterator_tag, void, void, void, void>
{
public:
typedef typename _Sequence::value_type value_type;
protected:
_Sequence* _M_prefix;
value_type _M_buffer[_Buf_sz];
size_t _M_buf_count;
public:
void
flush()
{
_M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
_M_buf_count = 0;
}
~sequence_buffer()
{ flush(); }
sequence_buffer()
: _M_prefix(0), _M_buf_count(0) { }
sequence_buffer(const sequence_buffer& __x)
{
_M_prefix = __x._M_prefix;
_M_buf_count = __x._M_buf_count;
std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
}
sequence_buffer(sequence_buffer& __x)
{
__x.flush();
_M_prefix = __x._M_prefix;
_M_buf_count = 0;
}
sequence_buffer(_Sequence& __s)
: _M_prefix(&__s), _M_buf_count(0) { }
sequence_buffer&
operator=(sequence_buffer& __x)
{
__x.flush();
_M_prefix = __x._M_prefix;
_M_buf_count = 0;
return *this;
}
sequence_buffer&
operator=(const sequence_buffer& __x)
{
_M_prefix = __x._M_prefix;
_M_buf_count = __x._M_buf_count;
std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
return *this;
}
void
push_back(value_type __x)
{
if (_M_buf_count < _Buf_sz)
{
_M_buffer[_M_buf_count] = __x;
++_M_buf_count;
}
else
{
flush();
_M_buffer[0] = __x;
_M_buf_count = 1;
}
}
void
append(value_type* __s, size_t __len)
{
if (__len + _M_buf_count <= _Buf_sz)
{
size_t __i = _M_buf_count;
for (size_t __j = 0; __j < __len; __i++, __j++)
_M_buffer[__i] = __s[__j];
_M_buf_count += __len;
}
else if (0 == _M_buf_count)
_M_prefix->append(__s, __s + __len);
else
{
flush();
append(__s, __len);
}
}
sequence_buffer&
write(value_type* __s, size_t __len)
{
append(__s, __len);
return *this;
}
sequence_buffer&
put(value_type __x)
{
push_back(__x);
return *this;
}
sequence_buffer&
operator=(const value_type& __rhs)
{
push_back(__rhs);
return *this;
}
sequence_buffer&
operator*()
{ return *this; }
sequence_buffer&
operator++()
{ return *this; }
sequence_buffer
operator++(int)
{ return *this; }
};
// The following should be treated as private, at least for now.
template<class _CharT>
class _Rope_char_consumer
{
public:
// If we had member templates, these should not be virtual.
// For now we need to use run-time parametrization where
// compile-time would do. Hence this should all be private
// for now.
// The symmetry with char_producer is accidental and temporary.
virtual ~_Rope_char_consumer() { }
virtual bool
operator()(const _CharT* __buffer, size_t __len) = 0;
};
// First a lot of forward declarations. The standard seems to require
// much stricter "declaration before use" than many of the implementations
// that preceded it.
template<class _CharT, class _Alloc = allocator<_CharT> >
class rope;
template<class _CharT, class _Alloc>
struct _Rope_RopeConcatenation;
template<class _CharT, class _Alloc>
struct _Rope_RopeLeaf;
template<class _CharT, class _Alloc>
struct _Rope_RopeFunction;
template<class _CharT, class _Alloc>
struct _Rope_RopeSubstring;
template<class _CharT, class _Alloc>
class _Rope_iterator;
template<class _CharT, class _Alloc>
class _Rope_const_iterator;
template<class _CharT, class _Alloc>
class _Rope_char_ref_proxy;
template<class _CharT, class _Alloc>
class _Rope_char_ptr_proxy;
template<class _CharT, class _Alloc>
bool
operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc>
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc>
operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x,
ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n,
const _Rope_const_iterator<_CharT, _Alloc>& __x);
template<class _CharT, class _Alloc>
bool
operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
bool
operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
ptrdiff_t
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _Alloc>
operator-(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _Alloc>
operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x);
template<class _CharT, class _Alloc>
bool
operator==(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
bool
operator<(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
ptrdiff_t
operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left,
const rope<_CharT, _Alloc>& __right);
template<class _CharT, class _Alloc>
rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left, const _CharT* __right);
template<class _CharT, class _Alloc>
rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left, _CharT __right);
// Some helpers, so we can use power on ropes.
// See below for why this isn't local to the implementation.
// This uses a nonstandard refcount convention.
// The result has refcount 0.
template<class _CharT, class _Alloc>
struct _Rope_Concat_fn
: public std::binary_function<rope<_CharT, _Alloc>, rope<_CharT, _Alloc>,
rope<_CharT, _Alloc> >
{
rope<_CharT, _Alloc>
operator()(const rope<_CharT, _Alloc>& __x,
const rope<_CharT, _Alloc>& __y)
{ return __x + __y; }
};
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>
identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
{ return rope<_CharT, _Alloc>(); }
// Class _Refcount_Base provides a type, _RC_t, a data member,
// _M_ref_count, and member functions _M_incr and _M_decr, which perform
// atomic preincrement/predecrement. The constructor initializes
// _M_ref_count.
struct _Refcount_Base
{
// The type _RC_t
typedef size_t _RC_t;
// The data member _M_ref_count
volatile _RC_t _M_ref_count;
// Constructor
#ifdef __GTHREAD_MUTEX_INIT
__gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_ref_count_lock;
#endif
_Refcount_Base(_RC_t __n) : _M_ref_count(__n)
{
#ifndef __GTHREAD_MUTEX_INIT
#ifdef __GTHREAD_MUTEX_INIT_FUNCTION
__GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);
#else
#error __GTHREAD_MUTEX_INIT or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org.
#endif
#endif
}
#ifndef __GTHREAD_MUTEX_INIT
~_Refcount_Base()
{ __gthread_mutex_destroy(&_M_ref_count_lock); }
#endif
void
_M_incr()
{
__gthread_mutex_lock(&_M_ref_count_lock);
++_M_ref_count;
__gthread_mutex_unlock(&_M_ref_count_lock);
}
_RC_t
_M_decr()
{
__gthread_mutex_lock(&_M_ref_count_lock);
volatile _RC_t __tmp = --_M_ref_count;
__gthread_mutex_unlock(&_M_ref_count_lock);
return __tmp;
}
};
//
// What follows should really be local to rope. Unfortunately,
// that doesn't work, since it makes it impossible to define generic
// equality on rope iterators. According to the draft standard, the
// template parameters for such an equality operator cannot be inferred
// from the occurrence of a member class as a parameter.
// (SGI compilers in fact allow this, but the __result wouldn't be
// portable.)
// Similarly, some of the static member functions are member functions
// only to avoid polluting the global namespace, and to circumvent
// restrictions on type inference for template functions.
//
//
// The internal data structure for representing a rope. This is
// private to the implementation. A rope is really just a pointer
// to one of these.
//
// A few basic functions for manipulating this data structure
// are members of _RopeRep. Most of the more complex algorithms
// are implemented as rope members.
//
// Some of the static member functions of _RopeRep have identically
// named functions in rope that simply invoke the _RopeRep versions.
#define __ROPE_DEFINE_ALLOCS(__a) \
__ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \
typedef _Rope_RopeConcatenation<_CharT,__a> __C; \
__ROPE_DEFINE_ALLOC(__C,_C) \
typedef _Rope_RopeLeaf<_CharT,__a> __L; \
__ROPE_DEFINE_ALLOC(__L,_L) \
typedef _Rope_RopeFunction<_CharT,__a> __F; \
__ROPE_DEFINE_ALLOC(__F,_F) \
typedef _Rope_RopeSubstring<_CharT,__a> __S; \
__ROPE_DEFINE_ALLOC(__S,_S)
// Internal rope nodes potentially store a copy of the allocator
// instance used to allocate them. This is mostly redundant.
// But the alternative would be to pass allocator instances around
// in some form to nearly all internal functions, since any pointer
// assignment may result in a zero reference count and thus require
// deallocation.
#define __STATIC_IF_SGI_ALLOC /* not static */
template <class _CharT, class _Alloc>
struct _Rope_rep_base
: public _Alloc
{
typedef _Alloc allocator_type;
allocator_type
get_allocator() const
{ return *static_cast<const _Alloc*>(this); }
allocator_type&
_M_get_allocator()
{ return *static_cast<_Alloc*>(this); }
const allocator_type&
_M_get_allocator() const
{ return *static_cast<const _Alloc*>(this); }
_Rope_rep_base(size_t __size, const allocator_type&)
: _M_size(__size) { }
size_t _M_size;
# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
typedef typename \
_Alloc::template rebind<_Tp>::other __name##Alloc; \
static _Tp* __name##_allocate(size_t __n) \
{ return __name##Alloc().allocate(__n); } \
static void __name##_deallocate(_Tp *__p, size_t __n) \
{ __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc)
# undef __ROPE_DEFINE_ALLOC
};
template<class _CharT, class _Alloc>
struct _Rope_RopeRep
: public _Rope_rep_base<_CharT, _Alloc>
# ifndef __GC
, _Refcount_Base
# endif
{
public:
__detail::_Tag _M_tag:8;
bool _M_is_balanced:8;
unsigned char _M_depth;
__GC_CONST _CharT* _M_c_string;
#ifdef __GTHREAD_MUTEX_INIT
__gthread_mutex_t _M_c_string_lock = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_c_string_lock;
#endif
/* Flattened version of string, if needed. */
/* typically 0. */
/* If it's not 0, then the memory is owned */
/* by this node. */
/* In the case of a leaf, this may point to */
/* the same memory as the data field. */
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
using _Rope_rep_base<_CharT, _Alloc>::_M_get_allocator;
_Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size,
const allocator_type& __a)
: _Rope_rep_base<_CharT, _Alloc>(__size, __a),
#ifndef __GC
_Refcount_Base(1),
#endif
_M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
#ifdef __GTHREAD_MUTEX_INIT
{ }
#else
{ __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
~_Rope_RopeRep()
{ __gthread_mutex_destroy (&_M_c_string_lock); }
#endif
#ifdef __GC
void
_M_incr () { }
#endif
static void
_S_free_string(__GC_CONST _CharT*, size_t __len,
allocator_type& __a);
#define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
// Deallocate data section of a leaf.
// This shouldn't be a member function.
// But its hard to do anything else at the
// moment, because it's templatized w.r.t.
// an allocator.
// Does nothing if __GC is defined.
#ifndef __GC
void _M_free_c_string();
void _M_free_tree();
// Deallocate t. Assumes t is not 0.
void
_M_unref_nonnil()
{
if (0 == _M_decr())
_M_free_tree();
}
void
_M_ref_nonnil()
{ _M_incr(); }
static void
_S_unref(_Rope_RopeRep* __t)
{
if (0 != __t)
__t->_M_unref_nonnil();
}
static void
_S_ref(_Rope_RopeRep* __t)
{
if (0 != __t)
__t->_M_incr();
}
static void
_S_free_if_unref(_Rope_RopeRep* __t)
{
if (0 != __t && 0 == __t->_M_ref_count)
__t->_M_free_tree();
}
# else /* __GC */
void _M_unref_nonnil() { }
void _M_ref_nonnil() { }
static void _S_unref(_Rope_RopeRep*) { }
static void _S_ref(_Rope_RopeRep*) { }
static void _S_free_if_unref(_Rope_RopeRep*) { }
# endif
protected:
_Rope_RopeRep&
operator=(const _Rope_RopeRep&);
_Rope_RopeRep(const _Rope_RopeRep&);
};
template<class _CharT, class _Alloc>
struct _Rope_RopeLeaf
: public _Rope_RopeRep<_CharT, _Alloc>
{
public:
// Apparently needed by VC++
// The data fields of leaves are allocated with some
// extra space, to accommodate future growth and for basic
// character types, to hold a trailing eos character.
enum { _S_alloc_granularity = 8 };
static size_t
_S_rounded_up_size(size_t __n)
{
size_t __size_with_eos;
if (_S_is_basic_char_type((_CharT*)0))
__size_with_eos = __n + 1;
else
__size_with_eos = __n;
#ifdef __GC
return __size_with_eos;
#else
// Allow slop for in-place expansion.
return ((__size_with_eos + size_t(_S_alloc_granularity) - 1)
&~ (size_t(_S_alloc_granularity) - 1));
#endif
}
__GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
/* The allocated size is */
/* _S_rounded_up_size(size), except */
/* in the GC case, in which it */
/* doesn't matter. */
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
allocator_type;
_Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
const allocator_type& __a)
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
__size, __a), _M_data(__d)
{
if (_S_is_basic_char_type((_CharT *)0))
{
// already eos terminated.
this->_M_c_string = __d;
}
}
// The constructor assumes that d has been allocated with
// the proper allocator and the properly padded size.
// In contrast, the destructor deallocates the data:
#ifndef __GC
~_Rope_RopeLeaf() throw()
{
if (_M_data != this->_M_c_string)
this->_M_free_c_string();
this->__STL_FREE_STRING(_M_data, this->_M_size, this->_M_get_allocator());
}
#endif
protected:
_Rope_RopeLeaf&
operator=(const _Rope_RopeLeaf&);
_Rope_RopeLeaf(const _Rope_RopeLeaf&);
};
template<class _CharT, class _Alloc>
struct _Rope_RopeConcatenation
: public _Rope_RopeRep<_CharT, _Alloc>
{
public:
_Rope_RopeRep<_CharT, _Alloc>* _M_left;
_Rope_RopeRep<_CharT, _Alloc>* _M_right;
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
_Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
_Rope_RopeRep<_CharT, _Alloc>* __r,
const allocator_type& __a)
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,
std::max(__l->_M_depth,
__r->_M_depth) + 1,
false,
__l->_M_size + __r->_M_size, __a),
_M_left(__l), _M_right(__r)
{ }
#ifndef __GC
~_Rope_RopeConcatenation() throw()
{
this->_M_free_c_string();
_M_left->_M_unref_nonnil();
_M_right->_M_unref_nonnil();
}
#endif
protected:
_Rope_RopeConcatenation&
operator=(const _Rope_RopeConcatenation&);
_Rope_RopeConcatenation(const _Rope_RopeConcatenation&);
};
template<class _CharT, class _Alloc>
struct _Rope_RopeFunction
: public _Rope_RopeRep<_CharT, _Alloc>
{
public:
char_producer<_CharT>* _M_fn;
#ifndef __GC
bool _M_delete_when_done; // Char_producer is owned by the
// rope and should be explicitly
// deleted when the rope becomes
// inaccessible.
#else
// In the GC case, we either register the rope for
// finalization, or not. Thus the field is unnecessary;
// the information is stored in the collector data structures.
// We do need a finalization procedure to be invoked by the
// collector.
static void
_S_fn_finalization_proc(void * __tree, void *)
{ delete ((_Rope_RopeFunction *)__tree) -> _M_fn; }
#endif
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
_Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
bool __d, const allocator_type& __a)
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
, _M_fn(__f)
#ifndef __GC
, _M_delete_when_done(__d)
#endif
{
#ifdef __GC
if (__d)
{
GC_REGISTER_FINALIZER(this, _Rope_RopeFunction::
_S_fn_finalization_proc, 0, 0, 0);
}
#endif
}
#ifndef __GC
~_Rope_RopeFunction() throw()
{
this->_M_free_c_string();
if (_M_delete_when_done)
delete _M_fn;
}
# endif
protected:
_Rope_RopeFunction&
operator=(const _Rope_RopeFunction&);
_Rope_RopeFunction(const _Rope_RopeFunction&);
};
// Substring results are usually represented using just
// concatenation nodes. But in the case of very long flat ropes
// or ropes with a functional representation that isn't practical.
// In that case, we represent the __result as a special case of
// RopeFunction, whose char_producer points back to the rope itself.
// In all cases except repeated substring operations and
// deallocation, we treat the __result as a RopeFunction.
template<class _CharT, class _Alloc>
struct _Rope_RopeSubstring
: public _Rope_RopeFunction<_CharT, _Alloc>,
public char_producer<_CharT>
{
public:
// XXX this whole class should be rewritten.
_Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0
size_t _M_start;
virtual void
operator()(size_t __start_pos, size_t __req_len,
_CharT* __buffer)
{
switch(_M_base->_M_tag)
{
case __detail::_S_function:
case __detail::_S_substringfn:
{
char_producer<_CharT>* __fn =
((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
(*__fn)(__start_pos + _M_start, __req_len, __buffer);
}
break;
case __detail::_S_leaf:
{
__GC_CONST _CharT* __s =
((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
uninitialized_copy_n(__s + __start_pos + _M_start, __req_len,
__buffer);
}
break;
default:
break;
}
}
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
_Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s,
size_t __l, const allocator_type& __a)
: _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),
char_producer<_CharT>(), _M_base(__b), _M_start(__s)
{
#ifndef __GC
_M_base->_M_ref_nonnil();
#endif
this->_M_tag = __detail::_S_substringfn;
}
virtual ~_Rope_RopeSubstring() throw()
{
#ifndef __GC
_M_base->_M_unref_nonnil();
// _M_free_c_string(); -- done by parent class
#endif
}
};
// Self-destructing pointers to Rope_rep.
// These are not conventional smart pointers. Their
// only purpose in life is to ensure that unref is called
// on the pointer either at normal exit or if an exception
// is raised. It is the caller's responsibility to
// adjust reference counts when these pointers are initialized
// or assigned to. (This convention significantly reduces
// the number of potentially expensive reference count
// updates.)
#ifndef __GC
template<class _CharT, class _Alloc>
struct _Rope_self_destruct_ptr
{
_Rope_RopeRep<_CharT, _Alloc>* _M_ptr;
~_Rope_self_destruct_ptr()
{ _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); }
#if __cpp_exceptions
_Rope_self_destruct_ptr() : _M_ptr(0) { }
#else
_Rope_self_destruct_ptr() { }
#endif
_Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p)
: _M_ptr(__p) { }
_Rope_RopeRep<_CharT, _Alloc>&
operator*()
{ return *_M_ptr; }
_Rope_RopeRep<_CharT, _Alloc>*
operator->()
{ return _M_ptr; }
operator _Rope_RopeRep<_CharT, _Alloc>*()
{ return _M_ptr; }
_Rope_self_destruct_ptr&
operator=(_Rope_RopeRep<_CharT, _Alloc>* __x)
{ _M_ptr = __x; return *this; }
};
#endif
// Dereferencing a nonconst iterator has to return something
// that behaves almost like a reference. It's not possible to
// return an actual reference since assignment requires extra
// work. And we would get into the same problems as with the
// CD2 version of basic_string.
template<class _CharT, class _Alloc>
class _Rope_char_ref_proxy
{
friend class rope<_CharT, _Alloc>;
friend class _Rope_iterator<_CharT, _Alloc>;
friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;
#ifdef __GC
typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;
#else
typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;
#endif
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
typedef rope<_CharT, _Alloc> _My_rope;
size_t _M_pos;
_CharT _M_current;
bool _M_current_valid;
_My_rope* _M_root; // The whole rope.
public:
_Rope_char_ref_proxy(_My_rope* __r, size_t __p)
: _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }
_Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
: _M_pos(__x._M_pos), _M_current(__x._M_current),
_M_current_valid(false), _M_root(__x._M_root) { }
// Don't preserve cache if the reference can outlive the
// expression. We claim that's not possible without calling
// a copy constructor or generating reference to a proxy
// reference. We declare the latter to have undefined semantics.
_Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
: _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }
inline operator _CharT () const;
_Rope_char_ref_proxy&
operator=(_CharT __c);
_Rope_char_ptr_proxy<_CharT, _Alloc> operator&() const;
_Rope_char_ref_proxy&
operator=(const _Rope_char_ref_proxy& __c)
{ return operator=((_CharT)__c); }
};
template<class _CharT, class __Alloc>
inline void
swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
_Rope_char_ref_proxy <_CharT, __Alloc > __b)
{
_CharT __tmp = __a;
__a = __b;
__b = __tmp;
}
template<class _CharT, class _Alloc>
class _Rope_char_ptr_proxy
{
// XXX this class should be rewritten.
friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
size_t _M_pos;
rope<_CharT,_Alloc>* _M_root; // The whole rope.
public:
_Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
: _M_pos(__x._M_pos), _M_root(__x._M_root) { }
_Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)
: _M_pos(__x._M_pos), _M_root(__x._M_root) { }
_Rope_char_ptr_proxy() { }
_Rope_char_ptr_proxy(_CharT* __x)
: _M_root(0), _M_pos(0) { }
_Rope_char_ptr_proxy&
operator=(const _Rope_char_ptr_proxy& __x)
{
_M_pos = __x._M_pos;
_M_root = __x._M_root;
return *this;
}
template<class _CharT2, class _Alloc2>
friend bool
operator==(const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __x,
const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __y);
_Rope_char_ref_proxy<_CharT, _Alloc> operator*() const
{ return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root, _M_pos); }
};
// Rope iterators:
// Unlike in the C version, we cache only part of the stack
// for rope iterators, since they must be efficiently copyable.
// When we run out of cache, we have to reconstruct the iterator
// value.
// Pointers from iterators are not included in reference counts.
// Iterators are assumed to be thread private. Ropes can
// be shared.
template<class _CharT, class _Alloc>
class _Rope_iterator_base
: public std::iterator<std::random_access_iterator_tag, _CharT>
{
friend class rope<_CharT, _Alloc>;
public:
typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
// Borland doesn't want this to be protected.
protected:
enum { _S_path_cache_len = 4 }; // Must be <= 9.
enum { _S_iterator_buf_len = 15 };
size_t _M_current_pos;
_RopeRep* _M_root; // The whole rope.
size_t _M_leaf_pos; // Starting position for current leaf
__GC_CONST _CharT* _M_buf_start;
// Buffer possibly
// containing current char.
__GC_CONST _CharT* _M_buf_ptr;
// Pointer to current char in buffer.
// != 0 ==> buffer valid.
__GC_CONST _CharT* _M_buf_end;
// One past __last valid char in buffer.
// What follows is the path cache. We go out of our
// way to make this compact.
// Path_end contains the bottom section of the path from
// the root to the current leaf.
const _RopeRep* _M_path_end[_S_path_cache_len];
int _M_leaf_index; // Last valid __pos in path_end;
// _M_path_end[0] ... _M_path_end[leaf_index-1]
// point to concatenation nodes.
unsigned char _M_path_directions;
// (path_directions >> __i) & 1 is 1
// iff we got from _M_path_end[leaf_index - __i - 1]
// to _M_path_end[leaf_index - __i] by going to the
// __right. Assumes path_cache_len <= 9.
_CharT _M_tmp_buf[_S_iterator_buf_len];
// Short buffer for surrounding chars.
// This is useful primarily for
// RopeFunctions. We put the buffer
// here to avoid locking in the
// multithreaded case.
// The cached path is generally assumed to be valid
// only if the buffer is valid.
static void _S_setbuf(_Rope_iterator_base& __x);
// Set buffer contents given
// path cache.
static void _S_setcache(_Rope_iterator_base& __x);
// Set buffer contents and
// path cache.
static void _S_setcache_for_incr(_Rope_iterator_base& __x);
// As above, but assumes path
// cache is valid for previous posn.
_Rope_iterator_base() { }
_Rope_iterator_base(_RopeRep* __root, size_t __pos)
: _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }
void _M_incr(size_t __n);
void _M_decr(size_t __n);
public:
size_t
index() const
{ return _M_current_pos; }
_Rope_iterator_base(const _Rope_iterator_base& __x)
{
if (0 != __x._M_buf_ptr)
*this = __x;
else
{
_M_current_pos = __x._M_current_pos;
_M_root = __x._M_root;
_M_buf_ptr = 0;
}
}
};
template<class _CharT, class _Alloc>
class _Rope_iterator;
template<class _CharT, class _Alloc>
class _Rope_const_iterator
: public _Rope_iterator_base<_CharT, _Alloc>
{
friend class rope<_CharT, _Alloc>;
protected:
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
// The one from the base class may not be directly visible.
_Rope_const_iterator(const _RopeRep* __root, size_t __pos)
: _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),
__pos)
// Only nonconst iterators modify root ref count
{ }
public:
typedef _CharT reference; // Really a value. Returning a reference
// Would be a mess, since it would have
// to be included in refcount.
typedef const _CharT* pointer;
public:
_Rope_const_iterator() { }
_Rope_const_iterator(const _Rope_const_iterator& __x)
: _Rope_iterator_base<_CharT,_Alloc>(__x) { }
_Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x);
_Rope_const_iterator(const rope<_CharT, _Alloc>& __r, size_t __pos)
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { }
_Rope_const_iterator&
operator=(const _Rope_const_iterator& __x)
{
if (0 != __x._M_buf_ptr)
*(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x;
else
{
this->_M_current_pos = __x._M_current_pos;
this->_M_root = __x._M_root;
this->_M_buf_ptr = 0;
}
return(*this);
}
reference
operator*()
{
if (0 == this->_M_buf_ptr)
this->_S_setcache(*this);
return *this->_M_buf_ptr;
}
// Without this const version, Rope iterators do not meet the
// requirements of an Input Iterator.
reference
operator*() const
{
return *const_cast<_Rope_const_iterator&>(*this);
}
_Rope_const_iterator&
operator++()
{
__GC_CONST _CharT* __next;
if (0 != this->_M_buf_ptr
&& (__next = this->_M_buf_ptr + 1) < this->_M_buf_end)
{
this->_M_buf_ptr = __next;
++this->_M_current_pos;
}
else
this->_M_incr(1);
return *this;
}
_Rope_const_iterator&
operator+=(ptrdiff_t __n)
{
if (__n >= 0)
this->_M_incr(__n);
else
this->_M_decr(-__n);
return *this;
}
_Rope_const_iterator&
operator--()
{
this->_M_decr(1);
return *this;
}
_Rope_const_iterator&
operator-=(ptrdiff_t __n)
{
if (__n >= 0)
this->_M_decr(__n);
else
this->_M_incr(-__n);
return *this;
}
_Rope_const_iterator
operator++(int)
{
size_t __old_pos = this->_M_current_pos;
this->_M_incr(1);
return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
// This makes a subsequent dereference expensive.
// Perhaps we should instead copy the iterator
// if it has a valid cache?
}
_Rope_const_iterator
operator--(int)
{
size_t __old_pos = this->_M_current_pos;
this->_M_decr(1);
return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
}
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2>
operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2>
operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2>
operator+(ptrdiff_t __n,
const _Rope_const_iterator<_CharT2, _Alloc2>& __x);
reference
operator[](size_t __n)
{ return rope<_CharT, _Alloc>::_S_fetch(this->_M_root,
this->_M_current_pos + __n); }
template<class _CharT2, class _Alloc2>
friend bool
operator==(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
friend bool
operator<(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
friend ptrdiff_t
operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
};
template<class _CharT, class _Alloc>
class _Rope_iterator
: public _Rope_iterator_base<_CharT, _Alloc>
{
friend class rope<_CharT, _Alloc>;
protected:
typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep;
rope<_CharT, _Alloc>* _M_root_rope;
// root is treated as a cached version of this, and is used to
// detect changes to the underlying rope.
// Root is included in the reference count. This is necessary
// so that we can detect changes reliably. Unfortunately, it
// requires careful bookkeeping for the nonGC case.
_Rope_iterator(rope<_CharT, _Alloc>* __r, size_t __pos)
: _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),
_M_root_rope(__r)
{ _RopeRep::_S_ref(this->_M_root);
if (!(__r -> empty()))
this->_S_setcache(*this);
}
void _M_check();
public:
typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;
typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer;
rope<_CharT, _Alloc>&
container()
{ return *_M_root_rope; }
_Rope_iterator()
{
this->_M_root = 0; // Needed for reference counting.
}
_Rope_iterator(const _Rope_iterator& __x)
: _Rope_iterator_base<_CharT, _Alloc>(__x)
{
_M_root_rope = __x._M_root_rope;
_RopeRep::_S_ref(this->_M_root);
}
_Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos);
~_Rope_iterator()
{ _RopeRep::_S_unref(this->_M_root); }
_Rope_iterator&
operator=(const _Rope_iterator& __x)
{
_RopeRep* __old = this->_M_root;
_RopeRep::_S_ref(__x._M_root);
if (0 != __x._M_buf_ptr)
{
_M_root_rope = __x._M_root_rope;
*(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x;
}
else
{
this->_M_current_pos = __x._M_current_pos;
this->_M_root = __x._M_root;
_M_root_rope = __x._M_root_rope;
this->_M_buf_ptr = 0;
}
_RopeRep::_S_unref(__old);
return(*this);
}
reference
operator*()
{
_M_check();
if (0 == this->_M_buf_ptr)
return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
this->_M_current_pos);
else
return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
this->_M_current_pos,
*this->_M_buf_ptr);
}
// See above comment.
reference
operator*() const
{
return *const_cast<_Rope_iterator&>(*this);
}
_Rope_iterator&
operator++()
{
this->_M_incr(1);
return *this;
}
_Rope_iterator&
operator+=(ptrdiff_t __n)
{
if (__n >= 0)
this->_M_incr(__n);
else
this->_M_decr(-__n);
return *this;
}
_Rope_iterator&
operator--()
{
this->_M_decr(1);
return *this;
}
_Rope_iterator&
operator-=(ptrdiff_t __n)
{
if (__n >= 0)
this->_M_decr(__n);
else
this->_M_incr(-__n);
return *this;
}
_Rope_iterator
operator++(int)
{
size_t __old_pos = this->_M_current_pos;
this->_M_incr(1);
return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
}
_Rope_iterator
operator--(int)
{
size_t __old_pos = this->_M_current_pos;
this->_M_decr(1);
return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
}
reference
operator[](ptrdiff_t __n)
{ return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
this->_M_current_pos
+ __n); }
template<class _CharT2, class _Alloc2>
friend bool
operator==(const _Rope_iterator<_CharT2, _Alloc2>& __x,
const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
friend bool
operator<(const _Rope_iterator<_CharT2, _Alloc2>& __x,
const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
friend ptrdiff_t
operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x,
const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _Alloc2>
operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _Alloc2>
operator+(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _Alloc2>
operator+(ptrdiff_t __n, const _Rope_iterator<_CharT2, _Alloc2>& __x);
};
template <class _CharT, class _Alloc>
struct _Rope_base
: public _Alloc
{
typedef _Alloc allocator_type;
allocator_type
get_allocator() const
{ return *static_cast<const _Alloc*>(this); }
allocator_type&
_M_get_allocator()
{ return *static_cast<_Alloc*>(this); }
const allocator_type&
_M_get_allocator() const
{ return *static_cast<const _Alloc*>(this); }
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
// The one in _Base may not be visible due to template rules.
_Rope_base(_RopeRep* __t, const allocator_type&)
: _M_tree_ptr(__t) { }
_Rope_base(const allocator_type&) { }
// The only data member of a rope:
_RopeRep *_M_tree_ptr;
#define __ROPE_DEFINE_ALLOC(_Tp, __name) \
typedef typename \
_Alloc::template rebind<_Tp>::other __name##Alloc; \
static _Tp* __name##_allocate(size_t __n) \
{ return __name##Alloc().allocate(__n); } \
static void __name##_deallocate(_Tp *__p, size_t __n) \
{ __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc)
#undef __ROPE_DEFINE_ALLOC
protected:
_Rope_base&
operator=(const _Rope_base&);
_Rope_base(const _Rope_base&);
};
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template <class _CharT, class _Alloc>
class rope : public _Rope_base<_CharT, _Alloc>
{
public:
typedef _CharT value_type;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef _CharT const_reference;
typedef const _CharT* const_pointer;
typedef _Rope_iterator<_CharT, _Alloc> iterator;
typedef _Rope_const_iterator<_CharT, _Alloc> const_iterator;
typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;
typedef _Rope_char_ptr_proxy<_CharT, _Alloc> pointer;
friend class _Rope_iterator<_CharT, _Alloc>;
friend class _Rope_const_iterator<_CharT, _Alloc>;
friend struct _Rope_RopeRep<_CharT, _Alloc>;
friend class _Rope_iterator_base<_CharT, _Alloc>;
friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;
friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
friend struct _Rope_RopeSubstring<_CharT, _Alloc>;
protected:
typedef _Rope_base<_CharT, _Alloc> _Base;
typedef typename _Base::allocator_type allocator_type;
using _Base::_M_tree_ptr;
using _Base::get_allocator;
using _Base::_M_get_allocator;
typedef __GC_CONST _CharT* _Cstrptr;
static _CharT _S_empty_c_str[1];
static bool
_S_is0(_CharT __c)
{ return __c == _S_eos((_CharT*)0); }
enum { _S_copy_max = 23 };
// For strings shorter than _S_copy_max, we copy to
// concatenate.
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
// Retrieve a character at the indicated position.
static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
#ifndef __GC
// Obtain a pointer to the character at the indicated position.
// The pointer can be used to change the character.
// If such a pointer cannot be produced, as is frequently the
// case, 0 is returned instead.
// (Returns nonzero only if all nodes in the path have a refcount
// of 1.)
static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
#endif
static bool
_S_apply_to_pieces(// should be template parameter
_Rope_char_consumer<_CharT>& __c,
const _RopeRep* __r,
size_t __begin, size_t __end);
// begin and end are assumed to be in range.
#ifndef __GC
static void
_S_unref(_RopeRep* __t)
{ _RopeRep::_S_unref(__t); }
static void
_S_ref(_RopeRep* __t)
{ _RopeRep::_S_ref(__t); }
#else /* __GC */
static void _S_unref(_RopeRep*) { }
static void _S_ref(_RopeRep*) { }
#endif
#ifdef __GC
typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;
#else
typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;
#endif
// _Result is counted in refcount.
static _RopeRep* _S_substring(_RopeRep* __base,
size_t __start, size_t __endp1);
static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
const _CharT* __iter, size_t __slen);
// Concatenate rope and char ptr, copying __s.
// Should really take an arbitrary iterator.
// Result is counted in refcount.
static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
const _CharT* __iter,
size_t __slen)
// As above, but one reference to __r is about to be
// destroyed. Thus the pieces may be recycled if all
// relevant reference counts are 1.
#ifdef __GC
// We can't really do anything since refcounts are unavailable.
{ return _S_concat_char_iter(__r, __iter, __slen); }
#else
;
#endif
static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right);
// General concatenation on _RopeRep. _Result
// has refcount of 1. Adjusts argument refcounts.
public:
void
apply_to_pieces(size_t __begin, size_t __end,
_Rope_char_consumer<_CharT>& __c) const
{ _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); }
protected:
static size_t
_S_rounded_up_size(size_t __n)
{ return _RopeLeaf::_S_rounded_up_size(__n); }
static size_t
_S_allocated_capacity(size_t __n)
{
if (_S_is_basic_char_type((_CharT*)0))
return _S_rounded_up_size(__n) - 1;
else
return _S_rounded_up_size(__n);
}
// Allocate and construct a RopeLeaf using the supplied allocator
// Takes ownership of s instead of copying.
static _RopeLeaf*
_S_new_RopeLeaf(__GC_CONST _CharT *__s,
size_t __size, allocator_type& __a)
{
_RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1);
return new(__space) _RopeLeaf(__s, __size, __a);
}
static _RopeConcatenation*
_S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
allocator_type& __a)
{
_RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1);
return new(__space) _RopeConcatenation(__left, __right, __a);
}
static _RopeFunction*
_S_new_RopeFunction(char_producer<_CharT>* __f,
size_t __size, bool __d, allocator_type& __a)
{
_RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1);
return new(__space) _RopeFunction(__f, __size, __d, __a);
}
static _RopeSubstring*
_S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
size_t __l, allocator_type& __a)
{
_RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1);
return new(__space) _RopeSubstring(__b, __s, __l, __a);
}
static _RopeLeaf*
_S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
size_t __size, allocator_type& __a)
#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
_S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
{
if (0 == __size)
return 0;
_CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
__uninitialized_copy_n_a(__s, __size, __buf, __a);
_S_cond_store_eos(__buf[__size]);
__try
{ return _S_new_RopeLeaf(__buf, __size, __a); }
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__buf, __size, __a);
__throw_exception_again;
}
}
// Concatenation of nonempty strings.
// Always builds a concatenation node.
// Rebalances if the result is too deep.
// Result has refcount 1.
// Does not increment left and right ref counts even though
// they are referenced.
static _RopeRep*
_S_tree_concat(_RopeRep* __left, _RopeRep* __right);
// Concatenation helper functions
static _RopeLeaf*
_S_leaf_concat_char_iter(_RopeLeaf* __r,
const _CharT* __iter, size_t __slen);
// Concatenate by copying leaf.
// should take an arbitrary iterator
// result has refcount 1.
#ifndef __GC
static _RopeLeaf*
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r,
const _CharT* __iter, size_t __slen);
// A version that potentially clobbers __r if __r->_M_ref_count == 1.
#endif
private:
static size_t _S_char_ptr_len(const _CharT* __s);
// slightly generalized strlen
rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
: _Base(__t, __a) { }
// Copy __r to the _CharT buffer.
// Returns __buffer + __r->_M_size.
// Assumes that buffer is uninitialized.
static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
// Again, with explicit starting position and length.
// Assumes that buffer is uninitialized.
static _CharT* _S_flatten(_RopeRep* __r,
size_t __start, size_t __len,
_CharT* __buffer);
static const unsigned long
_S_min_len[__detail::_S_max_rope_depth + 1];
static bool
_S_is_balanced(_RopeRep* __r)
{ return (__r->_M_size >= _S_min_len[__r->_M_depth]); }
static bool
_S_is_almost_balanced(_RopeRep* __r)
{ return (__r->_M_depth == 0
|| __r->_M_size >= _S_min_len[__r->_M_depth - 1]); }
static bool
_S_is_roughly_balanced(_RopeRep* __r)
{ return (__r->_M_depth <= 1
|| __r->_M_size >= _S_min_len[__r->_M_depth - 2]); }
// Assumes the result is not empty.
static _RopeRep*
_S_concat_and_set_balanced(_RopeRep* __left, _RopeRep* __right)
{
_RopeRep* __result = _S_concat(__left, __right);
if (_S_is_balanced(__result))
__result->_M_is_balanced = true;
return __result;
}
// The basic rebalancing operation. Logically copies the
// rope. The result has refcount of 1. The client will
// usually decrement the reference count of __r.
// The result is within height 2 of balanced by the above
// definition.
static _RopeRep* _S_balance(_RopeRep* __r);
// Add all unbalanced subtrees to the forest of balanced trees.
// Used only by balance.
static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
// Add __r to forest, assuming __r is already balanced.
static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
// Print to stdout, exposing structure
static void _S_dump(_RopeRep* __r, int __indent = 0);
// Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
public:
bool
empty() const
{ return 0 == this->_M_tree_ptr; }
// Comparison member function. This is public only for those
// clients that need a ternary comparison. Others
// should use the comparison operators below.
int
compare(const rope& __y) const
{ return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }
rope(const _CharT* __s, const allocator_type& __a = allocator_type())
: _Base(__a)
{
this->_M_tree_ptr =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
_M_get_allocator());
}
rope(const _CharT* __s, size_t __len,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
this->_M_tree_ptr =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, _M_get_allocator());
}
// Should perhaps be templatized with respect to the iterator type
// and use Sequence_buffer. (It should perhaps use sequence_buffer
// even now.)
rope(const _CharT* __s, const _CharT* __e,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
this->_M_tree_ptr =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, _M_get_allocator());
}
rope(const const_iterator& __s, const const_iterator& __e,
const allocator_type& __a = allocator_type())
: _Base(_S_substring(__s._M_root, __s._M_current_pos,
__e._M_current_pos), __a)
{ }
rope(const iterator& __s, const iterator& __e,
const allocator_type& __a = allocator_type())
: _Base(_S_substring(__s._M_root, __s._M_current_pos,
__e._M_current_pos), __a)
{ }
rope(_CharT __c, const allocator_type& __a = allocator_type())
: _Base(__a)
{
_CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));
_M_get_allocator().construct(__buf, __c);
__try
{
this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1,
_M_get_allocator());
}
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__buf, 1, _M_get_allocator());
__throw_exception_again;
}
}
rope(size_t __n, _CharT __c,
const allocator_type& __a = allocator_type());
rope(const allocator_type& __a = allocator_type())
: _Base(0, __a) { }
// Construct a rope from a function that can compute its members
rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
this->_M_tree_ptr = (0 == __len)
? 0
: _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator());
}
rope(const rope& __x, const allocator_type& __a = allocator_type())
: _Base(__x._M_tree_ptr, __a)
{ _S_ref(this->_M_tree_ptr); }
~rope() throw()
{ _S_unref(this->_M_tree_ptr); }
rope&
operator=(const rope& __x)
{
_RopeRep* __old = this->_M_tree_ptr;
this->_M_tree_ptr = __x._M_tree_ptr;
_S_ref(this->_M_tree_ptr);
_S_unref(__old);
return *this;
}
void
clear()
{
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = 0;
}
void
push_back(_CharT __x)
{
_RopeRep* __old = this->_M_tree_ptr;
this->_M_tree_ptr
= _S_destr_concat_char_iter(this->_M_tree_ptr, &__x, 1);
_S_unref(__old);
}
void
pop_back()
{
_RopeRep* __old = this->_M_tree_ptr;
this->_M_tree_ptr = _S_substring(this->_M_tree_ptr,
0, this->_M_tree_ptr->_M_size - 1);
_S_unref(__old);
}
_CharT
back() const
{ return _S_fetch(this->_M_tree_ptr, this->_M_tree_ptr->_M_size - 1); }
void
push_front(_CharT __x)
{
_RopeRep* __old = this->_M_tree_ptr;
_RopeRep* __left =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, _M_get_allocator());
__try
{
this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
_S_unref(__old);
_S_unref(__left);
}
__catch(...)
{
_S_unref(__left);
__throw_exception_again;
}
}
void
pop_front()
{
_RopeRep* __old = this->_M_tree_ptr;
this->_M_tree_ptr
= _S_substring(this->_M_tree_ptr, 1, this->_M_tree_ptr->_M_size);
_S_unref(__old);
}
_CharT
front() const
{ return _S_fetch(this->_M_tree_ptr, 0); }
void
balance()
{
_RopeRep* __old = this->_M_tree_ptr;
this->_M_tree_ptr = _S_balance(this->_M_tree_ptr);
_S_unref(__old);
}
void
copy(_CharT* __buffer) const
{
_Destroy_const(__buffer, __buffer + size(), _M_get_allocator());
_S_flatten(this->_M_tree_ptr, __buffer);
}
// This is the copy function from the standard, but
// with the arguments reordered to make it consistent with the
// rest of the interface.
// Note that this guaranteed not to compile if the draft standard
// order is assumed.
size_type
copy(size_type __pos, size_type __n, _CharT* __buffer) const
{
size_t __size = size();
size_t __len = (__pos + __n > __size? __size - __pos : __n);
_Destroy_const(__buffer, __buffer + __len, _M_get_allocator());
_S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
return __len;
}
// Print to stdout, exposing structure. May be useful for
// performance debugging.
void
dump()
{ _S_dump(this->_M_tree_ptr); }
// Convert to 0 terminated string in new allocated memory.
// Embedded 0s in the input do not terminate the copy.
const _CharT* c_str() const;
// As above, but also use the flattened representation as
// the new rope representation.
const _CharT* replace_with_c_str();
// Reclaim memory for the c_str generated flattened string.
// Intentionally undocumented, since it's hard to say when this
// is safe for multiple threads.
void
delete_c_str ()
{
if (0 == this->_M_tree_ptr)
return;
if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag &&
((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
this->_M_tree_ptr->_M_c_string)
{
// Representation shared
return;
}
#ifndef __GC
this->_M_tree_ptr->_M_free_c_string();
#endif
this->_M_tree_ptr->_M_c_string = 0;
}
_CharT
operator[] (size_type __pos) const
{ return _S_fetch(this->_M_tree_ptr, __pos); }
_CharT
at(size_type __pos) const
{
// if (__pos >= size()) throw out_of_range; // XXX
return (*this)[__pos];
}
const_iterator
begin() const
{ return(const_iterator(this->_M_tree_ptr, 0)); }
// An easy way to get a const iterator from a non-const container.
const_iterator
const_begin() const
{ return(const_iterator(this->_M_tree_ptr, 0)); }
const_iterator
end() const
{ return(const_iterator(this->_M_tree_ptr, size())); }
const_iterator
const_end() const
{ return(const_iterator(this->_M_tree_ptr, size())); }
size_type
size() const
{ return(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size); }
size_type
length() const
{ return size(); }
size_type
max_size() const
{
return _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1;
// Guarantees that the result can be sufficiently
// balanced. Longer ropes will probably still work,
// but it's harder to make guarantees.
}
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
const_reverse_iterator
rbegin() const
{ return const_reverse_iterator(end()); }
const_reverse_iterator
const_rbegin() const
{ return const_reverse_iterator(end()); }
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
const_reverse_iterator
const_rend() const
{ return const_reverse_iterator(begin()); }
template<class _CharT2, class _Alloc2>
friend rope<_CharT2, _Alloc2>
operator+(const rope<_CharT2, _Alloc2>& __left,
const rope<_CharT2, _Alloc2>& __right);
template<class _CharT2, class _Alloc2>
friend rope<_CharT2, _Alloc2>
operator+(const rope<_CharT2, _Alloc2>& __left, const _CharT2* __right);
template<class _CharT2, class _Alloc2>
friend rope<_CharT2, _Alloc2>
operator+(const rope<_CharT2, _Alloc2>& __left, _CharT2 __right);
// The symmetric cases are intentionally omitted, since they're
// presumed to be less common, and we don't handle them as well.
// The following should really be templatized. The first
// argument should be an input iterator or forward iterator with
// value_type _CharT.
rope&
append(const _CharT* __iter, size_t __n)
{
_RopeRep* __result =
_S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
return *this;
}
rope&
append(const _CharT* __c_string)
{
size_t __len = _S_char_ptr_len(__c_string);
append(__c_string, __len);
return(*this);
}
rope&
append(const _CharT* __s, const _CharT* __e)
{
_RopeRep* __result =
_S_destr_concat_char_iter(this->_M_tree_ptr, __s, __e - __s);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
return *this;
}
rope&
append(const_iterator __s, const_iterator __e)
{
_Self_destruct_ptr __appendee(_S_substring(__s._M_root,
__s._M_current_pos,
__e._M_current_pos));
_RopeRep* __result = _S_concat(this->_M_tree_ptr,
(_RopeRep*)__appendee);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
return *this;
}
rope&
append(_CharT __c)
{
_RopeRep* __result =
_S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
return *this;
}
rope&
append()
{ return append(_CharT()); } // XXX why?
rope&
append(const rope& __y)
{
_RopeRep* __result = _S_concat(this->_M_tree_ptr, __y._M_tree_ptr);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
return *this;
}
rope&
append(size_t __n, _CharT __c)
{
rope<_CharT,_Alloc> __last(__n, __c);
return append(__last);
}
void
swap(rope& __b)
{
_RopeRep* __tmp = this->_M_tree_ptr;
this->_M_tree_ptr = __b._M_tree_ptr;
__b._M_tree_ptr = __tmp;
}
protected:
// Result is included in refcount.
static _RopeRep*
replace(_RopeRep* __old, size_t __pos1,
size_t __pos2, _RopeRep* __r)
{
if (0 == __old)
{
_S_ref(__r);
return __r;
}
_Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
_Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size));
_RopeRep* __result;
if (0 == __r)
__result = _S_concat(__left, __right);
else
{
_Self_destruct_ptr __left_result(_S_concat(__left, __r));
__result = _S_concat(__left_result, __right);
}
return __result;
}
public:
void
insert(size_t __p, const rope& __r)
{
_RopeRep* __result =
replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
}
void
insert(size_t __p, size_t __n, _CharT __c)
{
rope<_CharT,_Alloc> __r(__n,__c);
insert(__p, __r);
}
void
insert(size_t __p, const _CharT* __i, size_t __n)
{
_Self_destruct_ptr __left(_S_substring(this->_M_tree_ptr, 0, __p));
_Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr,
__p, size()));
_Self_destruct_ptr __left_result(_S_concat_char_iter(__left, __i, __n));
// _S_ destr_concat_char_iter should be safe here.
// But as it stands it's probably not a win, since __left
// is likely to have additional references.
_RopeRep* __result = _S_concat(__left_result, __right);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
}
void
insert(size_t __p, const _CharT* __c_string)
{ insert(__p, __c_string, _S_char_ptr_len(__c_string)); }
void
insert(size_t __p, _CharT __c)
{ insert(__p, &__c, 1); }
void
insert(size_t __p)
{
_CharT __c = _CharT();
insert(__p, &__c, 1);
}
void
insert(size_t __p, const _CharT* __i, const _CharT* __j)
{
rope __r(__i, __j);
insert(__p, __r);
}
void
insert(size_t __p, const const_iterator& __i,
const const_iterator& __j)
{
rope __r(__i, __j);
insert(__p, __r);
}
void
insert(size_t __p, const iterator& __i,
const iterator& __j)
{
rope __r(__i, __j);
insert(__p, __r);
}
// (position, length) versions of replace operations:
void
replace(size_t __p, size_t __n, const rope& __r)
{
_RopeRep* __result =
replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
}
void
replace(size_t __p, size_t __n,
const _CharT* __i, size_t __i_len)
{
rope __r(__i, __i_len);
replace(__p, __n, __r);
}
void
replace(size_t __p, size_t __n, _CharT __c)
{
rope __r(__c);
replace(__p, __n, __r);
}
void
replace(size_t __p, size_t __n, const _CharT* __c_string)
{
rope __r(__c_string);
replace(__p, __n, __r);
}
void
replace(size_t __p, size_t __n,
const _CharT* __i, const _CharT* __j)
{
rope __r(__i, __j);
replace(__p, __n, __r);
}
void
replace(size_t __p, size_t __n,
const const_iterator& __i, const const_iterator& __j)
{
rope __r(__i, __j);
replace(__p, __n, __r);
}
void
replace(size_t __p, size_t __n,
const iterator& __i, const iterator& __j)
{
rope __r(__i, __j);
replace(__p, __n, __r);
}
// Single character variants:
void
replace(size_t __p, _CharT __c)
{
iterator __i(this, __p);
*__i = __c;
}
void
replace(size_t __p, const rope& __r)
{ replace(__p, 1, __r); }
void
replace(size_t __p, const _CharT* __i, size_t __i_len)
{ replace(__p, 1, __i, __i_len); }
void
replace(size_t __p, const _CharT* __c_string)
{ replace(__p, 1, __c_string); }
void
replace(size_t __p, const _CharT* __i, const _CharT* __j)
{ replace(__p, 1, __i, __j); }
void
replace(size_t __p, const const_iterator& __i,
const const_iterator& __j)
{ replace(__p, 1, __i, __j); }
void
replace(size_t __p, const iterator& __i,
const iterator& __j)
{ replace(__p, 1, __i, __j); }
// Erase, (position, size) variant.
void
erase(size_t __p, size_t __n)
{
_RopeRep* __result = replace(this->_M_tree_ptr, __p,
__p + __n, 0);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
}
// Erase, single character
void
erase(size_t __p)
{ erase(__p, __p + 1); }
// Insert, iterator variants.
iterator
insert(const iterator& __p, const rope& __r)
{
insert(__p.index(), __r);
return __p;
}
iterator
insert(const iterator& __p, size_t __n, _CharT __c)
{
insert(__p.index(), __n, __c);
return __p;
}
iterator insert(const iterator& __p, _CharT __c)
{
insert(__p.index(), __c);
return __p;
}
iterator
insert(const iterator& __p )
{
insert(__p.index());
return __p;
}
iterator
insert(const iterator& __p, const _CharT* c_string)
{
insert(__p.index(), c_string);
return __p;
}
iterator
insert(const iterator& __p, const _CharT* __i, size_t __n)
{
insert(__p.index(), __i, __n);
return __p;
}
iterator
insert(const iterator& __p, const _CharT* __i,
const _CharT* __j)
{
insert(__p.index(), __i, __j);
return __p;
}
iterator
insert(const iterator& __p,
const const_iterator& __i, const const_iterator& __j)
{
insert(__p.index(), __i, __j);
return __p;
}
iterator
insert(const iterator& __p,
const iterator& __i, const iterator& __j)
{
insert(__p.index(), __i, __j);
return __p;
}
// Replace, range variants.
void
replace(const iterator& __p, const iterator& __q, const rope& __r)
{ replace(__p.index(), __q.index() - __p.index(), __r); }
void
replace(const iterator& __p, const iterator& __q, _CharT __c)
{ replace(__p.index(), __q.index() - __p.index(), __c); }
void
replace(const iterator& __p, const iterator& __q,
const _CharT* __c_string)
{ replace(__p.index(), __q.index() - __p.index(), __c_string); }
void
replace(const iterator& __p, const iterator& __q,
const _CharT* __i, size_t __n)
{ replace(__p.index(), __q.index() - __p.index(), __i, __n); }
void
replace(const iterator& __p, const iterator& __q,
const _CharT* __i, const _CharT* __j)
{ replace(__p.index(), __q.index() - __p.index(), __i, __j); }
void
replace(const iterator& __p, const iterator& __q,
const const_iterator& __i, const const_iterator& __j)
{ replace(__p.index(), __q.index() - __p.index(), __i, __j); }
void
replace(const iterator& __p, const iterator& __q,
const iterator& __i, const iterator& __j)
{ replace(__p.index(), __q.index() - __p.index(), __i, __j); }
// Replace, iterator variants.
void
replace(const iterator& __p, const rope& __r)
{ replace(__p.index(), __r); }
void
replace(const iterator& __p, _CharT __c)
{ replace(__p.index(), __c); }
void
replace(const iterator& __p, const _CharT* __c_string)
{ replace(__p.index(), __c_string); }
void
replace(const iterator& __p, const _CharT* __i, size_t __n)
{ replace(__p.index(), __i, __n); }
void
replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
{ replace(__p.index(), __i, __j); }
void
replace(const iterator& __p, const_iterator __i, const_iterator __j)
{ replace(__p.index(), __i, __j); }
void
replace(const iterator& __p, iterator __i, iterator __j)
{ replace(__p.index(), __i, __j); }
// Iterator and range variants of erase
iterator
erase(const iterator& __p, const iterator& __q)
{
size_t __p_index = __p.index();
erase(__p_index, __q.index() - __p_index);
return iterator(this, __p_index);
}
iterator
erase(const iterator& __p)
{
size_t __p_index = __p.index();
erase(__p_index, 1);
return iterator(this, __p_index);
}
rope
substr(size_t __start, size_t __len = 1) const
{
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__start,
__start + __len));
}
rope
substr(iterator __start, iterator __end) const
{
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__start.index(),
__end.index()));
}
rope
substr(iterator __start) const
{
size_t __pos = __start.index();
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__pos, __pos + 1));
}
rope
substr(const_iterator __start, const_iterator __end) const
{
// This might eventually take advantage of the cache in the
// iterator.
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__start.index(),
__end.index()));
}
rope<_CharT, _Alloc>
substr(const_iterator __start)
{
size_t __pos = __start.index();
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__pos, __pos + 1));
}
static const size_type npos;
size_type find(_CharT __c, size_type __pos = 0) const;
size_type
find(const _CharT* __s, size_type __pos = 0) const
{
size_type __result_pos;
const_iterator __result =
std::search(const_begin() + __pos, const_end(),
__s, __s + _S_char_ptr_len(__s));
__result_pos = __result.index();
#ifndef __STL_OLD_ROPE_SEMANTICS
if (__result_pos == size())
__result_pos = npos;
#endif
return __result_pos;
}
iterator
mutable_begin()
{ return(iterator(this, 0)); }
iterator
mutable_end()
{ return(iterator(this, size())); }
typedef std::reverse_iterator<iterator> reverse_iterator;
reverse_iterator
mutable_rbegin()
{ return reverse_iterator(mutable_end()); }
reverse_iterator
mutable_rend()
{ return reverse_iterator(mutable_begin()); }
reference
mutable_reference_at(size_type __pos)
{ return reference(this, __pos); }
#ifdef __STD_STUFF
reference
operator[] (size_type __pos)
{ return _char_ref_proxy(this, __pos); }
reference
at(size_type __pos)
{
// if (__pos >= size()) throw out_of_range; // XXX
return (*this)[__pos];
}
void resize(size_type __n, _CharT __c) { }
void resize(size_type __n) { }
void reserve(size_type __res_arg = 0) { }
size_type
capacity() const
{ return max_size(); }
// Stuff below this line is dangerous because it's error prone.
// I would really like to get rid of it.
// copy function with funny arg ordering.
size_type
copy(_CharT* __buffer, size_type __n,
size_type __pos = 0) const
{ return copy(__pos, __n, __buffer); }
iterator
end()
{ return mutable_end(); }
iterator
begin()
{ return mutable_begin(); }
reverse_iterator
rend()
{ return mutable_rend(); }
reverse_iterator
rbegin()
{ return mutable_rbegin(); }
#else
const_iterator
end()
{ return const_end(); }
const_iterator
begin()
{ return const_begin(); }
const_reverse_iterator
rend()
{ return const_rend(); }
const_reverse_iterator
rbegin()
{ return const_rbegin(); }
#endif
};
template <class _CharT, class _Alloc>
const typename rope<_CharT, _Alloc>::size_type
rope<_CharT, _Alloc>::npos = (size_type)(-1);
template <class _CharT, class _Alloc>
inline bool operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return (__x._M_current_pos == __y._M_current_pos
&& __x._M_root == __y._M_root); }
template <class _CharT, class _Alloc>
inline bool operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return (__x._M_current_pos < __y._M_current_pos); }
template <class _CharT, class _Alloc>
inline bool operator!=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return !(__x == __y); }
template <class _CharT, class _Alloc>
inline bool operator>(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return __y < __x; }
template <class _CharT, class _Alloc>
inline bool
operator<=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return !(__y < __x); }
template <class _CharT, class _Alloc>
inline bool
operator>=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return !(__x < __y); }
template <class _CharT, class _Alloc>
inline ptrdiff_t
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _Alloc>
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
{ return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos - __n); }
template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _Alloc>
operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
{ return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT, _Alloc>& __x)
{ return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
inline bool
operator==(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{return (__x._M_current_pos == __y._M_current_pos
&& __x._M_root_rope == __y._M_root_rope); }
template <class _CharT, class _Alloc>
inline bool
operator<(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{ return (__x._M_current_pos < __y._M_current_pos); }
template <class _CharT, class _Alloc>
inline bool
operator!=(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{ return !(__x == __y); }
template <class _CharT, class _Alloc>
inline bool
operator>(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{ return __y < __x; }
template <class _CharT, class _Alloc>
inline bool
operator<=(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{ return !(__y < __x); }
template <class _CharT, class _Alloc>
inline bool
operator>=(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{ return !(__x < __y); }
template <class _CharT, class _Alloc>
inline ptrdiff_t
operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
{ return ((ptrdiff_t)__x._M_current_pos
- (ptrdiff_t)__y._M_current_pos); }
template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc>
operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
ptrdiff_t __n)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos - __n); }
template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc>
operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left,
const rope<_CharT, _Alloc>& __right)
{
// Inlining this should make it possible to keep __left and
// __right in registers.
typedef rope<_CharT, _Alloc> rope_type;
return rope_type(rope_type::_S_concat(__left._M_tree_ptr,
__right._M_tree_ptr));
}
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>&
operator+=(rope<_CharT, _Alloc>& __left,
const rope<_CharT, _Alloc>& __right)
{
__left.append(__right);
return __left;
}
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left,
const _CharT* __right)
{
typedef rope<_CharT, _Alloc> rope_type;
size_t __rlen = rope_type::_S_char_ptr_len(__right);
return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
__right, __rlen));
}
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>&
operator+=(rope<_CharT, _Alloc>& __left,
const _CharT* __right)
{
__left.append(__right);
return __left;
}
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left, _CharT __right)
{
typedef rope<_CharT, _Alloc> rope_type;
return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
&__right, 1));
}
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>&
operator+=(rope<_CharT, _Alloc>& __left, _CharT __right)
{
__left.append(__right);
return __left;
}
template <class _CharT, class _Alloc>
bool
operator<(const rope<_CharT, _Alloc>& __left,
const rope<_CharT, _Alloc>& __right)
{ return __left.compare(__right) < 0; }
template <class _CharT, class _Alloc>
bool
operator==(const rope<_CharT, _Alloc>& __left,
const rope<_CharT, _Alloc>& __right)
{ return __left.compare(__right) == 0; }
template <class _CharT, class _Alloc>
inline bool
operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)
{ return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); }
template <class _CharT, class _Alloc>
inline bool
operator!=(const rope<_CharT, _Alloc>& __x,
const rope<_CharT, _Alloc>& __y)
{ return !(__x == __y); }
template <class _CharT, class _Alloc>
inline bool
operator>(const rope<_CharT, _Alloc>& __x,
const rope<_CharT, _Alloc>& __y)
{ return __y < __x; }
template <class _CharT, class _Alloc>
inline bool
operator<=(const rope<_CharT, _Alloc>& __x,
const rope<_CharT, _Alloc>& __y)
{ return !(__y < __x); }
template <class _CharT, class _Alloc>
inline bool
operator>=(const rope<_CharT, _Alloc>& __x,
const rope<_CharT, _Alloc>& __y)
{ return !(__x < __y); }
template <class _CharT, class _Alloc>
inline bool
operator!=(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)
{ return !(__x == __y); }
template<class _CharT, class _Traits, class _Alloc>
std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __o,
const rope<_CharT, _Alloc>& __r);
typedef rope<char> crope;
typedef rope<wchar_t> wrope;
inline crope::reference
__mutable_reference_at(crope& __c, size_t __i)
{ return __c.mutable_reference_at(__i); }
inline wrope::reference
__mutable_reference_at(wrope& __c, size_t __i)
{ return __c.mutable_reference_at(__i); }
template <class _CharT, class _Alloc>
inline void
swap(rope<_CharT, _Alloc>& __x, rope<_CharT, _Alloc>& __y)
{ __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace tr1
{
template<>
struct hash<__gnu_cxx::crope>
{
size_t
operator()(const __gnu_cxx::crope& __str) const
{
size_t __size = __str.size();
if (0 == __size)
return 0;
return 13 * __str[0] + 5 * __str[__size - 1] + __size;
}
};
template<>
struct hash<__gnu_cxx::wrope>
{
size_t
operator()(const __gnu_cxx::wrope& __str) const
{
size_t __size = __str.size();
if (0 == __size)
return 0;
return 13 * __str[0] + 5 * __str[__size - 1] + __size;
}
};
} // namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
# include <ext/ropeimpl.h>
#endif
// File descriptor layer for filebuf -*- C++ -*-
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/stdio_filebuf.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _STDIO_FILEBUF_H
#define _STDIO_FILEBUF_H 1
#pragma GCC system_header
#include <fstream>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Provides a layer of compatibility for C/POSIX.
* @ingroup io
*
* This GNU extension provides extensions for working with standard C
* FILE*'s and POSIX file descriptors. It must be instantiated by the
* user with the type of character used in the file stream, e.g.,
* stdio_filebuf<char>.
*/
template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
class stdio_filebuf : public std::basic_filebuf<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
typedef std::size_t size_t;
public:
/**
* deferred initialization
*/
stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {}
/**
* @param __fd An open file descriptor.
* @param __mode Same meaning as in a standard filebuf.
* @param __size Optimal or preferred size of internal buffer,
* in chars.
*
* This constructor associates a file stream buffer with an open
* POSIX file descriptor. The file descriptor will be automatically
* closed when the stdio_filebuf is closed/destroyed.
*/
stdio_filebuf(int __fd, std::ios_base::openmode __mode,
size_t __size = static_cast<size_t>(BUFSIZ));
/**
* @param __f An open @c FILE*.
* @param __mode Same meaning as in a standard filebuf.
* @param __size Optimal or preferred size of internal buffer,
* in chars. Defaults to system's @c BUFSIZ.
*
* This constructor associates a file stream buffer with an open
* C @c FILE*. The @c FILE* will not be automatically closed when the
* stdio_filebuf is closed/destroyed.
*/
stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
size_t __size = static_cast<size_t>(BUFSIZ));
/**
* Closes the external data stream if the file descriptor constructor
* was used.
*/
virtual
~stdio_filebuf();
#if __cplusplus >= 201103L
stdio_filebuf(stdio_filebuf&&) = default;
stdio_filebuf& operator=(stdio_filebuf&&) = default;
void
swap(stdio_filebuf& __fb)
{ std::basic_filebuf<_CharT, _Traits>::swap(__fb); }
#endif
/**
* @return The underlying file descriptor.
*
* Once associated with an external data stream, this function can be
* used to access the underlying POSIX file descriptor. Note that
* there is no way for the library to track what you do with the
* descriptor, so be careful.
*/
int
fd() { return this->_M_file.fd(); }
/**
* @return The underlying FILE*.
*
* This function can be used to access the underlying "C" file pointer.
* Note that there is no way for the library to track what you do
* with the file, so be careful.
*/
std::__c_file*
file() { return this->_M_file.file(); }
};
template<typename _CharT, typename _Traits>
stdio_filebuf<_CharT, _Traits>::~stdio_filebuf()
{ }
template<typename _CharT, typename _Traits>
stdio_filebuf<_CharT, _Traits>::
stdio_filebuf(int __fd, std::ios_base::openmode __mode, size_t __size)
{
this->_M_file.sys_open(__fd, __mode);
if (this->is_open())
{
this->_M_mode = __mode;
this->_M_buf_size = __size;
this->_M_allocate_internal_buffer();
this->_M_reading = false;
this->_M_writing = false;
this->_M_set_buffer(-1);
}
}
template<typename _CharT, typename _Traits>
stdio_filebuf<_CharT, _Traits>::
stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
size_t __size)
{
this->_M_file.sys_open(__f, __mode);
if (this->is_open())
{
this->_M_mode = __mode;
this->_M_buf_size = __size;
this->_M_allocate_internal_buffer();
this->_M_reading = false;
this->_M_writing = false;
this->_M_set_buffer(-1);
}
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Hashing map implementation -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file backward/hash_map
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset).
*/
#ifndef _BACKWARD_HASH_MAP
#define _BACKWARD_HASH_MAP 1
#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
#include "backward_warning.h"
#endif
#include <bits/c++config.h>
#include <backward/hashtable.h>
#include <bits/concept_check.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::equal_to;
using std::allocator;
using std::pair;
using std::_Select1st;
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Key, class _Tp, class _HashFn = hash<_Key>,
class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> >
class hash_map
{
private:
typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,
_Select1st<pair<const _Key, _Tp> >,
_EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef _Tp data_type;
typedef _Tp mapped_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Ht::pointer pointer;
typedef typename _Ht::const_pointer const_pointer;
typedef typename _Ht::reference reference;
typedef typename _Ht::const_reference const_reference;
typedef typename _Ht::iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_map()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_map(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_map(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
template<class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_map& __hs)
{ _M_ht.swap(__hs._M_ht); }
template<class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool
operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
iterator
begin()
{ return _M_ht.begin(); }
iterator
end()
{ return _M_ht.end(); }
const_iterator
begin() const
{ return _M_ht.begin(); }
const_iterator
end() const
{ return _M_ht.end(); }
pair<iterator, bool>
insert(const value_type& __obj)
{ return _M_ht.insert_unique(__obj); }
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f, __l); }
pair<iterator, bool>
insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); }
iterator
find(const key_type& __key)
{ return _M_ht.find(__key); }
const_iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
_Tp&
operator[](const key_type& __key)
{ return _M_ht.find_or_insert(value_type(__key, _Tp())).second; }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline bool
operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ return __hm1._M_ht == __hm2._M_ht; }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline bool
operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ return !(__hm1 == __hm2); }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline void
swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
/**
* This is an SGI extension.
* @ingroup SGIextensions
* @doctodo
*/
template<class _Key, class _Tp,
class _HashFn = hash<_Key>,
class _EqualKey = equal_to<_Key>,
class _Alloc = allocator<_Tp> >
class hash_multimap
{
// concept requirements
__glibcxx_class_requires(_Key, _SGIAssignableConcept)
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
__glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept)
__glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)
private:
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,
_Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
_Ht;
_Ht _M_ht;
public:
typedef typename _Ht::key_type key_type;
typedef _Tp data_type;
typedef _Tp mapped_type;
typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type;
typedef typename _Ht::pointer pointer;
typedef typename _Ht::const_pointer const_pointer;
typedef typename _Ht::reference reference;
typedef typename _Ht::const_reference const_reference;
typedef typename _Ht::iterator iterator;
typedef typename _Ht::const_iterator const_iterator;
typedef typename _Ht::allocator_type allocator_type;
hasher
hash_funct() const
{ return _M_ht.hash_funct(); }
key_equal
key_eq() const
{ return _M_ht.key_eq(); }
allocator_type
get_allocator() const
{ return _M_ht.get_allocator(); }
hash_multimap()
: _M_ht(100, hasher(), key_equal(), allocator_type()) {}
explicit
hash_multimap(size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
hash_multimap(size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type()) {}
hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
size_type
size() const
{ return _M_ht.size(); }
size_type
max_size() const
{ return _M_ht.max_size(); }
bool
empty() const
{ return _M_ht.empty(); }
void
swap(hash_multimap& __hs)
{ _M_ht.swap(__hs._M_ht); }
template<class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool
operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
iterator
begin()
{ return _M_ht.begin(); }
iterator
end()
{ return _M_ht.end(); }
const_iterator
begin() const
{ return _M_ht.begin(); }
const_iterator
end() const
{ return _M_ht.end(); }
iterator
insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
template<class _InputIterator>
void
insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
iterator
insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
iterator
find(const key_type& __key)
{ return _M_ht.find(__key); }
const_iterator
find(const key_type& __key) const
{ return _M_ht.find(__key); }
size_type
count(const key_type& __key) const
{ return _M_ht.count(__key); }
pair<iterator, iterator>
equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type
erase(const key_type& __key)
{ return _M_ht.erase(__key); }
void
erase(iterator __it)
{ _M_ht.erase(__it); }
void
erase(iterator __f, iterator __l)
{ _M_ht.erase(__f, __l); }
void
clear()
{ _M_ht.clear(); }
void
resize(size_type __hint)
{ _M_ht.resize(__hint); }
size_type
bucket_count() const
{ return _M_ht.bucket_count(); }
size_type
max_bucket_count() const
{ return _M_ht.max_bucket_count(); }
size_type
elems_in_bucket(size_type __n) const
{ return _M_ht.elems_in_bucket(__n); }
};
template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
{ return __hm1._M_ht == __hm2._M_ht; }
template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
{ return !(__hm1 == __hm2); }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
inline void
swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Specialization of insert_iterator so that it will work for hash_map
// and hash_multimap.
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>
_Container;
_Container* container;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++() { return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
{
protected:
typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
_Container;
_Container* container;
typename _Container::iterator iter;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x)
: container(&__x) {}
insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value)
{
container->insert(__value);
return *this;
}
insert_iterator<_Container>&
operator*()
{ return *this; }
insert_iterator<_Container>&
operator++()
{ return *this; }
insert_iterator<_Container>&
operator++(int)
{ return *this; }
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Versatile string -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/vstring.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/vstring.h}
*/
#ifndef _VSTRING_TCC
#define _VSTRING_TCC 1
#pragma GCC system_header
#include <bits/cxxabi_forced.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
const typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::npos;
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
void
__versa_string<_CharT, _Traits, _Alloc, _Base>::
resize(size_type __n, _CharT __c)
{
const size_type __size = this->size();
if (__size < __n)
this->append(__n - __size, __c);
else if (__n < __size)
this->_M_erase(__n, __size - __n);
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>&
__versa_string<_CharT, _Traits, _Alloc, _Base>::
_M_append(const _CharT* __s, size_type __n)
{
const size_type __len = __n + this->size();
if (__len <= this->capacity() && !this->_M_is_shared())
{
if (__n)
this->_S_copy(this->_M_data() + this->size(), __s, __n);
}
else
this->_M_mutate(this->size(), size_type(0), __s, __n);
this->_M_set_length(__len);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
template<typename _InputIterator>
__versa_string<_CharT, _Traits, _Alloc, _Base>&
__versa_string<_CharT, _Traits, _Alloc, _Base>::
_M_replace_dispatch(const_iterator __i1, const_iterator __i2,
_InputIterator __k1, _InputIterator __k2,
std::__false_type)
{
const __versa_string __s(__k1, __k2);
const size_type __n1 = __i2 - __i1;
return _M_replace(__i1 - _M_ibegin(), __n1, __s._M_data(),
__s.size());
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>&
__versa_string<_CharT, _Traits, _Alloc, _Base>::
_M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
_CharT __c)
{
_M_check_length(__n1, __n2, "__versa_string::_M_replace_aux");
const size_type __old_size = this->size();
const size_type __new_size = __old_size + __n2 - __n1;
if (__new_size <= this->capacity() && !this->_M_is_shared())
{
_CharT* __p = this->_M_data() + __pos1;
const size_type __how_much = __old_size - __pos1 - __n1;
if (__how_much && __n1 != __n2)
this->_S_move(__p + __n2, __p + __n1, __how_much);
}
else
this->_M_mutate(__pos1, __n1, 0, __n2);
if (__n2)
this->_S_assign(this->_M_data() + __pos1, __n2, __c);
this->_M_set_length(__new_size);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>&
__versa_string<_CharT, _Traits, _Alloc, _Base>::
_M_replace(size_type __pos, size_type __len1, const _CharT* __s,
const size_type __len2)
{
_M_check_length(__len1, __len2, "__versa_string::_M_replace");
const size_type __old_size = this->size();
const size_type __new_size = __old_size + __len2 - __len1;
if (__new_size <= this->capacity() && !this->_M_is_shared())
{
_CharT* __p = this->_M_data() + __pos;
const size_type __how_much = __old_size - __pos - __len1;
if (_M_disjunct(__s))
{
if (__how_much && __len1 != __len2)
this->_S_move(__p + __len2, __p + __len1, __how_much);
if (__len2)
this->_S_copy(__p, __s, __len2);
}
else
{
// Work in-place.
if (__len2 && __len2 <= __len1)
this->_S_move(__p, __s, __len2);
if (__how_much && __len1 != __len2)
this->_S_move(__p + __len2, __p + __len1, __how_much);
if (__len2 > __len1)
{
if (__s + __len2 <= __p + __len1)
this->_S_move(__p, __s, __len2);
else if (__s >= __p + __len1)
this->_S_copy(__p, __s + __len2 - __len1, __len2);
else
{
const size_type __nleft = (__p + __len1) - __s;
this->_S_move(__p, __s, __nleft);
this->_S_copy(__p + __nleft, __p + __len2,
__len2 - __nleft);
}
}
}
}
else
this->_M_mutate(__pos, __len1, __s, __len2);
this->_M_set_length(__new_size);
return *this;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{
__versa_string<_CharT, _Traits, _Alloc, _Base> __str;
__str.reserve(__lhs.size() + __rhs.size());
__str.append(__lhs);
__str.append(__rhs);
return __str;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const _CharT* __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{
__glibcxx_requires_string(__lhs);
typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type;
typedef typename __string_type::size_type __size_type;
const __size_type __len = _Traits::length(__lhs);
__string_type __str;
__str.reserve(__len + __rhs.size());
__str.append(__lhs, __len);
__str.append(__rhs);
return __str;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(_CharT __lhs,
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
{
__versa_string<_CharT, _Traits, _Alloc, _Base> __str;
__str.reserve(__rhs.size() + 1);
__str.push_back(__lhs);
__str.append(__rhs);
return __str;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
const _CharT* __rhs)
{
__glibcxx_requires_string(__rhs);
typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type;
typedef typename __string_type::size_type __size_type;
const __size_type __len = _Traits::length(__rhs);
__string_type __str;
__str.reserve(__lhs.size() + __len);
__str.append(__lhs);
__str.append(__rhs, __len);
return __str;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
__versa_string<_CharT, _Traits, _Alloc, _Base>
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
_CharT __rhs)
{
__versa_string<_CharT, _Traits, _Alloc, _Base> __str;
__str.reserve(__lhs.size() + 1);
__str.append(__lhs);
__str.push_back(__rhs);
return __str;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
copy(_CharT* __s, size_type __n, size_type __pos) const
{
_M_check(__pos, "__versa_string::copy");
__n = _M_limit(__pos, __n);
__glibcxx_requires_string_len(__s, __n);
if (__n)
this->_S_copy(__s, this->_M_data() + __pos, __n);
// 21.3.5.7 par 3: do not append null. (good.)
return __n;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__s, __n);
const size_type __size = this->size();
const _CharT* __data = this->_M_data();
if (__n == 0)
return __pos <= __size ? __pos : npos;
if (__n <= __size)
{
for (; __pos <= __size - __n; ++__pos)
if (traits_type::eq(__data[__pos], __s[0])
&& traits_type::compare(__data + __pos + 1,
__s + 1, __n - 1) == 0)
return __pos;
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __ret = npos;
const size_type __size = this->size();
if (__pos < __size)
{
const _CharT* __data = this->_M_data();
const size_type __n = __size - __pos;
const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
if (__p)
__ret = __p - __data;
}
return __ret;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
rfind(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__s, __n);
const size_type __size = this->size();
if (__n <= __size)
{
__pos = std::min(size_type(__size - __n), __pos);
const _CharT* __data = this->_M_data();
do
{
if (traits_type::compare(__data + __pos, __s, __n) == 0)
return __pos;
}
while (__pos-- > 0);
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __size = this->size();
if (__size)
{
if (--__size > __pos)
__size = __pos;
for (++__size; __size-- > 0; )
if (traits_type::eq(this->_M_data()[__size], __c))
return __size;
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__s, __n);
for (; __n && __pos < this->size(); ++__pos)
{
const _CharT* __p = traits_type::find(__s, __n,
this->_M_data()[__pos]);
if (__p)
return __pos;
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__s, __n);
size_type __size = this->size();
if (__size && __n)
{
if (--__size > __pos)
__size = __pos;
do
{
if (traits_type::find(__s, __n, this->_M_data()[__size]))
return __size;
}
while (__size-- != 0);
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__s, __n);
for (; __pos < this->size(); ++__pos)
if (!traits_type::find(__s, __n, this->_M_data()[__pos]))
return __pos;
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
for (; __pos < this->size(); ++__pos)
if (!traits_type::eq(this->_M_data()[__pos], __c))
return __pos;
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_requires_string_len(__s, __n);
size_type __size = this->size();
if (__size)
{
if (--__size > __pos)
__size = __pos;
do
{
if (!traits_type::find(__s, __n, this->_M_data()[__size]))
return __size;
}
while (__size--);
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __size = this->size();
if (__size)
{
if (--__size > __pos)
__size = __pos;
do
{
if (!traits_type::eq(this->_M_data()[__size], __c))
return __size;
}
while (__size--);
}
return npos;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
int
__versa_string<_CharT, _Traits, _Alloc, _Base>::
compare(size_type __pos, size_type __n, const __versa_string& __str) const
{
_M_check(__pos, "__versa_string::compare");
__n = _M_limit(__pos, __n);
const size_type __osize = __str.size();
const size_type __len = std::min(__n, __osize);
int __r = traits_type::compare(this->_M_data() + __pos,
__str.data(), __len);
if (!__r)
__r = this->_S_compare(__n, __osize);
return __r;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
int
__versa_string<_CharT, _Traits, _Alloc, _Base>::
compare(size_type __pos1, size_type __n1, const __versa_string& __str,
size_type __pos2, size_type __n2) const
{
_M_check(__pos1, "__versa_string::compare");
__str._M_check(__pos2, "__versa_string::compare");
__n1 = _M_limit(__pos1, __n1);
__n2 = __str._M_limit(__pos2, __n2);
const size_type __len = std::min(__n1, __n2);
int __r = traits_type::compare(this->_M_data() + __pos1,
__str.data() + __pos2, __len);
if (!__r)
__r = this->_S_compare(__n1, __n2);
return __r;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
int
__versa_string<_CharT, _Traits, _Alloc, _Base>::
compare(const _CharT* __s) const
{
__glibcxx_requires_string(__s);
const size_type __size = this->size();
const size_type __osize = traits_type::length(__s);
const size_type __len = std::min(__size, __osize);
int __r = traits_type::compare(this->_M_data(), __s, __len);
if (!__r)
__r = this->_S_compare(__size, __osize);
return __r;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
int
__versa_string <_CharT, _Traits, _Alloc, _Base>::
compare(size_type __pos, size_type __n1, const _CharT* __s) const
{
__glibcxx_requires_string(__s);
_M_check(__pos, "__versa_string::compare");
__n1 = _M_limit(__pos, __n1);
const size_type __osize = traits_type::length(__s);
const size_type __len = std::min(__n1, __osize);
int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);
if (!__r)
__r = this->_S_compare(__n1, __osize);
return __r;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
int
__versa_string <_CharT, _Traits, _Alloc, _Base>::
compare(size_type __pos, size_type __n1, const _CharT* __s,
size_type __n2) const
{
__glibcxx_requires_string_len(__s, __n2);
_M_check(__pos, "__versa_string::compare");
__n1 = _M_limit(__pos, __n1);
const size_type __len = std::min(__n1, __n2);
int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);
if (!__r)
__r = this->_S_compare(__n1, __n2);
return __r;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __in,
__gnu_cxx::__versa_string<_CharT, _Traits,
_Alloc, _Base>& __str)
{
typedef basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>
__string_type;
typedef typename __istream_type::int_type __int_type;
typedef typename __string_type::size_type __size_type;
typedef ctype<_CharT> __ctype_type;
typedef typename __ctype_type::ctype_base __ctype_base;
__size_type __extracted = 0;
typename __ios_base::iostate __err = __ios_base::goodbit;
typename __istream_type::sentry __cerb(__in, false);
if (__cerb)
{
__try
{
// Avoid reallocation for common case.
__str.erase();
_CharT __buf[128];
__size_type __len = 0;
const streamsize __w = __in.width();
const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)
: __str.max_size();
const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
const __int_type __eof = _Traits::eof();
__int_type __c = __in.rdbuf()->sgetc();
while (__extracted < __n
&& !_Traits::eq_int_type(__c, __eof)
&& !__ct.is(__ctype_base::space,
_Traits::to_char_type(__c)))
{
if (__len == sizeof(__buf) / sizeof(_CharT))
{
__str.append(__buf, sizeof(__buf) / sizeof(_CharT));
__len = 0;
}
__buf[__len++] = _Traits::to_char_type(__c);
++__extracted;
__c = __in.rdbuf()->snextc();
}
__str.append(__buf, __len);
if (_Traits::eq_int_type(__c, __eof))
__err |= __ios_base::eofbit;
__in.width(0);
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(__ios_base::badbit);
}
}
// 211. operator>>(istream&, string&) doesn't set failbit
if (!__extracted)
__err |= __ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
template<typename _CharT, typename _Traits, typename _Alloc,
template <typename, typename, typename> class _Base>
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __in,
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
_CharT __delim)
{
typedef basic_istream<_CharT, _Traits> __istream_type;
typedef typename __istream_type::ios_base __ios_base;
typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>
__string_type;
typedef typename __istream_type::int_type __int_type;
typedef typename __string_type::size_type __size_type;
__size_type __extracted = 0;
const __size_type __n = __str.max_size();
typename __ios_base::iostate __err = __ios_base::goodbit;
typename __istream_type::sentry __cerb(__in, true);
if (__cerb)
{
__try
{
// Avoid reallocation for common case.
__str.erase();
_CharT __buf[128];
__size_type __len = 0;
const __int_type __idelim = _Traits::to_int_type(__delim);
const __int_type __eof = _Traits::eof();
__int_type __c = __in.rdbuf()->sgetc();
while (__extracted < __n
&& !_Traits::eq_int_type(__c, __eof)
&& !_Traits::eq_int_type(__c, __idelim))
{
if (__len == sizeof(__buf) / sizeof(_CharT))
{
__str.append(__buf, sizeof(__buf) / sizeof(_CharT));
__len = 0;
}
__buf[__len++] = _Traits::to_char_type(__c);
++__extracted;
__c = __in.rdbuf()->snextc();
}
__str.append(__buf, __len);
if (_Traits::eq_int_type(__c, __eof))
__err |= __ios_base::eofbit;
else if (_Traits::eq_int_type(__c, __idelim))
{
++__extracted;
__in.rdbuf()->sbumpc();
}
else
__err |= __ios_base::failbit;
}
__catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
__catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 91. Description of operator>> and getline() for string<>
// might cause endless loop
__in._M_setstate(__ios_base::badbit);
}
}
if (!__extracted)
__err |= __ios_base::failbit;
if (__err)
__in.setstate(__err);
return __in;
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // _VSTRING_TCC
// filebuf with encoding state type -*- C++ -*-
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/enc_filebuf.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _EXT_ENC_FILEBUF_H
#define _EXT_ENC_FILEBUF_H 1
#include <fstream>
#include <locale>
#include <ext/codecvt_specializations.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// class enc_filebuf.
template<typename _CharT>
class enc_filebuf
: public std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >
{
public:
typedef encoding_char_traits<_CharT> traits_type;
typedef typename traits_type::state_type state_type;
typedef typename traits_type::pos_type pos_type;
enc_filebuf(state_type& __state)
: std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >()
{ this->_M_state_beg = __state; }
private:
// concept requirements:
// Set state type to something useful.
// Something more than copyconstructible is needed here, so
// require default and copy constructible + assignment operator.
__glibcxx_class_requires(state_type, _SGIAssignableConcept)
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
// Reference-counted versatile string base -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/rc_string_base.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/vstring.h}
*/
#ifndef _RC_STRING_BASE_H
#define _RC_STRING_BASE_H 1
#include <ext/atomicity.h>
#include <bits/stl_iterator_base_funcs.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* Documentation? What's that?
* Nathan Myers <ncm@cantrip.org>.
*
* A string looks like this:
*
* @code
* [_Rep]
* _M_length
* [__rc_string_base<char_type>] _M_capacity
* _M_dataplus _M_refcount
* _M_p ----------------> unnamed array of char_type
* @endcode
*
* Where the _M_p points to the first character in the string, and
* you cast it to a pointer-to-_Rep and subtract 1 to get a
* pointer to the header.
*
* This approach has the enormous advantage that a string object
* requires only one allocation. All the ugliness is confined
* within a single pair of inline functions, which each compile to
* a single @a add instruction: _Rep::_M_refdata(), and
* __rc_string_base::_M_rep(); and the allocation function which gets a
* block of raw bytes and with room enough and constructs a _Rep
* object at the front.
*
* The reason you want _M_data pointing to the character array and
* not the _Rep is so that the debugger can see the string
* contents. (Probably we should add a non-inline member to get
* the _Rep for the debugger to use, so users can check the actual
* string length.)
*
* Note that the _Rep object is a POD so that you can have a
* static <em>empty string</em> _Rep object already @a constructed before
* static constructors have run. The reference-count encoding is
* chosen so that a 0 indicates one reference, so you never try to
* destroy the empty-string _Rep object.
*
* All but the last paragraph is considered pretty conventional
* for a C++ string implementation.
*/
template<typename _CharT, typename _Traits, typename _Alloc>
class __rc_string_base
: protected __vstring_utility<_CharT, _Traits, _Alloc>
{
public:
typedef _Traits traits_type;
typedef typename _Traits::char_type value_type;
typedef _Alloc allocator_type;
typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
typedef typename _CharT_alloc_type::size_type size_type;
private:
// _Rep: string representation
// Invariants:
// 1. String really contains _M_length + 1 characters: due to 21.3.4
// must be kept null-terminated.
// 2. _M_capacity >= _M_length
// Allocated memory is always (_M_capacity + 1) * sizeof(_CharT).
// 3. _M_refcount has three states:
// -1: leaked, one reference, no ref-copies allowed, non-const.
// 0: one reference, non-const.
// n>0: n + 1 references, operations require a lock, const.
// 4. All fields == 0 is an empty string, given the extra storage
// beyond-the-end for a null terminator; thus, the shared
// empty string representation needs no constructor.
struct _Rep
{
union
{
struct
{
size_type _M_length;
size_type _M_capacity;
_Atomic_word _M_refcount;
} _M_info;
// Only for alignment purposes.
_CharT _M_align;
};
typedef typename _Alloc::template rebind<_Rep>::other _Rep_alloc_type;
_CharT*
_M_refdata() throw()
{ return reinterpret_cast<_CharT*>(this + 1); }
_CharT*
_M_refcopy() throw()
{
__atomic_add_dispatch(&_M_info._M_refcount, 1);
return _M_refdata();
} // XXX MT
void
_M_set_length(size_type __n)
{
_M_info._M_refcount = 0; // One reference.
_M_info._M_length = __n;
// grrr. (per 21.3.4)
// You cannot leave those LWG people alone for a second.
traits_type::assign(_M_refdata()[__n], _CharT());
}
// Create & Destroy
static _Rep*
_S_create(size_type, size_type, const _Alloc&);
void
_M_destroy(const _Alloc&) throw();
_CharT*
_M_clone(const _Alloc&, size_type __res = 0);
};
struct _Rep_empty
: public _Rep
{
_CharT _M_terminal;
};
static _Rep_empty _S_empty_rep;
// The maximum number of individual char_type elements of an
// individual string is determined by _S_max_size. This is the
// value that will be returned by max_size(). (Whereas npos
// is the maximum number of bytes the allocator can allocate.)
// If one was to divvy up the theoretical largest size string,
// with a terminating character and m _CharT elements, it'd
// look like this:
// npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)
// + sizeof(_Rep) - 1
// (NB: last two terms for rounding reasons, see _M_create below)
// Solving for m:
// m = ((npos - 2 * sizeof(_Rep) + 1) / sizeof(_CharT)) - 1
// In addition, this implementation halves this amount.
enum { _S_max_size = (((static_cast<size_type>(-1) - 2 * sizeof(_Rep)
+ 1) / sizeof(_CharT)) - 1) / 2 };
// Data Member (private):
mutable typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus;
void
_M_data(_CharT* __p)
{ _M_dataplus._M_p = __p; }
_Rep*
_M_rep() const
{ return &((reinterpret_cast<_Rep*>(_M_data()))[-1]); }
_CharT*
_M_grab(const _Alloc& __alloc) const
{
return (!_M_is_leaked() && _M_get_allocator() == __alloc)
? _M_rep()->_M_refcopy() : _M_rep()->_M_clone(__alloc);
}
void
_M_dispose()
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_rep()->_M_info.
_M_refcount);
if (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount,
-1) <= 0)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_rep()->_M_info.
_M_refcount);
_M_rep()->_M_destroy(_M_get_allocator());
}
} // XXX MT
bool
_M_is_leaked() const
{ return _M_rep()->_M_info._M_refcount < 0; }
void
_M_set_sharable()
{ _M_rep()->_M_info._M_refcount = 0; }
void
_M_leak_hard();
// _S_construct_aux is used to implement the 21.3.1 para 15 which
// requires special behaviour if _InIterator is an integral type
template<typename _InIterator>
static _CharT*
_S_construct_aux(_InIterator __beg, _InIterator __end,
const _Alloc& __a, std::__false_type)
{
typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
return _S_construct(__beg, __end, __a, _Tag());
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
static _CharT*
_S_construct_aux(_Integer __beg, _Integer __end,
const _Alloc& __a, std::__true_type)
{ return _S_construct_aux_2(static_cast<size_type>(__beg),
__end, __a); }
static _CharT*
_S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a)
{ return _S_construct(__req, __c, __a); }
template<typename _InIterator>
static _CharT*
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)
{
typedef typename std::__is_integer<_InIterator>::__type _Integral;
return _S_construct_aux(__beg, __end, __a, _Integral());
}
// For Input Iterators, used in istreambuf_iterators, etc.
template<typename _InIterator>
static _CharT*
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
std::input_iterator_tag);
// For forward_iterators up to random_access_iterators, used for
// string::iterator, _CharT*, etc.
template<typename _FwdIterator>
static _CharT*
_S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a,
std::forward_iterator_tag);
static _CharT*
_S_construct(size_type __req, _CharT __c, const _Alloc& __a);
public:
size_type
_M_max_size() const
{ return size_type(_S_max_size); }
_CharT*
_M_data() const
{ return _M_dataplus._M_p; }
size_type
_M_length() const
{ return _M_rep()->_M_info._M_length; }
size_type
_M_capacity() const
{ return _M_rep()->_M_info._M_capacity; }
bool
_M_is_shared() const
{ return _M_rep()->_M_info._M_refcount > 0; }
void
_M_set_leaked()
{ _M_rep()->_M_info._M_refcount = -1; }
void
_M_leak() // for use in begin() & non-const op[]
{
if (!_M_is_leaked())
_M_leak_hard();
}
void
_M_set_length(size_type __n)
{ _M_rep()->_M_set_length(__n); }
__rc_string_base()
: _M_dataplus(_S_empty_rep._M_refcopy()) { }
__rc_string_base(const _Alloc& __a);
__rc_string_base(const __rc_string_base& __rcs);
#if __cplusplus >= 201103L
__rc_string_base(__rc_string_base&& __rcs)
: _M_dataplus(__rcs._M_dataplus)
{ __rcs._M_data(_S_empty_rep._M_refcopy()); }
#endif
__rc_string_base(size_type __n, _CharT __c, const _Alloc& __a);
template<typename _InputIterator>
__rc_string_base(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a);
~__rc_string_base()
{ _M_dispose(); }
allocator_type&
_M_get_allocator()
{ return _M_dataplus; }
const allocator_type&
_M_get_allocator() const
{ return _M_dataplus; }
void
_M_swap(__rc_string_base& __rcs);
void
_M_assign(const __rc_string_base& __rcs);
void
_M_reserve(size_type __res);
void
_M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
size_type __len2);
void
_M_erase(size_type __pos, size_type __n);
void
_M_clear()
{
_M_dispose();
_M_data(_S_empty_rep._M_refcopy());
}
bool
_M_compare(const __rc_string_base&) const
{ return false; }
};
template<typename _CharT, typename _Traits, typename _Alloc>
typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep_empty
__rc_string_base<_CharT, _Traits, _Alloc>::_S_empty_rep;
template<typename _CharT, typename _Traits, typename _Alloc>
typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep*
__rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
_S_create(size_type __capacity, size_type __old_capacity,
const _Alloc& __alloc)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 83. String::npos vs. string::max_size()
if (__capacity > size_type(_S_max_size))
std::__throw_length_error(__N("__rc_string_base::_Rep::_S_create"));
// The standard places no restriction on allocating more memory
// than is strictly needed within this layer at the moment or as
// requested by an explicit application call to reserve().
// Many malloc implementations perform quite poorly when an
// application attempts to allocate memory in a stepwise fashion
// growing each allocation size by only 1 char. Additionally,
// it makes little sense to allocate less linear memory than the
// natural blocking size of the malloc implementation.
// Unfortunately, we would need a somewhat low-level calculation
// with tuned parameters to get this perfect for any particular
// malloc implementation. Fortunately, generalizations about
// common features seen among implementations seems to suffice.
// __pagesize need not match the actual VM page size for good
// results in practice, thus we pick a common value on the low
// side. __malloc_header_size is an estimate of the amount of
// overhead per memory allocation (in practice seen N * sizeof
// (void*) where N is 0, 2 or 4). According to folklore,
// picking this value on the high side is better than
// low-balling it (especially when this algorithm is used with
// malloc implementations that allocate memory blocks rounded up
// to a size which is a power of 2).
const size_type __pagesize = 4096;
const size_type __malloc_header_size = 4 * sizeof(void*);
// The below implements an exponential growth policy, necessary to
// meet amortized linear time requirements of the library: see
// http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
{
__capacity = 2 * __old_capacity;
// Never allocate a string bigger than _S_max_size.
if (__capacity > size_type(_S_max_size))
__capacity = size_type(_S_max_size);
}
// NB: Need an array of char_type[__capacity], plus a terminating
// null char_type() element, plus enough for the _Rep data structure,
// plus sizeof(_Rep) - 1 to upper round to a size multiple of
// sizeof(_Rep).
// Whew. Seemingly so needy, yet so elemental.
size_type __size = ((__capacity + 1) * sizeof(_CharT)
+ 2 * sizeof(_Rep) - 1);
const size_type __adj_size = __size + __malloc_header_size;
if (__adj_size > __pagesize && __capacity > __old_capacity)
{
const size_type __extra = __pagesize - __adj_size % __pagesize;
__capacity += __extra / sizeof(_CharT);
if (__capacity > size_type(_S_max_size))
__capacity = size_type(_S_max_size);
__size = (__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1;
}
// NB: Might throw, but no worries about a leak, mate: _Rep()
// does not throw.
_Rep* __place = _Rep_alloc_type(__alloc).allocate(__size / sizeof(_Rep));
_Rep* __p = new (__place) _Rep;
__p->_M_info._M_capacity = __capacity;
return __p;
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
_M_destroy(const _Alloc& __a) throw ()
{
const size_type __size = ((_M_info._M_capacity + 1) * sizeof(_CharT)
+ 2 * sizeof(_Rep) - 1);
_Rep_alloc_type(__a).deallocate(this, __size / sizeof(_Rep));
}
template<typename _CharT, typename _Traits, typename _Alloc>
_CharT*
__rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
_M_clone(const _Alloc& __alloc, size_type __res)
{
// Requested capacity of the clone.
const size_type __requested_cap = _M_info._M_length + __res;
_Rep* __r = _Rep::_S_create(__requested_cap, _M_info._M_capacity,
__alloc);
if (_M_info._M_length)
__rc_string_base::_S_copy(__r->_M_refdata(), _M_refdata(), _M_info._M_length);
__r->_M_set_length(_M_info._M_length);
return __r->_M_refdata();
}
template<typename _CharT, typename _Traits, typename _Alloc>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(const _Alloc& __a)
: _M_dataplus(__a, _S_construct(size_type(), _CharT(), __a)) { }
template<typename _CharT, typename _Traits, typename _Alloc>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(const __rc_string_base& __rcs)
: _M_dataplus(__rcs._M_get_allocator(),
__rcs._M_grab(__rcs._M_get_allocator())) { }
template<typename _CharT, typename _Traits, typename _Alloc>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(size_type __n, _CharT __c, const _Alloc& __a)
: _M_dataplus(__a, _S_construct(__n, __c, __a)) { }
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InputIterator>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a)
: _M_dataplus(__a, _S_construct(__beg, __end, __a)) { }
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
_M_leak_hard()
{
if (_M_is_shared())
_M_erase(0, 0);
_M_set_leaked();
}
// NB: This is the special case for Input Iterators, used in
// istreambuf_iterators, etc.
// Input Iterators have a cost structure very different from
// pointers, calling for a different coding style.
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InIterator>
_CharT*
__rc_string_base<_CharT, _Traits, _Alloc>::
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
std::input_iterator_tag)
{
if (__beg == __end && __a == _Alloc())
return _S_empty_rep._M_refcopy();
// Avoid reallocation for common case.
_CharT __buf[128];
size_type __len = 0;
while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))
{
__buf[__len++] = *__beg;
++__beg;
}
_Rep* __r = _Rep::_S_create(__len, size_type(0), __a);
_S_copy(__r->_M_refdata(), __buf, __len);
__try
{
while (__beg != __end)
{
if (__len == __r->_M_info._M_capacity)
{
// Allocate more space.
_Rep* __another = _Rep::_S_create(__len + 1, __len, __a);
_S_copy(__another->_M_refdata(), __r->_M_refdata(), __len);
__r->_M_destroy(__a);
__r = __another;
}
__r->_M_refdata()[__len++] = *__beg;
++__beg;
}
}
__catch(...)
{
__r->_M_destroy(__a);
__throw_exception_again;
}
__r->_M_set_length(__len);
return __r->_M_refdata();
}
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InIterator>
_CharT*
__rc_string_base<_CharT, _Traits, _Alloc>::
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
std::forward_iterator_tag)
{
if (__beg == __end && __a == _Alloc())
return _S_empty_rep._M_refcopy();
// NB: Not required, but considered best practice.
if (__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("__rc_string_base::"
"_S_construct null not valid"));
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
__end));
// Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
__try
{ __rc_string_base::_S_copy_chars(__r->_M_refdata(), __beg, __end); }
__catch(...)
{
__r->_M_destroy(__a);
__throw_exception_again;
}
__r->_M_set_length(__dnew);
return __r->_M_refdata();
}
template<typename _CharT, typename _Traits, typename _Alloc>
_CharT*
__rc_string_base<_CharT, _Traits, _Alloc>::
_S_construct(size_type __n, _CharT __c, const _Alloc& __a)
{
if (__n == 0 && __a == _Alloc())
return _S_empty_rep._M_refcopy();
// Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
if (__n)
__rc_string_base::_S_assign(__r->_M_refdata(), __n, __c);
__r->_M_set_length(__n);
return __r->_M_refdata();
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
_M_swap(__rc_string_base& __rcs)
{
if (_M_is_leaked())
_M_set_sharable();
if (__rcs._M_is_leaked())
__rcs._M_set_sharable();
_CharT* __tmp = _M_data();
_M_data(__rcs._M_data());
__rcs._M_data(__tmp);
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 431. Swapping containers with unequal allocators.
std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(),
__rcs._M_get_allocator());
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
_M_assign(const __rc_string_base& __rcs)
{
if (_M_rep() != __rcs._M_rep())
{
_CharT* __tmp = __rcs._M_grab(_M_get_allocator());
_M_dispose();
_M_data(__tmp);
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
_M_reserve(size_type __res)
{
// Make sure we don't shrink below the current size.
if (__res < _M_length())
__res = _M_length();
if (__res != _M_capacity() || _M_is_shared())
{
_CharT* __tmp = _M_rep()->_M_clone(_M_get_allocator(),
__res - _M_length());
_M_dispose();
_M_data(__tmp);
}
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
_M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
size_type __len2)
{
const size_type __how_much = _M_length() - __pos - __len1;
_Rep* __r = _Rep::_S_create(_M_length() + __len2 - __len1,
_M_capacity(), _M_get_allocator());
if (__pos)
this->_S_copy(__r->_M_refdata(), _M_data(), __pos);
if (__s && __len2)
this->_S_copy(__r->_M_refdata() + __pos, __s, __len2);
if (__how_much)
this->_S_copy(__r->_M_refdata() + __pos + __len2,
_M_data() + __pos + __len1, __how_much);
_M_dispose();
_M_data(__r->_M_refdata());
}
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
_M_erase(size_type __pos, size_type __n)
{
const size_type __new_size = _M_length() - __n;
const size_type __how_much = _M_length() - __pos - __n;
if (_M_is_shared())
{
// Must reallocate.
_Rep* __r = _Rep::_S_create(__new_size, _M_capacity(),
_M_get_allocator());
if (__pos)
this->_S_copy(__r->_M_refdata(), _M_data(), __pos);
if (__how_much)
this->_S_copy(__r->_M_refdata() + __pos,
_M_data() + __pos + __n, __how_much);
_M_dispose();
_M_data(__r->_M_refdata());
}
else if (__how_much && __n)
{
// Work in-place.
this->_S_move(_M_data() + __pos,
_M_data() + __pos + __n, __how_much);
}
_M_rep()->_M_set_length(__new_size);
}
template<>
inline bool
__rc_string_base<char, std::char_traits<char>,
std::allocator<char> >::
_M_compare(const __rc_string_base& __rcs) const
{
if (_M_rep() == __rcs._M_rep())
return true;
return false;
}
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
inline bool
__rc_string_base<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::
_M_compare(const __rc_string_base& __rcs) const
{
if (_M_rep() == __rcs._M_rep())
return true;
return false;
}
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _RC_STRING_BASE_H */
// SGI's rope class implementation -*- C++ -*-
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ropeimpl.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/rope}
*/
#include <cstdio>
#include <ostream>
#include <bits/functexcept.h>
#include <ext/algorithm> // For copy_n and lexicographical_compare_3way
#include <ext/memory> // For uninitialized_copy_n
#include <ext/numeric> // For power
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::printf;
using std::basic_ostream;
using std::__throw_length_error;
using std::_Destroy;
using std::__uninitialized_fill_n_a;
// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
// Results in a valid buf_ptr if the iterator can be legitimately
// dereferenced.
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
size_t __leaf_pos = __x._M_leaf_pos;
size_t __pos = __x._M_current_pos;
switch(__leaf->_M_tag)
{
case __detail::_S_leaf:
__x._M_buf_start = ((_Rope_RopeLeaf<_CharT, _Alloc>*)__leaf)->_M_data;
__x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
__x._M_buf_end = __x._M_buf_start + __leaf->_M_size;
break;
case __detail::_S_function:
case __detail::_S_substringfn:
{
size_t __len = _S_iterator_buf_len;
size_t __buf_start_pos = __leaf_pos;
size_t __leaf_end = __leaf_pos + __leaf->_M_size;
char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT,
_Alloc>*)__leaf)->_M_fn;
if (__buf_start_pos + __len <= __pos)
{
__buf_start_pos = __pos - __len / 4;
if (__buf_start_pos + __len > __leaf_end)
__buf_start_pos = __leaf_end - __len;
}
if (__buf_start_pos + __len > __leaf_end)
__len = __leaf_end - __buf_start_pos;
(*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf);
__x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos);
__x._M_buf_start = __x._M_tmp_buf;
__x._M_buf_end = __x._M_tmp_buf + __len;
}
break;
default:
break;
}
}
// Set path and buffer inside a rope iterator. We assume that
// pos and root are already set.
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1];
const _RopeRep* __curr_rope;
int __curr_depth = -1; /* index into path */
size_t __curr_start_pos = 0;
size_t __pos = __x._M_current_pos;
unsigned char __dirns = 0; // Bit vector marking right turns in the path
if (__pos >= __x._M_root->_M_size)
{
__x._M_buf_ptr = 0;
return;
}
__curr_rope = __x._M_root;
if (0 != __curr_rope->_M_c_string)
{
/* Treat the root as a leaf. */
__x._M_buf_start = __curr_rope->_M_c_string;
__x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size;
__x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
__x._M_path_end[0] = __curr_rope;
__x._M_leaf_index = 0;
__x._M_leaf_pos = 0;
return;
}
for(;;)
{
++__curr_depth;
__path[__curr_depth] = __curr_rope;
switch(__curr_rope->_M_tag)
{
case __detail::_S_leaf:
case __detail::_S_function:
case __detail::_S_substringfn:
__x._M_leaf_pos = __curr_start_pos;
goto done;
case __detail::_S_concat:
{
_Rope_RopeConcatenation<_CharT, _Alloc>* __c =
(_Rope_RopeConcatenation<_CharT, _Alloc>*)__curr_rope;
_RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size;
__dirns <<= 1;
if (__pos >= __curr_start_pos + __left_len)
{
__dirns |= 1;
__curr_rope = __c->_M_right;
__curr_start_pos += __left_len;
}
else
__curr_rope = __left;
}
break;
}
}
done:
// Copy last section of path into _M_path_end.
{
int __i = -1;
int __j = __curr_depth + 1 - int(_S_path_cache_len);
if (__j < 0) __j = 0;
while (__j <= __curr_depth)
__x._M_path_end[++__i] = __path[__j++];
__x._M_leaf_index = __i;
}
__x._M_path_directions = __dirns;
_S_setbuf(__x);
}
// Specialized version of the above. Assumes that
// the path cache is valid for the previous position.
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
int __current_index = __x._M_leaf_index;
const _RopeRep* __current_node = __x._M_path_end[__current_index];
size_t __len = __current_node->_M_size;
size_t __node_start_pos = __x._M_leaf_pos;
unsigned char __dirns = __x._M_path_directions;
_Rope_RopeConcatenation<_CharT, _Alloc>* __c;
if (__x._M_current_pos - __node_start_pos < __len)
{
/* More stuff in this leaf, we just didn't cache it. */
_S_setbuf(__x);
return;
}
// node_start_pos is starting position of last_node.
while (--__current_index >= 0)
{
if (!(__dirns & 1) /* Path turned left */)
break;
__current_node = __x._M_path_end[__current_index];
__c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;
// Otherwise we were in the right child. Thus we should pop
// the concatenation node.
__node_start_pos -= __c->_M_left->_M_size;
__dirns >>= 1;
}
if (__current_index < 0)
{
// We underflowed the cache. Punt.
_S_setcache(__x);
return;
}
__current_node = __x._M_path_end[__current_index];
__c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;
// current_node is a concatenation node. We are positioned on the first
// character in its right child.
// node_start_pos is starting position of current_node.
__node_start_pos += __c->_M_left->_M_size;
__current_node = __c->_M_right;
__x._M_path_end[++__current_index] = __current_node;
__dirns |= 1;
while (__detail::_S_concat == __current_node->_M_tag)
{
++__current_index;
if (int(_S_path_cache_len) == __current_index)
{
int __i;
for (__i = 0; __i < int(_S_path_cache_len) - 1; __i++)
__x._M_path_end[__i] = __x._M_path_end[__i+1];
--__current_index;
}
__current_node =
((_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node)->_M_left;
__x._M_path_end[__current_index] = __current_node;
__dirns <<= 1;
// node_start_pos is unchanged.
}
__x._M_leaf_index = __current_index;
__x._M_leaf_pos = __node_start_pos;
__x._M_path_directions = __dirns;
_S_setbuf(__x);
}
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_M_incr(size_t __n)
{
_M_current_pos += __n;
if (0 != _M_buf_ptr)
{
size_t __chars_left = _M_buf_end - _M_buf_ptr;
if (__chars_left > __n)
_M_buf_ptr += __n;
else if (__chars_left == __n)
{
_M_buf_ptr += __n;
_S_setcache_for_incr(*this);
}
else
_M_buf_ptr = 0;
}
}
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_M_decr(size_t __n)
{
if (0 != _M_buf_ptr)
{
size_t __chars_left = _M_buf_ptr - _M_buf_start;
if (__chars_left >= __n)
_M_buf_ptr -= __n;
else
_M_buf_ptr = 0;
}
_M_current_pos -= __n;
}
template <class _CharT, class _Alloc>
void
_Rope_iterator<_CharT, _Alloc>::
_M_check()
{
if (_M_root_rope->_M_tree_ptr != this->_M_root)
{
// _Rope was modified. Get things fixed up.
_RopeRep::_S_unref(this->_M_root);
this->_M_root = _M_root_rope->_M_tree_ptr;
_RopeRep::_S_ref(this->_M_root);
this->_M_buf_ptr = 0;
}
}
template <class _CharT, class _Alloc>
inline
_Rope_const_iterator<_CharT, _Alloc>::
_Rope_const_iterator(const _Rope_iterator<_CharT, _Alloc>& __x)
: _Rope_iterator_base<_CharT, _Alloc>(__x)
{ }
template <class _CharT, class _Alloc>
inline
_Rope_iterator<_CharT, _Alloc>::
_Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos)
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
_M_root_rope(&__r)
{ _RopeRep::_S_ref(this->_M_root); }
template <class _CharT, class _Alloc>
inline size_t
rope<_CharT, _Alloc>::
_S_char_ptr_len(const _CharT* __s)
{
const _CharT* __p = __s;
while (!_S_is0(*__p))
++__p;
return (__p - __s);
}
#ifndef __GC
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
_M_free_c_string()
{
_CharT* __cstr = _M_c_string;
if (0 != __cstr)
{
size_t __size = this->_M_size + 1;
_Destroy(__cstr, __cstr + __size, _M_get_allocator());
this->_Data_deallocate(__cstr, __size);
}
}
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
_S_free_string(_CharT* __s, size_t __n, allocator_type& __a)
{
if (!_S_is_basic_char_type((_CharT*)0))
_Destroy(__s, __s + __n, __a);
// This has to be a static member, so this gets a bit messy
__a.deallocate(__s,
_Rope_RopeLeaf<_CharT, _Alloc>::_S_rounded_up_size(__n));
}
// There are several reasons for not doing this with virtual destructors
// and a class specific delete operator:
// - A class specific delete operator can't easily get access to
// allocator instances if we need them.
// - Any virtual function would need a 4 or byte vtable pointer;
// this only requires a one byte tag per object.
template <class _CharT, class _Alloc>
void
_Rope_RopeRep<_CharT, _Alloc>::
_M_free_tree()
{
switch(_M_tag)
{
case __detail::_S_leaf:
{
_Rope_RopeLeaf<_CharT, _Alloc>* __l
= (_Rope_RopeLeaf<_CharT, _Alloc>*)this;
__l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();
this->_L_deallocate(__l, 1);
break;
}
case __detail::_S_concat:
{
_Rope_RopeConcatenation<_CharT,_Alloc>* __c
= (_Rope_RopeConcatenation<_CharT, _Alloc>*)this;
__c->_Rope_RopeConcatenation<_CharT, _Alloc>::
~_Rope_RopeConcatenation();
this->_C_deallocate(__c, 1);
break;
}
case __detail::_S_function:
{
_Rope_RopeFunction<_CharT, _Alloc>* __f
= (_Rope_RopeFunction<_CharT, _Alloc>*)this;
__f->_Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();
this->_F_deallocate(__f, 1);
break;
}
case __detail::_S_substringfn:
{
_Rope_RopeSubstring<_CharT, _Alloc>* __ss =
(_Rope_RopeSubstring<_CharT, _Alloc>*)this;
__ss->_Rope_RopeSubstring<_CharT, _Alloc>::
~_Rope_RopeSubstring();
this->_S_deallocate(__ss, 1);
break;
}
}
}
#else
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
_S_free_string(const _CharT*, size_t, allocator_type)
{ }
#endif
// Concatenate a C string onto a leaf rope by copying the rope data.
// Used for short ropes.
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>::
_S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
{
size_t __old_len = __r->_M_size;
_CharT* __new_data = (_CharT*)
rope::_Data_allocate(_S_rounded_up_size(__old_len + __len));
_RopeLeaf* __result;
uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
uninitialized_copy_n(__iter, __len, __new_data + __old_len);
_S_cond_store_eos(__new_data[__old_len + __len]);
__try
{
__result = _S_new_RopeLeaf(__new_data, __old_len + __len,
__r->_M_get_allocator());
}
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
__r->_M_get_allocator());
__throw_exception_again;
}
return __result;
}
#ifndef __GC
// As above, but it's OK to clobber original if refcount is 1
template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>::
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,
size_t __len)
{
if (__r->_M_ref_count > 1)
return _S_leaf_concat_char_iter(__r, __iter, __len);
size_t __old_len = __r->_M_size;
if (_S_allocated_capacity(__old_len) >= __old_len + __len)
{
// The space has been partially initialized for the standard
// character types. But that doesn't matter for those types.
uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len);
if (_S_is_basic_char_type((_CharT*)0))
_S_cond_store_eos(__r->_M_data[__old_len + __len]);
else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string)
{
__r->_M_free_c_string();
__r->_M_c_string = 0;
}
__r->_M_size = __old_len + __len;
__r->_M_ref_count = 2;
return __r;
}
else
{
_RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
return __result;
}
}
#endif
// Assumes left and right are not 0.
// Does not increment (nor decrement on exception) child reference counts.
// Result has ref count 1.
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_tree_concat(_RopeRep* __left, _RopeRep* __right)
{
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
__left->
_M_get_allocator());
size_t __depth = __result->_M_depth;
if (__depth > 20
&& (__result->_M_size < 1000
|| __depth > size_t(__detail::_S_max_rope_depth)))
{
_RopeRep* __balanced;
__try
{
__balanced = _S_balance(__result);
__result->_M_unref_nonnil();
}
__catch(...)
{
rope::_C_deallocate(__result,1);
__throw_exception_again;
}
// In case of exception, we need to deallocate
// otherwise dangling result node. But caller
// still owns its children. Thus unref is
// inappropriate.
return __balanced;
}
else
return __result;
}
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_concat_char_iter(_RopeRep* __r, const _CharT*__s, size_t __slen)
{
_RopeRep* __result;
if (0 == __slen)
{
_S_ref(__r);
return __r;
}
if (0 == __r)
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
__r->_M_get_allocator());
if (__r->_M_tag == __detail::_S_leaf
&& __r->_M_size + __slen <= size_t(_S_copy_max))
{
__result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
return __result;
}
if (__detail::_S_concat == __r->_M_tag
&& __detail::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag)
{
_RopeLeaf* __right =
(_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
if (__right->_M_size + __slen <= size_t(_S_copy_max))
{
_RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
_RopeRep* __nright =
_S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
__left->_M_ref_nonnil();
__try
{ __result = _S_tree_concat(__left, __nright); }
__catch(...)
{
_S_unref(__left);
_S_unref(__nright);
__throw_exception_again;
}
return __result;
}
}
_RopeRep* __nright =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
__try
{
__r->_M_ref_nonnil();
__result = _S_tree_concat(__r, __nright);
}
__catch(...)
{
_S_unref(__r);
_S_unref(__nright);
__throw_exception_again;
}
return __result;
}
#ifndef __GC
template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::
_S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s, size_t __slen)
{
_RopeRep* __result;
if (0 == __r)
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
__r->_M_get_allocator());
size_t __count = __r->_M_ref_count;
size_t __orig_size = __r->_M_size;
if (__count > 1)
return _S_concat_char_iter(__r, __s, __slen);
if (0 == __slen)
{
__r->_M_ref_count = 2; // One more than before
return __r;
}
if (__orig_size + __slen <= size_t(_S_copy_max)
&& __detail::_S_leaf == __r->_M_tag)
{
__result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s,
__slen);
return __result;
}
if (__detail::_S_concat == __r->_M_tag)
{
_RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)
__r)->_M_right);
if (__detail::_S_leaf == __right->_M_tag
&& __right->_M_size + __slen <= size_t(_S_copy_max))
{
_RopeRep* __new_right =
_S_destr_leaf_concat_char_iter(__right, __s, __slen);
if (__right == __new_right)
__new_right->_M_ref_count = 1;
else
__right->_M_unref_nonnil();
__r->_M_ref_count = 2; // One more than before.
((_RopeConcatenation*)__r)->_M_right = __new_right;
__r->_M_size = __orig_size + __slen;
if (0 != __r->_M_c_string)
{
__r->_M_free_c_string();
__r->_M_c_string = 0;
}
return __r;
}
}
_RopeRep* __right =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
__r->_M_ref_nonnil();
__try
{ __result = _S_tree_concat(__r, __right); }
__catch(...)
{
_S_unref(__r);
_S_unref(__right);
__throw_exception_again;
}
return __result;
}
#endif /* !__GC */
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_concat(_RopeRep* __left, _RopeRep* __right)
{
if (0 == __left)
{
_S_ref(__right);
return __right;
}
if (0 == __right)
{
__left->_M_ref_nonnil();
return __left;
}
if (__detail::_S_leaf == __right->_M_tag)
{
if (__detail::_S_leaf == __left->_M_tag)
{
if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max))
return _S_leaf_concat_char_iter((_RopeLeaf*)__left,
((_RopeLeaf*)__right)->_M_data,
__right->_M_size);
}
else if (__detail::_S_concat == __left->_M_tag
&& __detail::_S_leaf == ((_RopeConcatenation*)
__left)->_M_right->_M_tag)
{
_RopeLeaf* __leftright =
(_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);
if (__leftright->_M_size
+ __right->_M_size <= size_t(_S_copy_max))
{
_RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;
_RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
((_RopeLeaf*)
__right)->
_M_data,
__right->_M_size);
__leftleft->_M_ref_nonnil();
__try
{ return(_S_tree_concat(__leftleft, __rest)); }
__catch(...)
{
_S_unref(__leftleft);
_S_unref(__rest);
__throw_exception_again;
}
}
}
}
__left->_M_ref_nonnil();
__right->_M_ref_nonnil();
__try
{ return(_S_tree_concat(__left, __right)); }
__catch(...)
{
_S_unref(__left);
_S_unref(__right);
__throw_exception_again;
}
}
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_substring(_RopeRep* __base, size_t __start, size_t __endp1)
{
if (0 == __base)
return 0;
size_t __len = __base->_M_size;
size_t __adj_endp1;
const size_t __lazy_threshold = 128;
if (__endp1 >= __len)
{
if (0 == __start)
{
__base->_M_ref_nonnil();
return __base;
}
else
__adj_endp1 = __len;
}
else
__adj_endp1 = __endp1;
switch(__base->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__base;
_RopeRep* __left = __c->_M_left;
_RopeRep* __right = __c->_M_right;
size_t __left_len = __left->_M_size;
_RopeRep* __result;
if (__adj_endp1 <= __left_len)
return _S_substring(__left, __start, __endp1);
else if (__start >= __left_len)
return _S_substring(__right, __start - __left_len,
__adj_endp1 - __left_len);
_Self_destruct_ptr __left_result(_S_substring(__left,
__start,
__left_len));
_Self_destruct_ptr __right_result(_S_substring(__right, 0,
__endp1
- __left_len));
__result = _S_concat(__left_result, __right_result);
return __result;
}
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__base;
_RopeLeaf* __result;
size_t __result_len;
if (__start >= __adj_endp1)
return 0;
__result_len = __adj_endp1 - __start;
if (__result_len > __lazy_threshold)
goto lazy;
#ifdef __GC
const _CharT* __section = __l->_M_data + __start;
__result = _S_new_RopeLeaf(__section, __result_len,
__base->_M_get_allocator());
__result->_M_c_string = 0; // Not eos terminated.
#else
// We should sometimes create substring node instead.
__result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start,
__result_len,
__base->
_M_get_allocator());
#endif
return __result;
}
case __detail::_S_substringfn:
// Avoid introducing multiple layers of substring nodes.
{
_RopeSubstring* __old = (_RopeSubstring*)__base;
size_t __result_len;
if (__start >= __adj_endp1)
return 0;
__result_len = __adj_endp1 - __start;
if (__result_len > __lazy_threshold)
{
_RopeSubstring* __result =
_S_new_RopeSubstring(__old->_M_base,
__start + __old->_M_start,
__adj_endp1 - __start,
__base->_M_get_allocator());
return __result;
} // *** else fall through: ***
}
case __detail::_S_function:
{
_RopeFunction* __f = (_RopeFunction*)__base;
_CharT* __section;
size_t __result_len;
if (__start >= __adj_endp1)
return 0;
__result_len = __adj_endp1 - __start;
if (__result_len > __lazy_threshold)
goto lazy;
__section = (_CharT*)
rope::_Data_allocate(_S_rounded_up_size(__result_len));
__try
{ (*(__f->_M_fn))(__start, __result_len, __section); }
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__section, __result_len,
__base->_M_get_allocator());
__throw_exception_again;
}
_S_cond_store_eos(__section[__result_len]);
return _S_new_RopeLeaf(__section, __result_len,
__base->_M_get_allocator());
}
}
lazy:
{
// Create substring node.
return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
__base->_M_get_allocator());
}
}
template<class _CharT>
class _Rope_flatten_char_consumer
: public _Rope_char_consumer<_CharT>
{
private:
_CharT* _M_buf_ptr;
public:
_Rope_flatten_char_consumer(_CharT* __buffer)
{ _M_buf_ptr = __buffer; }
~_Rope_flatten_char_consumer() {}
bool
operator()(const _CharT* __leaf, size_t __n)
{
uninitialized_copy_n(__leaf, __n, _M_buf_ptr);
_M_buf_ptr += __n;
return true;
}
};
template<class _CharT>
class _Rope_find_char_char_consumer
: public _Rope_char_consumer<_CharT>
{
private:
_CharT _M_pattern;
public:
size_t _M_count; // Number of nonmatching characters
_Rope_find_char_char_consumer(_CharT __p)
: _M_pattern(__p), _M_count(0) {}
~_Rope_find_char_char_consumer() {}
bool
operator()(const _CharT* __leaf, size_t __n)
{
size_t __i;
for (__i = 0; __i < __n; __i++)
{
if (__leaf[__i] == _M_pattern)
{
_M_count += __i;
return false;
}
}
_M_count += __n; return true;
}
};
template<class _CharT, class _Traits>
// Here _CharT is both the stream and rope character type.
class _Rope_insert_char_consumer
: public _Rope_char_consumer<_CharT>
{
private:
typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
_Insert_ostream& _M_o;
public:
_Rope_insert_char_consumer(_Insert_ostream& __writer)
: _M_o(__writer) {}
~_Rope_insert_char_consumer() { }
// Caller is presumed to own the ostream
bool operator() (const _CharT* __leaf, size_t __n);
// Returns true to continue traversal.
};
template<class _CharT, class _Traits>
bool
_Rope_insert_char_consumer<_CharT, _Traits>::
operator()(const _CharT* __leaf, size_t __n)
{
size_t __i;
// We assume that formatting is set up correctly for each element.
for (__i = 0; __i < __n; __i++)
_M_o.put(__leaf[__i]);
return true;
}
template <class _CharT, class _Alloc>
bool
rope<_CharT, _Alloc>::
_S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c,
const _RopeRep* __r, size_t __begin, size_t __end)
{
if (0 == __r)
return true;
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __conc = (_RopeConcatenation*)__r;
_RopeRep* __left = __conc->_M_left;
size_t __left_len = __left->_M_size;
if (__begin < __left_len)
{
size_t __left_end = std::min(__left_len, __end);
if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
return false;
}
if (__end > __left_len)
{
_RopeRep* __right = __conc->_M_right;
size_t __right_start = std::max(__left_len, __begin);
if (!_S_apply_to_pieces(__c, __right,
__right_start - __left_len,
__end - __left_len))
return false;
}
}
return true;
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
return __c(__l->_M_data + __begin, __end - __begin);
}
case __detail::_S_function:
case __detail::_S_substringfn:
{
_RopeFunction* __f = (_RopeFunction*)__r;
size_t __len = __end - __begin;
bool __result;
_CharT* __buffer =
(_CharT*)_Alloc().allocate(__len * sizeof(_CharT));
__try
{
(*(__f->_M_fn))(__begin, __len, __buffer);
__result = __c(__buffer, __len);
_Alloc().deallocate(__buffer, __len * sizeof(_CharT));
}
__catch(...)
{
_Alloc().deallocate(__buffer, __len * sizeof(_CharT));
__throw_exception_again;
}
return __result;
}
default:
return false;
}
}
template<class _CharT, class _Traits>
inline void
_Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
{
char __f = __o.fill();
size_t __i;
for (__i = 0; __i < __n; __i++)
__o.put(__f);
}
template <class _CharT>
inline bool
_Rope_is_simple(_CharT*)
{ return false; }
inline bool
_Rope_is_simple(char*)
{ return true; }
inline bool
_Rope_is_simple(wchar_t*)
{ return true; }
template<class _CharT, class _Traits, class _Alloc>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __o,
const rope<_CharT, _Alloc>& __r)
{
size_t __w = __o.width();
bool __left = bool(__o.flags() & std::ios::left);
size_t __pad_len;
size_t __rope_len = __r.size();
_Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
bool __is_simple = _Rope_is_simple((_CharT*)0);
if (__rope_len < __w)
__pad_len = __w - __rope_len;
else
__pad_len = 0;
if (!__is_simple)
__o.width(__w / __rope_len);
__try
{
if (__is_simple && !__left && __pad_len > 0)
_Rope_fill(__o, __pad_len);
__r.apply_to_pieces(0, __r.size(), __c);
if (__is_simple && __left && __pad_len > 0)
_Rope_fill(__o, __pad_len);
if (!__is_simple)
__o.width(__w);
}
__catch(...)
{
if (!__is_simple)
__o.width(__w);
__throw_exception_again;
}
return __o;
}
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
_S_flatten(_RopeRep* __r, size_t __start, size_t __len,
_CharT* __buffer)
{
_Rope_flatten_char_consumer<_CharT> __c(__buffer);
_S_apply_to_pieces(__c, __r, __start, __start + __len);
return(__buffer + __len);
}
template <class _CharT, class _Alloc>
size_t
rope<_CharT, _Alloc>::
find(_CharT __pattern, size_t __start) const
{
_Rope_find_char_char_consumer<_CharT> __c(__pattern);
_S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());
size_type __result_pos = __start + __c._M_count;
#ifndef __STL_OLD_ROPE_SEMANTICS
if (__result_pos == size())
__result_pos = npos;
#endif
return __result_pos;
}
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
_S_flatten(_RopeRep* __r, _CharT* __buffer)
{
if (0 == __r)
return __buffer;
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
_RopeRep* __right = __c->_M_right;
_CharT* __rest = _S_flatten(__left, __buffer);
return _S_flatten(__right, __rest);
}
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
return copy_n(__l->_M_data, __l->_M_size, __buffer).second;
}
case __detail::_S_function:
case __detail::_S_substringfn:
// We don't yet do anything with substring nodes.
// This needs to be fixed before ropefiles will work well.
{
_RopeFunction* __f = (_RopeFunction*)__r;
(*(__f->_M_fn))(0, __f->_M_size, __buffer);
return __buffer + __f->_M_size;
}
default:
return 0;
}
}
// This needs work for _CharT != char
template <class _CharT, class _Alloc>
void
rope<_CharT, _Alloc>::
_S_dump(_RopeRep* __r, int __indent)
{
for (int __i = 0; __i < __indent; __i++)
putchar(' ');
if (0 == __r)
{
printf("NULL\n");
return;
}
if (__detail::_S_concat == __r->_M_tag)
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
_RopeRep* __right = __c->_M_right;
#ifdef __GC
printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n",
__r, __r->_M_depth, __r->_M_size,
__r->_M_is_balanced? "" : "not");
#else
printf("Concatenation %p (rc = %ld, depth = %d, "
"len = %ld, %s balanced)\n",
__r, __r->_M_ref_count, __r->_M_depth, __r->_M_size,
__r->_M_is_balanced? "" : "not");
#endif
_S_dump(__left, __indent + 2);
_S_dump(__right, __indent + 2);
return;
}
else
{
const char* __kind;
switch (__r->_M_tag)
{
case __detail::_S_leaf:
__kind = "Leaf";
break;
case __detail::_S_function:
__kind = "Function";
break;
case __detail::_S_substringfn:
__kind = "Function representing substring";
break;
default:
__kind = "(corrupted kind field!)";
}
#ifdef __GC
printf("%s %p (depth = %d, len = %ld) ",
__kind, __r, __r->_M_depth, __r->_M_size);
#else
printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
__kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size);
#endif
if (_S_is_one_byte_char_type((_CharT*)0))
{
const int __max_len = 40;
_Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
_CharT __buffer[__max_len + 1];
bool __too_big = __r->_M_size > __prefix->_M_size;
_S_flatten(__prefix, __buffer);
__buffer[__prefix->_M_size] = _S_eos((_CharT*)0);
printf("%s%s\n", (char*)__buffer,
__too_big? "...\n" : "\n");
}
else
printf("\n");
}
}
template <class _CharT, class _Alloc>
const unsigned long
rope<_CharT, _Alloc>::
_S_min_len[int(__detail::_S_max_rope_depth) + 1] = {
/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,
/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,
/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,
/* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368,
/* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811,
/* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309,
/* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352,
/* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155,
/* 39 */165580141, /* 40 */267914296, /* 41 */433494437,
/* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903,
/* 45 */2971215073u };
// These are Fibonacci numbers < 2**32.
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_balance(_RopeRep* __r)
{
_RopeRep* __forest[int(__detail::_S_max_rope_depth) + 1];
_RopeRep* __result = 0;
int __i;
// Invariant:
// The concatenation of forest in descending order is equal to __r.
// __forest[__i]._M_size >= _S_min_len[__i]
// __forest[__i]._M_depth = __i
// References from forest are included in refcount.
for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)
__forest[__i] = 0;
__try
{
_S_add_to_forest(__r, __forest);
for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)
if (0 != __forest[__i])
{
#ifndef __GC
_Self_destruct_ptr __old(__result);
#endif
__result = _S_concat(__forest[__i], __result);
__forest[__i]->_M_unref_nonnil();
#if !defined(__GC) && __cpp_exceptions
__forest[__i] = 0;
#endif
}
}
__catch(...)
{
for(__i = 0; __i <= int(__detail::_S_max_rope_depth); __i++)
_S_unref(__forest[__i]);
__throw_exception_again;
}
if (__result->_M_depth > int(__detail::_S_max_rope_depth))
__throw_length_error(__N("rope::_S_balance"));
return(__result);
}
template <class _CharT, class _Alloc>
void
rope<_CharT, _Alloc>::
_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
{
if (__r->_M_is_balanced)
{
_S_add_leaf_to_forest(__r, __forest);
return;
}
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_S_add_to_forest(__c->_M_left, __forest);
_S_add_to_forest(__c->_M_right, __forest);
}
}
template <class _CharT, class _Alloc>
void
rope<_CharT, _Alloc>::
_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
{
_RopeRep* __insertee; // included in refcount
_RopeRep* __too_tiny = 0; // included in refcount
int __i; // forest[0..__i-1] is empty
size_t __s = __r->_M_size;
for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i)
{
if (0 != __forest[__i])
{
#ifndef __GC
_Self_destruct_ptr __old(__too_tiny);
#endif
__too_tiny = _S_concat_and_set_balanced(__forest[__i],
__too_tiny);
__forest[__i]->_M_unref_nonnil();
__forest[__i] = 0;
}
}
{
#ifndef __GC
_Self_destruct_ptr __old(__too_tiny);
#endif
__insertee = _S_concat_and_set_balanced(__too_tiny, __r);
}
// Too_tiny dead, and no longer included in refcount.
// Insertee is live and included.
for (;; ++__i)
{
if (0 != __forest[__i])
{
#ifndef __GC
_Self_destruct_ptr __old(__insertee);
#endif
__insertee = _S_concat_and_set_balanced(__forest[__i],
__insertee);
__forest[__i]->_M_unref_nonnil();
__forest[__i] = 0;
}
if (__i == int(__detail::_S_max_rope_depth)
|| __insertee->_M_size < _S_min_len[__i+1])
{
__forest[__i] = __insertee;
// refcount is OK since __insertee is now dead.
return;
}
}
}
template <class _CharT, class _Alloc>
_CharT
rope<_CharT, _Alloc>::
_S_fetch(_RopeRep* __r, size_type __i)
{
__GC_CONST _CharT* __cstr = __r->_M_c_string;
if (0 != __cstr)
return __cstr[__i];
for(;;)
{
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size;
if (__i >= __left_len)
{
__i -= __left_len;
__r = __c->_M_right;
}
else
__r = __left;
}
break;
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
return __l->_M_data[__i];
}
case __detail::_S_function:
case __detail::_S_substringfn:
{
_RopeFunction* __f = (_RopeFunction*)__r;
_CharT __result;
(*(__f->_M_fn))(__i, 1, &__result);
return __result;
}
}
}
}
#ifndef __GC
// Return a uniquely referenced character slot for the given
// position, or 0 if that's not possible.
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
_S_fetch_ptr(_RopeRep* __r, size_type __i)
{
_RopeRep* __clrstack[__detail::_S_max_rope_depth];
size_t __csptr = 0;
for(;;)
{
if (__r->_M_ref_count > 1)
return 0;
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size;
if (__c->_M_c_string != 0)
__clrstack[__csptr++] = __c;
if (__i >= __left_len)
{
__i -= __left_len;
__r = __c->_M_right;
}
else
__r = __left;
}
break;
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
__clrstack[__csptr++] = __l;
while (__csptr > 0)
{
-- __csptr;
_RopeRep* __d = __clrstack[__csptr];
__d->_M_free_c_string();
__d->_M_c_string = 0;
}
return __l->_M_data + __i;
}
case __detail::_S_function:
case __detail::_S_substringfn:
return 0;
}
}
}
#endif /* __GC */
// The following could be implemented trivially using
// lexicographical_compare_3way.
// We do a little more work to avoid dealing with rope iterators for
// flat strings.
template <class _CharT, class _Alloc>
int
rope<_CharT, _Alloc>::
_S_compare (const _RopeRep* __left, const _RopeRep* __right)
{
size_t __left_len;
size_t __right_len;
if (0 == __right)
return 0 != __left;
if (0 == __left)
return -1;
__left_len = __left->_M_size;
__right_len = __right->_M_size;
if (__detail::_S_leaf == __left->_M_tag)
{
_RopeLeaf* __l = (_RopeLeaf*) __left;
if (__detail::_S_leaf == __right->_M_tag)
{
_RopeLeaf* __r = (_RopeLeaf*) __right;
return lexicographical_compare_3way(__l->_M_data,
__l->_M_data + __left_len,
__r->_M_data, __r->_M_data
+ __right_len);
}
else
{
const_iterator __rstart(__right, 0);
const_iterator __rend(__right, __right_len);
return lexicographical_compare_3way(__l->_M_data, __l->_M_data
+ __left_len,
__rstart, __rend);
}
}
else
{
const_iterator __lstart(__left, 0);
const_iterator __lend(__left, __left_len);
if (__detail::_S_leaf == __right->_M_tag)
{
_RopeLeaf* __r = (_RopeLeaf*) __right;
return lexicographical_compare_3way(__lstart, __lend,
__r->_M_data, __r->_M_data
+ __right_len);
}
else
{
const_iterator __rstart(__right, 0);
const_iterator __rend(__right, __right_len);
return lexicographical_compare_3way(__lstart, __lend,
__rstart, __rend);
}
}
}
// Assignment to reference proxies.
template <class _CharT, class _Alloc>
_Rope_char_ref_proxy<_CharT, _Alloc>&
_Rope_char_ref_proxy<_CharT, _Alloc>::
operator=(_CharT __c)
{
_RopeRep* __old = _M_root->_M_tree_ptr;
#ifndef __GC
// First check for the case in which everything is uniquely
// referenced. In that case we can do this destructively.
_CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
if (0 != __ptr)
{
*__ptr = __c;
return *this;
}
#endif
_Self_destruct_ptr __left(_My_rope::_S_substring(__old, 0, _M_pos));
_Self_destruct_ptr __right(_My_rope::_S_substring(__old, _M_pos + 1,
__old->_M_size));
_Self_destruct_ptr __result_left(_My_rope::
_S_destr_concat_char_iter(__left,
&__c, 1));
_RopeRep* __result = _My_rope::_S_concat(__result_left, __right);
#ifndef __GC
_RopeRep::_S_unref(__old);
#endif
_M_root->_M_tree_ptr = __result;
return *this;
}
template <class _CharT, class _Alloc>
inline _Rope_char_ref_proxy<_CharT, _Alloc>::
operator _CharT() const
{
if (_M_current_valid)
return _M_current;
else
return _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos);
}
template <class _CharT, class _Alloc>
_Rope_char_ptr_proxy<_CharT, _Alloc>
_Rope_char_ref_proxy<_CharT, _Alloc>::
operator&() const
{ return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); }
template <class _CharT, class _Alloc>
rope<_CharT, _Alloc>::
rope(size_t __n, _CharT __c, const allocator_type& __a)
: _Base(__a)
{
rope<_CharT,_Alloc> __result;
const size_t __exponentiate_threshold = 32;
size_t __exponent;
size_t __rest;
_CharT* __rest_buffer;
_RopeRep* __remainder;
rope<_CharT, _Alloc> __remainder_rope;
if (0 == __n)
return;
__exponent = __n / __exponentiate_threshold;
__rest = __n % __exponentiate_threshold;
if (0 == __rest)
__remainder = 0;
else
{
__rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest));
__uninitialized_fill_n_a(__rest_buffer, __rest, __c,
_M_get_allocator());
_S_cond_store_eos(__rest_buffer[__rest]);
__try
{ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest,
_M_get_allocator()); }
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest,
_M_get_allocator());
__throw_exception_again;
}
}
__remainder_rope._M_tree_ptr = __remainder;
if (__exponent != 0)
{
_CharT* __base_buffer =
this->_Data_allocate(_S_rounded_up_size(__exponentiate_threshold));
_RopeLeaf* __base_leaf;
rope __base_rope;
__uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,
_M_get_allocator());
_S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
__try
{
__base_leaf = _S_new_RopeLeaf(__base_buffer,
__exponentiate_threshold,
_M_get_allocator());
}
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__base_buffer,
__exponentiate_threshold,
_M_get_allocator());
__throw_exception_again;
}
__base_rope._M_tree_ptr = __base_leaf;
if (1 == __exponent)
__result = __base_rope;
else
__result = power(__base_rope, __exponent,
_Rope_Concat_fn<_CharT, _Alloc>());
if (0 != __remainder)
__result += __remainder_rope;
}
else
__result = __remainder_rope;
this->_M_tree_ptr = __result._M_tree_ptr;
this->_M_tree_ptr->_M_ref_nonnil();
}
template<class _CharT, class _Alloc>
_CharT
rope<_CharT, _Alloc>::_S_empty_c_str[1];
template<class _CharT, class _Alloc>
const _CharT*
rope<_CharT, _Alloc>::
c_str() const
{
if (0 == this->_M_tree_ptr)
{
_S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant,
// but probably fast.
return _S_empty_c_str;
}
__gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock);
__GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
if (0 == __result)
{
size_t __s = size();
__result = this->_Data_allocate(__s + 1);
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
this->_M_tree_ptr->_M_c_string = __result;
}
__gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock);
return(__result);
}
template<class _CharT, class _Alloc>
const _CharT* rope<_CharT, _Alloc>::
replace_with_c_str()
{
if (0 == this->_M_tree_ptr)
{
_S_empty_c_str[0] = _S_eos((_CharT*)0);
return _S_empty_c_str;
}
__GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string;
if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag
&& 0 != __old_c_string)
return(__old_c_string);
size_t __s = size();
_CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s));
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
this->_M_tree_ptr->_M_unref_nonnil();
this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s,
this->_M_get_allocator());
return(__result);
}
// Algorithm specializations. More should be added.
template<class _Rope_iterator> // was templated on CharT and Alloc
void // VC++ workaround
_Rope_rotate(_Rope_iterator __first,
_Rope_iterator __middle,
_Rope_iterator __last)
{
typedef typename _Rope_iterator::value_type _CharT;
typedef typename _Rope_iterator::_allocator_type _Alloc;
rope<_CharT, _Alloc>& __r(__first.container());
rope<_CharT, _Alloc> __prefix = __r.substr(0, __first.index());
rope<_CharT, _Alloc> __suffix =
__r.substr(__last.index(), __r.size() - __last.index());
rope<_CharT, _Alloc> __part1 =
__r.substr(__middle.index(), __last.index() - __middle.index());
rope<_CharT, _Alloc> __part2 =
__r.substr(__first.index(), __middle.index() - __first.index());
__r = __prefix;
__r += __part1;
__r += __part2;
__r += __suffix;
}
#if !defined(__GNUC__)
// Appears to confuse g++
inline void
rotate(_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __first,
_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __middle,
_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __last)
{ _Rope_rotate(__first, __middle, __last); }
#endif
# if 0
// Probably not useful for several reasons:
// - for SGIs 7.1 compiler and probably some others,
// this forces lots of rope<wchar_t, ...> instantiations, creating a
// code bloat and compile time problem. (Fixed in 7.2.)
// - wchar_t is 4 bytes wide on most UNIX platforms, making it
// unattractive for unicode strings. Unsigned short may be a better
// character type.
inline void
rotate(_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __first,
_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __middle,
_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __last)
{ _Rope_rotate(__first, __middle, __last); }
# endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// Random number extensions -*- C++ -*-
// Copyright (C) 2012-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/random
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _EXT_RANDOM
#define _EXT_RANDOM 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <random>
#include <algorithm>
#include <array>
#include <ext/cmath>
#ifdef __SSE2__
# include <emmintrin.h>
#endif
#if defined(_GLIBCXX_USE_C99_STDINT_TR1) && defined(UINT32_C)
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/* Mersenne twister implementation optimized for vector operations.
*
* Reference: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
*/
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
class simd_fast_mersenne_twister_engine
{
static_assert(std::is_unsigned<_UIntType>::value, "template argument "
"substituting _UIntType not an unsigned integral type");
static_assert(__sr1 < 32, "first right shift too large");
static_assert(__sr2 < 16, "second right shift too large");
static_assert(__sl1 < 32, "first left shift too large");
static_assert(__sl2 < 16, "second left shift too large");
public:
typedef _UIntType result_type;
private:
static constexpr size_t m_w = sizeof(result_type) * 8;
static constexpr size_t _M_nstate = __m / 128 + 1;
static constexpr size_t _M_nstate32 = _M_nstate * 4;
static_assert(std::is_unsigned<_UIntType>::value, "template argument "
"substituting _UIntType not an unsigned integral type");
static_assert(__pos1 < _M_nstate, "POS1 not smaller than state size");
static_assert(16 % sizeof(_UIntType) == 0,
"UIntType size must divide 16");
public:
static constexpr size_t state_size = _M_nstate * (16
/ sizeof(result_type));
static constexpr result_type default_seed = 5489u;
// constructors and member function
explicit
simd_fast_mersenne_twister_engine(result_type __sd = default_seed)
{ seed(__sd); }
template<typename _Sseq, typename = typename
std::enable_if<!std::is_same<_Sseq,
simd_fast_mersenne_twister_engine>::value>
::type>
explicit
simd_fast_mersenne_twister_engine(_Sseq& __q)
{ seed(__q); }
void
seed(result_type __sd = default_seed);
template<typename _Sseq>
typename std::enable_if<std::is_class<_Sseq>::value>::type
seed(_Sseq& __q);
static constexpr result_type
min()
{ return 0; }
static constexpr result_type
max()
{ return std::numeric_limits<result_type>::max(); }
void
discard(unsigned long long __z);
result_type
operator()()
{
if (__builtin_expect(_M_pos >= state_size, 0))
_M_gen_rand();
return _M_stateT[_M_pos++];
}
template<typename _UIntType_2, size_t __m_2,
size_t __pos1_2, size_t __sl1_2, size_t __sl2_2,
size_t __sr1_2, size_t __sr2_2,
uint32_t __msk1_2, uint32_t __msk2_2,
uint32_t __msk3_2, uint32_t __msk4_2,
uint32_t __parity1_2, uint32_t __parity2_2,
uint32_t __parity3_2, uint32_t __parity4_2>
friend bool
operator==(const simd_fast_mersenne_twister_engine<_UIntType_2,
__m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2,
__msk1_2, __msk2_2, __msk3_2, __msk4_2,
__parity1_2, __parity2_2, __parity3_2, __parity4_2>& __lhs,
const simd_fast_mersenne_twister_engine<_UIntType_2,
__m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2,
__msk1_2, __msk2_2, __msk3_2, __msk4_2,
__parity1_2, __parity2_2, __parity3_2, __parity4_2>& __rhs);
template<typename _UIntType_2, size_t __m_2,
size_t __pos1_2, size_t __sl1_2, size_t __sl2_2,
size_t __sr1_2, size_t __sr2_2,
uint32_t __msk1_2, uint32_t __msk2_2,
uint32_t __msk3_2, uint32_t __msk4_2,
uint32_t __parity1_2, uint32_t __parity2_2,
uint32_t __parity3_2, uint32_t __parity4_2,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::simd_fast_mersenne_twister_engine
<_UIntType_2,
__m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2,
__msk1_2, __msk2_2, __msk3_2, __msk4_2,
__parity1_2, __parity2_2, __parity3_2, __parity4_2>& __x);
template<typename _UIntType_2, size_t __m_2,
size_t __pos1_2, size_t __sl1_2, size_t __sl2_2,
size_t __sr1_2, size_t __sr2_2,
uint32_t __msk1_2, uint32_t __msk2_2,
uint32_t __msk3_2, uint32_t __msk4_2,
uint32_t __parity1_2, uint32_t __parity2_2,
uint32_t __parity3_2, uint32_t __parity4_2,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType_2,
__m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2,
__msk1_2, __msk2_2, __msk3_2, __msk4_2,
__parity1_2, __parity2_2, __parity3_2, __parity4_2>& __x);
private:
union
{
#ifdef __SSE2__
__m128i _M_state[_M_nstate];
#endif
#ifdef __ARM_NEON
#ifdef __aarch64__
__Uint32x4_t _M_state[_M_nstate];
#endif
#endif
uint32_t _M_state32[_M_nstate32];
result_type _M_stateT[state_size];
} __attribute__ ((__aligned__ (16)));
size_t _M_pos;
void _M_gen_rand(void);
void _M_period_certification();
};
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
size_t __sr1, size_t __sr2,
uint32_t __msk1, uint32_t __msk2,
uint32_t __msk3, uint32_t __msk4,
uint32_t __parity1, uint32_t __parity2,
uint32_t __parity3, uint32_t __parity4>
inline bool
operator!=(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3,
__msk4, __parity1, __parity2, __parity3, __parity4>& __lhs,
const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
__m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3,
__msk4, __parity1, __parity2, __parity3, __parity4>& __rhs)
{ return !(__lhs == __rhs); }
/* Definitions for the SIMD-oriented Fast Mersenne Twister as defined
* in the C implementation by Daito and Matsumoto, as both a 32-bit
* and 64-bit version.
*/
typedef simd_fast_mersenne_twister_engine<uint32_t, 607, 2,
15, 3, 13, 3,
0xfdff37ffU, 0xef7f3f7dU,
0xff777b7dU, 0x7ff7fb2fU,
0x00000001U, 0x00000000U,
0x00000000U, 0x5986f054U>
sfmt607;
typedef simd_fast_mersenne_twister_engine<uint64_t, 607, 2,
15, 3, 13, 3,
0xfdff37ffU, 0xef7f3f7dU,
0xff777b7dU, 0x7ff7fb2fU,
0x00000001U, 0x00000000U,
0x00000000U, 0x5986f054U>
sfmt607_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 1279, 7,
14, 3, 5, 1,
0xf7fefffdU, 0x7fefcfffU,
0xaff3ef3fU, 0xb5ffff7fU,
0x00000001U, 0x00000000U,
0x00000000U, 0x20000000U>
sfmt1279;
typedef simd_fast_mersenne_twister_engine<uint64_t, 1279, 7,
14, 3, 5, 1,
0xf7fefffdU, 0x7fefcfffU,
0xaff3ef3fU, 0xb5ffff7fU,
0x00000001U, 0x00000000U,
0x00000000U, 0x20000000U>
sfmt1279_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 2281, 12,
19, 1, 5, 1,
0xbff7ffbfU, 0xfdfffffeU,
0xf7ffef7fU, 0xf2f7cbbfU,
0x00000001U, 0x00000000U,
0x00000000U, 0x41dfa600U>
sfmt2281;
typedef simd_fast_mersenne_twister_engine<uint64_t, 2281, 12,
19, 1, 5, 1,
0xbff7ffbfU, 0xfdfffffeU,
0xf7ffef7fU, 0xf2f7cbbfU,
0x00000001U, 0x00000000U,
0x00000000U, 0x41dfa600U>
sfmt2281_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 4253, 17,
20, 1, 7, 1,
0x9f7bffffU, 0x9fffff5fU,
0x3efffffbU, 0xfffff7bbU,
0xa8000001U, 0xaf5390a3U,
0xb740b3f8U, 0x6c11486dU>
sfmt4253;
typedef simd_fast_mersenne_twister_engine<uint64_t, 4253, 17,
20, 1, 7, 1,
0x9f7bffffU, 0x9fffff5fU,
0x3efffffbU, 0xfffff7bbU,
0xa8000001U, 0xaf5390a3U,
0xb740b3f8U, 0x6c11486dU>
sfmt4253_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 11213, 68,
14, 3, 7, 3,
0xeffff7fbU, 0xffffffefU,
0xdfdfbfffU, 0x7fffdbfdU,
0x00000001U, 0x00000000U,
0xe8148000U, 0xd0c7afa3U>
sfmt11213;
typedef simd_fast_mersenne_twister_engine<uint64_t, 11213, 68,
14, 3, 7, 3,
0xeffff7fbU, 0xffffffefU,
0xdfdfbfffU, 0x7fffdbfdU,
0x00000001U, 0x00000000U,
0xe8148000U, 0xd0c7afa3U>
sfmt11213_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 19937, 122,
18, 1, 11, 1,
0xdfffffefU, 0xddfecb7fU,
0xbffaffffU, 0xbffffff6U,
0x00000001U, 0x00000000U,
0x00000000U, 0x13c9e684U>
sfmt19937;
typedef simd_fast_mersenne_twister_engine<uint64_t, 19937, 122,
18, 1, 11, 1,
0xdfffffefU, 0xddfecb7fU,
0xbffaffffU, 0xbffffff6U,
0x00000001U, 0x00000000U,
0x00000000U, 0x13c9e684U>
sfmt19937_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 44497, 330,
5, 3, 9, 3,
0xeffffffbU, 0xdfbebfffU,
0xbfbf7befU, 0x9ffd7bffU,
0x00000001U, 0x00000000U,
0xa3ac4000U, 0xecc1327aU>
sfmt44497;
typedef simd_fast_mersenne_twister_engine<uint64_t, 44497, 330,
5, 3, 9, 3,
0xeffffffbU, 0xdfbebfffU,
0xbfbf7befU, 0x9ffd7bffU,
0x00000001U, 0x00000000U,
0xa3ac4000U, 0xecc1327aU>
sfmt44497_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 86243, 366,
6, 7, 19, 1,
0xfdbffbffU, 0xbff7ff3fU,
0xfd77efffU, 0xbf9ff3ffU,
0x00000001U, 0x00000000U,
0x00000000U, 0xe9528d85U>
sfmt86243;
typedef simd_fast_mersenne_twister_engine<uint64_t, 86243, 366,
6, 7, 19, 1,
0xfdbffbffU, 0xbff7ff3fU,
0xfd77efffU, 0xbf9ff3ffU,
0x00000001U, 0x00000000U,
0x00000000U, 0xe9528d85U>
sfmt86243_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 132049, 110,
19, 1, 21, 1,
0xffffbb5fU, 0xfb6ebf95U,
0xfffefffaU, 0xcff77fffU,
0x00000001U, 0x00000000U,
0xcb520000U, 0xc7e91c7dU>
sfmt132049;
typedef simd_fast_mersenne_twister_engine<uint64_t, 132049, 110,
19, 1, 21, 1,
0xffffbb5fU, 0xfb6ebf95U,
0xfffefffaU, 0xcff77fffU,
0x00000001U, 0x00000000U,
0xcb520000U, 0xc7e91c7dU>
sfmt132049_64;
typedef simd_fast_mersenne_twister_engine<uint32_t, 216091, 627,
11, 3, 10, 1,
0xbff7bff7U, 0xbfffffffU,
0xbffffa7fU, 0xffddfbfbU,
0xf8000001U, 0x89e80709U,
0x3bd2b64bU, 0x0c64b1e4U>
sfmt216091;
typedef simd_fast_mersenne_twister_engine<uint64_t, 216091, 627,
11, 3, 10, 1,
0xbff7bff7U, 0xbfffffffU,
0xbffffa7fU, 0xffddfbfbU,
0xf8000001U, 0x89e80709U,
0x3bd2b64bU, 0x0c64b1e4U>
sfmt216091_64;
#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/**
* @brief A beta continuous distribution for random numbers.
*
* The formula for the beta probability density function is:
* @f[
* p(x|\alpha,\beta) = \frac{1}{B(\alpha,\beta)}
* x^{\alpha - 1} (1 - x)^{\beta - 1}
* @f]
*/
template<typename _RealType = double>
class beta_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef beta_distribution<_RealType> distribution_type;
friend class beta_distribution<_RealType>;
explicit
param_type(_RealType __alpha_val = _RealType(1),
_RealType __beta_val = _RealType(1))
: _M_alpha(__alpha_val), _M_beta(__beta_val)
{
__glibcxx_assert(_M_alpha > _RealType(0));
__glibcxx_assert(_M_beta > _RealType(0));
}
_RealType
alpha() const
{ return _M_alpha; }
_RealType
beta() const
{ return _M_beta; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_alpha == __p2._M_alpha
&& __p1._M_beta == __p2._M_beta); }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void
_M_initialize();
_RealType _M_alpha;
_RealType _M_beta;
};
public:
/**
* @brief Constructs a beta distribution with parameters
* @f$\alpha@f$ and @f$\beta@f$.
*/
explicit
beta_distribution(_RealType __alpha_val = _RealType(1),
_RealType __beta_val = _RealType(1))
: _M_param(__alpha_val, __beta_val)
{ }
explicit
beta_distribution(const param_type& __p)
: _M_param(__p)
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ }
/**
* @brief Returns the @f$\alpha@f$ of the distribution.
*/
_RealType
alpha() const
{ return _M_param.alpha(); }
/**
* @brief Returns the @f$\beta@f$ of the distribution.
*/
_RealType
beta() const
{ return _M_param.beta(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return result_type(0); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return result_type(1); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, _M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two beta distributions have the same
* parameters and the sequences that would be generated
* are equal.
*/
friend bool
operator==(const beta_distribution& __d1,
const beta_distribution& __d2)
{ return __d1._M_param == __d2._M_param; }
/**
* @brief Inserts a %beta_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %beta_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::beta_distribution<_RealType1>& __x);
/**
* @brief Extracts a %beta_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %beta_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::beta_distribution<_RealType1>& __x);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
};
/**
* @brief Return true if two beta distributions are different.
*/
template<typename _RealType>
inline bool
operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1,
const __gnu_cxx::beta_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A multi-variate normal continuous distribution for random numbers.
*
* The formula for the normal probability density function is
* @f[
* p(\overrightarrow{x}|\overrightarrow{\mu },\Sigma) =
* \frac{1}{\sqrt{(2\pi )^k\det(\Sigma))}}
* e^{-\frac{1}{2}(\overrightarrow{x}-\overrightarrow{\mu})^\text{T}
* \Sigma ^{-1}(\overrightarrow{x}-\overrightarrow{\mu})}
* @f]
*
* where @f$\overrightarrow{x}@f$ and @f$\overrightarrow{\mu}@f$ are
* vectors of dimension @f$k@f$ and @f$\Sigma@f$ is the covariance
* matrix (which must be positive-definite).
*/
template<std::size_t _Dimen, typename _RealType = double>
class normal_mv_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
static_assert(_Dimen != 0, "dimension is zero");
public:
/** The type of the range of the distribution. */
typedef std::array<_RealType, _Dimen> result_type;
/** Parameter type. */
class param_type
{
static constexpr size_t _M_t_size = _Dimen * (_Dimen + 1) / 2;
public:
typedef normal_mv_distribution<_Dimen, _RealType> distribution_type;
friend class normal_mv_distribution<_Dimen, _RealType>;
param_type()
{
std::fill(_M_mean.begin(), _M_mean.end(), _RealType(0));
auto __it = _M_t.begin();
for (size_t __i = 0; __i < _Dimen; ++__i)
{
std::fill_n(__it, __i, _RealType(0));
__it += __i;
*__it++ = _RealType(1);
}
}
template<typename _ForwardIterator1, typename _ForwardIterator2>
param_type(_ForwardIterator1 __meanbegin,
_ForwardIterator1 __meanend,
_ForwardIterator2 __varcovbegin,
_ForwardIterator2 __varcovend)
{
__glibcxx_function_requires(_ForwardIteratorConcept<
_ForwardIterator1>)
__glibcxx_function_requires(_ForwardIteratorConcept<
_ForwardIterator2>)
_GLIBCXX_DEBUG_ASSERT(std::distance(__meanbegin, __meanend)
<= _Dimen);
const auto __dist = std::distance(__varcovbegin, __varcovend);
_GLIBCXX_DEBUG_ASSERT(__dist == _Dimen * _Dimen
|| __dist == _Dimen * (_Dimen + 1) / 2
|| __dist == _Dimen);
if (__dist == _Dimen * _Dimen)
_M_init_full(__meanbegin, __meanend, __varcovbegin, __varcovend);
else if (__dist == _Dimen * (_Dimen + 1) / 2)
_M_init_lower(__meanbegin, __meanend, __varcovbegin, __varcovend);
else
{
__glibcxx_assert(__dist == _Dimen);
_M_init_diagonal(__meanbegin, __meanend,
__varcovbegin, __varcovend);
}
}
param_type(std::initializer_list<_RealType> __mean,
std::initializer_list<_RealType> __varcov)
{
_GLIBCXX_DEBUG_ASSERT(__mean.size() <= _Dimen);
_GLIBCXX_DEBUG_ASSERT(__varcov.size() == _Dimen * _Dimen
|| __varcov.size() == _Dimen * (_Dimen + 1) / 2
|| __varcov.size() == _Dimen);
if (__varcov.size() == _Dimen * _Dimen)
_M_init_full(__mean.begin(), __mean.end(),
__varcov.begin(), __varcov.end());
else if (__varcov.size() == _Dimen * (_Dimen + 1) / 2)
_M_init_lower(__mean.begin(), __mean.end(),
__varcov.begin(), __varcov.end());
else
{
__glibcxx_assert(__varcov.size() == _Dimen);
_M_init_diagonal(__mean.begin(), __mean.end(),
__varcov.begin(), __varcov.end());
}
}
std::array<_RealType, _Dimen>
mean() const
{ return _M_mean; }
std::array<_RealType, _M_t_size>
varcov() const
{ return _M_t; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_mean == __p2._M_mean && __p1._M_t == __p2._M_t; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
template <typename _InputIterator1, typename _InputIterator2>
void _M_init_full(_InputIterator1 __meanbegin,
_InputIterator1 __meanend,
_InputIterator2 __varcovbegin,
_InputIterator2 __varcovend);
template <typename _InputIterator1, typename _InputIterator2>
void _M_init_lower(_InputIterator1 __meanbegin,
_InputIterator1 __meanend,
_InputIterator2 __varcovbegin,
_InputIterator2 __varcovend);
template <typename _InputIterator1, typename _InputIterator2>
void _M_init_diagonal(_InputIterator1 __meanbegin,
_InputIterator1 __meanend,
_InputIterator2 __varbegin,
_InputIterator2 __varend);
std::array<_RealType, _Dimen> _M_mean;
std::array<_RealType, _M_t_size> _M_t;
};
public:
normal_mv_distribution()
: _M_param(), _M_nd()
{ }
template<typename _ForwardIterator1, typename _ForwardIterator2>
normal_mv_distribution(_ForwardIterator1 __meanbegin,
_ForwardIterator1 __meanend,
_ForwardIterator2 __varcovbegin,
_ForwardIterator2 __varcovend)
: _M_param(__meanbegin, __meanend, __varcovbegin, __varcovend),
_M_nd()
{ }
normal_mv_distribution(std::initializer_list<_RealType> __mean,
std::initializer_list<_RealType> __varcov)
: _M_param(__mean, __varcov), _M_nd()
{ }
explicit
normal_mv_distribution(const param_type& __p)
: _M_param(__p), _M_nd()
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ _M_nd.reset(); }
/**
* @brief Returns the mean of the distribution.
*/
result_type
mean() const
{ return _M_param.mean(); }
/**
* @brief Returns the compact form of the variance/covariance
* matrix of the distribution.
*/
std::array<_RealType, _Dimen * (_Dimen + 1) / 2>
varcov() const
{ return _M_param.varcov(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ result_type __res;
__res.fill(std::numeric_limits<_RealType>::lowest());
return __res; }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ result_type __res;
__res.fill(std::numeric_limits<_RealType>::max());
return __res; }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, _M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ return this->__generate_impl(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ return this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two multi-variant normal distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
template<size_t _Dimen1, typename _RealType1>
friend bool
operator==(const
__gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>&
__d1,
const
__gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>&
__d2);
/**
* @brief Inserts a %normal_mv_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %normal_mv_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<size_t _Dimen1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const
__gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>&
__x);
/**
* @brief Extracts a %normal_mv_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %normal_mv_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error
* state.
*/
template<size_t _Dimen1, typename _RealType1,
typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>&
__x);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::normal_distribution<_RealType> _M_nd;
};
/**
* @brief Return true if two multi-variate normal distributions are
* different.
*/
template<size_t _Dimen, typename _RealType>
inline bool
operator!=(const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>&
__d1,
const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>&
__d2)
{ return !(__d1 == __d2); }
/**
* @brief A Rice continuous distribution for random numbers.
*
* The formula for the Rice probability density function is
* @f[
* p(x|\nu,\sigma) = \frac{x}{\sigma^2}
* \exp\left(-\frac{x^2+\nu^2}{2\sigma^2}\right)
* I_0\left(\frac{x \nu}{\sigma^2}\right)
* @f]
* where @f$I_0(z)@f$ is the modified Bessel function of the first kind
* of order 0 and @f$\nu >= 0@f$ and @f$\sigma > 0@f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$\sqrt{\pi/2}L_{1/2}(-\nu^2/2\sigma^2)@f$</td></tr>
* <tr><td>Variance</td><td>@f$2\sigma^2 + \nu^2
* + (\pi\sigma^2/2)L^2_{1/2}(-\nu^2/2\sigma^2)@f$</td></tr>
* <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr>
* </table>
* where @f$L_{1/2}(x)@f$ is the Laguerre polynomial of order 1/2.
*/
template<typename _RealType = double>
class
rice_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef rice_distribution<result_type> distribution_type;
param_type(result_type __nu_val = result_type(0),
result_type __sigma_val = result_type(1))
: _M_nu(__nu_val), _M_sigma(__sigma_val)
{
__glibcxx_assert(_M_nu >= result_type(0));
__glibcxx_assert(_M_sigma > result_type(0));
}
result_type
nu() const
{ return _M_nu; }
result_type
sigma() const
{ return _M_sigma; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_nu == __p2._M_nu && __p1._M_sigma == __p2._M_sigma; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_nu;
result_type _M_sigma;
};
/**
* @brief Constructors.
*/
explicit
rice_distribution(result_type __nu_val = result_type(0),
result_type __sigma_val = result_type(1))
: _M_param(__nu_val, __sigma_val),
_M_ndx(__nu_val, __sigma_val),
_M_ndy(result_type(0), __sigma_val)
{ }
explicit
rice_distribution(const param_type& __p)
: _M_param(__p),
_M_ndx(__p.nu(), __p.sigma()),
_M_ndy(result_type(0), __p.sigma())
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{
_M_ndx.reset();
_M_ndy.reset();
}
/**
* @brief Return the parameters of the distribution.
*/
result_type
nu() const
{ return _M_param.nu(); }
result_type
sigma() const
{ return _M_param.sigma(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return result_type(0); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __x = this->_M_ndx(__urng);
result_type __y = this->_M_ndy(__urng);
#if _GLIBCXX_USE_C99_MATH_TR1
return std::hypot(__x, __y);
#else
return std::sqrt(__x * __x + __y * __y);
#endif
}
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
typename std::normal_distribution<result_type>::param_type
__px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma());
result_type __x = this->_M_ndx(__px, __urng);
result_type __y = this->_M_ndy(__py, __urng);
#if _GLIBCXX_USE_C99_MATH_TR1
return std::hypot(__x, __y);
#else
return std::sqrt(__x * __x + __y * __y);
#endif
}
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two Rice distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
friend bool
operator==(const rice_distribution& __d1,
const rice_distribution& __d2)
{ return (__d1._M_param == __d2._M_param
&& __d1._M_ndx == __d2._M_ndx
&& __d1._M_ndy == __d2._M_ndy); }
/**
* @brief Inserts a %rice_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %rice_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const rice_distribution<_RealType1>&);
/**
* @brief Extracts a %rice_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %rice_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
rice_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::normal_distribution<result_type> _M_ndx;
std::normal_distribution<result_type> _M_ndy;
};
/**
* @brief Return true if two Rice distributions are not equal.
*/
template<typename _RealType1>
inline bool
operator!=(const rice_distribution<_RealType1>& __d1,
const rice_distribution<_RealType1>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A Nakagami continuous distribution for random numbers.
*
* The formula for the Nakagami probability density function is
* @f[
* p(x|\mu,\omega) = \frac{2\mu^\mu}{\Gamma(\mu)\omega^\mu}
* x^{2\mu-1}e^{-\mu x / \omega}
* @f]
* where @f$\Gamma(z)@f$ is the gamma function and @f$\mu >= 0.5@f$
* and @f$\omega > 0@f$.
*/
template<typename _RealType = double>
class
nakagami_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef nakagami_distribution<result_type> distribution_type;
param_type(result_type __mu_val = result_type(1),
result_type __omega_val = result_type(1))
: _M_mu(__mu_val), _M_omega(__omega_val)
{
__glibcxx_assert(_M_mu >= result_type(0.5L));
__glibcxx_assert(_M_omega > result_type(0));
}
result_type
mu() const
{ return _M_mu; }
result_type
omega() const
{ return _M_omega; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_mu == __p2._M_mu && __p1._M_omega == __p2._M_omega; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_mu;
result_type _M_omega;
};
/**
* @brief Constructors.
*/
explicit
nakagami_distribution(result_type __mu_val = result_type(1),
result_type __omega_val = result_type(1))
: _M_param(__mu_val, __omega_val),
_M_gd(__mu_val, __omega_val / __mu_val)
{ }
explicit
nakagami_distribution(const param_type& __p)
: _M_param(__p),
_M_gd(__p.mu(), __p.omega() / __p.mu())
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ _M_gd.reset(); }
/**
* @brief Return the parameters of the distribution.
*/
result_type
mu() const
{ return _M_param.mu(); }
result_type
omega() const
{ return _M_param.omega(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return result_type(0); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return std::sqrt(this->_M_gd(__urng)); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
typename std::gamma_distribution<result_type>::param_type
__pg(__p.mu(), __p.omega() / __p.mu());
return std::sqrt(this->_M_gd(__pg, __urng));
}
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two Nakagami distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
friend bool
operator==(const nakagami_distribution& __d1,
const nakagami_distribution& __d2)
{ return (__d1._M_param == __d2._M_param
&& __d1._M_gd == __d2._M_gd); }
/**
* @brief Inserts a %nakagami_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %nakagami_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const nakagami_distribution<_RealType1>&);
/**
* @brief Extracts a %nakagami_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %nakagami_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
nakagami_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::gamma_distribution<result_type> _M_gd;
};
/**
* @brief Return true if two Nakagami distributions are not equal.
*/
template<typename _RealType>
inline bool
operator!=(const nakagami_distribution<_RealType>& __d1,
const nakagami_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A Pareto continuous distribution for random numbers.
*
* The formula for the Pareto cumulative probability function is
* @f[
* P(x|\alpha,\mu) = 1 - \left(\frac{\mu}{x}\right)^\alpha
* @f]
* The formula for the Pareto probability density function is
* @f[
* p(x|\alpha,\mu) = \frac{\alpha + 1}{\mu}
* \left(\frac{\mu}{x}\right)^{\alpha + 1}
* @f]
* where @f$x >= \mu@f$ and @f$\mu > 0@f$, @f$\alpha > 0@f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$\alpha \mu / (\alpha - 1)@f$
* for @f$\alpha > 1@f$</td></tr>
* <tr><td>Variance</td><td>@f$\alpha \mu^2 / [(\alpha - 1)^2(\alpha - 2)]@f$
* for @f$\alpha > 2@f$</td></tr>
* <tr><td>Range</td><td>@f$[\mu, \infty)@f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class
pareto_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef pareto_distribution<result_type> distribution_type;
param_type(result_type __alpha_val = result_type(1),
result_type __mu_val = result_type(1))
: _M_alpha(__alpha_val), _M_mu(__mu_val)
{
__glibcxx_assert(_M_alpha > result_type(0));
__glibcxx_assert(_M_mu > result_type(0));
}
result_type
alpha() const
{ return _M_alpha; }
result_type
mu() const
{ return _M_mu; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_alpha == __p2._M_alpha && __p1._M_mu == __p2._M_mu; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_alpha;
result_type _M_mu;
};
/**
* @brief Constructors.
*/
explicit
pareto_distribution(result_type __alpha_val = result_type(1),
result_type __mu_val = result_type(1))
: _M_param(__alpha_val, __mu_val),
_M_ud()
{ }
explicit
pareto_distribution(const param_type& __p)
: _M_param(__p),
_M_ud()
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{
_M_ud.reset();
}
/**
* @brief Return the parameters of the distribution.
*/
result_type
alpha() const
{ return _M_param.alpha(); }
result_type
mu() const
{ return _M_param.mu(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return this->mu(); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{
return this->mu() * std::pow(this->_M_ud(__urng),
-result_type(1) / this->alpha());
}
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
return __p.mu() * std::pow(this->_M_ud(__urng),
-result_type(1) / __p.alpha());
}
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two Pareto distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
friend bool
operator==(const pareto_distribution& __d1,
const pareto_distribution& __d2)
{ return (__d1._M_param == __d2._M_param
&& __d1._M_ud == __d2._M_ud); }
/**
* @brief Inserts a %pareto_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %pareto_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const pareto_distribution<_RealType1>&);
/**
* @brief Extracts a %pareto_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %pareto_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
pareto_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::uniform_real_distribution<result_type> _M_ud;
};
/**
* @brief Return true if two Pareto distributions are not equal.
*/
template<typename _RealType>
inline bool
operator!=(const pareto_distribution<_RealType>& __d1,
const pareto_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A K continuous distribution for random numbers.
*
* The formula for the K probability density function is
* @f[
* p(x|\lambda, \mu, \nu) = \frac{2}{x}
* \left(\frac{\lambda\nu x}{\mu}\right)^{\frac{\lambda + \nu}{2}}
* \frac{1}{\Gamma(\lambda)\Gamma(\nu)}
* K_{\nu - \lambda}\left(2\sqrt{\frac{\lambda\nu x}{\mu}}\right)
* @f]
* where @f$I_0(z)@f$ is the modified Bessel function of the second kind
* of order @f$\nu - \lambda@f$ and @f$\lambda > 0@f$, @f$\mu > 0@f$
* and @f$\nu > 0@f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$\mu@f$</td></tr>
* <tr><td>Variance</td><td>@f$\mu^2\frac{\lambda + \nu + 1}{\lambda\nu}@f$</td></tr>
* <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class
k_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef k_distribution<result_type> distribution_type;
param_type(result_type __lambda_val = result_type(1),
result_type __mu_val = result_type(1),
result_type __nu_val = result_type(1))
: _M_lambda(__lambda_val), _M_mu(__mu_val), _M_nu(__nu_val)
{
__glibcxx_assert(_M_lambda > result_type(0));
__glibcxx_assert(_M_mu > result_type(0));
__glibcxx_assert(_M_nu > result_type(0));
}
result_type
lambda() const
{ return _M_lambda; }
result_type
mu() const
{ return _M_mu; }
result_type
nu() const
{ return _M_nu; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{
return __p1._M_lambda == __p2._M_lambda
&& __p1._M_mu == __p2._M_mu
&& __p1._M_nu == __p2._M_nu;
}
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_lambda;
result_type _M_mu;
result_type _M_nu;
};
/**
* @brief Constructors.
*/
explicit
k_distribution(result_type __lambda_val = result_type(1),
result_type __mu_val = result_type(1),
result_type __nu_val = result_type(1))
: _M_param(__lambda_val, __mu_val, __nu_val),
_M_gd1(__lambda_val, result_type(1) / __lambda_val),
_M_gd2(__nu_val, __mu_val / __nu_val)
{ }
explicit
k_distribution(const param_type& __p)
: _M_param(__p),
_M_gd1(__p.lambda(), result_type(1) / __p.lambda()),
_M_gd2(__p.nu(), __p.mu() / __p.nu())
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{
_M_gd1.reset();
_M_gd2.reset();
}
/**
* @brief Return the parameters of the distribution.
*/
result_type
lambda() const
{ return _M_param.lambda(); }
result_type
mu() const
{ return _M_param.mu(); }
result_type
nu() const
{ return _M_param.nu(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return result_type(0); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator&);
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator&, const param_type&);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two K distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
friend bool
operator==(const k_distribution& __d1,
const k_distribution& __d2)
{ return (__d1._M_param == __d2._M_param
&& __d1._M_gd1 == __d2._M_gd1
&& __d1._M_gd2 == __d2._M_gd2); }
/**
* @brief Inserts a %k_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %k_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const k_distribution<_RealType1>&);
/**
* @brief Extracts a %k_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %k_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
k_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::gamma_distribution<result_type> _M_gd1;
std::gamma_distribution<result_type> _M_gd2;
};
/**
* @brief Return true if two K distributions are not equal.
*/
template<typename _RealType>
inline bool
operator!=(const k_distribution<_RealType>& __d1,
const k_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief An arcsine continuous distribution for random numbers.
*
* The formula for the arcsine probability density function is
* @f[
* p(x|a,b) = \frac{1}{\pi \sqrt{(x - a)(b - x)}}
* @f]
* where @f$x >= a@f$ and @f$x <= b@f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$ (a + b) / 2 @f$</td></tr>
* <tr><td>Variance</td><td>@f$ (b - a)^2 / 8 @f$</td></tr>
* <tr><td>Range</td><td>@f$[a, b]@f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class
arcsine_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef arcsine_distribution<result_type> distribution_type;
param_type(result_type __a = result_type(0),
result_type __b = result_type(1))
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_a <= _M_b);
}
result_type
a() const
{ return _M_a; }
result_type
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_a;
result_type _M_b;
};
/**
* @brief Constructors.
*/
explicit
arcsine_distribution(result_type __a = result_type(0),
result_type __b = result_type(1))
: _M_param(__a, __b),
_M_ud(-1.5707963267948966192313216916397514L,
+1.5707963267948966192313216916397514L)
{ }
explicit
arcsine_distribution(const param_type& __p)
: _M_param(__p),
_M_ud(-1.5707963267948966192313216916397514L,
+1.5707963267948966192313216916397514L)
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ _M_ud.reset(); }
/**
* @brief Return the parameters of the distribution.
*/
result_type
a() const
{ return _M_param.a(); }
result_type
b() const
{ return _M_param.b(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return this->a(); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return this->b(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{
result_type __x = std::sin(this->_M_ud(__urng));
return (__x * (this->b() - this->a())
+ this->a() + this->b()) / result_type(2);
}
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
result_type __x = std::sin(this->_M_ud(__urng));
return (__x * (__p.b() - __p.a())
+ __p.a() + __p.b()) / result_type(2);
}
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two arcsine distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
friend bool
operator==(const arcsine_distribution& __d1,
const arcsine_distribution& __d2)
{ return (__d1._M_param == __d2._M_param
&& __d1._M_ud == __d2._M_ud); }
/**
* @brief Inserts a %arcsine_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %arcsine_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const arcsine_distribution<_RealType1>&);
/**
* @brief Extracts a %arcsine_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %arcsine_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
arcsine_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::uniform_real_distribution<result_type> _M_ud;
};
/**
* @brief Return true if two arcsine distributions are not equal.
*/
template<typename _RealType>
inline bool
operator!=(const arcsine_distribution<_RealType>& __d1,
const arcsine_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A Hoyt continuous distribution for random numbers.
*
* The formula for the Hoyt probability density function is
* @f[
* p(x|q,\omega) = \frac{(1 + q^2)x}{q\omega}
* \exp\left(-\frac{(1 + q^2)^2 x^2}{4 q^2 \omega}\right)
* I_0\left(\frac{(1 - q^4) x^2}{4 q^2 \omega}\right)
* @f]
* where @f$I_0(z)@f$ is the modified Bessel function of the first kind
* of order 0 and @f$0 < q < 1@f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$ \sqrt{\frac{2}{\pi}} \sqrt{\frac{\omega}{1 + q^2}}
* E(1 - q^2) @f$</td></tr>
* <tr><td>Variance</td><td>@f$ \omega \left(1 - \frac{2E^2(1 - q^2)}
* {\pi (1 + q^2)}\right) @f$</td></tr>
* <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr>
* </table>
* where @f$E(x)@f$ is the elliptic function of the second kind.
*/
template<typename _RealType = double>
class
hoyt_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef hoyt_distribution<result_type> distribution_type;
param_type(result_type __q = result_type(0.5L),
result_type __omega = result_type(1))
: _M_q(__q), _M_omega(__omega)
{
__glibcxx_assert(_M_q > result_type(0));
__glibcxx_assert(_M_q < result_type(1));
}
result_type
q() const
{ return _M_q; }
result_type
omega() const
{ return _M_omega; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_q == __p2._M_q && __p1._M_omega == __p2._M_omega; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_q;
result_type _M_omega;
};
/**
* @brief Constructors.
*/
explicit
hoyt_distribution(result_type __q = result_type(0.5L),
result_type __omega = result_type(1))
: _M_param(__q, __omega),
_M_ad(result_type(0.5L) * (result_type(1) + __q * __q),
result_type(0.5L) * (result_type(1) + __q * __q)
/ (__q * __q)),
_M_ed(result_type(1))
{ }
explicit
hoyt_distribution(const param_type& __p)
: _M_param(__p),
_M_ad(result_type(0.5L) * (result_type(1) + __p.q() * __p.q()),
result_type(0.5L) * (result_type(1) + __p.q() * __p.q())
/ (__p.q() * __p.q())),
_M_ed(result_type(1))
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{
_M_ad.reset();
_M_ed.reset();
}
/**
* @brief Return the parameters of the distribution.
*/
result_type
q() const
{ return _M_param.q(); }
result_type
omega() const
{ return _M_param.omega(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return result_type(0); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng);
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two Hoyt distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
friend bool
operator==(const hoyt_distribution& __d1,
const hoyt_distribution& __d2)
{ return (__d1._M_param == __d2._M_param
&& __d1._M_ad == __d2._M_ad
&& __d1._M_ed == __d2._M_ed); }
/**
* @brief Inserts a %hoyt_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %hoyt_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const hoyt_distribution<_RealType1>&);
/**
* @brief Extracts a %hoyt_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %hoyt_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
hoyt_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
__gnu_cxx::arcsine_distribution<result_type> _M_ad;
std::exponential_distribution<result_type> _M_ed;
};
/**
* @brief Return true if two Hoyt distributions are not equal.
*/
template<typename _RealType>
inline bool
operator!=(const hoyt_distribution<_RealType>& __d1,
const hoyt_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A triangular distribution for random numbers.
*
* The formula for the triangular probability density function is
* @f[
* / 0 for x < a
* p(x|a,b,c) = | \frac{2(x-a)}{(c-a)(b-a)} for a <= x <= b
* | \frac{2(c-x)}{(c-a)(c-b)} for b < x <= c
* \ 0 for c < x
* @f]
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$ \frac{a+b+c}{2} @f$</td></tr>
* <tr><td>Variance</td><td>@f$ \frac{a^2+b^2+c^2-ab-ac-bc}
* {18}@f$</td></tr>
* <tr><td>Range</td><td>@f$[a, c]@f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class triangular_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
friend class triangular_distribution<_RealType>;
explicit
param_type(_RealType __a = _RealType(0),
_RealType __b = _RealType(0.5),
_RealType __c = _RealType(1))
: _M_a(__a), _M_b(__b), _M_c(__c)
{
__glibcxx_assert(_M_a <= _M_b);
__glibcxx_assert(_M_b <= _M_c);
__glibcxx_assert(_M_a < _M_c);
_M_r_ab = (_M_b - _M_a) / (_M_c - _M_a);
_M_f_ab_ac = (_M_b - _M_a) * (_M_c - _M_a);
_M_f_bc_ac = (_M_c - _M_b) * (_M_c - _M_a);
}
_RealType
a() const
{ return _M_a; }
_RealType
b() const
{ return _M_b; }
_RealType
c() const
{ return _M_c; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{
return (__p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b
&& __p1._M_c == __p2._M_c);
}
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
_RealType _M_a;
_RealType _M_b;
_RealType _M_c;
_RealType _M_r_ab;
_RealType _M_f_ab_ac;
_RealType _M_f_bc_ac;
};
/**
* @brief Constructs a triangle distribution with parameters
* @f$ a @f$, @f$ b @f$ and @f$ c @f$.
*/
explicit
triangular_distribution(result_type __a = result_type(0),
result_type __b = result_type(0.5),
result_type __c = result_type(1))
: _M_param(__a, __b, __c)
{ }
explicit
triangular_distribution(const param_type& __p)
: _M_param(__p)
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ }
/**
* @brief Returns the @f$ a @f$ of the distribution.
*/
result_type
a() const
{ return _M_param.a(); }
/**
* @brief Returns the @f$ b @f$ of the distribution.
*/
result_type
b() const
{ return _M_param.b(); }
/**
* @brief Returns the @f$ c @f$ of the distribution.
*/
result_type
c() const
{ return _M_param.c(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return _M_param._M_a; }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return _M_param._M_c; }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, _M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{
std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
__aurng(__urng);
result_type __rnd = __aurng();
if (__rnd <= __p._M_r_ab)
return __p.a() + std::sqrt(__rnd * __p._M_f_ab_ac);
else
return __p.c() - std::sqrt((result_type(1) - __rnd)
* __p._M_f_bc_ac);
}
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two triangle distributions have the same
* parameters and the sequences that would be generated
* are equal.
*/
friend bool
operator==(const triangular_distribution& __d1,
const triangular_distribution& __d2)
{ return __d1._M_param == __d2._M_param; }
/**
* @brief Inserts a %triangular_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %triangular_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::triangular_distribution<_RealType1>& __x);
/**
* @brief Extracts a %triangular_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %triangular_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::triangular_distribution<_RealType1>& __x);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
};
/**
* @brief Return true if two triangle distributions are different.
*/
template<typename _RealType>
inline bool
operator!=(const __gnu_cxx::triangular_distribution<_RealType>& __d1,
const __gnu_cxx::triangular_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A von Mises distribution for random numbers.
*
* The formula for the von Mises probability density function is
* @f[
* p(x|\mu,\kappa) = \frac{e^{\kappa \cos(x-\mu)}}
* {2\pi I_0(\kappa)}
* @f]
*
* The generating functions use the method according to:
*
* D. J. Best and N. I. Fisher, 1979. "Efficient Simulation of the
* von Mises Distribution", Journal of the Royal Statistical Society.
* Series C (Applied Statistics), Vol. 28, No. 2, pp. 152-157.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$ \mu @f$</td></tr>
* <tr><td>Variance</td><td>@f$ 1-I_1(\kappa)/I_0(\kappa) @f$</td></tr>
* <tr><td>Range</td><td>@f$[-\pi, \pi]@f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class von_mises_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
friend class von_mises_distribution<_RealType>;
explicit
param_type(_RealType __mu = _RealType(0),
_RealType __kappa = _RealType(1))
: _M_mu(__mu), _M_kappa(__kappa)
{
const _RealType __pi = __gnu_cxx::__math_constants<_RealType>::__pi;
__glibcxx_assert(_M_mu >= -__pi && _M_mu <= __pi);
__glibcxx_assert(_M_kappa >= _RealType(0));
auto __tau = std::sqrt(_RealType(4) * _M_kappa * _M_kappa
+ _RealType(1)) + _RealType(1);
auto __rho = ((__tau - std::sqrt(_RealType(2) * __tau))
/ (_RealType(2) * _M_kappa));
_M_r = (_RealType(1) + __rho * __rho) / (_RealType(2) * __rho);
}
_RealType
mu() const
{ return _M_mu; }
_RealType
kappa() const
{ return _M_kappa; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_mu == __p2._M_mu && __p1._M_kappa == __p2._M_kappa; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
_RealType _M_mu;
_RealType _M_kappa;
_RealType _M_r;
};
/**
* @brief Constructs a von Mises distribution with parameters
* @f$\mu@f$ and @f$\kappa@f$.
*/
explicit
von_mises_distribution(result_type __mu = result_type(0),
result_type __kappa = result_type(1))
: _M_param(__mu, __kappa)
{ }
explicit
von_mises_distribution(const param_type& __p)
: _M_param(__p)
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ }
/**
* @brief Returns the @f$ \mu @f$ of the distribution.
*/
result_type
mu() const
{ return _M_param.mu(); }
/**
* @brief Returns the @f$ \kappa @f$ of the distribution.
*/
result_type
kappa() const
{ return _M_param.kappa(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{
return -__gnu_cxx::__math_constants<result_type>::__pi;
}
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{
return __gnu_cxx::__math_constants<result_type>::__pi;
}
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, _M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, _M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two von Mises distributions have the same
* parameters and the sequences that would be generated
* are equal.
*/
friend bool
operator==(const von_mises_distribution& __d1,
const von_mises_distribution& __d2)
{ return __d1._M_param == __d2._M_param; }
/**
* @brief Inserts a %von_mises_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %von_mises_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::von_mises_distribution<_RealType1>& __x);
/**
* @brief Extracts a %von_mises_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %von_mises_distribution random number generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::von_mises_distribution<_RealType1>& __x);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
};
/**
* @brief Return true if two von Mises distributions are different.
*/
template<typename _RealType>
inline bool
operator!=(const __gnu_cxx::von_mises_distribution<_RealType>& __d1,
const __gnu_cxx::von_mises_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A discrete hypergeometric random number distribution.
*
* The hypergeometric distribution is a discrete probability distribution
* that describes the probability of @p k successes in @p n draws @a without
* replacement from a finite population of size @p N containing exactly @p K
* successes.
*
* The formula for the hypergeometric probability density function is
* @f[
* p(k|N,K,n) = \frac{\binom{K}{k} \binom{N-K}{n-k}}{\binom{N}{n}}
* @f]
* where @f$N@f$ is the total population of the distribution,
* @f$K@f$ is the total population of the distribution.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$ n\frac{K}{N} @f$</td></tr>
* <tr><td>Variance</td><td>@f$ n\frac{K}{N}\frac{N-K}{N}\frac{N-n}{N-1}
* @f$</td></tr>
* <tr><td>Range</td><td>@f$[max(0, n+K-N), min(K, n)]@f$</td></tr>
* </table>
*/
template<typename _UIntType = unsigned int>
class hypergeometric_distribution
{
static_assert(std::is_unsigned<_UIntType>::value, "template argument "
"substituting _UIntType not an unsigned integral type");
public:
/** The type of the range of the distribution. */
typedef _UIntType result_type;
/** Parameter type. */
struct param_type
{
typedef hypergeometric_distribution<_UIntType> distribution_type;
friend class hypergeometric_distribution<_UIntType>;
explicit
param_type(result_type __N = 10, result_type __K = 5,
result_type __n = 1)
: _M_N{__N}, _M_K{__K}, _M_n{__n}
{
__glibcxx_assert(_M_N >= _M_K);
__glibcxx_assert(_M_N >= _M_n);
}
result_type
total_size() const
{ return _M_N; }
result_type
successful_size() const
{ return _M_K; }
result_type
unsuccessful_size() const
{ return _M_N - _M_K; }
result_type
total_draws() const
{ return _M_n; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_N == __p2._M_N)
&& (__p1._M_K == __p2._M_K)
&& (__p1._M_n == __p2._M_n); }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
result_type _M_N;
result_type _M_K;
result_type _M_n;
};
// constructors and member function
explicit
hypergeometric_distribution(result_type __N = 10, result_type __K = 5,
result_type __n = 1)
: _M_param{__N, __K, __n}
{ }
explicit
hypergeometric_distribution(const param_type& __p)
: _M_param{__p}
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ }
/**
* @brief Returns the distribution parameter @p N,
* the total number of items.
*/
result_type
total_size() const
{ return this->_M_param.total_size(); }
/**
* @brief Returns the distribution parameter @p K,
* the total number of successful items.
*/
result_type
successful_size() const
{ return this->_M_param.successful_size(); }
/**
* @brief Returns the total number of unsuccessful items @f$ N - K @f$.
*/
result_type
unsuccessful_size() const
{ return this->_M_param.unsuccessful_size(); }
/**
* @brief Returns the distribution parameter @p n,
* the total number of draws.
*/
result_type
total_draws() const
{ return this->_M_param.total_draws(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return this->_M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ this->_M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{
using _IntType = typename std::make_signed<result_type>::type;
return static_cast<result_type>(std::max(static_cast<_IntType>(0),
static_cast<_IntType>(this->total_draws()
- this->unsuccessful_size())));
}
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::min(this->successful_size(), this->total_draws()); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, this->_M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, this->_M_param); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two hypergeometric distributions have the same
* parameters and the sequences that would be generated
* are equal.
*/
friend bool
operator==(const hypergeometric_distribution& __d1,
const hypergeometric_distribution& __d2)
{ return __d1._M_param == __d2._M_param; }
/**
* @brief Inserts a %hypergeometric_distribution random number
* distribution @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %hypergeometric_distribution random number
* distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _UIntType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::hypergeometric_distribution<_UIntType1>&
__x);
/**
* @brief Extracts a %hypergeometric_distribution random number
* distribution @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %hypergeometric_distribution random number generator
* distribution.
*
* @returns The input stream with @p __x extracted or in an error
* state.
*/
template<typename _UIntType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::hypergeometric_distribution<_UIntType1>& __x);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
};
/**
* @brief Return true if two hypergeometric distributions are different.
*/
template<typename _UIntType>
inline bool
operator!=(const __gnu_cxx::hypergeometric_distribution<_UIntType>& __d1,
const __gnu_cxx::hypergeometric_distribution<_UIntType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A logistic continuous distribution for random numbers.
*
* The formula for the logistic probability density function is
* @f[
* p(x|\a,\b) = \frac{e^{(x - a)/b}}{b[1 + e^{(x - a)/b}]^2}
* @f]
* where @f$b > 0@f$.
*
* The formula for the logistic probability function is
* @f[
* cdf(x|\a,\b) = \frac{e^{(x - a)/b}}{1 + e^{(x - a)/b}}
* @f]
* where @f$b > 0@f$.
*
* <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Distribution Statistics</caption>
* <tr><td>Mean</td><td>@f$a@f$</td></tr>
* <tr><td>Variance</td><td>@f$b^2\pi^2/3@f$</td></tr>
* <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr>
* </table>
*/
template<typename _RealType = double>
class
logistic_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
/** Parameter type. */
struct param_type
{
typedef logistic_distribution<result_type> distribution_type;
param_type(result_type __a = result_type(0),
result_type __b = result_type(1))
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_b > result_type(0));
}
result_type
a() const
{ return _M_a; }
result_type
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
void _M_initialize();
result_type _M_a;
result_type _M_b;
};
/**
* @brief Constructors.
*/
explicit
logistic_distribution(result_type __a = result_type(0),
result_type __b = result_type(1))
: _M_param(__a, __b)
{ }
explicit
logistic_distribution(const param_type& __p)
: _M_param(__p)
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ }
/**
* @brief Return the parameters of the distribution.
*/
result_type
a() const
{ return _M_param.a(); }
result_type
b() const
{ return _M_param.b(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
*/
result_type
min() const
{ return -std::numeric_limits<result_type>::max(); }
/**
* @brief Returns the least upper bound value of the distribution.
*/
result_type
max() const
{ return std::numeric_limits<result_type>::max(); }
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, this->_M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator&,
const param_type&);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, this->param()); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two logistic distributions have
* the same parameters and the sequences that would
* be generated are equal.
*/
template<typename _RealType1>
friend bool
operator==(const logistic_distribution<_RealType1>& __d1,
const logistic_distribution<_RealType1>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %logistic_distribution random number distribution
* @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %logistic_distribution random number distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>&,
const logistic_distribution<_RealType1>&);
/**
* @brief Extracts a %logistic_distribution random number distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %logistic_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>&,
logistic_distribution<_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
};
/**
* @brief Return true if two logistic distributions are not equal.
*/
template<typename _RealType1>
inline bool
operator!=(const logistic_distribution<_RealType1>& __d1,
const logistic_distribution<_RealType1>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A distribution for random coordinates on a unit sphere.
*
* The method used in the generation function is attributed by Donald Knuth
* to G. W. Brown, Modern Mathematics for the Engineer (1956).
*/
template<std::size_t _Dimen, typename _RealType = double>
class uniform_on_sphere_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
static_assert(_Dimen != 0, "dimension is zero");
public:
/** The type of the range of the distribution. */
typedef std::array<_RealType, _Dimen> result_type;
/** Parameter type. */
struct param_type
{
explicit
param_type()
{ }
friend bool
operator==(const param_type&, const param_type&)
{ return true; }
friend bool
operator!=(const param_type&, const param_type&)
{ return false; }
};
/**
* @brief Constructs a uniform on sphere distribution.
*/
explicit
uniform_on_sphere_distribution()
: _M_param(), _M_nd()
{ }
explicit
uniform_on_sphere_distribution(const param_type& __p)
: _M_param(__p), _M_nd()
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ _M_nd.reset(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
* This function makes no sense for this distribution.
*/
result_type
min() const
{
result_type __res;
__res.fill(0);
return __res;
}
/**
* @brief Returns the least upper bound value of the distribution.
* This function makes no sense for this distribution.
*/
result_type
max() const
{
result_type __res;
__res.fill(0);
return __res;
}
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, _M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, this->param()); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two uniform on sphere distributions have
* the same parameters and the sequences that would be
* generated are equal.
*/
friend bool
operator==(const uniform_on_sphere_distribution& __d1,
const uniform_on_sphere_distribution& __d2)
{ return __d1._M_nd == __d2._M_nd; }
/**
* @brief Inserts a %uniform_on_sphere_distribution random number
* distribution @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %uniform_on_sphere_distribution random number
* distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<size_t _Dimen1, typename _RealType1, typename _CharT,
typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::uniform_on_sphere_distribution<_Dimen1,
_RealType1>&
__x);
/**
* @brief Extracts a %uniform_on_sphere_distribution random number
* distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %uniform_on_sphere_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<std::size_t _Dimen1, typename _RealType1, typename _CharT,
typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::uniform_on_sphere_distribution<_Dimen1,
_RealType1>& __x);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
std::normal_distribution<_RealType> _M_nd;
};
/**
* @brief Return true if two uniform on sphere distributions are different.
*/
template<std::size_t _Dimen, typename _RealType>
inline bool
operator!=(const __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __d1,
const __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __d2)
{ return !(__d1 == __d2); }
/**
* @brief A distribution for random coordinates inside a unit sphere.
*/
template<std::size_t _Dimen, typename _RealType = double>
class uniform_inside_sphere_distribution
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
static_assert(_Dimen != 0, "dimension is zero");
public:
/** The type of the range of the distribution. */
using result_type = std::array<_RealType, _Dimen>;
/** Parameter type. */
struct param_type
{
using distribution_type
= uniform_inside_sphere_distribution<_Dimen, _RealType>;
friend class uniform_inside_sphere_distribution<_Dimen, _RealType>;
explicit
param_type(_RealType __radius = _RealType(1))
: _M_radius(__radius)
{
__glibcxx_assert(_M_radius > _RealType(0));
}
_RealType
radius() const
{ return _M_radius; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_radius == __p2._M_radius; }
friend bool
operator!=(const param_type& __p1, const param_type& __p2)
{ return !(__p1 == __p2); }
private:
_RealType _M_radius;
};
/**
* @brief Constructors.
*/
explicit
uniform_inside_sphere_distribution(_RealType __radius = _RealType(1))
: _M_param(__radius), _M_uosd()
{ }
explicit
uniform_inside_sphere_distribution(const param_type& __p)
: _M_param(__p), _M_uosd()
{ }
/**
* @brief Resets the distribution state.
*/
void
reset()
{ _M_uosd.reset(); }
/**
* @brief Returns the @f$radius@f$ of the distribution.
*/
_RealType
radius() const
{ return _M_param.radius(); }
/**
* @brief Returns the parameter set of the distribution.
*/
param_type
param() const
{ return _M_param; }
/**
* @brief Sets the parameter set of the distribution.
* @param __param The new parameter set of the distribution.
*/
void
param(const param_type& __param)
{ _M_param = __param; }
/**
* @brief Returns the greatest lower bound value of the distribution.
* This function makes no sense for this distribution.
*/
result_type
min() const
{
result_type __res;
__res.fill(0);
return __res;
}
/**
* @brief Returns the least upper bound value of the distribution.
* This function makes no sense for this distribution.
*/
result_type
max() const
{
result_type __res;
__res.fill(0);
return __res;
}
/**
* @brief Generating functions.
*/
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
{ return this->operator()(__urng, _M_param); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng)
{ this->__generate(__f, __t, __urng, this->param()); }
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
template<typename _UniformRandomNumberGenerator>
void
__generate(result_type* __f, result_type* __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p)
{ this->__generate_impl(__f, __t, __urng, __p); }
/**
* @brief Return true if two uniform on sphere distributions have
* the same parameters and the sequences that would be
* generated are equal.
*/
friend bool
operator==(const uniform_inside_sphere_distribution& __d1,
const uniform_inside_sphere_distribution& __d2)
{ return __d1._M_param == __d2._M_param && __d1._M_uosd == __d2._M_uosd; }
/**
* @brief Inserts a %uniform_inside_sphere_distribution random number
* distribution @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %uniform_inside_sphere_distribution random number
* distribution.
*
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
template<size_t _Dimen1, typename _RealType1, typename _CharT,
typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const __gnu_cxx::uniform_inside_sphere_distribution<_Dimen1,
_RealType1>&
);
/**
* @brief Extracts a %uniform_inside_sphere_distribution random number
* distribution
* @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %uniform_inside_sphere_distribution random number
* generator engine.
*
* @returns The input stream with @p __x extracted or in an error state.
*/
template<std::size_t _Dimen1, typename _RealType1, typename _CharT,
typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
__gnu_cxx::uniform_inside_sphere_distribution<_Dimen1,
_RealType1>&);
private:
template<typename _ForwardIterator,
typename _UniformRandomNumberGenerator>
void
__generate_impl(_ForwardIterator __f, _ForwardIterator __t,
_UniformRandomNumberGenerator& __urng,
const param_type& __p);
param_type _M_param;
uniform_on_sphere_distribution<_Dimen, _RealType> _M_uosd;
};
/**
* @brief Return true if two uniform on sphere distributions are different.
*/
template<std::size_t _Dimen, typename _RealType>
inline bool
operator!=(const __gnu_cxx::uniform_inside_sphere_distribution<_Dimen,
_RealType>& __d1,
const __gnu_cxx::uniform_inside_sphere_distribution<_Dimen,
_RealType>& __d2)
{ return !(__d1 == __d2); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
#include <ext/opt_random.h>
#include <ext/random.tcc>
#endif // _GLIBCXX_USE_C99_STDINT_TR1 && UINT32_C
#endif // C++11
#endif // _EXT_RANDOM
// Math extensions -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/cmath
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _EXT_CMATH
#define _EXT_CMATH 1
#pragma GCC system_header
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <cmath>
#include <type_traits>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// A class for math constants.
template<typename _RealType>
struct __math_constants
{
static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
// Constant @f$ \pi @f$.
static constexpr _RealType __pi = 3.1415926535897932384626433832795029L;
// Constant @f$ \pi / 2 @f$.
static constexpr _RealType __pi_half = 1.5707963267948966192313216916397514L;
// Constant @f$ \pi / 3 @f$.
static constexpr _RealType __pi_third = 1.0471975511965977461542144610931676L;
// Constant @f$ \pi / 4 @f$.
static constexpr _RealType __pi_quarter = 0.7853981633974483096156608458198757L;
// Constant @f$ \sqrt(\pi / 2) @f$.
static constexpr _RealType __root_pi_div_2 = 1.2533141373155002512078826424055226L;
// Constant @f$ 1 / \pi @f$.
static constexpr _RealType __one_div_pi = 0.3183098861837906715377675267450287L;
// Constant @f$ 2 / \pi @f$.
static constexpr _RealType __two_div_pi = 0.6366197723675813430755350534900574L;
// Constant @f$ 2 / \sqrt(\pi) @f$.
static constexpr _RealType __two_div_root_pi = 1.1283791670955125738961589031215452L;
// Constant Euler's number @f$ e @f$.
static constexpr _RealType __e = 2.7182818284590452353602874713526625L;
// Constant @f$ 1 / e @f$.
static constexpr _RealType __one_div_e = 0.36787944117144232159552377016146087L;
// Constant @f$ \log_2(e) @f$.
static constexpr _RealType __log2_e = 1.4426950408889634073599246810018921L;
// Constant @f$ \log_10(e) @f$.
static constexpr _RealType __log10_e = 0.4342944819032518276511289189166051L;
// Constant @f$ \ln(2) @f$.
static constexpr _RealType __ln_2 = 0.6931471805599453094172321214581766L;
// Constant @f$ \ln(3) @f$.
static constexpr _RealType __ln_3 = 1.0986122886681096913952452369225257L;
// Constant @f$ \ln(10) @f$.
static constexpr _RealType __ln_10 = 2.3025850929940456840179914546843642L;
// Constant Euler-Mascheroni @f$ \gamma_E @f$.
static constexpr _RealType __gamma_e = 0.5772156649015328606065120900824024L;
// Constant Golden Ratio @f$ \phi @f$.
static constexpr _RealType __phi = 1.6180339887498948482045868343656381L;
// Constant @f$ \sqrt(2) @f$.
static constexpr _RealType __root_2 = 1.4142135623730950488016887242096981L;
// Constant @f$ \sqrt(3) @f$.
static constexpr _RealType __root_3 = 1.7320508075688772935274463415058724L;
// Constant @f$ \sqrt(5) @f$.
static constexpr _RealType __root_5 = 2.2360679774997896964091736687312762L;
// Constant @f$ \sqrt(7) @f$.
static constexpr _RealType __root_7 = 2.6457513110645905905016157536392604L;
// Constant @f$ 1 / \sqrt(2) @f$.
static constexpr _RealType __one_div_root_2 = 0.7071067811865475244008443621048490L;
};
// And the template definitions for the constants.
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__pi;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__pi_half;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__pi_third;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__pi_quarter;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__root_pi_div_2;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__one_div_pi;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__two_div_pi;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__two_div_root_pi;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__e;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__one_div_e;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__log2_e;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__log10_e;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__ln_2;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__ln_3;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__ln_10;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__gamma_e;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__phi;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__root_2;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__root_3;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__root_5;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__root_7;
template<typename _RealType>
constexpr _RealType __math_constants<_RealType>::__one_div_root_2;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
#endif // C++11
#endif // _EXT_CMATH
// Aligned memory buffer -*- C++ -*-
// Copyright (C) 2013-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/aligned_buffer.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _ALIGNED_BUFFER_H
#define _ALIGNED_BUFFER_H 1
#pragma GCC system_header
#if __cplusplus >= 201103L
# include <type_traits>
#else
# include <bits/c++0x_warning.h>
#endif
namespace __gnu_cxx
{
// A utility type containing a POD object that can hold an object of type
// _Tp initialized via placement new or allocator_traits::construct.
// Intended for use as a data member subobject, use __aligned_buffer for
// complete objects.
template<typename _Tp>
struct __aligned_membuf
{
// Target macro ADJUST_FIELD_ALIGN can produce different alignment for
// types when used as class members. __aligned_membuf is intended
// for use as a class member, so align the buffer as for a class member.
// Since GCC 8 we could just use alignof(_Tp) instead, but older
// versions of non-GNU compilers might still need this trick.
struct _Tp2 { _Tp _M_t; };
alignas(__alignof__(_Tp2::_M_t)) unsigned char _M_storage[sizeof(_Tp)];
__aligned_membuf() = default;
// Can be used to avoid value-initialization zeroing _M_storage.
__aligned_membuf(std::nullptr_t) { }
void*
_M_addr() noexcept
{ return static_cast<void*>(&_M_storage); }
const void*
_M_addr() const noexcept
{ return static_cast<const void*>(&_M_storage); }
_Tp*
_M_ptr() noexcept
{ return static_cast<_Tp*>(_M_addr()); }
const _Tp*
_M_ptr() const noexcept
{ return static_cast<const _Tp*>(_M_addr()); }
};
#if _GLIBCXX_INLINE_VERSION
template<typename _Tp>
using __aligned_buffer = __aligned_membuf<_Tp>;
#else
// Similar to __aligned_membuf but aligned for complete objects, not members.
// This type is used in <forward_list>, <future>, <bits/shared_ptr_base.h>
// and <bits/hashtable_policy.h>, but ideally they would use __aligned_membuf
// instead, as it has smaller size for some types on some targets.
// This type is still used to avoid an ABI change.
template<typename _Tp>
struct __aligned_buffer
: std::aligned_storage<sizeof(_Tp), __alignof__(_Tp)>
{
typename
std::aligned_storage<sizeof(_Tp), __alignof__(_Tp)>::type _M_storage;
__aligned_buffer() = default;
// Can be used to avoid value-initialization
__aligned_buffer(std::nullptr_t) { }
void*
_M_addr() noexcept
{
return static_cast<void*>(&_M_storage);
}
const void*
_M_addr() const noexcept
{
return static_cast<const void*>(&_M_storage);
}
_Tp*
_M_ptr() noexcept
{ return static_cast<_Tp*>(_M_addr()); }
const _Tp*
_M_ptr() const noexcept
{ return static_cast<const _Tp*>(_M_addr()); }
};
#endif
} // namespace
#endif /* _ALIGNED_BUFFER_H */
// Allocator traits -*- C++ -*-
// Copyright (C) 2011-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file ext/alloc_traits.h
* This file is a GNU extension to the Standard C++ Library.
*/
#ifndef _EXT_ALLOC_TRAITS_H
#define _EXT_ALLOC_TRAITS_H 1
#pragma GCC system_header
#if __cplusplus >= 201103L
# include <bits/move.h>
# include <bits/alloc_traits.h>
#else
# include <bits/allocator.h> // for __alloc_swap
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief Uniform interface to C++98 and C++11 allocators.
* @ingroup allocators
*/
template<typename _Alloc, typename = typename _Alloc::value_type>
struct __alloc_traits
#if __cplusplus >= 201103L
: std::allocator_traits<_Alloc>
#endif
{
typedef _Alloc allocator_type;
#if __cplusplus >= 201103L
typedef std::allocator_traits<_Alloc> _Base_type;
typedef typename _Base_type::value_type value_type;
typedef typename _Base_type::pointer pointer;
typedef typename _Base_type::const_pointer const_pointer;
typedef typename _Base_type::size_type size_type;
typedef typename _Base_type::difference_type difference_type;
// C++11 allocators do not define reference or const_reference
typedef value_type& reference;
typedef const value_type& const_reference;
using _Base_type::allocate;
using _Base_type::deallocate;
using _Base_type::construct;
using _Base_type::destroy;
using _Base_type::max_size;
private:
template<typename _Ptr>
using __is_custom_pointer
= std::__and_<std::is_same<pointer, _Ptr>,
std::__not_<std::is_pointer<_Ptr>>>;
public:
// overload construct for non-standard pointer types
template<typename _Ptr, typename... _Args>
static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type
construct(_Alloc& __a, _Ptr __p, _Args&&... __args)
{
_Base_type::construct(__a, std::__to_address(__p),
std::forward<_Args>(__args)...);
}
// overload destroy for non-standard pointer types
template<typename _Ptr>
static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type
destroy(_Alloc& __a, _Ptr __p)
{ _Base_type::destroy(__a, std::__to_address(__p)); }
static _Alloc _S_select_on_copy(const _Alloc& __a)
{ return _Base_type::select_on_container_copy_construction(__a); }
static void _S_on_swap(_Alloc& __a, _Alloc& __b)
{ std::__alloc_on_swap(__a, __b); }
static constexpr bool _S_propagate_on_copy_assign()
{ return _Base_type::propagate_on_container_copy_assignment::value; }
static constexpr bool _S_propagate_on_move_assign()
{ return _Base_type::propagate_on_container_move_assignment::value; }
static constexpr bool _S_propagate_on_swap()
{ return _Base_type::propagate_on_container_swap::value; }
static constexpr bool _S_always_equal()
{ return _Base_type::is_always_equal::value; }
static constexpr bool _S_nothrow_move()
{ return _S_propagate_on_move_assign() || _S_always_equal(); }
template<typename _Tp>
struct rebind
{ typedef typename _Base_type::template rebind_alloc<_Tp> other; };
#else
typedef typename _Alloc::pointer pointer;
typedef typename _Alloc::const_pointer const_pointer;
typedef typename _Alloc::value_type value_type;
typedef typename _Alloc::reference reference;
typedef typename _Alloc::const_reference const_reference;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
static pointer
allocate(_Alloc& __a, size_type __n)
{ return __a.allocate(__n); }
static void deallocate(_Alloc& __a, pointer __p, size_type __n)
{ __a.deallocate(__p, __n); }
template<typename _Tp>
static void construct(_Alloc& __a, pointer __p, const _Tp& __arg)
{ __a.construct(__p, __arg); }
static void destroy(_Alloc& __a, pointer __p)
{ __a.destroy(__p); }
static size_type max_size(const _Alloc& __a)
{ return __a.max_size(); }
static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; }
static void _S_on_swap(_Alloc& __a, _Alloc& __b)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 431. Swapping containers with unequal allocators.
std::__alloc_swap<_Alloc>::_S_do_it(__a, __b);
}
template<typename _Tp>
struct rebind
{ typedef typename _Alloc::template rebind<_Tp>::other other; };
#endif
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file tree_policy.hpp
* Contains tree-related policies.
*/
#ifndef PB_DS_TREE_POLICY_HPP
#define PB_DS_TREE_POLICY_HPP
#include <bits/c++config.h>
#include <iterator>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
namespace __gnu_pbds
{
#define PB_DS_CLASS_T_DEC \
template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn, \
typename _Alloc>
#define PB_DS_CLASS_C_DEC \
tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>
#define PB_DS_BRANCH_POLICY_BASE \
detail::branch_policy<Node_CItr, Node_Itr, _Alloc>
/// Functor updating ranks of entrees.
template<typename Node_CItr, typename Node_Itr,
typename Cmp_Fn, typename _Alloc>
class tree_order_statistics_node_update : private PB_DS_BRANCH_POLICY_BASE
{
private:
typedef PB_DS_BRANCH_POLICY_BASE base_type;
public:
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
typedef typename allocator_type::size_type size_type;
typedef typename base_type::key_type key_type;
typedef typename base_type::key_const_reference key_const_reference;
typedef size_type metadata_type;
typedef Node_CItr node_const_iterator;
typedef Node_Itr node_iterator;
typedef typename node_const_iterator::value_type const_iterator;
typedef typename node_iterator::value_type iterator;
/// Finds an entry by __order. Returns a const_iterator to the
/// entry with the __order order, or a const_iterator to the
/// container object's end if order is at least the size of the
/// container object.
inline const_iterator
find_by_order(size_type) const;
/// Finds an entry by __order. Returns an iterator to the entry
/// with the __order order, or an iterator to the container
/// object's end if order is at least the size of the container
/// object.
inline iterator
find_by_order(size_type);
/// Returns the order of a key within a sequence. For exapmle, if
/// r_key is the smallest key, this method will return 0; if r_key
/// is a key between the smallest and next key, this method will
/// return 1; if r_key is a key larger than the largest key, this
/// method will return the size of r_c.
inline size_type
order_of_key(key_const_reference) const;
private:
/// Const reference to the container's value-type.
typedef typename base_type::const_reference const_reference;
/// Const pointer to the container's value-type.
typedef typename base_type::const_pointer const_pointer;
typedef typename _Alloc::template rebind<metadata_type>::other __rebind_m;
/// Const metadata reference.
typedef typename __rebind_m::const_reference metadata_const_reference;
/// Metadata reference.
typedef typename __rebind_m::reference metadata_reference;
/// Returns the node_const_iterator associated with the tree's root node.
virtual node_const_iterator
node_begin() const = 0;
/// Returns the node_iterator associated with the tree's root node.
virtual node_iterator
node_begin() = 0;
/// Returns the node_const_iterator associated with a just-after leaf node.
virtual node_const_iterator
node_end() const = 0;
/// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
/// Access to the cmp_fn object.
virtual cmp_fn&
get_cmp_fn() = 0;
protected:
/// Updates the rank of a node through a node_iterator node_it;
/// end_nd_it is the end node iterator.
inline void
operator()(node_iterator, node_const_iterator) const;
virtual
~tree_order_statistics_node_update();
};
#include <ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_BRANCH_POLICY_BASE
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy.hpp
* Contains trie-related policies.
*/
#ifndef PB_DS_TRIE_POLICY_HPP
#define PB_DS_TRIE_POLICY_HPP
#include <bits/c++config.h>
#include <string>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>
namespace __gnu_pbds
{
#define PB_DS_CLASS_T_DEC \
template<typename String, typename String::value_type Min_E_Val, \
typename String::value_type Max_E_Val, bool Reverse, \
typename _Alloc>
#define PB_DS_CLASS_C_DEC \
trie_string_access_traits<String, Min_E_Val,Max_E_Val,Reverse,_Alloc>
/**
* Element access traits for string types.
*
* @tparam String String type.
* @tparam Min_E_Val Minimal element value.
* @tparam Max_E_Val Maximum element value.
* @tparam Reverse Reverse iteration should be used.
* Default: false.
* @tparam _Alloc Allocator type.
*/
template<typename String = std::string,
typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,
typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,
bool Reverse = false,
typename _Alloc = std::allocator<char> >
struct trie_string_access_traits
{
public:
typedef typename _Alloc::size_type size_type;
typedef String key_type;
typedef typename _Alloc::template rebind<key_type> __rebind_k;
typedef typename __rebind_k::other::const_reference key_const_reference;
enum
{
reverse = Reverse
};
/// Element const iterator type.
typedef typename detail::__conditional_type<Reverse, \
typename String::const_reverse_iterator, \
typename String::const_iterator>::__type const_iterator;
/// Element type.
typedef typename std::iterator_traits<const_iterator>::value_type e_type;
enum
{
min_e_val = Min_E_Val,
max_e_val = Max_E_Val,
max_size = max_e_val - min_e_val + 1
};
PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2);
/// Returns a const_iterator to the first element of
/// key_const_reference agumnet.
inline static const_iterator
begin(key_const_reference);
/// Returns a const_iterator to the after-last element of
/// key_const_reference argument.
inline static const_iterator
end(key_const_reference);
/// Maps an element to a position.
inline static size_type
e_pos(e_type e);
private:
inline static const_iterator
begin_imp(key_const_reference, detail::false_type);
inline static const_iterator
begin_imp(key_const_reference, detail::true_type);
inline static const_iterator
end_imp(key_const_reference, detail::false_type);
inline static const_iterator
end_imp(key_const_reference, detail::true_type);
static detail::integral_constant<int, Reverse> s_rev_ind;
};
#include <ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
template<typename Node_CItr,typename Node_Itr, \
typename _ATraits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
trie_prefix_search_node_update<Node_CItr, Node_Itr, \
_ATraits,_Alloc>
#define PB_DS_TRIE_POLICY_BASE \
detail::trie_policy_base<Node_CItr,Node_Itr,_ATraits, _Alloc>
/// A node updator that allows tries to be searched for the range of
/// values that match a certain prefix.
template<typename Node_CItr,
typename Node_Itr,
typename _ATraits,
typename _Alloc>
class trie_prefix_search_node_update : private PB_DS_TRIE_POLICY_BASE
{
private:
typedef PB_DS_TRIE_POLICY_BASE base_type;
public:
typedef typename base_type::key_type key_type;
typedef typename base_type::key_const_reference key_const_reference;
/// Element access traits.
typedef _ATraits access_traits;
/// Const element iterator.
typedef typename access_traits::const_iterator a_const_iterator;
/// _Alloc type.
typedef _Alloc allocator_type;
/// Size type.
typedef typename allocator_type::size_type size_type;
typedef null_type metadata_type;
typedef Node_Itr node_iterator;
typedef Node_CItr node_const_iterator;
typedef typename node_iterator::value_type iterator;
typedef typename node_const_iterator::value_type const_iterator;
/// Finds the const iterator range corresponding to all values
/// whose prefixes match r_key.
std::pair<const_iterator, const_iterator>
prefix_range(key_const_reference) const;
/// Finds the iterator range corresponding to all values whose
/// prefixes match r_key.
std::pair<iterator, iterator>
prefix_range(key_const_reference);
/// Finds the const iterator range corresponding to all values
/// whose prefixes match [b, e).
std::pair<const_iterator, const_iterator>
prefix_range(a_const_iterator, a_const_iterator) const;
/// Finds the iterator range corresponding to all values whose
/// prefixes match [b, e).
std::pair<iterator, iterator>
prefix_range(a_const_iterator, a_const_iterator);
protected:
/// Called to update a node's metadata.
inline void
operator()(node_iterator node_it, node_const_iterator end_nd_it) const;
private:
node_iterator
next_child(node_iterator, a_const_iterator, a_const_iterator,
node_iterator, const access_traits&);
/// Returns the const iterator associated with the just-after last element.
virtual const_iterator
end() const = 0;
/// Returns the iterator associated with the just-after last element.
virtual iterator
end() = 0;
/// Returns the node_const_iterator associated with the trie's root node.
virtual node_const_iterator
node_begin() const = 0;
/// Returns the node_iterator associated with the trie's root node.
virtual node_iterator
node_begin() = 0;
/// Returns the node_const_iterator associated with a just-after leaf node.
virtual node_const_iterator
node_end() const = 0;
/// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
/// Access to the cmp_fn object.
virtual const access_traits&
get_access_traits() const = 0;
};
#include <ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp>
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_C_DEC \
trie_order_statistics_node_update<Node_CItr, Node_Itr, \
_ATraits, _Alloc>
/// Functor updating ranks of entrees.
template<typename Node_CItr,
typename Node_Itr,
typename _ATraits,
typename _Alloc>
class trie_order_statistics_node_update : private PB_DS_TRIE_POLICY_BASE
{
private:
typedef PB_DS_TRIE_POLICY_BASE base_type;
public:
typedef _ATraits access_traits;
typedef typename access_traits::const_iterator a_const_iterator;
typedef _Alloc allocator_type;
typedef typename allocator_type::size_type size_type;
typedef typename base_type::key_type key_type;
typedef typename base_type::key_const_reference key_const_reference;
typedef size_type metadata_type;
typedef Node_CItr node_const_iterator;
typedef Node_Itr node_iterator;
typedef typename node_const_iterator::value_type const_iterator;
typedef typename node_iterator::value_type iterator;
/// Finds an entry by __order. Returns a const_iterator to the
/// entry with the __order order, or a const_iterator to the
/// container object's end if order is at least the size of the
/// container object.
inline const_iterator
find_by_order(size_type) const;
/// Finds an entry by __order. Returns an iterator to the entry
/// with the __order order, or an iterator to the container
/// object's end if order is at least the size of the container
/// object.
inline iterator
find_by_order(size_type);
/// Returns the order of a key within a sequence. For exapmle, if
/// r_key is the smallest key, this method will return 0; if r_key
/// is a key between the smallest and next key, this method will
/// return 1; if r_key is a key larger than the largest key, this
/// method will return the size of r_c.
inline size_type
order_of_key(key_const_reference) const;
/// Returns the order of a prefix within a sequence. For exapmle,
/// if [b, e] is the smallest prefix, this method will return 0; if
/// r_key is a key between the smallest and next key, this method
/// will return 1; if r_key is a key larger than the largest key,
/// this method will return the size of r_c.
inline size_type
order_of_prefix(a_const_iterator, a_const_iterator) const;
protected:
/// Updates the rank of a node through a node_iterator node_it;
/// end_nd_it is the end node iterator.
inline void
operator()(node_iterator, node_const_iterator) const;
private:
typedef typename base_type::const_reference const_reference;
typedef typename base_type::const_pointer const_pointer;
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef typename __rebind_ma::const_reference metadata_const_reference;
typedef typename __rebind_ma::reference metadata_reference;
/// Returns true if the container is empty.
virtual bool
empty() const = 0;
/// Returns the iterator associated with the trie's first element.
virtual iterator
begin() = 0;
/// Returns the iterator associated with the trie's
/// just-after-last element.
virtual iterator
end() = 0;
/// Returns the node_const_iterator associated with the trie's root node.
virtual node_const_iterator
node_begin() const = 0;
/// Returns the node_iterator associated with the trie's root node.
virtual node_iterator
node_begin() = 0;
/// Returns the node_const_iterator associated with a just-after
/// leaf node.
virtual node_const_iterator
node_end() const = 0;
/// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
/// Access to the cmp_fn object.
virtual access_traits&
get_access_traits() = 0;
};
#include <ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_TRIE_POLICY_BASE
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file exception.hpp
* Contains exception classes.
*/
#ifndef PB_DS_EXCEPTION_HPP
#define PB_DS_EXCEPTION_HPP
#include <bits/c++config.h>
#include <stdexcept>
#include <cstdlib>
namespace __gnu_pbds
{
/**
* @defgroup exceptions-pbds Exceptions
* @ingroup pbds
* @{
*/
/// Base class for exceptions.
struct container_error : public std::logic_error
{
container_error()
: std::logic_error(__N("__gnu_pbds::container_error")) { }
};
/// An entry cannot be inserted into a container object for logical
/// reasons (not, e.g., if memory is unabvailable, in which case
/// the allocator_type's exception will be thrown).
struct insert_error : public container_error { };
/// A join cannot be performed logical reasons (i.e., the ranges of
/// the two container objects being joined overlaps.
struct join_error : public container_error { };
/// A container cannot be resized.
struct resize_error : public container_error { };
inline void
__throw_container_error()
{ _GLIBCXX_THROW_OR_ABORT(container_error()); }
inline void
__throw_insert_error()
{ _GLIBCXX_THROW_OR_ABORT(insert_error()); }
inline void
__throw_join_error()
{ _GLIBCXX_THROW_OR_ABORT(join_error()); }
inline void
__throw_resize_error()
{ _GLIBCXX_THROW_OR_ABORT(resize_error()); }
//@}
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file assoc_container.hpp
* Contains associative containers.
*/
#ifndef PB_DS_ASSOC_CNTNR_HPP
#define PB_DS_ASSOC_CNTNR_HPP
#include <bits/c++config.h>
#include <ext/typelist.h>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/detail/container_base_dispatch.hpp>
#include <ext/pb_ds/detail/branch_policy/traits.hpp>
namespace __gnu_pbds
{
/**
* @defgroup containers-pbds Containers
* @ingroup pbds
* @{
*/
/**
* @defgroup hash-based Hash-Based
* @ingroup containers-pbds
* @{
*/
#define PB_DS_HASH_BASE \
detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, \
typename __gnu_cxx::typelist::append< \
typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, \
detail::integral_constant<int, Store_Hash> >::type, Policy_Tl>::type>::type
/**
* @defgroup hash-detail Base and Policy Classes
* @ingroup hash-based
*/
/**
* A hashed container abstraction.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam Hash_Fn Hashing functor.
* @tparam Eq_Fn Equal functor.
* @tparam Resize_Policy Resizes hash.
* @tparam Store_Hash Indicates whether the hash value
* will be stored along with each key.
* @tparam Tag Instantiating data structure type,
* see container_tag.
* @tparam Policy_TL Policy typelist.
* @tparam _Alloc Allocator type.
*
* Base is dispatched at compile time via Tag, from the following
* choices: cc_hash_tag, gp_hash_tag, and descendants of basic_hash_tag.
*
* Base choices are: detail::cc_ht_map, detail::gp_ht_map
*/
template<typename Key,
typename Mapped,
typename Hash_Fn,
typename Eq_Fn,
typename Resize_Policy,
bool Store_Hash,
typename Tag,
typename Policy_Tl,
typename _Alloc>
class basic_hash_table : public PB_DS_HASH_BASE
{
private:
typedef typename PB_DS_HASH_BASE base_type;
public:
virtual
~basic_hash_table() { }
protected:
basic_hash_table() { }
basic_hash_table(const basic_hash_table& other)
: base_type((const base_type&)other) { }
template<typename T0>
basic_hash_table(T0 t0) : base_type(t0) { }
template<typename T0, typename T1>
basic_hash_table(T0 t0, T1 t1) : base_type(t0, t1) { }
template<typename T0, typename T1, typename T2>
basic_hash_table(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { }
template<typename T0, typename T1, typename T2, typename T3>
basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3)
: base_type(t0, t1, t2, t3) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4>
basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
: base_type(t0, t1, t2, t3, t4) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5>
basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
: base_type(t0, t1, t2, t3, t4, t5) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
: base_type(t0, t1, t2, t3, t4, t5, t6) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
: base_type(t0, t1, t2, t3, t4, t5, t6, t7) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6,
T7 t7, T8 t8)
: base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8)
{ }
private:
basic_hash_table&
operator=(const base_type&);
};
#undef PB_DS_HASH_BASE
#define PB_DS_CC_HASH_BASE \
basic_hash_table<Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \
cc_hash_tag, \
typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, _Alloc>
/**
* A collision-chaining hash-based associative container.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam Hash_Fn Hashing functor.
* @tparam Eq_Fn Equal functor.
* @tparam Comb_Hash_Fn Combining hash functor.
* If Hash_Fn is not null_type, then this
* is the ranged-hash functor; otherwise,
* this is the range-hashing functor.
* XXX(See Design::Hash-Based Containers::Hash Policies.)
* @tparam Resize_Policy Resizes hash.
* @tparam Store_Hash Indicates whether the hash value
* will be stored along with each key.
* If Hash_Fn is null_type, then the
* container will not compile if this
* value is true
* @tparam _Alloc Allocator type.
*
* Base tag choices are: cc_hash_tag.
*
* Base is basic_hash_table.
*/
template<typename Key,
typename Mapped,
typename Hash_Fn = typename detail::default_hash_fn<Key>::type,
typename Eq_Fn = typename detail::default_eq_fn<Key>::type,
typename Comb_Hash_Fn = detail::default_comb_hash_fn::type,
typename Resize_Policy = typename detail::default_resize_policy<Comb_Hash_Fn>::type,
bool Store_Hash = detail::default_store_hash,
typename _Alloc = std::allocator<char> >
class cc_hash_table : public PB_DS_CC_HASH_BASE
{
private:
typedef PB_DS_CC_HASH_BASE base_type;
public:
typedef cc_hash_tag container_category;
typedef Hash_Fn hash_fn;
typedef Eq_Fn eq_fn;
typedef Resize_Policy resize_policy;
typedef Comb_Hash_Fn comb_hash_fn;
/// Default constructor.
cc_hash_table() { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the Hash_Fn object of the container object.
cc_hash_table(const hash_fn& h)
: base_type(h) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, and
/// r_eq_fn will be copied by the eq_fn object of the container
/// object.
cc_hash_table(const hash_fn& h, const eq_fn& e)
: base_type(h, e) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, r_eq_fn
/// will be copied by the eq_fn object of the container object,
/// and r_comb_hash_fn will be copied by the comb_hash_fn object
/// of the container object.
cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch)
: base_type(h, e, ch) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, r_eq_fn
/// will be copied by the eq_fn object of the container object,
/// r_comb_hash_fn will be copied by the comb_hash_fn object of
/// the container object, and r_resize_policy will be copied by
/// the resize_policy object of the container object.
cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch,
const resize_policy& rp)
: base_type(h, e, ch, rp) { }
/// Constructor taking __iterators to a range of value_types. The
/// value_types between first_it and last_it will be inserted into
/// the container object.
template<typename It>
cc_hash_table(It first, It last)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h)
: base_type(h)
{ this->copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// and r_eq_fn will be copied by the eq_fn object of the
/// container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)
: base_type(h, e)
{ this->copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// r_eq_fn will be copied by the eq_fn object of the container
/// object, and r_comb_hash_fn will be copied by the comb_hash_fn
/// object of the container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_hash_fn& ch)
: base_type(h, e, ch)
{ this->copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// r_eq_fn will be copied by the eq_fn object of the container
/// object, r_comb_hash_fn will be copied by the comb_hash_fn
/// object of the container object, and r_resize_policy will be
/// copied by the resize_policy object of the container object.
template<typename It>
cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_hash_fn& ch, const resize_policy& rp)
: base_type(h, e, ch, rp)
{ this->copy_from_range(first, last); }
cc_hash_table(const cc_hash_table& other)
: base_type((const base_type&)other)
{ }
virtual
~cc_hash_table() { }
cc_hash_table&
operator=(const cc_hash_table& other)
{
if (this != &other)
{
cc_hash_table tmp(other);
swap(tmp);
}
return *this;
}
void
swap(cc_hash_table& other)
{ base_type::swap(other); }
};
#undef PB_DS_CC_HASH_BASE
#define PB_DS_GP_HASH_BASE \
basic_hash_table<Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \
gp_hash_tag, \
typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, _Alloc>
/**
* A general-probing hash-based associative container.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam Hash_Fn Hashing functor.
* @tparam Eq_Fn Equal functor.
* @tparam Comb_Probe_Fn Combining probe functor.
* If Hash_Fn is not null_type, then this
* is the ranged-probe functor; otherwise,
* this is the range-hashing functor.
* XXX See Design::Hash-Based Containers::Hash Policies.
* @tparam Probe_Fn Probe functor.
* @tparam Resize_Policy Resizes hash.
* @tparam Store_Hash Indicates whether the hash value
* will be stored along with each key.
* If Hash_Fn is null_type, then the
* container will not compile if this
* value is true
* @tparam _Alloc Allocator type.
*
* Base tag choices are: gp_hash_tag.
*
* Base is basic_hash_table.
*/
template<typename Key,
typename Mapped,
typename Hash_Fn = typename detail::default_hash_fn<Key>::type,
typename Eq_Fn = typename detail::default_eq_fn<Key>::type,
typename Comb_Probe_Fn = detail::default_comb_hash_fn::type,
typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type,
typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type,
bool Store_Hash = detail::default_store_hash,
typename _Alloc = std::allocator<char> >
class gp_hash_table : public PB_DS_GP_HASH_BASE
{
private:
typedef PB_DS_GP_HASH_BASE base_type;
public:
typedef gp_hash_tag container_category;
typedef Hash_Fn hash_fn;
typedef Eq_Fn eq_fn;
typedef Comb_Probe_Fn comb_probe_fn;
typedef Probe_Fn probe_fn;
typedef Resize_Policy resize_policy;
/// Default constructor.
gp_hash_table() { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object.
gp_hash_table(const hash_fn& h)
: base_type(h) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, and
/// r_eq_fn will be copied by the eq_fn object of the container
/// object.
gp_hash_table(const hash_fn& h, const eq_fn& e)
: base_type(h, e) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, r_eq_fn
/// will be copied by the eq_fn object of the container object,
/// and r_comb_probe_fn will be copied by the comb_probe_fn object
/// of the container object.
gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp)
: base_type(h, e, cp) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, r_eq_fn
/// will be copied by the eq_fn object of the container object,
/// r_comb_probe_fn will be copied by the comb_probe_fn object of
/// the container object, and r_probe_fn will be copied by the
/// probe_fn object of the container object.
gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,
const probe_fn& p)
: base_type(h, e, cp, p) { }
/// Constructor taking some policy objects. r_hash_fn will be
/// copied by the hash_fn object of the container object, r_eq_fn
/// will be copied by the eq_fn object of the container object,
/// r_comb_probe_fn will be copied by the comb_probe_fn object of
/// the container object, r_probe_fn will be copied by the
/// probe_fn object of the container object, and r_resize_policy
/// will be copied by the Resize_Policy object of the container
/// object.
gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,
const probe_fn& p, const resize_policy& rp)
: base_type(h, e, cp, p, rp) { }
/// Constructor taking __iterators to a range of value_types. The
/// value_types between first_it and last_it will be inserted into
/// the container object.
template<typename It>
gp_hash_table(It first, It last)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h)
: base_type(h)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// and r_eq_fn will be copied by the eq_fn object of the
/// container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)
: base_type(h, e)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// r_eq_fn will be copied by the eq_fn object of the container
/// object, and r_comb_probe_fn will be copied by the
/// comb_probe_fn object of the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_probe_fn& cp)
: base_type(h, e, cp)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// r_eq_fn will be copied by the eq_fn object of the container
/// object, r_comb_probe_fn will be copied by the comb_probe_fn
/// object of the container object, and r_probe_fn will be copied
/// by the probe_fn object of the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_probe_fn& cp, const probe_fn& p)
: base_type(h, e, cp, p)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object. r_hash_fn
/// will be copied by the hash_fn object of the container object,
/// r_eq_fn will be copied by the eq_fn object of the container
/// object, r_comb_probe_fn will be copied by the comb_probe_fn
/// object of the container object, r_probe_fn will be copied by
/// the probe_fn object of the container object, and
/// r_resize_policy will be copied by the resize_policy object of
/// the container object.
template<typename It>
gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
const comb_probe_fn& cp, const probe_fn& p,
const resize_policy& rp)
: base_type(h, e, cp, p, rp)
{ base_type::copy_from_range(first, last); }
gp_hash_table(const gp_hash_table& other)
: base_type((const base_type&)other)
{ }
virtual
~gp_hash_table() { }
gp_hash_table&
operator=(const gp_hash_table& other)
{
if (this != &other)
{
gp_hash_table tmp(other);
swap(tmp);
}
return *this;
}
void
swap(gp_hash_table& other)
{ base_type::swap(other); }
};
//@} hash-based
#undef PB_DS_GP_HASH_BASE
/**
* @defgroup branch-based Branch-Based
* @ingroup containers-pbds
* @{
*/
#define PB_DS_BRANCH_BASE \
detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, Policy_Tl>::type
/**
* @defgroup branch-detail Base and Policy Classes
* @ingroup branch-based
*/
/**
* A branched, tree-like (tree, trie) container abstraction.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam Tag Instantiating data structure type,
* see container_tag.
* @tparam Node_Update Updates nodes, restores invariants.
* @tparam Policy_TL Policy typelist.
* @tparam _Alloc Allocator type.
*
* Base is dispatched at compile time via Tag, from the following
* choices: tree_tag, trie_tag, and their descendants.
*
* Base choices are: detail::ov_tree_map, detail::rb_tree_map,
* detail::splay_tree_map, and detail::pat_trie_map.
*/
template<typename Key, typename Mapped, typename Tag,
typename Node_Update, typename Policy_Tl, typename _Alloc>
class basic_branch : public PB_DS_BRANCH_BASE
{
private:
typedef typename PB_DS_BRANCH_BASE base_type;
public:
typedef Node_Update node_update;
virtual
~basic_branch() { }
protected:
basic_branch() { }
basic_branch(const basic_branch& other)
: base_type((const base_type&)other) { }
template<typename T0>
basic_branch(T0 t0) : base_type(t0) { }
template<typename T0, typename T1>
basic_branch(T0 t0, T1 t1) : base_type(t0, t1) { }
template<typename T0, typename T1, typename T2>
basic_branch(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { }
template<typename T0, typename T1, typename T2, typename T3>
basic_branch(T0 t0, T1 t1, T2 t2, T3 t3)
: base_type(t0, t1, t2, t3) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4>
basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
: base_type(t0, t1, t2, t3, t4) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5>
basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
: base_type(t0, t1, t2, t3, t4, t5) { }
template<typename T0, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
: base_type(t0, t1, t2, t3, t4, t5, t6) { }
};
#undef PB_DS_BRANCH_BASE
#define PB_DS_TREE_NODE_AND_IT_TRAITS \
detail::tree_traits<Key, Mapped,Cmp_Fn,Node_Update,Tag,_Alloc>
#define PB_DS_TREE_BASE \
basic_branch<Key,Mapped, Tag, \
typename PB_DS_TREE_NODE_AND_IT_TRAITS::node_update, \
typename __gnu_cxx::typelist::create2<Cmp_Fn, \
PB_DS_TREE_NODE_AND_IT_TRAITS>::type, _Alloc>
/**
* A tree-based container.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam Cmp_Fn Comparison functor.
* @tparam Tag Instantiating data structure type,
* see container_tag.
* @tparam Node_Update Updates tree internal-nodes,
* restores invariants when invalidated.
* XXX See design::tree-based-containers::node invariants.
* @tparam _Alloc Allocator type.
*
* Base tag choices are: ov_tree_tag, rb_tree_tag, splay_tree_tag.
*
* Base is basic_branch.
*/
template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
typename Tag = rb_tree_tag,
template<typename Node_CItr, typename Node_Itr,
typename Cmp_Fn_, typename _Alloc_>
class Node_Update = null_node_update,
typename _Alloc = std::allocator<char> >
class tree : public PB_DS_TREE_BASE
{
private:
typedef PB_DS_TREE_BASE base_type;
public:
/// Comparison functor type.
typedef Cmp_Fn cmp_fn;
tree() { }
/// Constructor taking some policy objects. r_cmp_fn will be
/// copied by the Cmp_Fn object of the container object.
tree(const cmp_fn& c)
: base_type(c) { }
/// Constructor taking __iterators to a range of value_types. The
/// value_types between first_it and last_it will be inserted into
/// the container object.
template<typename It>
tree(It first, It last)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects The value_types between first_it and
/// last_it will be inserted into the container object. r_cmp_fn
/// will be copied by the cmp_fn object of the container object.
template<typename It>
tree(It first, It last, const cmp_fn& c)
: base_type(c)
{ base_type::copy_from_range(first, last); }
tree(const tree& other)
: base_type((const base_type&)other) { }
virtual
~tree() { }
tree&
operator=(const tree& other)
{
if (this != &other)
{
tree tmp(other);
swap(tmp);
}
return *this;
}
void
swap(tree& other)
{ base_type::swap(other); }
};
#undef PB_DS_TREE_BASE
#undef PB_DS_TREE_NODE_AND_IT_TRAITS
#define PB_DS_TRIE_NODE_AND_IT_TRAITS \
detail::trie_traits<Key,Mapped,_ATraits,Node_Update,Tag,_Alloc>
#define PB_DS_TRIE_BASE \
basic_branch<Key,Mapped,Tag, \
typename PB_DS_TRIE_NODE_AND_IT_TRAITS::node_update, \
typename __gnu_cxx::typelist::create2<_ATraits, \
PB_DS_TRIE_NODE_AND_IT_TRAITS >::type, _Alloc>
/**
* A trie-based container.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam _ATraits Element access traits.
* @tparam Tag Instantiating data structure type,
* see container_tag.
* @tparam Node_Update Updates trie internal-nodes,
* restores invariants when invalidated.
* XXX See design::tree-based-containers::node invariants.
* @tparam _Alloc Allocator type.
*
* Base tag choice is pat_trie_tag.
*
* Base is basic_branch.
*/
template<typename Key,
typename Mapped,
typename _ATraits = \
typename detail::default_trie_access_traits<Key>::type,
typename Tag = pat_trie_tag,
template<typename Node_CItr,
typename Node_Itr,
typename _ATraits_,
typename _Alloc_>
class Node_Update = null_node_update,
typename _Alloc = std::allocator<char> >
class trie : public PB_DS_TRIE_BASE
{
private:
typedef PB_DS_TRIE_BASE base_type;
public:
/// Element access traits type.
typedef _ATraits access_traits;
trie() { }
/// Constructor taking some policy objects. r_access_traits will
/// be copied by the _ATraits object of the container object.
trie(const access_traits& t)
: base_type(t) { }
/// Constructor taking __iterators to a range of value_types. The
/// value_types between first_it and last_it will be inserted into
/// the container object.
template<typename It>
trie(It first, It last)
{ base_type::copy_from_range(first, last); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects. The value_types between first_it and
/// last_it will be inserted into the container object.
template<typename It>
trie(It first, It last, const access_traits& t)
: base_type(t)
{ base_type::copy_from_range(first, last); }
trie(const trie& other)
: base_type((const base_type&)other) { }
virtual
~trie() { }
trie&
operator=(const trie& other)
{
if (this != &other)
{
trie tmp(other);
swap(tmp);
}
return *this;
}
void
swap(trie& other)
{ base_type::swap(other); }
};
//@} branch-based
#undef PB_DS_TRIE_BASE
#undef PB_DS_TRIE_NODE_AND_IT_TRAITS
/**
* @defgroup list-based List-Based
* @ingroup containers-pbds
* @{
*/
#define PB_DS_LU_BASE \
detail::container_base_dispatch<Key, Mapped, _Alloc, list_update_tag, \
typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type>::type
/**
* A list-update based associative container.
*
* @tparam Key Key type.
* @tparam Mapped Map type.
* @tparam Eq_Fn Equal functor.
* @tparam Update_Policy Update policy, determines when an element
* will be moved to the front of the list.
* @tparam _Alloc Allocator type.
*
* Base is detail::lu_map.
*/
template<typename Key,
typename Mapped,
class Eq_Fn = typename detail::default_eq_fn<Key>::type,
class Update_Policy = detail::default_update_policy::type,
class _Alloc = std::allocator<char> >
class list_update : public PB_DS_LU_BASE
{
private:
typedef typename PB_DS_LU_BASE base_type;
public:
typedef list_update_tag container_category;
typedef Eq_Fn eq_fn;
typedef Update_Policy update_policy;
list_update() { }
/// Constructor taking __iterators to a range of value_types. The
/// value_types between first_it and last_it will be inserted into
/// the container object.
template<typename It>
list_update(It first, It last)
{ base_type::copy_from_range(first, last); }
list_update(const list_update& other)
: base_type((const base_type&)other) { }
virtual
~list_update() { }
list_update&
operator=(const list_update& other)
{
if (this !=& other)
{
list_update tmp(other);
swap(tmp);
}
return *this;
}
void
swap(list_update& other)
{ base_type::swap(other); }
};
//@} list-based
#undef PB_DS_LU_BASE
// @} group containers-pbds
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file tag_and_trait.hpp
* Contains tags and traits, e.g., ones describing underlying
* data structures.
*/
#ifndef PB_DS_TAG_AND_TRAIT_HPP
#define PB_DS_TAG_AND_TRAIT_HPP
#include <bits/c++config.h>
#include <ext/pb_ds/detail/type_utils.hpp>
/**
* @namespace __gnu_pbds
* @brief GNU extensions for policy-based data structures for public use.
*/
namespace __gnu_pbds
{
/** @defgroup pbds Policy-Based Data Structures
* @ingroup extensions
*
* This is a library of policy-based elementary data structures:
* associative containers and priority queues. It is designed for
* high-performance, flexibility, semantic safety, and conformance
* to the corresponding containers in std (except for some points
* where it differs by design).
*
* For details, see:
* http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html
*
* @{
*/
/**
* @defgroup tags Tags
* @{
*/
/// A trivial iterator tag. Signifies that the iterators has none of
/// std::iterators's movement abilities.
struct trivial_iterator_tag
{ };
/// Prohibit moving trivial iterators.
typedef void trivial_iterator_difference_type;
/**
* @defgroup invalidation_tags Invalidation Guarantees
* @ingroup tags
* @{
*/
/**
* Signifies a basic invalidation guarantee that any iterator,
* pointer, or reference to a container object's mapped value type
* is valid as long as the container is not modified.
*/
struct basic_invalidation_guarantee
{ };
/**
* Signifies an invalidation guarantee that includes all those of
* its base, and additionally, that any point-type iterator,
* pointer, or reference to a container object's mapped value type
* is valid as long as its corresponding entry has not be erased,
* regardless of modifications to the container object.
*/
struct point_invalidation_guarantee : public basic_invalidation_guarantee
{ };
/**
* Signifies an invalidation guarantee that includes all those of
* its base, and additionally, that any range-type iterator
* (including the returns of begin() and end()) is in the correct
* relative positions to other range-type iterators as long as its
* corresponding entry has not be erased, regardless of
* modifications to the container object.
*/
struct range_invalidation_guarantee : public point_invalidation_guarantee
{ };
//@}
/**
* @defgroup ds_tags Data Structure Type
* @ingroup tags
* @{
*/
/// Base data structure tag.
struct container_tag
{ };
/// Basic sequence.
struct sequence_tag : public container_tag { };
/// Basic string container, inclusive of strings, ropes, etc.
struct string_tag : public sequence_tag { };
/// Basic associative-container.
struct associative_tag : public container_tag { };
/// Basic hash structure.
struct basic_hash_tag : public associative_tag { };
/// Collision-chaining hash.
struct cc_hash_tag : public basic_hash_tag { };
/// General-probing hash.
struct gp_hash_tag : public basic_hash_tag { };
/// Basic branch structure.
struct basic_branch_tag : public associative_tag { };
/// Basic tree structure.
struct tree_tag : public basic_branch_tag { };
/// Red-black tree.
struct rb_tree_tag : public tree_tag { };
/// Splay tree.
struct splay_tree_tag : public tree_tag { };
/// Ordered-vector tree.
struct ov_tree_tag : public tree_tag { };
/// Basic trie structure.
struct trie_tag : public basic_branch_tag { };
/// PATRICIA trie.
struct pat_trie_tag : public trie_tag { };
/// List-update.
struct list_update_tag : public associative_tag { };
/// Basic priority-queue.
struct priority_queue_tag : public container_tag { };
/// Pairing-heap.
struct pairing_heap_tag : public priority_queue_tag { };
/// Binomial-heap.
struct binomial_heap_tag : public priority_queue_tag { };
/// Redundant-counter binomial-heap.
struct rc_binomial_heap_tag : public priority_queue_tag { };
/// Binary-heap (array-based).
struct binary_heap_tag : public priority_queue_tag { };
/// Thin heap.
struct thin_heap_tag : public priority_queue_tag { };
//@}
//@}
/**
* @defgroup traits Traits
* @{
*/
/**
* @brief Represents no type, or absence of type, for template tricks.
*
* In a mapped-policy, indicates that an associative container is a set.
*
* In a list-update policy, indicates that each link does not need
* metadata.
*
* In a hash policy, indicates that the combining hash function
* is actually a ranged hash function.
*
* In a probe policy, indicates that the combining probe function
* is actually a ranged probe function.
*/
struct null_type { };
/// A null node updator, indicating that no node updates are required.
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
struct null_node_update : public null_type
{ };
/// Primary template, container traits base.
template<typename _Tag>
struct container_traits_base;
/// Specialization, cc hash.
template<>
struct container_traits_base<cc_hash_tag>
{
typedef cc_hash_tag container_category;
typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, gp hash.
template<>
struct container_traits_base<gp_hash_tag>
{
typedef gp_hash_tag container_category;
typedef basic_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, rb tree.
template<>
struct container_traits_base<rb_tree_tag>
{
typedef rb_tree_tag container_category;
typedef range_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = true,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = true
};
};
/// Specialization, splay tree.
template<>
struct container_traits_base<splay_tree_tag>
{
typedef splay_tree_tag container_category;
typedef range_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = true,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = true
};
};
/// Specialization, ov tree.
template<>
struct container_traits_base<ov_tree_tag>
{
typedef ov_tree_tag container_category;
typedef basic_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = true,
erase_can_throw = true,
split_join_can_throw = true,
reverse_iteration = false
};
};
/// Specialization, pat trie.
template<>
struct container_traits_base<pat_trie_tag>
{
typedef pat_trie_tag container_category;
typedef range_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = true,
erase_can_throw = false,
split_join_can_throw = true,
reverse_iteration = true
};
};
/// Specialization, list update.
template<>
struct container_traits_base<list_update_tag>
{
typedef list_update_tag container_category;
typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, pairing heap.
template<>
struct container_traits_base<pairing_heap_tag>
{
typedef pairing_heap_tag container_category;
typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, thin heap.
template<>
struct container_traits_base<thin_heap_tag>
{
typedef thin_heap_tag container_category;
typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, binomial heap.
template<>
struct container_traits_base<binomial_heap_tag>
{
typedef binomial_heap_tag container_category;
typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, rc binomial heap.
template<>
struct container_traits_base<rc_binomial_heap_tag>
{
typedef rc_binomial_heap_tag container_category;
typedef point_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = false,
reverse_iteration = false
};
};
/// Specialization, binary heap.
template<>
struct container_traits_base<binary_heap_tag>
{
typedef binary_heap_tag container_category;
typedef basic_invalidation_guarantee invalidation_guarantee;
enum
{
order_preserving = false,
erase_can_throw = false,
split_join_can_throw = true,
reverse_iteration = false
};
};
/// Container traits.
// See Matt Austern for the name, S. Meyers MEFC++ #2, others.
template<typename Cntnr>
struct container_traits
: public container_traits_base<typename Cntnr::container_category>
{
typedef Cntnr container_type;
typedef typename Cntnr::container_category container_category;
typedef container_traits_base<container_category> base_type;
typedef typename base_type::invalidation_guarantee invalidation_guarantee;
enum
{
/// True only if Cntnr objects guarantee storing keys by order.
order_preserving = base_type::order_preserving,
/// True only if erasing a key can throw.
erase_can_throw = base_type::erase_can_throw,
/// True only if split or join operations can throw.
split_join_can_throw = base_type::split_join_can_throw,
/// True only reverse iterators are supported.
reverse_iteration = base_type::reverse_iteration
};
};
//@}
namespace detail
{
/// Dispatch mechanism, primary template for associative types.
template<typename Key, typename Mapped, typename _Alloc, typename Tag,
typename Policy_Tl = null_type>
struct container_base_dispatch;
} // namespace detail
//@}
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_policy.hpp
* Contains policies for list update containers.
*/
#ifndef PB_DS_LU_POLICY_HPP
#define PB_DS_LU_POLICY_HPP
#include <bits/c++config.h>
#include <cstdlib>
#include <ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
namespace __gnu_pbds
{
/**
* A list-update policy that unconditionally moves elements to the
* front of the list. A null type means that each link in a
* list-based container does not actually need metadata.
*/
template<typename _Alloc = std::allocator<char> >
class lu_move_to_front_policy
{
public:
typedef _Alloc allocator_type;
/// Metadata on which this functor operates.
typedef null_type metadata_type;
private:
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
public:
/// Reference to metadata on which this functor operates.
typedef typename __rebind_m::other::reference metadata_reference;
/// Creates a metadata object.
metadata_type
operator()() const
{ return s_metadata; }
/// Decides whether a metadata object should be moved to the front
/// of the list.
inline bool
operator()(metadata_reference r_metadata) const
{ return true; }
private:
static null_type s_metadata;
};
/**
* A list-update policy that moves elements to the front of the
* list based on the counter algorithm.
*/
template<std::size_t Max_Count = 5, typename _Alloc = std::allocator<char> >
class lu_counter_policy
: private detail::lu_counter_policy_base<typename _Alloc::size_type>
{
public:
typedef _Alloc allocator_type;
typedef typename allocator_type::size_type size_type;
enum
{
/// When some element is accessed this number of times, it
/// will be moved to the front of the list.
max_count = Max_Count
};
/// Metadata on which this functor operates.
typedef detail::lu_counter_metadata<size_type> metadata_type;
private:
typedef detail::lu_counter_policy_base<size_type> base_type;
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
public:
/// Reference to metadata on which this functor operates.
typedef typename __rebind_m::other::reference metadata_reference;
/// Creates a metadata object.
metadata_type
operator()() const
{ return base_type::operator()(max_count); }
/// Decides whether a metadata object should be moved to the front
/// of the list.
bool
operator()(metadata_reference r_data) const
{ return base_type::operator()(r_data, max_count); }
};
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file priority_queue.hpp
* Contains priority_queues.
*/
#ifndef PB_DS_PRIORITY_QUEUE_HPP
#define PB_DS_PRIORITY_QUEUE_HPP
#include <bits/c++config.h>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
namespace __gnu_pbds
{
/**
* @defgroup heap-based Heap-Based
* @ingroup containers-pbds
* @{
*/
/**
* @defgroup heap-detail Base and Policy Classes
* @ingroup heap-based
*/
/**
* A priority queue composed of one specific heap policy.
*
* @tparam _Tv Value type.
* @tparam Cmp_Fn Comparison functor.
* @tparam Tag Instantiating data structure type,
* see container_tag.
* @tparam _Alloc Allocator type.
*
* Base is dispatched at compile time via Tag, from the following
* choices: binary_heap_tag, binomial_heap_tag, pairing_heap_tag,
* rc_binomial_heap_tag, thin_heap_tag
*
* Base choices are: detail::binary_heap, detail::binomial_heap,
* detail::pairing_heap, detail::rc_binomial_heap,
* detail::thin_heap.
*/
template<typename _Tv,
typename Cmp_Fn = std::less<_Tv>,
typename Tag = pairing_heap_tag,
typename _Alloc = std::allocator<char> >
class priority_queue
: public detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, Tag>::type
{
public:
typedef _Tv value_type;
typedef Cmp_Fn cmp_fn;
typedef Tag container_category;
typedef _Alloc allocator_type;
typedef typename allocator_type::size_type size_type;
typedef typename allocator_type::difference_type difference_type;
private:
typedef typename detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc,
Tag>::type
base_type;
typedef typename _Alloc::template rebind<_Tv> __rebind_v;
typedef typename __rebind_v::other __rebind_va;
public:
typedef typename __rebind_va::reference reference;
typedef typename __rebind_va::const_reference const_reference;
typedef typename __rebind_va::pointer pointer;
typedef typename __rebind_va::const_pointer const_pointer;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::point_const_iterator point_const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
priority_queue() { }
/// Constructor taking some policy objects. r_cmp_fn will be
/// copied by the Cmp_Fn object of the container object.
priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }
/// Constructor taking __iterators to a range of value_types. The
/// value_types between first_it and last_it will be inserted into
/// the container object.
template<typename It>
priority_queue(It first_it, It last_it)
{ base_type::copy_from_range(first_it, last_it); }
/// Constructor taking __iterators to a range of value_types and
/// some policy objects The value_types between first_it and
/// last_it will be inserted into the container object. r_cmp_fn
/// will be copied by the cmp_fn object of the container object.
template<typename It>
priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)
: base_type(r_cmp_fn)
{ base_type::copy_from_range(first_it, last_it); }
priority_queue(const priority_queue& other)
: base_type((const base_type& )other) { }
virtual
~priority_queue() { }
priority_queue&
operator=(const priority_queue& other)
{
if (this != &other)
{
priority_queue tmp(other);
swap(tmp);
}
return *this;
}
void
swap(priority_queue& other)
{ base_type::swap(other); }
};
} // namespace __gnu_pbds
//@} heap-based
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file container_base_dispatch.hpp
* Contains associative container dispatching.
*/
#ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
#define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
#include <ext/typelist.h>
#define PB_DS_ASSERT_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)
#define PB_DS_DEBUG_VERIFY(_Cond) \
_GLIBCXX_DEBUG_VERIFY_AT(_Cond, \
_M_message(#_Cond" assertion from %1;:%2;") \
._M_string(__FILE__)._M_integer(__LINE__) \
,__file,__line)
#define PB_DS_CHECK_KEY_EXISTS(_Key) \
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(_Key, __FILE__, __LINE__);)
#define PB_DS_CHECK_KEY_DOES_NOT_EXIST(_Key) \
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(_Key, \
__FILE__, __LINE__);)
#define PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_V2F(X) (X).first
#define PB_DS_V2S(X) (X).second
#define PB_DS_EP2VP(X)& ((X)->m_value)
#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
#undef PB_DS_DATA_TRUE_INDICATOR
#undef PB_DS_V2F
#undef PB_DS_V2S
#undef PB_DS_EP2VP
#define PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_V2F(X) (X)
#define PB_DS_V2S(X) Mapped_Data()
#define PB_DS_EP2VP(X)& ((X)->m_value.first)
#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
#undef PB_DS_DATA_FALSE_INDICATOR
#undef PB_DS_V2F
#undef PB_DS_V2S
#undef PB_DS_EP2VP
#undef PB_DS_CHECK_KEY_DOES_NOT_EXIST
#undef PB_DS_CHECK_KEY_EXISTS
#undef PB_DS_DEBUG_VERIFY
#undef PB_DS_ASSERT_VALID
namespace __gnu_pbds
{
namespace detail
{
/// Specialization for list-update map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, list_update_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef lu_map<Key, Mapped, at0t, _Alloc, at1t> type;
};
/// Specialization for list-update set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, list_update_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef lu_set<Key, null_type, at0t, _Alloc, at1t> type;
};
/// Specialization for PATRICIA trie map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, pat_trie_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
typedef pat_trie_map<Key, Mapped, at1t, _Alloc> type;
};
/// Specialization for PATRICIA trie set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, pat_trie_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef pat_trie_set<Key, null_type, at1t, _Alloc> type;
};
/// Specialization for R-B tree map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, rb_tree_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef rb_tree_map<Key, Mapped, at0t, at1t, _Alloc> type;
};
/// Specialization for R-B tree set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, rb_tree_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
typedef rb_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
};
/// Specialization splay tree map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, splay_tree_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef splay_tree_map<Key, Mapped, at0t, at1t, _Alloc> type;
};
/// Specialization splay tree set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, splay_tree_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef splay_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
};
/// Specialization ordered-vector tree map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, ov_tree_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef ov_tree_map<Key, Mapped, at0t, at1t, _Alloc> type;
};
/// Specialization ordered-vector tree set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, ov_tree_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
/// Dispatched type.
typedef ov_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
};
/// Specialization colision-chaining hash map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, cc_hash_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
typedef typename at2::type at2t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
typedef typename at3::type at3t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
typedef typename at4::type at4t;
public:
/// Dispatched type.
typedef cc_ht_map<Key, Mapped, at0t, at1t, _Alloc,
at3t::value, at4t, at2t> type;
};
/// Specialization colision-chaining hash set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, cc_hash_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
typedef typename at2::type at2t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
typedef typename at3::type at3t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
typedef typename at4::type at4t;
public:
/// Dispatched type.
typedef cc_ht_set<Key, null_type, at0t, at1t, _Alloc,
at3t::value, at4t, at2t> type;
};
/// Specialization general-probe hash map.
template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, Mapped, _Alloc, gp_hash_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
typedef typename at2::type at2t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
typedef typename at3::type at3t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
typedef typename at4::type at4t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5;
typedef typename at5::type at5t;
public:
/// Dispatched type.
typedef gp_ht_map<Key, Mapped, at0t, at1t, _Alloc,
at3t::value, at4t, at5t, at2t> type;
};
/// Specialization general-probe hash set.
template<typename Key, typename _Alloc, typename Policy_Tl>
struct container_base_dispatch<Key, null_type, _Alloc, gp_hash_tag,
Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
typedef typename at2::type at2t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
typedef typename at3::type at3t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
typedef typename at4::type at4t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5;
typedef typename at5::type at5t;
public:
/// Dispatched type.
typedef gp_ht_set<Key, null_type, at0t, at1t, _Alloc,
at3t::value, at4t, at5t, at2t> type;
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/debug_map_base.hpp
* Contains a debug-mode base for all maps.
*/
#ifndef PB_DS_DEBUG_MAP_BASE_HPP
#define PB_DS_DEBUG_MAP_BASE_HPP
#ifdef _GLIBCXX_DEBUG
#include <list>
#include <utility>
#include <cstdlib>
#include <iostream>
#include <ext/throw_allocator.h>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
// Need std::pair ostream extractor.
template<typename _CharT, typename _Traits, typename _Tp1, typename _Tp2>
inline std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __out,
const std::pair<_Tp1, _Tp2>& p)
{ return (__out << '(' << p.first << ',' << p.second << ')'); }
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Eq_Fn, typename Const_Key_Reference>
#define PB_DS_CLASS_C_DEC \
debug_map_base<Key, Eq_Fn, Const_Key_Reference>
/// Debug base class.
template<typename Key, typename Eq_Fn, typename Const_Key_Reference>
class debug_map_base
{
private:
typedef Const_Key_Reference key_const_reference;
typedef std::_GLIBCXX_STD_C::list<Key> key_repository;
typedef typename key_repository::size_type size_type;
typedef typename key_repository::iterator iterator;
typedef typename key_repository::const_iterator const_iterator;
protected:
debug_map_base();
debug_map_base(const PB_DS_CLASS_C_DEC&);
~debug_map_base();
inline void
insert_new(key_const_reference);
inline void
erase_existing(key_const_reference);
void
clear();
inline void
check_key_exists(key_const_reference, const char*, int) const;
inline void
check_key_does_not_exist(key_const_reference, const char*, int) const;
inline void
check_size(size_type, const char*, int) const;
void
swap(PB_DS_CLASS_C_DEC&);
template<typename Cmp_Fn>
void
split(key_const_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
void
join(PB_DS_CLASS_C_DEC&, bool with_cleanup = true);
private:
void
assert_valid(const char*, int) const;
const_iterator
find(key_const_reference) const;
iterator
find(key_const_reference);
key_repository m_keys;
Eq_Fn m_eq;
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
debug_map_base()
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
debug_map_base(const PB_DS_CLASS_C_DEC& other)
: m_keys(other.m_keys), m_eq(other.m_eq)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~debug_map_base()
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
insert_new(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
if (find(r_key) != m_keys.end())
{
std::cerr << "insert_new key already present " << r_key << std::endl;
std::abort();
}
__try
{
m_keys.push_back(r_key);
}
__catch(...)
{
std::cerr << "insert_new " << r_key << std::endl;
std::abort();
}
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
erase_existing(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
iterator it = find(r_key);
if (it == m_keys.end())
{
std::cerr << "erase_existing" << r_key << std::endl;
std::abort();
}
m_keys.erase(it);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
PB_DS_ASSERT_VALID((*this))
m_keys.clear();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
check_key_exists(key_const_reference r_key,
const char* __file, int __line) const
{
assert_valid(__file, __line);
if (find(r_key) == m_keys.end())
{
std::cerr << __file << ':' << __line << ": check_key_exists "
<< r_key << std::endl;
std::abort();
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
check_key_does_not_exist(key_const_reference r_key,
const char* __file, int __line) const
{
assert_valid(__file, __line);
if (find(r_key) != m_keys.end())
{
using std::cerr;
using std::endl;
cerr << __file << ':' << __line << ": check_key_does_not_exist "
<< r_key << endl;
std::abort();
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
check_size(size_type size, const char* __file, int __line) const
{
assert_valid(__file, __line);
const size_type keys_size = m_keys.size();
if (size != keys_size)
{
std::cerr << __file << ':' << __line << ": check_size "
<< size << " != " << keys_size << std::endl;
std::abort();
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
m_keys.swap(other.m_keys);
std::swap(m_eq, other.m_eq);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
typedef const_iterator iterator_type;
for (iterator_type it = m_keys.begin(); it != m_keys.end(); ++it)
if (m_eq(*it, r_key))
return it;
return m_keys.end();
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
iterator it = m_keys.begin();
while (it != m_keys.end())
{
if (m_eq(*it, r_key))
return it;
++it;
}
return it;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
const_iterator prime_it = m_keys.begin();
while (prime_it != m_keys.end())
{
const_iterator sec_it = prime_it;
++sec_it;
while (sec_it != m_keys.end())
{
PB_DS_DEBUG_VERIFY(!m_eq(*sec_it, *prime_it));
PB_DS_DEBUG_VERIFY(!m_eq(*prime_it, *sec_it));
++sec_it;
}
++prime_it;
}
}
PB_DS_CLASS_T_DEC
template<typename Cmp_Fn>
void
PB_DS_CLASS_C_DEC::
split(key_const_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
{
other.clear();
iterator it = m_keys.begin();
while (it != m_keys.end())
if (cmp_fn(r_key, *it))
{
other.insert_new(*it);
it = m_keys.erase(it);
}
else
++it;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other, bool with_cleanup)
{
iterator it = other.m_keys.begin();
while (it != other.m_keys.end())
{
insert_new(*it);
if (with_cleanup)
it = other.m_keys.erase(it);
else
++it;
}
_GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_keys.empty());
}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/priority_queue_base_dispatch.hpp
* Contains an pqiative container dispatching base.
*/
#ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
#define PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
#define PB_DS_ASSERT_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)
#define PB_DS_DEBUG_VERIFY(_Cond) \
_GLIBCXX_DEBUG_VERIFY_AT(_Cond, \
_M_message(#_Cond" assertion from %1;:%2;") \
._M_string(__FILE__)._M_integer(__LINE__) \
,__file,__line)
#include <ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp>
#include <ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp>
#include <ext/pb_ds/detail/binary_heap_/binary_heap_.hpp>
#include <ext/pb_ds/detail/thin_heap_/thin_heap_.hpp>
#undef PB_DS_DEBUG_VERIFY
#undef PB_DS_ASSERT_VALID
namespace __gnu_pbds
{
namespace detail
{
/// Specialization for pairing_heap.
template<typename _VTp, typename Cmp_Fn, typename _Alloc>
struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, pairing_heap_tag,
null_type>
{
/// Dispatched type.
typedef pairing_heap<_VTp, Cmp_Fn, _Alloc> type;
};
/// Specialization for binomial_heap.
template<typename _VTp, typename Cmp_Fn, typename _Alloc>
struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binomial_heap_tag,
null_type>
{
/// Dispatched type.
typedef binomial_heap<_VTp, Cmp_Fn, _Alloc> type;
};
/// Specialization for rc_binary_heap.
template<typename _VTp, typename Cmp_Fn, typename _Alloc>
struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, rc_binomial_heap_tag,
null_type>
{
/// Dispatched type.
typedef rc_binomial_heap<_VTp, Cmp_Fn, _Alloc> type;
};
/// Specialization for binary_heap.
template<typename _VTp, typename Cmp_Fn, typename _Alloc>
struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binary_heap_tag,
null_type>
{
/// Dispatched type.
typedef binary_heap<_VTp, Cmp_Fn, _Alloc> type;
};
/// Specialization for thin_heap.
template<typename _VTp, typename Cmp_Fn, typename _Alloc>
struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, thin_heap_tag,
null_type>
{
/// Dispatched type.
typedef thin_heap<_VTp, Cmp_Fn, _Alloc> type;
};
//@} group pbds
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/trie_policy_base.hpp
* Contains an implementation of trie_policy_base.
*/
#ifndef PB_DS_TRIE_POLICY_BASE_HPP
#define PB_DS_TRIE_POLICY_BASE_HPP
#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Base class for trie policies.
template<typename Node_CItr, typename Node_Itr,
typename _ATraits, typename _Alloc>
class trie_policy_base
: public branch_policy<Node_CItr, Node_Itr, _Alloc>
{
typedef branch_policy<Node_CItr, Node_Itr, _Alloc> base_type;
public:
typedef _ATraits access_traits;
typedef _Alloc allocator_type;
typedef typename allocator_type::size_type size_type;
typedef null_type metadata_type;
typedef Node_CItr node_const_iterator;
typedef Node_Itr node_iterator;
typedef typename node_const_iterator::value_type const_iterator;
typedef typename node_iterator::value_type iterator;
typedef typename base_type::key_type key_type;
typedef typename base_type::key_const_reference key_const_reference;
protected:
virtual const_iterator
end() const = 0;
virtual iterator
end() = 0;
virtual node_const_iterator
node_begin() const = 0;
virtual node_iterator
node_begin() = 0;
virtual node_const_iterator
node_end() const = 0;
virtual node_iterator
node_end() = 0;
virtual const access_traits&
get_access_traits() const = 0;
private:
typedef typename access_traits::const_iterator e_const_iterator;
typedef std::pair<e_const_iterator, e_const_iterator> prefix_range_t;
protected:
static size_type
common_prefix_len(node_iterator, e_const_iterator,
e_const_iterator, const access_traits&);
static iterator
leftmost_it(node_iterator);
static iterator
rightmost_it(node_iterator);
static bool
less(e_const_iterator, e_const_iterator, e_const_iterator,
e_const_iterator, const access_traits&);
};
#define PB_DS_CLASS_T_DEC \
template<typename Node_CItr, typename Node_Itr, \
typename _ATraits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
trie_policy_base<Node_CItr, Node_Itr, _ATraits, _Alloc>
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
common_prefix_len(node_iterator nd_it, e_const_iterator b_r,
e_const_iterator e_r, const access_traits& r_traits)
{
prefix_range_t pref_range = nd_it.valid_prefix();
e_const_iterator b_l = pref_range.first;
e_const_iterator e_l = pref_range.second;
const size_type range_length_l = std::distance(b_l, e_l);
const size_type range_length_r = std::distance(b_r, e_r);
if (range_length_r < range_length_l)
{
std::swap(b_l, b_r);
std::swap(e_l, e_r);
}
size_type ret = 0;
while (b_l != e_l)
{
if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r))
return ret;
++ret;
++b_l;
++b_r;
}
return ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
leftmost_it(node_iterator nd_it)
{
if (nd_it.num_children() == 0)
return *nd_it;
return leftmost_it(nd_it.get_child(0));
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
rightmost_it(node_iterator nd_it)
{
const size_type num_children = nd_it.num_children();
if (num_children == 0)
return *nd_it;
return rightmost_it(nd_it.get_child(num_children - 1));
}
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
less(e_const_iterator b_l, e_const_iterator e_l,
e_const_iterator b_r, e_const_iterator e_r,
const access_traits& r_traits)
{
while (b_l != e_l)
{
if (b_r == e_r)
return false;
size_type l_pos = r_traits.e_pos(*b_l);
size_type r_pos = r_traits.e_pos(*b_r);
if (l_pos != r_pos)
return (l_pos < r_pos);
++b_l;
++b_r;
}
return b_r != e_r;
}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/sample_trie_access_traits.hpp
* Contains a sample probe policy.
*/
#ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
#define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
namespace __gnu_pbds
{
/// A sample trie element access traits.
struct sample_trie_access_traits
{
typedef std::size_t size_type;
typedef std::string key_type;
typedef typename _Alloc::template rebind<key_type> __rebind_k;
typedef typename __rebind_k::other::const_reference key_const_reference;
typedef std::string::const_iterator const_iterator;
/// Element type.
typedef char e_type;
enum
{
max_size = 4
};
/// Returns a const_iterator to the first element of r_key.
inline static const_iterator
begin(key_const_reference);
/// Returns a const_iterator to the after-last element of r_key.
inline static const_iterator
end(key_const_reference);
/// Maps an element to a position.
inline static size_type
e_pos(e_type);
};
}
#endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/prefix_search_node_update_imp.hpp
* Contains an implementation of prefix_search_node_update.
*/
PB_DS_CLASS_T_DEC
std::pair<
typename PB_DS_CLASS_C_DEC::const_iterator,
typename PB_DS_CLASS_C_DEC::const_iterator>
PB_DS_CLASS_C_DEC::
prefix_range(key_const_reference r_key) const
{
const access_traits& r_traits = get_access_traits();
return (prefix_range(r_traits.begin(r_key), r_traits.end(r_key)));
}
PB_DS_CLASS_T_DEC
std::pair<
typename PB_DS_CLASS_C_DEC::iterator,
typename PB_DS_CLASS_C_DEC::iterator>
PB_DS_CLASS_C_DEC::
prefix_range(key_const_reference r_key)
{
return (prefix_range(get_access_traits().begin(r_key),
get_access_traits().end(r_key)));
}
PB_DS_CLASS_T_DEC
std::pair<
typename PB_DS_CLASS_C_DEC::const_iterator,
typename PB_DS_CLASS_C_DEC::const_iterator>
PB_DS_CLASS_C_DEC::
prefix_range(typename access_traits::const_iterator b,
typename access_traits::const_iterator e) const
{
const std::pair<iterator, iterator> non_const_ret =
const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e);
return (std::make_pair(const_iterator(non_const_ret.first),
const_iterator(non_const_ret.second)));
}
PB_DS_CLASS_T_DEC
std::pair<
typename PB_DS_CLASS_C_DEC::iterator,
typename PB_DS_CLASS_C_DEC::iterator>
PB_DS_CLASS_C_DEC::
prefix_range(typename access_traits::const_iterator b,
typename access_traits::const_iterator e)
{
Node_Itr nd_it = node_begin();
Node_Itr end_nd_it = node_end();
const access_traits& r_traits = get_access_traits();
const size_type given_range_length = std::distance(b, e);
while (true)
{
if (nd_it == end_nd_it)
return (std::make_pair(end(), end()));
const size_type common_range_length =
base_type::common_prefix_len(nd_it, b, e, r_traits);
if (common_range_length >= given_range_length)
{
iterator ret_b = this->leftmost_it(nd_it);
iterator ret_e = this->rightmost_it(nd_it);
return (std::make_pair(ret_b, ++ret_e));
}
nd_it = next_child(nd_it, b, e, end_nd_it, r_traits);
}
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
next_child(node_iterator nd_it, typename access_traits::const_iterator b,
typename access_traits::const_iterator e, node_iterator end_nd_it,
const access_traits& r_traits)
{
const size_type num_children = nd_it.num_children();
node_iterator ret = end_nd_it;
size_type max_length = 0;
for (size_type i = 0; i < num_children; ++i)
{
node_iterator pot = nd_it.get_child(i);
const size_type common_range_length =
base_type::common_prefix_len(pot, b, e, r_traits);
if (common_range_length > max_length)
{
ret = pot;
max_length = common_range_length;
}
}
return (ret);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
operator()(node_iterator /*nd_it*/, node_const_iterator /*end_nd_it*/) const
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/node_metadata_selector.hpp
* Contains an implementation class for tries.
*/
#ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
#define PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
/**
* @addtogroup traits Traits
* @{
*/
/// Trie metadata helper.
template<typename Node_Update, bool _BTp>
struct trie_metadata_helper;
/// Specialization, false.
template<typename Node_Update>
struct trie_metadata_helper<Node_Update, false>
{
typedef typename Node_Update::metadata_type type;
};
/// Specialization, true.
template<typename Node_Update>
struct trie_metadata_helper<Node_Update, true>
{
typedef null_type type;
};
/// Trie node metadata dispatch.
template<typename Key,
typename Data,
typename Cmp_Fn,
template<typename Node_CItr,
typename Const_Iterator,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct trie_node_metadata_dispatch
{
private:
typedef dumnode_const_iterator<Key, Data, _Alloc> __it_type;
typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc> __node_u;
typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;
enum
{
null_update = is_same<__node_u, __nnode_u>::value
};
public:
typedef typename trie_metadata_helper<__node_u, null_update>::type type;
};
//@}
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/order_statistics_imp.hpp
* Contains forward declarations for order_statistics_key
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
find_by_order(size_type order)
{
if (empty())
return end();
++order;
node_iterator nd_it = node_begin();
while (true)
{
if (order > nd_it.get_metadata())
return ++base_type::rightmost_it(nd_it);
const size_type num_children = nd_it.num_children();
if (num_children == 0)
return *nd_it;
for (size_type i = 0; i < num_children; ++i)
{
node_iterator child_nd_it = nd_it.get_child(i);
if (order <= child_nd_it.get_metadata())
{
i = num_children;
nd_it = child_nd_it;
}
else
order -= child_nd_it.get_metadata();
}
}
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
find_by_order(size_type order) const
{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
order_of_key(key_const_reference r_key) const
{
const _ATraits& r_traits =
const_cast<PB_DS_CLASS_C_DEC* >(this)->get_access_traits();
return order_of_prefix(r_traits.begin(r_key), r_traits.end(r_key));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
order_of_prefix(typename access_traits::const_iterator b,
typename access_traits::const_iterator e) const
{
if (empty())
return 0;
const _ATraits& r_traits =
const_cast<PB_DS_CLASS_C_DEC*>(this)->get_access_traits();
node_const_iterator nd_it = node_begin();
node_const_iterator end_nd_it = node_end();
size_type ord = 0;
while (true)
{
const size_type num_children = nd_it.num_children();
if (num_children == 0)
{
key_const_reference r_key = base_type::extract_key(*(*nd_it));
typename access_traits::const_iterator key_b =
r_traits.begin(r_key);
typename access_traits::const_iterator key_e =
r_traits.end(r_key);
return (base_type::less(key_b, key_e, b, e, r_traits)) ?
ord + 1 : ord;
}
node_const_iterator next_nd_it = end_nd_it;
size_type i = num_children - 1;
do
{
node_const_iterator child_nd_it = nd_it.get_child(i);
if (next_nd_it != end_nd_it)
ord += child_nd_it.get_metadata();
else if (!base_type::less(b, e,
child_nd_it.valid_prefix().first,
child_nd_it.valid_prefix().second,
r_traits))
next_nd_it = child_nd_it;
}
while (i-- > 0);
if (next_nd_it == end_nd_it)
return ord;
nd_it = next_nd_it;
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
operator()(node_iterator nd_it, node_const_iterator /*end_nd_it*/) const
{
const size_type num_children = nd_it.num_children();
size_type children_rank = 0;
for (size_type i = 0; i < num_children; ++i)
children_rank += nd_it.get_child(i).get_metadata();
const size_type res = (num_children == 0) ? 1 : children_rank;
const_cast<size_type&>(nd_it.get_metadata()) = res;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/trie_string_access_traits_imp.hpp
* Contains a policy for extracting character positions from
* a string for a vector-based PATRICIA tree
*/
PB_DS_CLASS_T_DEC
detail::integral_constant<int, Reverse> PB_DS_CLASS_C_DEC::s_rev_ind;
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
e_pos(e_type e)
{
return (static_cast<size_type>(e - min_e_val));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin(key_const_reference r_key)
{
return (begin_imp(r_key, s_rev_ind));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end(key_const_reference r_key)
{
return (end_imp(r_key, s_rev_ind));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin_imp(key_const_reference r_key, detail::false_type)
{
return (r_key.begin());
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin_imp(key_const_reference r_key, detail::true_type)
{
return (r_key.rbegin());
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end_imp(key_const_reference r_key, detail::false_type)
{
return (r_key.end());
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end_imp(key_const_reference r_key, detail::true_type)
{
return (r_key.rend());
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file trie_policy/sample_trie_node_update.hpp
* Contains a samle node update functor.
*/
#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
namespace __gnu_pbds
{
/// A sample node updator.
template<typename Node_CItr, typename Node_Itr,
typename _ATraits, typename _Alloc>
class sample_trie_node_update
{
public:
typedef std::size_t metadata_type;
protected:
/// Default constructor.
sample_trie_node_update();
/// Updates the rank of a node through a node_iterator node_it;
/// end_nd_it is the end node iterator.
inline void
operator()(node_iterator, node_const_iterator) const;
};
}
#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/standard_policies.hpp
* Contains standard policies for containers.
*/
#ifndef PB_DS_STANDARD_POLICIES_HPP
#define PB_DS_STANDARD_POLICIES_HPP
#include <memory>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/list_update_policy.hpp>
#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <tr1/functional>
namespace __gnu_pbds
{
namespace detail
{
/// Primary template, default_hash_fn.
template<typename Key>
struct default_hash_fn
{
/// Dispatched type.
typedef std::tr1::hash<Key> type;
};
/// Primary template, default_eq_fn.
template<typename Key>
struct default_eq_fn
{
/// Dispatched type.
typedef std::equal_to<Key> type;
};
/// Enumeration for default behavior of stored hash data.
enum
{
default_store_hash = false
};
/// Primary template, default_comb_hash_fn.
struct default_comb_hash_fn
{
/// Dispatched type.
typedef direct_mask_range_hashing<> type;
};
/// Primary template, default_resize_policy.
template<typename Comb_Hash_Fn>
struct default_resize_policy
{
private:
typedef typename Comb_Hash_Fn::size_type size_type;
typedef direct_mask_range_hashing<size_type> default_fn;
typedef is_same<default_fn, Comb_Hash_Fn> same_type;
typedef hash_exponential_size_policy<size_type> iftrue;
typedef hash_prime_size_policy iffalse;
typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;
typedef typename cond_type::__type size_policy_type;
typedef hash_load_check_resize_trigger<false, size_type> trigger;
public:
/// Dispatched type.
typedef hash_standard_resize_policy<size_policy_type, trigger,
false, size_type> type;
};
/// Default update policy.
struct default_update_policy
{
/// Dispatched type.
typedef lu_move_to_front_policy<> type;
};
/// Primary template, default_probe_fn.
template<typename Comb_Probe_Fn>
struct default_probe_fn
{
private:
typedef typename Comb_Probe_Fn::size_type size_type;
typedef direct_mask_range_hashing<size_type> default_fn;
typedef is_same<default_fn, Comb_Probe_Fn> same_type;
typedef linear_probe_fn<size_type> iftrue;
typedef quadratic_probe_fn<size_type> iffalse;
typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;
public:
/// Dispatched type.
typedef typename cond_type::__type type;
};
/// Primary template, default_trie_access_traits.
template<typename Key>
struct default_trie_access_traits;
#define __dtrie_alloc std::allocator<char>
#define __dtrie_string std::basic_string<Char, Char_Traits, __dtrie_alloc>
/// Partial specialization, default_trie_access_traits.
template<typename Char, typename Char_Traits>
struct default_trie_access_traits<__dtrie_string>
{
private:
typedef __dtrie_string string_type;
public:
/// Dispatched type.
typedef trie_string_access_traits<string_type> type;
};
#undef __dtrie_alloc
#undef __dtrie_string
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_STANDARD_POLICIES_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/tree_trace_base.hpp
* Contains tree-related policies.
*/
#ifndef PB_DS_TREE_TRACE_BASE_HPP
#define PB_DS_TREE_TRACE_BASE_HPP
#ifdef PB_DS_TREE_TRACE
#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_TREE_TRACE
#define PB_DS_CLASS_T_DEC \
template<typename Node_CItr, typename Node_Itr, \
typename Cmp_Fn, bool Node_Based, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
tree_trace_base<Node_CItr, Node_Itr, Cmp_Fn, \
Node_Based, _Alloc>
#define PB_DS_TRACE_BASE \
branch_policy<Node_CItr, Node_Itr, _Alloc>
/// Tracing base class.
template<typename Node_CItr, typename Node_Itr,
typename Cmp_Fn, bool Node_Based, typename _Alloc>
class tree_trace_base : private PB_DS_TRACE_BASE
{
public:
void
trace() const;
private:
typedef PB_DS_TRACE_BASE base_type;
typedef Node_CItr node_const_iterator;
typedef typename _Alloc::size_type size_type;
void
trace_node(node_const_iterator, size_type) const;
virtual bool
empty() const = 0;
virtual node_const_iterator
node_begin() const = 0;
virtual node_const_iterator
node_end() const = 0;
static void
print_node_pointer(Node_CItr, integral_constant<int,true>);
static void
print_node_pointer(Node_CItr, integral_constant<int,false>);
template<typename Metadata_>
static void
trace_it_metadata(Node_CItr, type_to_type<Metadata_>);
static void
trace_it_metadata(Node_CItr, type_to_type<null_type>);
};
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
if (empty())
return;
trace_node(node_begin(), 0);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_node(node_const_iterator nd_it, size_type level) const
{
if (nd_it.get_r_child() != node_end())
trace_node(nd_it.get_r_child(), level + 1);
for (size_type i = 0; i < level; ++i)
std::cerr << ' ';
print_node_pointer(nd_it, integral_constant<int,Node_Based>());
std::cerr << base_type::extract_key(*(*nd_it));
typedef type_to_type<typename node_const_iterator::metadata_type>
m_type_ind_t;
trace_it_metadata(nd_it, m_type_ind_t());
std::cerr << std::endl;
if (nd_it.get_l_child() != node_end())
trace_node(nd_it.get_l_child(), level + 1);
}
PB_DS_CLASS_T_DEC
template<typename Metadata_>
void
PB_DS_CLASS_C_DEC::
trace_it_metadata(Node_CItr nd_it, type_to_type<Metadata_>)
{
const unsigned long ul = static_cast<unsigned long>(nd_it.get_metadata());
std::cerr << " (" << ul << ") ";
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_it_metadata(Node_CItr, type_to_type<null_type>)
{ }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
print_node_pointer(Node_CItr nd_it, integral_constant<int,true>)
{ std::cerr << nd_it.m_p_nd << " "; }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
print_node_pointer(Node_CItr nd_it, integral_constant<int,false>)
{ std::cerr << *nd_it << " "; }
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_TRACE_BASE
#endif // #ifdef PB_DS_TREE_TRACE
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifdef PB_DS_TREE_TRACE
#endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file tree_policy/node_metadata_selector.hpp
* Contains an implementation class for trees.
*/
#ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
#define PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
/**
* @addtogroup traits Traits
* @{
*/
/// Tree metadata helper.
template<typename Node_Update, bool _BTp>
struct tree_metadata_helper;
/// Specialization, false.
template<typename Node_Update>
struct tree_metadata_helper<Node_Update, false>
{
typedef typename Node_Update::metadata_type type;
};
/// Specialization, true.
template<typename Node_Update>
struct tree_metadata_helper<Node_Update, true>
{
typedef null_type type;
};
/// Tree node metadata dispatch.
template<typename Key,
typename Data,
typename Cmp_Fn,
template<typename Node_CItr,
typename Const_Iterator,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct tree_node_metadata_dispatch
{
private:
typedef dumnode_const_iterator<Key, Data, _Alloc> __it_type;
typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc> __node_u;
typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;
enum
{
null_update = is_same<__node_u, __nnode_u>::value
};
public:
typedef typename tree_metadata_helper<__node_u, null_update>::type type;
};
//@}
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file tree_policy/sample_tree_node_update.hpp
* Contains a samle node update functor.
*/
#ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
#define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
namespace __gnu_pbds
{
/// A sample node updator.
template<typename Const_Node_Iter, typename Node_Iter, typename Cmp_Fn,
typename _Alloc>
class sample_tree_node_update
{
typedef std::size_t metadata_type;
/// Default constructor.
sample_tree_node_update();
/// Updates the rank of a node through a node_iterator node_it;
/// end_nd_it is the end node iterator.
inline void
operator()(node_iterator node_it, node_const_iterator end_nd_it) const;
};
}
#endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file tree_policy/order_statistics_imp.hpp
* Contains forward declarations for order_statistics_key
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
find_by_order(size_type order)
{
node_iterator it = node_begin();
node_iterator end_it = node_end();
while (it != end_it)
{
node_iterator l_it = it.get_l_child();
const size_type o = (l_it == end_it)? 0 : l_it.get_metadata();
if (order == o)
return *it;
else if (order < o)
it = l_it;
else
{
order -= o + 1;
it = it.get_r_child();
}
}
return base_type::end_iterator();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
find_by_order(size_type order) const
{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
order_of_key(key_const_reference r_key) const
{
node_const_iterator it = node_begin();
node_const_iterator end_it = node_end();
const cmp_fn& r_cmp_fn = const_cast<PB_DS_CLASS_C_DEC*>(this)->get_cmp_fn();
size_type ord = 0;
while (it != end_it)
{
node_const_iterator l_it = it.get_l_child();
if (r_cmp_fn(r_key, this->extract_key(*(*it))))
it = l_it;
else if (r_cmp_fn(this->extract_key(*(*it)), r_key))
{
ord += (l_it == end_it)? 1 : 1 + l_it.get_metadata();
it = it.get_r_child();
}
else
{
ord += (l_it == end_it)? 0 : l_it.get_metadata();
it = end_it;
}
}
return ord;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
operator()(node_iterator node_it, node_const_iterator end_nd_it) const
{
node_iterator l_it = node_it.get_l_child();
const size_type l_rank = (l_it == end_nd_it) ? 0 : l_it.get_metadata();
node_iterator r_it = node_it.get_r_child();
const size_type r_rank = (r_it == end_nd_it) ? 0 : r_it.get_metadata();
const_cast<metadata_reference>(node_it.get_metadata())= 1 + l_rank + r_rank;
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~tree_order_statistics_node_update()
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file sample_ranged_hash_fn.hpp
* Contains a ranged hash policy.
*/
#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP
namespace __gnu_pbds
{
/// A sample ranged-hash functor.
class sample_ranged_hash_fn
{
public:
typedef std::size_t size_type;
/// Default constructor.
sample_ranged_hash_fn();
/// Copy constructor.
sample_ranged_hash_fn(const sample_ranged_hash_fn&);
/// Swaps content.
inline void
swap(sample_ranged_hash_fn&);
protected:
/// Notifies the policy object that the container's __size has
/// changed to size.
void
notify_resized(size_type);
/// Transforms key_const_reference into a position within the table.
inline size_type
operator()(key_const_reference) const;
};
}
#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file direct_mask_range_hashing_imp.hpp
* Contains a range-hashing policy implementation
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{ mask_based_base::swap(other); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type size)
{ mask_based_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(size_type hash) const
{ return mask_based_base::range_hash(hash); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file mod_based_range_hashing.hpp
* Contains a range hashing policy base.
*/
#ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP
#define PB_DS_MOD_BASED_RANGE_HASHING_HPP
namespace __gnu_pbds
{
namespace detail
{
/// Mod based range hashing.
template<typename Size_Type>
class mod_based_range_hashing
{
protected:
typedef Size_Type size_type;
void
swap(mod_based_range_hashing& other)
{ std::swap(m_size, other.m_size); }
void
notify_resized(size_type s)
{ m_size = s; }
inline size_type
range_hash(size_type s) const
{ return s % m_size; }
private:
size_type m_size;
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file mask_based_range_hashing.hpp
* Contains a range hashing policy base.
*/
#ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP
#define PB_DS_MASK_BASED_RANGE_HASHING_HPP
namespace __gnu_pbds
{
namespace detail
{
/// Range hashing policy.
template<typename Size_Type>
class mask_based_range_hashing
{
protected:
typedef Size_Type size_type;
void
swap(mask_based_range_hashing& other)
{ std::swap(m_mask, other.m_mask); }
void
notify_resized(size_type size);
inline size_type
range_hash(size_type hash) const
{ return size_type(hash & m_mask); }
private:
size_type m_mask;
const static size_type s_num_bits_in_size_type;
const static size_type s_highest_bit_1;
};
template<typename Size_Type>
const typename mask_based_range_hashing<Size_Type>::size_type
mask_based_range_hashing<Size_Type>::s_num_bits_in_size_type =
sizeof(typename mask_based_range_hashing<Size_Type>::size_type) << 3;
template<typename Size_Type>
const typename mask_based_range_hashing<Size_Type>::size_type mask_based_range_hashing<Size_Type>::s_highest_bit_1 = static_cast<typename mask_based_range_hashing<Size_Type>::size_type>(1) << (s_num_bits_in_size_type - 1);
template<typename Size_Type>
void
mask_based_range_hashing<Size_Type>::
notify_resized(size_type size)
{
size_type i = 0;
while (size ^ s_highest_bit_1)
{
size <<= 1;
++i;
}
m_mask = 1;
i += 2;
while (i++ < s_num_bits_in_size_type)
m_mask = (m_mask << 1) ^ 1;
}
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file direct_mod_range_hashing_imp.hpp
* Contains a range-hashing policy implementation
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{ mod_based_base::swap(other); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type n)
{ mod_based_base::notify_resized(n); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(size_type hash) const
{ return mod_based_base::range_hash(hash); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file linear_probe_fn_imp.hpp
* Contains a probe policy implementation
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{ }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(size_type i) const
{
return (i);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file sample_probe_fn.hpp
* Contains a sample probe policy.
*/
#ifndef PB_DS_SAMPLE_PROBE_FN_HPP
#define PB_DS_SAMPLE_PROBE_FN_HPP
namespace __gnu_pbds
{
/// A sample probe policy.
class sample_probe_fn
{
public:
typedef std::size_t size_type;
/// Default constructor.
sample_probe_fn();
/// Copy constructor.
sample_probe_fn(const sample_probe_fn&);
/// Swaps content.
inline void
swap(sample_probe_fn&);
protected:
/// Returns the i-th offset from the hash value of some key r_key.
inline size_type
operator()(key_const_reference r_key, size_type i) const;
};
}
#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file sample_ranged_probe_fn.hpp
* Contains a ranged probe policy.
*/
#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
namespace __gnu_pbds
{
/// A sample ranged-probe functor.
class sample_ranged_probe_fn
{
public:
typedef std::size_t size_type;
// Default constructor.
sample_ranged_probe_fn();
// Copy constructor.
sample_ranged_probe_fn(const sample_ranged_probe_fn&);
// Swaps content.
inline void
swap(sample_ranged_probe_fn&);
protected:
// Notifies the policy object that the container's __size has
// changed to size.
void
notify_resized(size_type);
// Transforms the const key reference r_key into the i-th position
// within the table. This method is called for each collision within
// the probe sequence.
inline size_type
operator()(key_const_reference, std::size_t, size_type) const;
};
}
#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ranged_probe_fn.hpp
* Contains a unified ranged probe functor, allowing the probe tables to deal with
* a single class for ranged probeing.
*/
#ifndef PB_DS_RANGED_PROBE_FN_HPP
#define PB_DS_RANGED_PROBE_FN_HPP
#include <utility>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
/// Primary template.
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>
class ranged_probe_fn;
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Probe_Fn, typename Probe_Fn>
#define PB_DS_CLASS_C_DEC \
ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false>
/**
* Specialization 1
* The client supplies a probe function and a ranged probe
* function, and requests that hash values not be stored.
**/
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn>
class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn,
Probe_Fn, false>
: public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef Comb_Probe_Fn comb_probe_fn_base;
typedef Hash_Fn hash_fn_base;
typedef Probe_Fn probe_fn_base;
typedef typename _Alloc::template rebind<Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
ranged_probe_fn(size_type);
ranged_probe_fn(size_type, const Hash_Fn&);
ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&);
ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&,
const Probe_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
void
notify_resized(size_type);
inline size_type
operator()(key_const_reference) const;
inline size_type
operator()(key_const_reference, size_type, size_type) const;
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size)
{ Comb_Probe_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn)
: Hash_Fn(r_hash_fn)
{ Comb_Probe_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
const Comb_Probe_Fn& r_comb_probe_fn)
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
const Comb_Probe_Fn& r_comb_probe_fn,
const Probe_Fn& r_probe_fn)
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
comb_probe_fn_base::swap(other);
std::swap((Hash_Fn& )(*this), (Hash_Fn&)other);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type size)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(key_const_reference r_key) const
{ return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(key_const_reference, size_type hash, size_type i) const
{
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Probe_Fn, typename Probe_Fn>
#define PB_DS_CLASS_C_DEC \
ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true>
/**
* Specialization 2- The client supplies a probe function and a ranged
* probe function, and requests that hash values not be stored.
**/
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn>
class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn,
Probe_Fn, true>
: public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef std::pair<size_type, size_type> comp_hash;
typedef Comb_Probe_Fn comb_probe_fn_base;
typedef Hash_Fn hash_fn_base;
typedef Probe_Fn probe_fn_base;
typedef typename _Alloc::template rebind<Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
ranged_probe_fn(size_type);
ranged_probe_fn(size_type, const Hash_Fn&);
ranged_probe_fn(size_type, const Hash_Fn&,
const Comb_Probe_Fn&);
ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&,
const Probe_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
void
notify_resized(size_type);
inline comp_hash
operator()(key_const_reference) const;
inline size_type
operator()(key_const_reference, size_type, size_type) const;
inline size_type
operator()(key_const_reference, size_type) const;
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size)
{ Comb_Probe_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn)
: Hash_Fn(r_hash_fn)
{ Comb_Probe_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
const Comb_Probe_Fn& r_comb_probe_fn)
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
const Comb_Probe_Fn& r_comb_probe_fn,
const Probe_Fn& r_probe_fn)
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
comb_probe_fn_base::swap(other);
std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type size)
{ comb_probe_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
operator()(key_const_reference r_key) const
{
const size_type hash = hash_fn_base::operator()(r_key);
return std::make_pair(comb_probe_fn_base::operator()(hash), hash);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(key_const_reference, size_type hash, size_type i) const
{
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()
#ifdef _GLIBCXX_DEBUG
(key_const_reference r_key, size_type hash) const
#else
(key_const_reference /*r_key*/, size_type hash) const
#endif
{
_GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
return hash;
}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
/**
* Specialization 3 and 4
* The client does not supply a hash function or probe function,
* and requests that hash values not be stored.
**/
template<typename Key, typename _Alloc, typename Comb_Probe_Fn>
class ranged_probe_fn<Key, null_type, _Alloc, Comb_Probe_Fn,
null_type, false>
: public Comb_Probe_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef Comb_Probe_Fn comb_probe_fn_base;
typedef typename _Alloc::template rebind<Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
ranged_probe_fn(size_type size)
{ Comb_Probe_Fn::notify_resized(size); }
ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn)
: Comb_Probe_Fn(r_comb_probe_fn)
{ }
ranged_probe_fn(size_type, const null_type&,
const Comb_Probe_Fn& r_comb_probe_fn,
const null_type&)
: Comb_Probe_Fn(r_comb_probe_fn)
{ }
void
swap(ranged_probe_fn& other)
{ comb_probe_fn_base::swap(other); }
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file sample_range_hashing.hpp
* Contains a range hashing policy.
*/
#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
#define PB_DS_SAMPLE_RANGE_HASHING_HPP
namespace __gnu_pbds
{
/// A sample range-hashing functor.
class sample_range_hashing
{
public:
/// Size type.
typedef std::size_t size_type;
/// Default constructor.
sample_range_hashing();
/// Copy constructor.
sample_range_hashing(const sample_range_hashing& other);
/// Swaps content.
inline void
swap(sample_range_hashing& other);
protected:
/// Notifies the policy object that the container's size has
/// changed to argument's size.
void
notify_resized(size_type);
/// Transforms the __hash value hash into a ranged-hash value.
inline size_type
operator()(size_type ) const;
};
}
#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file probe_fn_base.hpp
* Contains a probe policy base.
*/
#ifndef PB_DS_PROBE_FN_BASE_HPP
#define PB_DS_PROBE_FN_BASE_HPP
#include <functional>
namespace __gnu_pbds
{
namespace detail
{
/// Probe functor base.
template<typename _Alloc>
class probe_fn_base
{
protected:
~probe_fn_base() { }
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file quadratic_probe_fn_imp.hpp
* Contains a probe policy implementation
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{ }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(size_type i) const
{
return (i* i);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ranged_hash_fn.hpp
* Contains a unified ranged hash functor, allowing the hash tables
* to deal with a single class for ranged hashing.
*/
#ifndef PB_DS_RANGED_HASH_FN_HPP
#define PB_DS_RANGED_HASH_FN_HPP
#include <utility>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
/// Primary template.
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn, bool Store_Hash>
class ranged_hash_fn;
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false>
/**
* Specialization 1
* The client supplies a hash function and a ranged hash function,
* and requests that hash values not be stored.
**/
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn>
class ranged_hash_fn< Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false>
: public Hash_Fn, public Comb_Hash_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef Hash_Fn hash_fn_base;
typedef Comb_Hash_Fn comb_hash_fn_base;
typedef typename _Alloc::template rebind< Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
ranged_hash_fn(size_type);
ranged_hash_fn(size_type, const Hash_Fn&);
ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
void
notify_resized(size_type);
inline size_type
operator()(key_const_reference) const;
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size)
{ Comb_Hash_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn)
: Hash_Fn(r_hash_fn)
{ Comb_Hash_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn,
const Comb_Hash_Fn& r_comb_hash_fn)
: Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
{ comb_hash_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
comb_hash_fn_base::swap(other);
std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type size)
{ comb_hash_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
operator()(key_const_reference r_key) const
{ return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
ranged_hash_fn<Key,Hash_Fn, _Alloc, Comb_Hash_Fn, true>
/**
* Specialization 2
* The client supplies a hash function and a ranged hash function,
* and requests that hash values be stored.
**/
template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn>
class ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, true>
: public Hash_Fn, public Comb_Hash_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef std::pair<size_type, size_type> comp_hash;
typedef Hash_Fn hash_fn_base;
typedef Comb_Hash_Fn comb_hash_fn_base;
typedef typename _Alloc::template rebind<Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
ranged_hash_fn(size_type);
ranged_hash_fn(size_type, const Hash_Fn&);
ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
void
notify_resized(size_type);
inline comp_hash
operator()(key_const_reference) const;
inline comp_hash
operator()(key_const_reference, size_type) const;
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size)
{ Comb_Hash_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) :
Hash_Fn(r_hash_fn)
{ Comb_Hash_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn,
const Comb_Hash_Fn& r_comb_hash_fn)
: Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
{ comb_hash_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
comb_hash_fn_base::swap(other);
std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
notify_resized(size_type size)
{ comb_hash_fn_base::notify_resized(size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
operator()(key_const_reference r_key) const
{
const size_type hash = hash_fn_base::operator()(r_key);
return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
operator()
#ifdef _GLIBCXX_DEBUG
(key_const_reference r_key, size_type hash) const
#else
(key_const_reference /*r_key*/, size_type hash) const
#endif
{
_GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false>
/**
* Specialization 3
* The client does not supply a hash function (by specifying
* null_type as the Hash_Fn parameter), and requests that hash
* values not be stored.
**/
template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false>
: public Comb_Hash_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef Comb_Hash_Fn comb_hash_fn_base;
ranged_hash_fn(size_type);
ranged_hash_fn(size_type, const Comb_Hash_Fn&);
ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size)
{ Comb_Hash_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) :
Comb_Hash_Fn(r_comb_hash_fn)
{ }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const null_type& r_null_type,
const Comb_Hash_Fn& r_comb_hash_fn)
: Comb_Hash_Fn(r_comb_hash_fn)
{ }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{ comb_hash_fn_base::swap(other); }
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true>
/**
* Specialization 4
* The client does not supply a hash function (by specifying
* null_type as the Hash_Fn parameter), and requests that hash
* values be stored.
**/
template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true>
: public Comb_Hash_Fn
{
protected:
typedef typename _Alloc::size_type size_type;
typedef Comb_Hash_Fn comb_hash_fn_base;
ranged_hash_fn(size_type);
ranged_hash_fn(size_type, const Comb_Hash_Fn&);
ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
};
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size)
{ Comb_Hash_Fn::notify_resized(size); }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn)
: Comb_Hash_Fn(r_comb_hash_fn)
{ }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
ranged_hash_fn(size_type size, const null_type& r_null_type,
const Comb_Hash_Fn& r_comb_hash_fn)
: Comb_Hash_Fn(r_comb_hash_fn)
{ }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{ comb_hash_fn_base::swap(other); }
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/binomial_heap_/debug_fn_imps.hpp
* Contains an implementation for binomial_heap_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{ base_type::assert_valid(true, __file, __line); }
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/binomial_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation for binomial_heap_.
*/
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap()
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap(const Cmp_Fn& r_cmp_fn)
: base_type(r_cmp_fn)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap(const PB_DS_CLASS_C_DEC& other)
: base_type(other)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~binomial_heap() { }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_.hpp
* Contains an implementation class for a binomial heap.
*/
/*
* Binomial heap.
* Vuillemin J is the mastah.
* Modified from CLRS.
*/
#include <debug/debug.h>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
binomial_heap<Value_Type, Cmp_Fn, _Alloc>
/**
* Binomial heap.
*
* @ingroup heap-detail
*/
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class binomial_heap
: public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
{
private:
typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> base_type;
typedef typename base_type::node_pointer node_pointer;
typedef typename base_type::node_const_pointer node_const_pointer;
public:
typedef Value_Type value_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename base_type::pointer pointer;
typedef typename base_type::const_pointer const_pointer;
typedef typename base_type::reference reference;
typedef typename base_type::const_reference const_reference;
typedef typename base_type::point_const_iterator point_const_iterator;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::cmp_fn cmp_fn;
typedef typename base_type::allocator_type allocator_type;
binomial_heap();
binomial_heap(const Cmp_Fn&);
binomial_heap(const binomial_heap&);
~binomial_heap();
protected:
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
#endif
};
#include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp>
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file lu_counter_metadata.hpp
* Contains implementation of a lu counter policy's metadata.
*/
namespace __gnu_pbds
{
namespace detail
{
template<typename Size_Type>
class lu_counter_policy_base;
/// A list-update metadata type that moves elements to the front of
/// the list based on the counter algorithm.
template<typename Size_Type = std::size_t>
class lu_counter_metadata
{
public:
typedef Size_Type size_type;
private:
lu_counter_metadata(size_type init_count) : m_count(init_count)
{ }
friend class lu_counter_policy_base<size_type>;
mutable size_type m_count;
};
/// Base class for list-update counter policy.
template<typename Size_Type>
class lu_counter_policy_base
{
protected:
typedef Size_Type size_type;
lu_counter_metadata<size_type>
operator()(size_type max_size) const
{ return lu_counter_metadata<Size_Type>(std::rand() % max_size); }
template<typename Metadata_Reference>
bool
operator()(Metadata_Reference r_data, size_type m_max_count) const
{
if (++r_data.m_count != m_max_count)
return false;
r_data.m_count = 0;
return true;
}
};
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file sample_update_policy.hpp
* Contains a sample policy for list update containers.
*/
#ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP
#define PB_DS_SAMPLE_UPDATE_POLICY_HPP
namespace __gnu_pbds
{
/// A sample list-update policy.
struct sample_update_policy
{
/// Default constructor.
sample_update_policy();
/// Copy constructor.
sample_update_policy(const sample_update_policy&);
/// Swaps content.
inline void
swap(sample_update_policy& other);
protected:
/// Metadata on which this functor operates.
typedef some_metadata_type metadata_type;
/// Creates a metadata object.
metadata_type
operator()() const;
/// Decides whether a metadata object should be moved to the front
/// of the list. A list-update based containers object will call
/// this method to decide whether to move a node to the front of
/// the list. The method shoule return true if the node should be
/// moved to the front of the list.
bool
operator()(metadata_reference) const;
};
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/rotate_fn_imps.hpp
* Contains imps for rotating nodes.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rotate_left(node_pointer p_x)
{
node_pointer p_y = p_x->m_p_right;
p_x->m_p_right = p_y->m_p_left;
if (p_y->m_p_left != 0)
p_y->m_p_left->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
if (p_x == m_p_head->m_p_parent)
m_p_head->m_p_parent = p_y;
else if (p_x == p_x->m_p_parent->m_p_left)
p_x->m_p_parent->m_p_left = p_y;
else
p_x->m_p_parent->m_p_right = p_y;
p_y->m_p_left = p_x;
p_x->m_p_parent = p_y;
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
apply_update(p_x, (Node_Update*)this);
apply_update(p_x->m_p_parent, (Node_Update*)this);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rotate_right(node_pointer p_x)
{
node_pointer p_y = p_x->m_p_left;
p_x->m_p_left = p_y->m_p_right;
if (p_y->m_p_right != 0)
p_y->m_p_right->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
if (p_x == m_p_head->m_p_parent)
m_p_head->m_p_parent = p_y;
else if (p_x == p_x->m_p_parent->m_p_right)
p_x->m_p_parent->m_p_right = p_y;
else
p_x->m_p_parent->m_p_left = p_y;
p_y->m_p_right = p_x;
p_x->m_p_parent = p_y;
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
apply_update(p_x, (Node_Update*)this);
apply_update(p_x->m_p_parent, (Node_Update*)this);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rotate_parent(node_pointer p_nd)
{
node_pointer p_parent = p_nd->m_p_parent;
if (p_nd == p_parent->m_p_left)
rotate_right(p_parent);
else
rotate_left(p_parent);
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent || p_nd->m_p_right == p_parent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/)
{ }
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_* p_update)
{
p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == 0) ?
0 :
& PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == 0) ?
0 :
& PB_DS_V2F(p_nd->m_p_right->m_value));
}
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
update_to_top(node_pointer p_nd, Node_Update_* p_update)
{
while (p_nd != m_p_head)
{
apply_update(p_nd, p_update);
p_nd = p_nd->m_p_parent;
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update_to_top(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/)
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/erase_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{
node_pointer p_nd = find_imp(r_key);
if (p_nd == 0 || p_nd->m_type == i_node)
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return false;
}
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
if (!synth_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return false;
}
PB_DS_CHECK_KEY_EXISTS(r_key)
erase_leaf(static_cast<leaf_pointer>(p_nd));
PB_DS_ASSERT_VALID((*this))
return true;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase_fixup(inode_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1);
if (std::distance(p_nd->begin(), p_nd->end()) == 1)
{
node_pointer p_parent = p_nd->m_p_parent;
if (p_parent == m_p_head)
m_p_head->m_p_parent = *p_nd->begin();
else
{
_GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);
node_pointer p_new_child = *p_nd->begin();
typedef inode_pointer inode_ptr;
inode_ptr p_internal = static_cast<inode_ptr>(p_parent);
p_internal->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
}
(*p_nd->begin())->m_p_parent = p_nd->m_p_parent;
p_nd->~inode();
s_inode_allocator.deallocate(p_nd, 1);
if (p_parent == m_p_head)
return;
_GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);
p_nd = static_cast<inode_pointer>(p_parent);
}
while (true)
{
_GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1);
p_nd->update_prefixes(this);
apply_update(p_nd, (node_update*)this);
PB_DS_ASSERT_NODE_VALID(p_nd)
if (p_nd->m_p_parent->m_type == head_node)
return;
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type == i_node);
p_nd = static_cast<inode_pointer>(p_nd->m_p_parent);
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
actual_erase_leaf(leaf_pointer p_l)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->value())));
p_l->~leaf();
s_leaf_allocator.deallocate(p_l, 1);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
if (!empty())
{
clear_imp(m_p_head->m_p_parent);
m_size = 0;
initialize();
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
PB_DS_ASSERT_VALID((*this))
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
if (p_nd->m_type == i_node)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
for (typename inode::iterator it =
static_cast<inode_pointer>(p_nd)->begin();
it != static_cast<inode_pointer>(p_nd)->end();
++it)
{
node_pointer p_child =* it;
clear_imp(p_child);
}
s_inode_allocator.deallocate(static_cast<inode_pointer>(p_nd), 1);
return;
}
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
static_cast<leaf_pointer>(p_nd)->~leaf();
s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
erase(const_iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it == end())
return it;
const_iterator ret_it = it;
++ret_it;
_GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
#ifdef PB_DS_DATA_TRUE_INDICATOR
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
erase(iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it == end())
return it;
iterator ret_it = it;
++ret_it;
_GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
PB_DS_CLASS_C_DEC::
erase(const_reverse_iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it.m_p_nd == m_p_head)
return it;
const_reverse_iterator ret_it = it;
++ret_it;
_GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
#ifdef PB_DS_DATA_TRUE_INDICATOR
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
erase(reverse_iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it.m_p_nd == m_p_head)
return it;
reverse_iterator ret_it = it;
++ret_it;
_GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
size_type num_ersd = 0;
PB_DS_ASSERT_VALID((*this))
iterator it = begin();
while (it != end())
{
PB_DS_ASSERT_VALID((*this))
if (pred(*it))
{
++num_ersd;
it = erase(it);
}
else
++it;
}
PB_DS_ASSERT_VALID((*this))
return num_ersd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase_leaf(leaf_pointer p_l)
{
update_min_max_for_erased_leaf(p_l);
if (p_l->m_p_parent->m_type == head_node)
{
_GLIBCXX_DEBUG_ASSERT(size() == 1);
clear();
return;
}
_GLIBCXX_DEBUG_ASSERT(size() > 1);
_GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type == i_node);
inode_pointer p_parent = static_cast<inode_pointer>(p_l->m_p_parent);
p_parent->remove_child(p_l);
erase_fixup(p_parent);
actual_erase_leaf(p_l);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
update_min_max_for_erased_leaf(leaf_pointer p_l)
{
if (m_size == 1)
{
m_p_head->m_p_min = m_p_head;
m_p_head->m_p_max = m_p_head;
return;
}
if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_min))
{
iterator it(p_l);
++it;
m_p_head->m_p_min = it.m_p_nd;
return;
}
if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_max))
{
iterator it(p_l);
--it;
m_p_head->m_p_max = it.m_p_nd;
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/insert_join_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
branch_bag bag;
if (!join_prep(other, bag))
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent,
other.m_p_head->m_p_parent, 0, bag);
m_p_head->m_p_parent->m_p_parent = m_p_head;
m_size += other.m_size;
other.initialize();
PB_DS_ASSERT_VALID(other)
m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);
m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
join_prep(PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (other.m_size == 0)
return false;
if (m_size == 0)
{
value_swap(other);
return false;
}
const bool greater =
synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()),
PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_min)->value()));
const bool lesser =
synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_max)->value()),
PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value()));
if (!greater && !lesser)
__throw_join_error();
rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag);
_GLIBCXX_DEBUG_ONLY(debug_base::join(other, false);)
return true;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
rec_join_prep(node_const_pointer p_l, node_const_pointer p_r,
branch_bag& r_bag)
{
if (p_l->m_type == leaf_node)
{
if (p_r->m_type == leaf_node)
{
rec_join_prep(static_cast<leaf_const_pointer>(p_l),
static_cast<leaf_const_pointer>(p_r), r_bag);
return;
}
_GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
rec_join_prep(static_cast<leaf_const_pointer>(p_l),
static_cast<inode_const_pointer>(p_r), r_bag);
return;
}
_GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);
if (p_r->m_type == leaf_node)
{
rec_join_prep(static_cast<inode_const_pointer>(p_l),
static_cast<leaf_const_pointer>(p_r), r_bag);
return;
}
_GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
rec_join_prep(static_cast<inode_const_pointer>(p_l),
static_cast<inode_const_pointer>(p_r), r_bag);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
rec_join_prep(leaf_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,
branch_bag& r_bag)
{ r_bag.add_branch(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
rec_join_prep(leaf_const_pointer /*p_l*/, inode_const_pointer /*p_r*/,
branch_bag& r_bag)
{ r_bag.add_branch(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
rec_join_prep(inode_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,
branch_bag& r_bag)
{ r_bag.add_branch(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
rec_join_prep(inode_const_pointer p_l, inode_const_pointer p_r,
branch_bag& r_bag)
{
if (p_l->get_e_ind() == p_r->get_e_ind() &&
synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
p_r->pref_b_it(), p_r->pref_e_it()))
{
for (typename inode::const_iterator it = p_r->begin();
it != p_r->end(); ++ it)
{
node_const_pointer p_l_join_child = p_l->get_join_child(*it, this);
if (p_l_join_child != 0)
rec_join_prep(p_l_join_child, * it, r_bag);
}
return;
}
if (p_r->get_e_ind() < p_l->get_e_ind() &&
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);
if (p_r_join_child != 0)
rec_join_prep(p_r_join_child, p_l, r_bag);
return;
}
if (p_r->get_e_ind() < p_l->get_e_ind() &&
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);
if (p_r_join_child != 0)
rec_join_prep(p_r_join_child, p_l, r_bag);
return;
}
r_bag.add_branch();
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind,
branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
if (p_l == 0)
{
apply_update(p_r, (node_update*)this);
return (p_r);
}
if (p_l->m_type == leaf_node)
{
if (p_r->m_type == leaf_node)
{
node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
static_cast<leaf_pointer>(p_r), r_bag);
apply_update(p_ret, (node_update*)this);
return p_ret;
}
_GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
static_cast<inode_pointer>(p_r),
checked_ind, r_bag);
apply_update(p_ret, (node_update*)this);
return p_ret;
}
_GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);
if (p_r->m_type == leaf_node)
{
node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),
static_cast<leaf_pointer>(p_r),
checked_ind, r_bag);
apply_update(p_ret, (node_update*)this);
return p_ret;
}
_GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),
static_cast<inode_pointer>(p_r),
r_bag);
apply_update(p_ret, (node_update*)this);
return p_ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(leaf_pointer p_l, leaf_pointer p_r, branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
if (p_l == 0)
return (p_r);
node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == 2);
return p_ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(leaf_pointer p_l, inode_pointer p_r, size_type checked_ind,
branch_bag& r_bag)
{
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
#endif
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs);
return p_ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(inode_pointer p_l, leaf_pointer p_r, size_type checked_ind, branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_l != 0);
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
#endif
if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this))
{
node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
PB_DS_ASSERT_NODE_VALID(p_ret)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) ==
lhs_leafs + rhs_leafs);
return p_ret;
}
node_pointer p_pot_child = p_l->add_child(p_r, pref_begin(p_r),
pref_end(p_r), this);
if (p_pot_child != p_r)
{
node_pointer p_new_child = rec_join(p_pot_child, p_r, p_l->get_e_ind(),
r_bag);
p_l->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
}
PB_DS_ASSERT_NODE_VALID(p_l)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs);
return p_l;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_join(inode_pointer p_l, inode_pointer p_r,
branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_l != 0);
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
#endif
if (p_l->get_e_ind() == p_r->get_e_ind() &&
synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
p_r->pref_b_it(), p_r->pref_e_it()))
{
for (typename inode::iterator it = p_r->begin();
it != p_r->end(); ++ it)
{
node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this),
* it, 0, r_bag);
p_l->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
}
p_r->~inode();
s_inode_allocator.deallocate(p_r, 1);
PB_DS_ASSERT_NODE_VALID(p_l)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs);
return p_l;
}
if (p_l->get_e_ind() < p_r->get_e_ind() &&
p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this))
{
node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this),
p_r, 0, r_bag);
p_l->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
PB_DS_ASSERT_NODE_VALID(p_l)
return p_l;
}
if (p_r->get_e_ind() < p_l->get_e_ind() &&
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l,
0, r_bag);
p_r->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
PB_DS_ASSERT_NODE_VALID(p_r)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_r) == lhs_leafs + rhs_leafs);
return p_r;
}
node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
PB_DS_ASSERT_NODE_VALID(p_ret)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs);
return p_ret;
}
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::iterator, bool>
PB_DS_CLASS_C_DEC::
insert(const_reference r_val)
{
node_pointer p_lf = find_imp(PB_DS_V2F(r_val));
if (p_lf != 0 && p_lf->m_type == leaf_node &&
synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
{
PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val))
PB_DS_ASSERT_VALID((*this))
return std::make_pair(iterator(p_lf), false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_val))
leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
cond_dealtor cond(p_new_lf);
new (p_new_lf) leaf(r_val);
apply_update(p_new_lf, (node_update*)this);
cond.set_call_destructor();
branch_bag bag;
bag.add_branch();
m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag);
m_p_head->m_p_parent->m_p_parent = m_p_head;
cond.set_no_action_dtor();
++m_size;
update_min_max_for_inserted_leaf(p_new_lf);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
PB_DS_ASSERT_VALID((*this))
return std::make_pair(point_iterator(p_new_lf), true);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
keys_diff_ind(typename access_traits::const_iterator b_l,
typename access_traits::const_iterator e_l,
typename access_traits::const_iterator b_r,
typename access_traits::const_iterator e_r)
{
size_type diff_pos = 0;
while (b_l != e_l)
{
if (b_r == e_r)
return (diff_pos);
if (access_traits::e_pos(*b_l) != access_traits::e_pos(*b_r))
return (diff_pos);
++b_l;
++b_r;
++diff_pos;
}
_GLIBCXX_DEBUG_ASSERT(b_r != e_r);
return diff_pos;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::inode_pointer
PB_DS_CLASS_C_DEC::
insert_branch(node_pointer p_l, node_pointer p_r, branch_bag& r_bag)
{
typename synth_access_traits::const_iterator left_b_it = pref_begin(p_l);
typename synth_access_traits::const_iterator left_e_it = pref_end(p_l);
typename synth_access_traits::const_iterator right_b_it = pref_begin(p_r);
typename synth_access_traits::const_iterator right_e_it = pref_end(p_r);
const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it,
right_b_it, right_e_it);
inode_pointer p_new_nd = r_bag.get_branch();
new (p_new_nd) inode(diff_ind, left_b_it);
p_new_nd->add_child(p_l, left_b_it, left_e_it, this);
p_new_nd->add_child(p_r, right_b_it, right_e_it, this);
p_l->m_p_parent = p_new_nd;
p_r->m_p_parent = p_new_nd;
PB_DS_ASSERT_NODE_VALID(p_new_nd)
return (p_new_nd);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
update_min_max_for_inserted_leaf(leaf_pointer p_new_lf)
{
if (m_p_head->m_p_min == m_p_head ||
synth_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),
PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))
m_p_head->m_p_min = p_new_lf;
if (m_p_head->m_p_max == m_p_head ||
synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))
m_p_head->m_p_max = p_new_lf;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/debug_fn_imps.hpp
* Contains an implementation class for pat_trie_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
if (m_p_head->m_p_parent != 0)
m_p_head->m_p_parent->assert_valid(this, __file, __line);
assert_iterators(__file, __line);
assert_reverse_iterators(__file, __line);
if (m_p_head->m_p_parent == 0)
{
PB_DS_DEBUG_VERIFY(m_p_head->m_p_min == m_p_head);
PB_DS_DEBUG_VERIFY(m_p_head->m_p_max == m_p_head);
PB_DS_DEBUG_VERIFY(empty());
return;
}
PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == leaf_node);
PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == leaf_node);
PB_DS_DEBUG_VERIFY(!empty());
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_iterators(const char* __file, int __line) const
{
size_type calc_size = 0;
for (const_iterator it = begin(); it != end(); ++it)
{
++calc_size;
debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line);
PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)) == it);
PB_DS_DEBUG_VERIFY(--upper_bound(PB_DS_V2F(*it)) == it);
}
PB_DS_DEBUG_VERIFY(calc_size == m_size);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_reverse_iterators(const char* __file, int __line) const
{
size_type calc_size = 0;
for (const_reverse_iterator it = rbegin(); it != rend(); ++it)
{
++calc_size;
node_const_pointer p_nd =
const_cast<PB_DS_CLASS_C_DEC*>(this)->find_imp(PB_DS_V2F(*it));
PB_DS_DEBUG_VERIFY(p_nd == it.m_p_nd);
}
PB_DS_DEBUG_VERIFY(calc_size == m_size);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
recursive_count_leafs(node_const_pointer p_nd, const char* __file, int __line)
{
if (p_nd == 0)
return (0);
if (p_nd->m_type == leaf_node)
return (1);
PB_DS_DEBUG_VERIFY(p_nd->m_type == i_node);
size_type ret = 0;
for (typename inode::const_iterator it = static_cast<inode_const_pointer>(p_nd)->begin();
it != static_cast<inode_const_pointer>(p_nd)->end();
++it)
ret += recursive_count_leafs(*it, __file, __line);
return ret;
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/r_erase_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
actual_erase_node(node_pointer p_z)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value)));
p_z->~node();
s_node_allocator.deallocate(p_z, 1);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update_min_max_for_erased_node(node_pointer p_z)
{
if (m_size == 1)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
return;
}
if (m_p_head->m_p_left == p_z)
{
iterator it(p_z);
++it;
m_p_head->m_p_left = it.m_p_nd;
}
else if (m_p_head->m_p_right == p_z)
{
iterator it(p_z);
--it;
m_p_head->m_p_right = it.m_p_nd;
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
_GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)
clear_imp(m_p_head->m_p_parent);
m_size = 0;
initialize();
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
_GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
if (p_nd == 0)
return;
clear_imp(p_nd->m_p_left);
clear_imp(p_nd->m_p_right);
p_nd->~Node();
s_node_allocator.deallocate(p_nd, 1);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/split_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
branch_bag bag;
leaf_pointer p_split_lf = split_prep(r_key, other, bag);
if (p_split_lf == 0)
{
_GLIBCXX_DEBUG_ASSERT(bag.empty());
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
_GLIBCXX_DEBUG_ASSERT(!bag.empty());
other.clear();
m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent, pref_begin(p_split_lf),
pref_end(p_split_lf), other, bag);
m_p_head->m_p_parent->m_p_parent = m_p_head;
head_pointer __ohead = other.m_p_head;
__ohead->m_p_max = m_p_head->m_p_max;
m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
__ohead->m_p_min = other.leftmost_descendant(__ohead->m_p_parent);
other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(),
other.PB_DS_CLASS_C_DEC::end());
m_size -= other.m_size;
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other,
branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(r_bag.empty());
if (m_size == 0)
{
other.clear();
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return 0;
}
if (synth_access_traits::cmp_keys(r_key,
PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))
{
other.clear();
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return 0;
}
if (!synth_access_traits::cmp_keys(r_key,
PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value())))
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return 0;
}
iterator it = lower_bound(r_key);
if (!synth_access_traits::equal_keys(PB_DS_V2F(*it), r_key))
--it;
node_pointer p_nd = it.m_p_nd;
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd);
while (p_nd->m_type != head_node)
{
r_bag.add_branch();
p_nd = p_nd->m_p_parent;
}
_GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_access_traits&)(*this), other);)
return p_ret_l;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
rec_split(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,
PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)
{
if (p_nd->m_type == leaf_node)
{
_GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == 0);
return p_nd;
}
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
inode_pointer p_ind = static_cast<inode_pointer>(p_nd);
node_pointer pfirst = p_ind->get_child_node(b_it, e_it, this);
node_pointer p_child_ret = rec_split(pfirst, b_it, e_it, other, r_bag);
PB_DS_ASSERT_NODE_VALID(p_child_ret)
p_ind->replace_child(p_child_ret, b_it, e_it, this);
apply_update(p_ind, (node_update*)this);
inode_iterator child_it = p_ind->get_child_it(b_it, e_it, this);
const size_type lhs_dist = std::distance(p_ind->begin(), child_it);
const size_type lhs_num_children = lhs_dist + 1;
_GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0);
const size_type rhs_dist = std::distance(p_ind->begin(), p_ind->end());
size_type rhs_num_children = rhs_dist - lhs_num_children;
if (rhs_num_children == 0)
{
apply_update(p_ind, (node_update*)this);
return p_ind;
}
other.split_insert_branch(p_ind->get_e_ind(), b_it, child_it,
rhs_num_children, r_bag);
child_it = p_ind->get_child_it(b_it, e_it, this);
while (rhs_num_children != 0)
{
++child_it;
p_ind->remove_child(child_it);
--rhs_num_children;
}
apply_update(p_ind, (node_update*)this);
const size_type int_dist = std::distance(p_ind->begin(), p_ind->end());
_GLIBCXX_DEBUG_ASSERT(int_dist >= 1);
if (int_dist > 1)
{
p_ind->update_prefixes(this);
PB_DS_ASSERT_NODE_VALID(p_ind)
apply_update(p_ind, (node_update*)this);
return p_ind;
}
node_pointer p_ret = *p_ind->begin();
p_ind->~inode();
s_inode_allocator.deallocate(p_ind, 1);
apply_update(p_ret, (node_update*)this);
return p_ret;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split_insert_branch(size_type e_ind, a_const_iterator b_it,
inode_iterator child_b_it,
size_type num_children, branch_bag& r_bag)
{
#ifdef _GLIBCXX_DEBUG
if (m_p_head->m_p_parent != 0)
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
#endif
const size_type start = m_p_head->m_p_parent == 0 ? 0 : 1;
const size_type total_num_children = start + num_children;
if (total_num_children == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
return;
}
if (total_num_children == 1)
{
if (m_p_head->m_p_parent != 0)
{
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
return;
}
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
++child_b_it;
m_p_head->m_p_parent = *child_b_it;
m_p_head->m_p_parent->m_p_parent = m_p_head;
apply_update(m_p_head->m_p_parent, (node_update*)this);
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
return;
}
_GLIBCXX_DEBUG_ASSERT(total_num_children > 1);
inode_pointer p_new_root = r_bag.get_branch();
new (p_new_root) inode(e_ind, b_it);
size_type num_inserted = 0;
while (num_inserted++ < num_children)
{
++child_b_it;
PB_DS_ASSERT_NODE_VALID((*child_b_it))
p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),
pref_end(*child_b_it), this);
}
if (m_p_head->m_p_parent != 0)
p_new_root->add_child(m_p_head->m_p_parent,
pref_begin(m_p_head->m_p_parent),
pref_end(m_p_head->m_p_parent), this);
m_p_head->m_p_parent = p_new_root;
p_new_root->m_p_parent = m_p_head;
apply_update(m_p_head->m_p_parent, (node_update*)this);
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/policy_access_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::access_traits&
PB_DS_CLASS_C_DEC::
get_access_traits()
{ return *this; }
PB_DS_CLASS_T_DEC
const typename PB_DS_CLASS_C_DEC::access_traits&
PB_DS_CLASS_C_DEC::
get_access_traits() const
{ return *this; }
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_update&
PB_DS_CLASS_C_DEC::
get_node_update()
{ return *this; }
PB_DS_CLASS_T_DEC
const typename PB_DS_CLASS_C_DEC::node_update&
PB_DS_CLASS_C_DEC::
get_node_update() const
{ return *this; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/pat_trie_base.hpp
* Contains the base class for a patricia tree.
*/
#ifndef PB_DS_PAT_TRIE_BASE
#define PB_DS_PAT_TRIE_BASE
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
/// Base type for PATRICIA trees.
struct pat_trie_base
{
/**
* @brief Three types of nodes.
*
* i_node is used by _Inode, leaf_node by _Leaf, and head_node by _Head.
*/
enum node_type
{
i_node,
leaf_node,
head_node
};
/// Metadata base primary template.
template<typename Metadata, typename _Alloc>
struct _Metadata
{
typedef Metadata metadata_type;
typedef _Alloc allocator_type;
typedef typename _Alloc::template rebind<Metadata> __rebind_m;
typedef typename __rebind_m::other::const_reference const_reference;
const_reference
get_metadata() const
{ return m_metadata; }
metadata_type m_metadata;
};
/// Specialization for null metadata.
template<typename _Alloc>
struct _Metadata<null_type, _Alloc>
{
typedef null_type metadata_type;
typedef _Alloc allocator_type;
};
/// Node base.
template<typename _ATraits, typename Metadata>
struct _Node_base
: public Metadata
{
private:
typedef typename Metadata::allocator_type _Alloc;
public:
typedef _Alloc allocator_type;
typedef _ATraits access_traits;
typedef typename _ATraits::type_traits type_traits;
typedef typename _Alloc::template rebind<_Node_base> __rebind_n;
typedef typename __rebind_n::other::pointer node_pointer;
node_pointer m_p_parent;
const node_type m_type;
_Node_base(node_type type) : m_type(type)
{ }
typedef typename _Alloc::template rebind<_ATraits> __rebind_at;
typedef typename __rebind_at::other::const_pointer a_const_pointer;
typedef typename _ATraits::const_iterator a_const_iterator;
#ifdef _GLIBCXX_DEBUG
typedef std::pair<a_const_iterator, a_const_iterator> node_debug_info;
void
assert_valid(a_const_pointer p_traits,
const char* __file, int __line) const
{ assert_valid_imp(p_traits, __file, __line); }
virtual node_debug_info
assert_valid_imp(a_const_pointer, const char*, int) const = 0;
#endif
};
/// Head node for PATRICIA tree.
template<typename _ATraits, typename Metadata>
struct _Head
: public _Node_base<_ATraits, Metadata>
{
typedef _Node_base<_ATraits, Metadata> base_type;
typedef typename base_type::type_traits type_traits;
typedef typename base_type::node_pointer node_pointer;
node_pointer m_p_min;
node_pointer m_p_max;
_Head() : base_type(head_node) { }
#ifdef _GLIBCXX_DEBUG
typedef typename base_type::node_debug_info node_debug_info;
typedef typename base_type::a_const_pointer a_const_pointer;
virtual node_debug_info
assert_valid_imp(a_const_pointer, const char* __file, int __line) const
{
_GLIBCXX_DEBUG_VERIFY_AT(false,
_M_message("Assertion from %1;:%2;")
._M_string(__FILE__)._M_integer(__LINE__),
__file, __line);
return node_debug_info();
}
#endif
};
/// Leaf node for PATRICIA tree.
template<typename _ATraits, typename Metadata>
struct _Leaf
: public _Node_base<_ATraits, Metadata>
{
typedef _Node_base<_ATraits, Metadata> base_type;
typedef typename base_type::type_traits type_traits;
typedef typename type_traits::value_type value_type;
typedef typename type_traits::reference reference;
typedef typename type_traits::const_reference const_reference;
private:
value_type m_value;
_Leaf(const _Leaf&);
public:
_Leaf(const_reference other)
: base_type(leaf_node), m_value(other) { }
reference
value()
{ return m_value; }
const_reference
value() const
{ return m_value; }
#ifdef _GLIBCXX_DEBUG
typedef typename base_type::node_debug_info node_debug_info;
typedef typename base_type::a_const_pointer a_const_pointer;
virtual node_debug_info
assert_valid_imp(a_const_pointer p_traits,
const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(base_type::m_type == leaf_node);
node_debug_info ret;
const_reference r_val = value();
return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),
p_traits->end(p_traits->extract_key(r_val)));
}
virtual
~_Leaf() { }
#endif
};
/// Internal node type, PATRICIA tree.
template<typename _ATraits, typename Metadata>
struct _Inode
: public _Node_base<_ATraits, Metadata>
{
typedef _Node_base<_ATraits, Metadata> base_type;
typedef typename base_type::type_traits type_traits;
typedef typename base_type::access_traits access_traits;
typedef typename type_traits::value_type value_type;
typedef typename base_type::allocator_type _Alloc;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
private:
typedef typename base_type::a_const_pointer a_const_pointer;
typedef typename base_type::a_const_iterator a_const_iterator;
typedef typename base_type::node_pointer node_pointer;
typedef typename _Alloc::template rebind<base_type> __rebind_n;
typedef typename __rebind_n::other::const_pointer node_const_pointer;
typedef _Leaf<_ATraits, Metadata> leaf;
typedef typename _Alloc::template rebind<leaf>::other __rebind_l;
typedef typename __rebind_l::pointer leaf_pointer;
typedef typename __rebind_l::const_pointer leaf_const_pointer;
typedef typename _Alloc::template rebind<_Inode>::other __rebind_in;
typedef typename __rebind_in::pointer inode_pointer;
typedef typename __rebind_in::const_pointer inode_const_pointer;
inline size_type
get_pref_pos(a_const_iterator, a_const_iterator, a_const_pointer) const;
public:
typedef typename _Alloc::template rebind<node_pointer>::other __rebind_np;
typedef typename __rebind_np::pointer node_pointer_pointer;
typedef typename __rebind_np::reference node_pointer_reference;
enum
{
arr_size = _ATraits::max_size + 1
};
PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);
/// Constant child iterator.
struct const_iterator
{
node_pointer_pointer m_p_p_cur;
node_pointer_pointer m_p_p_end;
typedef std::forward_iterator_tag iterator_category;
typedef typename _Alloc::difference_type difference_type;
typedef node_pointer value_type;
typedef node_pointer_pointer pointer;
typedef node_pointer_reference reference;
const_iterator(node_pointer_pointer p_p_cur = 0,
node_pointer_pointer p_p_end = 0)
: m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
{ }
bool
operator==(const const_iterator& other) const
{ return m_p_p_cur == other.m_p_p_cur; }
bool
operator!=(const const_iterator& other) const
{ return m_p_p_cur != other.m_p_p_cur; }
const_iterator&
operator++()
{
do
++m_p_p_cur;
while (m_p_p_cur != m_p_p_end && *m_p_p_cur == 0);
return *this;
}
const_iterator
operator++(int)
{
const_iterator ret_it(*this);
operator++();
return ret_it;
}
const node_pointer_pointer
operator->() const
{
_GLIBCXX_DEBUG_ONLY(assert_referencible();)
return m_p_p_cur;
}
node_const_pointer
operator*() const
{
_GLIBCXX_DEBUG_ONLY(assert_referencible();)
return *m_p_p_cur;
}
protected:
#ifdef _GLIBCXX_DEBUG
void
assert_referencible() const
{ _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end && *m_p_p_cur != 0); }
#endif
};
/// Child iterator.
struct iterator : public const_iterator
{
public:
typedef std::forward_iterator_tag iterator_category;
typedef typename _Alloc::difference_type difference_type;
typedef node_pointer value_type;
typedef node_pointer_pointer pointer;
typedef node_pointer_reference reference;
inline
iterator(node_pointer_pointer p_p_cur = 0,
node_pointer_pointer p_p_end = 0)
: const_iterator(p_p_cur, p_p_end) { }
bool
operator==(const iterator& other) const
{ return const_iterator::m_p_p_cur == other.m_p_p_cur; }
bool
operator!=(const iterator& other) const
{ return const_iterator::m_p_p_cur != other.m_p_p_cur; }
iterator&
operator++()
{
const_iterator::operator++();
return *this;
}
iterator
operator++(int)
{
iterator ret_it(*this);
operator++();
return ret_it;
}
node_pointer_pointer
operator->()
{
_GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
return const_iterator::m_p_p_cur;
}
node_pointer
operator*()
{
_GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
return *const_iterator::m_p_p_cur;
}
};
_Inode(size_type, const a_const_iterator);
void
update_prefixes(a_const_pointer);
const_iterator
begin() const;
iterator
begin();
const_iterator
end() const;
iterator
end();
inline node_pointer
get_child_node(a_const_iterator, a_const_iterator, a_const_pointer);
inline node_const_pointer
get_child_node(a_const_iterator, a_const_iterator, a_const_pointer) const;
inline iterator
get_child_it(a_const_iterator, a_const_iterator, a_const_pointer);
inline node_pointer
get_lower_bound_child_node(a_const_iterator, a_const_iterator,
size_type, a_const_pointer);
inline node_pointer
add_child(node_pointer, a_const_iterator, a_const_iterator,
a_const_pointer);
inline node_const_pointer
get_join_child(node_const_pointer, a_const_pointer) const;
inline node_pointer
get_join_child(node_pointer, a_const_pointer);
void
remove_child(node_pointer);
void
remove_child(iterator);
void
replace_child(node_pointer, a_const_iterator, a_const_iterator,
a_const_pointer);
inline a_const_iterator
pref_b_it() const;
inline a_const_iterator
pref_e_it() const;
bool
should_be_mine(a_const_iterator, a_const_iterator, size_type,
a_const_pointer) const;
leaf_pointer
leftmost_descendant();
leaf_const_pointer
leftmost_descendant() const;
leaf_pointer
rightmost_descendant();
leaf_const_pointer
rightmost_descendant() const;
#ifdef _GLIBCXX_DEBUG
typedef typename base_type::node_debug_info node_debug_info;
virtual node_debug_info
assert_valid_imp(a_const_pointer, const char*, int) const;
#endif
size_type
get_e_ind() const
{ return m_e_ind; }
private:
_Inode(const _Inode&);
size_type
get_begin_pos() const;
static __rebind_l s_leaf_alloc;
static __rebind_in s_inode_alloc;
const size_type m_e_ind;
a_const_iterator m_pref_b_it;
a_const_iterator m_pref_e_it;
node_pointer m_a_p_children[arr_size];
};
#define PB_DS_CONST_IT_C_DEC \
_CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
#define PB_DS_CONST_ODIR_IT_C_DEC \
_CIter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>
#define PB_DS_IT_C_DEC \
_Iter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
#define PB_DS_ODIR_IT_C_DEC \
_Iter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>
/// Const iterator.
template<typename Node, typename Leaf, typename Head, typename Inode,
bool Is_Forward_Iterator>
class _CIter
{
public:
// These types are all the same for the first four template arguments.
typedef typename Node::allocator_type allocator_type;
typedef typename Node::type_traits type_traits;
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename allocator_type::difference_type difference_type;
typedef typename type_traits::value_type value_type;
typedef typename type_traits::pointer pointer;
typedef typename type_traits::reference reference;
typedef typename type_traits::const_pointer const_pointer;
typedef typename type_traits::const_reference const_reference;
typedef allocator_type _Alloc;
typedef typename _Alloc::template rebind<Node> __rebind_n;
typedef typename __rebind_n::other::pointer node_pointer;
typedef typename _Alloc::template rebind<Leaf> __rebind_l;
typedef typename __rebind_l::other::pointer leaf_pointer;
typedef typename __rebind_l::other::const_pointer leaf_const_pointer;
typedef typename _Alloc::template rebind<Head> __rebind_h;
typedef typename __rebind_h::other::pointer head_pointer;
typedef typename _Alloc::template rebind<Inode> __rebind_in;
typedef typename __rebind_in::other::pointer inode_pointer;
typedef typename Inode::iterator inode_iterator;
node_pointer m_p_nd;
_CIter(node_pointer p_nd = 0) : m_p_nd(p_nd)
{ }
_CIter(const PB_DS_CONST_ODIR_IT_C_DEC& other)
: m_p_nd(other.m_p_nd)
{ }
_CIter&
operator=(const _CIter& other)
{
m_p_nd = other.m_p_nd;
return *this;
}
_CIter&
operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)
{
m_p_nd = other.m_p_nd;
return *this;
}
const_pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);
return &static_cast<leaf_pointer>(m_p_nd)->value();
}
const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);
return static_cast<leaf_pointer>(m_p_nd)->value();
}
bool
operator==(const _CIter& other) const
{ return m_p_nd == other.m_p_nd; }
bool
operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
{ return m_p_nd == other.m_p_nd; }
bool
operator!=(const _CIter& other) const
{ return m_p_nd != other.m_p_nd; }
bool
operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
{ return m_p_nd != other.m_p_nd; }
_CIter&
operator++()
{
inc(integral_constant<int, Is_Forward_Iterator>());
return *this;
}
_CIter
operator++(int)
{
_CIter ret_it(m_p_nd);
operator++();
return ret_it;
}
_CIter&
operator--()
{
dec(integral_constant<int, Is_Forward_Iterator>());
return *this;
}
_CIter
operator--(int)
{
_CIter ret_it(m_p_nd);
operator--();
return ret_it;
}
protected:
void
inc(false_type)
{ dec(true_type()); }
void
inc(true_type)
{
if (m_p_nd->m_type == head_node)
{
m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;
return;
}
node_pointer p_y = m_p_nd->m_p_parent;
while (p_y->m_type != head_node && get_larger_sibling(m_p_nd) == 0)
{
m_p_nd = p_y;
p_y = p_y->m_p_parent;
}
if (p_y->m_type == head_node)
{
m_p_nd = p_y;
return;
}
m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));
}
void
dec(false_type)
{ inc(true_type()); }
void
dec(true_type)
{
if (m_p_nd->m_type == head_node)
{
m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;
return;
}
node_pointer p_y = m_p_nd->m_p_parent;
while (p_y->m_type != head_node && get_smaller_sibling(m_p_nd) == 0)
{
m_p_nd = p_y;
p_y = p_y->m_p_parent;
}
if (p_y->m_type == head_node)
{
m_p_nd = p_y;
return;
}
m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));
}
static node_pointer
get_larger_sibling(node_pointer p_nd)
{
inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);
inode_iterator it = p_parent->begin();
while (*it != p_nd)
++it;
inode_iterator next_it = it;
++next_it;
return (next_it == p_parent->end())? 0 : *next_it;
}
static node_pointer
get_smaller_sibling(node_pointer p_nd)
{
inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);
inode_iterator it = p_parent->begin();
if (*it == p_nd)
return 0;
inode_iterator prev_it;
do
{
prev_it = it;
++it;
if (*it == p_nd)
return *prev_it;
}
while (true);
_GLIBCXX_DEBUG_ASSERT(false);
return 0;
}
static leaf_pointer
leftmost_descendant(node_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return static_cast<leaf_pointer>(p_nd);
return static_cast<inode_pointer>(p_nd)->leftmost_descendant();
}
static leaf_pointer
rightmost_descendant(node_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return static_cast<leaf_pointer>(p_nd);
return static_cast<inode_pointer>(p_nd)->rightmost_descendant();
}
};
/// Iterator.
template<typename Node, typename Leaf, typename Head, typename Inode,
bool Is_Forward_Iterator>
class _Iter
: public _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
{
public:
typedef _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
base_type;
typedef typename base_type::allocator_type allocator_type;
typedef typename base_type::type_traits type_traits;
typedef typename type_traits::value_type value_type;
typedef typename type_traits::pointer pointer;
typedef typename type_traits::reference reference;
typedef typename base_type::node_pointer node_pointer;
typedef typename base_type::leaf_pointer leaf_pointer;
typedef typename base_type::leaf_const_pointer leaf_const_pointer;
typedef typename base_type::head_pointer head_pointer;
typedef typename base_type::inode_pointer inode_pointer;
_Iter(node_pointer p_nd = 0)
: base_type(p_nd) { }
_Iter(const PB_DS_ODIR_IT_C_DEC& other)
: base_type(other.m_p_nd) { }
_Iter&
operator=(const _Iter& other)
{
base_type::m_p_nd = other.m_p_nd;
return *this;
}
_Iter&
operator=(const PB_DS_ODIR_IT_C_DEC& other)
{
base_type::m_p_nd = other.m_p_nd;
return *this;
}
pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);
return &static_cast<leaf_pointer>(base_type::m_p_nd)->value();
}
reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);
return static_cast<leaf_pointer>(base_type::m_p_nd)->value();
}
_Iter&
operator++()
{
base_type::operator++();
return *this;
}
_Iter
operator++(int)
{
_Iter ret(base_type::m_p_nd);
operator++();
return ret;
}
_Iter&
operator--()
{
base_type::operator--();
return *this;
}
_Iter
operator--(int)
{
_Iter ret(base_type::m_p_nd);
operator--();
return ret;
}
};
#undef PB_DS_CONST_ODIR_IT_C_DEC
#undef PB_DS_ODIR_IT_C_DEC
#define PB_DS_PAT_TRIE_NODE_CONST_ITERATOR_C_DEC \
_Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>
#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \
_Node_iter<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>
/// Node const iterator.
template<typename Node,
typename Leaf,
typename Head,
typename Inode,
typename _CIterator,
typename Iterator,
typename _Alloc>
class _Node_citer
{
protected:
typedef typename _Alloc::template rebind<Node> __rebind_n;
typedef typename __rebind_n::other::pointer node_pointer;
typedef typename _Alloc::template rebind<Leaf> __rebind_l;
typedef typename __rebind_l::other::pointer leaf_pointer;
typedef typename __rebind_l::other::const_pointer leaf_const_pointer;
typedef typename _Alloc::template rebind<Inode> __rebind_in;
typedef typename __rebind_in::other::pointer inode_pointer;
typedef typename __rebind_in::other::const_pointer inode_const_pointer;
typedef typename Node::a_const_pointer a_const_pointer;
typedef typename Node::a_const_iterator a_const_iterator;
private:
a_const_iterator
pref_begin() const
{
if (m_p_nd->m_type == leaf_node)
{
leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);
return m_p_traits->begin(m_p_traits->extract_key(lcp->value()));
}
_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
return static_cast<inode_const_pointer>(m_p_nd)->pref_b_it();
}
a_const_iterator
pref_end() const
{
if (m_p_nd->m_type == leaf_node)
{
leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);
return m_p_traits->end(m_p_traits->extract_key(lcp->value()));
}
_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
return static_cast<inode_const_pointer>(m_p_nd)->pref_e_it();
}
public:
typedef trivial_iterator_tag iterator_category;
typedef trivial_iterator_difference_type difference_type;
typedef typename _Alloc::size_type size_type;
typedef _CIterator value_type;
typedef value_type reference;
typedef value_type const_reference;
/// Metadata type.
typedef typename Node::metadata_type metadata_type;
/// Const metadata reference type.
typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef typename __rebind_ma::const_reference metadata_const_reference;
inline
_Node_citer(node_pointer p_nd = 0, a_const_pointer p_traits = 0)
: m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
{ }
/// Subtree valid prefix.
std::pair<a_const_iterator, a_const_iterator>
valid_prefix() const
{ return std::make_pair(pref_begin(), pref_end()); }
/// Const access; returns the __const iterator* associated with
/// the current leaf.
const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(num_children() == 0);
return _CIterator(m_p_nd);
}
/// Metadata access.
metadata_const_reference
get_metadata() const
{ return m_p_nd->get_metadata(); }
/// Returns the number of children in the corresponding node.
size_type
num_children() const
{
if (m_p_nd->m_type == leaf_node)
return 0;
_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
inode_pointer inp = static_cast<inode_pointer>(m_p_nd);
return std::distance(inp->begin(), inp->end());
}
/// Returns a __const node __iterator to the corresponding node's
/// i-th child.
_Node_citer
get_child(size_type i) const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
inode_pointer inp = static_cast<inode_pointer>(m_p_nd);
typename Inode::iterator it = inp->begin();
std::advance(it, i);
return _Node_citer(*it, m_p_traits);
}
/// Compares content to a different iterator object.
bool
operator==(const _Node_citer& other) const
{ return m_p_nd == other.m_p_nd; }
/// Compares content (negatively) to a different iterator object.
bool
operator!=(const _Node_citer& other) const
{ return m_p_nd != other.m_p_nd; }
node_pointer m_p_nd;
a_const_pointer m_p_traits;
};
/// Node iterator.
template<typename Node,
typename Leaf,
typename Head,
typename Inode,
typename _CIterator,
typename Iterator,
typename _Alloc>
class _Node_iter
: public _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _Alloc>
{
private:
typedef _Node_citer<Node, Leaf, Head, Inode,
_CIterator, Iterator, _Alloc> base_type;
typedef typename _Alloc::template rebind<Node> __rebind_n;
typedef typename __rebind_n::other::pointer node_pointer;
typedef typename base_type::inode_pointer inode_pointer;
typedef typename base_type::a_const_pointer a_const_pointer;
typedef Iterator iterator;
public:
typedef typename base_type::size_type size_type;
typedef Iterator value_type;
typedef value_type reference;
typedef value_type const_reference;
_Node_iter(node_pointer p_nd = 0, a_const_pointer p_traits = 0)
: base_type(p_nd, p_traits)
{ }
/// Access; returns the iterator* associated with the current leaf.
reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);
return iterator(base_type::m_p_nd);
}
/// Returns a node __iterator to the corresponding node's i-th child.
_Node_iter
get_child(size_type i) const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == i_node);
typename Inode::iterator it =
static_cast<inode_pointer>(base_type::m_p_nd)->begin();
std::advance(it, i);
return _Node_iter(*it, base_type::m_p_traits);
}
};
};
#define PB_DS_CLASS_T_DEC \
template<typename _ATraits, typename Metadata>
#define PB_DS_CLASS_C_DEC \
pat_trie_base::_Inode<_ATraits, Metadata>
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::__rebind_l
PB_DS_CLASS_C_DEC::s_leaf_alloc;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::__rebind_in
PB_DS_CLASS_C_DEC::s_inode_alloc;
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
get_pref_pos(a_const_iterator b_it, a_const_iterator e_it,
a_const_pointer p_traits) const
{
if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)
return 0;
std::advance(b_it, m_e_ind);
return 1 + p_traits->e_pos(*b_it);
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
_Inode(size_type len, const a_const_iterator it)
: base_type(i_node), m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
{
std::advance(m_pref_e_it, m_e_ind);
std::fill(m_a_p_children, m_a_p_children + arr_size,
static_cast<node_pointer>(0));
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
update_prefixes(a_const_pointer p_traits)
{
node_pointer p_first = *begin();
if (p_first->m_type == leaf_node)
{
leaf_const_pointer p = static_cast<leaf_const_pointer>(p_first);
m_pref_b_it = p_traits->begin(access_traits::extract_key(p->value()));
}
else
{
inode_pointer p = static_cast<inode_pointer>(p_first);
_GLIBCXX_DEBUG_ASSERT(p_first->m_type == i_node);
m_pref_b_it = p->pref_b_it();
}
m_pref_e_it = m_pref_b_it;
std::advance(m_pref_e_it, m_e_ind);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
typedef node_pointer_pointer pointer_type;
pointer_type p = const_cast<pointer_type>(m_a_p_children);
return const_iterator(p + get_begin_pos(), p + arr_size);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
return iterator(m_a_p_children + get_begin_pos(),
m_a_p_children + arr_size);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
typedef node_pointer_pointer pointer_type;
pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;
return const_iterator(p, p);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{ return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_child_node(a_const_iterator b_it, a_const_iterator e_it,
a_const_pointer p_traits)
{
const size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
return m_a_p_children[i];
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
get_child_it(a_const_iterator b_it, a_const_iterator e_it,
a_const_pointer p_traits)
{
const size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
_GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);
return iterator(m_a_p_children + i, m_a_p_children + i);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_pointer
PB_DS_CLASS_C_DEC::
get_child_node(a_const_iterator b_it, a_const_iterator e_it,
a_const_pointer p_traits) const
{ return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_lower_bound_child_node(a_const_iterator b_it, a_const_iterator e_it,
size_type checked_ind,
a_const_pointer p_traits)
{
if (!should_be_mine(b_it, e_it, checked_ind, p_traits))
{
if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it,
m_pref_e_it, true))
return leftmost_descendant();
return rightmost_descendant();
}
size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
if (m_a_p_children[i] != 0)
return m_a_p_children[i];
while (++i < arr_size)
if (m_a_p_children[i] != 0)
{
const node_type& __nt = m_a_p_children[i]->m_type;
node_pointer ret = m_a_p_children[i];
if (__nt == leaf_node)
return ret;
_GLIBCXX_DEBUG_ASSERT(__nt == i_node);
inode_pointer inp = static_cast<inode_pointer>(ret);
return inp->leftmost_descendant();
}
return rightmost_descendant();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
add_child(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,
a_const_pointer p_traits)
{
const size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
if (m_a_p_children[i] == 0)
{
m_a_p_children[i] = p_nd;
p_nd->m_p_parent = this;
return p_nd;
}
return m_a_p_children[i];
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_const_pointer
PB_DS_CLASS_C_DEC::
get_join_child(node_const_pointer p_nd,
a_const_pointer p_tr) const
{
node_pointer p = const_cast<node_pointer>(p_nd);
return const_cast<inode_pointer>(this)->get_join_child(p, p_tr);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_join_child(node_pointer p_nd, a_const_pointer p_traits)
{
size_type i;
a_const_iterator b_it;
a_const_iterator e_it;
if (p_nd->m_type == leaf_node)
{
leaf_const_pointer p = static_cast<leaf_const_pointer>(p_nd);
typedef typename type_traits::key_const_reference kcr;
kcr r_key = access_traits::extract_key(p->value());
b_it = p_traits->begin(r_key);
e_it = p_traits->end(r_key);
}
else
{
b_it = static_cast<inode_pointer>(p_nd)->pref_b_it();
e_it = static_cast<inode_pointer>(p_nd)->pref_e_it();
}
i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
return m_a_p_children[i];
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
remove_child(node_pointer p_nd)
{
size_type i = 0;
for (; i < arr_size; ++i)
if (m_a_p_children[i] == p_nd)
{
m_a_p_children[i] = 0;
return;
}
_GLIBCXX_DEBUG_ASSERT(i != arr_size);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
remove_child(iterator it)
{ *it.m_p_p_cur = 0; }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
replace_child(node_pointer p_nd, a_const_iterator b_it,
a_const_iterator e_it,
a_const_pointer p_traits)
{
const size_type i = get_pref_pos(b_it, e_it, p_traits);
_GLIBCXX_DEBUG_ASSERT(i < arr_size);
m_a_p_children[i] = p_nd;
p_nd->m_p_parent = this;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::a_const_iterator
PB_DS_CLASS_C_DEC::
pref_b_it() const
{ return m_pref_b_it; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::a_const_iterator
PB_DS_CLASS_C_DEC::
pref_e_it() const
{ return m_pref_e_it; }
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
should_be_mine(a_const_iterator b_it, a_const_iterator e_it,
size_type checked_ind,
a_const_pointer p_traits) const
{
if (m_e_ind == 0)
return true;
const size_type num_es = std::distance(b_it, e_it);
if (num_es < m_e_ind)
return false;
a_const_iterator key_b_it = b_it;
std::advance(key_b_it, checked_ind);
a_const_iterator key_e_it = b_it;
std::advance(key_e_it, m_e_ind);
a_const_iterator value_b_it = m_pref_b_it;
std::advance(value_b_it, checked_ind);
a_const_iterator value_e_it = m_pref_b_it;
std::advance(value_e_it, m_e_ind);
return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it,
value_e_it);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
leftmost_descendant()
{
node_pointer p_pot = *begin();
if (p_pot->m_type == leaf_node)
return (static_cast<leaf_pointer>(p_pot));
_GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);
return static_cast<inode_pointer>(p_pot)->leftmost_descendant();
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_const_pointer
PB_DS_CLASS_C_DEC::
leftmost_descendant() const
{ return const_cast<inode_pointer>(this)->leftmost_descendant(); }
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
rightmost_descendant()
{
const size_type num_children = std::distance(begin(), end());
_GLIBCXX_DEBUG_ASSERT(num_children >= 2);
iterator it = begin();
std::advance(it, num_children - 1);
node_pointer p_pot =* it;
if (p_pot->m_type == leaf_node)
return static_cast<leaf_pointer>(p_pot);
_GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);
return static_cast<inode_pointer>(p_pot)->rightmost_descendant();
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_const_pointer
PB_DS_CLASS_C_DEC::
rightmost_descendant() const
{ return const_cast<inode_pointer>(this)->rightmost_descendant(); }
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
get_begin_pos() const
{
size_type i = 0;
for (; i < arr_size && m_a_p_children[i] == 0; ++i)
;
return i;
}
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_debug_info
PB_DS_CLASS_C_DEC::
assert_valid_imp(a_const_pointer p_traits,
const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(base_type::m_type == i_node);
PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);
PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2);
for (typename _Inode::const_iterator it = begin(); it != end(); ++it)
{
node_const_pointer p_nd = *it;
PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this);
node_debug_info child_ret = p_nd->assert_valid_imp(p_traits,
__file, __line);
PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);
PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));
PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));
}
return std::make_pair(pref_b_it(), pref_e_it());
}
#endif
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::head_allocator
PB_DS_CLASS_C_DEC::s_head_allocator;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::inode_allocator
PB_DS_CLASS_C_DEC::s_inode_allocator;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_allocator
PB_DS_CLASS_C_DEC::s_leaf_allocator;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_PAT_TRIE_NAME() :
m_p_head(s_head_allocator.allocate(1)),
m_size(0)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_PAT_TRIE_NAME(const access_traits& r_access_traits) :
synth_access_traits(r_access_traits),
m_p_head(s_head_allocator.allocate(1)),
m_size(0)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(other),
#endif
synth_access_traits(other),
node_update(other),
m_p_head(s_head_allocator.allocate(1)),
m_size(0)
{
initialize();
m_size = other.m_size;
PB_DS_ASSERT_VALID(other)
if (other.m_p_head->m_p_parent == 0)
{
PB_DS_ASSERT_VALID((*this))
return;
}
__try
{
m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
}
__catch(...)
{
s_head_allocator.deallocate(m_p_head, 1);
__throw_exception_again;
}
m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);
m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
m_p_head->m_p_parent->m_p_parent = m_p_head;
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
value_swap(other);
std::swap((access_traits& )(*this), (access_traits& )other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_p_head, other.m_p_head);
std::swap(m_size, other.m_size);
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~PB_DS_PAT_TRIE_NAME()
{
clear();
s_head_allocator.deallocate(m_p_head, 1);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{
new (m_p_head) head();
m_p_head->m_p_parent = 0;
m_p_head->m_p_min = m_p_head;
m_p_head->m_p_max = m_p_head;
m_size = 0;
}
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
insert(*(first_it++));
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
recursive_copy_node(node_const_pointer p_ncp)
{
_GLIBCXX_DEBUG_ASSERT(p_ncp != 0);
if (p_ncp->m_type == leaf_node)
{
leaf_const_pointer p_other_lf = static_cast<leaf_const_pointer>(p_ncp);
leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
cond_dealtor cond(p_new_lf);
new (p_new_lf) leaf(p_other_lf->value());
apply_update(p_new_lf, (node_update*)this);
cond.set_no_action_dtor();
return (p_new_lf);
}
_GLIBCXX_DEBUG_ASSERT(p_ncp->m_type == i_node);
node_pointer a_p_children[inode::arr_size];
size_type child_i = 0;
inode_const_pointer p_icp = static_cast<inode_const_pointer>(p_ncp);
typename inode::const_iterator child_it = p_icp->begin();
inode_pointer p_ret;
__try
{
while (child_it != p_icp->end())
{
a_p_children[child_i] = recursive_copy_node(*(child_it));
child_i++;
child_it++;
}
p_ret = s_inode_allocator.allocate(1);
}
__catch(...)
{
while (child_i-- > 0)
clear_imp(a_p_children[child_i]);
__throw_exception_again;
}
new (p_ret) inode(p_icp->get_e_ind(), pref_begin(a_p_children[0]));
--child_i;
_GLIBCXX_DEBUG_ASSERT(child_i >= 1);
do
p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),
pref_end(a_p_children[child_i]), this);
while (child_i-- > 0);
apply_update(p_ret, (node_update*)this);
return p_ret;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/trace_fn_imps.hpp
* Contains an implementation class for pat_trie_.
*/
#ifdef PB_DS_PAT_TRIE_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << std::endl;
if (m_p_head->m_p_parent == 0)
return;
trace_node(m_p_head->m_p_parent, 0);
std::cerr << std::endl;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_node(node_const_pointer p_nd, size_type level)
{
for (size_type i = 0; i < level; ++i)
std::cerr << ' ';
std::cerr << p_nd << " ";
std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? "l " : "i ");
trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>());
typename access_traits::const_iterator el_it = pref_begin(p_nd);
while (el_it != pref_end(p_nd))
{
std::cerr <<* el_it;
++el_it;
}
if (p_nd->m_type == pat_trie_leaf_node_type)
{
std::cerr << std::endl;
return;
}
inode_const_pointer p_internal = static_cast<inode_const_pointer>(p_nd);
std::cerr << " " <<
static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl;
const size_type num_children = std::distance(p_internal->begin(),
p_internal->end());
for (size_type child_i = 0; child_i < num_children; ++child_i)
{
typename inode::const_iterator child_it = p_internal->begin();
std::advance(child_it, num_children - child_i - 1);
trace_node(*child_it, level + 1);
}
}
PB_DS_CLASS_T_DEC
template<typename Metadata_>
void
PB_DS_CLASS_C_DEC::
trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)
{
std::cerr << "(" << static_cast<unsigned long>(p_nd->get_metadata()) << ") ";
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_node_metadata(node_const_pointer, type_to_type<null_type>)
{ }
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/synth_access_traits.hpp
* Contains an implementation class for a patricia tree.
*/
#ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP
#define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP
#include <ext/pb_ds/detail/type_utils.hpp>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \
template<typename Type_Traits, bool Set, typename _ATraits>
#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \
synth_access_traits<Type_Traits, Set, _ATraits>
/// Synthetic element access traits.
template<typename Type_Traits, bool Set, typename _ATraits>
struct synth_access_traits : public _ATraits
{
typedef _ATraits base_type;
typedef typename base_type::const_iterator const_iterator;
typedef Type_Traits type_traits;
typedef typename type_traits::const_reference const_reference;
typedef typename type_traits::key_const_reference key_const_reference;
synth_access_traits();
synth_access_traits(const base_type&);
inline bool
equal_prefixes(const_iterator, const_iterator, const_iterator,
const_iterator, bool compare_after = true) const;
bool
equal_keys(key_const_reference, key_const_reference) const;
bool
cmp_prefixes(const_iterator, const_iterator, const_iterator,
const_iterator, bool compare_after = false) const;
bool
cmp_keys(key_const_reference, key_const_reference) const;
inline static key_const_reference
extract_key(const_reference);
#ifdef _GLIBCXX_DEBUG
bool
operator()(key_const_reference, key_const_reference);
#endif
private:
inline static key_const_reference
extract_key(const_reference, true_type);
inline static key_const_reference
extract_key(const_reference, false_type);
static integral_constant<int, Set> s_set_ind;
};
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
integral_constant<int,Set>
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind;
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
synth_access_traits()
{ }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
synth_access_traits(const _ATraits& r_traits)
: _ATraits(r_traits)
{ }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
inline bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
equal_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
const_iterator e_r, bool compare_after /*= false */) const
{
while (b_l != e_l)
{
if (b_r == e_r)
return false;
if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))
return false;
++b_l;
++b_r;
}
return (!compare_after || b_r == e_r);
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
equal_keys(key_const_reference r_lhs_key,
key_const_reference r_rhs_key) const
{
return equal_prefixes(base_type::begin(r_lhs_key),
base_type::end(r_lhs_key),
base_type::begin(r_rhs_key),
base_type::end(r_rhs_key),
true);
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
cmp_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
const_iterator e_r, bool compare_after /* = false*/) const
{
while (b_l != e_l)
{
if (b_r == e_r)
return false;
const typename base_type::size_type l_pos = base_type::e_pos(*b_l);
const typename base_type::size_type r_pos = base_type::e_pos(*b_r);
if (l_pos != r_pos)
return l_pos < r_pos;
++b_l;
++b_r;
}
if (!compare_after)
return false;
return b_r != e_r;
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
cmp_keys(key_const_reference r_lhs_key,
key_const_reference r_rhs_key) const
{
return cmp_prefixes(base_type::begin(r_lhs_key),
base_type::end(r_lhs_key),
base_type::begin(r_rhs_key),
base_type::end(r_rhs_key),
true);
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
extract_key(const_reference r_val)
{ return extract_key(r_val, s_set_ind); }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
extract_key(const_reference r_val, true_type)
{ return r_val; }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
extract_key(const_reference r_val, false_type)
{ return r_val.first; }
#ifdef _GLIBCXX_DEBUG
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
operator()(key_const_reference r_lhs, key_const_reference r_rhs)
{ return cmp_keys(r_lhs, r_rhs); }
#endif
#undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
#undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/iterators_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{ return iterator(m_p_head->m_p_min); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{ return const_iterator(m_p_head->m_p_min); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{ return iterator(m_p_head); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{ return const_iterator(m_p_head); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
PB_DS_CLASS_C_DEC::
rbegin() const
{
if (empty())
return rend();
return --end();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
rbegin()
{
if (empty())
return rend();
return --end();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
rend()
{ return reverse_iterator(m_p_head); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
PB_DS_CLASS_C_DEC::
rend() const
{ return const_reverse_iterator(m_p_head); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_begin() const
{ return node_const_iterator(m_p_head->m_p_parent, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_begin()
{ return node_iterator(m_p_head->m_p_parent, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_end() const
{ return node_const_iterator(0, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_end()
{ return node_iterator(0, this); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/pat_trie_.hpp
* Contains an implementation class for a patricia tree.
*/
#include <iterator>
#include <utility>
#include <algorithm>
#include <functional>
#include <assert.h>
#include <list>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>
#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_PAT_TRIE_NAME pat_trie_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_PAT_TRIE_NAME pat_trie_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Node_And_It_Traits, \
typename _Alloc>
#define PB_DS_CLASS_C_DEC \
PB_DS_PAT_TRIE_NAME<Key, Mapped, Node_And_It_Traits, _Alloc>
#define PB_DS_PAT_TRIE_TRAITS_BASE \
types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, eq_by_less<Key, std::less<Key> >, \
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
/**
* @brief PATRICIA trie.
* @ingroup branch-detail
*
* This implementation loosely borrows ideas from:
* 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
* 2) Ptset: Sets of integers implemented as Patricia trees,
* Jean-Christophe Filliatr, 2000
*/
template<typename Key, typename Mapped, typename Node_And_It_Traits,
typename _Alloc>
class PB_DS_PAT_TRIE_NAME :
#ifdef _GLIBCXX_DEBUG
public PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public Node_And_It_Traits::synth_access_traits,
public Node_And_It_Traits::node_update,
public PB_DS_PAT_TRIE_TRAITS_BASE,
public pat_trie_base
{
private:
typedef pat_trie_base base_type;
typedef PB_DS_PAT_TRIE_TRAITS_BASE traits_base;
typedef Node_And_It_Traits traits_type;
typedef typename traits_type::synth_access_traits synth_access_traits;
typedef typename synth_access_traits::const_iterator a_const_iterator;
typedef typename traits_type::node node;
typedef typename _Alloc::template rebind<node> __rebind_n;
typedef typename __rebind_n::other::const_pointer node_const_pointer;
typedef typename __rebind_n::other::pointer node_pointer;
typedef typename traits_type::head head;
typedef typename _Alloc::template rebind<head> __rebind_h;
typedef typename __rebind_h::other head_allocator;
typedef typename head_allocator::pointer head_pointer;
typedef typename traits_type::leaf leaf;
typedef typename _Alloc::template rebind<leaf> __rebind_l;
typedef typename __rebind_l::other leaf_allocator;
typedef typename leaf_allocator::pointer leaf_pointer;
typedef typename leaf_allocator::const_pointer leaf_const_pointer;
typedef typename traits_type::inode inode;
typedef typename inode::iterator inode_iterator;
typedef typename _Alloc::template rebind<inode> __rebind_in;
typedef typename __rebind_in::other __rebind_ina;
typedef typename __rebind_in::other inode_allocator;
typedef typename __rebind_ina::pointer inode_pointer;
typedef typename __rebind_ina::const_pointer inode_const_pointer;
/// Conditional deallocator.
class cond_dealtor
{
protected:
leaf_pointer m_p_nd;
bool m_no_action_dtor;
bool m_call_destructor;
public:
cond_dealtor(leaf_pointer p_nd)
: m_p_nd(p_nd), m_no_action_dtor(false), m_call_destructor(false)
{ }
void
set_no_action_dtor()
{ m_no_action_dtor = true; }
void
set_call_destructor()
{ m_call_destructor = true; }
~cond_dealtor()
{
if (m_no_action_dtor)
return;
if (m_call_destructor)
m_p_nd->~leaf();
s_leaf_allocator.deallocate(m_p_nd, 1);
}
};
/// Branch bag, for split-join.
class branch_bag
{
private:
typedef inode_pointer __inp;
typedef typename _Alloc::template rebind<__inp>::other __rebind_inp;
#ifdef _GLIBCXX_DEBUG
typedef std::_GLIBCXX_STD_C::list<__inp, __rebind_inp> bag_type;
#else
typedef std::list<__inp, __rebind_inp> bag_type;
#endif
bag_type m_bag;
public:
void
add_branch()
{
inode_pointer p_nd = s_inode_allocator.allocate(1);
__try
{
m_bag.push_back(p_nd);
}
__catch(...)
{
s_inode_allocator.deallocate(p_nd, 1);
__throw_exception_again;
}
}
inode_pointer
get_branch()
{
_GLIBCXX_DEBUG_ASSERT(!m_bag.empty());
inode_pointer p_nd = *m_bag.begin();
m_bag.pop_front();
return p_nd;
}
~branch_bag()
{
while (!m_bag.empty())
{
inode_pointer p_nd = *m_bag.begin();
s_inode_allocator.deallocate(p_nd, 1);
m_bag.pop_front();
}
}
inline bool
empty() const
{ return m_bag.empty(); }
};
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif
typedef typename traits_type::null_node_update_pointer null_node_update_pointer;
public:
typedef pat_trie_tag container_category;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
typedef typename traits_base::mapped_const_reference mapped_const_reference;
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
typedef typename traits_base::reference reference;
typedef typename traits_base::const_reference const_reference;
typedef typename traits_type::access_traits access_traits;
typedef typename traits_type::const_iterator point_const_iterator;
typedef typename traits_type::iterator point_iterator;
typedef point_const_iterator const_iterator;
typedef point_iterator iterator;
typedef typename traits_type::reverse_iterator reverse_iterator;
typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
typedef typename traits_type::node_const_iterator node_const_iterator;
typedef typename traits_type::node_iterator node_iterator;
typedef typename traits_type::node_update node_update;
PB_DS_PAT_TRIE_NAME();
PB_DS_PAT_TRIE_NAME(const access_traits&);
PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
~PB_DS_PAT_TRIE_NAME();
inline bool
empty() const;
inline size_type
size() const;
inline size_type
max_size() const;
access_traits&
get_access_traits();
const access_traits&
get_access_traits() const;
node_update&
get_node_update();
const node_update&
get_node_update() const;
inline std::pair<point_iterator, bool>
insert(const_reference);
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
return insert(std::make_pair(r_key, mapped_type())).first->second;
#else
insert(r_key);
return traits_base::s_null_type;
#endif
}
inline point_iterator
find(key_const_reference);
inline point_const_iterator
find(key_const_reference) const;
inline point_iterator
lower_bound(key_const_reference);
inline point_const_iterator
lower_bound(key_const_reference) const;
inline point_iterator
upper_bound(key_const_reference);
inline point_const_iterator
upper_bound(key_const_reference) const;
void
clear();
inline bool
erase(key_const_reference);
inline const_iterator
erase(const_iterator);
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline iterator
erase(iterator);
#endif
inline const_reverse_iterator
erase(const_reverse_iterator);
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline reverse_iterator
erase(reverse_iterator);
#endif
template<typename Pred>
inline size_type
erase_if(Pred);
void
join(PB_DS_CLASS_C_DEC&);
void
split(key_const_reference, PB_DS_CLASS_C_DEC&);
inline iterator
begin();
inline const_iterator
begin() const;
inline iterator
end();
inline const_iterator
end() const;
inline reverse_iterator
rbegin();
inline const_reverse_iterator
rbegin() const;
inline reverse_iterator
rend();
inline const_reverse_iterator
rend() const;
/// Returns a const node_iterator corresponding to the node at the
/// root of the tree.
inline node_const_iterator
node_begin() const;
/// Returns a node_iterator corresponding to the node at the
/// root of the tree.
inline node_iterator
node_begin();
/// Returns a const node_iterator corresponding to a node just
/// after a leaf of the tree.
inline node_const_iterator
node_end() const;
/// Returns a node_iterator corresponding to a node just
/// after a leaf of the tree.
inline node_iterator
node_end();
#ifdef PB_DS_PAT_TRIE_TRACE_
void
trace() const;
#endif
protected:
template<typename It>
void
copy_from_range(It, It);
void
value_swap(PB_DS_CLASS_C_DEC&);
node_pointer
recursive_copy_node(node_const_pointer);
private:
void
initialize();
inline void
apply_update(node_pointer, null_node_update_pointer);
template<typename Node_Update_>
inline void
apply_update(node_pointer, Node_Update_*);
bool
join_prep(PB_DS_CLASS_C_DEC&, branch_bag&);
void
rec_join_prep(node_const_pointer, node_const_pointer, branch_bag&);
void
rec_join_prep(leaf_const_pointer, leaf_const_pointer, branch_bag&);
void
rec_join_prep(leaf_const_pointer, inode_const_pointer, branch_bag&);
void
rec_join_prep(inode_const_pointer, leaf_const_pointer, branch_bag&);
void
rec_join_prep(inode_const_pointer, inode_const_pointer, branch_bag&);
node_pointer
rec_join(node_pointer, node_pointer, size_type, branch_bag&);
node_pointer
rec_join(leaf_pointer, leaf_pointer, branch_bag&);
node_pointer
rec_join(leaf_pointer, inode_pointer, size_type, branch_bag&);
node_pointer
rec_join(inode_pointer, leaf_pointer, size_type, branch_bag&);
node_pointer
rec_join(inode_pointer, inode_pointer, branch_bag&);
size_type
keys_diff_ind(typename access_traits::const_iterator,
typename access_traits::const_iterator,
typename access_traits::const_iterator,
typename access_traits::const_iterator);
inode_pointer
insert_branch(node_pointer, node_pointer, branch_bag&);
void
update_min_max_for_inserted_leaf(leaf_pointer);
void
erase_leaf(leaf_pointer);
inline void
actual_erase_leaf(leaf_pointer);
void
clear_imp(node_pointer);
void
erase_fixup(inode_pointer);
void
update_min_max_for_erased_leaf(leaf_pointer);
static inline a_const_iterator
pref_begin(node_const_pointer);
static inline a_const_iterator
pref_end(node_const_pointer);
inline node_pointer
find_imp(key_const_reference);
inline node_pointer
lower_bound_imp(key_const_reference);
inline node_pointer
upper_bound_imp(key_const_reference);
inline static leaf_const_pointer
leftmost_descendant(node_const_pointer);
inline static leaf_pointer
leftmost_descendant(node_pointer);
inline static leaf_const_pointer
rightmost_descendant(node_const_pointer);
inline static leaf_pointer
rightmost_descendant(node_pointer);
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
void
assert_iterators(const char*, int) const;
void
assert_reverse_iterators(const char*, int) const;
static size_type
recursive_count_leafs(node_const_pointer, const char*, int);
#endif
#ifdef PB_DS_PAT_TRIE_TRACE_
static void
trace_node(node_const_pointer, size_type);
template<typename Metadata_>
static void
trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
static void
trace_node_metadata(node_const_pointer, type_to_type<null_type>);
#endif
leaf_pointer
split_prep(key_const_reference, PB_DS_CLASS_C_DEC&, branch_bag&);
node_pointer
rec_split(node_pointer, a_const_iterator, a_const_iterator,
PB_DS_CLASS_C_DEC&, branch_bag&);
void
split_insert_branch(size_type, a_const_iterator, inode_iterator,
size_type, branch_bag&);
static head_allocator s_head_allocator;
static inode_allocator s_inode_allocator;
static leaf_allocator s_leaf_allocator;
head_pointer m_p_head;
size_type m_size;
};
#define PB_DS_ASSERT_NODE_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X->assert_valid(this, __FILE__, __LINE__);)
#define PB_DS_RECURSIVE_COUNT_LEAFS(X) \
recursive_count_leafs(X, __FILE__, __LINE__)
#include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp>
#include <ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp>
#undef PB_DS_RECURSIVE_COUNT_LEAFS
#undef PB_DS_ASSERT_NODE_VALID
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_PAT_TRIE_NAME
#undef PB_DS_PAT_TRIE_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/find_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = find_imp(r_key);
if (p_nd == 0 || p_nd->m_type != leaf_node)
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return end();
}
if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return iterator(p_nd);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return end();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
if (p_nd == 0 || p_nd->m_type != leaf_node)
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return end();
}
if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return const_iterator(const_cast<node_pointer>(p_nd));
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return end();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
find_imp(key_const_reference r_key)
{
if (empty())
return 0;
typename synth_access_traits::const_iterator b_it =
synth_access_traits::begin(r_key);
typename synth_access_traits::const_iterator e_it =
synth_access_traits::end(r_key);
node_pointer p_nd = m_p_head->m_p_parent;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
while (p_nd->m_type != leaf_node)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
node_pointer p_next_nd = static_cast<inode_pointer>(p_nd)->get_child_node(b_it, e_it, this);
if (p_next_nd == 0)
return p_nd;
p_nd = p_next_nd;
}
return p_nd;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
lower_bound_imp(key_const_reference r_key)
{
if (empty())
return (m_p_head);
node_pointer p_nd = m_p_head->m_p_parent;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
typename PB_DS_CLASS_C_DEC::a_const_iterator b_it =
synth_access_traits::begin(r_key);
typename PB_DS_CLASS_C_DEC::a_const_iterator e_it =
synth_access_traits::end(r_key);
size_type checked_ind = 0;
while (true)
{
if (p_nd->m_type == leaf_node)
{
if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
return p_nd;
iterator it(p_nd);
++it;
return it.m_p_nd;
}
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
const size_type new_checked_ind =
static_cast<inode_pointer>(p_nd)->get_e_ind();
p_nd =
static_cast<inode_pointer>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this);
checked_ind = new_checked_ind;
}
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
lower_bound(key_const_reference r_key)
{ return point_iterator(lower_bound_imp(r_key)); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
lower_bound(key_const_reference r_key) const
{
return point_const_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
upper_bound(key_const_reference r_key)
{
point_iterator l_bound_it = lower_bound(r_key);
_GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
!synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
r_key));
if (l_bound_it == end() ||
synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
return l_bound_it;
return ++l_bound_it;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
upper_bound(key_const_reference r_key) const
{
point_const_iterator l_bound_it = lower_bound(r_key);
_GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
!synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
r_key));
if (l_bound_it == end() ||
synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
return l_bound_it;
return ++l_bound_it;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::a_const_iterator
PB_DS_CLASS_C_DEC::
pref_begin(node_const_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return (synth_access_traits::begin(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
return static_cast<inode_const_pointer>(p_nd)->pref_b_it();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::a_const_iterator
PB_DS_CLASS_C_DEC::
pref_end(node_const_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return (synth_access_traits::end(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));
_GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
return static_cast<inode_const_pointer>(p_nd)->pref_e_it();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
PB_DS_CLASS_C_DEC::
leftmost_descendant(node_const_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return static_cast<leaf_const_pointer>(p_nd);
return static_cast<inode_const_pointer>(p_nd)->leftmost_descendant();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
leftmost_descendant(node_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return static_cast<leaf_pointer>(p_nd);
return static_cast<inode_pointer>(p_nd)->leftmost_descendant();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
PB_DS_CLASS_C_DEC::
rightmost_descendant(node_const_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return static_cast<leaf_const_pointer>(p_nd);
return static_cast<inode_const_pointer>(p_nd)->rightmost_descendant();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
rightmost_descendant(node_pointer p_nd)
{
if (p_nd->m_type == leaf_node)
return static_cast<leaf_pointer>(p_nd);
return static_cast<inode_pointer>(p_nd)->rightmost_descendant();
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/update_fn_imps.hpp
* Contains an implementation class for pat_trie_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer, null_node_update_pointer)
{ }
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_*)
{
Node_Update_::operator()(node_iterator(p_nd, this),
node_const_iterator(0, this));
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/traits.hpp
* Contains an implementation class for pat_trie_.
*/
#ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
#define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>
#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Specialization.
/// @ingroup traits
template<typename Key,
typename Mapped,
typename _ATraits,
template<typename Node_CItr,
typename Node_Itr,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct trie_traits<Key, Mapped, _ATraits, Node_Update, pat_trie_tag, _Alloc>
{
private:
typedef pat_trie_base base_type;
typedef types_traits<Key, Mapped, _Alloc, false> type_traits;
public:
typedef typename trie_node_metadata_dispatch<Key, Mapped, _ATraits, Node_Update, _Alloc>::type metadata_type;
typedef base_type::_Metadata<metadata_type, _Alloc> metadata;
typedef _ATraits access_traits;
/// Type for synthesized traits.
typedef __gnu_pbds::detail::synth_access_traits<type_traits, false, access_traits> synth_access_traits;
typedef base_type::_Node_base<synth_access_traits, metadata> node;
typedef base_type::_Head<synth_access_traits, metadata> head;
typedef base_type::_Leaf<synth_access_traits, metadata> leaf;
typedef base_type::_Inode<synth_access_traits, metadata> inode;
typedef base_type::_Iter<node, leaf, head, inode, true> iterator;
typedef base_type::_CIter<node, leaf, head, inode, true> const_iterator;
typedef base_type::_Iter<node, leaf, head, inode, false> reverse_iterator;
typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator;
/// This is an iterator to an iterator: it iterates over nodes,
/// and de-referencing it returns one of the tree's iterators.
typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
typedef base_type::_Node_iter<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_iterator;
/// Type for node update.
typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update;
typedef null_node_update<node_const_iterator, node_iterator, _ATraits, _Alloc>* null_node_update_pointer;
};
/// Specialization.
/// @ingroup traits
template<typename Key,
typename _ATraits,
template<typename Node_CItr,
typename Node_Itr,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct trie_traits<Key, null_type, _ATraits, Node_Update, pat_trie_tag, _Alloc>
{
private:
typedef pat_trie_base base_type;
typedef types_traits<Key, null_type, _Alloc, false> type_traits;
public:
typedef typename trie_node_metadata_dispatch<Key, null_type, _ATraits, Node_Update, _Alloc>::type metadata_type;
typedef base_type::_Metadata<metadata_type, _Alloc> metadata;
typedef _ATraits access_traits;
/// Type for synthesized traits.
typedef __gnu_pbds::detail::synth_access_traits<type_traits, true, access_traits> synth_access_traits;
typedef base_type::_Node_base<synth_access_traits, metadata> node;
typedef base_type::_Head<synth_access_traits, metadata> head;
typedef base_type::_Leaf<synth_access_traits, metadata> leaf;
typedef base_type::_Inode<synth_access_traits, metadata> inode;
typedef base_type::_CIter<node, leaf, head, inode, true> const_iterator;
typedef const_iterator iterator;
typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator;
typedef const_reverse_iterator reverse_iterator;
/// This is an iterator to an iterator: it iterates over nodes,
/// and de-referencing it returns one of the tree's iterators.
typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
typedef node_const_iterator node_iterator;
/// Type for node update.
typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update;
typedef null_node_update<node_const_iterator, node_const_iterator, _ATraits, _Alloc>* null_node_update_pointer;
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pat_trie_/info_fn_imps.hpp
* Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return (m_size == 0); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{ return m_size; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{ return s_inode_allocator.max_size(); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/type_utils.hpp
* Contains utilities for handnling types. All of these classes are based on
* Modern C++ by Andrei Alxandrescu.
*/
#ifndef PB_DS_TYPE_UTILS_HPP
#define PB_DS_TYPE_UTILS_HPP
#include <cstddef>
#include <utility>
#include <tr1/type_traits>
#include <ext/type_traits.h>
#include <ext/numeric_traits.h>
namespace __gnu_pbds
{
namespace detail
{
using std::tr1::is_same;
using std::tr1::is_const;
using std::tr1::is_pointer;
using std::tr1::is_reference;
using std::tr1::is_fundamental;
using std::tr1::is_member_object_pointer;
using std::tr1::is_member_pointer;
using std::tr1::is_base_of;
using std::tr1::remove_const;
using std::tr1::remove_reference;
// Need integral_const<bool, true> <-> integral_const<int, 1>, so
// because of this use the following typedefs instead of importing
// std::tr1's.
using std::tr1::integral_constant;
typedef std::tr1::integral_constant<int, 1> true_type;
typedef std::tr1::integral_constant<int, 0> false_type;
using __gnu_cxx::__conditional_type;
using __gnu_cxx::__numeric_traits;
template<typename T>
struct is_const_pointer
{
enum
{
value = is_const<T>::value && is_pointer<T>::value
};
};
template<typename T>
struct is_const_reference
{
enum
{
value = is_const<T>::value && is_reference<T>::value
};
};
template<typename T>
struct is_simple
{
enum
{
value = is_fundamental<typename remove_const<T>::type>::value
|| is_pointer<typename remove_const<T>::type>::value
|| is_member_pointer<T>::value
};
};
template<typename T>
class is_pair
{
private:
template<typename U>
struct is_pair_imp
{
enum
{
value = 0
};
};
template<typename U, typename V>
struct is_pair_imp<std::pair<U,V> >
{
enum
{
value = 1
};
};
public:
enum
{
value = is_pair_imp<T>::value
};
};
// Use C++11's static_assert if possible.
#if __cplusplus >= 201103L
#define PB_DS_STATIC_ASSERT(UNIQUE, E) static_assert(E, #UNIQUE)
#else
template<bool>
struct __static_assert;
template<>
struct __static_assert<true>
{ };
template<int>
struct __static_assert_dumclass
{
enum
{
v = 1
};
};
#define PB_DS_STATIC_ASSERT(UNIQUE, E) \
typedef __gnu_pbds::detail::__static_assert_dumclass<sizeof(__gnu_pbds::detail::__static_assert<bool(E)>)> UNIQUE##__static_assert_type
#endif
template<typename Type>
struct type_to_type
{
typedef Type type;
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/erase_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
pop()
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
node_pointer p_new_root = join_node_children(base_type::m_p_root);
PB_DS_ASSERT_NODE_CONSISTENT(p_new_root, false)
if (p_new_root != 0)
p_new_root->m_p_prev_or_parent = 0;
base_type::actual_erase_node(base_type::m_p_root);
base_type::m_p_root = p_new_root;
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase(point_iterator it)
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
remove_node(it.m_p_nd);
base_type::actual_erase_node(it.m_p_nd);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
remove_node(node_pointer p_nd)
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
node_pointer p_new_child = join_node_children(p_nd);
PB_DS_ASSERT_NODE_CONSISTENT(p_new_child, false)
if (p_nd == base_type::m_p_root)
{
if (p_new_child != 0)
p_new_child->m_p_prev_or_parent = 0;
base_type::m_p_root = p_new_child;
PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false)
return;
}
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != 0);
if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd)
{
if (p_new_child != 0)
{
p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;
if (p_new_child->m_p_next_sibling != 0)
p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;
p_nd->m_p_prev_or_parent->m_p_l_child = p_new_child;
PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)
return;
}
p_nd->m_p_prev_or_parent->m_p_l_child = p_nd->m_p_next_sibling;
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)
return;
}
if (p_new_child != 0)
{
p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;
if (p_new_child->m_p_next_sibling != 0)
p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;
p_new_child->m_p_prev_or_parent->m_p_next_sibling = p_new_child;
PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)
return;
}
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
join_node_children(node_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
node_pointer p_ret = p_nd->m_p_l_child;
if (p_ret == 0)
return 0;
while (p_ret->m_p_next_sibling != 0)
p_ret = forward_join(p_ret, p_ret->m_p_next_sibling);
while (p_ret->m_p_prev_or_parent != p_nd)
p_ret = back_join(p_ret->m_p_prev_or_parent, p_ret);
PB_DS_ASSERT_NODE_CONSISTENT(p_ret, false)
return p_ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
forward_join(node_pointer p_nd, node_pointer p_next)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == p_next);
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
base_type::make_child_of(p_nd, p_next);
return p_next->m_p_next_sibling == 0
? p_next : p_next->m_p_next_sibling;
}
if (p_next->m_p_next_sibling != 0)
{
p_next->m_p_next_sibling->m_p_prev_or_parent = p_nd;
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
base_type::make_child_of(p_next, p_nd);
return p_nd->m_p_next_sibling;
}
p_nd->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)
return p_nd;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
back_join(node_pointer p_nd, node_pointer p_next)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0);
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
base_type::make_child_of(p_nd, p_next);
PB_DS_ASSERT_NODE_CONSISTENT(p_next, false)
return p_next;
}
p_nd->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)
return p_nd;
}
PB_DS_CLASS_T_DEC
template<typename Pred>
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
if (base_type::empty())
{
PB_DS_ASSERT_VALID((*this))
return 0;
}
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
size_type ersd = 0;
while (p_out != 0)
{
++ersd;
node_pointer p_next = p_out->m_p_next_sibling;
base_type::actual_erase_node(p_out);
p_out = p_next;
}
node_pointer p_cur = base_type::m_p_root;
base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;
push_imp(p_cur);
p_cur = p_next;
}
PB_DS_ASSERT_VALID((*this))
return ersd;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/pairing_heap_.hpp
* Contains an implementation class for a pairing heap.
*/
/*
* Pairing heap:
* Michael L. Fredman, Robert Sedgewick, Daniel Dominic Sleator,
* and Robert Endre Tarjan, The Pairing Heap:
* A New Form of Self-Adjusting Heap, Algorithmica, 1(1):111-129, 1986.
*/
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
pairing_heap<Value_Type, Cmp_Fn, _Alloc>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_P_HEAP_BASE \
left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc, false>
#else
#define PB_DS_P_HEAP_BASE \
left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc>
#endif
/**
* Pairing heap.
*
* @ingroup heap-detail
*/
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class pairing_heap : public PB_DS_P_HEAP_BASE
{
private:
typedef PB_DS_P_HEAP_BASE base_type;
typedef typename base_type::node_pointer node_pointer;
typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a;
public:
typedef Value_Type value_type;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename __rebind_a::pointer pointer;
typedef typename __rebind_a::const_pointer const_pointer;
typedef typename __rebind_a::reference reference;
typedef typename __rebind_a::const_reference const_reference;
typedef typename base_type::point_const_iterator point_const_iterator;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::iterator iterator;
pairing_heap();
pairing_heap(const Cmp_Fn&);
pairing_heap(const pairing_heap&);
void
swap(pairing_heap&);
~pairing_heap();
inline point_iterator
push(const_reference);
void
modify(point_iterator, const_reference);
inline const_reference
top() const;
void
pop();
void
erase(point_iterator);
template<typename Pred>
size_type
erase_if(Pred);
template<typename Pred>
void
split(Pred, pairing_heap&);
void
join(pairing_heap&);
protected:
template<typename It>
void
copy_from_range(It, It);
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
#endif
private:
inline void
push_imp(node_pointer);
node_pointer
join_node_children(node_pointer);
node_pointer
forward_join(node_pointer, node_pointer);
node_pointer
back_join(node_pointer, node_pointer);
void
remove_node(node_pointer);
};
#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool, \
__FILE__, __LINE__);)
#include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp>
#undef PB_DS_ASSERT_NODE_CONSISTENT
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_P_HEAP_BASE
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/debug_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(base_type::m_p_root == 0
|| base_type::m_p_root->m_p_next_sibling == 0);
base_type::assert_valid(__file, __line);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/insert_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_new_nd = base_type::get_new_node_for_insert(r_val);
push_imp(p_new_nd);
PB_DS_ASSERT_VALID((*this))
return point_iterator(p_new_nd);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
push_imp(node_pointer p_nd)
{
p_nd->m_p_l_child = 0;
if (base_type::m_p_root == 0)
{
p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
}
else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
{
p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
base_type::make_child_of(base_type::m_p_root, p_nd);
PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)
base_type::m_p_root = p_nd;
}
else
{
base_type::make_child_of(p_nd, base_type::m_p_root);
PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false)
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
modify(point_iterator it, const_reference r_new_val)
{
PB_DS_ASSERT_VALID((*this))
remove_node(it.m_p_nd);
it.m_p_nd->m_value = r_new_val;
push_imp(it.m_p_nd);
PB_DS_ASSERT_VALID((*this))
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/split_join_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
PB_DS_CLASS_T_DEC
template<typename Pred>
void
PB_DS_CLASS_C_DEC::
split(Pred pred, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
other.clear();
if (base_type::empty())
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
++other.m_size;
node_pointer p_next = p_out->m_p_next_sibling;
p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = 0;
other.push_imp(p_out);
p_out = p_next;
}
PB_DS_ASSERT_VALID(other)
node_pointer p_cur = base_type::m_p_root;
base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;
push_imp(p_cur);
p_cur = p_next;
}
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (other.m_p_root == 0)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
if (base_type::m_p_root == 0)
base_type::m_p_root = other.m_p_root;
else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, other.m_p_root->m_value))
{
base_type::make_child_of(base_type::m_p_root, other.m_p_root);
PB_DS_ASSERT_NODE_CONSISTENT(other.m_p_root, false)
base_type::m_p_root = other.m_p_root;
}
else
{
base_type::make_child_of(other.m_p_root, base_type::m_p_root);
PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false)
}
base_type::m_size += other.m_size;
other.m_p_root = 0;
other.m_size = 0;
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
push(*(first_it++));
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
pairing_heap()
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
pairing_heap(const Cmp_Fn& r_cmp_fn)
: base_type(r_cmp_fn)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
pairing_heap(const PB_DS_CLASS_C_DEC& other)
: base_type(other)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
base_type::swap(other);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~pairing_heap()
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file pairing_heap_/find_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reference
PB_DS_CLASS_C_DEC::
top() const
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
return base_type::m_p_root->m_value;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file branch_policy/branch_policy.hpp
* Contains a base class for branch policies.
*/
#ifndef PB_DS_BRANCH_POLICY_BASE_HPP
#define PB_DS_BRANCH_POLICY_BASE_HPP
#include <ext/pb_ds/tag_and_trait.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Primary template, base class for branch structure policies.
template<typename Node_CItr, typename Node_Itr, typename _Alloc>
struct branch_policy
{
protected:
typedef typename Node_Itr::value_type it_type;
typedef typename std::iterator_traits<it_type>::value_type value_type;
typedef typename value_type::first_type key_type;
typedef typename remove_const<value_type>::type rcvalue_type;
typedef typename remove_const<key_type>::type rckey_type;
typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v;
typedef typename _Alloc::template rebind<rckey_type>::other rebind_k;
typedef typename rebind_v::reference reference;
typedef typename rebind_v::const_reference const_reference;
typedef typename rebind_v::const_pointer const_pointer;
typedef typename rebind_k::const_reference key_const_reference;
static inline key_const_reference
extract_key(const_reference r_val)
{ return r_val.first; }
virtual it_type
end() = 0;
it_type
end_iterator() const
{ return const_cast<branch_policy*>(this)->end(); }
virtual
~branch_policy() { }
};
/// Specialization for const iterators.
template<typename Node_CItr, typename _Alloc>
struct branch_policy<Node_CItr, Node_CItr, _Alloc>
{
protected:
typedef typename Node_CItr::value_type it_type;
typedef typename std::iterator_traits<it_type>::value_type value_type;
typedef typename remove_const<value_type>::type rcvalue_type;
typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v;
typedef typename rebind_v::reference reference;
typedef typename rebind_v::const_reference const_reference;
typedef typename rebind_v::const_pointer const_pointer;
typedef value_type key_type;
typedef typename rebind_v::const_reference key_const_reference;
static inline key_const_reference
extract_key(const_reference r_val)
{ return r_val; }
virtual it_type
end() const = 0;
it_type
end_iterator() const
{ return end(); }
virtual
~branch_policy() { }
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_BRANCH_POLICY_BASE_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file branch_policy/null_node_metadata.hpp
* Contains an implementation class for tree-like classes.
*/
#ifndef PB_DS_0_NODE_METADATA_HPP
#define PB_DS_0_NODE_METADATA_HPP
#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Constant node iterator.
template<typename Key, typename Data, typename _Alloc>
struct dumnode_const_iterator
{
private:
typedef types_traits<Key, Data, _Alloc, false> __traits_type;
typedef typename __traits_type::pointer const_iterator;
public:
typedef const_iterator value_type;
typedef const_iterator const_reference;
typedef const_reference reference;
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file branch_policy/traits.hpp
* Contains an implementation class for tree-like classes.
*/
#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
#define PB_DS_NODE_AND_IT_TRAITS_HPP
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>
#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>
#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>
#define PB_DS_DEBUG_VERIFY(_Cond) \
_GLIBCXX_DEBUG_VERIFY_AT(_Cond, \
_M_message(#_Cond" assertion from %1;:%2;") \
._M_string(__FILE__)._M_integer(__LINE__) \
,__file,__line)
namespace __gnu_pbds
{
namespace detail
{
/// Tree traits class, primary template.
template<typename Key,
typename Data,
typename Cmp_Fn,
template<typename Node_CItr,
typename Node_Itr,
typename Cmp_Fn_,
typename _Alloc>
class Node_Update,
typename Tag,
typename _Alloc>
struct tree_traits;
/// Trie traits class, primary template.
template<typename Key,
typename Data,
typename _ATraits,
template<typename Node_CItr,
typename Node_Itr,
typename _ATraits_,
typename _Alloc>
class Node_Update,
typename Tag,
typename _Alloc>
struct trie_traits;
} // namespace detail
} // namespace __gnu_pbds
#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>
#include <ext/pb_ds/detail/splay_tree_/traits.hpp>
#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>
#include <ext/pb_ds/detail/pat_trie_/traits.hpp>
#undef PB_DS_DEBUG_VERIFY
#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/erase_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{
point_iterator it = this->find(r_key);
if (it == base_type::end())
return false;
erase(it);
return true;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
erase(iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it == base_type::end())
return it;
iterator ret_it = it;
++ret_it;
erase_node(it.m_p_nd);
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
erase(reverse_iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it.m_p_nd == base_type::m_p_head)
return it;
reverse_iterator ret_it = it;
++ret_it;
erase_node(it.m_p_nd);
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
size_type num_ersd = 0;
iterator it = base_type::begin();
while (it != base_type::end())
{
if (pred(*it))
{
++num_ersd;
it = erase(it);
}
else
++it;
}
PB_DS_ASSERT_VALID((*this))
return num_ersd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase_node(node_pointer p_nd)
{
remove_node(p_nd);
base_type::actual_erase_node(p_nd);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
remove_node(node_pointer p_z)
{
this->update_min_max_for_erased_node(p_z);
node_pointer p_y = p_z;
node_pointer p_x = 0;
node_pointer p_new_x_parent = 0;
if (p_y->m_p_left == 0)
p_x = p_y->m_p_right;
else if (p_y->m_p_right == 0)
p_x = p_y->m_p_left;
else
{
p_y = p_y->m_p_right;
while (p_y->m_p_left != 0)
p_y = p_y->m_p_left;
p_x = p_y->m_p_right;
}
if (p_y == p_z)
{
p_new_x_parent = p_y->m_p_parent;
if (p_x != 0)
p_x->m_p_parent = p_y->m_p_parent;
if (base_type::m_p_head->m_p_parent == p_z)
base_type::m_p_head->m_p_parent = p_x;
else if (p_z->m_p_parent->m_p_left == p_z)
{
p_y->m_p_left = p_z->m_p_parent;
p_z->m_p_parent->m_p_left = p_x;
}
else
{
p_y->m_p_left = 0;
p_z->m_p_parent->m_p_right = p_x;
}
}
else
{
p_z->m_p_left->m_p_parent = p_y;
p_y->m_p_left = p_z->m_p_left;
if (p_y != p_z->m_p_right)
{
p_new_x_parent = p_y->m_p_parent;
if (p_x != 0)
p_x->m_p_parent = p_y->m_p_parent;
p_y->m_p_parent->m_p_left = p_x;
p_y->m_p_right = p_z->m_p_right;
p_z->m_p_right->m_p_parent = p_y;
}
else
p_new_x_parent = p_y;
if (base_type::m_p_head->m_p_parent == p_z)
base_type::m_p_head->m_p_parent = p_y;
else if (p_z->m_p_parent->m_p_left == p_z)
p_z->m_p_parent->m_p_left = p_y;
else
p_z->m_p_parent->m_p_right = p_y;
p_y->m_p_parent = p_z->m_p_parent;
std::swap(p_y->m_red, p_z->m_red);
p_y = p_z;
}
this->update_to_top(p_new_x_parent, (node_update* )this);
if (p_y->m_red)
return;
remove_fixup(p_x, p_new_x_parent);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
{
_GLIBCXX_DEBUG_ASSERT(p_x == 0 || p_x->m_p_parent == p_new_x_parent);
while (p_x != base_type::m_p_head->m_p_parent && is_effectively_black(p_x))
if (p_x == p_new_x_parent->m_p_left)
{
node_pointer p_w = p_new_x_parent->m_p_right;
if (p_w->m_red)
{
p_w->m_red = false;
p_new_x_parent->m_red = true;
base_type::rotate_left(p_new_x_parent);
p_w = p_new_x_parent->m_p_right;
}
if (is_effectively_black(p_w->m_p_left)
&& is_effectively_black(p_w->m_p_right))
{
p_w->m_red = true;
p_x = p_new_x_parent;
p_new_x_parent = p_new_x_parent->m_p_parent;
}
else
{
if (is_effectively_black(p_w->m_p_right))
{
if (p_w->m_p_left != 0)
p_w->m_p_left->m_red = false;
p_w->m_red = true;
base_type::rotate_right(p_w);
p_w = p_new_x_parent->m_p_right;
}
p_w->m_red = p_new_x_parent->m_red;
p_new_x_parent->m_red = false;
if (p_w->m_p_right != 0)
p_w->m_p_right->m_red = false;
base_type::rotate_left(p_new_x_parent);
this->update_to_top(p_new_x_parent, (node_update* )this);
break;
}
}
else
{
node_pointer p_w = p_new_x_parent->m_p_left;
if (p_w->m_red == true)
{
p_w->m_red = false;
p_new_x_parent->m_red = true;
base_type::rotate_right(p_new_x_parent);
p_w = p_new_x_parent->m_p_left;
}
if (is_effectively_black(p_w->m_p_right)
&& is_effectively_black(p_w->m_p_left))
{
p_w->m_red = true;
p_x = p_new_x_parent;
p_new_x_parent = p_new_x_parent->m_p_parent;
}
else
{
if (is_effectively_black(p_w->m_p_left))
{
if (p_w->m_p_right != 0)
p_w->m_p_right->m_red = false;
p_w->m_red = true;
base_type::rotate_left(p_w);
p_w = p_new_x_parent->m_p_left;
}
p_w->m_red = p_new_x_parent->m_red;
p_new_x_parent->m_red = false;
if (p_w->m_p_left != 0)
p_w->m_p_left->m_red = false;
base_type::rotate_right(p_new_x_parent);
this->update_to_top(p_new_x_parent, (node_update* )this);
break;
}
}
if (p_x != 0)
p_x->m_red = false;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/debug_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
assert_node_consistent(const node_pointer p_nd, const char* __file,
int __line) const
{
if (p_nd == 0)
return 1;
const size_type l_height =
assert_node_consistent(p_nd->m_p_left, __file, __line);
const size_type r_height =
assert_node_consistent(p_nd->m_p_right, __file, __line);
if (p_nd->m_red)
{
PB_DS_DEBUG_VERIFY(is_effectively_black(p_nd->m_p_left));
PB_DS_DEBUG_VERIFY(is_effectively_black(p_nd->m_p_right));
}
PB_DS_DEBUG_VERIFY(l_height == r_height);
return (p_nd->m_red ? 0 : 1) + l_height;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
base_type::assert_valid(__file, __line);
const node_pointer p_head = base_type::m_p_head;
PB_DS_DEBUG_VERIFY(p_head->m_red);
if (p_head->m_p_parent != 0)
{
PB_DS_DEBUG_VERIFY(!p_head->m_p_parent->m_red);
assert_node_consistent(p_head->m_p_parent, __file, __line);
}
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/insert_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert(const_reference r_value)
{
PB_DS_ASSERT_VALID((*this))
std::pair<point_iterator, bool> ins_pair = base_type::insert_leaf(r_value);
if (ins_pair.second == true)
{
ins_pair.first.m_p_nd->m_red = true;
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
insert_fixup(ins_pair.first.m_p_nd);
}
PB_DS_ASSERT_VALID((*this))
return ins_pair;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
insert_fixup(node_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_red == true);
while (p_nd != base_type::m_p_head->m_p_parent && p_nd->m_p_parent->m_red)
{
if (p_nd->m_p_parent == p_nd->m_p_parent->m_p_parent->m_p_left)
{
node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_right;
if (p_y != 0 && p_y->m_red)
{
p_nd->m_p_parent->m_red = false;
p_y->m_red = false;
p_nd->m_p_parent->m_p_parent->m_red = true;
p_nd = p_nd->m_p_parent->m_p_parent;
}
else
{
if (p_nd == p_nd->m_p_parent->m_p_right)
{
p_nd = p_nd->m_p_parent;
base_type::rotate_left(p_nd);
}
p_nd->m_p_parent->m_red = false;
p_nd->m_p_parent->m_p_parent->m_red = true;
base_type::rotate_right(p_nd->m_p_parent->m_p_parent);
}
}
else
{
node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_left;
if (p_y != 0 && p_y->m_red)
{
p_nd->m_p_parent->m_red = false;
p_y->m_red = false;
p_nd->m_p_parent->m_p_parent->m_red = true;
p_nd = p_nd->m_p_parent->m_p_parent;
}
else
{
if (p_nd == p_nd->m_p_parent->m_p_left)
{
p_nd = p_nd->m_p_parent;
base_type::rotate_right(p_nd);
}
p_nd->m_p_parent->m_red = false;
p_nd->m_p_parent->m_p_parent->m_red = true;
base_type::rotate_left(p_nd->m_p_parent->m_p_parent);
}
}
}
base_type::update_to_top(p_nd, (node_update* )this);
base_type::m_p_head->m_p_parent->m_red = false;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/split_join_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (base_type::join_prep(other) == false)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
const node_pointer p_x = other.split_min();
join_imp(p_x, other.m_p_head->m_p_parent);
base_type::join_finish(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
join_imp(node_pointer p_x, node_pointer p_r)
{
_GLIBCXX_DEBUG_ASSERT(p_x != 0);
if (p_r != 0)
p_r->m_red = false;
const size_type h = black_height(base_type::m_p_head->m_p_parent);
const size_type other_h = black_height(p_r);
node_pointer p_x_l;
node_pointer p_x_r;
std::pair<node_pointer, node_pointer> join_pos;
const bool right_join = h >= other_h;
if (right_join)
{
join_pos = find_join_pos_right(base_type::m_p_head->m_p_parent,
h, other_h);
p_x_l = join_pos.first;
p_x_r = p_r;
}
else
{
p_x_l = base_type::m_p_head->m_p_parent;
base_type::m_p_head->m_p_parent = p_r;
if (p_r != 0)
p_r->m_p_parent = base_type::m_p_head;
join_pos = find_join_pos_left(base_type::m_p_head->m_p_parent,
h, other_h);
p_x_r = join_pos.first;
}
node_pointer p_parent = join_pos.second;
if (p_parent == base_type::m_p_head)
{
base_type::m_p_head->m_p_parent = p_x;
p_x->m_p_parent = base_type::m_p_head;
}
else
{
p_x->m_p_parent = p_parent;
if (right_join)
p_x->m_p_parent->m_p_right = p_x;
else
p_x->m_p_parent->m_p_left = p_x;
}
p_x->m_p_left = p_x_l;
if (p_x_l != 0)
p_x_l->m_p_parent = p_x;
p_x->m_p_right = p_x_r;
if (p_x_r != 0)
p_x_r->m_p_parent = p_x;
p_x->m_red = true;
base_type::initialize_min_max();
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
base_type::update_to_top(p_x, (node_update* )this);
insert_fixup(p_x);
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
split_min()
{
node_pointer p_min = base_type::m_p_head->m_p_left;
#ifdef _GLIBCXX_DEBUG
const node_pointer p_head = base_type::m_p_head;
_GLIBCXX_DEBUG_ASSERT(p_min != p_head);
#endif
remove_node(p_min);
return p_min;
}
PB_DS_CLASS_T_DEC
std::pair<
typename PB_DS_CLASS_C_DEC::node_pointer,
typename PB_DS_CLASS_C_DEC::node_pointer>
PB_DS_CLASS_C_DEC::
find_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r)
{
_GLIBCXX_DEBUG_ASSERT(h_l >= h_r);
if (base_type::m_p_head->m_p_parent == 0)
return (std::make_pair((node_pointer)0, base_type::m_p_head));
node_pointer p_l_parent = base_type::m_p_head;
while (h_l > h_r)
{
if (p_l->m_red == false)
{
_GLIBCXX_DEBUG_ASSERT(h_l > 0);
--h_l;
}
p_l_parent = p_l;
p_l = p_l->m_p_right;
}
if (!is_effectively_black(p_l))
{
p_l_parent = p_l;
p_l = p_l->m_p_right;
}
_GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_l));
_GLIBCXX_DEBUG_ASSERT(black_height(p_l) == h_r);
_GLIBCXX_DEBUG_ASSERT(p_l == 0 || p_l->m_p_parent == p_l_parent);
return std::make_pair(p_l, p_l_parent);
}
PB_DS_CLASS_T_DEC
std::pair<
typename PB_DS_CLASS_C_DEC::node_pointer,
typename PB_DS_CLASS_C_DEC::node_pointer>
PB_DS_CLASS_C_DEC::
find_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r)
{
_GLIBCXX_DEBUG_ASSERT(h_r > h_l);
if (base_type::m_p_head->m_p_parent == 0)
return (std::make_pair((node_pointer)0,
base_type::m_p_head));
node_pointer p_r_parent = base_type::m_p_head;
while (h_r > h_l)
{
if (p_r->m_red == false)
{
_GLIBCXX_DEBUG_ASSERT(h_r > 0);
--h_r;
}
p_r_parent = p_r;
p_r = p_r->m_p_left;
}
if (!is_effectively_black(p_r))
{
p_r_parent = p_r;
p_r = p_r->m_p_left;
}
_GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_r));
_GLIBCXX_DEBUG_ASSERT(black_height(p_r) == h_l);
_GLIBCXX_DEBUG_ASSERT(p_r == 0 || p_r->m_p_parent == p_r_parent);
return std::make_pair(p_r, p_r_parent);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
black_height(node_pointer p_nd)
{
size_type h = 1;
while (p_nd != 0)
{
if (p_nd->m_red == false)
++h;
p_nd = p_nd->m_p_left;
}
return h;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (base_type::split_prep(r_key, other) == false)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
node_pointer p_nd = this->upper_bound(r_key).m_p_nd;
do
{
node_pointer p_next_nd = p_nd->m_p_parent;
if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
split_at_node(p_nd, other);
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
p_nd = p_next_nd;
}
while (p_nd != base_type::m_p_head);
base_type::split_finish(other);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
node_pointer p_l = p_nd->m_p_left;
node_pointer p_r = p_nd->m_p_right;
node_pointer p_parent = p_nd->m_p_parent;
if (p_parent == base_type::m_p_head)
{
base_type::m_p_head->m_p_parent = p_l;
if (p_l != 0)
{
p_l->m_p_parent = base_type::m_p_head;
p_l->m_red = false;
}
}
else
{
if (p_parent->m_p_left == p_nd)
p_parent->m_p_left = p_l;
else
p_parent->m_p_right = p_l;
if (p_l != 0)
p_l->m_p_parent = p_parent;
this->update_to_top(p_parent, (node_update* )this);
if (!p_nd->m_red)
remove_fixup(p_l, p_parent);
}
base_type::initialize_min_max();
other.join_imp(p_nd, p_r);
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/constructors_destructor_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
insert(*(first_it++));
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_RB_TREE_NAME()
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
base_type(r_cmp_fn)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
base_type(r_cmp_fn, r_node_update)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
base_type(other)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
base_type::swap(other);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{ base_type::m_p_head->m_red = true; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/rb_tree_.hpp
* Contains an implementation for Red Black trees.
*/
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <utility>
#include <vector>
#include <assert.h>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Cmp_Fn, \
typename Node_And_It_Traits, typename _Alloc>
#ifdef PB_DS_DATA_TRUE_INDICATOR
# define PB_DS_RB_TREE_NAME rb_tree_map
# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
# define PB_DS_RB_TREE_NAME rb_tree_set
# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set
#endif
#define PB_DS_CLASS_C_DEC \
PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
#define PB_DS_RB_TREE_BASE \
PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
/**
* @brief Red-Black tree.
* @ingroup branch-detail
*
* This implementation uses an idea from the SGI STL (using a
* @a header node which is needed for efficient iteration).
*/
template<typename Key,
typename Mapped,
typename Cmp_Fn,
typename Node_And_It_Traits,
typename _Alloc>
class PB_DS_RB_TREE_NAME : public PB_DS_RB_TREE_BASE
{
private:
typedef PB_DS_RB_TREE_BASE base_type;
typedef typename base_type::node_pointer node_pointer;
public:
typedef rb_tree_tag container_category;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename base_type::key_type key_type;
typedef typename base_type::key_pointer key_pointer;
typedef typename base_type::key_const_pointer key_const_pointer;
typedef typename base_type::key_reference key_reference;
typedef typename base_type::key_const_reference key_const_reference;
typedef typename base_type::mapped_type mapped_type;
typedef typename base_type::mapped_pointer mapped_pointer;
typedef typename base_type::mapped_const_pointer mapped_const_pointer;
typedef typename base_type::mapped_reference mapped_reference;
typedef typename base_type::mapped_const_reference mapped_const_reference;
typedef typename base_type::value_type value_type;
typedef typename base_type::pointer pointer;
typedef typename base_type::const_pointer const_pointer;
typedef typename base_type::reference reference;
typedef typename base_type::const_reference const_reference;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator point_const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::reverse_iterator reverse_iterator;
typedef typename base_type::const_reverse_iterator const_reverse_iterator;
typedef typename base_type::node_update node_update;
PB_DS_RB_TREE_NAME();
PB_DS_RB_TREE_NAME(const Cmp_Fn&);
PB_DS_RB_TREE_NAME(const Cmp_Fn&, const node_update&);
PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
template<typename It>
void
copy_from_range(It, It);
inline std::pair<point_iterator, bool>
insert(const_reference);
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
std::pair<point_iterator, bool> ins_pair =
base_type::insert_leaf(value_type(r_key, mapped_type()));
if (ins_pair.second == true)
{
ins_pair.first.m_p_nd->m_red = true;
_GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid(__FILE__, __LINE__);)
insert_fixup(ins_pair.first.m_p_nd);
}
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return ins_pair.first.m_p_nd->m_value.second;
#else
insert(r_key);
return base_type::s_null_type;
#endif
}
inline bool
erase(key_const_reference);
inline iterator
erase(iterator);
inline reverse_iterator
erase(reverse_iterator);
template<typename Pred>
inline size_type
erase_if(Pred);
void
join(PB_DS_CLASS_C_DEC&);
void
split(key_const_reference, PB_DS_CLASS_C_DEC&);
private:
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
size_type
assert_node_consistent(const node_pointer, const char*, int) const;
#endif
inline static bool
is_effectively_black(const node_pointer);
void
initialize();
void
insert_fixup(node_pointer);
void
erase_node(node_pointer);
void
remove_node(node_pointer);
void
remove_fixup(node_pointer, node_pointer);
void
split_imp(node_pointer, PB_DS_CLASS_C_DEC&);
inline node_pointer
split_min();
std::pair<node_pointer, node_pointer>
split_min_imp();
void
join_imp(node_pointer, node_pointer);
std::pair<node_pointer, node_pointer>
find_join_pos_right(node_pointer, size_type, size_type);
std::pair<node_pointer, node_pointer>
find_join_pos_left(node_pointer, size_type, size_type);
inline size_type
black_height(node_pointer);
void
split_at_node(node_pointer, PB_DS_CLASS_C_DEC&);
};
#define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);)
#include <ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp>
#undef PB_DS_STRUCT_ONLY_ASSERT_VALID
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_RB_TREE_NAME
#undef PB_DS_RB_TREE_BASE_NAME
#undef PB_DS_RB_TREE_BASE
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/find_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/node.hpp
* Contains an implementation for rb_tree_.
*/
#ifndef PB_DS_RB_TREE_NODE_HPP
#define PB_DS_RB_TREE_NODE_HPP
#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Node for Red-Black trees.
template<typename Value_Type, class Metadata, typename _Alloc>
struct rb_tree_node_
{
public:
typedef Value_Type value_type;
typedef Metadata metadata_type;
typedef
typename _Alloc::template rebind<
rb_tree_node_<
Value_Type,
Metadata,
_Alloc> >::other::pointer
node_pointer;
typedef
typename _Alloc::template rebind<
metadata_type>::other::reference
metadata_reference;
typedef
typename _Alloc::template rebind<
metadata_type>::other::const_reference
metadata_const_reference;
bool
special() const
{ return m_red; }
metadata_const_reference
get_metadata() const
{ return m_metadata; }
metadata_reference
get_metadata()
{ return m_metadata; }
#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
void
trace() const
{
std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> ")
<< "(" << m_metadata << ")";
}
#endif
node_pointer m_p_left;
node_pointer m_p_right;
node_pointer m_p_parent;
value_type m_value;
bool m_red;
metadata_type m_metadata;
};
template<typename Value_Type, typename _Alloc>
struct rb_tree_node_<Value_Type, null_type, _Alloc>
{
public:
typedef Value_Type value_type;
typedef null_type metadata_type;
typedef
typename _Alloc::template rebind<
rb_tree_node_<
Value_Type,
null_type,
_Alloc> >::other::pointer
node_pointer;
bool
special() const
{ return m_red; }
#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
void
trace() const
{ std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> "); }
#endif
node_pointer m_p_left;
node_pointer m_p_right;
node_pointer m_p_parent;
value_type m_value;
bool m_red;
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/traits.hpp
* Contains an implementation for rb_tree_.
*/
#ifndef PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP
#define PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP
#include <ext/pb_ds/detail/rb_tree_map_/node.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Specialization.
/// @ingroup traits
template<typename Key,
typename Mapped,
typename Cmp_Fn,
template<typename Node_CItr,
typename Node_Itr,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc>
: public bin_search_tree_traits<
Key,
Mapped,
Cmp_Fn,
Node_Update,
rb_tree_node_<
typename types_traits<Key, Mapped, _Alloc, false>::value_type,
typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,
_Alloc>::type,
_Alloc>,
_Alloc>
{ };
/// Specialization.
/// @ingroup traits
template<typename Key,
typename Cmp_Fn,
template<typename Node_CItr,
typename Node_Itr,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc>
: public bin_search_tree_traits<
Key,
null_type,
Cmp_Fn,
Node_Update,
rb_tree_node_<
typename types_traits<Key, null_type, _Alloc, false>::value_type,
typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,
_Alloc>::type,
_Alloc>,
_Alloc>
{ };
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/info_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
is_effectively_black(const node_pointer p_nd)
{ return (p_nd == 0 || !p_nd->m_red); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/erase_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
pop()
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
_GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
node_pointer p_nd = m_p_max;
remove_max_node();
base_type::actual_erase_node(p_nd);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
remove_max_node()
{
to_aux_except_max();
make_from_aux();
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
to_aux_except_max()
{
node_pointer p_add = base_type::m_p_root;
while (p_add != m_p_max)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
add_to_aux(p_add);
p_add = p_next_add;
}
p_add = m_p_max->m_p_l_child;
while (p_add != 0)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
p_add->m_metadata = p_add->m_p_l_child == 0 ?
0 : p_add->m_p_l_child->m_metadata + 1;
add_to_aux(p_add);
p_add = p_next_add;
}
p_add = m_p_max->m_p_next_sibling;
while (p_add != 0)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
add_to_aux(p_add);
p_add = p_next_add;
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
add_to_aux(node_pointer p_nd)
{
size_type r = p_nd->m_metadata;
while (m_a_aux[r] != 0)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value))
make_child_of(m_a_aux[r], p_nd);
else
{
make_child_of(p_nd, m_a_aux[r]);
p_nd = m_a_aux[r];
}
m_a_aux[r] = 0;
++r;
}
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
m_a_aux[r] = p_nd;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
make_child_of(node_pointer p_nd, node_pointer p_new_parent)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_new_parent->m_metadata);
_GLIBCXX_DEBUG_ASSERT(m_a_aux[p_nd->m_metadata] == p_nd ||
m_a_aux[p_nd->m_metadata] == p_new_parent);
++p_new_parent->m_metadata;
base_type::make_child_of(p_nd, p_new_parent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
make_from_aux()
{
base_type::m_p_root = m_p_max = 0;
const size_type rnk_bnd = rank_bound();
size_type i = 0;
while (i < rnk_bnd)
{
if (m_a_aux[i] != 0)
{
make_root_and_link(m_a_aux[i]);
m_a_aux[i] = 0;
}
++i;
}
PB_DS_ASSERT_AUX_NULL((*this))
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
remove_node(node_pointer p_nd)
{
node_pointer p_parent = p_nd;
while (base_type::parent(p_parent) != 0)
p_parent = base_type::parent(p_parent);
base_type::bubble_to_top(p_nd);
m_p_max = p_nd;
node_pointer p_fix = base_type::m_p_root;
while (p_fix != 0&& p_fix->m_p_next_sibling != p_parent)
p_fix = p_fix->m_p_next_sibling;
if (p_fix != 0)
p_fix->m_p_next_sibling = p_nd;
remove_max_node();
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
clear()
{
base_type::clear();
m_p_max = 0;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase(point_iterator it)
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
node_pointer p_nd = it.m_p_nd;
remove_node(p_nd);
base_type::actual_erase_node(p_nd);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
template<typename Pred>
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
if (base_type::empty())
{
PB_DS_ASSERT_VALID((*this))
return 0;
}
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
size_type ersd = 0;
while (p_out != 0)
{
++ersd;
node_pointer p_next = p_out->m_p_next_sibling;
base_type::actual_erase_node(p_out);
p_out = p_next;
}
node_pointer p_cur = base_type::m_p_root;
m_p_max = base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
make_root_and_link(p_cur);
p_cur = p_next;
}
PB_DS_ASSERT_VALID((*this))
return ersd;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
rank_bound()
{
using namespace std;
const size_t* const p_upper =
std::upper_bound(g_a_rank_bounds,
g_a_rank_bounds + num_distinct_rank_bounds,
base_type::m_size);
if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds)
return max_rank;
return (p_upper - g_a_rank_bounds);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/debug_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
base_type::assert_valid(__file, __line);
assert_node_consistent(base_type::m_p_root, true, __file, __line);
assert_max(__file, __line);
assert_aux_null(__file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_aux_null(const char* __file, int __line) const
{
for (size_type i = 0; i < max_rank; ++i)
PB_DS_DEBUG_VERIFY(m_a_aux[i] == 0);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_max(const char* __file, int __line) const
{
if (m_p_max == 0)
{
PB_DS_DEBUG_VERIFY(base_type::empty());
return;
}
PB_DS_DEBUG_VERIFY(!base_type::empty());
PB_DS_DEBUG_VERIFY(base_type::parent(m_p_max) == 0);
PB_DS_DEBUG_VERIFY(m_p_max->m_p_prev_or_parent == 0);
for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_node_consistent(node_const_pointer p_nd, bool root,
const char* __file, int __line) const
{
base_type::assert_node_consistent(p_nd, root, __file, __line);
if (p_nd == 0)
return;
assert_node_consistent(p_nd->m_p_next_sibling, root, __file, __line);
assert_node_consistent(p_nd->m_p_l_child, false, __file, __line);
if (!root)
{
if (p_nd->m_metadata == 0)
PB_DS_DEBUG_VERIFY(p_nd->m_p_next_sibling == 0);
else
PB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1);
}
if (p_nd->m_p_l_child != 0)
PB_DS_DEBUG_VERIFY(p_nd->m_p_l_child->m_metadata + 1 == base_type::degree(p_nd));
const bool unmarked_valid =
(p_nd->m_p_l_child == 0 && p_nd->m_metadata == 0)
|| (p_nd->m_p_l_child != 0
&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);
const bool marked_valid =
(p_nd->m_p_l_child == 0 && p_nd->m_metadata == 1)
|| (p_nd->m_p_l_child != 0
&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2);
PB_DS_DEBUG_VERIFY(unmarked_valid || marked_valid);
if (root)
PB_DS_DEBUG_VERIFY(unmarked_valid);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/insert_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
p_nd->m_metadata = 0;
p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;
if (base_type::m_p_root == 0)
{
p_nd->m_p_next_sibling = 0;
m_p_max = base_type::m_p_root = p_nd;
PB_DS_ASSERT_VALID((*this))
return point_iterator(p_nd);
}
p_nd->m_p_next_sibling = base_type::m_p_root;
base_type::m_p_root->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
update_max(p_nd);
PB_DS_ASSERT_VALID((*this))
return point_iterator(p_nd);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
make_root(node_pointer p_nd)
{
p_nd->m_metadata = p_nd->m_p_l_child == 0
? 0 : 1 + p_nd->m_p_l_child->m_metadata;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
make_root_and_link(node_pointer p_nd)
{
make_root(p_nd);
p_nd->m_p_prev_or_parent = 0;
p_nd->m_p_next_sibling = base_type::m_p_root;
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
update_max(p_nd);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix(node_pointer p_y)
{
while (true)
{
if (p_y->m_p_prev_or_parent == 0)
{
fix_root(p_y);
return;
}
else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == 0)
{
if (p_y->m_p_l_child != 0)
{
fix_sibling_rank_1_unmarked(p_y);
return;
}
fix_sibling_rank_1_marked(p_y);
p_y = p_y->m_p_prev_or_parent;
}
else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != 0);
if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2)
{
fix_sibling_general_unmarked(p_y);
return;
}
fix_sibling_general_marked(p_y);
p_y = p_y->m_p_prev_or_parent;
}
else if ((p_y->m_p_l_child == 0&&
p_y->m_metadata == 2) ||(p_y->m_p_l_child != 0&&
p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3))
{
node_pointer p_z = p_y->m_p_prev_or_parent;
fix_child(p_y);
p_y = p_z;
}
else
return;
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix_root(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == 0);
make_root(p_y);
PB_DS_ASSERT_NODE_CONSISTENT(p_y, true)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix_sibling_rank_1_unmarked(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
_GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;)
_GLIBCXX_DEBUG_ASSERT(p_w != 0);
_GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == 0);
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == 0);
p_y->m_p_next_sibling = p_y->m_p_l_child;
p_y->m_p_next_sibling->m_p_prev_or_parent = p_y;
p_y->m_p_l_child = 0;
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix_sibling_rank_1_marked(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == 0);
p_y->m_metadata = 0;
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix_sibling_general_unmarked(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
node_pointer p_w = p_y->m_p_l_child;
_GLIBCXX_DEBUG_ASSERT(p_w != 0);
_GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);
p_y->m_p_l_child = p_w->m_p_next_sibling;
p_w->m_p_next_sibling->m_p_prev_or_parent = p_y;
p_w->m_p_next_sibling = p_y->m_p_next_sibling;
_GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);
p_w->m_p_next_sibling->m_p_prev_or_parent = p_w;
p_y->m_p_next_sibling = p_w;
p_w->m_p_prev_or_parent = p_y;
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix_sibling_general_marked(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
--p_y->m_metadata;
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
fix_child(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
if (p_y->m_p_next_sibling != 0)
p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent;
if (p_y->m_p_prev_or_parent->m_p_l_child == p_y)
p_y->m_p_prev_or_parent->m_p_l_child = p_y->m_p_next_sibling;
else
p_y->m_p_prev_or_parent->m_p_next_sibling = p_y->m_p_next_sibling;
make_root_and_link(p_y);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
modify(point_iterator it, const_reference r_new_val)
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = it.m_p_nd;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value);
p_nd->m_value = r_new_val;
if (smaller)
{
remove_node(p_nd);
p_nd->m_p_l_child = 0;
make_root_and_link(p_nd);
PB_DS_ASSERT_VALID((*this))
return;
}
if (p_nd->m_p_prev_or_parent == 0)
{
update_max(p_nd);
PB_DS_ASSERT_VALID((*this))
return;
}
node_pointer p_y = p_nd->m_p_prev_or_parent;
_GLIBCXX_DEBUG_ASSERT(p_y != 0);
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y;
if (p_y->m_p_l_child == p_nd)
p_y->m_p_l_child = p_nd->m_p_next_sibling;
else
p_y->m_p_next_sibling = p_nd->m_p_next_sibling;
fix(p_y);
make_root_and_link(p_nd);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update_max(node_pointer p_nd)
{
if (m_p_max == 0 || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
m_p_max = p_nd;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/split_join_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
PB_DS_CLASS_T_DEC
template<typename Pred>
void
PB_DS_CLASS_C_DEC::
split(Pred pred, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
other.clear();
if (base_type::empty())
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
++other.m_size;
node_pointer p_next = p_out->m_p_next_sibling;
other.make_root_and_link(p_out);
p_out = p_next;
}
PB_DS_ASSERT_VALID(other)
node_pointer p_cur = base_type::m_p_root;
m_p_max = 0;
base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
make_root_and_link(p_cur);
p_cur = p_next;
}
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
node_pointer p_other = other.m_p_root;
while (p_other != 0)
{
node_pointer p_next = p_other->m_p_next_sibling;
make_root_and_link(p_other);
p_other = p_next;
}
base_type::m_size += other.m_size;
other.m_p_root = 0;
other.m_size = 0;
other.m_p_max = 0;
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
push(*(first_it++));
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
thin_heap() : m_p_max(0)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
thin_heap(const Cmp_Fn& r_cmp_fn)
: base_type(r_cmp_fn), m_p_max(0)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
thin_heap(const PB_DS_CLASS_C_DEC& other)
: base_type(other)
{
initialize();
m_p_max = base_type::m_p_root;
for (node_pointer p_nd = base_type::m_p_root; p_nd != 0;
p_nd = p_nd->m_p_next_sibling)
if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
m_p_max = p_nd;
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
base_type::swap(other);
std::swap(m_p_max, other.m_p_max);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~thin_heap()
{ }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{ std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(0)); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/trace_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
#ifdef PB_DS_THIN_HEAP_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << std::endl;
std::cerr << "m_p_max " << m_p_max << std::endl;
base_type::trace();
}
#endif // #ifdef PB_DS_THIN_HEAP_TRACE_
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/find_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reference
PB_DS_CLASS_C_DEC::
top() const
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
_GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
return m_p_max->m_value;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file thin_heap_/thin_heap_.hpp
* Contains an implementation class for a thin heap.
*/
#ifndef PB_DS_THIN_HEAP_HPP
#define PB_DS_THIN_HEAP_HPP
#include <algorithm>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
thin_heap<Value_Type, Cmp_Fn, _Alloc>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_BASE_T_P \
<Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc, true>
#else
#define PB_DS_BASE_T_P \
<Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc>
#endif
/**
* Thin heap.
*
* @ingroup heap-detail
*
* See Tarjan and Kaplan.
*/
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class thin_heap
: public left_child_next_sibling_heap PB_DS_BASE_T_P
{
private:
typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a;
typedef left_child_next_sibling_heap PB_DS_BASE_T_P base_type;
protected:
typedef typename base_type::node node;
typedef typename base_type::node_pointer node_pointer;
typedef typename base_type::node_const_pointer node_const_pointer;
public:
typedef Value_Type value_type;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename __rebind_a::pointer pointer;
typedef typename __rebind_a::const_pointer const_pointer;
typedef typename __rebind_a::reference reference;
typedef typename __rebind_a::const_reference const_reference;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::point_const_iterator point_const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
inline point_iterator
push(const_reference);
void
modify(point_iterator, const_reference);
inline const_reference
top() const;
void
pop();
void
erase(point_iterator);
inline void
clear();
template<typename Pred>
size_type
erase_if(Pred);
template<typename Pred>
void
split(Pred, PB_DS_CLASS_C_DEC&);
void
join(PB_DS_CLASS_C_DEC&);
protected:
thin_heap();
thin_heap(const Cmp_Fn&);
thin_heap(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
~thin_heap();
template<typename It>
void
copy_from_range(It, It);
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
void
assert_max(const char*, int) const;
#endif
#ifdef PB_DS_THIN_HEAP_TRACE_
void
trace() const;
#endif
private:
enum
{
max_rank = (sizeof(size_type) << 4) + 2
};
void
initialize();
inline void
update_max(node_pointer);
inline void
fix(node_pointer);
inline void
fix_root(node_pointer);
inline void
fix_sibling_rank_1_unmarked(node_pointer);
inline void
fix_sibling_rank_1_marked(node_pointer);
inline void
fix_sibling_general_unmarked(node_pointer);
inline void
fix_sibling_general_marked(node_pointer);
inline void
fix_child(node_pointer);
inline static void
make_root(node_pointer);
inline void
make_root_and_link(node_pointer);
inline void
remove_max_node();
void
to_aux_except_max();
inline void
add_to_aux(node_pointer);
inline void
make_from_aux();
inline size_type
rank_bound();
inline void
make_child_of(node_pointer, node_pointer);
inline void
remove_node(node_pointer);
inline node_pointer
join(node_pointer, node_pointer) const;
#ifdef _GLIBCXX_DEBUG
void
assert_node_consistent(node_const_pointer, bool, const char*, int) const;
void
assert_aux_null(const char*, int) const;
#endif
node_pointer m_p_max;
node_pointer m_a_aux[max_rank];
};
enum
{
num_distinct_rank_bounds = 48
};
// Taken from the SGI implementation; acknowledged in the docs.
static const std::size_t g_a_rank_bounds[num_distinct_rank_bounds] =
{
/* Dealing cards... */
/* 0 */ 0ul,
/* 1 */ 1ul,
/* 2 */ 1ul,
/* 3 */ 2ul,
/* 4 */ 4ul,
/* 5 */ 6ul,
/* 6 */ 11ul,
/* 7 */ 17ul,
/* 8 */ 29ul,
/* 9 */ 46ul,
/* 10 */ 76ul,
/* 11 */ 122ul,
/* 12 */ 199ul,
/* 13 */ 321ul,
/* 14 */ 521ul,
/* 15 */ 842ul,
/* 16 */ 1364ul,
/* 17 */ 2206ul,
/* 18 */ 3571ul,
/* 19 */ 5777ul,
/* 20 */ 9349ul,
/* 21 */ 15126ul,
/* 22 */ 24476ul,
/* 23 */ 39602ul,
/* 24 */ 64079ul
#if __SIZE_MAX__ > 0xfffful
,
/* 25 */ 103681ul,
/* 26 */ 167761ul,
/* 27 */ 271442ul,
/* 28 */ 439204ul,
/* 29 */ 710646ul
#if __SIZE_MAX__ > 0xffffful
,
/* 30 */ 1149851ul,
/* 31 */ 1860497ul,
/* 32 */ 3010349ul,
/* 33 */ 4870846ul,
/* 34 */ 7881196ul,
/* 35 */ 12752042ul
#if __SIZE_MAX__ > 0xfffffful
,
/* 36 */ 20633239ul,
/* 37 */ 33385282ul,
/* 38 */ 54018521ul,
/* 39 */ 87403803ul,
/* 40 */ 141422324ul,
/* 41 */ 228826127ul,
/* 42 */ 370248451ul,
/* 43 */ 599074578ul,
/* 44 */ 969323029ul,
/* 45 */ 1568397607ul,
/* 46 */ 2537720636ul,
/* 47 */ 4106118243ul
#endif
#endif
#endif
/* Pot's good, let's play */
};
#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool, \
__FILE__, __LINE__);)
#define PB_DS_ASSERT_AUX_NULL(X) \
_GLIBCXX_DEBUG_ONLY(X.assert_aux_null(__FILE__, __LINE__);)
#include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp>
#include <ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp>
#undef PB_DS_ASSERT_AUX_NULL
#undef PB_DS_ASSERT_NODE_CONSISTENT
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_BASE_T_P
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file point_iterator.hpp
* Contains an iterator class returned by the tables' find and insert
* methods.
*/
/// Find type iterator.
class point_iterator_
{
public:
/// Category.
typedef trivial_iterator_tag iterator_category;
/// Difference type.
typedef trivial_iterator_difference_type difference_type;
/// Iterator's value type.
typedef value_type_ value_type;
/// Iterator's pointer type.
typedef pointer_ pointer;
/// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
/// Iterator's reference type.
typedef reference_ reference;
/// Iterator's const reference type.
typedef const_reference_ const_reference;
/// Default constructor.
inline
point_iterator_()
: m_p_value(0)
{ }
/// Copy constructor.
inline
point_iterator_(const point_iterator_& other)
: m_p_value(other.m_p_value)
{ }
/// Access.
pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return (m_p_value);
}
/// Access.
reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return (*m_p_value);
}
/// Compares content to a different iterator object.
bool
operator==(const point_iterator_& other) const
{ return m_p_value == other.m_p_value; }
/// Compares content to a different iterator object.
bool
operator==(const point_const_iterator_& other) const
{ return m_p_value == other.m_p_value; }
/// Compares content to a different iterator object.
bool
operator!=(const point_iterator_& other) const
{ return m_p_value != other.m_p_value; }
/// Compares content (negatively) to a different iterator object.
bool
operator!=(const point_const_iterator_& other) const
{ return m_p_value != other.m_p_value; }
inline
point_iterator_(pointer p_value) : m_p_value(p_value)
{ }
protected:
friend class point_const_iterator_;
friend class PB_DS_CLASS_C_DEC;
protected:
pointer m_p_value;
};
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file unordered_iterator/const_iterator.hpp
* Contains an iterator class used for const ranging over the elements of the
* table.
*/
/// Const range-type iterator.
class const_iterator_
: public point_const_iterator_
{
public:
/// Category.
typedef std::forward_iterator_tag iterator_category;
/// Difference type.
typedef typename _Alloc::difference_type difference_type;
/// Iterator's value type.
typedef value_type_ value_type;
/// Iterator's pointer type.
typedef pointer_ pointer;
/// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
/// Iterator's reference type.
typedef reference_ reference;
/// Iterator's const reference type.
typedef const_reference_ const_reference;
/// Default constructor.
const_iterator_() : m_p_tbl(0)
{ }
/// Increments.
const_iterator_&
operator++()
{
m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);
return *this;
}
/// Increments.
const_iterator_
operator++(int)
{
const_iterator_ ret =* this;
m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);
return ret;
}
protected:
typedef point_const_iterator_ base_type;
/**
* Constructor used by the table to initiate the generalized
* pointer and position (e.g., this is called from within a find()
* of a table.
* */
const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos,
const PB_DS_CLASS_C_DEC* p_tbl)
: point_const_iterator_(p_value), m_p_tbl(p_tbl), m_pos(pos)
{ }
/**
* Pointer to the table object which created the iterator (used for
* incrementing its position.
* */
const PB_DS_CLASS_C_DEC* m_p_tbl;
PB_DS_GEN_POS m_pos;
friend class PB_DS_CLASS_C_DEC;
};
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file unordered_iterator/point_const_iterator.hpp
* Contains an iterator class returned by the tables' const find and insert
* methods.
*/
class point_iterator_;
/// Const point-type iterator.
class point_const_iterator_
{
public:
/// Category.
typedef trivial_iterator_tag iterator_category;
/// Difference type.
typedef trivial_iterator_difference_type difference_type;
/// Iterator's value type.
typedef value_type_ value_type;
/// Iterator's pointer type.
typedef pointer_ pointer;
/// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
/// Iterator's reference type.
typedef reference_ reference;
/// Iterator's const reference type.
typedef const_reference_ const_reference;
inline
point_const_iterator_(const_pointer p_value) : m_p_value(p_value)
{ }
/// Default constructor.
inline
point_const_iterator_() : m_p_value(0)
{ }
/// Copy constructor.
inline
point_const_iterator_(const point_const_iterator_& other)
: m_p_value(other.m_p_value)
{ }
/// Copy constructor.
inline
point_const_iterator_(const point_iterator_& other)
: m_p_value(other.m_p_value)
{ }
/// Access.
const_pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return m_p_value;
}
/// Access.
const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
return *m_p_value;
}
/// Compares content to a different iterator object.
bool
operator==(const point_iterator_& other) const
{ return m_p_value == other.m_p_value; }
/// Compares content to a different iterator object.
bool
operator==(const point_const_iterator_& other) const
{ return m_p_value == other.m_p_value; }
/// Compares content (negatively) to a different iterator object.
bool
operator!=(const point_iterator_& other) const
{ return m_p_value != other.m_p_value; }
/// Compares content (negatively) to a different iterator object.
bool
operator!=(const point_const_iterator_& other) const
{ return m_p_value != other.m_p_value; }
protected:
const_pointer m_p_value;
friend class point_iterator_;
friend class PB_DS_CLASS_C_DEC;
};
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file iterator.hpp
* Contains an iterator_ class used for ranging over the elements of the
* table.
*/
/// Range-type iterator.
class iterator_
: public const_iterator_
{
public:
/// Category.
typedef std::forward_iterator_tag iterator_category;
/// Difference type.
typedef typename _Alloc::difference_type difference_type;
/// Iterator's value type.
typedef value_type_ value_type;
/// Iterator's pointer type.
typedef pointer_ pointer;
/// Iterator's const pointer type.
typedef const_pointer_ const_pointer;
/// Iterator's reference type.
typedef reference_ reference;
/// Iterator's const reference type.
typedef const_reference_ const_reference;
/// Default constructor.
inline
iterator_()
: const_iterator_(0, PB_DS_GEN_POS(), 0) { }
/// Conversion to a point-type iterator.
inline
operator point_iterator_()
{ return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); }
/// Conversion to a point-type iterator.
inline
operator const point_iterator_() const
{ return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); }
/// Access.
pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
return (const_cast<pointer>(base_type::m_p_value));
}
/// Access.
reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
return (const_cast<reference>(*base_type::m_p_value));
}
/// Increments.
iterator_&
operator++()
{
base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);
return *this;
}
/// Increments.
iterator_
operator++(int)
{
iterator_ ret =* this;
base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);
return ret;
}
protected:
typedef const_iterator_ base_type;
/**
* Constructor used by the table to initiate the generalized
* pointer and position (e.g., this is called from within a find()
* of a table.
* */
inline
iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl)
: const_iterator_(p_value, pos, p_tbl)
{ }
friend class PB_DS_CLASS_C_DEC;
};
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/erase_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
clear_imp(m_p_root);
_GLIBCXX_DEBUG_ASSERT(m_size == 0);
m_p_root = 0;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
actual_erase_node(node_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
p_nd->~node();
s_node_allocator.deallocate(p_nd, 1);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
while (p_nd != 0)
{
clear_imp(p_nd->m_p_l_child);
node_pointer p_next = p_nd->m_p_next_sibling;
actual_erase_node(p_nd);
p_nd = p_next;
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
to_linked_list()
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_cur = m_p_root;
while (p_cur != 0)
if (p_cur->m_p_l_child != 0)
{
node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;
p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;
p_cur->m_p_next_sibling = p_cur->m_p_l_child;
p_cur->m_p_l_child = p_child_next;
}
else
p_cur = p_cur->m_p_next_sibling;
#ifdef _GLIBCXX_DEBUG
node_const_pointer p_counter = m_p_root;
size_type count = 0;
while (p_counter != 0)
{
++count;
_GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == 0);
p_counter = p_counter->m_p_next_sibling;
}
_GLIBCXX_DEBUG_ASSERT(count == m_size);
#endif
}
PB_DS_CLASS_T_DEC
template<typename Pred>
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
prune(Pred pred)
{
node_pointer p_cur = m_p_root;
m_p_root = 0;
node_pointer p_out = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
if (pred(p_cur->m_value))
{
p_cur->m_p_next_sibling = p_out;
if (p_out != 0)
p_out->m_p_prev_or_parent = p_cur;
p_out = p_cur;
}
else
{
p_cur->m_p_next_sibling = m_p_root;
if (m_p_root != 0)
m_p_root->m_p_prev_or_parent = p_cur;
m_p_root = p_cur;
}
p_cur = p_next;
}
return p_out;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
bubble_to_top(node_pointer p_nd)
{
node_pointer p_parent = parent(p_nd);
while (p_parent != 0)
{
swap_with_parent(p_nd, p_parent);
p_parent = parent(p_nd);
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/const_iterator.hpp
* Contains an iterator class returned by the table's const find and insert
* methods.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_C_DEC \
left_child_next_sibling_heap_const_iterator_<Node, _Alloc>
#define PB_DS_BASIC_HEAP_CIT_BASE \
left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
/// Const point-type iterator.
template<typename Node, typename _Alloc>
class left_child_next_sibling_heap_const_iterator_
: public PB_DS_BASIC_HEAP_CIT_BASE
{
private:
typedef PB_DS_BASIC_HEAP_CIT_BASE base_type;
typedef typename base_type::node_pointer node_pointer;
public:
/// Category.
typedef std::forward_iterator_tag iterator_category;
/// Difference type.
typedef typename _Alloc::difference_type difference_type;
/// Iterator's value type.
typedef typename base_type::value_type value_type;
/// Iterator's pointer type.
typedef typename base_type::pointer pointer;
/// Iterator's const pointer type.
typedef typename base_type::const_pointer const_pointer;
/// Iterator's reference type.
typedef typename base_type::reference reference;
/// Iterator's const reference type.
typedef typename base_type::const_reference const_reference;
inline
left_child_next_sibling_heap_const_iterator_(node_pointer p_nd)
: base_type(p_nd)
{ }
/// Default constructor.
inline
left_child_next_sibling_heap_const_iterator_()
{ }
/// Copy constructor.
inline
left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
{ }
/// Compares content to a different iterator object.
bool
operator==(const PB_DS_CLASS_C_DEC& other) const
{ return (base_type::m_p_nd == other.m_p_nd); }
/// Compares content (negatively) to a different iterator object.
bool
operator!=(const PB_DS_CLASS_C_DEC& other) const
{ return (base_type::m_p_nd != other.m_p_nd); }
PB_DS_CLASS_C_DEC&
operator++()
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0);
inc();
return (*this);
}
PB_DS_CLASS_C_DEC
operator++(int)
{
PB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd);
operator++();
return (ret_it);
}
private:
void
inc()
{
if (base_type::m_p_nd->m_p_next_sibling != 0)
{
base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;
while (base_type::m_p_nd->m_p_l_child != 0)
base_type::m_p_nd = base_type::m_p_nd->m_p_l_child;
return;
}
while (true)
{
node_pointer p_next = base_type::m_p_nd;
base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;
if (base_type::m_p_nd == 0
|| base_type::m_p_nd->m_p_l_child == p_next)
return;
}
}
};
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_BASIC_HEAP_CIT_BASE
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/debug_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(m_p_root == 0 || m_p_root->m_p_prev_or_parent == 0);
if (m_p_root != 0)
assert_node_consistent(m_p_root, Single_Link_Roots, __file, __line);
assert_size(__file, __line);
assert_iterators(__file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_node_consistent(node_const_pointer p_nd, bool single_link,
const char* __file, int __line) const
{
if (p_nd == 0)
return;
assert_node_consistent(p_nd->m_p_l_child, false, __file, __line);
assert_node_consistent(p_nd->m_p_next_sibling, single_link, __file, __line);
if (single_link)
PB_DS_DEBUG_VERIFY(p_nd->m_p_prev_or_parent == 0);
else if (p_nd->m_p_next_sibling != 0)
PB_DS_DEBUG_VERIFY(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);
if (p_nd->m_p_l_child == 0)
return;
node_const_pointer p_child = p_nd->m_p_l_child;
while (p_child != 0)
{
node_const_pointer p_next_child = p_child->m_p_next_sibling;
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));
p_child = p_next_child;
}
PB_DS_DEBUG_VERIFY(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_iterators(const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) == size());
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_size(const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(size_from_node(m_p_root) == m_size);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size_under_node(node_const_pointer p_nd)
{ return 1 + size_from_node(p_nd->m_p_l_child); }
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size_from_node(node_const_pointer p_nd)
{
size_type ret = 0;
while (p_nd != 0)
{
ret += 1 + size_from_node(p_nd->m_p_l_child);
p_nd = p_nd->m_p_next_sibling;
}
return ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
degree(node_const_pointer p_nd)
{
size_type ret = 0;
node_const_pointer p_child = p_nd->m_p_l_child;
while (p_child != 0)
{
++ret;
p_child = p_child->m_p_next_sibling;
}
return ret;
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/point_const_iterator.hpp
* Contains an iterator class returned by the table's const find and insert
* methods.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
#include <ext/pb_ds/tag_and_trait.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Node, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
/// Const point-type iterator.
template<typename Node, typename _Alloc>
class left_child_next_sibling_heap_node_point_const_iterator_
{
protected:
typedef typename _Alloc::template rebind<Node>::other::pointer node_pointer;
public:
/// Category.
typedef trivial_iterator_tag iterator_category;
/// Difference type.
typedef trivial_iterator_difference_type difference_type;
/// Iterator's value type.
typedef typename Node::value_type value_type;
/// Iterator's pointer type.
typedef
typename _Alloc::template rebind<
value_type>::other::pointer
pointer;
/// Iterator's const pointer type.
typedef
typename _Alloc::template rebind<
value_type>::other::const_pointer
const_pointer;
/// Iterator's reference type.
typedef
typename _Alloc::template rebind<
value_type>::other::reference
reference;
/// Iterator's const reference type.
typedef
typename _Alloc::template rebind<
value_type>::other::const_reference
const_reference;
inline
left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
{ }
/// Default constructor.
inline
left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0)
{ }
/// Copy constructor.
inline
left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
{ }
/// Access.
const_pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return &m_p_nd->m_value;
}
/// Access.
const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return m_p_nd->m_value;
}
/// Compares content to a different iterator object.
bool
operator==(const PB_DS_CLASS_C_DEC& other) const
{ return m_p_nd == other.m_p_nd; }
/// Compares content (negatively) to a different iterator object.
bool
operator!=(const PB_DS_CLASS_C_DEC& other) const
{ return m_p_nd != other.m_p_nd; }
node_pointer m_p_nd;
};
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/insert_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_new_node_for_insert(const_reference r_val)
{
return get_new_node_for_insert(r_val, s_no_throw_copies_ind);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_new_node_for_insert(const_reference r_val, false_type)
{
node_pointer p_new_nd = s_node_allocator.allocate(1);
cond_dealtor_t cond(p_new_nd);
new (const_cast<void* >(
static_cast<const void* >(&p_new_nd->m_value)))
typename node::value_type(r_val);
cond.set_no_action();
++m_size;
return (p_new_nd);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_new_node_for_insert(const_reference r_val, true_type)
{
node_pointer p_new_nd = s_node_allocator.allocate(1);
new (const_cast<void* >(
static_cast<const void* >(&p_new_nd->m_value)))
typename node::value_type(r_val);
++m_size;
return (p_new_nd);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
make_child_of(node_pointer p_nd, node_pointer p_new_parent)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(p_new_parent != 0);
p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;
if (p_new_parent->m_p_l_child != 0)
p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd;
p_nd->m_p_prev_or_parent = p_new_parent;
p_new_parent->m_p_l_child = p_nd;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
parent(node_pointer p_nd)
{
while (true)
{
node_pointer p_pot = p_nd->m_p_prev_or_parent;
if (p_pot == 0 || p_pot->m_p_l_child == p_nd)
return p_pot;
p_nd = p_pot;
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
swap_with_parent(node_pointer p_nd, node_pointer p_parent)
{
if (p_parent == m_p_root)
m_p_root = p_nd;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(p_parent != 0);
_GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent);
const bool nd_direct_child = p_parent->m_p_l_child == p_nd;
const bool parent_root = p_parent->m_p_prev_or_parent == 0;
const bool parent_direct_child =
!parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent;
std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent);
std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling);
std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child);
std::swap(p_parent->m_metadata, p_nd->m_metadata);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != 0);
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != 0);
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
if (p_parent->m_p_next_sibling != 0)
p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;
if (p_parent->m_p_l_child != 0)
p_parent->m_p_l_child->m_p_prev_or_parent = p_parent;
if (parent_direct_child)
p_nd->m_p_prev_or_parent->m_p_l_child = p_nd;
else if (!parent_root)
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd;
if (!nd_direct_child)
{
p_nd->m_p_l_child->m_p_prev_or_parent = p_nd;
p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent;
}
else
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd);
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent);
p_nd->m_p_l_child = p_parent;
p_parent->m_p_prev_or_parent = p_nd;
}
_GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/policy_access_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
PB_DS_CLASS_T_DEC
Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn() const
{ return *this; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_allocator
PB_DS_CLASS_C_DEC::s_node_allocator;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::no_throw_copies_t
PB_DS_CLASS_C_DEC::s_no_throw_copies_ind;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap() :
m_p_root(0),
m_size(0)
{
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap(const Cmp_Fn& r_cmp_fn) :
Cmp_Fn(r_cmp_fn),
m_p_root(0),
m_size(0)
{
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
left_child_next_sibling_heap(const PB_DS_CLASS_C_DEC& other)
: Cmp_Fn(other), m_p_root(0), m_size(0)
{
m_size = other.m_size;
PB_DS_ASSERT_VALID(other)
m_p_root = recursive_copy_node(other.m_p_root);
m_size = other.m_size;
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
value_swap(other);
std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
std::swap(m_p_root, other.m_p_root);
std::swap(m_size, other.m_size);
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~left_child_next_sibling_heap()
{
clear();
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
recursive_copy_node(node_const_pointer p_nd)
{
if (p_nd == 0)
return (0);
node_pointer p_ret = s_node_allocator.allocate(1);
__try
{
new (p_ret) node(*p_nd);
}
__catch(...)
{
s_node_allocator.deallocate(p_ret, 1);
__throw_exception_again;
}
p_ret->m_p_l_child = p_ret->m_p_next_sibling =
p_ret->m_p_prev_or_parent = 0;
__try
{
p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child);
p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling);
}
__catch(...)
{
clear_imp(p_ret);
__throw_exception_again;
}
if (p_ret->m_p_l_child != 0)
p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;
if (p_ret->m_p_next_sibling != 0)
p_ret->m_p_next_sibling->m_p_prev_or_parent =
p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : 0;
return p_ret;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/trace_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
#ifdef PB_DS_LC_NS_HEAP_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << std::endl;
trace_node(m_p_root, 0);
std::cerr << std::endl;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_node(node_const_pointer p_nd, size_type level)
{
while (p_nd != 0)
{
for (size_type i = 0; i < level; ++i)
std::cerr << ' ';
std::cerr << p_nd <<
" prev = " << p_nd->m_p_prev_or_parent <<
" next " << p_nd->m_p_next_sibling <<
" left = " << p_nd->m_p_l_child << " ";
trace_node_metadata(p_nd, type_to_type<node_metadata>());
std::cerr << p_nd->m_value << std::endl;
trace_node(p_nd->m_p_l_child, level + 1);
p_nd = p_nd->m_p_next_sibling;
}
}
PB_DS_CLASS_T_DEC
template<typename Metadata_>
void
PB_DS_CLASS_C_DEC::
trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)
{
std::cerr << "(" << p_nd->m_metadata << ") ";
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_node_metadata(node_const_pointer, type_to_type<null_type>)
{ }
#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/iterators_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
node_pointer p_nd = m_p_root;
if (p_nd == 0)
return (iterator(0));
while (p_nd->m_p_l_child != 0)
p_nd = p_nd->m_p_l_child;
return (iterator(p_nd));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
node_pointer p_nd = m_p_root;
if (p_nd == 0)
return (const_iterator(0));
while (p_nd->m_p_l_child != 0)
p_nd = p_nd->m_p_l_child;
return (const_iterator(p_nd));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{
return (iterator(0));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
return (const_iterator(0));
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
* Contains an implementation class for a basic heap.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP
/*
* Based on CLRS.
*/
#include <iterator>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>
#ifdef PB_DS_LC_NS_HEAP_TRACE_
#include <iostream>
#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef _GLIBCXX_DEBUG
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \
typename _Alloc, bool Single_Link_Roots>
#define PB_DS_CLASS_C_DEC \
left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, \
_Alloc, Single_Link_Roots>
#else
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \
typename _Alloc>
#define PB_DS_CLASS_C_DEC \
left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, _Alloc>
#endif
/// Base class for a basic heap.
template<typename Value_Type,
typename Cmp_Fn,
typename Node_Metadata,
typename _Alloc
#ifdef _GLIBCXX_DEBUG
,bool Single_Link_Roots>
#else
>
#endif
class left_child_next_sibling_heap : public Cmp_Fn
{
protected:
typedef
typename _Alloc::template rebind<
left_child_next_sibling_heap_node_<Value_Type, Node_Metadata,
_Alloc> >::other
node_allocator;
typedef typename node_allocator::value_type node;
typedef typename node_allocator::pointer node_pointer;
typedef typename node_allocator::const_pointer node_const_pointer;
typedef Node_Metadata node_metadata;
typedef std::pair< node_pointer, node_pointer> node_pointer_pair;
private:
typedef cond_dealtor< node, _Alloc> cond_dealtor_t;
enum
{
simple_value = is_simple<Value_Type>::value
};
typedef integral_constant<int, simple_value> no_throw_copies_t;
typedef typename _Alloc::template rebind<Value_Type> __rebind_v;
public:
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef Value_Type value_type;
typedef typename __rebind_v::other::pointer pointer;
typedef typename __rebind_v::other::const_pointer const_pointer;
typedef typename __rebind_v::other::reference reference;
typedef typename __rebind_v::other::const_reference const_reference;
typedef left_child_next_sibling_heap_node_point_const_iterator_<node, _Alloc>
point_const_iterator;
typedef point_const_iterator point_iterator;
typedef left_child_next_sibling_heap_const_iterator_<node, _Alloc>
const_iterator;
typedef const_iterator iterator;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
left_child_next_sibling_heap();
left_child_next_sibling_heap(const Cmp_Fn&);
left_child_next_sibling_heap(const left_child_next_sibling_heap&);
void
swap(PB_DS_CLASS_C_DEC&);
~left_child_next_sibling_heap();
inline bool
empty() const;
inline size_type
size() const;
inline size_type
max_size() const;
Cmp_Fn&
get_cmp_fn();
const Cmp_Fn&
get_cmp_fn() const;
inline iterator
begin();
inline const_iterator
begin() const;
inline iterator
end();
inline const_iterator
end() const;
void
clear();
#ifdef PB_DS_LC_NS_HEAP_TRACE_
void
trace() const;
#endif
protected:
inline node_pointer
get_new_node_for_insert(const_reference);
inline static void
make_child_of(node_pointer, node_pointer);
void
value_swap(left_child_next_sibling_heap&);
inline static node_pointer
parent(node_pointer);
inline void
swap_with_parent(node_pointer, node_pointer);
void
bubble_to_top(node_pointer);
inline void
actual_erase_node(node_pointer);
void
clear_imp(node_pointer);
void
to_linked_list();
template<typename Pred>
node_pointer
prune(Pred);
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
void
assert_node_consistent(node_const_pointer, bool, const char*, int) const;
static size_type
size_under_node(node_const_pointer);
static size_type
degree(node_const_pointer);
#endif
#ifdef PB_DS_LC_NS_HEAP_TRACE_
static void
trace_node(node_const_pointer, size_type);
#endif
private:
#ifdef _GLIBCXX_DEBUG
void
assert_iterators(const char*, int) const;
void
assert_size(const char*, int) const;
static size_type
size_from_node(node_const_pointer);
#endif
node_pointer
recursive_copy_node(node_const_pointer);
inline node_pointer
get_new_node_for_insert(const_reference, false_type);
inline node_pointer
get_new_node_for_insert(const_reference, true_type);
#ifdef PB_DS_LC_NS_HEAP_TRACE_
template<typename Metadata_>
static void
trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
static void
trace_node_metadata(node_const_pointer, type_to_type<null_type>);
#endif
static node_allocator s_node_allocator;
static no_throw_copies_t s_no_throw_copies_ind;
protected:
node_pointer m_p_root;
size_type m_size;
};
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp>
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/node.hpp
* Contains an implementation struct for this type of heap's node.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
namespace __gnu_pbds
{
namespace detail
{
/// Node.
template<typename _Value, typename _Metadata, typename _Alloc>
struct left_child_next_sibling_heap_node_
{
private:
typedef left_child_next_sibling_heap_node_<_Value, _Metadata, _Alloc> this_type;
public:
typedef _Value value_type;
typedef typename _Alloc::size_type size_type;
typedef _Metadata metadata_type;
typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer;
value_type m_value;
metadata_type m_metadata;
node_pointer m_p_l_child;
node_pointer m_p_next_sibling;
node_pointer m_p_prev_or_parent;
};
template<typename _Value, typename _Alloc>
struct left_child_next_sibling_heap_node_<_Value, null_type, _Alloc>
{
private:
typedef left_child_next_sibling_heap_node_<_Value, null_type, _Alloc> this_type;
public:
typedef _Value value_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer;
value_type m_value;
node_pointer m_p_l_child;
node_pointer m_p_next_sibling;
node_pointer m_p_prev_or_parent;
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file left_child_next_sibling_heap_/info_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{
return (m_size == 0);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{
return (m_size);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{
return (s_node_allocator.max_size());
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file eq_by_less.hpp
* Contains an equivalence function.
*/
#ifndef PB_DS_EQ_BY_LESS_HPP
#define PB_DS_EQ_BY_LESS_HPP
#include <utility>
#include <functional>
#include <vector>
#include <assert.h>
#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Equivalence function.
template<typename Key, class Cmp_Fn>
struct eq_by_less : private Cmp_Fn
{
bool
operator()(const Key& r_lhs, const Key& r_rhs) const
{
const bool l = Cmp_Fn::operator()(r_lhs, r_rhs);
const bool g = Cmp_Fn::operator()(r_rhs, r_lhs);
return !(l || g);
}
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_EQ_BY_LESS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file hash_eq_fn.hpp
* Contains 2 eqivalence functions, one employing a hash value,
* and one ignoring it.
*/
#ifndef PB_DS_HASH_EQ_FN_HPP
#define PB_DS_HASH_EQ_FN_HPP
#include <utility>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
/// Primary template.
template<typename Key, typename Eq_Fn, typename _Alloc, bool Store_Hash>
struct hash_eq_fn;
/// Specialization 1 - The client requests that hash values not be stored.
template<typename Key, typename Eq_Fn, typename _Alloc>
struct hash_eq_fn<Key, Eq_Fn, _Alloc, false> : public Eq_Fn
{
typedef Eq_Fn eq_fn_base;
typedef typename _Alloc::template rebind<Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
hash_eq_fn() { }
hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
bool
operator()(key_const_reference r_lhs_key,
key_const_reference r_rhs_key) const
{ return eq_fn_base::operator()(r_lhs_key, r_rhs_key); }
void
swap(const hash_eq_fn& other)
{ std::swap((Eq_Fn&)(*this), (Eq_Fn&)other); }
};
/// Specialization 2 - The client requests that hash values be stored.
template<typename Key, class Eq_Fn, class _Alloc>
struct hash_eq_fn<Key, Eq_Fn, _Alloc, true> : public Eq_Fn
{
typedef typename _Alloc::size_type size_type;
typedef Eq_Fn eq_fn_base;
typedef typename _Alloc::template rebind<Key>::other key_allocator;
typedef typename key_allocator::const_reference key_const_reference;
hash_eq_fn() { }
hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
bool
operator()(key_const_reference r_lhs_key, size_type lhs_hash,
key_const_reference r_rhs_key, size_type rhs_hash) const
{
_GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
|| lhs_hash == rhs_hash);
return (lhs_hash == rhs_hash &&
eq_fn_base::operator()(r_lhs_key, r_rhs_key));
}
void
swap(const hash_eq_fn& other)
{ std::swap((Eq_Fn&)(*this), (Eq_Fn&)(other)); }
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/rotate_fn_imps.hpp
* Contains imps for rotating nodes.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rotate_left(node_pointer p_x)
{
node_pointer p_y = p_x->m_p_right;
p_x->m_p_right = p_y->m_p_left;
if (p_y->m_p_left != 0)
p_y->m_p_left->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
if (p_x == m_p_head->m_p_parent)
m_p_head->m_p_parent = p_y;
else if (p_x == p_x->m_p_parent->m_p_left)
p_x->m_p_parent->m_p_left = p_y;
else
p_x->m_p_parent->m_p_right = p_y;
p_y->m_p_left = p_x;
p_x->m_p_parent = p_y;
PB_DS_ASSERT_NODE_CONSISTENT(p_x)
PB_DS_ASSERT_NODE_CONSISTENT(p_y)
apply_update(p_x, (node_update* )this);
apply_update(p_x->m_p_parent, (node_update* )this);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rotate_right(node_pointer p_x)
{
node_pointer p_y = p_x->m_p_left;
p_x->m_p_left = p_y->m_p_right;
if (p_y->m_p_right != 0)
p_y->m_p_right->m_p_parent = p_x;
p_y->m_p_parent = p_x->m_p_parent;
if (p_x == m_p_head->m_p_parent)
m_p_head->m_p_parent = p_y;
else if (p_x == p_x->m_p_parent->m_p_right)
p_x->m_p_parent->m_p_right = p_y;
else
p_x->m_p_parent->m_p_left = p_y;
p_y->m_p_right = p_x;
p_x->m_p_parent = p_y;
PB_DS_ASSERT_NODE_CONSISTENT(p_x)
PB_DS_ASSERT_NODE_CONSISTENT(p_y)
apply_update(p_x, (node_update* )this);
apply_update(p_x->m_p_parent, (node_update* )this);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rotate_parent(node_pointer p_nd)
{
node_pointer p_parent = p_nd->m_p_parent;
if (p_nd == p_parent->m_p_left)
rotate_right(p_parent);
else
rotate_left(p_parent);
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent ||
p_nd->m_p_right == p_parent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)
{ }
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
{
node_update::operator()(node_iterator(p_nd),
node_const_iterator(static_cast<node_pointer>(0)));
}
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
update_to_top(node_pointer p_nd, Node_Update_* p_update)
{
while (p_nd != m_p_head)
{
apply_update(p_nd, p_update);
p_nd = p_nd->m_p_parent;
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update_to_top(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/erase_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
actual_erase_node(node_pointer p_z)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value));)
p_z->~node();
s_node_allocator.deallocate(p_z, 1);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update_min_max_for_erased_node(node_pointer p_z)
{
if (m_size == 1)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
return;
}
if (m_p_head->m_p_left == p_z)
{
iterator it(p_z);
++it;
m_p_head->m_p_left = it.m_p_nd;
}
else if (m_p_head->m_p_right == p_z)
{
iterator it(p_z);
--it;
m_p_head->m_p_right = it.m_p_nd;
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
clear_imp(m_p_head->m_p_parent);
m_size = 0;
initialize();
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
if (p_nd == 0)
return;
clear_imp(p_nd->m_p_left);
clear_imp(p_nd->m_p_right);
p_nd->~node();
s_node_allocator.deallocate(p_nd, 1);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/debug_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
structure_only_assert_valid(__file, __line);
assert_consistent_with_debug_base(__file, __line);
assert_size(__file, __line);
assert_iterators(__file, __line);
if (m_p_head->m_p_parent == 0)
{
PB_DS_DEBUG_VERIFY(m_size == 0);
}
else
{
PB_DS_DEBUG_VERIFY(m_size > 0);
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
structure_only_assert_valid(const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(m_p_head != 0);
if (m_p_head->m_p_parent == 0)
{
PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head);
PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head);
}
else
{
PB_DS_DEBUG_VERIFY(m_p_head->m_p_parent->m_p_parent == m_p_head);
PB_DS_DEBUG_VERIFY(m_p_head->m_p_left != m_p_head);
PB_DS_DEBUG_VERIFY(m_p_head->m_p_right != m_p_head);
}
if (m_p_head->m_p_parent != 0)
assert_node_consistent(m_p_head->m_p_parent, __file, __line);
assert_min(__file, __line);
assert_max(__file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_node_consistent(const node_pointer p_nd,
const char* __file, int __line) const
{
assert_node_consistent_(p_nd, __file, __line);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_consistent_t
PB_DS_CLASS_C_DEC::
assert_node_consistent_(const node_pointer p_nd,
const char* __file, int __line) const
{
if (p_nd == 0)
return (std::make_pair((const_pointer)0,(const_pointer)0));
assert_node_consistent_with_left(p_nd, __file, __line);
assert_node_consistent_with_right(p_nd, __file, __line);
const std::pair<const_pointer, const_pointer>
l_range = assert_node_consistent_(p_nd->m_p_left, __file, __line);
if (l_range.second != 0)
PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*l_range.second),
PB_DS_V2F(p_nd->m_value)));
const std::pair<const_pointer, const_pointer>
r_range = assert_node_consistent_(p_nd->m_p_right, __file, __line);
if (r_range.first != 0)
PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(*r_range.first)));
return std::make_pair((l_range.first != 0) ? l_range.first : &p_nd->m_value,
(r_range.second != 0)? r_range.second : &p_nd->m_value);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_node_consistent_with_left(const node_pointer p_nd,
const char* __file, int __line) const
{
if (p_nd->m_p_left == 0)
return;
PB_DS_DEBUG_VERIFY(p_nd->m_p_left->m_p_parent == p_nd);
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(p_nd->m_p_left->m_value)));
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_node_consistent_with_right(const node_pointer p_nd,
const char* __file, int __line) const
{
if (p_nd->m_p_right == 0)
return;
PB_DS_DEBUG_VERIFY(p_nd->m_p_right->m_p_parent == p_nd);
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value),
PB_DS_V2F(p_nd->m_value)));
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_min(const char* __file, int __line) const
{
assert_min_imp(m_p_head->m_p_parent, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_min_imp(const node_pointer p_nd, const char* __file, int __line) const
{
if (p_nd == 0)
{
PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head);
return;
}
if (p_nd->m_p_left == 0)
{
PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_left);
return;
}
assert_min_imp(p_nd->m_p_left, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_max(const char* __file, int __line) const
{
assert_max_imp(m_p_head->m_p_parent, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_max_imp(const node_pointer p_nd,
const char* __file, int __line) const
{
if (p_nd == 0)
{
PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head);
return;
}
if (p_nd->m_p_right == 0)
{
PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_right);
return;
}
assert_max_imp(p_nd->m_p_right, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_iterators(const char* __file, int __line) const
{
size_type iterated_num = 0;
const_iterator prev_it = end();
for (const_iterator it = begin(); it != end(); ++it)
{
++iterated_num;
PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)).m_p_nd == it.m_p_nd);
const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
--upper_bound_it;
PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == it.m_p_nd);
if (prev_it != end())
PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),
PB_DS_V2F(*it)));
prev_it = it;
}
PB_DS_DEBUG_VERIFY(iterated_num == m_size);
size_type reverse_iterated_num = 0;
const_reverse_iterator reverse_prev_it = rend();
for (const_reverse_iterator reverse_it = rbegin(); reverse_it != rend();
++reverse_it)
{
++reverse_iterated_num;
PB_DS_DEBUG_VERIFY(lower_bound(
PB_DS_V2F(*reverse_it)).m_p_nd == reverse_it.m_p_nd);
const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*reverse_it));
--upper_bound_it;
PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == reverse_it.m_p_nd);
if (reverse_prev_it != rend())
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(*reverse_prev_it),
PB_DS_V2F(*reverse_it)));
reverse_prev_it = reverse_it;
}
PB_DS_DEBUG_VERIFY(reverse_iterated_num == m_size);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_consistent_with_debug_base(const char* __file, int __line) const
{
debug_base::check_size(m_size, __file, __line);
assert_consistent_with_debug_base(m_p_head->m_p_parent, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_consistent_with_debug_base(const node_pointer p_nd,
const char* __file, int __line) const
{
if (p_nd == 0)
return;
debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value), __file, __line);
assert_consistent_with_debug_base(p_nd->m_p_left, __file, __line);
assert_consistent_with_debug_base(p_nd->m_p_right, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_size(const char* __file, int __line) const
{ PB_DS_DEBUG_VERIFY(recursive_count(m_p_head->m_p_parent) == m_size); }
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/r_erase_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
actual_erase_node(node_pointer p_z)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
_GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value));)
p_z->~node();
s_node_allocator.deallocate(p_z, 1);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update_min_max_for_erased_node(node_pointer p_z)
{
if (m_size == 1)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
return;
}
if (m_p_head->m_p_left == p_z)
{
iterator it(p_z);
++it;
m_p_head->m_p_left = it.m_p_nd;
}
else if (m_p_head->m_p_right == p_z)
{
iterator it(p_z);
--it;
m_p_head->m_p_right = it.m_p_nd;
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
clear_imp(m_p_head->m_p_parent);
m_size = 0;
initialize();
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
if (p_nd == 0)
return;
clear_imp(p_nd->m_p_left);
clear_imp(p_nd->m_p_right);
p_nd->~Node();
s_node_allocator.deallocate(p_nd, 1);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/insert_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_leaf(const_reference r_value)
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
if (m_size == 0)
return std::make_pair(insert_imp_empty(r_value),
true);
node_pointer p_nd = m_p_head->m_p_parent;
node_pointer p_pot = m_p_head;
while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(r_value)))
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
if (p_pot == m_p_head)
return std::make_pair(insert_leaf_new(r_value, m_p_head->m_p_right, false),
true);
if (!Cmp_Fn::operator()(PB_DS_V2F(r_value),
PB_DS_V2F(p_pot->m_value)))
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_value))
return std::make_pair(p_pot, false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))
p_nd = p_pot->m_p_left;
if (p_nd == 0)
return std::make_pair(insert_leaf_new(r_value, p_pot, true),
true);
while (p_nd->m_p_right != 0)
p_nd = p_nd->m_p_right;
return std::make_pair(insert_leaf_new(r_value, p_nd, false),
true);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
{
node_pointer p_new_nd =
get_new_node_for_leaf_insert(r_value,
traits_base::m_no_throw_copies_indicator);
if (left_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == 0);
_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(r_value),
PB_DS_V2F(p_nd->m_value)));
p_nd->m_p_left = p_new_nd;
if (m_p_head->m_p_left == p_nd)
m_p_head->m_p_left = p_new_nd;
}
else
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == 0);
_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
PB_DS_V2F(r_value)));
p_nd->m_p_right = p_new_nd;
if (m_p_head->m_p_right == p_nd)
m_p_head->m_p_right = p_new_nd;
}
p_new_nd->m_p_parent = p_nd;
p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
PB_DS_ASSERT_NODE_CONSISTENT(p_nd)
update_to_top(p_new_nd, (node_update* )this);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)
return iterator(p_new_nd);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
insert_imp_empty(const_reference r_value)
{
node_pointer p_new_node =
get_new_node_for_leaf_insert(r_value, traits_base::m_no_throw_copies_indicator);
m_p_head->m_p_left = m_p_head->m_p_right =
m_p_head->m_p_parent = p_new_node;
p_new_node->m_p_parent = m_p_head;
p_new_node->m_p_left = p_new_node->m_p_right = 0;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)
update_to_top(m_p_head->m_p_parent, (node_update*)this);
return iterator(p_new_node);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_new_node_for_leaf_insert(const_reference r_val, false_type)
{
node_pointer p_new_nd = s_node_allocator.allocate(1);
cond_dealtor_t cond(p_new_nd);
new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value)))
typename node::value_type(r_val);
cond.set_no_action();
p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
++m_size;
return p_new_nd;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
get_new_node_for_leaf_insert(const_reference r_val, true_type)
{
node_pointer p_new_nd = s_node_allocator.allocate(1);
new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value)))
typename node::value_type(r_val);
p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
++m_size;
return p_new_nd;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/point_iterators.hpp
* Contains an implementation class for bin_search_tree_.
*/
#ifndef PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP
#define PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP
#include <ext/pb_ds/tag_and_trait.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_TREE_CONST_IT_C_DEC \
bin_search_tree_const_it_< \
Node_Pointer, \
Value_Type, \
Pointer, \
Const_Pointer, \
Reference, \
Const_Reference, \
Is_Forward_Iterator, \
_Alloc>
#define PB_DS_TREE_CONST_ODIR_IT_C_DEC \
bin_search_tree_const_it_< \
Node_Pointer, \
Value_Type, \
Pointer, \
Const_Pointer, \
Reference, \
Const_Reference, \
!Is_Forward_Iterator, \
_Alloc>
#define PB_DS_TREE_IT_C_DEC \
bin_search_tree_it_< \
Node_Pointer, \
Value_Type, \
Pointer, \
Const_Pointer, \
Reference, \
Const_Reference, \
Is_Forward_Iterator, \
_Alloc>
#define PB_DS_TREE_ODIR_IT_C_DEC \
bin_search_tree_it_< \
Node_Pointer, \
Value_Type, \
Pointer, \
Const_Pointer, \
Reference, \
Const_Reference, \
!Is_Forward_Iterator, \
_Alloc>
/// Const iterator.
template<typename Node_Pointer,
typename Value_Type,
typename Pointer,
typename Const_Pointer,
typename Reference,
typename Const_Reference,
bool Is_Forward_Iterator,
typename _Alloc>
class bin_search_tree_const_it_
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef typename _Alloc::difference_type difference_type;
typedef Value_Type value_type;
typedef Pointer pointer;
typedef Const_Pointer const_pointer;
typedef Reference reference;
typedef Const_Reference const_reference;
inline
bin_search_tree_const_it_(const Node_Pointer p_nd = 0)
: m_p_nd(const_cast<Node_Pointer>(p_nd))
{ }
inline
bin_search_tree_const_it_(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)
: m_p_nd(other.m_p_nd)
{ }
inline
PB_DS_TREE_CONST_IT_C_DEC&
operator=(const PB_DS_TREE_CONST_IT_C_DEC& other)
{
m_p_nd = other.m_p_nd;
return *this;
}
inline
PB_DS_TREE_CONST_IT_C_DEC&
operator=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)
{
m_p_nd = other.m_p_nd;
return *this;
}
inline const_pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return &m_p_nd->m_value;
}
inline const_reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
return m_p_nd->m_value;
}
inline bool
operator==(const PB_DS_TREE_CONST_IT_C_DEC & other) const
{ return m_p_nd == other.m_p_nd; }
inline bool
operator==(const PB_DS_TREE_CONST_ODIR_IT_C_DEC & other) const
{ return m_p_nd == other.m_p_nd; }
inline bool
operator!=(const PB_DS_TREE_CONST_IT_C_DEC& other) const
{ return m_p_nd != other.m_p_nd; }
inline bool
operator!=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) const
{ return m_p_nd != other.m_p_nd; }
inline PB_DS_TREE_CONST_IT_C_DEC&
operator++()
{
_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
inc(integral_constant<int,Is_Forward_Iterator>());
return *this;
}
inline PB_DS_TREE_CONST_IT_C_DEC
operator++(int)
{
PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);
operator++();
return ret_it;
}
inline PB_DS_TREE_CONST_IT_C_DEC&
operator--()
{
dec(integral_constant<int,Is_Forward_Iterator>());
return *this;
}
inline PB_DS_TREE_CONST_IT_C_DEC
operator--(int)
{
PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);
operator--();
return ret_it;
}
protected:
inline void
inc(false_type)
{ dec(true_type()); }
void
inc(true_type)
{
if (m_p_nd->special()&&
m_p_nd->m_p_parent->m_p_parent == m_p_nd)
{
m_p_nd = m_p_nd->m_p_left;
return;
}
if (m_p_nd->m_p_right != 0)
{
m_p_nd = m_p_nd->m_p_right;
while (m_p_nd->m_p_left != 0)
m_p_nd = m_p_nd->m_p_left;
return;
}
Node_Pointer p_y = m_p_nd->m_p_parent;
while (m_p_nd == p_y->m_p_right)
{
m_p_nd = p_y;
p_y = p_y->m_p_parent;
}
if (m_p_nd->m_p_right != p_y)
m_p_nd = p_y;
}
inline void
dec(false_type)
{ inc(true_type()); }
void
dec(true_type)
{
if (m_p_nd->special() && m_p_nd->m_p_parent->m_p_parent == m_p_nd)
{
m_p_nd = m_p_nd->m_p_right;
return;
}
if (m_p_nd->m_p_left != 0)
{
Node_Pointer p_y = m_p_nd->m_p_left;
while (p_y->m_p_right != 0)
p_y = p_y->m_p_right;
m_p_nd = p_y;
return;
}
Node_Pointer p_y = m_p_nd->m_p_parent;
while (m_p_nd == p_y->m_p_left)
{
m_p_nd = p_y;
p_y = p_y->m_p_parent;
}
if (m_p_nd->m_p_left != p_y)
m_p_nd = p_y;
}
public:
Node_Pointer m_p_nd;
};
/// Iterator.
template<typename Node_Pointer,
typename Value_Type,
typename Pointer,
typename Const_Pointer,
typename Reference,
typename Const_Reference,
bool Is_Forward_Iterator,
typename _Alloc>
class bin_search_tree_it_ : public PB_DS_TREE_CONST_IT_C_DEC
{
public:
inline
bin_search_tree_it_(const Node_Pointer p_nd = 0)
: PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)
{ }
inline
bin_search_tree_it_(const PB_DS_TREE_ODIR_IT_C_DEC& other)
: PB_DS_TREE_CONST_IT_C_DEC(other.m_p_nd)
{ }
inline
PB_DS_TREE_IT_C_DEC&
operator=(const PB_DS_TREE_IT_C_DEC& other)
{
base_it_type::m_p_nd = other.m_p_nd;
return *this;
}
inline
PB_DS_TREE_IT_C_DEC&
operator=(const PB_DS_TREE_ODIR_IT_C_DEC& other)
{
base_it_type::m_p_nd = other.m_p_nd;
return *this;
}
inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer
operator->() const
{
_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);
return &base_it_type::m_p_nd->m_value;
}
inline typename PB_DS_TREE_CONST_IT_C_DEC::reference
operator*() const
{
_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);
return base_it_type::m_p_nd->m_value;
}
inline PB_DS_TREE_IT_C_DEC&
operator++()
{
PB_DS_TREE_CONST_IT_C_DEC:: operator++();
return *this;
}
inline PB_DS_TREE_IT_C_DEC
operator++(int)
{
PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);
operator++();
return ret_it;
}
inline PB_DS_TREE_IT_C_DEC&
operator--()
{
PB_DS_TREE_CONST_IT_C_DEC:: operator--();
return *this;
}
inline PB_DS_TREE_IT_C_DEC
operator--(int)
{
PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);
operator--();
return ret_it;
}
protected:
typedef PB_DS_TREE_CONST_IT_C_DEC base_it_type;
};
#undef PB_DS_TREE_CONST_IT_C_DEC
#undef PB_DS_TREE_CONST_ODIR_IT_C_DEC
#undef PB_DS_TREE_IT_C_DEC
#undef PB_DS_TREE_ODIR_IT_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/split_join_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
join_prep(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (other.m_size == 0)
return false;
if (m_size == 0)
{
value_swap(other);
return false;
}
const bool greater =
Cmp_Fn::operator()(PB_DS_V2F(m_p_head->m_p_right->m_value),
PB_DS_V2F(other.m_p_head->m_p_left->m_value));
const bool lesser =
Cmp_Fn::operator()(PB_DS_V2F(other.m_p_head->m_p_right->m_value),
PB_DS_V2F(m_p_head->m_p_left->m_value));
if (!greater && !lesser)
__throw_join_error();
if (lesser)
value_swap(other);
m_size += other.m_size;
_GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
return true;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
join_finish(PB_DS_CLASS_C_DEC& other)
{
initialize_min_max();
other.initialize();
}
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
other.clear();
if (m_size == 0)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return false;
}
if (Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_left->m_value)))
{
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return false;
}
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_right->m_value)))
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return false;
}
if (m_size == 1)
{
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return false;
}
_GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
return true;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split_finish(PB_DS_CLASS_C_DEC& other)
{
other.initialize_min_max();
other.m_size = std::distance(other.begin(), other.end());
m_size -= other.m_size;
initialize_min_max();
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
recursive_count(node_pointer p) const
{
if (p == 0)
return 0;
return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/policy_access_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn()
{ return (*this); }
PB_DS_CLASS_T_DEC
const Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn() const
{ return (*this); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_allocator
PB_DS_CLASS_C_DEC::s_node_allocator;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_BIN_TREE_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)
{
initialize();
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0)
{
initialize();
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
Cmp_Fn(r_cmp_fn),
node_update(r_node_update),
m_p_head(s_node_allocator.allocate(1)),
m_size(0)
{
initialize();
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(other),
#endif
#ifdef PB_DS_TREE_TRACE
PB_DS_TREE_TRACE_BASE_C_DEC(other),
#endif
Cmp_Fn(other),
node_update(other),
m_p_head(s_node_allocator.allocate(1)),
m_size(0)
{
initialize();
m_size = other.m_size;
PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
__try
{
m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
if (m_p_head->m_p_parent != 0)
m_p_head->m_p_parent->m_p_parent = m_p_head;
m_size = other.m_size;
initialize_min_max();
}
__catch(...)
{
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
s_node_allocator.deallocate(m_p_head, 1);
__throw_exception_again;
}
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
value_swap(other);
std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_p_head, other.m_p_head);
std::swap(m_size, other.m_size);
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~PB_DS_BIN_TREE_NAME()
{
clear();
s_node_allocator.deallocate(m_p_head, 1);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{
m_p_head->m_p_parent = 0;
m_p_head->m_p_left = m_p_head;
m_p_head->m_p_right = m_p_head;
m_size = 0;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
recursive_copy_node(const node_pointer p_nd)
{
if (p_nd == 0)
return (0);
node_pointer p_ret = s_node_allocator.allocate(1);
__try
{
new (p_ret) node(*p_nd);
}
__catch(...)
{
s_node_allocator.deallocate(p_ret, 1);
__throw_exception_again;
}
p_ret->m_p_left = p_ret->m_p_right = 0;
__try
{
p_ret->m_p_left = recursive_copy_node(p_nd->m_p_left);
p_ret->m_p_right = recursive_copy_node(p_nd->m_p_right);
}
__catch(...)
{
clear_imp(p_ret);
__throw_exception_again;
}
if (p_ret->m_p_left != 0)
p_ret->m_p_left->m_p_parent = p_ret;
if (p_ret->m_p_right != 0)
p_ret->m_p_right->m_p_parent = p_ret;
PB_DS_ASSERT_NODE_CONSISTENT(p_ret)
return p_ret;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize_min_max()
{
if (m_p_head->m_p_parent == 0)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
return;
}
{
node_pointer p_min = m_p_head->m_p_parent;
while (p_min->m_p_left != 0)
p_min = p_min->m_p_left;
m_p_head->m_p_left = p_min;
}
{
node_pointer p_max = m_p_head->m_p_parent;
while (p_max->m_p_right != 0)
p_max = p_max->m_p_right;
m_p_head->m_p_right = p_max;
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/node_iterators.hpp
* Contains an implementation class for bin_search_tree_.
*/
#ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
#define PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
#include <ext/pb_ds/tag_and_trait.hpp>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \
bin_search_tree_const_node_it_<Node, Const_Iterator, Iterator, _Alloc>
/// Const node iterator.
template<typename Node,
class Const_Iterator,
class Iterator,
typename _Alloc>
class bin_search_tree_const_node_it_
{
private:
typedef
typename _Alloc::template rebind<
Node>::other::pointer
node_pointer;
public:
/// Category.
typedef trivial_iterator_tag iterator_category;
/// Difference type.
typedef trivial_iterator_difference_type difference_type;
/// Iterator's value type.
typedef Const_Iterator value_type;
/// Iterator's reference type.
typedef Const_Iterator reference;
/// Iterator's __const reference type.
typedef Const_Iterator const_reference;
/// Metadata type.
typedef typename Node::metadata_type metadata_type;
/// Const metadata reference type.
typedef
typename _Alloc::template rebind<metadata_type>::other::const_reference
metadata_const_reference;
bin_search_tree_const_node_it_(const node_pointer p_nd = 0)
: m_p_nd(const_cast<node_pointer>(p_nd))
{ }
/// Access.
const_reference
operator*() const
{ return Const_Iterator(m_p_nd); }
/// Metadata access.
metadata_const_reference
get_metadata() const
{ return m_p_nd->get_metadata(); }
/// Returns the __const node iterator associated with the left node.
PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
get_l_child() const
{ return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left); }
/// Returns the __const node iterator associated with the right node.
PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
get_r_child() const
{ return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right); }
/// Compares to a different iterator object.
bool
operator==(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const
{ return m_p_nd == other.m_p_nd; }
/// Compares (negatively) to a different iterator object.
bool
operator!=(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const
{ return m_p_nd != other.m_p_nd; }
node_pointer m_p_nd;
};
#define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC \
bin_search_tree_node_it_<Node, Const_Iterator, Iterator, _Alloc>
/// Node iterator.
template<typename Node,
class Const_Iterator,
class Iterator,
typename _Alloc>
class bin_search_tree_node_it_
: public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
{
private:
typedef
typename _Alloc::template rebind<
Node>::other::pointer
node_pointer;
public:
/// Iterator's value type.
typedef Iterator value_type;
/// Iterator's reference type.
typedef Iterator reference;
/// Iterator's __const reference type.
typedef Iterator const_reference;
inline
bin_search_tree_node_it_(const node_pointer p_nd = 0)
: PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast<node_pointer>(p_nd))
{ }
/// Access.
Iterator
operator*() const
{ return Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd); }
/// Returns the node iterator associated with the left node.
PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
get_l_child() const
{
return PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left);
}
/// Returns the node iterator associated with the right node.
PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
get_r_child() const
{
return PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right);
}
};
#undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
#undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/bin_search_tree_.hpp
* Contains an implementation class for binary search tree.
*/
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/tree_trace_base.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#include <utility>
#include <functional>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_BIN_TREE_NAME bin_search_tree_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_BIN_TREE_NAME bin_search_tree_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Cmp_Fn, \
typename Node_And_It_Traits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
PB_DS_BIN_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
#define PB_DS_BIN_TREE_TRAITS_BASE \
types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
#ifdef PB_DS_TREE_TRACE
#define PB_DS_TREE_TRACE_BASE_C_DEC \
tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \
typename Node_And_It_Traits::node_iterator, \
Cmp_Fn, true, _Alloc>
#endif
/*
* @brief Binary search tree (BST).
*
* This implementation uses an idea from the SGI STL (using a @a
* header node which is needed for efficient iteration).
*/
template<typename Key, typename Mapped, typename Cmp_Fn,
typename Node_And_It_Traits, typename _Alloc>
class PB_DS_BIN_TREE_NAME :
#ifdef _GLIBCXX_DEBUG
public PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
#ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC,
#endif
public Cmp_Fn,
public PB_DS_BIN_TREE_TRAITS_BASE,
public Node_And_It_Traits::node_update
{
typedef Node_And_It_Traits traits_type;
protected:
typedef PB_DS_BIN_TREE_TRAITS_BASE traits_base;
typedef
typename _Alloc::template rebind<typename traits_type::node>::other
node_allocator;
typedef typename node_allocator::value_type node;
typedef typename node_allocator::pointer node_pointer;
typedef typename traits_type::null_node_update_pointer
null_node_update_pointer;
private:
typedef cond_dealtor<node, _Alloc> cond_dealtor_t;
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif
public:
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
typedef typename traits_base::key_const_reference key_const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
typedef typename traits_base::mapped_const_reference mapped_const_reference;
#endif
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
typedef typename traits_base::reference reference;
typedef typename traits_base::const_reference const_reference;
typedef typename traits_type::point_const_iterator point_const_iterator;
typedef point_const_iterator const_iterator;
typedef typename traits_type::point_iterator point_iterator;
typedef point_iterator iterator;
typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
typedef typename traits_type::reverse_iterator reverse_iterator;
typedef typename traits_type::node_const_iterator node_const_iterator;
typedef typename traits_type::node_iterator node_iterator;
typedef typename traits_type::node_update node_update;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
PB_DS_BIN_TREE_NAME();
PB_DS_BIN_TREE_NAME(const Cmp_Fn&);
PB_DS_BIN_TREE_NAME(const Cmp_Fn&, const node_update&);
PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
~PB_DS_BIN_TREE_NAME();
inline bool
empty() const;
inline size_type
size() const;
inline size_type
max_size() const;
Cmp_Fn&
get_cmp_fn();
const Cmp_Fn&
get_cmp_fn() const;
inline point_iterator
lower_bound(key_const_reference);
inline point_const_iterator
lower_bound(key_const_reference) const;
inline point_iterator
upper_bound(key_const_reference);
inline point_const_iterator
upper_bound(key_const_reference) const;
inline point_iterator
find(key_const_reference);
inline point_const_iterator
find(key_const_reference) const;
inline iterator
begin();
inline const_iterator
begin() const;
inline iterator
end();
inline const_iterator
end() const;
inline reverse_iterator
rbegin();
inline const_reverse_iterator
rbegin() const;
inline reverse_iterator
rend();
inline const_reverse_iterator
rend() const;
/// Returns a const node_iterator corresponding to the node at the
/// root of the tree.
inline node_const_iterator
node_begin() const;
/// Returns a node_iterator corresponding to the node at the
/// root of the tree.
inline node_iterator
node_begin();
/// Returns a const node_iterator corresponding to a node just
/// after a leaf of the tree.
inline node_const_iterator
node_end() const;
/// Returns a node_iterator corresponding to a node just
/// after a leaf of the tree.
inline node_iterator
node_end();
void
clear();
protected:
void
value_swap(PB_DS_CLASS_C_DEC&);
void
initialize_min_max();
inline iterator
insert_imp_empty(const_reference);
inline iterator
insert_leaf_new(const_reference, node_pointer, bool);
inline node_pointer
get_new_node_for_leaf_insert(const_reference, false_type);
inline node_pointer
get_new_node_for_leaf_insert(const_reference, true_type);
inline void
actual_erase_node(node_pointer);
inline std::pair<node_pointer, bool>
erase(node_pointer);
inline void
update_min_max_for_erased_node(node_pointer);
static void
clear_imp(node_pointer);
inline std::pair<point_iterator, bool>
insert_leaf(const_reference);
inline void
rotate_left(node_pointer);
inline void
rotate_right(node_pointer);
inline void
rotate_parent(node_pointer);
inline void
apply_update(node_pointer, null_node_update_pointer);
template<typename Node_Update_>
inline void
apply_update(node_pointer, Node_Update_*);
inline void
update_to_top(node_pointer, null_node_update_pointer);
template<typename Node_Update_>
inline void
update_to_top(node_pointer, Node_Update_*);
bool
join_prep(PB_DS_CLASS_C_DEC&);
void
join_finish(PB_DS_CLASS_C_DEC&);
bool
split_prep(key_const_reference, PB_DS_CLASS_C_DEC&);
void
split_finish(PB_DS_CLASS_C_DEC&);
size_type
recursive_count(node_pointer) const;
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
void
structure_only_assert_valid(const char*, int) const;
void
assert_node_consistent(const node_pointer, const char*, int) const;
#endif
private:
#ifdef _GLIBCXX_DEBUG
void
assert_iterators(const char*, int) const;
void
assert_consistent_with_debug_base(const char*, int) const;
void
assert_node_consistent_with_left(const node_pointer,
const char*, int) const;
void
assert_node_consistent_with_right(const node_pointer,
const char*, int) const;
void
assert_consistent_with_debug_base(const node_pointer,
const char*, int) const;
void
assert_min(const char*, int) const;
void
assert_min_imp(const node_pointer, const char*, int) const;
void
assert_max(const char*, int) const;
void
assert_max_imp(const node_pointer, const char*, int) const;
void
assert_size(const char*, int) const;
typedef std::pair<const_pointer, const_pointer> node_consistent_t;
node_consistent_t
assert_node_consistent_(const node_pointer, const char*, int) const;
#endif
void
initialize();
node_pointer
recursive_copy_node(const node_pointer);
protected:
node_pointer m_p_head;
size_type m_size;
static node_allocator s_node_allocator;
};
#define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);)
#define PB_DS_ASSERT_NODE_CONSISTENT(_Node) \
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, __FILE__, __LINE__);)
#include <ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>
#undef PB_DS_ASSERT_NODE_CONSISTENT
#undef PB_DS_STRUCT_ONLY_ASSERT_VALID
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_BIN_TREE_NAME
#undef PB_DS_BIN_TREE_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
#ifdef PB_DS_TREE_TRACE
#undef PB_DS_TREE_TRACE_BASE_C_DEC
#endif
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/iterators_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
return (iterator(m_p_head->m_p_left));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
return (const_iterator(m_p_head->m_p_left));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{
return (iterator(m_p_head));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
return (const_iterator(m_p_head));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
PB_DS_CLASS_C_DEC::
rbegin() const
{
return (const_reverse_iterator(m_p_head->m_p_right));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
rbegin()
{
return (reverse_iterator(m_p_head->m_p_right));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
rend()
{
return (reverse_iterator(m_p_head));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
PB_DS_CLASS_C_DEC::
rend() const
{
return (const_reverse_iterator(m_p_head));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_begin() const
{
return (node_const_iterator(m_p_head->m_p_parent));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_begin()
{
return (node_iterator(m_p_head->m_p_parent));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_end() const
{
return (node_const_iterator(0));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_end()
{
return (node_iterator(0));
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/find_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
lower_bound(key_const_reference r_key) const
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
p_nd = p_nd->m_p_right;
else
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
return iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
lower_bound(key_const_reference r_key)
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
p_nd = p_nd->m_p_right;
else
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
return iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
upper_bound(key_const_reference r_key) const
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
return const_iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
upper_bound(key_const_reference r_key)
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
return point_iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key)
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
node_pointer ret = p_pot;
if (p_pot != m_p_head)
{
const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value));
if (__cmp)
ret = m_p_head;
}
return point_iterator(ret);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key) const
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
node_pointer ret = p_pot;
if (p_pot != m_p_head)
{
const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value));
if (__cmp)
ret = m_p_head;
}
return point_const_iterator(ret);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/traits.hpp
* Contains an implementation for bin_search_tree_.
*/
#ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
#define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
#include <ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp>
#include <ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Binary search tree traits, primary template
/// @ingroup traits
template<typename Key,
typename Mapped,
class Cmp_Fn,
template<typename Node_CItr,
class Node_Itr,
class _Cmp_Fn,
typename _Alloc>
class Node_Update,
class Node,
typename _Alloc>
struct bin_search_tree_traits
{
private:
typedef types_traits<Key, Mapped, _Alloc, false> type_traits;
public:
typedef Node node;
typedef
bin_search_tree_const_it_<
typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
typename type_traits::const_pointer,
typename type_traits::reference,
typename type_traits::const_reference,
true,
_Alloc>
point_const_iterator;
typedef
bin_search_tree_it_<
typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
typename type_traits::const_pointer,
typename type_traits::reference,
typename type_traits::const_reference,
true,
_Alloc>
point_iterator;
typedef
bin_search_tree_const_it_<
typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
typename type_traits::const_pointer,
typename type_traits::reference,
typename type_traits::const_reference,
false,
_Alloc>
const_reverse_iterator;
typedef
bin_search_tree_it_<
typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
typename type_traits::const_pointer,
typename type_traits::reference,
typename type_traits::const_reference,
false,
_Alloc>
reverse_iterator;
/// This is an iterator to an iterator: it iterates over nodes,
/// and de-referencing it returns one of the tree's iterators.
typedef
bin_search_tree_const_node_it_<
Node,
point_const_iterator,
point_iterator,
_Alloc>
node_const_iterator;
typedef
bin_search_tree_node_it_<
Node,
point_const_iterator,
point_iterator,
_Alloc>
node_iterator;
typedef
Node_Update<
node_const_iterator,
node_iterator,
Cmp_Fn,
_Alloc>
node_update;
typedef
__gnu_pbds::null_node_update<
node_const_iterator,
node_iterator,
Cmp_Fn,
_Alloc>*
null_node_update_pointer;
};
/// Specialization.
/// @ingroup traits
template<typename Key,
class Cmp_Fn,
template<typename Node_CItr,
class Node_Itr,
class _Cmp_Fn,
typename _Alloc>
class Node_Update,
class Node,
typename _Alloc>
struct
bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, Node, _Alloc>
{
private:
typedef types_traits<Key, null_type, _Alloc, false> type_traits;
public:
typedef Node node;
typedef
bin_search_tree_const_it_<
typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
typename type_traits::const_pointer,
typename type_traits::reference,
typename type_traits::const_reference,
true,
_Alloc>
point_const_iterator;
typedef point_const_iterator point_iterator;
typedef
bin_search_tree_const_it_<
typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
typename type_traits::const_pointer,
typename type_traits::reference,
typename type_traits::const_reference,
false,
_Alloc>
const_reverse_iterator;
typedef const_reverse_iterator reverse_iterator;
/// This is an iterator to an iterator: it iterates over nodes,
/// and de-referencing it returns one of the tree's iterators.
typedef
bin_search_tree_const_node_it_<
Node,
point_const_iterator,
point_iterator,
_Alloc>
node_const_iterator;
typedef node_const_iterator node_iterator;
typedef
Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>
node_update;
typedef
__gnu_pbds::null_node_update<
node_const_iterator,
node_iterator,
Cmp_Fn,
_Alloc>*
null_node_update_pointer;
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file bin_search_tree_/info_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{
return (m_size == 0);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{
return (m_size);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{
return (s_node_allocator.max_size());
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/types_traits.hpp
* Contains a traits class of types used by containers.
*/
#ifndef PB_DS_TYPES_TRAITS_HPP
#define PB_DS_TYPES_TRAITS_HPP
#include <algorithm>
#include <utility>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <utility>
namespace __gnu_pbds
{
namespace detail
{
/**
* @addtogroup traits Traits
* @{
*/
/// Primary template.
template<typename Key, typename Mapped>
struct no_throw_copies
{
static const bool __simple = is_simple<Key>::value
&& is_simple<Mapped>::value;
typedef integral_constant<int, __simple> indicator;
};
/// Specialization.
template<typename Key>
struct no_throw_copies<Key, null_type>
{
typedef integral_constant<int, is_simple<Key>::value> indicator;
};
/// Stored value.
template<typename _Tv>
struct stored_value
{
typedef _Tv value_type;
value_type m_value;
};
/// Stored hash.
template<typename _Th>
struct stored_hash
{
typedef _Th hash_type;
hash_type m_hash;
};
/// Primary template for representation of stored data.
/// Two types of data can be stored: value and hash.
template<typename _Tv, typename _Th>
struct stored_data
: public stored_value<_Tv>, public stored_hash<_Th>
{ };
/// Specialization for representation of stored data of just value type.
template<typename _Tv>
struct stored_data<_Tv, null_type>
: public stored_value<_Tv>
{ };
/// Primary template.
template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
struct type_base;
/**
* Specialization of type_base for the case where the hash value
* is not stored alongside each value.
*/
template<typename Key, typename Mapped, typename _Alloc>
struct type_base<Key, Mapped, _Alloc, false>
{
public:
typedef typename _Alloc::size_type size_type;
private:
typedef typename _Alloc::template rebind<Mapped> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef std::pair<const Key, Mapped> __value_type;
typedef typename _Alloc::template rebind<__value_type> __rebind_v;
typedef typename __rebind_v::other __rebind_va;
public:
typedef typename __rebind_ma::value_type mapped_type;
typedef typename __rebind_ma::pointer mapped_pointer;
typedef typename __rebind_ma::const_pointer mapped_const_pointer;
typedef typename __rebind_ma::reference mapped_reference;
typedef typename __rebind_ma::const_reference mapped_const_reference;
typedef typename __rebind_va::value_type value_type;
typedef typename __rebind_va::pointer pointer;
typedef typename __rebind_va::const_pointer const_pointer;
typedef typename __rebind_va::reference reference;
typedef typename __rebind_va::const_reference const_reference;
typedef stored_data<value_type, null_type> stored_data_type;
};
/**
* Specialization of type_base for the case where the hash value
* is stored alongside each value.
*/
template<typename Key, typename Mapped, typename _Alloc>
struct type_base<Key, Mapped, _Alloc, true>
{
public:
typedef typename _Alloc::size_type size_type;
private:
typedef typename _Alloc::template rebind<Mapped> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef std::pair<const Key, Mapped> __value_type;
typedef typename _Alloc::template rebind<__value_type> __rebind_v;
typedef typename __rebind_v::other __rebind_va;
public:
typedef typename __rebind_ma::value_type mapped_type;
typedef typename __rebind_ma::pointer mapped_pointer;
typedef typename __rebind_ma::const_pointer mapped_const_pointer;
typedef typename __rebind_ma::reference mapped_reference;
typedef typename __rebind_ma::const_reference mapped_const_reference;
typedef typename __rebind_va::value_type value_type;
typedef typename __rebind_va::pointer pointer;
typedef typename __rebind_va::const_pointer const_pointer;
typedef typename __rebind_va::reference reference;
typedef typename __rebind_va::const_reference const_reference;
typedef stored_data<value_type, size_type> stored_data_type;
};
/**
* Specialization of type_base for the case where the hash value
* is not stored alongside each value.
*/
template<typename Key, typename _Alloc>
struct type_base<Key, null_type, _Alloc, false>
{
public:
typedef typename _Alloc::size_type size_type;
typedef Key value_type;
private:
typedef typename _Alloc::template rebind<null_type> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef typename _Alloc::template rebind<value_type> __rebind_v;
typedef typename __rebind_v::other __rebind_va;
public:
typedef typename __rebind_ma::value_type mapped_type;
typedef typename __rebind_ma::pointer mapped_pointer;
typedef typename __rebind_ma::const_pointer mapped_const_pointer;
typedef typename __rebind_ma::reference mapped_reference;
typedef typename __rebind_ma::const_reference mapped_const_reference;
typedef typename __rebind_va::pointer pointer;
typedef typename __rebind_va::const_pointer const_pointer;
typedef typename __rebind_va::reference reference;
typedef typename __rebind_va::const_reference const_reference;
typedef stored_data<value_type, null_type> stored_data_type;
static null_type s_null_type;
};
template<typename Key, typename _Alloc>
null_type
type_base<Key, null_type, _Alloc, false>::s_null_type;
/**
* Specialization of type_base for the case where the hash value
* is stored alongside each value.
*/
template<typename Key, typename _Alloc>
struct type_base<Key, null_type, _Alloc, true>
{
public:
typedef typename _Alloc::size_type size_type;
typedef Key value_type;
private:
typedef typename _Alloc::template rebind<null_type> __rebind_m;
typedef typename __rebind_m::other __rebind_ma;
typedef typename _Alloc::template rebind<value_type> __rebind_v;
typedef typename __rebind_v::other __rebind_va;
public:
typedef typename __rebind_ma::value_type mapped_type;
typedef typename __rebind_ma::pointer mapped_pointer;
typedef typename __rebind_ma::const_pointer mapped_const_pointer;
typedef typename __rebind_ma::reference mapped_reference;
typedef typename __rebind_ma::const_reference mapped_const_reference;
typedef typename __rebind_va::pointer pointer;
typedef typename __rebind_va::const_pointer const_pointer;
typedef typename __rebind_va::reference reference;
typedef typename __rebind_va::const_reference const_reference;
typedef stored_data<value_type, size_type> stored_data_type;
static null_type s_null_type;
};
template<typename Key, typename _Alloc>
null_type
type_base<Key, null_type, _Alloc, true>::s_null_type;
/// Type base dispatch.
template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
struct type_dispatch
{
typedef type_base<Key, Mapped, _Alloc, Store_Hash> type;
};
/// Traits for abstract types.
template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
struct types_traits
: public type_dispatch<Key, Mapped, _Alloc, Store_Hash>::type
{
private:
typedef no_throw_copies<Key, Mapped> __nothrowcopy;
typedef typename _Alloc::template rebind<Key>::other __rebind_a;
public:
typedef typename _Alloc::size_type size_type;
typedef typename __rebind_a::value_type key_type;
typedef typename __rebind_a::pointer key_pointer;
typedef typename __rebind_a::const_pointer key_const_pointer;
typedef typename __rebind_a::reference key_reference;
typedef typename __rebind_a::const_reference key_const_reference;
typedef std::pair<size_type, size_type> comp_hash;
typedef integral_constant<int, Store_Hash> store_extra;
typedef typename __nothrowcopy::indicator no_throw_indicator;
store_extra m_store_extra_indicator;
no_throw_indicator m_no_throw_copies_indicator;
};
//@}
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/erase_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
pop()
{
make_binomial_heap();
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
base_type::pop();
base_type::find_max();
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
base_type::clear();
m_rc.clear();
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
make_binomial_heap()
{
node_pointer p_nd = base_type::m_p_root;
while (p_nd != 0)
{
node_pointer p_next = p_nd->m_p_next_sibling;
if (p_next == 0)
p_nd = p_next;
else if (p_nd->m_metadata == p_next->m_metadata)
p_nd = link_with_next_sibling(p_nd);
else if (p_nd->m_metadata < p_next->m_metadata)
p_nd = p_next;
#ifdef _GLIBCXX_DEBUG
else
_GLIBCXX_DEBUG_ASSERT(0);
#endif
}
m_rc.clear();
}
PB_DS_CLASS_T_DEC
template<typename Pred>
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
make_binomial_heap();
const size_type ersd = base_type::erase_if(pred);
base_type::find_max();
PB_DS_ASSERT_VALID((*this))
return ersd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase(point_iterator it)
{
make_binomial_heap();
base_type::erase(it);
base_type::find_max();
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/rc_binomial_heap_.hpp
* Contains an implementation for redundant-counter binomial heap.
*/
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/rc.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
rc_binomial_heap<Value_Type, Cmp_Fn, _Alloc>
#define PB_DS_RC_C_DEC \
rc<typename binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>::node, _Alloc>
/**
* Redundant-counter binomial heap.
*
* @ingroup heap-detail
*/
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class rc_binomial_heap
: public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
{
private:
typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
base_type;
typedef typename base_type::node_pointer node_pointer;
typedef typename base_type::node_const_pointer node_const_pointer;
typedef PB_DS_RC_C_DEC rc_t;
public:
typedef Value_Type value_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename base_type::pointer pointer;
typedef typename base_type::const_pointer const_pointer;
typedef typename base_type::reference reference;
typedef typename base_type::const_reference const_reference;
typedef typename base_type::point_const_iterator point_const_iterator;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::cmp_fn cmp_fn;
typedef typename base_type::allocator_type allocator_type;
rc_binomial_heap();
rc_binomial_heap(const Cmp_Fn&);
rc_binomial_heap(const PB_DS_CLASS_C_DEC&);
~rc_binomial_heap();
void
swap(PB_DS_CLASS_C_DEC&);
inline point_iterator
push(const_reference);
void
modify(point_iterator, const_reference);
inline void
pop();
void
erase(point_iterator);
inline void
clear();
template<typename Pred>
size_type
erase_if(Pred);
template<typename Pred>
void
split(Pred, PB_DS_CLASS_C_DEC&);
void
join(PB_DS_CLASS_C_DEC&);
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
#endif
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
void
trace() const;
#endif
private:
inline node_pointer
link_with_next_sibling(node_pointer);
void
make_0_exposed();
void
make_binomial_heap();
#ifdef _GLIBCXX_DEBUG
static node_const_pointer
next_2_pointer(node_const_pointer);
static node_const_pointer
next_after_0_pointer(node_const_pointer);
#endif
rc_t m_rc;
};
#include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp>
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_RC_C_DEC
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/debug_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
base_type::assert_valid(false, __file, __line);
if (!base_type::empty())
{
PB_DS_DEBUG_VERIFY(base_type::m_p_max != 0);
base_type::assert_max(__file, __line);
}
m_rc.assert_valid(__file, __line);
if (m_rc.empty())
{
base_type::assert_valid(true, __file, __line);
PB_DS_DEBUG_VERIFY(next_2_pointer(base_type::m_p_root) == 0);
return;
}
node_const_pointer p_nd = next_2_pointer(base_type::m_p_root);
typename rc_t::const_iterator it = m_rc.end();
--it;
while (p_nd != 0)
{
PB_DS_DEBUG_VERIFY(*it == p_nd);
node_const_pointer p_next = p_nd->m_p_next_sibling;
PB_DS_DEBUG_VERIFY(p_next != 0);
PB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_next->m_metadata);
PB_DS_DEBUG_VERIFY(p_next->m_p_next_sibling == 0 ||
p_next->m_metadata < p_next->m_p_next_sibling->m_metadata);
--it;
p_nd = next_2_pointer(next_after_0_pointer(p_nd));
}
PB_DS_DEBUG_VERIFY(it + 1 == m_rc.begin());
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_const_pointer
PB_DS_CLASS_C_DEC::
next_2_pointer(node_const_pointer p_nd)
{
if (p_nd == 0)
return 0;
node_pointer p_next = p_nd->m_p_next_sibling;
if (p_next == 0)
return 0;
if (p_nd->m_metadata == p_next->m_metadata)
return p_nd;
return next_2_pointer(p_next);
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_const_pointer
PB_DS_CLASS_C_DEC::
next_after_0_pointer(node_const_pointer p_nd)
{
if (p_nd == 0)
return 0;
node_pointer p_next = p_nd->m_p_next_sibling;
if (p_next == 0)
return 0;
if (p_nd->m_metadata < p_next->m_metadata)
return p_next;
return next_after_0_pointer(p_next);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/insert_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
make_0_exposed();
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = 0;
p_nd->m_metadata = 0;
if (base_type::m_p_max == 0 || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val))
base_type::m_p_max = p_nd;
p_nd->m_p_next_sibling = base_type::m_p_root;
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_nd;
base_type::m_p_root = p_nd;
if (p_nd->m_p_next_sibling != 0&& p_nd->m_p_next_sibling->m_metadata == 0)
m_rc.push(p_nd);
PB_DS_ASSERT_VALID((*this))
return point_iterator(p_nd);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
modify(point_iterator it, const_reference r_new_val)
{
PB_DS_ASSERT_VALID((*this))
make_binomial_heap();
base_type::modify(it, r_new_val);
base_type::find_max();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
link_with_next_sibling(node_pointer p_nd)
{
node_pointer p_next = p_nd->m_p_next_sibling;
_GLIBCXX_DEBUG_ASSERT(p_next != 0);
_GLIBCXX_DEBUG_ASSERT(p_next->m_p_prev_or_parent == p_nd);
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
if (p_next->m_p_prev_or_parent == 0)
base_type::m_p_root = p_next;
else
p_next->m_p_prev_or_parent->m_p_next_sibling = p_next;
if (base_type::m_p_max == p_nd)
base_type::m_p_max = p_next;
base_type::make_child_of(p_nd, p_next);
++p_next->m_metadata;
return p_next;
}
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
if (base_type::m_p_max == p_next)
base_type::m_p_max = p_nd;
base_type::make_child_of(p_next, p_nd);
++p_nd->m_metadata;
return p_nd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
make_0_exposed()
{
if (m_rc.empty())
return;
node_pointer p_nd = m_rc.top();
m_rc.pop();
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != 0);
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata);
node_pointer p_res = link_with_next_sibling(p_nd);
if (p_res->m_p_next_sibling != 0&& p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)
m_rc.push(p_res);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/split_join_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
PB_DS_CLASS_T_DEC
template<typename Pred>
void
PB_DS_CLASS_C_DEC::
split(Pred pred, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
make_binomial_heap();
other.make_binomial_heap();
base_type::split(pred, other);
base_type::find_max();
other.find_max();
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
make_binomial_heap();
other.make_binomial_heap();
base_type::join(other);
base_type::find_max();
other.find_max();
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
rc_binomial_heap()
{
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
rc_binomial_heap(const Cmp_Fn& r_cmp_fn)
: base_type(r_cmp_fn)
{
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
rc_binomial_heap(const PB_DS_CLASS_C_DEC& other)
: base_type(other)
{
make_binomial_heap();
base_type::find_max();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~rc_binomial_heap()
{ }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
base_type::swap(other);
m_rc.swap(other.m_rc);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/trace_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
base_type::trace();
m_rc.trace();
}
#endif // #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rc_binomial_heap_/rc.hpp
* Contains a redundant (binary counter).
*/
#ifndef PB_DS_RC_HPP
#define PB_DS_RC_HPP
namespace __gnu_pbds
{
namespace detail
{
/// Redundant binary counter.
template<typename _Node, typename _Alloc>
class rc
{
private:
typedef _Alloc allocator_type;
typedef typename allocator_type::size_type size_type;
typedef _Node node;
typedef typename _Alloc::template rebind<node> __rebind_n;
typedef typename __rebind_n::other::pointer node_pointer;
typedef typename _Alloc::template rebind<node_pointer> __rebind_np;
typedef typename __rebind_np::other::pointer entry_pointer;
typedef typename __rebind_np::other::const_pointer entry_const_pointer;
enum
{
max_entries = sizeof(size_type) << 3
};
public:
typedef node_pointer entry;
typedef entry_const_pointer const_iterator;
rc();
rc(const rc&);
inline void
swap(rc&);
inline void
push(entry);
inline node_pointer
top() const;
inline void
pop();
inline bool
empty() const;
inline size_type
size() const;
void
clear();
const const_iterator
begin() const;
const const_iterator
end() const;
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
#endif
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
void
trace() const;
#endif
private:
node_pointer m_a_entries[max_entries];
size_type m_over_top;
};
template<typename _Node, typename _Alloc>
rc<_Node, _Alloc>::
rc() : m_over_top(0)
{ PB_DS_ASSERT_VALID((*this)) }
template<typename _Node, typename _Alloc>
rc<_Node, _Alloc>::
rc(const rc<_Node, _Alloc>& other) : m_over_top(0)
{ PB_DS_ASSERT_VALID((*this)) }
template<typename _Node, typename _Alloc>
inline void
rc<_Node, _Alloc>::
swap(rc<_Node, _Alloc>& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
const size_type over_top = std::max(m_over_top, other.m_over_top);
for (size_type i = 0; i < over_top; ++i)
std::swap(m_a_entries[i], other.m_a_entries[i]);
std::swap(m_over_top, other.m_over_top);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
template<typename _Node, typename _Alloc>
inline void
rc<_Node, _Alloc>::
push(entry p_nd)
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries);
m_a_entries[m_over_top++] = p_nd;
PB_DS_ASSERT_VALID((*this))
}
template<typename _Node, typename _Alloc>
inline void
rc<_Node, _Alloc>::
pop()
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!empty());
--m_over_top;
PB_DS_ASSERT_VALID((*this))
}
template<typename _Node, typename _Alloc>
inline typename rc<_Node, _Alloc>::node_pointer
rc<_Node, _Alloc>::
top() const
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!empty());
return *(m_a_entries + m_over_top - 1);
}
template<typename _Node, typename _Alloc>
inline bool
rc<_Node, _Alloc>::
empty() const
{
PB_DS_ASSERT_VALID((*this))
return m_over_top == 0;
}
template<typename _Node, typename _Alloc>
inline typename rc<_Node, _Alloc>::size_type
rc<_Node, _Alloc>::
size() const
{ return m_over_top; }
template<typename _Node, typename _Alloc>
void
rc<_Node, _Alloc>::
clear()
{
PB_DS_ASSERT_VALID((*this))
m_over_top = 0;
PB_DS_ASSERT_VALID((*this))
}
template<typename _Node, typename _Alloc>
const typename rc<_Node, _Alloc>::const_iterator
rc<_Node, _Alloc>::
begin() const
{ return& m_a_entries[0]; }
template<typename _Node, typename _Alloc>
const typename rc<_Node, _Alloc>::const_iterator
rc<_Node, _Alloc>::
end() const
{ return& m_a_entries[m_over_top]; }
#ifdef _GLIBCXX_DEBUG
template<typename _Node, typename _Alloc>
void
rc<_Node, _Alloc>::
assert_valid(const char* __file, int __line) const
{ PB_DS_DEBUG_VERIFY(m_over_top < max_entries); }
#endif
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
template<typename _Node, typename _Alloc>
void
rc<_Node, _Alloc>::
trace() const
{
std::cout << "rc" << std::endl;
for (size_type i = 0; i < m_over_top; ++i)
std::cerr << m_a_entries[i] << std::endl;
std::cout << std::endl;
}
#endif
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/entry_metadata_base.hpp
* Contains an implementation for a list update map.
*/
#ifndef PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP
#define PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP
namespace __gnu_pbds
{
namespace detail
{
template<typename Metadata>
struct lu_map_entry_metadata_base
{
Metadata m_update_metadata;
};
template<>
struct lu_map_entry_metadata_base<null_type>
{ };
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/erase_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
if (m_p_l == 0)
return false;
if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
{
entry_pointer p_next = m_p_l->m_p_next;
actual_erase_entry(m_p_l);
m_p_l = p_next;
return true;
}
entry_pointer p_l = m_p_l;
while (p_l->m_p_next != 0)
if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value)))
{
erase_next(p_l);
return true;
}
else
p_l = p_l->m_p_next;
return false;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
deallocate_all();
}
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
size_type num_ersd = 0;
while (m_p_l != 0 && pred(m_p_l->m_value))
{
entry_pointer p_next = m_p_l->m_p_next;
++num_ersd;
actual_erase_entry(m_p_l);
m_p_l = p_next;
}
if (m_p_l == 0)
return num_ersd;
entry_pointer p_l = m_p_l;
while (p_l->m_p_next != 0)
{
if (pred(p_l->m_p_next->m_value))
{
++num_ersd;
erase_next(p_l);
}
else
p_l = p_l->m_p_next;
}
PB_DS_ASSERT_VALID((*this))
return num_ersd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase_next(entry_pointer p_l)
{
_GLIBCXX_DEBUG_ASSERT(p_l != 0);
_GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != 0);
entry_pointer p_next_l = p_l->m_p_next->m_p_next;
actual_erase_entry(p_l->m_p_next);
p_l->m_p_next = p_next_l;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
actual_erase_entry(entry_pointer p_l)
{
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->m_value));)
p_l->~entry();
s_entry_allocator.deallocate(p_l, 1);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/debug_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
size_type calc_size = 0;
for (const_iterator it = begin(); it != end(); ++it)
{
debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line);
++calc_size;
}
debug_base::check_size(calc_size, __file, __line);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/insert_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline std::pair<
typename PB_DS_CLASS_C_DEC::point_iterator,
bool>
PB_DS_CLASS_C_DEC::
insert(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
entry_pointer p_l = find_imp(PB_DS_V2F(r_val));
if (p_l != 0)
{
PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val))
return std::make_pair(point_iterator(&p_l->m_value), false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_val))
p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator);
p_l->m_p_next = m_p_l;
m_p_l = p_l;
PB_DS_ASSERT_VALID((*this))
return std::make_pair(point_iterator(&p_l->m_value), true);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
allocate_new_entry(const_reference r_val, false_type)
{
entry_pointer p_l = s_entry_allocator.allocate(1);
cond_dealtor_t cond(p_l);
new (const_cast<void* >(static_cast<const void* >(&p_l->m_value)))
value_type(r_val);
cond.set_no_action();
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
init_entry_metadata(p_l, s_metadata_type_indicator);
return p_l;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
allocate_new_entry(const_reference r_val, true_type)
{
entry_pointer p_l = s_entry_allocator.allocate(1);
new (&p_l->m_value) value_type(r_val);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
init_entry_metadata(p_l, s_metadata_type_indicator);
return p_l;
}
PB_DS_CLASS_T_DEC
template<typename Metadata>
inline void
PB_DS_CLASS_C_DEC::
init_entry_metadata(entry_pointer p_l, type_to_type<Metadata>)
{ new (&p_l->m_update_metadata) Metadata(s_update_policy()); }
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
init_entry_metadata(entry_pointer, type_to_type<null_type>)
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/trace_fn_imps.hpp
* Contains implementations of lu_map_.
*/
#ifdef PB_DS_LU_MAP_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << m_p_l << std::endl << std::endl;
const_entry_pointer p_l = m_p_l;
while (p_l != 0)
{
std::cerr << PB_DS_V2F(p_l->m_value) << std::endl;
p_l = p_l->m_p_next;
}
std::cerr << std::endl;
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/constructor_destructor_fn_imps.hpp
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::entry_allocator
PB_DS_CLASS_C_DEC::s_entry_allocator;
PB_DS_CLASS_T_DEC
Eq_Fn PB_DS_CLASS_C_DEC::s_eq_fn;
PB_DS_CLASS_T_DEC
null_type PB_DS_CLASS_C_DEC::s_null_type;
PB_DS_CLASS_T_DEC
Update_Policy PB_DS_CLASS_C_DEC::s_update_policy;
PB_DS_CLASS_T_DEC
type_to_type<
typename PB_DS_CLASS_C_DEC::update_metadata> PB_DS_CLASS_C_DEC::s_metadata_type_indicator;
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
insert(*(first_it++));
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_LU_NAME() : m_p_l(0)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
template<typename It>
PB_DS_CLASS_C_DEC::
PB_DS_LU_NAME(It first_it, It last_it) : m_p_l(0)
{
copy_from_range(first_it, last_it);
PB_DS_ASSERT_VALID((*this));
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC& other) :
m_p_l(0)
{
__try
{
for (const_iterator it = other.begin(); it != other.end(); ++it)
{
entry_pointer p_l = allocate_new_entry(*it,
traits_base::m_no_throw_copies_indicator);
p_l->m_p_next = m_p_l;
m_p_l = p_l;
}
}
__catch(...)
{
deallocate_all();
__throw_exception_again;
}
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
_GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_p_l, other.m_p_l);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
deallocate_all()
{
entry_pointer p_l = m_p_l;
while (p_l != 0)
{
entry_pointer p_next_l = p_l->m_p_next;
actual_erase_entry(p_l);
p_l = p_next_l;
}
m_p_l = 0;
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~PB_DS_LU_NAME()
{ deallocate_all(); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/iterators_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
if (m_p_l == 0)
{
_GLIBCXX_DEBUG_ASSERT(empty());
return end();
}
return iterator(&m_p_l->m_value, m_p_l, this);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
if (m_p_l == 0)
{
_GLIBCXX_DEBUG_ASSERT(empty());
return end();
}
return iterator(&m_p_l->m_value, m_p_l, const_cast<PB_DS_CLASS_C_DEC* >(this));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{ return iterator(0, 0, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{
return const_iterator(0, 0, const_cast<PB_DS_CLASS_C_DEC*>(this));
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/lu_map_.hpp
* Contains a list update map.
*/
#include <utility>
#include <iterator>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp>
#include <ext/pb_ds/exception.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#ifdef PB_DS_LU_MAP_TRACE_
#include <iostream>
#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_LU_NAME lu_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_LU_NAME lu_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Eq_Fn, \
typename _Alloc, typename Update_Policy>
#define PB_DS_CLASS_C_DEC \
PB_DS_LU_NAME<Key, Mapped, Eq_Fn, _Alloc, Update_Policy>
#define PB_DS_LU_TRAITS_BASE \
types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, Eq_Fn, \
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
/// list-based (with updates) associative container.
/// Skip to the lu, my darling.
template<typename Key,
typename Mapped,
typename Eq_Fn,
typename _Alloc,
typename Update_Policy>
class PB_DS_LU_NAME :
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public PB_DS_LU_TRAITS_BASE
{
private:
typedef PB_DS_LU_TRAITS_BASE traits_base;
struct entry
: public lu_map_entry_metadata_base<typename Update_Policy::metadata_type>
{
typename traits_base::value_type m_value;
typename _Alloc::template rebind<entry>::other::pointer m_p_next;
};
typedef typename _Alloc::template rebind<entry>::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
typedef typename entry_allocator::const_pointer const_entry_pointer;
typedef typename entry_allocator::reference entry_reference;
typedef typename entry_allocator::const_reference const_entry_reference;
typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator;
typedef typename entry_pointer_allocator::pointer entry_pointer_array;
typedef typename traits_base::value_type value_type_;
typedef typename traits_base::pointer pointer_;
typedef typename traits_base::const_pointer const_pointer_;
typedef typename traits_base::reference reference_;
typedef typename traits_base::const_reference const_reference_;
#define PB_DS_GEN_POS entry_pointer
#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
#undef PB_DS_GEN_POS
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif
typedef cond_dealtor<entry, _Alloc> cond_dealtor_t;
public:
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef Eq_Fn eq_fn;
typedef Update_Policy update_policy;
typedef typename Update_Policy::metadata_type update_metadata;
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
typedef typename traits_base::mapped_const_reference mapped_const_reference;
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
typedef typename traits_base::reference reference;
typedef typename traits_base::const_reference const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef point_iterator_ point_iterator;
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
typedef point_const_iterator_ point_iterator;
#endif
typedef point_const_iterator_ point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef iterator_ iterator;
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
typedef const_iterator_ iterator;
#endif
typedef const_iterator_ const_iterator;
public:
PB_DS_LU_NAME();
PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC&);
virtual
~PB_DS_LU_NAME();
template<typename It>
PB_DS_LU_NAME(It, It);
void
swap(PB_DS_CLASS_C_DEC&);
inline size_type
size() const;
inline size_type
max_size() const;
inline bool
empty() const;
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return insert(std::make_pair(r_key, mapped_type())).first->second;
#else
insert(r_key);
return traits_base::s_null_type;
#endif
}
inline std::pair<point_iterator, bool>
insert(const_reference);
inline point_iterator
find(key_const_reference r_key)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
entry_pointer p_e = find_imp(r_key);
return point_iterator(p_e == 0 ? 0: &p_e->m_value);
}
inline point_const_iterator
find(key_const_reference r_key) const
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
entry_pointer p_e = find_imp(r_key);
return point_const_iterator(p_e == 0 ? 0: &p_e->m_value);
}
inline bool
erase(key_const_reference);
template<typename Pred>
inline size_type
erase_if(Pred);
void
clear();
inline iterator
begin();
inline const_iterator
begin() const;
inline iterator
end();
inline const_iterator
end() const;
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char* file, int line) const;
#endif
#ifdef PB_DS_LU_MAP_TRACE_
void
trace() const;
#endif
protected:
template<typename It>
void
copy_from_range(It, It);
private:
#ifdef PB_DS_DATA_TRUE_INDICATOR
friend class iterator_;
#endif
friend class const_iterator_;
inline entry_pointer
allocate_new_entry(const_reference, false_type);
inline entry_pointer
allocate_new_entry(const_reference, true_type);
template<typename Metadata>
inline static void
init_entry_metadata(entry_pointer, type_to_type<Metadata>);
inline static void
init_entry_metadata(entry_pointer, type_to_type<null_type>);
void
deallocate_all();
void
erase_next(entry_pointer);
void
actual_erase_entry(entry_pointer);
void
inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const
{
r_pos = r_pos->m_p_next;
r_p_value = (r_pos == 0) ? 0 : &r_pos->m_value;
}
template<typename Metadata>
inline static bool
apply_update(entry_pointer, type_to_type<Metadata>);
inline static bool
apply_update(entry_pointer, type_to_type<null_type>);
inline entry_pointer
find_imp(key_const_reference) const;
static entry_allocator s_entry_allocator;
static Eq_Fn s_eq_fn;
static Update_Policy s_update_policy;
static type_to_type<update_metadata> s_metadata_type_indicator;
static null_type s_null_type;
mutable entry_pointer m_p_l;
};
#include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_LU_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_LU_NAME
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/find_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
find_imp(key_const_reference r_key) const
{
if (m_p_l == 0)
return 0;
if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
{
apply_update(m_p_l, s_metadata_type_indicator);
PB_DS_CHECK_KEY_EXISTS(r_key)
return m_p_l;
}
entry_pointer p_l = m_p_l;
while (p_l->m_p_next != 0)
{
entry_pointer p_next = p_l->m_p_next;
if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value)))
{
if (apply_update(p_next, s_metadata_type_indicator))
{
p_l->m_p_next = p_next->m_p_next;
p_next->m_p_next = m_p_l;
m_p_l = p_next;
return m_p_l;
}
return p_next;
}
else
p_l = p_next;
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return 0;
}
PB_DS_CLASS_T_DEC
template<typename Metadata>
inline bool
PB_DS_CLASS_C_DEC::
apply_update(entry_pointer p_l, type_to_type<Metadata>)
{ return s_update_policy(p_l->m_update_metadata); }
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
apply_update(entry_pointer, type_to_type<null_type>)
{ return s_update_policy(s_null_type); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file list_update_map_/info_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{ return std::distance(begin(), end()); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{ return s_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return (m_p_l == 0); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/erase_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{
point_iterator it = find(r_key);
if (it == base_type::end())
return false;
erase(it);
return true;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
erase(iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it == base_type::end())
return it;
iterator ret_it = it;
++ret_it;
erase_node(it.m_p_nd);
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::reverse_iterator
PB_DS_CLASS_C_DEC::
erase(reverse_iterator it)
{
PB_DS_ASSERT_VALID((*this))
if (it.m_p_nd == base_type::m_p_head)
return (it);
reverse_iterator ret_it = it;
++ret_it;
erase_node(it.m_p_nd);
PB_DS_ASSERT_VALID((*this))
return ret_it;
}
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
size_type num_ersd = 0;
iterator it = base_type::begin();
while (it != base_type::end())
{
if (pred(*it))
{
++num_ersd;
it = erase(it);
}
else
++it;
}
PB_DS_ASSERT_VALID((*this))
return num_ersd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase_node(node_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
splay(p_nd);
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);
node_pointer p_l = p_nd->m_p_left;
node_pointer p_r = p_nd->m_p_right;
base_type::update_min_max_for_erased_node(p_nd);
base_type::actual_erase_node(p_nd);
if (p_r == 0)
{
base_type::m_p_head->m_p_parent = p_l;
if (p_l != 0)
p_l->m_p_parent = base_type::m_p_head;
PB_DS_ASSERT_VALID((*this))
return;
}
node_pointer p_target_r = leftmost(p_r);
_GLIBCXX_DEBUG_ASSERT(p_target_r != 0);
p_r->m_p_parent = base_type::m_p_head;
base_type::m_p_head->m_p_parent = p_r;
splay(p_target_r);
_GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = 0);
_GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_parent == this->m_p_head);
_GLIBCXX_DEBUG_ASSERT(this->m_p_head->m_p_parent == p_target_r);
p_target_r->m_p_left = p_l;
if (p_l != 0)
p_l->m_p_parent = p_target_r;
PB_DS_ASSERT_VALID((*this))
this->apply_update(p_target_r, (node_update*)this);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
leftmost(node_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
while (p_nd->m_p_left != 0)
p_nd = p_nd->m_p_left;
return p_nd;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/debug_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
base_type::assert_valid(__file, __line);
const node_pointer p_head = base_type::m_p_head;
assert_special_imp(p_head, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_special_imp(const node_pointer p_nd,
const char* __file, int __line) const
{
if (p_nd == 0)
return;
if (p_nd == base_type::m_p_head)
{
PB_DS_DEBUG_VERIFY(p_nd->m_special);
assert_special_imp(p_nd->m_p_parent, __file, __line);
return;
}
PB_DS_DEBUG_VERIFY(!p_nd->m_special);
assert_special_imp(p_nd->m_p_left, __file, __line);
assert_special_imp(p_nd->m_p_right, __file, __line);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/insert_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert(const_reference r_value)
{
PB_DS_ASSERT_VALID((*this))
std::pair<point_iterator, bool> ins_pair = insert_leaf_imp(r_value);
ins_pair.first.m_p_nd->m_special = false;
PB_DS_ASSERT_VALID((*this))
splay(ins_pair.first.m_p_nd);
PB_DS_ASSERT_VALID((*this))
return ins_pair;
}
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_leaf_imp(const_reference r_value)
{
_GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__,
__LINE__);)
if (base_type::m_size == 0)
return std::make_pair(base_type::insert_imp_empty(r_value), true);
node_pointer p_nd = base_type::m_p_head->m_p_parent;
node_pointer p_pot = base_type::m_p_head;
while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value)))
{
if (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value)))
{
return std::make_pair(point_iterator(p_nd), false);
}
p_pot = p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
if (p_pot == base_type::m_p_head)
return std::make_pair(base_type::insert_leaf_new(r_value, base_type::m_p_head->m_p_right, false), true);
PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))
p_nd = p_pot->m_p_left;
if (p_nd == 0)
return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));
while (p_nd->m_p_right != 0)
p_nd = p_nd->m_p_right;
return std::make_pair(this->insert_leaf_new(r_value, p_nd, false), true);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/splay_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
splay(node_pointer p_nd)
{
while (p_nd->m_p_parent != base_type::m_p_head)
{
#ifdef _GLIBCXX_DEBUG
{
node_pointer p_head = base_type::m_p_head;
assert_special_imp(p_head, __FILE__, __LINE__);
}
#endif
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)
if (p_nd->m_p_parent->m_p_parent == base_type::m_p_head)
{
base_type::rotate_parent(p_nd);
_GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);
}
else
{
const node_pointer p_parent = p_nd->m_p_parent;
const node_pointer p_grandparent = p_parent->m_p_parent;
#ifdef _GLIBCXX_DEBUG
const size_type total =
base_type::recursive_count(p_grandparent);
_GLIBCXX_DEBUG_ASSERT(total >= 3);
#endif
if (p_parent->m_p_left == p_nd &&
p_grandparent->m_p_right == p_parent)
splay_zig_zag_left(p_nd, p_parent, p_grandparent);
else if (p_parent->m_p_right == p_nd &&
p_grandparent->m_p_left == p_parent)
splay_zig_zag_right(p_nd, p_parent, p_grandparent);
else if (p_parent->m_p_left == p_nd &&
p_grandparent->m_p_left == p_parent)
splay_zig_zig_left(p_nd, p_parent, p_grandparent);
else
splay_zig_zig_right(p_nd, p_parent, p_grandparent);
_GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd));
}
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)
}
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
_GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
p_grandparent->m_p_right == p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
node_pointer p_b = p_nd->m_p_right;
node_pointer p_c = p_nd->m_p_left;
p_nd->m_p_right = p_parent;
p_parent->m_p_parent = p_nd;
p_nd->m_p_left = p_grandparent;
p_grandparent->m_p_parent = p_nd;
p_parent->m_p_left = p_b;
if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_right = p_c;
if (p_c != 0)
p_c->m_p_parent = p_grandparent;
splay_zz_end(p_nd, p_parent, p_grandparent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
_GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
p_grandparent->m_p_left == p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
node_pointer p_b = p_nd->m_p_left;
node_pointer p_c = p_nd->m_p_right;
p_nd->m_p_left = p_parent;
p_parent->m_p_parent = p_nd;
p_nd->m_p_right = p_grandparent;
p_grandparent->m_p_parent = p_nd;
p_parent->m_p_right = p_b;
if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_left = p_c;
if (p_c != 0)
p_c->m_p_parent = p_grandparent;
splay_zz_end(p_nd, p_parent, p_grandparent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
_GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
node_pointer p_b = p_nd->m_p_right;
node_pointer p_c = p_parent->m_p_right;
p_nd->m_p_right = p_parent;
p_parent->m_p_parent = p_nd;
p_parent->m_p_right = p_grandparent;
p_grandparent->m_p_parent = p_parent;
p_parent->m_p_left = p_b;
if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_left = p_c;
if (p_c != 0)
p_c->m_p_parent = p_grandparent;
splay_zz_end(p_nd, p_parent, p_grandparent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
_GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
node_pointer p_b = p_nd->m_p_left;
node_pointer p_c = p_parent->m_p_left;
p_nd->m_p_left = p_parent;
p_parent->m_p_parent = p_nd;
p_parent->m_p_left = p_grandparent;
p_grandparent->m_p_parent = p_parent;
p_parent->m_p_right = p_b;
if (p_b != 0)
p_b->m_p_parent = p_parent;
p_grandparent->m_p_right = p_c;
if (p_c != 0)
p_c->m_p_parent = p_grandparent;
base_type::update_to_top(p_grandparent, (node_update*)this);
splay_zz_end(p_nd, p_parent, p_grandparent);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
splay_zz_start(node_pointer p_nd,
#ifdef _GLIBCXX_DEBUG
node_pointer p_parent,
#else
node_pointer /*p_parent*/,
#endif
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(p_parent != 0);
_GLIBCXX_DEBUG_ASSERT(p_grandparent != 0);
const bool grandparent_head = p_grandparent->m_p_parent == base_type::m_p_head;
if (grandparent_head)
{
base_type::m_p_head->m_p_parent = base_type::m_p_head->m_p_parent;
p_nd->m_p_parent = base_type::m_p_head;
return;
}
node_pointer p_greatgrandparent = p_grandparent->m_p_parent;
p_nd->m_p_parent = p_greatgrandparent;
if (p_grandparent == p_greatgrandparent->m_p_left)
p_greatgrandparent->m_p_left = p_nd;
else
p_greatgrandparent->m_p_right = p_nd;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
splay_zz_end(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
if (p_nd->m_p_parent == base_type::m_p_head)
base_type::m_p_head->m_p_parent = p_nd;
this->apply_update(p_grandparent, (node_update*)this);
this->apply_update(p_parent, (node_update*)this);
this->apply_update(p_nd, (node_update*)this);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/split_join_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (base_type::join_prep(other) == false)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
node_pointer p_target_r = other.leftmost(other.m_p_head);
_GLIBCXX_DEBUG_ASSERT(p_target_r != 0);
other.splay(p_target_r);
_GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent);
_GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == 0);
p_target_r->m_p_left = base_type::m_p_head->m_p_parent;
_GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != 0);
p_target_r->m_p_left->m_p_parent = p_target_r;
base_type::m_p_head->m_p_parent = p_target_r;
p_target_r->m_p_parent = base_type::m_p_head;
this->apply_update(p_target_r, (node_update*)this);
base_type::join_finish(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (base_type::split_prep(r_key, other) == false)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
node_pointer p_upper_bound = this->upper_bound(r_key).m_p_nd;
_GLIBCXX_DEBUG_ASSERT(p_upper_bound != 0);
splay(p_upper_bound);
_GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head);
node_pointer p_new_root = p_upper_bound->m_p_left;
_GLIBCXX_DEBUG_ASSERT(p_new_root != 0);
base_type::m_p_head->m_p_parent = p_new_root;
p_new_root->m_p_parent = base_type::m_p_head;
other.m_p_head->m_p_parent = p_upper_bound;
p_upper_bound->m_p_parent = other.m_p_head;
p_upper_bound->m_p_left = 0;
this->apply_update(p_upper_bound, (node_update*)this);
base_type::split_finish(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
insert(*(first_it++));
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_S_TREE_NAME()
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
base_type(r_cmp_fn)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
base_type(r_cmp_fn, r_node_update)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
base_type(other)
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
base_type::swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{ base_type::m_p_head->m_special = true; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/splay_tree_.hpp
* Contains an implementation class for splay trees.
*/
/*
* This implementation uses an idea from the SGI STL (using a @a header node
* which is needed for efficient iteration). Following is the SGI STL
* copyright.
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
*/
#include <utility>
#include <vector>
#include <assert.h>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
# define PB_DS_S_TREE_NAME splay_tree_map
# define PB_DS_S_TREE_BASE_NAME bin_search_tree_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
# define PB_DS_S_TREE_NAME splay_tree_set
# define PB_DS_S_TREE_BASE_NAME bin_search_tree_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Cmp_Fn, \
typename Node_And_It_Traits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
PB_DS_S_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
#define PB_DS_S_TREE_BASE \
PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
/**
* @brief Splay tree.
* @ingroup branch-detail
*/
template<typename Key, typename Mapped, typename Cmp_Fn,
typename Node_And_It_Traits, typename _Alloc>
class PB_DS_S_TREE_NAME : public PB_DS_S_TREE_BASE
{
private:
typedef PB_DS_S_TREE_BASE base_type;
#ifdef _GLIBCXX_DEBUG
typedef base_type debug_base;
#endif
typedef typename base_type::node_pointer node_pointer;
public:
typedef splay_tree_tag container_category;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef Cmp_Fn cmp_fn;
typedef typename base_type::key_type key_type;
typedef typename base_type::key_pointer key_pointer;
typedef typename base_type::key_const_pointer key_const_pointer;
typedef typename base_type::key_reference key_reference;
typedef typename base_type::key_const_reference key_const_reference;
typedef typename base_type::mapped_type mapped_type;
typedef typename base_type::mapped_pointer mapped_pointer;
typedef typename base_type::mapped_const_pointer mapped_const_pointer;
typedef typename base_type::mapped_reference mapped_reference;
typedef typename base_type::mapped_const_reference mapped_const_reference;
typedef typename base_type::value_type value_type;
typedef typename base_type::pointer pointer;
typedef typename base_type::const_pointer const_pointer;
typedef typename base_type::reference reference;
typedef typename base_type::const_reference const_reference;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator point_const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::reverse_iterator reverse_iterator;
typedef typename base_type::const_reverse_iterator const_reverse_iterator;
typedef typename base_type::node_update node_update;
PB_DS_S_TREE_NAME();
PB_DS_S_TREE_NAME(const Cmp_Fn&);
PB_DS_S_TREE_NAME(const Cmp_Fn&, const node_update&);
PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
template<typename It>
void
copy_from_range(It, It);
void
initialize();
inline std::pair<point_iterator, bool>
insert(const_reference r_value);
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
std::pair<point_iterator, bool> ins_pair =
insert_leaf_imp(value_type(r_key, mapped_type()));
ins_pair.first.m_p_nd->m_special = false;
_GLIBCXX_DEBUG_ONLY(base_type::assert_valid(__FILE__, __LINE__));
splay(ins_pair.first.m_p_nd);
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return ins_pair.first.m_p_nd->m_value.second;
#else
insert(r_key);
return base_type::s_null_type;
#endif
}
inline point_iterator
find(key_const_reference);
inline point_const_iterator
find(key_const_reference) const;
inline bool
erase(key_const_reference);
inline iterator
erase(iterator it);
inline reverse_iterator
erase(reverse_iterator);
template<typename Pred>
inline size_type
erase_if(Pred);
void
join(PB_DS_CLASS_C_DEC&);
void
split(key_const_reference, PB_DS_CLASS_C_DEC&);
private:
inline std::pair<point_iterator, bool>
insert_leaf_imp(const_reference);
inline node_pointer
find_imp(key_const_reference);
inline const node_pointer
find_imp(key_const_reference) const;
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char* file, int line) const;
void
assert_special_imp(const node_pointer, const char* file, int line) const;
#endif
void
splay(node_pointer);
inline void
splay_zig_zag_left(node_pointer, node_pointer, node_pointer);
inline void
splay_zig_zag_right(node_pointer, node_pointer, node_pointer);
inline void
splay_zig_zig_left(node_pointer, node_pointer, node_pointer);
inline void
splay_zig_zig_right(node_pointer, node_pointer, node_pointer);
inline void
splay_zz_start(node_pointer, node_pointer, node_pointer);
inline void
splay_zz_end(node_pointer, node_pointer, node_pointer);
inline node_pointer
leftmost(node_pointer);
void
erase_node(node_pointer);
};
#define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node) \
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, \
__FILE__, __LINE__);)
#include <ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp>
#include <ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp>
#undef PB_DS_ASSERT_BASE_NODE_CONSISTENT
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_S_TREE_NAME
#undef PB_DS_S_TREE_BASE_NAME
#undef PB_DS_S_TREE_BASE
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/find_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key)
{
node_pointer p_found = find_imp(r_key);
if (p_found != base_type::m_p_head)
splay(p_found);
return point_iterator(p_found);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key) const
{
const node_pointer p_found = find_imp(r_key);
if (p_found != base_type::m_p_head)
const_cast<PB_DS_CLASS_C_DEC* >(this)->splay(p_found);
return point_iterator(p_found);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
find_imp(key_const_reference r_key)
{
_GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__,
__LINE__);)
node_pointer p_nd = base_type::m_p_head->m_p_parent;
while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
return p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
return base_type::m_p_head;
}
PB_DS_CLASS_T_DEC
inline const typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
find_imp(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = base_type::m_p_head->m_p_parent;
while (p_nd != 0)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
return p_nd;
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
return base_type::m_p_head;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/node.hpp
* Contains an implementation struct for splay_tree_'s node.
*/
#ifndef PB_DS_SPLAY_TREE_NODE_HPP
#define PB_DS_SPLAY_TREE_NODE_HPP
namespace __gnu_pbds
{
namespace detail
{
/// Node for splay tree.
template<typename Value_Type, class Metadata, typename _Alloc>
struct splay_tree_node_
{
public:
typedef Value_Type value_type;
typedef Metadata metadata_type;
typedef
typename _Alloc::template rebind<
splay_tree_node_<Value_Type, Metadata, _Alloc> >::other::pointer
node_pointer;
typedef
typename _Alloc::template rebind<metadata_type>::other::reference
metadata_reference;
typedef
typename _Alloc::template rebind<metadata_type>::other::const_reference
metadata_const_reference;
#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
void
trace() const
{ std::cout << PB_DS_V2F(m_value) << "(" << m_metadata << ")"; }
#endif
inline bool
special() const
{ return m_special; }
inline metadata_const_reference
get_metadata() const
{ return m_metadata; }
inline metadata_reference
get_metadata()
{ return m_metadata; }
value_type m_value;
bool m_special;
node_pointer m_p_left;
node_pointer m_p_right;
node_pointer m_p_parent;
metadata_type m_metadata;
};
template<typename Value_Type, typename _Alloc>
struct splay_tree_node_<Value_Type, null_type, _Alloc>
{
public:
typedef Value_Type value_type;
typedef null_type metadata_type;
typedef
typename _Alloc::template rebind<
splay_tree_node_<Value_Type, null_type, _Alloc> >::other::pointer
node_pointer;
inline bool
special() const
{ return m_special; }
#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
void
trace() const
{ std::cout << PB_DS_V2F(m_value); }
#endif
node_pointer m_p_left;
node_pointer m_p_right;
node_pointer m_p_parent;
value_type m_value;
bool m_special;
};
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/traits.hpp
* Contains an implementation for splay_tree_.
*/
#ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP
#define PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP
#include <ext/pb_ds/detail/splay_tree_/node.hpp>
namespace __gnu_pbds
{
namespace detail
{
/// Specialization.
/// @ingroup traits
template<typename Key,
typename Mapped,
typename Cmp_Fn,
template<typename Node_CItr,
typename Node_Itr,
typename Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, splay_tree_tag, _Alloc>
: public bin_search_tree_traits<Key, Mapped, Cmp_Fn, Node_Update,
splay_tree_node_<
typename types_traits<Key, Mapped, _Alloc, false>::value_type,
typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,
_Alloc>::type,
_Alloc>,
_Alloc>
{ };
/// Specialization.
/// @ingroup traits
template<typename Key,
class Cmp_Fn,
template<typename Node_CItr,
class Node_Itr,
class Cmp_Fn_,
typename _Alloc_>
class Node_Update,
typename _Alloc>
struct tree_traits<Key, null_type, Cmp_Fn, Node_Update,
splay_tree_tag, _Alloc>
: public bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update,
splay_tree_node_<
typename types_traits<Key, null_type, _Alloc, false>::value_type,
typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,
_Alloc>::type,
_Alloc>,
_Alloc>
{ };
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file splay_tree_/info_fn_imps.hpp
* Contains an implementation.
*/
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s resize related functions, when the
* hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type)
{
const size_type hash_pos =
ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));
entry_pointer const p_next_e = p_e->m_p_next;
p_e->m_p_next = a_p_entries_resized[hash_pos];
a_p_entries_resized[hash_pos] = p_e;
return p_next_e;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s insert related functions,
* when the hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, false_type)
{
PB_DS_ASSERT_VALID((*this))
key_const_reference r_key = PB_DS_V2F(r_val);
const size_type pos = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos];
resize_base::notify_insert_search_start();
while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
r_key))
{
resize_base::notify_insert_search_collision();
p_e = p_e->m_p_next;
}
resize_base::notify_insert_search_end();
if (p_e != 0)
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return std::make_pair(&p_e->m_value, false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return std::make_pair(insert_new_imp(r_val, pos), true);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/erase_fn_imps.hpp
* Contains implementations of cc_ht_map_'s erase related functions.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
erase_entry_pointer(entry_pointer& r_p_e)
{
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value)));
entry_pointer p_e = r_p_e;
r_p_e = r_p_e->m_p_next;
rels_entry(p_e);
_GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);
resize_base::notify_erased(--m_num_used_e);
}
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
size_type num_ersd = 0;
for (size_type pos = 0; pos < m_num_e; ++pos)
{
while (m_entries[pos] != 0 && pred(m_entries[pos]->m_value))
{
++num_ersd;
entry_pointer p_next_e = m_entries[pos]->m_p_next;
erase_entry_pointer(m_entries[pos]);
m_entries[pos] = p_next_e;
}
entry_pointer p_e = m_entries[pos];
while (p_e != 0 && p_e->m_p_next != 0)
{
if (pred(p_e->m_p_next->m_value))
{
++num_ersd;
erase_entry_pointer(p_e->m_p_next);
}
else
p_e = p_e->m_p_next;
}
}
do_resize_if_needed_no_throw();
return num_ersd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
for (size_type pos = 0; pos < m_num_e; ++pos)
while (m_entries[pos] != 0)
erase_entry_pointer(m_entries[pos]);
do_resize_if_needed_no_throw();
resize_base::notify_cleared();
}
#include <ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp>
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/erase_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s erase related functions,
* when the hash value is stored.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase_in_pos_imp(key_const_reference r_key, const comp_hash& r_pos_hash_pair)
{
PB_DS_ASSERT_VALID((*this))
entry_pointer p_e = m_entries[r_pos_hash_pair.first];
resize_base::notify_erase_search_start();
if (p_e == 0)
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
PB_DS_ASSERT_VALID((*this))
return false;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
r_key, r_pos_hash_pair.second))
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
erase_entry_pointer(m_entries[r_pos_hash_pair.first]);
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
return true;
}
while (true)
{
entry_pointer p_next_e = p_e->m_p_next;
if (p_next_e == 0)
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
PB_DS_ASSERT_VALID((*this))
return false;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value),
p_next_e->m_hash, r_key,
r_pos_hash_pair.second))
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
erase_entry_pointer(p_e->m_p_next);
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
return true;
}
resize_base::notify_erase_search_collision();
p_e = p_next_e;
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/debug_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
debug_base::check_size(m_num_used_e, __file, __line);
assert_entry_pointer_array_valid(m_entries, __file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_entry_pointer_array_valid(const entry_pointer_array a_p_entries,
const char* __file, int __line) const
{
size_type iterated_num_used_e = 0;
for (size_type pos = 0; pos < m_num_e; ++pos)
{
entry_pointer p_e = a_p_entries[pos];
while (p_e != 0)
{
++iterated_num_used_e;
assert_entry_pointer_valid(p_e, traits_base::m_store_extra_indicator,
__file, __line);
p_e = p_e->m_p_next;
}
}
PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e);
}
#include <ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp>
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s erase related functions,
* when the hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
return erase_in_pos_imp(r_key, ranged_hash_fn_base::operator()(r_key));
}
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase_in_pos_imp(key_const_reference r_key, size_type pos)
{
PB_DS_ASSERT_VALID((*this))
entry_pointer p_e = m_entries[pos];
resize_base::notify_erase_search_start();
if (p_e == 0)
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
PB_DS_ASSERT_VALID((*this))
return false;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
erase_entry_pointer(m_entries[pos]);
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
return true;
}
while (true)
{
entry_pointer p_next_e = p_e->m_p_next;
if (p_next_e == 0)
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
PB_DS_ASSERT_VALID((*this))
return false;
}
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
erase_entry_pointer(p_e->m_p_next);
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
return true;
}
resize_base::notify_erase_search_collision();
p_e = p_next_e;
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/entry_list_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entry-list related functions.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
deallocate_links_in_list(entry_pointer p_e)
{
while (p_e != 0)
{
entry_pointer p_dealloc_e = p_e;
p_e = p_e->m_p_next;
s_entry_allocator.deallocate(p_dealloc_e, 1);
}
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
get_entry(const_reference r_val, true_type)
{
// Following line might throw an exception.
entry_pointer p_e = s_entry_allocator.allocate(1);
// Following lines* cannot* throw an exception.
new (&p_e->m_value) value_type(r_val);
return p_e;
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
get_entry(const_reference r_val, false_type)
{
// Following line might throw an exception.
entry_pointer p_e = s_entry_allocator.allocate(1);
cond_dealtor_t cond(p_e);
// Following lines might throw an exception.
new (&p_e->m_value) value_type(r_val);
cond.set_no_action();
return p_e;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
rels_entry(entry_pointer p_e)
{
// The following lines cannot throw exceptions (unless if key-data dtors do).
p_e->m_value.~value_type();
s_entry_allocator.deallocate(p_e, 1);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/resize_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s resize related functions, when the
* hash value is stored.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type)
{
const comp_hash pos_hash_pair =
ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash);
entry_pointer const p_next_e = p_e->m_p_next;
p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first];
a_p_entries_resized[pos_hash_pair.first] = p_e;
return p_next_e;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/insert_fn_imps.hpp
* Contains implementations of cc_ht_map_'s insert related functions.
*/
#include <ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp>
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/cc_ht_map_.hpp
* Contains an implementation class for cc_ht_map_.
*/
#include <utility>
#include <iterator>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#ifdef PB_DS_HT_MAP_TRACE_
#include <iostream>
#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_CC_HASH_NAME cc_ht_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_CC_HASH_NAME cc_ht_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Hash_Fn, \
typename Eq_Fn, typename _Alloc, bool Store_Hash, \
typename Comb_Hash_Fn, typename Resize_Policy>
#define PB_DS_CLASS_C_DEC \
PB_DS_CC_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \
Store_Hash, Comb_Hash_Fn, Resize_Policy>
#define PB_DS_HASH_EQ_FN_C_DEC \
hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
#define PB_DS_RANGED_HASH_FN_C_DEC \
ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, Store_Hash>
#define PB_DS_CC_HASH_TRAITS_BASE \
types_traits<Key, Mapped, _Alloc, Store_Hash>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, Eq_Fn, \
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
/**
* A collision-chaining hash-based container.
*
*
* @ingroup hash-detail
*
* @tparam Key Key type.
*
* @tparam Mapped Map type.
*
* @tparam Hash_Fn Hashing functor.
* Default is __gnu_cxx::hash.
*
* @tparam Eq_Fn Equal functor.
* Default std::equal_to<Key>
*
* @tparam _Alloc Allocator type.
*
* @tparam Store_Hash If key type stores extra metadata.
* Defaults to false.
*
* @tparam Comb_Hash_Fn Combining hash functor.
* If Hash_Fn is not null_type, then this
* is the ranged-hash functor; otherwise,
* this is the range-hashing functor.
* XXX(See Design::Hash-Based Containers::Hash Policies.)
* Default direct_mask_range_hashing.
*
* @tparam Resize_Policy Resizes hash.
* Defaults to hash_standard_resize_policy,
* using hash_exponential_size_policy and
* hash_load_check_resize_trigger.
*
*
* Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_hash_fn,
* detail::types_traits. (Optional: detail::debug_map_base.)
*/
template<typename Key,
typename Mapped,
typename Hash_Fn,
typename Eq_Fn,
typename _Alloc,
bool Store_Hash,
typename Comb_Hash_Fn,
typename Resize_Policy >
class PB_DS_CC_HASH_NAME:
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy,
public PB_DS_RANGED_HASH_FN_C_DEC,
public PB_DS_CC_HASH_TRAITS_BASE
{
private:
typedef PB_DS_CC_HASH_TRAITS_BASE traits_base;
typedef typename traits_base::comp_hash comp_hash;
typedef typename traits_base::value_type value_type_;
typedef typename traits_base::pointer pointer_;
typedef typename traits_base::const_pointer const_pointer_;
typedef typename traits_base::reference reference_;
typedef typename traits_base::const_reference const_reference_;
struct entry : public traits_base::stored_data_type
{
typename _Alloc::template rebind<entry>::other::pointer m_p_next;
};
typedef cond_dealtor<entry, _Alloc> cond_dealtor_t;
typedef typename _Alloc::template rebind<entry>::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
typedef typename entry_allocator::const_pointer const_entry_pointer;
typedef typename entry_allocator::reference entry_reference;
typedef typename entry_allocator::const_reference const_entry_reference;
typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator;
typedef typename entry_pointer_allocator::pointer entry_pointer_array;
typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base;
typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
typedef Resize_Policy resize_base;
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif
#define PB_DS_GEN_POS std::pair<entry_pointer, typename _Alloc::size_type>
#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
#undef PB_DS_GEN_POS
public:
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef Hash_Fn hash_fn;
typedef Eq_Fn eq_fn;
typedef Comb_Hash_Fn comb_hash_fn;
typedef Resize_Policy resize_policy;
/// Value stores hash, true or false.
enum
{
store_hash = Store_Hash
};
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
typedef typename traits_base::mapped_const_reference mapped_const_reference;
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
typedef typename traits_base::reference reference;
typedef typename traits_base::const_reference const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef point_iterator_ point_iterator;
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
typedef point_const_iterator_ point_iterator;
#endif
typedef point_const_iterator_ point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef iterator_ iterator;
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
typedef const_iterator_ iterator;
#endif
typedef const_iterator_ const_iterator;
PB_DS_CC_HASH_NAME();
PB_DS_CC_HASH_NAME(const Hash_Fn&);
PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&);
PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);
PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&,
const Resize_Policy&);
PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC&);
virtual
~PB_DS_CC_HASH_NAME();
void
swap(PB_DS_CLASS_C_DEC&);
template<typename It>
void
copy_from_range(It, It);
void
initialize();
inline size_type
size() const;
inline size_type
max_size() const;
/// True if size() == 0.
inline bool
empty() const;
/// Return current hash_fn.
Hash_Fn&
get_hash_fn();
/// Return current const hash_fn.
const Hash_Fn&
get_hash_fn() const;
/// Return current eq_fn.
Eq_Fn&
get_eq_fn();
/// Return current const eq_fn.
const Eq_Fn&
get_eq_fn() const;
/// Return current comb_hash_fn.
Comb_Hash_Fn&
get_comb_hash_fn();
/// Return current const comb_hash_fn.
const Comb_Hash_Fn&
get_comb_hash_fn() const;
/// Return current resize_policy.
Resize_Policy&
get_resize_policy();
/// Return current const resize_policy.
const Resize_Policy&
get_resize_policy() const;
inline std::pair<point_iterator, bool>
insert(const_reference r_val)
{ return insert_imp(r_val, traits_base::m_store_extra_indicator); }
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
return (subscript_imp(r_key, traits_base::m_store_extra_indicator));
#else
insert(r_key);
return traits_base::s_null_type;
#endif
}
inline point_iterator
find(key_const_reference);
inline point_const_iterator
find(key_const_reference) const;
inline point_iterator
find_end();
inline point_const_iterator
find_end() const;
inline bool
erase(key_const_reference);
template<typename Pred>
inline size_type
erase_if(Pred);
void
clear();
inline iterator
begin();
inline const_iterator
begin() const;
inline iterator
end();
inline const_iterator
end() const;
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
#endif
#ifdef PB_DS_HT_MAP_TRACE_
void
trace() const;
#endif
private:
void
deallocate_all();
inline bool
do_resize_if_needed();
inline void
do_resize_if_needed_no_throw();
void
resize_imp(size_type);
void
do_resize(size_type);
void
resize_imp_no_exceptions(size_type, entry_pointer_array, size_type);
inline entry_pointer
resize_imp_no_exceptions_reassign_pointer(entry_pointer,
entry_pointer_array,
false_type);
inline entry_pointer
resize_imp_no_exceptions_reassign_pointer(entry_pointer,
entry_pointer_array,
true_type);
void
deallocate_links_in_list(entry_pointer);
inline entry_pointer
get_entry(const_reference, false_type);
inline entry_pointer
get_entry(const_reference, true_type);
inline void
rels_entry(entry_pointer);
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline mapped_reference
subscript_imp(key_const_reference r_key, false_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
const size_type pos = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos];
resize_base::notify_insert_search_start();
while (p_e != 0
&& !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))
{
resize_base::notify_insert_search_collision();
p_e = p_e->m_p_next;
}
resize_base::notify_insert_search_end();
if (p_e != 0)
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return (p_e->m_value.second);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return insert_new_imp(value_type(r_key, mapped_type()), pos)->second;
}
inline mapped_reference
subscript_imp(key_const_reference r_key, true_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_insert_search_start();
while (p_e != 0 &&
!hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash,
r_key, pos_hash_pair.second))
{
resize_base::notify_insert_search_collision();
p_e = p_e->m_p_next;
}
resize_base::notify_insert_search_end();
if (p_e != 0)
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return p_e->m_value.second;
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return insert_new_imp(value_type(r_key, mapped_type()),
pos_hash_pair)->second;
}
#endif
inline std::pair<point_iterator, bool>
insert_imp(const_reference, false_type);
inline std::pair<point_iterator, bool>
insert_imp(const_reference, true_type);
inline pointer
insert_new_imp(const_reference r_val, size_type pos)
{
if (do_resize_if_needed())
pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
// Following lines might throw an exception.
entry_pointer p_e = get_entry(r_val,
traits_base::m_no_throw_copies_indicator);
// At this point no exceptions can be thrown.
p_e->m_p_next = m_entries[pos];
m_entries[pos] = p_e;
resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return &p_e->m_value;
}
inline pointer
insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)
{
// Following lines might throw an exception.
if (do_resize_if_needed())
r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
entry_pointer p_e = get_entry(r_val,
traits_base::m_no_throw_copies_indicator);
// At this point no exceptions can be thrown.
p_e->m_hash = r_pos_hash_pair.second;
p_e->m_p_next = m_entries[r_pos_hash_pair.first];
m_entries[r_pos_hash_pair.first] = p_e;
resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return &p_e->m_value;
}
inline pointer
find_key_pointer(key_const_reference r_key, false_type)
{
entry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];
resize_base::notify_find_search_start();
while (p_e != 0 &&
!hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
resize_base::notify_find_search_collision();
p_e = p_e->m_p_next;
}
resize_base::notify_find_search_end();
#ifdef _GLIBCXX_DEBUG
if (p_e == 0)
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
else
PB_DS_CHECK_KEY_EXISTS(r_key)
#endif
return &p_e->m_value;
}
inline pointer
find_key_pointer(key_const_reference r_key, true_type)
{
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_find_search_start();
while (p_e != 0 &&
!hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
p_e->m_hash,
r_key, pos_hash_pair.second))
{
resize_base::notify_find_search_collision();
p_e = p_e->m_p_next;
}
resize_base::notify_find_search_end();
#ifdef _GLIBCXX_DEBUG
if (p_e == 0)
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
else
PB_DS_CHECK_KEY_EXISTS(r_key)
#endif
return &p_e->m_value;
}
inline bool
erase_in_pos_imp(key_const_reference, size_type);
inline bool
erase_in_pos_imp(key_const_reference, const comp_hash&);
inline void
erase_entry_pointer(entry_pointer&);
#ifdef PB_DS_DATA_TRUE_INDICATOR
void
inc_it_state(pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
inc_it_state((mapped_const_pointer& )r_p_value, r_pos);
}
#endif
void
inc_it_state(const_pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
_GLIBCXX_DEBUG_ASSERT(r_p_value != 0);
r_pos.first = r_pos.first->m_p_next;
if (r_pos.first != 0)
{
r_p_value = &r_pos.first->m_value;
return;
}
for (++r_pos.second; r_pos.second < m_num_e; ++r_pos.second)
if (m_entries[r_pos.second] != 0)
{
r_pos.first = m_entries[r_pos.second];
r_p_value = &r_pos.first->m_value;
return;
}
r_p_value = 0;
}
void
get_start_it_state(pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
for (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)
if (m_entries[r_pos.second] != 0)
{
r_pos.first = m_entries[r_pos.second];
r_p_value = &r_pos.first->m_value;
return;
}
r_p_value = 0;
}
#ifdef _GLIBCXX_DEBUG
void
assert_entry_pointer_array_valid(const entry_pointer_array,
const char*, int) const;
void
assert_entry_pointer_valid(const entry_pointer, true_type,
const char*, int) const;
void
assert_entry_pointer_valid(const entry_pointer, false_type,
const char*, int) const;
#endif
#ifdef PB_DS_HT_MAP_TRACE_
void
trace_list(const_entry_pointer) const;
#endif
private:
#ifdef PB_DS_DATA_TRUE_INDICATOR
friend class iterator_;
#endif
friend class const_iterator_;
static entry_allocator s_entry_allocator;
static entry_pointer_allocator s_entry_pointer_allocator;
static iterator s_end_it;
static const_iterator s_const_end_it;
static point_iterator s_find_end_it;
static point_const_iterator s_const_find_end_it;
size_type m_num_e;
size_type m_num_used_e;
entry_pointer_array m_entries;
enum
{
store_hash_ok = !Store_Hash
|| !is_same<Hash_Fn, __gnu_pbds::null_type>::value
};
PB_DS_STATIC_ASSERT(sth, store_hash_ok);
};
#include <ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_HASH_FN_C_DEC
#undef PB_DS_CC_HASH_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_CC_HASH_NAME
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/policy_access_fn_imps.hpp
* Contains implementations of cc_ht_map_'s policy access
* functions.
*/
PB_DS_CLASS_T_DEC
Hash_Fn&
PB_DS_CLASS_C_DEC::
get_hash_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Hash_Fn&
PB_DS_CLASS_C_DEC::
get_hash_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Eq_Fn&
PB_DS_CLASS_C_DEC::
get_eq_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Eq_Fn&
PB_DS_CLASS_C_DEC::
get_eq_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Comb_Hash_Fn&
PB_DS_CLASS_C_DEC::
get_comb_hash_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Comb_Hash_Fn&
PB_DS_CLASS_C_DEC::
get_comb_hash_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Resize_Policy&
PB_DS_CLASS_C_DEC::
get_resize_policy()
{ return *this; }
PB_DS_CLASS_T_DEC
const Resize_Policy&
PB_DS_CLASS_C_DEC::
get_resize_policy() const
{ return *this; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/insert_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s insert related functions,
* when the hash value is stored.
*/
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, true_type)
{
PB_DS_ASSERT_VALID((*this))
key_const_reference key = PB_DS_V2F(r_val);
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_insert_search_start();
while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
p_e->m_hash,
key, pos_hash_pair.second))
{
resize_base::notify_insert_search_collision();
p_e = p_e->m_p_next;
}
resize_base::notify_insert_search_end();
if (p_e != 0)
{
PB_DS_CHECK_KEY_EXISTS(key)
return std::make_pair(&p_e->m_value, false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)
return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/trace_fn_imps.hpp
* Contains implementations of cc_ht_map_'s trace-mode functions.
*/
#ifdef PB_DS_HT_MAP_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << static_cast<unsigned long>(m_num_e) << " "
<< static_cast<unsigned long>(m_num_used_e) << std::endl;
for (size_type i = 0; i < m_num_e; ++i)
{
std::cerr << static_cast<unsigned long>(i) << " ";
trace_list(m_entries[i]);
std::cerr << std::endl;
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace_list(const_entry_pointer p_l) const
{
size_type iterated_num_used_e = 0;
while (p_l != 0)
{
std::cerr << PB_DS_V2F(p_l->m_value) << " ";
p_l = p_l->m_p_next;
}
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/constructor_destructor_fn_imps.hpp
* Contains implementations of cc_ht_map_'s constructors, destructor,
* and related functions.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::entry_allocator
PB_DS_CLASS_C_DEC::s_entry_allocator;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::entry_pointer_allocator
PB_DS_CLASS_C_DEC::s_entry_pointer_allocator;
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
insert(*(first_it++));
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CC_HASH_NAME() :
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1)),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn) :
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :
PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
std::fill(m_entries, m_entries + m_num_e, (entry_pointer)0);
Resize_Policy::notify_cleared();
ranged_hash_fn_base::notify_resized(m_num_e);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Hash_Fn& r_comb_hash_fn) :
PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, r_comb_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Hash_Fn& r_comb_hash_fn,
const Resize_Policy& r_resize_policy) :
PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
Resize_Policy(r_resize_policy),
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, r_comb_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC& other) :
PB_DS_HASH_EQ_FN_C_DEC(other),
resize_base(other), ranged_hash_fn_base(other),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
__try
{
copy_from_range(other.begin(), other.end());
}
__catch(...)
{
deallocate_all();
__throw_exception_again;
}
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~PB_DS_CC_HASH_NAME()
{ deallocate_all(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
std::swap(m_entries, other.m_entries);
std::swap(m_num_e, other.m_num_e);
std::swap(m_num_used_e, other.m_num_used_e);
ranged_hash_fn_base::swap(other);
hash_eq_fn_base::swap(other);
resize_base::swap(other);
_GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
deallocate_all()
{
clear();
s_entry_pointer_allocator.deallocate(m_entries, m_num_e);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{
std::fill(m_entries, m_entries + m_num_e, entry_pointer(0));
Resize_Policy::notify_resized(m_num_e);
Resize_Policy::notify_cleared();
ranged_hash_fn_base::notify_resized(m_num_e);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/size_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container size related
* functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{ return m_num_used_e; }
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return (size() == 0); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{ return s_entry_allocator.max_size(); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s constructors, destructor,
* and related functions.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
constructor_insert_new_imp(mapped_const_reference r_val, size_type pos,
false_type)
{
// Following lines might throw an exception.
entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);
// At this point no exceptions can be thrown.
p->m_p_next = m_entries[pos];
m_entries[pos] = p;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/debug_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_entry_pointer_valid(const entry_pointer p_e, true_type,
const char* __file, int __line) const
{
debug_base::check_key_exists(PB_DS_V2F(p_e->m_value), __file, __line);
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));
PB_DS_DEBUG_VERIFY(p_e->m_hash == pos_hash_pair.second);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/iterators_fn_imps.hpp
* Contains implementations of cc_ht_map_'s iterators related functions, e.g.,
* begin().
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::s_end_it;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::s_const_end_it;
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
pointer p_value;
std::pair<entry_pointer, size_type> pos;
get_start_it_state(p_value, pos);
return iterator(p_value, pos, this);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{ return s_end_it; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
pointer p_value;
std::pair<entry_pointer, size_type> pos;
get_start_it_state(p_value, pos);
return const_iterator(p_value, pos, this);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{ return s_const_end_it; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s constructors, destructor,
* and related functions.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
constructor_insert_new_imp(const_reference r_val, size_type pos, true_type)
{
// Following lines might throw an exception.
entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);
// At this point no exceptions can be thrown.
p->m_p_next = m_entries[pos];
p->m_hash = ranged_hash_fn_base::operator()((key_const_reference)(PB_DS_V2F(p->m_value))).second;
m_entries[pos] = p;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_entry_pointer_valid(const entry_pointer p, false_type,
const char* __file, int __line) const
{ debug_base::check_key_exists(PB_DS_V2F(p->m_value), __file, __line); }
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/find_fn_imps.hpp
* Contains implementations of cc_ht_map_'s find related functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key,
traits_base::m_store_extra_indicator);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find_end()
{ return 0; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find_end() const
{ return 0; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/cmp_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container comparison related
* functions.
*/
PB_DS_CLASS_T_DEC
template<typename Other_HT_Map_Type>
bool
PB_DS_CLASS_C_DEC::
operator==(const Other_HT_Map_Type& other) const
{ return cmp_with_other(other); }
PB_DS_CLASS_T_DEC
template<typename Other_Map_Type>
bool
PB_DS_CLASS_C_DEC::
cmp_with_other(const Other_Map_Type& other) const
{
if (size() != other.size())
return false;
for (typename Other_Map_Type::const_iterator it = other.begin();
it != other.end(); ++it)
{
key_const_reference r_key = key_const_reference(PB_DS_V2F(*it));
mapped_const_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
if (p_mapped_value == 0)
return false;
#ifdef PB_DS_DATA_TRUE_INDICATOR
if (p_mapped_value->second != it->second)
return false;
#endif
}
return true;
}
PB_DS_CLASS_T_DEC
template<typename Other_HT_Map_Type>
bool
PB_DS_CLASS_C_DEC::
operator!=(const Other_HT_Map_Type& other) const
{ return !operator==(other); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/resize_fn_imps.hpp
* Contains implementations of cc_ht_map_'s resize related functions.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
do_resize_if_needed()
{
if (!resize_base::is_resize_needed())
return false;
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
return true;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
do_resize(size_type len)
{ resize_imp(resize_base::get_nearest_larger_size(len)); }
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
do_resize_if_needed_no_throw()
{
if (!resize_base::is_resize_needed())
return;
__try
{
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
}
__catch(...)
{ }
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
resize_imp(size_type new_size)
{
PB_DS_ASSERT_VALID((*this))
if (new_size == m_num_e)
return;
const size_type old_size = m_num_e;
entry_pointer_array a_p_entries_resized;
// Following line might throw an exception.
ranged_hash_fn_base::notify_resized(new_size);
__try
{
// Following line might throw an exception.
a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size);
m_num_e = new_size;
}
__catch(...)
{
ranged_hash_fn_base::notify_resized(old_size);
__throw_exception_again;
}
// At this point no exceptions can be thrown.
resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size);
Resize_Policy::notify_resized(new_size);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
resize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size)
{
std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e,
entry_pointer(0));
for (size_type pos = 0; pos < old_size; ++pos)
{
entry_pointer p_e = m_entries[pos];
while (p_e != 0)
p_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator);
}
m_num_e = new_size;
_GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized,
__FILE__, __LINE__);)
s_entry_pointer_allocator.deallocate(m_entries, old_size);
m_entries = a_p_entries_resized;
PB_DS_ASSERT_VALID((*this))
}
#include <ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp>
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
* Contains a conditional key destructor, used for exception handling.
*/
namespace __gnu_pbds
{
namespace detail
{
/// Conditional dey destructor, cc_hash.
template<typename HT_Map>
class cond_dealtor
{
public:
typedef typename HT_Map::entry entry;
typedef typename HT_Map::entry_allocator entry_allocator;
typedef typename HT_Map::key_type key_type;
cond_dealtor(entry_allocator* p_a, entry* p_e)
: m_p_a(p_a), m_p_e(p_e), m_key_destruct(false),
m_no_action_destructor(false)
{ }
inline
~cond_dealtor();
void
set_key_destruct()
{ m_key_destruct = true; }
void
set_no_action_destructor()
{ m_no_action_destructor = true; }
protected:
entry_allocator* const m_p_a;
entry* const m_p_e;
bool m_key_destruct;
bool m_no_action_destructor;
};
template<typename HT_Map>
inline
cond_dealtor<HT_Map>::
~cond_dealtor()
{
if (m_no_action_destructor)
return;
if (m_key_destruct)
m_p_e->m_value.first.~key_type();
m_p_a->deallocate(m_p_e, 1);
}
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/info_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container info related
* functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{ return m_num_used_e; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{ return m_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return (size() == 0); }
PB_DS_CLASS_T_DEC
template<typename Other_HT_Map_Type>
bool
PB_DS_CLASS_C_DEC::
operator==(const Other_HT_Map_Type& other) const
{ return cmp_with_other(other); }
PB_DS_CLASS_T_DEC
template<typename Other_Map_Type>
bool
PB_DS_CLASS_C_DEC::
cmp_with_other(const Other_Map_Type& other) const
{
if (size() != other.size())
return false;
for (typename Other_Map_Type::const_iterator it = other.begin();
it != other.end(); ++it)
{
key_const_reference r_key =(key_const_reference)PB_DS_V2F(*it);
mapped_const_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
if (p_mapped_value == 0)
return false;
#ifdef PB_DS_DATA_TRUE_INDICATOR
if (p_mapped_value->second != it->second)
return false;
#endif
}
return true;
}
PB_DS_CLASS_T_DEC
template<typename Other_HT_Map_Type>
bool
PB_DS_CLASS_C_DEC::
operator!=(const Other_HT_Map_Type& other) const
{ return !operator==(other); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file cc_hash_table_map_/find_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s find related functions,
* when the hash value is stored.
*/
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file detail/cond_dealtor.hpp
* Contains a conditional deallocator.
*/
#ifndef PB_DS_COND_DEALTOR_HPP
#define PB_DS_COND_DEALTOR_HPP
namespace __gnu_pbds
{
namespace detail
{
/// Conditional deallocate constructor argument.
template<typename Entry, typename _Alloc>
class cond_dealtor
{
typedef typename _Alloc::template rebind<Entry> __rebind_e;
public:
typedef typename __rebind_e::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
cond_dealtor(entry_pointer p_e)
: m_p_e(p_e), m_no_action_destructor(false) { }
~cond_dealtor()
{
if (m_no_action_destructor)
return;
s_alloc.deallocate(m_p_e, 1);
}
void
set_no_action()
{ m_no_action_destructor = true; }
private:
entry_pointer m_p_e;
bool m_no_action_destructor;
static entry_allocator s_alloc;
};
template<typename Entry, class _Alloc>
typename cond_dealtor<Entry, _Alloc>::entry_allocator
cond_dealtor<Entry, _Alloc>::s_alloc;
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_COND_DEALTOR_HPP
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s resize related functions, when the
* hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
false_type)
{
key_const_reference r_key = PB_DS_V2F(p_e->m_value);
size_type hash = ranged_probe_fn_base::operator()(r_key);
size_type i;
for (i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
entry_pointer p_new_e = a_entries_resized + pos;
switch(p_new_e->m_stat)
{
case empty_entry_status:
new (&p_new_e->m_value) value_type(p_e->m_value);
p_new_e->m_stat = valid_entry_status;
return;
case erased_entry_status:
_GLIBCXX_DEBUG_ASSERT(0);
break;
case valid_entry_status:
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
}
__throw_insert_error();
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s insert related functions,
* when the hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
find_ins_pos(key_const_reference r_key, false_type)
{
size_type hash = ranged_probe_fn_base::operator()(r_key);
size_type i;
/* The insertion position is initted to a non-legal value to indicate
* that it has not been initted yet.
*/
size_type ins_pos = m_num_e;
resize_base::notify_insert_search_start();
for (i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
_GLIBCXX_DEBUG_ASSERT(pos < m_num_e);
entry* const p_e = m_entries + pos;
switch(p_e->m_stat)
{
case empty_entry_status:
{
resize_base::notify_insert_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return (ins_pos == m_num_e) ? pos : ins_pos;
}
break;
case erased_entry_status:
if (ins_pos == m_num_e)
ins_pos = pos;
break;
case valid_entry_status:
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
resize_base::notify_insert_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
return pos;
}
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
resize_base::notify_insert_search_collision();
}
resize_base::notify_insert_search_end();
if (ins_pos == m_num_e)
__throw_insert_error();
return ins_pos;
}
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, false_type)
{
key_const_reference r_key = PB_DS_V2F(r_val);
const size_type pos = find_ins_pos(r_key,
traits_base::m_store_extra_indicator);
if (m_entries[pos].m_stat == valid_entry_status)
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return std::make_pair(&(m_entries + pos)->m_value, false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return std::make_pair(insert_new_imp(r_val, pos), true);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/erase_fn_imps.hpp
* Contains implementations of gp_ht_map_'s erase related functions.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
erase_entry(entry_pointer p_e)
{
_GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status);
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_e->m_value));)
p_e->m_value.~value_type();
p_e->m_stat = erased_entry_status;
_GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);
resize_base::notify_erased(--m_num_used_e);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
for (size_type pos = 0; pos < m_num_e; ++pos)
{
entry_pointer p_e = &m_entries[pos];
if (p_e->m_stat == valid_entry_status)
erase_entry(p_e);
}
do_resize_if_needed_no_throw();
resize_base::notify_cleared();
}
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
size_type num_ersd = 0;
for (size_type pos = 0; pos < m_num_e; ++pos)
{
entry_pointer p_e = &m_entries[pos];
if (p_e->m_stat == valid_entry_status)
if (pred(p_e->m_value))
{
++num_ersd;
erase_entry(p_e);
}
}
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
return num_ersd;
}
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{ return erase_imp(r_key, traits_base::m_store_extra_indicator); }
#include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp>
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/erase_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s erase related functions,
* when the hash value is stored.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase_imp(key_const_reference r_key, true_type)
{
const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
size_type i;
resize_base::notify_erase_search_start();
for (i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);
entry* const p_e = m_entries + pos;
switch(p_e->m_stat)
{
case empty_entry_status:
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return false;
}
break;
case valid_entry_status:
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
r_key, pos_hash_pair.second))
{
resize_base::notify_erase_search_end();
erase_entry(p_e);
do_resize_if_needed_no_throw();
return true;
}
break;
case erased_entry_status:
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
resize_base::notify_erase_search_collision();
}
resize_base::notify_erase_search_end();
return false;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/debug_fn_imps.hpp
* Contains implementations of gp_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
debug_base::check_size(m_num_used_e, __file, __line);
assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator,
__file, __line);
}
#include <ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp>
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s erase related functions,
* when the hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
erase_imp(key_const_reference r_key, false_type)
{
PB_DS_ASSERT_VALID((*this))
size_type hash = ranged_probe_fn_base::operator()(r_key);
size_type i;
resize_base::notify_erase_search_start();
for (i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
entry* const p_e = m_entries + pos;
switch(p_e->m_stat)
{
case empty_entry_status:
{
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return false;
}
break;
case valid_entry_status:
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
resize_base::notify_erase_search_end();
erase_entry(p_e);
do_resize_if_needed_no_throw();
return true;
}
break;
case erased_entry_status:
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
resize_base::notify_erase_search_collision();
}
resize_base::notify_erase_search_end();
return false;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/resize_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s resize related functions, when the
* hash value is stored.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
true_type)
{
key_const_reference r_key = PB_DS_V2F(p_e->m_value);
size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash);
size_type i;
for (i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
entry_pointer p_new_e = a_entries_resized + pos;
switch(p_new_e->m_stat)
{
case empty_entry_status:
new (&p_new_e->m_value) value_type(p_e->m_value);
p_new_e->m_hash = hash;
p_new_e->m_stat = valid_entry_status;
return;
case erased_entry_status:
_GLIBCXX_DEBUG_ASSERT(0);
break;
case valid_entry_status:
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
}
__throw_insert_error();
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/gp_ht_map_.hpp
* Contains an implementation class for general probing hash.
*/
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
#include <utility>
#ifdef PB_DS_HT_MAP_TRACE_
#include <iostream>
#endif
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_GP_HASH_NAME gp_ht_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_GP_HASH_NAME gp_ht_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, \
typename Probe_Fn, typename Resize_Policy>
#define PB_DS_CLASS_C_DEC \
PB_DS_GP_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \
Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
#define PB_DS_HASH_EQ_FN_C_DEC \
hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
#define PB_DS_RANGED_PROBE_FN_C_DEC \
ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, Store_Hash>
#define PB_DS_GP_HASH_TRAITS_BASE \
types_traits<Key, Mapped, _Alloc, Store_Hash>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, Eq_Fn, \
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
/**
* A general-probing hash-based container.
*
*
* @ingroup hash-detail
*
* @tparam Key Key type.
*
* @tparam Mapped Map type.
*
* @tparam Hash_Fn Hashing functor.
* Default is __gnu_cxx::hash.
*
* @tparam Eq_Fn Equal functor.
* Default std::equal_to<Key>
*
* @tparam _Alloc Allocator type.
*
* @tparam Store_Hash If key type stores extra metadata.
* Defaults to false.
*
* @tparam Comb_Probe_Fn Combining probe functor.
* If Hash_Fn is not null_type, then this
* is the ranged-probe functor; otherwise,
* this is the range-hashing functor.
* XXX See Design::Hash-Based Containers::Hash Policies.
* Default direct_mask_range_hashing.
*
* @tparam Probe_Fn Probe functor.
* Defaults to linear_probe_fn,
* also quadratic_probe_fn.
*
* @tparam Resize_Policy Resizes hash.
* Defaults to hash_standard_resize_policy,
* using hash_exponential_size_policy and
* hash_load_check_resize_trigger.
*
*
* Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_probe_fn,
* detail::types_traits. (Optional: detail::debug_map_base.)
*/
template<typename Key,
typename Mapped,
typename Hash_Fn,
typename Eq_Fn,
typename _Alloc,
bool Store_Hash,
typename Comb_Probe_Fn,
typename Probe_Fn,
typename Resize_Policy>
class PB_DS_GP_HASH_NAME :
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy,
public PB_DS_RANGED_PROBE_FN_C_DEC,
public PB_DS_GP_HASH_TRAITS_BASE
{
private:
typedef PB_DS_GP_HASH_TRAITS_BASE traits_base;
typedef typename traits_base::value_type value_type_;
typedef typename traits_base::pointer pointer_;
typedef typename traits_base::const_pointer const_pointer_;
typedef typename traits_base::reference reference_;
typedef typename traits_base::const_reference const_reference_;
typedef typename traits_base::comp_hash comp_hash;
enum entry_status
{
empty_entry_status,
valid_entry_status,
erased_entry_status
} __attribute__ ((__packed__));
struct entry : public traits_base::stored_data_type
{
entry_status m_stat;
};
typedef typename _Alloc::template rebind<entry>::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
typedef typename entry_allocator::const_pointer const_entry_pointer;
typedef typename entry_allocator::reference entry_reference;
typedef typename entry_allocator::const_reference const_entry_reference;
typedef typename entry_allocator::pointer entry_array;
typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif
typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
typedef Resize_Policy resize_base;
#define PB_DS_GEN_POS typename _Alloc::size_type
#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
#undef PB_DS_GEN_POS
public:
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef Hash_Fn hash_fn;
typedef Eq_Fn eq_fn;
typedef Probe_Fn probe_fn;
typedef Comb_Probe_Fn comb_probe_fn;
typedef Resize_Policy resize_policy;
/// Value stores hash, true or false.
enum
{
store_hash = Store_Hash
};
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
typedef typename traits_base::mapped_const_reference mapped_const_reference;
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
typedef typename traits_base::reference reference;
typedef typename traits_base::const_reference const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef point_iterator_ point_iterator;
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
typedef point_const_iterator_ point_iterator;
#endif
typedef point_const_iterator_ point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef iterator_ iterator;
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
typedef const_iterator_ iterator;
#endif
typedef const_iterator_ const_iterator;
PB_DS_GP_HASH_NAME();
PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC&);
PB_DS_GP_HASH_NAME(const Hash_Fn&);
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&);
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
const Probe_Fn&);
PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
const Probe_Fn&, const Resize_Policy&);
template<typename It>
void
copy_from_range(It, It);
virtual
~PB_DS_GP_HASH_NAME();
void
swap(PB_DS_CLASS_C_DEC&);
inline size_type
size() const;
inline size_type
max_size() const;
/// True if size() == 0.
inline bool
empty() const;
/// Return current hash_fn.
Hash_Fn&
get_hash_fn();
/// Return current const hash_fn.
const Hash_Fn&
get_hash_fn() const;
/// Return current eq_fn.
Eq_Fn&
get_eq_fn();
/// Return current const eq_fn.
const Eq_Fn&
get_eq_fn() const;
/// Return current probe_fn.
Probe_Fn&
get_probe_fn();
/// Return current const probe_fn.
const Probe_Fn&
get_probe_fn() const;
/// Return current comb_probe_fn.
Comb_Probe_Fn&
get_comb_probe_fn();
/// Return current const comb_probe_fn.
const Comb_Probe_Fn&
get_comb_probe_fn() const;
/// Return current resize_policy.
Resize_Policy&
get_resize_policy();
/// Return current const resize_policy.
const Resize_Policy&
get_resize_policy() const;
inline std::pair<point_iterator, bool>
insert(const_reference r_val)
{
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);)
return insert_imp(r_val, traits_base::m_store_extra_indicator);
}
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
return subscript_imp(r_key, traits_base::m_store_extra_indicator);
#else
insert(r_key);
return traits_base::s_null_type;
#endif
}
inline point_iterator
find(key_const_reference);
inline point_const_iterator
find(key_const_reference) const;
inline point_iterator
find_end();
inline point_const_iterator
find_end() const;
inline bool
erase(key_const_reference);
template<typename Pred>
inline size_type
erase_if(Pred);
void
clear();
inline iterator
begin();
inline const_iterator
begin() const;
inline iterator
end();
inline const_iterator
end() const;
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
#endif
#ifdef PB_DS_HT_MAP_TRACE_
void
trace() const;
#endif
private:
#ifdef PB_DS_DATA_TRUE_INDICATOR
friend class iterator_;
#endif
friend class const_iterator_;
void
deallocate_all();
void
initialize();
void
erase_all_valid_entries(entry_array, size_type);
inline bool
do_resize_if_needed();
inline void
do_resize_if_needed_no_throw();
void
resize_imp(size_type);
virtual void
do_resize(size_type);
void
resize_imp(entry_array, size_type);
inline void
resize_imp_reassign(entry_pointer, entry_array, false_type);
inline void
resize_imp_reassign(entry_pointer, entry_array, true_type);
inline size_type
find_ins_pos(key_const_reference, false_type);
inline comp_hash
find_ins_pos(key_const_reference, true_type);
inline std::pair<point_iterator, bool>
insert_imp(const_reference, false_type);
inline std::pair<point_iterator, bool>
insert_imp(const_reference, true_type);
inline pointer
insert_new_imp(const_reference r_val, size_type pos)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
if (do_resize_if_needed())
pos = find_ins_pos(PB_DS_V2F(r_val),
traits_base::m_store_extra_indicator);
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
entry* const p_e = m_entries + pos;
new (&p_e->m_value) value_type(r_val);
p_e->m_stat = valid_entry_status;
resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return &p_e->m_value;
}
inline pointer
insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
valid_entry_status);
if (do_resize_if_needed())
r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val),
traits_base::m_store_extra_indicator);
_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
valid_entry_status);
entry* const p_e = m_entries + r_pos_hash_pair.first;
new (&p_e->m_value) value_type(r_val);
p_e->m_hash = r_pos_hash_pair.second;
p_e->m_stat = valid_entry_status;
resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return &p_e->m_value;
}
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline mapped_reference
subscript_imp(key_const_reference key, false_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
const size_type pos = find_ins_pos(key,
traits_base::m_store_extra_indicator);
entry_pointer p_e = &m_entries[pos];
if (p_e->m_stat != valid_entry_status)
return insert_new_imp(value_type(key, mapped_type()), pos)->second;
PB_DS_CHECK_KEY_EXISTS(key)
return p_e->m_value.second;
}
inline mapped_reference
subscript_imp(key_const_reference key, true_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
comp_hash pos_hash_pair = find_ins_pos(key,
traits_base::m_store_extra_indicator);
if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)
return insert_new_imp(value_type(key, mapped_type()),
pos_hash_pair)->second;
PB_DS_CHECK_KEY_EXISTS(key)
return (m_entries + pos_hash_pair.first)->m_value.second;
}
#endif
inline pointer
find_key_pointer(key_const_reference key, false_type)
{
const size_type hash = ranged_probe_fn_base::operator()(key);
resize_base::notify_find_search_start();
// Loop until entry is found or until all possible entries accessed.
for (size_type i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(key,
hash, i);
entry* const p_e = m_entries + pos;
switch (p_e->m_stat)
{
case empty_entry_status:
{
resize_base::notify_find_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)
return 0;
}
break;
case valid_entry_status:
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))
{
resize_base::notify_find_search_end();
PB_DS_CHECK_KEY_EXISTS(key)
return pointer(&p_e->m_value);
}
break;
case erased_entry_status:
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
resize_base::notify_find_search_collision();
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)
resize_base::notify_find_search_end();
return 0;
}
inline pointer
find_key_pointer(key_const_reference key, true_type)
{
comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);
resize_base::notify_find_search_start();
// Loop until entry is found or until all possible entries accessed.
for (size_type i = 0; i < m_num_e; ++i)
{
const size_type pos =
ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);
entry* const p_e = m_entries + pos;
switch(p_e->m_stat)
{
case empty_entry_status:
{
resize_base::notify_find_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)
return 0;
}
break;
case valid_entry_status:
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
p_e->m_hash,
key, pos_hash_pair.second))
{
resize_base::notify_find_search_end();
PB_DS_CHECK_KEY_EXISTS(key)
return pointer(&p_e->m_value);
}
break;
case erased_entry_status:
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
resize_base::notify_find_search_collision();
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)
resize_base::notify_find_search_end();
return 0;
}
inline bool
erase_imp(key_const_reference, true_type);
inline bool
erase_imp(key_const_reference, false_type);
inline void
erase_entry(entry_pointer);
#ifdef PB_DS_DATA_TRUE_INDICATOR
void
inc_it_state(pointer& r_p_value, size_type& r_pos) const
{ inc_it_state((mapped_const_pointer& )r_p_value, r_pos); }
#endif
void
inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
{
_GLIBCXX_DEBUG_ASSERT(r_p_value != 0);
for (++r_pos; r_pos < m_num_e; ++r_pos)
{
const_entry_pointer p_e =& m_entries[r_pos];
if (p_e->m_stat == valid_entry_status)
{
r_p_value =& p_e->m_value;
return;
}
}
r_p_value = 0;
}
void
get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const
{
for (r_pos = 0; r_pos < m_num_e; ++r_pos)
{
const_entry_pointer p_e = &m_entries[r_pos];
if (p_e->m_stat == valid_entry_status)
{
r_p_value = &p_e->m_value;
return;
}
}
r_p_value = 0;
}
void
get_start_it_state(pointer& r_p_value, size_type& r_pos)
{
for (r_pos = 0; r_pos < m_num_e; ++r_pos)
{
entry_pointer p_e = &m_entries[r_pos];
if (p_e->m_stat == valid_entry_status)
{
r_p_value = &p_e->m_value;
return;
}
}
r_p_value = 0;
}
#ifdef _GLIBCXX_DEBUG
void
assert_entry_array_valid(const entry_array, false_type,
const char*, int) const;
void
assert_entry_array_valid(const entry_array, true_type,
const char*, int) const;
#endif
static entry_allocator s_entry_allocator;
static iterator s_end_it;
static const_iterator s_const_end_it;
size_type m_num_e;
size_type m_num_used_e;
entry_pointer m_entries;
enum
{
store_hash_ok = !Store_Hash
|| !is_same<Hash_Fn, __gnu_pbds::null_type>::value
};
PB_DS_STATIC_ASSERT(sth, store_hash_ok);
};
#include <ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp>
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_PROBE_FN_C_DEC
#undef PB_DS_GP_HASH_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
#undef PB_DS_GP_HASH_NAME
} // namespace detail
} // namespace __gnu_pbds
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/insert_fn_imps.hpp
* Contains implementations of gp_ht_map_'s insert related functions.
*/
#include <ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp>
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/policy_access_fn_imps.hpp
* Contains implementations of gp_ht_map_'s policy agpess
* functions.
*/
PB_DS_CLASS_T_DEC
Hash_Fn&
PB_DS_CLASS_C_DEC::
get_hash_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Hash_Fn&
PB_DS_CLASS_C_DEC::
get_hash_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Eq_Fn&
PB_DS_CLASS_C_DEC::
get_eq_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Eq_Fn&
PB_DS_CLASS_C_DEC::
get_eq_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Probe_Fn&
PB_DS_CLASS_C_DEC::
get_probe_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Probe_Fn&
PB_DS_CLASS_C_DEC::
get_probe_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Comb_Probe_Fn&
PB_DS_CLASS_C_DEC::
get_comb_probe_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Comb_Probe_Fn&
PB_DS_CLASS_C_DEC::
get_comb_probe_fn() const
{ return *this; }
PB_DS_CLASS_T_DEC
Resize_Policy&
PB_DS_CLASS_C_DEC::
get_resize_policy()
{ return *this; }
PB_DS_CLASS_T_DEC
const Resize_Policy&
PB_DS_CLASS_C_DEC::
get_resize_policy() const
{ return *this; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/insert_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s find related functions,
* when the hash value is stored.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
find_ins_pos(key_const_reference r_key, true_type)
{
PB_DS_ASSERT_VALID((*this))
comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
size_type i;
/* The insertion position is initted to a non-legal value to indicate
* that it has not been initted yet.
*/
size_type ins_pos = m_num_e;
resize_base::notify_insert_search_start();
for (i = 0; i < m_num_e; ++i)
{
const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);
entry* const p_e = m_entries + pos;
switch(p_e->m_stat)
{
case empty_entry_status:
{
resize_base::notify_insert_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return ((ins_pos == m_num_e) ?
std::make_pair(pos, pos_hash_pair.second) :
std::make_pair(ins_pos, pos_hash_pair.second));
}
break;
case erased_entry_status:
if (ins_pos == m_num_e)
ins_pos = pos;
break;
case valid_entry_status:
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
r_key, pos_hash_pair.second))
{
resize_base::notify_insert_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
return std::make_pair(pos, pos_hash_pair.second);
}
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
resize_base::notify_insert_search_collision();
}
resize_base::notify_insert_search_end();
if (ins_pos == m_num_e)
__throw_insert_error();
return std::make_pair(ins_pos, pos_hash_pair.second);
}
PB_DS_CLASS_T_DEC
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, true_type)
{
key_const_reference r_key = PB_DS_V2F(r_val);
comp_hash pos_hash_pair = find_ins_pos(r_key,
traits_base::m_store_extra_indicator);
_GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e);
entry_pointer p_e =& m_entries[pos_hash_pair.first];
if (p_e->m_stat == valid_entry_status)
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return std::make_pair(&p_e->m_value, false);
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/trace_fn_imps.hpp
* Contains implementations of gp_ht_map_'s trace-mode functions.
*/
#ifdef PB_DS_HT_MAP_TRACE_
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << static_cast<unsigned long>(m_num_e) << " " <<
static_cast<unsigned long>(m_num_used_e) << std::endl;
for (size_type i = 0; i < m_num_e; ++i)
{
std::cerr << static_cast<unsigned long>(i) << " ";
switch(m_entries[i].m_stat)
{
case empty_entry_status:
std::cerr << "<empty>";
break;
case erased_entry_status:
std::cerr << "<erased>";
break;
case valid_entry_status:
std::cerr << PB_DS_V2F(m_entries[i].m_value);
break;
default:
_GLIBCXX_DEBUG_ASSERT(0);
};
std::cerr << std::endl;
}
}
#endif // #ifdef PB_DS_HT_MAP_TRACE_
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s find related functions,
* when the hash value is not stored.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::pointer
PB_DS_CLASS_C_DEC::
find_key_pointer(key_const_reference r_key, false_type)
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/constructor_destructor_fn_imps.hpp
* Contains implementations of gp_ht_map_'s constructors, destructor,
* and related functions.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::entry_allocator
PB_DS_CLASS_C_DEC::s_entry_allocator;
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
insert(*(first_it++));
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME()
: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn)
: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn)
: hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& r_comb_hash_fn)
: hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, r_comb_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober)
: hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, comb_hash_fn, prober),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober,
const Resize_Policy& r_resize_policy)
: hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, comb_hash_fn, prober),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
{
initialize();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(other),
#endif
hash_eq_fn_base(other),
resize_base(other),
ranged_probe_fn_base(other),
m_num_e(other.m_num_e),
m_num_used_e(other.m_num_used_e),
m_entries(s_entry_allocator.allocate(m_num_e))
{
for (size_type i = 0; i < m_num_e; ++i)
m_entries[i].m_stat = (entry_status)empty_entry_status;
__try
{
for (size_type i = 0; i < m_num_e; ++i)
{
m_entries[i].m_stat = other.m_entries[i].m_stat;
if (m_entries[i].m_stat == valid_entry_status)
new (m_entries + i) entry(other.m_entries[i]);
}
}
__catch(...)
{
deallocate_all();
__throw_exception_again;
}
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~PB_DS_GP_HASH_NAME()
{ deallocate_all(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
std::swap(m_num_e, other.m_num_e);
std::swap(m_num_used_e, other.m_num_used_e);
std::swap(m_entries, other.m_entries);
ranged_probe_fn_base::swap(other);
hash_eq_fn_base::swap(other);
resize_base::swap(other);
_GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
deallocate_all()
{
clear();
erase_all_valid_entries(m_entries, m_num_e);
s_entry_allocator.deallocate(m_entries, m_num_e);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase_all_valid_entries(entry_array a_entries_resized, size_type len)
{
for (size_type pos = 0; pos < len; ++pos)
{
entry_pointer p_e = &a_entries_resized[pos];
if (p_e->m_stat == valid_entry_status)
p_e->m_value.~value_type();
}
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
initialize()
{
Resize_Policy::notify_resized(m_num_e);
Resize_Policy::notify_cleared();
ranged_probe_fn_base::notify_resized(m_num_e);
for (size_type i = 0; i < m_num_e; ++i)
m_entries[i].m_stat = empty_entry_status;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s constructors, destructor,
* and related functions.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
constructor_insert_new_imp(mapped_const_reference r_val, size_type pos,
false_type)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status)k;
entry* const p_e = m_entries + pos;
new (&p_e->m_value) mapped_value_type(r_val);
p_e->m_stat = valid_entry_status;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/debug_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_entry_array_valid(const entry_array a_entries, true_type,
const char* __file, int __line) const
{
size_type iterated_num_used_e = 0;
for (size_type pos = 0; pos < m_num_e; ++pos)
{
const_entry_pointer p_e =& a_entries[pos];
switch(p_e->m_stat)
{
case empty_entry_status:
case erased_entry_status:
break;
case valid_entry_status:
{
key_const_reference r_key = PB_DS_V2F(p_e->m_value);
debug_base::check_key_exists(r_key, __file, __line);
const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
PB_DS_DEBUG_VERIFY(p_e->m_hash == pos_hash_pair.second);
++iterated_num_used_e;
break;
}
default:
PB_DS_DEBUG_VERIFY(0);
};
}
PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s constructors, destructor,
* and related functions.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
constructor_insert_new_imp(mapped_const_reference r_val, size_type pos,
true_type)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
entry* const p_e = m_entries + pos;
new (&p_e->m_value) mapped_value_type(r_val);
p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second;
p_e->m_stat = valid_entry_status;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s debug-mode functions.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_entry_array_valid(const entry_array a_entries, false_type,
const char* __file, int __line) const
{
size_type iterated_num_used_e = 0;
for (size_type pos = 0; pos < m_num_e; ++pos)
{
const_entry_pointer p_e = &a_entries[pos];
switch(p_e->m_stat)
{
case empty_entry_status:
case erased_entry_status:
break;
case valid_entry_status:
{
key_const_reference r_key = PB_DS_V2F(p_e->m_value);
debug_base::check_key_exists(r_key, __file, __line);
++iterated_num_used_e;
break;
}
default:
PB_DS_DEBUG_VERIFY(0);
};
}
PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/find_fn_imps.hpp
* Contains implementations of gp_ht_map_'s find related functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
find_end()
{ return 0; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find_end() const
{ return 0; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/resize_fn_imps.hpp
* Contains implementations of gp_ht_map_'s resize related functions.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
do_resize_if_needed()
{
if (!resize_base::is_resize_needed())
return false;
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
return true;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
do_resize(size_type n)
{ resize_imp(resize_base::get_nearest_larger_size(n)); }
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
do_resize_if_needed_no_throw()
{
if (!resize_base::is_resize_needed())
return;
__try
{
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
}
__catch(...)
{ }
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
resize_imp(size_type new_size)
{
#ifdef PB_DS_REGRESSION
typename _Alloc::group_adjustor adjust(m_num_e);
#endif
if (new_size == m_num_e)
return;
PB_DS_ASSERT_VALID((*this))
const size_type old_size = m_num_e;
entry_array a_entries_resized = 0;
// Following line might throw an exception.
a_entries_resized = s_entry_allocator.allocate(new_size);
ranged_probe_fn_base::notify_resized(new_size);
m_num_e = new_size;
for (size_type i = 0; i < m_num_e; ++i)
a_entries_resized[i].m_stat = empty_entry_status;
__try
{
resize_imp(a_entries_resized, old_size);
}
__catch(...)
{
erase_all_valid_entries(a_entries_resized, new_size);
m_num_e = old_size;
s_entry_allocator.deallocate(a_entries_resized, new_size);
ranged_probe_fn_base::notify_resized(old_size);
__throw_exception_again;
}
// At this point no exceptions can be thrown.
_GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized,
traits_base::m_store_extra_indicator,
__FILE__, __LINE__);)
Resize_Policy::notify_resized(new_size);
erase_all_valid_entries(m_entries, old_size);
s_entry_allocator.deallocate(m_entries, old_size);
m_entries = a_entries_resized;
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
resize_imp(entry_array a_entries_resized, size_type old_size)
{
for (size_type pos = 0; pos < old_size; ++pos)
if (m_entries[pos].m_stat == valid_entry_status)
resize_imp_reassign(m_entries + pos, a_entries_resized,
traits_base::m_store_extra_indicator);
}
#include <ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp>
#include <ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp>
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/iterator_fn_imps.hpp
* Contains implementations of gp_ht_map_'s iterators related functions, e.g.,
* begin().
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::s_end_it;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::s_const_end_it;
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
{
pointer_ p_value;
size_type pos;
get_start_it_state(p_value, pos);
return iterator(p_value, pos, this);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
{ return s_end_it; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
{
const_pointer_ p_value;
size_type pos;
get_start_it_state(p_value, pos);
return const_iterator(p_value, pos, this);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
{ return s_const_end_it; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/info_fn_imps.hpp
* Contains implementations of gp_ht_map_'s entire container info related
* functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{ return m_num_used_e; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{ return s_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return (size() == 0); }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file gp_hash_table_map_/find_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s insert related functions,
* when the hash value is stored.
*/
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/erase_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
pop()
{
PB_DS_ASSERT_VALID_COND((*this),true)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
if (m_p_max == 0)
find_max();
_GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
node_pointer p_nd = m_p_max;
remove_parentless_node(m_p_max);
base_type::actual_erase_node(p_nd);
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
remove_parentless_node(node_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
_GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == 0);
node_pointer p_cur_root = p_nd == base_type::m_p_root?
p_nd->m_p_next_sibling : base_type::m_p_root;
if (p_cur_root != 0)
p_cur_root->m_p_prev_or_parent = 0;
if (p_nd->m_p_prev_or_parent != 0)
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
node_pointer p_child = p_nd->m_p_l_child;
if (p_child != 0)
{
p_child->m_p_prev_or_parent = 0;
while (p_child->m_p_next_sibling != 0)
p_child = p_child->m_p_next_sibling;
}
m_p_max = 0;
base_type::m_p_root = join(p_cur_root, p_child);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
clear()
{
base_type::clear();
m_p_max = 0;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
erase(point_iterator it)
{
PB_DS_ASSERT_VALID_COND((*this),true)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
base_type::bubble_to_top(it.m_p_nd);
remove_parentless_node(it.m_p_nd);
base_type::actual_erase_node(it.m_p_nd);
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
}
PB_DS_CLASS_T_DEC
template<typename Pred>
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID_COND((*this),true)
if (base_type::empty())
{
PB_DS_ASSERT_VALID_COND((*this),true)
return 0;
}
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
size_type ersd = 0;
while (p_out != 0)
{
++ersd;
node_pointer p_next = p_out->m_p_next_sibling;
base_type::actual_erase_node(p_out);
p_out = p_next;
}
node_pointer p_cur = base_type::m_p_root;
base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
p_cur->m_metadata = 0;
p_cur->m_p_next_sibling = base_type::m_p_root;
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_cur;
base_type::m_p_root = p_cur;
base_type::m_p_root = fix(base_type::m_p_root);
p_cur = p_next;
}
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
return ersd;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/binomial_heap_base_.hpp
* Contains an implementation class for a base of binomial heaps.
*/
#ifndef PB_DS_BINOMIAL_HEAP_BASE_HPP
#define PB_DS_BINOMIAL_HEAP_BASE_HPP
/*
* Binomial heap base.
* Vuillemin J is the mastah.
* Modified from CLRS.
*/
#include <debug/debug.h>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_B_HEAP_BASE \
left_child_next_sibling_heap<Value_Type, Cmp_Fn, \
typename _Alloc::size_type, _Alloc, false>
#else
#define PB_DS_B_HEAP_BASE \
left_child_next_sibling_heap<Value_Type, Cmp_Fn, \
typename _Alloc::size_type, _Alloc>
#endif
/// Base class for binomial heap.
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class binomial_heap_base
: public PB_DS_B_HEAP_BASE
{
private:
typedef typename _Alloc::template rebind<Value_Type>::other __rebind_v;
typedef PB_DS_B_HEAP_BASE base_type;
protected:
typedef typename base_type::node node;
typedef typename base_type::node_pointer node_pointer;
typedef typename base_type::node_const_pointer node_const_pointer;
public:
typedef Value_Type value_type;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename __rebind_v::pointer pointer;
typedef typename __rebind_v::const_pointer const_pointer;
typedef typename __rebind_v::reference reference;
typedef typename __rebind_v::const_reference const_reference;
typedef typename base_type::point_const_iterator point_const_iterator;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::iterator iterator;
public:
inline point_iterator
push(const_reference);
void
modify(point_iterator, const_reference);
inline const_reference
top() const;
void
pop();
void
erase(point_iterator);
inline void
clear();
template<typename Pred>
size_type
erase_if(Pred);
template<typename Pred>
void
split(Pred, PB_DS_CLASS_C_DEC&);
void
join(PB_DS_CLASS_C_DEC&);
protected:
binomial_heap_base();
binomial_heap_base(const Cmp_Fn&);
binomial_heap_base(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
~binomial_heap_base();
template<typename It>
void
copy_from_range(It, It);
inline void
find_max();
#ifdef _GLIBCXX_DEBUG
void
assert_valid(bool, const char*, int) const;
void
assert_max(const char*, int) const;
#endif
private:
inline node_pointer
fix(node_pointer) const;
inline void
insert_node(node_pointer);
inline void
remove_parentless_node(node_pointer);
inline node_pointer
join(node_pointer, node_pointer) const;
#ifdef _GLIBCXX_DEBUG
void
assert_node_consistent(node_const_pointer, bool, bool,
const char*, int) const;
#endif
protected:
node_pointer m_p_max;
};
#define PB_DS_ASSERT_VALID_COND(X, _StrictlyBinomial) \
_GLIBCXX_DEBUG_ONLY(X.assert_valid(_StrictlyBinomial,__FILE__, __LINE__);)
#define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node, _Bool) \
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool, \
__FILE__, __LINE__);)
#include <ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp>
#undef PB_DS_ASSERT_BASE_NODE_CONSISTENT
#undef PB_DS_ASSERT_VALID_COND
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_B_HEAP_BASE
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/debug_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(bool strictly_binomial, const char* __file, int __line) const
{
base_type::assert_valid(__file, __line);
assert_node_consistent(base_type::m_p_root, strictly_binomial, true,
__file, __line);
assert_max(__file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_max(const char* __file, int __line) const
{
if (m_p_max == 0)
return;
PB_DS_DEBUG_VERIFY(base_type::parent(m_p_max) == 0);
for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(m_p_max->m_value,
it.m_p_nd->m_value));
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_node_consistent(node_const_pointer p_nd, bool strictly_binomial,
bool increasing, const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(increasing || strictly_binomial);
base_type::assert_node_consistent(p_nd, false, __file, __line);
if (p_nd == 0)
return;
PB_DS_DEBUG_VERIFY(p_nd->m_metadata == base_type::degree(p_nd));
PB_DS_DEBUG_VERIFY(base_type::size_under_node(p_nd) ==
static_cast<size_type>(1 << p_nd->m_metadata));
assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing,
__file, __line);
assert_node_consistent(p_nd->m_p_l_child, true, false, __file, __line);
if (p_nd->m_p_next_sibling != 0)
{
if (increasing)
{
if (strictly_binomial)
PB_DS_DEBUG_VERIFY(p_nd->m_metadata
< p_nd->m_p_next_sibling->m_metadata);
else
PB_DS_DEBUG_VERIFY(p_nd->m_metadata
<= p_nd->m_p_next_sibling->m_metadata);
}
else
PB_DS_DEBUG_VERIFY(p_nd->m_metadata
> p_nd->m_p_next_sibling->m_metadata);
}
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/insert_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID_COND((*this),true)
node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
insert_node(p_nd);
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
return point_iterator(p_nd);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
insert_node(node_pointer p_nd)
{
if (base_type::m_p_root == 0)
{
p_nd->m_p_next_sibling = 0;
p_nd->m_p_prev_or_parent = 0;
p_nd->m_p_l_child = 0;
p_nd->m_metadata = 0;
base_type::m_p_root = p_nd;
return;
}
if (base_type::m_p_root->m_metadata > 0)
{
p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;
p_nd->m_p_next_sibling = base_type::m_p_root;
base_type::m_p_root->m_p_prev_or_parent = p_nd;
base_type::m_p_root = p_nd;
p_nd->m_metadata = 0;
return;
}
if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
{
p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling;
p_nd->m_p_prev_or_parent = 0;
p_nd->m_metadata = 1;
p_nd->m_p_l_child = base_type::m_p_root;
base_type::m_p_root->m_p_prev_or_parent = p_nd;
base_type::m_p_root->m_p_next_sibling = 0;
base_type::m_p_root = p_nd;
}
else
{
p_nd->m_p_next_sibling = 0;
p_nd->m_p_l_child = 0;
p_nd->m_p_prev_or_parent = base_type::m_p_root;
p_nd->m_metadata = 0;
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_root->m_p_l_child == 0);
base_type::m_p_root->m_p_l_child = p_nd;
base_type::m_p_root->m_metadata = 1;
}
base_type::m_p_root = fix(base_type::m_p_root);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
fix(node_pointer p_nd) const
{
while (p_nd->m_p_next_sibling != 0 &&
p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata)
{
node_pointer p_next = p_nd->m_p_next_sibling;
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
{
p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
if (p_nd->m_p_prev_or_parent != 0)
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next;
base_type::make_child_of(p_nd, p_next);
++p_next->m_metadata;
p_nd = p_next;
}
else
{
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
if (p_nd->m_p_next_sibling != 0)
p_next->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
++p_nd->m_metadata;
}
}
if (p_nd->m_p_next_sibling != 0)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
return p_nd;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
modify(point_iterator it, const_reference r_new_val)
{
PB_DS_ASSERT_VALID_COND((*this),true)
node_pointer p_nd = it.m_p_nd;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd, false)
const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val);
p_nd->m_value = r_new_val;
if (bubble_up)
{
node_pointer p_parent = base_type::parent(p_nd);
while (p_parent != 0 &&
Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value))
{
base_type::swap_with_parent(p_nd, p_parent);
p_parent = base_type::parent(p_nd);
}
if (p_nd->m_p_prev_or_parent == 0)
base_type::m_p_root = p_nd;
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
return;
}
base_type::bubble_to_top(p_nd);
remove_parentless_node(p_nd);
insert_node(p_nd);
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/split_join_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
PB_DS_CLASS_T_DEC
template<typename Pred>
void
PB_DS_CLASS_C_DEC::
split(Pred pred, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
other.clear();
if (base_type::empty())
{
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
return;
}
base_type::to_linked_list();
node_pointer p_out = base_type::prune(pred);
while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
++other.m_size;
node_pointer p_next = p_out->m_p_next_sibling;
p_out->m_p_l_child = p_out->m_p_prev_or_parent = 0;
p_out->m_metadata = 0;
p_out->m_p_next_sibling = other.m_p_root;
if (other.m_p_root != 0)
other.m_p_root->m_p_prev_or_parent = p_out;
other.m_p_root = p_out;
other.m_p_root = other.fix(other.m_p_root);
p_out = p_next;
}
PB_DS_ASSERT_VALID_COND(other,true)
node_pointer p_cur = base_type::m_p_root;
base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
p_cur->m_metadata = 0;
p_cur->m_p_next_sibling = base_type::m_p_root;
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_cur;
base_type::m_p_root = p_cur;
base_type::m_p_root = fix(base_type::m_p_root);
p_cur = p_next;
}
m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
node_pointer p_other = other.m_p_root;
if (p_other != 0)
do
{
node_pointer p_next = p_other->m_p_next_sibling;
std::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent);
p_other = p_next;
}
while (p_other != 0);
base_type::m_p_root = join(base_type::m_p_root, other.m_p_root);
base_type::m_size += other.m_size;
m_p_max = 0;
other.m_p_root = 0;
other.m_size = 0;
other.m_p_max = 0;
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
join(node_pointer p_lhs, node_pointer p_rhs) const
{
node_pointer p_ret = 0;
node_pointer p_cur = 0;
while (p_lhs != 0 || p_rhs != 0)
{
if (p_rhs == 0)
{
if (p_cur == 0)
p_ret = p_cur = p_lhs;
else
{
p_cur->m_p_next_sibling = p_lhs;
p_lhs->m_p_prev_or_parent = p_cur;
}
p_cur = p_lhs = 0;
}
else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata)
{
if (p_cur == 0)
{
p_ret = p_cur = p_rhs;
p_rhs = p_rhs->m_p_prev_or_parent;
}
else
{
p_cur->m_p_next_sibling = p_rhs;
p_rhs = p_rhs->m_p_prev_or_parent;
p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur;
p_cur = p_cur->m_p_next_sibling;
}
}
else if (p_lhs->m_metadata < p_rhs->m_metadata)
{
if (p_cur == 0)
p_ret = p_cur = p_lhs;
else
{
p_cur->m_p_next_sibling = p_lhs;
p_lhs->m_p_prev_or_parent = p_cur;
p_cur = p_cur->m_p_next_sibling;
}
p_lhs = p_cur->m_p_next_sibling;
}
else
{
node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent;
p_rhs->m_p_next_sibling = p_lhs;
p_lhs = fix(p_rhs);
p_rhs = p_next_rhs;
}
}
if (p_cur != 0)
p_cur->m_p_next_sibling = 0;
if (p_ret != 0)
p_ret->m_p_prev_or_parent = 0;
return p_ret;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
push(*(first_it++));
PB_DS_ASSERT_VALID_COND((*this),false)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap_base() : m_p_max(0)
{
PB_DS_ASSERT_VALID_COND((*this),false)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap_base(const Cmp_Fn& r_cmp_fn)
: base_type(r_cmp_fn), m_p_max(0)
{ PB_DS_ASSERT_VALID_COND((*this),false) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
binomial_heap_base(const PB_DS_CLASS_C_DEC& other)
: base_type(other), m_p_max(0)
{ PB_DS_ASSERT_VALID_COND((*this),false) }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID_COND((*this),false)
base_type::swap(other);
std::swap(m_p_max, other.m_p_max);
PB_DS_ASSERT_VALID_COND((*this),false)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~binomial_heap_base()
{ }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file binomial_heap_base_/find_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reference
PB_DS_CLASS_C_DEC::
top() const
{
PB_DS_ASSERT_VALID_COND((*this),false)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
if (m_p_max == 0)
const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max();
_GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
return m_p_max->m_value;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
find_max()
{
node_pointer p_cur = base_type::m_p_root;
m_p_max = p_cur;
while (p_cur != 0)
{
if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value))
m_p_max = p_cur;
p_cur = p_cur->m_p_next_sibling;
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/erase_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
clear()
{
PB_DS_ASSERT_VALID((*this))
if (m_size == 0)
{
return;
}
else
{
reallocate_metadata((node_update* )this, 0);
cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
}
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
m_a_values = 0;
m_size = 0;
m_end_it = m_a_values;
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
template<typename Pred>
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
#ifdef PB_DS_REGRESSION
typename _Alloc::group_adjustor adjust(m_size);
#endif
size_type new_size = 0;
size_type num_val_ersd = 0;
for (iterator source_it = begin(); source_it != m_end_it; ++source_it)
if (!pred(*source_it))
++new_size;
else
++num_val_ersd;
if (new_size == 0)
{
clear();
return num_val_ersd;
}
value_vector a_new_values = s_value_alloc.allocate(new_size);
iterator target_it = a_new_values;
cond_dtor<size_type> cd(a_new_values, target_it, new_size);
_GLIBCXX_DEBUG_ONLY(debug_base::clear());
for (iterator source_it = begin(); source_it != m_end_it; ++source_it)
{
if (!pred(*source_it))
{
new (const_cast<void*>(static_cast<const void*>(target_it)))
value_type(*source_it);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it)));
++target_it;
}
}
reallocate_metadata((node_update*)this, new_size);
cd.set_no_action();
{
cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
}
m_a_values = a_new_values;
m_size = new_size;
m_end_it = target_it;
update(node_begin(), (node_update*)this);
PB_DS_ASSERT_VALID((*this))
return num_val_ersd;
}
PB_DS_CLASS_T_DEC
template<typename It>
It
PB_DS_CLASS_C_DEC::
erase_imp(It it)
{
PB_DS_ASSERT_VALID((*this))
if (it == end())
return end();
PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(*it))
#ifdef PB_DS_REGRESSION
typename _Alloc::group_adjustor adjust(m_size);
#endif
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
value_vector a_values = s_value_alloc.allocate(m_size - 1);
iterator source_it = begin();
iterator source_end_it = end();
iterator target_it = a_values;
iterator ret_it = end();
cond_dtor<size_type> cd(a_values, target_it, m_size - 1);
_GLIBCXX_DEBUG_ONLY(size_type cnt = 0;)
while (source_it != source_end_it)
{
if (source_it != it)
{
_GLIBCXX_DEBUG_ONLY(++cnt;)
_GLIBCXX_DEBUG_ASSERT(cnt != m_size);
new (const_cast<void*>(static_cast<const void*>(target_it)))
value_type(*source_it);
++target_it;
}
else
ret_it = target_it;
++source_it;
}
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
reallocate_metadata((node_update*)this, m_size - 1);
cd.set_no_action();
_GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(*it));)
{
cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
}
m_a_values = a_values;
--m_size;
m_end_it = m_a_values + m_size;
update(node_begin(), (node_update*)this);
PB_DS_ASSERT_VALID((*this))
return It(ret_it);
}
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
erase(key_const_reference r_key)
{
point_iterator it = find(r_key);
if (it == end())
return false;
erase(it);
return true;
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/debug_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
#ifdef _GLIBCXX_DEBUG
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
if (m_a_values == 0 || m_end_it == 0 || m_size == 0)
PB_DS_DEBUG_VERIFY(m_a_values == 0 && m_end_it == 0 && m_size == 0);
assert_iterators(__file, __line);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_iterators(const char* __file, int __line) const
{
debug_base::check_size(m_size, __file, __line);
size_type iterated_num = 0;
const_iterator prev_it = end();
PB_DS_DEBUG_VERIFY(m_end_it == m_a_values + m_size);
for (const_iterator it = begin(); it != end(); ++it)
{
++iterated_num;
debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line);
PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)) == it);
const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
--upper_bound_it;
PB_DS_DEBUG_VERIFY(upper_bound_it == it);
if (prev_it != end())
PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),
PB_DS_V2F(*it)));
prev_it = it;
}
PB_DS_DEBUG_VERIFY(iterated_num == m_size);
}
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/insert_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
reallocate_metadata(null_node_update_pointer, size_type)
{ }
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
void
PB_DS_CLASS_C_DEC::
reallocate_metadata(Node_Update_* , size_type new_size)
{
metadata_pointer a_new_metadata_vec =(new_size == 0) ? 0 : s_metadata_alloc.allocate(new_size);
if (m_a_metadata != 0)
{
for (size_type i = 0; i < m_size; ++i)
m_a_metadata[i].~metadata_type();
s_metadata_alloc.deallocate(m_a_metadata, m_size);
}
std::swap(m_a_metadata, a_new_metadata_vec);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/split_join_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (m_size == 0)
{
other.clear();
return;
}
if (Cmp_Fn::operator()(r_key, PB_DS_V2F(*begin())))
{
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(*(end() - 1))))
{
return;
}
if (m_size == 1)
{
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
iterator it = upper_bound(r_key);
PB_DS_CLASS_C_DEC new_other(other, other);
new_other.copy_from_ordered_range(it, end());
PB_DS_CLASS_C_DEC new_this(*this, *this);
new_this.copy_from_ordered_range(begin(), it);
// No exceptions from this point.
other.update(other.node_begin(), (node_update*)(&other));
update(node_begin(), (node_update*)this);
other.value_swap(new_other);
value_swap(new_this);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
if (other.m_size == 0)
return;
if (m_size == 0)
{
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
return;
}
const bool greater = Cmp_Fn::operator()(PB_DS_V2F(*(end() - 1)),
PB_DS_V2F(*other.begin()));
const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(*(other.end() - 1)),
PB_DS_V2F(*begin()));
if (!greater && !lesser)
__throw_join_error();
PB_DS_CLASS_C_DEC new_this(*this, *this);
if (greater)
new_this.copy_from_ordered_range(begin(), end(),
other.begin(), other.end());
else
new_this.copy_from_ordered_range(other.begin(), other.end(),
begin(), end());
// No exceptions from this point.
value_swap(new_this);
other.clear();
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/policy_access_fn_imps.hpp
* Contains an implementation class for ov_tree.
*/
PB_DS_CLASS_T_DEC
Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn()
{ return *this; }
PB_DS_CLASS_T_DEC
const Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn() const
{ return *this; }
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::value_allocator
PB_DS_CLASS_C_DEC::s_value_alloc;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::metadata_allocator
PB_DS_CLASS_C_DEC::s_metadata_alloc;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_NAME() :
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
m_size(0)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
cmp_fn(r_cmp_fn),
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
m_size(0)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_nodeu) :
cmp_fn(r_cmp_fn),
node_update(r_nodeu),
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
m_size(0)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef PB_DS_TREE_TRACE
trace_base(other),
#endif
cmp_fn(other),
node_update(other),
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
m_size(0)
{
copy_from_ordered_range(other.begin(), other.end());
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
template<typename It>
inline void
PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
typedef std::map<key_type, mapped_type, Cmp_Fn,
typename _Alloc::template rebind<value_type>::other>
map_type;
#else
typedef std::set<key_type, Cmp_Fn,
typename _Alloc::template rebind<Key>::other>
map_type;
#endif
map_type m(first_it, last_it);
copy_from_ordered_range(m.begin(), m.end());
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_ordered_range(It first_it, It last_it)
{
const size_type len = std::distance(first_it, last_it);
if (len == 0)
return;
value_vector a_values = s_value_alloc.allocate(len);
iterator target_it = a_values;
It source_it = first_it;
It source_end_it = last_it;
cond_dtor<size_type> cd(a_values, target_it, len);
while (source_it != source_end_it)
{
void* __v = const_cast<void*>(static_cast<const void*>(target_it));
new (__v) value_type(*source_it++);
++target_it;
}
reallocate_metadata((node_update*)this, len);
cd.set_no_action();
m_a_values = a_values;
m_size = len;
m_end_it = m_a_values + m_size;
update(PB_DS_node_begin_imp(), (node_update*)this);
#ifdef _GLIBCXX_DEBUG
for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
debug_base::insert_new(PB_DS_V2F(*dbg_it));
#endif
}
PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
copy_from_ordered_range(It first_it, It last_it, It other_first_it,
It other_last_it)
{
clear();
const size_type len = std::distance(first_it, last_it)
+ std::distance(other_first_it, other_last_it);
value_vector a_values = s_value_alloc.allocate(len);
iterator target_it = a_values;
It source_it = first_it;
It source_end_it = last_it;
cond_dtor<size_type> cd(a_values, target_it, len);
while (source_it != source_end_it)
{
new (const_cast<void* >(static_cast<const void* >(target_it)))
value_type(*source_it++);
++target_it;
}
source_it = other_first_it;
source_end_it = other_last_it;
while (source_it != source_end_it)
{
new (const_cast<void* >(static_cast<const void* >(target_it)))
value_type(*source_it++);
++target_it;
}
reallocate_metadata((node_update* )this, len);
cd.set_no_action();
m_a_values = a_values;
m_size = len;
m_end_it = m_a_values + m_size;
update(PB_DS_node_begin_imp(), (node_update* )this);
#ifdef _GLIBCXX_DEBUG
for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
debug_base::insert_new(PB_DS_V2F(*dbg_it));
#endif
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
value_swap(other);
std::swap(static_cast<cmp_fn&>(*this),
static_cast<cmp_fn&>(other));
std::swap(static_cast<traits_base&>(*this),
static_cast<traits_base&>(other));
PB_DS_ASSERT_VALID(other)
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
_GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_a_values, other.m_a_values);
std::swap(m_a_metadata, other.m_a_metadata);
std::swap(m_size, other.m_size);
std::swap(m_end_it, other.m_end_it);
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
~PB_DS_OV_TREE_NAME()
{
PB_DS_ASSERT_VALID((*this))
cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
reallocate_metadata((node_update*)this, 0);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
update(node_iterator, null_node_update_pointer)
{ }
PB_DS_CLASS_T_DEC
template<typename Node_Update>
void
PB_DS_CLASS_C_DEC::
update(node_iterator nd_it, Node_Update* p_update)
{
node_const_iterator end_it = PB_DS_node_end_imp();
if (nd_it != end_it)
{
update(nd_it.get_l_child(), p_update);
update(nd_it.get_r_child(), p_update);
node_update::operator()(nd_it, end_it);
}
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/node_iterators.hpp
* Contains an implementation class for ov_tree_.
*/
#ifndef PB_DS_OV_TREE_NODE_ITERATORS_HPP
#define PB_DS_OV_TREE_NODE_ITERATORS_HPP
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC \
ov_tree_node_const_it_<Value_Type, Metadata_Type, _Alloc>
/// Const node reference.
template<typename Value_Type, typename Metadata_Type, typename _Alloc>
class ov_tree_node_const_it_
{
protected:
typedef
typename _Alloc::template rebind<
Value_Type>::other::pointer
pointer;
typedef
typename _Alloc::template rebind<
Value_Type>::other::const_pointer
const_pointer;
typedef
typename _Alloc::template rebind<
Metadata_Type>::other::const_pointer
const_metadata_pointer;
typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC this_type;
protected:
template<typename Ptr>
inline static Ptr
mid_pointer(Ptr p_begin, Ptr p_end)
{
_GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);
return (p_begin + (p_end - p_begin) / 2);
}
public:
typedef trivial_iterator_tag iterator_category;
typedef trivial_iterator_difference_type difference_type;
typedef
typename _Alloc::template rebind<
Value_Type>::other::const_pointer
value_type;
typedef
typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::const_pointer
reference;
typedef
typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::const_pointer
const_reference;
typedef Metadata_Type metadata_type;
typedef
typename _Alloc::template rebind<
metadata_type>::other::const_reference
metadata_const_reference;
public:
inline
ov_tree_node_const_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : m_p_value(const_cast<pointer>(p_nd)), m_p_begin_value(const_cast<pointer>(p_begin_nd)), m_p_end_value(const_cast<pointer>(p_end_nd)), m_p_metadata(p_metadata)
{ }
inline const_reference
operator*() const
{ return m_p_value; }
inline metadata_const_reference
get_metadata() const
{
enum
{
has_metadata = !is_same<Metadata_Type, null_type>::value
};
PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);
_GLIBCXX_DEBUG_ASSERT(m_p_metadata != 0);
return *m_p_metadata;
}
/// Returns the node iterator associated with the left node.
inline this_type
get_l_child() const
{
if (m_p_begin_value == m_p_value)
return (this_type(m_p_begin_value, m_p_begin_value, m_p_begin_value));
const_metadata_pointer p_begin_metadata =
m_p_metadata - (m_p_value - m_p_begin_value);
return (this_type(mid_pointer(m_p_begin_value, m_p_value),
m_p_begin_value,
m_p_value,
mid_pointer(p_begin_metadata, m_p_metadata)));
}
/// Returns the node iterator associated with the right node.
inline this_type
get_r_child() const
{
if (m_p_value == m_p_end_value)
return (this_type(m_p_end_value, m_p_end_value, m_p_end_value));
const_metadata_pointer p_end_metadata =
m_p_metadata + (m_p_end_value - m_p_value);
return (this_type(mid_pointer(m_p_value + 1, m_p_end_value),
m_p_value + 1,
m_p_end_value,(m_p_metadata == 0) ?
0 : mid_pointer(m_p_metadata + 1, p_end_metadata)));
}
inline bool
operator==(const this_type& other) const
{
const bool is_end = m_p_begin_value == m_p_end_value;
const bool is_other_end = other.m_p_begin_value == other.m_p_end_value;
if (is_end)
return (is_other_end);
if (is_other_end)
return (is_end);
return m_p_value == other.m_p_value;
}
inline bool
operator!=(const this_type& other) const
{ return !operator==(other); }
public:
pointer m_p_value;
pointer m_p_begin_value;
pointer m_p_end_value;
const_metadata_pointer m_p_metadata;
};
#define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \
ov_tree_node_it_<Value_Type, Metadata_Type, _Alloc>
/// Node reference.
template<typename Value_Type, typename Metadata_Type, typename _Alloc>
class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
{
private:
typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type;
typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC base_type;
typedef typename base_type::pointer pointer;
typedef typename base_type::const_pointer const_pointer;
typedef
typename base_type::const_metadata_pointer
const_metadata_pointer;
public:
typedef trivial_iterator_tag iterator_category;
typedef trivial_iterator_difference_type difference_type;
typedef
typename _Alloc::template rebind<
Value_Type>::other::pointer
value_type;
typedef
typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::pointer
reference;
typedef
typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::pointer
const_reference;
inline
ov_tree_node_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata)
{ }
/// Access.
inline reference
operator*() const
{ return reference(base_type::m_p_value); }
/// Returns the node reference associated with the left node.
inline ov_tree_node_it_
get_l_child() const
{
if (base_type::m_p_begin_value == base_type::m_p_value)
return (this_type(base_type::m_p_begin_value, base_type::m_p_begin_value, base_type::m_p_begin_value));
const_metadata_pointer p_begin_metadata =
base_type::m_p_metadata - (base_type::m_p_value - base_type::m_p_begin_value);
return (this_type(base_type::mid_pointer(base_type::m_p_begin_value, base_type::m_p_value),
base_type::m_p_begin_value,
base_type::m_p_value,
base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata)));
}
/// Returns the node reference associated with the right node.
inline ov_tree_node_it_
get_r_child() const
{
if (base_type::m_p_value == base_type::m_p_end_value)
return this_type(base_type::m_p_end_value, base_type::m_p_end_value,
base_type::m_p_end_value);
const_metadata_pointer p_end_metadata =
base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value);
return (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value),
base_type::m_p_value + 1,
base_type::m_p_end_value,(base_type::m_p_metadata == 0)?
0 : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata)));
}
};
#undef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC
#undef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
} // namespace detail
} // namespace __gnu_pbds
#endif
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/iterators_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_begin() const
{ return PB_DS_node_begin_imp(); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_end() const
{ return PB_DS_node_end_imp(); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_begin()
{ return PB_DS_node_begin_imp(); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
node_end()
{ return PB_DS_node_end_imp(); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
PB_DS_node_begin_imp() const
{
return node_const_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
const_cast<pointer>(begin()),
const_cast<pointer>(end()),(m_a_metadata == 0)?
0 :
mid_pointer(m_a_metadata, m_a_metadata + m_size));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
PB_DS_node_end_imp() const
{
return node_const_iterator(end(), end(), end(),
(m_a_metadata == 0) ? 0 : m_a_metadata + m_size);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
PB_DS_node_begin_imp()
{
return node_iterator(mid_pointer(begin(), end()), begin(), end(),
(m_a_metadata == 0) ? 0 : mid_pointer(m_a_metadata, m_a_metadata + m_size));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
PB_DS_node_end_imp()
{
return node_iterator(end(), end(),
end(),(m_a_metadata == 0) ? 0 : m_a_metadata + m_size);
}
// -*- C++ -*-
// Copyright (C) 2005-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file ov_tree_map_/ov_tree_map_.hpp
* Contains an implementation class for ov_tree.
*/
#include <map>
#include <set>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/tree_trace_base.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
#include <utility>
#include <functional>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
#define PB_DS_OV_TREE_NAME ov_tree_map
#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
#define PB_DS_OV_TREE_NAME ov_tree_set
#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_set
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Cmp_Fn, \
typename Node_And_It_Traits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
PB_DS_OV_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
#define PB_DS_OV_TREE_TRAITS_BASE \
types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
typename _Alloc::template rebind<Key>::other::const_reference>
#endif
#ifdef PB_DS_TREE_TRACE
#define PB_DS_TREE_TRACE_BASE_C_DEC \
tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \
typename Node_And_It_Traits::node_iterator, \
Cmp_Fn, false, _Alloc>
#endif
#ifndef PB_DS_CHECK_KEY_EXISTS
# error Missing definition
#endif
/**
* @brief Ordered-vector tree associative-container.
* @ingroup branch-detail
*/
template<typename Key, typename Mapped, typename Cmp_Fn,
typename Node_And_It_Traits, typename _Alloc>
class PB_DS_OV_TREE_NAME :
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
#endif
#ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC,
#endif
public Cmp_Fn,
public Node_And_It_Traits::node_update,
public PB_DS_OV_TREE_TRAITS_BASE
{
private:
typedef PB_DS_OV_TREE_TRAITS_BASE traits_base;
typedef Node_And_It_Traits traits_type;
typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type;
typedef typename _Alloc::template rebind<non_const_value_type>::other value_allocator;
typedef typename value_allocator::pointer value_vector;
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
#endif
#ifdef PB_DS_TREE_TRACE
typedef PB_DS_TREE_TRACE_BASE_C_DEC trace_base;
#endif
typedef typename traits_base::pointer mapped_pointer_;
typedef typename traits_base::const_pointer mapped_const_pointer_;
typedef typename traits_type::metadata_type metadata_type;
typedef typename _Alloc::template rebind<metadata_type>